本文整理汇总了PHP中dcPage::addSuccessNotice方法的典型用法代码示例。如果您正苦于以下问题:PHP dcPage::addSuccessNotice方法的具体用法?PHP dcPage::addSuccessNotice怎么用?PHP dcPage::addSuccessNotice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dcPage
的用法示例。
在下文中一共展示了dcPage::addSuccessNotice方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gui
public function gui($url)
{
$bls = $this->getServers();
if (isset($_POST['bls'])) {
try {
$this->core->blog->settings->addNamespace('antispam');
$this->core->blog->settings->antispam->put('antispam_dnsbls', $_POST['bls'], 'string', 'Antispam DNSBL servers', true, false);
dcPage::addSuccessNotice(__('The list of DNSBL servers has been succesfully updated.'));
http::redirect($url);
} catch (Exception $e) {
$core->error->add($e->getMessage());
}
}
/* DISPLAY
---------------------------------------------- */
$res = dcPage::notices();
$res .= '<form action="' . html::escapeURL($url) . '" method="post" class="fieldset">' . '<h3>' . __('IP Lookup servers') . '</h3>' . '<p><label for="bls">' . __('Add here a coma separated list of servers.') . '</label>' . form::textarea('bls', 40, 3, html::escapeHTML($bls), 'maximal') . '</p>' . '<p><input type="submit" value="' . __('Save') . '" />' . $this->core->formNonce() . '</p>' . '</form>';
return $res;
}
示例2: doReorderPages
public static function doReorderPages($core, dcPostsActionsPage $ap, $post)
{
foreach ($post['order'] as $post_id => $value) {
if (!$core->auth->check('publish,contentadmin', $core->blog->id)) {
throw new Exception(__('You are not allowed to change this entry status'));
}
$strReq = "WHERE blog_id = '" . $core->con->escape($core->blog->id) . "' " . "AND post_id " . $core->con->in($post_id);
#If user can only publish, we need to check the post's owner
if (!$core->auth->check('contentadmin', $core->blog->id)) {
$strReq .= "AND user_id = '" . $core->con->escape($core->auth->userID()) . "' ";
}
$cur = $core->con->openCursor($core->prefix . 'post');
$cur->post_position = (int) $value - 1;
$cur->post_upddt = date('Y-m-d H:i:s');
$cur->update($strReq);
$core->blog->triggerBlog();
}
dcPage::addSuccessNotice(__('Selected pages have been successfully reordered.'));
$ap->redirect(false);
}
示例3: gui
public function gui($url)
{
global $default_tab;
$core =& $this->core;
# Set current type and tab
$ip_type = 'black';
if (!empty($_REQUEST['ip_type']) && $_REQUEST['ip_type'] == 'white') {
$ip_type = 'white';
}
$default_tab = 'tab_' . $ip_type;
# Add IP to list
if (!empty($_POST['addip'])) {
try {
$global = !empty($_POST['globalip']) && $core->auth->isSuperAdmin();
$this->addIP($ip_type, $_POST['addip'], $global);
dcPage::addSuccessNotice(__('IP address has been successfully added.'));
http::redirect($url . '&ip_type=' . $ip_type);
} catch (Exception $e) {
$core->error->add($e->getMessage());
}
}
# Remove IP from list
if (!empty($_POST['delip']) && is_array($_POST['delip'])) {
try {
$this->removeRule($_POST['delip']);
dcPage::addSuccessNotice(__('IP addresses have been successfully removed.'));
http::redirect($url . '&ip_type=' . $ip_type);
} catch (Exception $e) {
$core->error->add($e->getMessage());
}
}
/* DISPLAY
---------------------------------------------- */
$res = dcPage::notices();
$res .= $this->displayForms($url, 'black', __('Blacklist')) . $this->displayForms($url, 'white', __('Whitelist'));
return $res;
}
示例4: gui
public function gui($url)
{
$blog =& $this->core->blog;
$blog->settings->addNamespace('akismet');
$ak_key = $blog->settings->akismet->ak_key;
$ak_verified = null;
if (isset($_POST['ak_key'])) {
try {
$ak_key = $_POST['ak_key'];
$blog->settings->akismet->put('ak_key', $ak_key, 'string');
dcPage::addSuccessNotice(__('Filter configuration have been successfully saved.'));
http::redirect($url);
} catch (Exception $e) {
$this->core->error->add($e->getMessage());
}
}
if ($blog->settings->akismet->ak_key) {
try {
$ak = new akismet($blog->url, $blog->settings->akismet->ak_key);
$ak_verified = $ak->verify();
} catch (Exception $e) {
$this->core->error->add($e->getMessage());
}
}
$res = dcPage::notices();
$res .= '<form action="' . html::escapeURL($url) . '" method="post" class="fieldset">' . '<p><label for="ak_key" class="classic">' . __('Akismet API key:') . '</label> ' . form::field('ak_key', 12, 128, $ak_key);
if ($ak_verified !== null) {
if ($ak_verified) {
$res .= ' <img src="images/check-on.png" alt="" /> ' . __('API key verified');
} else {
$res .= ' <img src="images/check-off.png" alt="" /> ' . __('API key not verified');
}
}
$res .= '</p>';
$res .= '<p><a href="http://akismet.com/">' . __('Get your own API key') . '</a></p>' . '<p><input type="submit" value="' . __('Save') . '" />' . $this->core->formNonce() . '</p>' . '</form>';
return $res;
}
示例5: adminRemoveTags
public static function adminRemoveTags($core, dcPostsActionsPage $ap, $post)
{
if (!empty($post['meta_id']) && $core->auth->check('delete,contentadmin', $core->blog->id)) {
$meta =& $core->meta;
$posts = $ap->getRS();
while ($posts->fetch()) {
foreach ($_POST['meta_id'] as $v) {
$meta->delPostMeta($posts->post_id, 'tag', $v);
}
}
dcPage::addSuccessNotice(sprintf(__('Tag has been successfully removed from selected entries', 'Tags have been successfully removed from selected entries', count($_POST['meta_id']))));
$ap->redirect(true);
} else {
$meta =& $core->meta;
$tags = array();
foreach ($ap->getIDS() as $id) {
$post_tags = $meta->getMetadata(array('meta_type' => 'tag', 'post_id' => (int) $id))->toStatic()->rows();
foreach ($post_tags as $v) {
if (isset($tags[$v['meta_id']])) {
$tags[$v['meta_id']]++;
} else {
$tags[$v['meta_id']] = 1;
}
}
}
if (empty($tags)) {
throw new Exception(__('No tags for selected entries'));
}
$ap->beginPage(dcPage::breadcrumb(array(html::escapeHTML($core->blog->name) => '', __('Entries') => 'posts.php', __('Remove selected tags from this selection') => '')));
$posts_count = count($_POST['entries']);
echo '<form action="' . $ap->getURI() . '" method="post">' . $ap->getCheckboxes() . '<div><p>' . __('Following tags have been found in selected entries:') . '</p>';
foreach ($tags as $k => $n) {
$label = '<label class="classic">%s %s</label>';
if ($posts_count == $n) {
$label = sprintf($label, '%s', '<strong>%s</strong>');
}
echo '<p>' . sprintf($label, form::checkbox(array('meta_id[]'), html::escapeHTML($k)), html::escapeHTML($k)) . '</p>';
}
echo '<p><input type="submit" value="' . __('ok') . '" />' . $core->formNonce() . $ap->getHiddenFields() . form::hidden(array('action'), 'tags_remove') . '</p></div></form>';
$ap->endPage();
}
}
示例6: catch
$blog_settings->system->put('media_img_default_alignment', $_POST['media_img_default_alignment']);
$blog_settings->system->put('media_img_default_link', !empty($_POST['media_img_default_link']));
$blog_settings->system->put('nb_post_per_feed', $nb_post_per_feed);
$blog_settings->system->put('nb_comment_per_feed', $nb_comment_per_feed);
$blog_settings->system->put('short_feed_items', !empty($_POST['short_feed_items']));
if (isset($_POST['robots_policy'])) {
$blog_settings->system->put('robots_policy', $_POST['robots_policy']);
}
$blog_settings->system->put('jquery_version', $_POST['jquery_version']);
$blog_settings->system->put('prevents_clickjacking', !empty($_POST['prevents_clickjacking']));
# --BEHAVIOR-- adminBeforeBlogSettingsUpdate
$core->callBehavior('adminBeforeBlogSettingsUpdate', $blog_settings);
if ($core->auth->isSuperAdmin() && in_array($_POST['url_scan'], $url_scan_combo)) {
$blog_settings->system->put('url_scan', $_POST['url_scan']);
}
dcPage::addSuccessNotice(__('Blog has been successfully updated.'));
http::redirect(sprintf($redir, $blog_id));
} catch (Exception $e) {
$core->error->add($e->getMessage());
}
}
if ($standalone) {
$breadcrumb = dcPage::breadcrumb(array(html::escapeHTML($blog_name) => '', __('Blog settings') => ''));
} else {
$breadcrumb = dcPage::breadcrumb(array(__('System') => '', __('Blogs') => $core->adminurl->get("admin.blogs"), __('Blog settings') . ' : ' . html::escapeHTML($blog_name) => ''));
}
dcPage::open(__('Blog settings'), '<script type="text/javascript">' . "\n" . "//<![CDATA[" . "\n" . dcPage::jsVar('dotclear.msg.warning_path_info', __('Warning: except for special configurations, it is generally advised to have a trailing "/" in your blog URL in PATH_INFO mode.')) . "\n" . dcPage::jsVar('dotclear.msg.warning_query_string', __('Warning: except for special configurations, it is generally advised to have a trailing "?" in your blog URL in QUERY_STRING mode.')) . "\n" . "//]]>" . "</script>" . dcPage::jsConfirmClose('blog-form') . $core->callBehavior('adminPostEditor') . dcPage::jsLoad('js/_blog_pref.js') . $core->callBehavior('adminBlogPreferencesHeaders') . dcPage::jsPageTabs(), $breadcrumb);
if ($blog_id) {
if (!empty($_GET['add'])) {
dcPage::success(__('Blog has been successfully created.'));
}
示例7: foreach
// Save settings
if (!empty($_POST['save_settings'])) {
try {
$core->blog->settings->maintenance->put('plugin_message', !empty($_POST['settings_plugin_message']), 'boolean', 'Display alert message of late tasks on plugin page', true, true);
foreach ($tasks as $t) {
if (!$t->id()) {
continue;
}
if (!empty($_POST['settings_recall_type']) && $_POST['settings_recall_type'] == 'all') {
$ts = $_POST['settings_recall_time'];
} else {
$ts = empty($_POST['settings_ts_' . $t->id()]) ? 0 : $_POST['settings_ts_' . $t->id()];
}
$core->blog->settings->maintenance->put('ts_' . $t->id(), abs((int) $ts), 'integer', sprintf('Recall time for task %s', $t->id()), true, $t->blog());
}
dcPage::addSuccessNotice(__('Maintenance plugin has been successfully configured.'));
http::redirect($p_url . '&tab=' . $tab . '#' . $tab);
} catch (Exception $e) {
$core->error->add($e->getMessage());
}
}
// Combos
$combo_ts = array(__('Never') => 0, __('Every week') => 604800, __('Every two weeks') => 1209600, __('Every month') => 2592000, __('Every two months') => 5184000);
// Display page
echo '<html><head>
<title>' . __('Maintenance') . '</title>' . dcPage::jsPageTabs($tab) . dcPage::jsLoad(dcPage::getPF('maintenance/js/settings.js'));
if ($task && $task->ajax()) {
echo '<script type="text/javascript">' . "\n" . "//<![CDATA[\n" . dcPage::jsVar('dotclear.msg.wait', __('Please wait...')) . "//]]>\n" . '</script>' . dcPage::jsLoad(dcPage::getPF('maintenance/js/dc.maintenance.js'));
}
echo $maintenance->getHeaders() . '
</head>
示例8: array
$core->callBehavior('adminAfterUserUpdate', $cur, $new_id);
if ($user_id == $core->auth->userID() && $user_id != $new_id) {
$core->session->destroy();
}
dcPage::addSuccessNotice(__('User has been successfully updated.'));
$core->adminurl->redirect("admin.user", array('id' => $new_id));
} else {
if ($core->getUsers(array('user_id' => $cur->user_id), true)->f(0) > 0) {
throw new Exception(sprintf(__('User "%s" already exists.'), html::escapeHTML($cur->user_id)));
}
# --BEHAVIOR-- adminBeforeUserCreate
$core->callBehavior('adminBeforeUserCreate', $cur);
$new_id = $core->addUser($cur);
# --BEHAVIOR-- adminAfterUserCreate
$core->callBehavior('adminAfterUserCreate', $cur, $new_id);
dcPage::addSuccessNotice(__('User has been successfully created.'));
if (!empty($_POST['saveplus'])) {
$core->adminurl->redirect("admin.user");
} else {
$core->adminurl->redirect("admin.user", array('id' => $new_id));
}
}
} catch (Exception $e) {
$core->error->add($e->getMessage());
}
}
/* DISPLAY
-------------------------------------------------------- */
dcPage::open($page_title, dcPage::jsConfirmClose('user-form') . dcPage::jsLoad('js/jquery/jquery.pwstrength.js') . '<script type="text/javascript">' . "\n" . "//<![CDATA[\n" . "\$(function() {\n" . "\t\$('#new_pwd').pwstrength({texts: ['" . sprintf(__('Password strength: %s'), __('very weak')) . "', '" . sprintf(__('Password strength: %s'), __('weak')) . "', '" . sprintf(__('Password strength: %s'), __('mediocre')) . "', '" . sprintf(__('Password strength: %s'), __('strong')) . "', '" . sprintf(__('Password strength: %s'), __('very strong')) . "']});\n" . "});\n" . "\n//]]>\n" . "</script>\n" . $core->callBehavior('adminUserHeaders'), dcPage::breadcrumb(array(__('System') => '', __('Users') => $core->adminurl->get("admin.users"), $page_title => '')));
if (!empty($_GET['upd'])) {
dcPage::success(__('User has been successfully updated.'));
示例9: json_decode
# Update order
if (!empty($_POST['save_order']) && !empty($_POST['categories_order'])) {
$categories = json_decode($_POST['categories_order']);
foreach ($categories as $category) {
if (!empty($category->item_id) && !empty($category->left) && !empty($category->right)) {
$core->blog->updCategoryPosition($category->item_id, $category->left, $category->right);
}
}
dcPage::addSuccessNotice(__('Categories have been successfully reordered.'));
$core->adminurl->redirect("admin.categories");
}
# Reset order
if (!empty($_POST['reset'])) {
try {
$core->blog->resetCategoriesOrder();
dcPage::addSuccessNotice(__('Categories order has been successfully reset.'));
$core->adminurl->redirect("admin.categories");
} catch (Exception $e) {
$core->error->add($e->getMessage());
}
}
/* Display
-------------------------------------------------------- */
$rs = $core->blog->getCategories(array('post_type' => 'post'));
$starting_script = "";
$core->auth->user_prefs->addWorkspace('accessibility');
if (!$core->auth->user_prefs->accessibility->nodragdrop && $core->auth->check('categories', $core->blog->id) && $rs->count() > 1) {
$starting_script .= dcPage::jsLoad('js/jquery/jquery-ui.custom.js');
$starting_script .= dcPage::jsLoad('js/jquery/jquery.ui.touch-punch.js');
$starting_script .= dcPage::jsLoad('js/jquery/jquery.mjs.nestedSortable.js');
}
示例10: substr
$order = substr($order, 0, strlen($order) - 1);
}
$order = explode(',', $order);
}
if (!empty($_POST['updateaction']) && !empty($order)) {
try {
$newmenu = array();
foreach ($order as $i => $k) {
$newmenu[] = array('label' => $menu[$k]['label'], 'descr' => $menu[$k]['descr'], 'url' => $menu[$k]['url']);
}
$menu = $newmenu;
// Save menu in blog settings
$core->blog->settings->system->put('simpleMenu', serialize($menu));
$core->blog->triggerBlog();
// All done successfully, return to menu items list
dcPage::addSuccessNotice(__('Menu items have been successfully updated.'));
http::redirect($p_url);
} catch (Exception $e) {
$core->error->add($e->getMessage());
}
}
}
}
# Display
?>
<html>
<head>
<title><?php
echo $page_title;
?>
示例11: elseif
} elseif (!empty($_POST['filters_order'])) {
$order = explode(',', trim($_POST['filters_order'], ','));
}
if (isset($order)) {
foreach ($order as $i => $f) {
$filters_opt[$f][1] = $i;
}
}
# Set auto delete flag
if (isset($_POST['filters_auto_del']) && is_array($_POST['filters_auto_del'])) {
foreach ($_POST['filters_auto_del'] as $v) {
$filters_opt[$v][2] = true;
}
}
dcAntispam::$filters->saveFilterOpts($filters_opt);
dcPage::addSuccessNotice(__('Filters configuration has been successfully saved.'));
http::redirect($p_url);
}
} catch (Exception $e) {
$core->error->add($e->getMessage());
}
?>
<html>
<head>
<title><?php
echo ($filter_gui !== false ? sprintf(__('%s configuration'), $filter->name) . ' - ' : '') . $page_name;
?>
</title>
<script type="text/javascript">
//<![CDATA[
<?php
示例12: array
$core->callBehavior('adminBeforeCommentUpdate', $cur, $comment_id);
$core->blog->updComment($comment_id, $cur);
# --BEHAVIOR-- adminAfterCommentUpdate
$core->callBehavior('adminAfterCommentUpdate', $cur, $comment_id);
dcPage::addSuccessNotice(__('Comment has been successfully updated.'));
$core->adminurl->redirect("admin.comment", array('id' => $comment_id));
} catch (Exception $e) {
$core->error->add($e->getMessage());
}
}
if (!empty($_POST['delete']) && $can_delete) {
try {
# --BEHAVIOR-- adminBeforeCommentDelete
$core->callBehavior('adminBeforeCommentDelete', $comment_id);
$core->blog->delComment($comment_id);
dcPage::addSuccessNotice(__('Comment has been successfully deleted.'));
http::redirect($core->getPostAdminURL($rs->post_type, $rs->post_id) . '&co=1', false);
} catch (Exception $e) {
$core->error->add($e->getMessage());
}
}
if (!$can_edit) {
$core->error->add(__("You can't edit this comment."));
}
}
/* DISPLAY
-------------------------------------------------------- */
if ($comment_id) {
$breadcrumb = dcPage::breadcrumb(array(html::escapeHTML($core->blog->name) => '', html::escapeHTML($post_title) => $core->getPostAdminURL($post_type, $post_id) . '&co=1#c' . $comment_id, __('Edit comment') => ''));
} else {
$breadcrumb = dcPage::breadcrumb(array(html::escapeHTML($core->blog->name) => '', html::escapeHTML($post_title) => $core->getPostAdminURL($post_type, $post_id), __('Edit comment') => ''));
示例13: Copyright
<?php
# -- BEGIN LICENSE BLOCK ---------------------------------------
#
# This file is part of Dotclear 2.
#
# Copyright (c) 2003-2015 Olivier Meunier & Association Dotclear
# Licensed under the GPL version 2.0 license.
# See LICENSE file or
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
# -- END LICENSE BLOCK -----------------------------------------
if (!defined('DC_CONTEXT_ADMIN')) {
exit;
}
$core->blog->settings->addNameSpace('dcReactify');
$dcreactify_active = $core->blog->settings->dcReactify->active;
$is_super_admin = $core->auth->isSuperAdmin();
$default_tab = 'settings';
if (!empty($_POST['saveconfig'])) {
try {
$dcreactify_active = empty($_POST['dcreactify_active']) ? false : true;
$core->blog->settings->dcReactify->put('active', $dcreactify_active, 'boolean');
dcPage::addSuccessNotice(__('Configuration has been updated.'));
http::redirect($p_url);
} catch (Exception $e) {
http::redirect($p_url);
}
}
include dirname(__FILE__) . '/tpl/index.tpl';
示例14: catch
http::redirect($p_url);
} catch (Exception $e) {
$core->error->add($e->getMessage());
}
}
# Global settings update
if (!empty($_POST['gs']) && is_array($_POST['gs'])) {
try {
foreach ($_POST['gs'] as $ns => $s) {
$core->blog->settings->addNamespace($ns);
foreach ($s as $k => $v) {
$core->blog->settings->{$ns}->put($k, $v, null, null, true, true);
}
$core->blog->triggerBlog();
}
dcPage::addSuccessNotice(__('Configuration successfully updated'));
http::redirect($p_url . '&part=global');
} catch (Exception $e) {
$core->error->add($e->getMessage());
}
}
$part = !empty($_GET['part']) && $_GET['part'] == 'global' ? 'global' : 'local';
function settingLine($id, $s, $ns, $field_name, $strong_label)
{
if ($s['type'] == 'boolean') {
$field = form::combo(array($field_name . '[' . $ns . '][' . $id . ']', $field_name . '_' . $ns . '_' . $id), array(__('yes') => 1, __('no') => 0), $s['value'] ? 1 : 0);
} else {
$field = form::field(array($field_name . '[' . $ns . '][' . $id . ']', $field_name . '_' . $ns . '_' . $id), 40, null, html::escapeHTML($s['value']));
}
$slabel = $strong_label ? '<strong>%s</strong>' : '%s';
return '<tr class="line">' . '<td scope="row"><label for="' . $field_name . '_' . $ns . '_' . $id . '">' . sprintf($slabel, html::escapeHTML($id)) . '</label></td>' . '<td>' . $field . '</td>' . '<td>' . $s['type'] . '</td>' . '<td>' . html::escapeHTML($s['label']) . '</td>' . '</tr>';
示例15: Exception
files::uploadStatus($_FILES['pkg_file']);
$dest = DC_L10N_ROOT . '/' . $_FILES['pkg_file']['name'];
if (!move_uploaded_file($_FILES['pkg_file']['tmp_name'], $dest)) {
throw new Exception(__('Unable to move uploaded file.'));
}
try {
$ret_code = dc_lang_install($dest);
} catch (Exception $e) {
@unlink($dest);
throw $e;
}
@unlink($dest);
if ($ret_code == 2) {
dcPage::addSuccessNotice(__('Language has been successfully upgraded'));
} else {
dcPage::addSuccessNotice(__('Language has been successfully installed.'));
}
$core->adminurl->redirect("admin.langs");
} catch (Exception $e) {
$core->error->add($e->getMessage());
}
}
/* DISPLAY Main page
-------------------------------------------------------- */
dcPage::open(__('Languages management'), dcPage::jsLoad('js/_langs.js'), dcPage::breadcrumb(array(__('System') => '', __('Languages management') => '')));
if (!empty($_GET['removed'])) {
dcPage::success(__('Language has been successfully deleted.'));
}
if (!empty($_GET['added'])) {
dcPage::success($_GET['added'] == 2 ? __('Language has been successfully upgraded') : __('Language has been successfully installed.'));
}