本文整理匯總了PHP中messenger函數的典型用法代碼示例。如果您正苦於以下問題:PHP messenger函數的具體用法?PHP messenger怎麽用?PHP messenger使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了messenger函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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'));
}
示例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);
}
}
示例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'));
}
}
}
示例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), ''));
}
}
示例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();
}
示例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();
}
示例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'));
}
}
}
示例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, ''));
}
}
示例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') . '.';
}
}
示例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();
}
示例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();
}
示例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();
}
示例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'));
}
示例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'));
}
}
示例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', '', '');
}