Exemplo n.º 1
0
 public static function onActionLegacy($core, dcPostsActionsPage $as, $post)
 {
     $core->callBehavior('adminPostsActions', $core, $as->getRS(), $as->getAction(), $as->getRedirection());
     $as->beginPage('', dcPage::jsLoad('js/jquery/jquery.autocomplete.js') . dcPage::jsMetaEditor() . $core->callBehavior('adminPostsActionsHeaders'), '');
     $core->callBehavior('adminPostsActionsContent', $core, $as->getAction(), $as->getHiddenFields(true));
     $as->endPage();
 }
Exemplo n.º 2
0
 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);
 }
Exemplo n.º 3
0
<?php

# -- BEGIN LICENSE BLOCK ---------------------------------------
#
# This file is part of Dotclear 2.
#
# 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 -----------------------------------------
/* ### THIS FILE IS DEPRECATED 					### */
/* ### IT IS ONLY USED FOR PLUGINS COMPATIBILITY ### */
require dirname(__FILE__) . '/../inc/admin/prepend.php';
dcPage::check('usage,contentadmin');
if (isset($_REQUEST['redir'])) {
    $u = explode('?', $_REQUEST['redir']);
    $uri = $u[0];
    if (isset($u[1])) {
        parse_str($u[1], $args);
    }
    $args['redir'] = $_REQUEST['redir'];
} else {
    $uri = $core->adminurl->get("admin.posts");
    $args = array();
}
$posts_actions_page = new dcPostsActionsPage($core, $uri, $args);
$posts_actions_page->setEnableRedirSelection(false);
$posts_actions_page->process();
Exemplo n.º 4
0
    $dt_m_combo = array_merge(array('-' => ''), dcAdminCombos::getDatesCombo($dates));
    $lang_combo = array_merge(array('-' => ''), dcAdminCombos::getLangsCombo($langs, false));
    # Post formats
    $core_formaters = $core->getFormaters();
    $available_formats = array();
    foreach ($core_formaters as $editor => $formats) {
        foreach ($formats as $format) {
            $available_formats[$format] = $format;
        }
    }
    $format_combo = array_merge(array('-' => ''), $available_formats);
    $sortby_combo = array(__('Date') => 'post_dt', __('Title') => 'post_title', __('Category') => 'cat_title', __('Author') => 'user_id', __('Status') => 'post_status', __('Selected') => 'post_selected', __('Number of comments') => 'nb_comment', __('Number of trackbacks') => 'nb_trackback');
    $order_combo = array(__('Descending') => 'desc', __('Ascending') => 'asc');
}
# Actions combo box
$posts_actions_page = new dcPostsActionsPage($core, $core->adminurl->get("admin.posts"));
if ($posts_actions_page->process()) {
    return;
}
/* Get posts
-------------------------------------------------------- */
$user_id = !empty($_GET['user_id']) ? $_GET['user_id'] : '';
$cat_id = !empty($_GET['cat_id']) ? $_GET['cat_id'] : '';
$status = isset($_GET['status']) ? $_GET['status'] : '';
$password = isset($_GET['password']) ? $_GET['password'] : '';
$selected = isset($_GET['selected']) ? $_GET['selected'] : '';
$comment = isset($_GET['comment']) ? $_GET['comment'] : '';
$trackback = isset($_GET['trackback']) ? $_GET['trackback'] : '';
$attachment = isset($_GET['attachment']) ? $_GET['attachment'] : '';
$month = !empty($_GET['month']) ? $_GET['month'] : '';
$lang = !empty($_GET['lang']) ? $_GET['lang'] : '';
Exemplo n.º 5
0
        $starting_scripts .= dcPage::jsLoad('js/_comments.js');
        $params['search'] = $q;
        $params['limit'] = array(($page - 1) * $nb_per_page, $nb_per_page);
        $params['no_content'] = true;
        $params['order'] = 'comment_dt DESC';
        try {
            $comments = $core->blog->getComments($params);
            $counter = $core->blog->getComments($params, true);
            $comment_list = new adminCommentList($core, $comments, $counter->f(0));
        } catch (Exception $e) {
            $core->error->add($e->getMessage());
        }
    }
}
if ($qtype == 'p') {
    $posts_actions_page = new dcPostsActionsPage($core, $core->adminurl->get("admin.search"), array('q' => $q, 'qtype' => $qtype));
    if ($posts_actions_page->process()) {
        return;
    }
} else {
    $comments_actions_page = new dcCommentsActionsPage($core, $core->adminurl->get("admin.search"), array('q' => $q, 'qtype' => $qtype));
    if ($comments_actions_page->process()) {
        return;
    }
}
dcPage::open(__('Search'), $starting_scripts, dcPage::breadcrumb(array(html::escapeHTML($core->blog->name) => '', __('Search') => '')));
echo '<form action="' . $core->adminurl->get("admin.search") . '" method="get" role="search">' . '<div class="fieldset"><h3>' . __('Search options') . '</h3>' . '<p><label for="q">' . __('Query:') . ' </label>' . form::field('q', 30, 255, $q) . '</p>' . '<p><label for="qtype1" class="classic">' . form::radio(array('qtype', 'qtype1'), 'p', $qtype == 'p') . ' ' . __('Search in entries') . '</label> ' . '<label for="qtype2" class="classic">' . form::radio(array('qtype', 'qtype2'), 'c', $qtype == 'c') . ' ' . __('Search in comments') . '</label></p>' . '<p><input type="submit" value="' . __('Search') . '" /></p>' . '</div>' . '</form>';
if ($q && !$core->error->flag()) {
    $redir = html::escapeHTML($_SERVER['REQUEST_URI']);
    # Show posts
    if ($qtype == 'p') {
Exemplo n.º 6
0
 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();
     }
 }
Exemplo n.º 7
0
 public static function doChangePostLang($core, dcPostsActionsPage $ap, $post)
 {
     $posts_ids = $ap->getIDs();
     if (empty($posts_ids)) {
         throw new Exception(__('No entry selected'));
     }
     if (isset($post['new_lang'])) {
         $new_lang = $post['new_lang'];
         $cur = $core->con->openCursor($core->prefix . 'post');
         $cur->post_lang = $new_lang;
         $cur->update('WHERE post_id ' . $core->con->in($posts_ids));
         dcPage::addSuccessNotice(sprintf(__('%d entry has been successfully set to language "%s"', '%d entries have been successfully set to language "%s"', count($posts_ids)), count($posts_ids), html::escapeHTML(l10n::getLanguageName($new_lang))));
         $ap->redirect(true);
     } else {
         $ap->beginPage(dcPage::breadcrumb(array(html::escapeHTML($core->blog->name) => '', $ap->getCallerTitle() => $ap->getRedirection(true), __('Change language for this selection') => '')));
         # lang list
         # Languages combo
         $rs = $core->blog->getLangs(array('order' => 'asc'));
         $all_langs = l10n::getISOcodes(0, 1);
         $lang_combo = array('' => '', __('Most used') => array(), __('Available') => l10n::getISOcodes(1, 1));
         while ($rs->fetch()) {
             if (isset($all_langs[$rs->post_lang])) {
                 $lang_combo[__('Most used')][$all_langs[$rs->post_lang]] = $rs->post_lang;
                 unset($lang_combo[__('Available')][$all_langs[$rs->post_lang]]);
             } else {
                 $lang_combo[__('Most used')][$rs->post_lang] = $rs->post_lang;
             }
         }
         unset($all_langs);
         unset($rs);
         echo '<form action="' . $ap->getURI() . '" method="post">' . $ap->getCheckboxes() . '<p><label for="new_lang" class="classic">' . __('Entry language:') . '</label> ' . form::combo('new_lang', $lang_combo, '');
         echo $core->formNonce() . $ap->getHiddenFields() . form::hidden(array('action'), 'lang') . '<input type="submit" value="' . __('Save') . '" /></p>' . '</form>';
         $ap->endPage();
     }
 }
Exemplo n.º 8
0
}
$params = array();
$params['limit'] = array(($page - 1) * $nb_per_page, $nb_per_page);
$params['no_content'] = true;
$params['meta_id'] = $tag;
$params['meta_type'] = 'tag';
$params['post_type'] = '';
# Get posts
try {
    $posts = $core->meta->getPostsByMeta($params);
    $counter = $core->meta->getPostsByMeta($params, true);
    $post_list = new adminPostList($core, $posts, $counter->f(0));
} catch (Exception $e) {
    $core->error->add($e->getMessage());
}
$posts_actions_page = new dcPostsActionsPage($core, 'plugin.php', array('p' => 'tags', 'm' => 'tag_posts', 'tag' => $tag));
if ($posts_actions_page->process()) {
    return;
}
?>
<html>
<head>
  <title><?php 
echo __('Tags');
?>
</title>
  <?php 
echo dcPage::cssLoad(dcPage::getPF('tags/style.css'));
?>
  <?php 
echo dcPage::jsLoad('js/_posts_list.js');