本文整理汇总了PHP中messenger函数的典型用法代码示例。如果您正苦于以下问题:PHP messenger函数的具体用法?PHP messenger怎么用?PHP messenger使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了messenger函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: page_delete
function page_delete()
{
if (ps('name') == 'default') {
return page_edit();
}
$name = doSlash(ps('name'));
safe_delete("txp_page", "name='{$name}'");
page_edit(messenger('page', $name, 'deleted'));
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:9,代码来源:txp_page.php
示例2: thumbnail_create
function thumbnail_create()
{
extract(doSlash(gpsa(array('id', 'width', 'height'))));
// better checking of thumbnail dimensions
// don't try and use zeros
$width = (int) $width;
$height = (int) $height;
if ($width == 0 && $height == 0) {
image_edit(messenger('invalid_width_or_height', "({$width})/({$height})", ''), $id);
return;
} else {
if ($width == 0) {
$width = '';
}
if ($height == 0) {
$height = '';
}
}
$crop = gps('crop');
$t = new txp_thumb($id);
$t->crop = $crop == '1';
$t->hint = '0';
$t->width = $width;
$t->height = $height;
if ($t->write()) {
global $prefs;
$prefs['thumb_w'] = $width;
$prefs['thumb_h'] = $height;
$prefs['thumb_crop'] = $crop;
// hidden prefs
set_pref('thumb_w', $width, 'image', 2);
set_pref('thumb_h', $height, 'image', 2);
set_pref('thumb_crop', $crop, 'image', 2);
$message = gTxt('thumbnail_saved', array('{id}' => $id));
update_lastmod();
image_edit($message, $id);
} else {
$message = gTxt('thumbnail_not_saved', array('{id}' => $id));
image_edit($message, $id);
}
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:41,代码来源:txp_image.php
示例3: ign_user_delete
function ign_user_delete()
{
global $ign_user_db;
$user_id = ps('user_id');
$name = fetch('Realname', $ign_user_db, 'user_id', $user_id);
if ($name) {
$rs = safe_delete($ign_user_db, "user_id = '{$user_id}'");
if ($rs) {
ign_admin(messenger('user', $name, 'deleted'));
}
}
}
开发者ID:netcarver,项目名称:ign_password_protect,代码行数:12,代码来源:ign_password_protect.php
示例4: file_delete
function file_delete($ids = array())
{
global $file_base_path;
$ids = $ids ? array_map('assert_int', $ids) : array(assert_int(ps('id')));
$fail = array();
$rs = safe_rows_start('id, filename', 'txp_file', 'id IN (' . join(',', $ids) . ')');
if ($rs) {
while ($a = nextRow($rs)) {
extract($a);
$filepath = build_file_path($file_base_path, $filename);
$rsd = safe_delete('txp_file', "id = {$id}");
$ul = false;
if ($rsd && is_file($filepath)) {
$ul = unlink($filepath);
}
if (!$rsd or !$ul) {
$fail[] = $id;
}
}
if ($fail) {
file_list(messenger(gTxt('file_delete_failed'), join(', ', $fail), ''));
} else {
file_list(gTxt('file_deleted', array('{name}' => join(', ', $ids))));
}
} else {
file_list(messenger(gTxt('file_not_found'), join(', ', $ids), ''));
}
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:28,代码来源:txp_file.php
示例5: discuss_multi_edit
function discuss_multi_edit()
{
$parentid = safe_field("txp_discuss", "parentid", "parentid=" . doSlash(ps('discussid')));
$deleted = event_multi_edit('txp_discuss', 'discussid');
if (!empty($deleted)) {
// might as well clean up all comment counts while we're here.
clean_comment_counts();
return discuss_list(messenger('comment', $deleted, 'deleted'));
}
return discuss_list();
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:11,代码来源:txp_discuss.php
示例6: list_multi_edit
//.........这里部分代码省略.........
foreach ($selected as $id) {
$author = safe_field('AuthorID', 'textpattern', "ID = {$id}");
if ($author == $txp_user) {
$allowed[] = $id;
}
}
}
$selected = $allowed;
}
foreach ($selected as $id) {
if (safe_delete('textpattern', "ID = {$id}")) {
$ids[] = $id;
}
}
$changed = join(', ', $ids);
if ($changed) {
safe_update('txp_discuss', "visible = " . MODERATE, "parentid in({$changed})");
}
} else {
$selected = array_map('assert_int', $selected);
$selected = safe_rows('ID, AuthorID, Status', 'textpattern', 'ID in (' . implode(',', $selected) . ')');
$allowed = array();
foreach ($selected as $item) {
if ($item['Status'] >= 4 and has_privs('article.edit.published') or $item['Status'] >= 4 and $item['AuthorID'] == $txp_user and has_privs('article.edit.own.published') or $item['Status'] < 4 and has_privs('article.edit') or $item['Status'] < 4 and $item['AuthorID'] == $txp_user and has_privs('article.edit.own')) {
$allowed[] = $item['ID'];
}
}
$selected = $allowed;
unset($allowed);
switch ($method) {
// change author
case 'changeauthor':
$key = 'AuthorID';
$val = has_privs('article.edit') ? ps('AuthorID') : '';
// do not allow to be set to an empty value
if (!$val) {
$selected = array();
}
break;
// change category1
// change category1
case 'changecategory1':
$key = 'Category1';
$val = ps('Category1');
break;
// change category2
// change category2
case 'changecategory2':
$key = 'Category2';
$val = ps('Category2');
break;
// change comments
// change comments
case 'changecomments':
$key = 'Annotate';
$val = (int) ps('Annotate');
break;
// change section
// change section
case 'changesection':
$key = 'Section';
$val = ps('Section');
// do not allow to be set to an empty value
if (!$val) {
$selected = array();
}
break;
// change status
// change status
case 'changestatus':
$key = 'Status';
$val = ps('Status');
if (!has_privs('article.publish') && $val >= 4) {
$val = 3;
}
// do not allow to be set to an empty value
if (!$val) {
$selected = array();
}
break;
default:
$key = '';
$val = '';
break;
}
if ($selected and $key) {
foreach ($selected as $id) {
if (safe_update('textpattern', "{$key} = '" . doSlash($val) . "'", "ID = {$id}")) {
$ids[] = $id;
}
}
$changed = join(', ', $ids);
}
}
if ($changed) {
update_lastmod();
return list_list(messenger('article', $changed, $method == 'delete' ? 'deleted' : 'modified'));
}
return list_list();
}
开发者ID:joebushi,项目名称:textpattern,代码行数:101,代码来源:txp_list.php
示例7: author_delete
function author_delete()
{
$user_id = ps('user_id');
$name = fetch('Realname', 'txp_users', 'user_id', $user_id);
if ($name) {
$rs = safe_delete("txp_users", "user_id = '{$user_id}'");
if ($rs) {
admin(messenger('author', $name, 'deleted'));
}
}
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:11,代码来源:txp_admin.php
示例8: file_delete
function file_delete()
{
global $txpcfg, $file_base_path;
extract($txpcfg);
$id = ps('id');
$rs = safe_row("*", "txp_file", "id='{$id}'");
if ($rs) {
extract($rs);
$filepath = build_file_path($file_base_path, $filename);
$rsd = safe_delete("txp_file", "id='{$id}'");
$ul = false;
if ($rsd && is_file($filepath)) {
$ul = unlink($filepath);
}
if ($rsd && $ul) {
file_list(messenger(gTxt('file'), $filename, gTxt('deleted')));
return;
} else {
file_list(messenger(gTxt('file_delete_failed'), $filename, ''));
}
} else {
file_list(messenger(gTxt('file_not_found'), $filename, ''));
}
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:24,代码来源:txp_file.php
示例9: css_delete
function css_delete()
{
$name = ps('name');
if ($name != 'default') {
safe_delete("txp_css", "name = '{$name}'");
css_edit(messenger('css', $name, 'deleted'));
} else {
echo gTxt('cannot_delete_default_css') . '.';
}
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:10,代码来源:txp_css.php
示例10: list_multi_edit
//.........这里部分代码省略.........
$changed = false;
$ids = array();
$key = '';
if ($method == 'delete') {
if (!has_privs('article.delete')) {
$allowed = array();
if (has_privs('article.delete.own')) {
$allowed = safe_column_num('ID', 'textpattern', 'ID in(' . join(',', $selected) . ') and AuthorID=\'' . doSlash($txp_user) . '\'');
}
$selected = $allowed;
}
foreach ($selected as $id) {
if (safe_delete('textpattern', "ID = {$id}")) {
$ids[] = $id;
}
}
$changed = join(', ', $ids);
if ($changed) {
safe_update('txp_discuss', "visible = " . MODERATE, "parentid in({$changed})");
callback_event('articles_deleted', '', 0, $ids);
}
} else {
$selected = safe_rows('ID, AuthorID, Status', 'textpattern', 'ID in (' . implode(',', $selected) . ')');
$allowed = array();
foreach ($selected as $item) {
if ($item['Status'] >= STATUS_LIVE and has_privs('article.edit.published') or $item['Status'] >= STATUS_LIVE and $item['AuthorID'] == $txp_user and has_privs('article.edit.own.published') or $item['Status'] < STATUS_LIVE and has_privs('article.edit') or $item['Status'] < STATUS_LIVE and $item['AuthorID'] == $txp_user and has_privs('article.edit.own')) {
$allowed[] = $item['ID'];
}
}
$selected = $allowed;
unset($allowed);
switch ($method) {
// change author
case 'changeauthor':
$val = has_privs('article.edit') ? ps('AuthorID') : '';
if (in_array($val, $all_authors)) {
$key = 'AuthorID';
}
break;
// change category1
// change category1
case 'changecategory1':
$val = ps('Category1');
if (in_array($val, $categories)) {
$key = 'Category1';
}
break;
// change category2
// change category2
case 'changecategory2':
$val = ps('Category2');
if (in_array($val, $categories)) {
$key = 'Category2';
}
break;
// change comments
// change comments
case 'changecomments':
$key = 'Annotate';
$val = (int) ps('Annotate');
break;
// change section
// change section
case 'changesection':
$val = ps('Section');
if (in_array($val, $all_sections)) {
$key = 'Section';
}
break;
// change status
// change status
case 'changestatus':
$val = (int) ps('Status');
if (array_key_exists($val, $statuses)) {
$key = 'Status';
}
if (!has_privs('article.publish') && $val >= STATUS_LIVE) {
$val = STATUS_PENDING;
}
break;
default:
$key = '';
$val = '';
break;
}
if ($selected and $key) {
foreach ($selected as $id) {
if (safe_update('textpattern', "{$key} = '" . doSlash($val) . "'", "ID = {$id}")) {
$ids[] = $id;
}
}
$changed = join(', ', $ids);
}
}
if ($changed) {
update_lastmod();
return list_list(messenger('article', $changed, $method == 'delete' ? 'deleted' : 'modified'));
}
return list_list();
}
开发者ID:balcides,项目名称:Cathartic_server,代码行数:101,代码来源:txp_list.php
示例11: discuss_multi_edit
function discuss_multi_edit()
{
$selected = ps('selected');
if ($selected) {
// Get all articles for which we have to update the count
foreach ($selected as $id) {
$to_delete[] = intval($id);
}
$parentids = safe_rows("DISTINCT parentid", "txp_discuss", "discussid IN (" . implode(',', $to_delete) . ")");
foreach ($parentids as $key => $value) {
$parentids[$key] = $value['parentid'];
}
// Delete and if succesful update commnet count
$deleted = event_multi_edit('txp_discuss', 'discussid');
if (!empty($deleted)) {
// might as well clean up all comment counts while we're here.
clean_comment_counts($parentids);
return discuss_list(messenger('comment', $deleted, 'deleted'));
}
}
return discuss_list();
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:22,代码来源:txp_discuss.php
示例12: product_multi_edit
function product_multi_edit()
{
global $txp_user;
$selected = ps('selected');
if (!$selected) {
return products_list();
}
$method = ps('edit_method');
$changed = false;
$ids = array();
if ($method == 'delete') {
if (!has_privs('article.delete')) {
$allowed = array();
if (has_privs('article.delete.own')) {
foreach ($selected as $id) {
$id = assert_int($id);
$author = safe_field('AuthorID', 'textpattern', "ID = {$id}");
if ($author == $txp_user) {
$allowed[] = $id;
}
}
}
$selected = $allowed;
}
foreach ($selected as $id) {
$id = assert_int($id);
if (safe_delete('textpattern', "ID = {$id}")) {
$ids[] = $id;
}
}
$changed = join(', ', $ids);
}
if ($changed) {
return products_list(messenger('Product', $changed, $method == 'delete' ? 'deleted' : 'modified'));
}
return products_list();
}
开发者ID:duongcuong96,项目名称:textcommerce,代码行数:37,代码来源:ln_txp_commerce.php
示例13: event_category_save
function event_category_save($evname, $table_name)
{
global $txpcfg;
//Prevent non url chars on category names
include_once $txpcfg['txpath'] . '/lib/classTextile.php';
$textile = new Textile();
$in = psa(array('id', 'name', 'old_name', 'parent', 'title'));
extract(doSlash($in));
$title = $textile->TextileThis($title, 1);
$name = dumbDown($textile->TextileThis($name, 1));
$name = preg_replace("/[^[:alnum:]\\-_]/", "", str_replace(" ", "-", $name));
$parent = $parent ? $parent : 'root';
safe_update("txp_category", "name='{$name}',parent='{$parent}',title='{$title}'", "id={$id}");
rebuild_tree('root', 1, $evname);
if ($evname == 'article') {
safe_update("textpattern", "Category1='{$name}'", "Category1 = '{$old_name}'");
safe_update("textpattern", "Category2='{$name}'", "Category2 = '{$old_name}'");
} else {
safe_update($table_name, "category='{$name}'", "category='{$old_name}'");
}
category_list(messenger($evname . '_category', stripslashes($name), 'saved'));
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:22,代码来源:txp_category.php
示例14: form_save
function form_save()
{
global $vars;
extract(doSlash(gpsa($vars)));
if ($savenew) {
if (safe_insert("txp_form", "Form='{$Form}', type='{$type}', name='{$name}'")) {
form_edit(messenger('form', $name, 'created'));
} else {
form_edit(messenger('form', $name, 'already_exists'));
}
} else {
safe_update("txp_form", "Form='{$Form}',type='{$type}',name='{$name}'", "name='{$oldname}'");
form_edit(messenger('form', $name, 'updated'));
}
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:15,代码来源:txp_form.php
示例15: permlinks_multi_edit
function permlinks_multi_edit()
{
$method = gps('edit_method') ? gps('edit_method') : gps('method');
// Up to Txp 4.0.3
switch ($method) {
case 'delete':
foreach (gps('selected') as $id) {
$deleted[] = $this->parent->remove_permlink($id);
}
break;
}
$this->parent->message = isset($deleted) && is_array($deleted) && count($deleted) ? messenger('', join(', ', $deleted), 'deleted') : messenger('an error occurred', '', '');
}
开发者ID:gbp,项目名称:gbp_permanent_links,代码行数:13,代码来源:gbp_permanent_links.php
示例16: thumbnail_create_post
function thumbnail_create_post()
{
$id = $this->psi('id');
extract(doSlash(gpsa(array('thumbnail_clear_settings', 'thumbnail_delete', 'width', 'height', 'crop'))));
if ($thumbnail_clear_settings) {
$message = $this->thumbnail_clear_settings($id);
} elseif ($thumbnail_delete) {
$message = $this->thumbnail_delete($id);
} else {
$width = (int) $width;
$height = (int) $height;
if ($width != 0 || $height != 0) {
if (img_makethumb($id, $width, $height, $crop)) {
global $prefs;
if ($width == 0) {
$width = '';
}
if ($height == 0) {
$height = '';
}
$prefs['thumb_w'] = $width;
$prefs['thumb_h'] = $height;
$prefs['thumb_crop'] = $crop;
// hidden prefs
set_pref('thumb_w', $width, 'image', 2);
set_pref('thumb_h', $height, 'image', 2);
set_pref('thumb_crop', $crop, 'image', 2);
update_lastmod();
$message = gTxt('thumbnail_saved', array('{id}' => $id));
} else {
$message = gTxt('thumbnail_not_saved', array('{id}' => $id));
}
} else {
$message = messenger('invalid_width_or_height', "({$width})/({$height})", '');
}
}
$this->_message($message);
$this->_set_view('edit', $id);
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:39,代码来源:txp_image.php
示例17: link_multi_edit
function link_multi_edit()
{
$method = ps('method');
$things = ps('selected');
if ($things) {
if ($method == 'delete') {
foreach ($things as $id) {
if (safe_delete('txp_link', "id='{$id}'")) {
$ids[] = $id;
}
}
link_edit(messenger('link', join(', ', $ids), 'deleted'));
} else {
link_edit();
}
} else {
link_edit();
}
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:19,代码来源:txp_link.php
示例18: div_save
function div_save()
{
extract(gpsa(array('html_array', 'html', 'start_pos', 'stop_pos', 'name')));
$html_array = unserialize($html_array);
$repl_array = preg_split("/(<.*>)/U", $html, -1, PREG_SPLIT_DELIM_CAPTURE);
array_splice($html_array, $start_pos, $stop_pos - $start_pos + 1, $repl_array);
$html = doSlash(join('', $html_array));
safe_update("txp_page", "user_html='{$html}'", "name='{$name}'");
page_edit(messenger('page', $name, 'updated'));
# print_r($html_array);
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:11,代码来源:txp_page.php
示例19: discuss_multi_edit
function discuss_multi_edit()
{
//FIXME, this method needs some refactoring
$selected = ps('selected');
$method = ps('method');
$done = array();
if ($selected) {
// Get all articles for which we have to update the count
foreach ($selected as $id) {
$ids[] = "'" . intval($id) . "'";
}
$parentids = safe_column("DISTINCT parentid", "txp_discuss", "discussid IN (" . implode(',', $ids) . ")");
$rs = safe_rows_start('*', 'txp_discuss', "discussid IN (" . implode(',', $ids) . ")");
while ($row = nextRow($rs)) {
extract($row);
$id = intval($discussid);
$parentids[] = $parentid;
if ($method == 'delete') {
// Delete and if succesful update commnet count
if (safe_delete('txp_discuss', "discussid='{$id}'")) {
$done[] = $id;
}
} elseif ($method == 'ban') {
// Ban the IP and hide all messages by that IP
if (!safe_field('ip', 'txp_discuss_ipban', "ip='" . doSlash($ip) . "'")) {
safe_insert("txp_discuss_ipban", "ip = '" . doSlash($ip) . "',\n\t\t\t\t\t\t\tname_used = '" . doSlash($name) . "',\n\t\t\t\t\t\t\tbanned_on_message = '" . doSlash($discussid) . "',\n\t\t\t\t\t\t\tdate_banned = now()\n\t\t\t\t\t\t");
safe_update('txp_discuss', "visible = " . SPAM, "ip='" . doSlash($ip) . "'");
}
$done[] = $id;
} elseif ($method == 'spam') {
if (safe_update('txp_discuss', "visible = " . SPAM, "discussid = {$id}")) {
$done[] = $id;
}
} elseif ($method == 'unmoderated') {
if (safe_update('txp_discuss', "visible = " . MODERATE, "discussid = {$id}")) {
$done[] = $id;
}
} elseif ($method == 'visible') {
if (safe_update('txp_discuss', "visible = " . VISIBLE, "discussid = {$id}")) {
$done[] = $id;
}
}
}
$done = join(', ', $done);
if (!empty($done)) {
// might as well clean up all comment counts while we're here.
clean_comment_counts($parentids);
$messages = array('delete' => messenger('comment', $done, 'deleted'), 'ban' => messenger('comment', $done, 'banned'), 'spam' => gTxt('comment') . ' ' . strong($done) . ' ' . gTxt('marked_as') . ' ' . gTxt('spam'), 'unmoderated' => gTxt('comment') . ' ' . strong($done) . ' ' . gTxt('marked_as') . ' ' . gTxt('unmoderated'), 'visible' => gTxt('comment') . ' ' . strong($done) . ' ' . gTxt('marked_as') . ' ' . gTxt('visible'));
return discuss_list($messages[$method]);
}
}
return discuss_list();
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:53,代码来源:txp_discuss.php
示例20: discuss_multi_edit
function discuss_multi_edit()
{
$method = ps('method');
$things = ps('selected');
if ($things) {
if ($method == 'delete') {
foreach ($things as $discussid) {
if (safe_delete('txp_discuss', "discussid='{$discussid}'")) {
$ids[] = $id;
}
}
discuss_list(messenger('comment', join(', ', $ids), 'deleted'));
} else {
discuss_list();
}
} else {
discuss_list();
}
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:19,代码来源:txp_discuss.php
注:本文中的messenger函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论