Ejemplo n.º 1
0
            if (!empty($_POST['buttons'])) {
                foreach ($_POST['buttons'] as $plugin_name => $button_name) {
                    $plugins[$plugin_name]['button'] = $button_name;
                }
            }
            $core->blog->settings->dcCKEditorAddons->put('plugins', json_encode($plugins), 'string');
            if ($_POST['action'] == 'activate') {
                $verb = 'activated';
            } else {
                $verb = 'deactivated';
            }
            dcPage::addSuccessNotice(sprintf(__('Selected addon has been ' . $verb . '.', 'Selected (%d) addons have been ' . $verb . '.', count($_POST['plugins'])), count($_POST['plugins'])));
            http::redirect($p_url);
        } elseif ($_POST['action'] == 'delete') {
            try {
                foreach ($_POST['plugins'] as $plugin_name) {
                    if (!files::deltree($dcckeditor_addons_repository_path . '/' . $dcckeditor_addons_plugins[$plugin_name]['path'])) {
                        throw new Exception(sprintf(__('Cannot remove addon "%s" files'), $plugin_name));
                    }
                    unset($plugins[$plugin_name]);
                }
                dcPage::addSuccessNotice(sprintf(__('Selected addon has been deleted.', 'Selected (%d) addons have been deleted.', count($_POST['plugins'])), count($_POST['plugins'])));
                $core->blog->settings->dcCKEditorAddons->put('plugins', json_encode($plugins), 'string');
            } catch (Exception $e) {
                dcPage::addErrorNotice($e->getMessage());
            }
            http::redirect($p_url);
        }
    }
}
include __DIR__ . '/tpl/index.tpl';
Ejemplo n.º 2
0
# Copyright (c) 2003-2013 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 -----------------------------------------
require dirname(__FILE__) . '/../inc/admin/prepend.php';
dcPage::check('categories');
# Remove a categories
if (!empty($_POST['delete'])) {
    $keys = array_keys($_POST['delete']);
    $cat_id = (int) $keys[0];
    # Check if category to delete exists
    $c = $core->blog->getCategory((int) $cat_id);
    if ($c->isEmpty()) {
        dcPage::addErrorNotice(__('This category does not exist.'));
        $core->adminurl->redirect("admin.categories");
    }
    $name = $c->cat_title;
    unset($c);
    try {
        # Delete category
        $core->blog->delCategory($cat_id);
        dcPage::addSuccessNotice(sprintf(__('The category "%s" has been successfully deleted.'), html::escapeHTML($name)));
        $core->adminurl->redirect("admin.categories");
    } catch (Exception $e) {
        $core->error->add($e->getMessage());
    }
}
# move post into a category
if (!empty($_POST['mov']) && !empty($_POST['mov_cat'])) {
Ejemplo n.º 3
0
         case 4:
             // Fourth step, menu item to be added
             try {
                 if ($item_label != '' && $item_url != '') {
                     // Add new item menu in menu array
                     $menu[] = array('label' => $item_label, 'descr' => $item_descr, 'url' => $item_url);
                     // 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 item has been successfully added.'));
                     http::redirect($p_url);
                 } else {
                     $step = 3;
                     $item_select_label = $item_label;
                     dcPage::addErrorNotice(__('Label and URL of menu item are mandatory.'));
                 }
             } catch (Exception $e) {
                 $core->error->add($e->getMessage());
             }
             break;
     }
 } else {
     # Remove selected menu items
     if (!empty($_POST['removeaction'])) {
         try {
             if (!empty($_POST['items_selected'])) {
                 foreach ($_POST['items_selected'] as $k => $v) {
                     $menu[$v]['label'] = '';
                 }
                 $newmenu = array();