Example #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();
 }
Example #2
0
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') {
        if ($counter->f(0) > 0) {
            printf('<h3>' . ($counter->f(0) == 1 ? __('%d entry found') : __('%d entries found')) . '</h3>', $counter->f(0));
        }
        $post_list->display($page, $nb_per_page, '<form action="' . $core->adminurl->get("admin.search") . '" method="post" id="form-entries">' . '%s' . '<div class="two-cols">' . '<p class="col checkboxes-helpers"></p>' . '<p class="col right"><label for="action1" class="classic">' . __('Selected entries action:') . '</label> ' . form::combo(array('action', 'action1'), $posts_actions_page->getCombo()) . '<input type="submit" value="' . __('ok') . '" /></p>' . $core->formNonce() . $posts_actions_page->getHiddenFields() . '</div>' . '</form>');
    } elseif ($qtype == 'c') {
        # Actions combo box
        if ($counter->f(0) > 0) {
            printf('<h3>' . ($counter->f(0) == 1 ? __('%d comment found') : __('%d comments found')) . '</h3>', $counter->f(0));
        }
        $comment_list->display($page, $nb_per_page, '<form action="' . $core->adminurl->get("admin.search") . '" method="post" id="form-comments">' . '%s' . '<div class="two-cols">' . '<p class="col checkboxes-helpers"></p>' . '<p class="col right"><label for="action2" class="classic">' . __('Selected comments action:') . '</label> ' . form::combo(array('action', 'action2'), $comments_actions_page->getCombo()) . '<input type="submit" value="' . __('ok') . '" /></p>' . $core->formNonce() . $comments_actions_page->getHiddenFields() . '</div>' . '</form>');
    }
}
dcPage::helpBlock('core_search');
dcPage::close();
Example #3
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();
     }
 }
Example #4
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();
     }
 }