public function init() { $this->con =& $this->core->con; $this->prefix = $this->core->prefix; $this->blog_id = $this->core->blog->id; if (!isset($_SESSION['wp_import_vars'])) { $_SESSION['wp_import_vars'] = $this->base_vars; } $this->vars =& $_SESSION['wp_import_vars']; if ($this->vars['post_limit'] > 0) { $this->post_limit = $this->vars['post_limit']; } $this->formaters = dcAdminCombos::getFormatersCombo(); }
# # -- END LICENSE BLOCK ----------------------------------------- require dirname(__FILE__) . '/../inc/admin/prepend.php'; dcPage::check('usage,contentadmin'); if (!empty($_POST['delete_all_spam'])) { try { $core->blog->delJunkComments(); $_SESSION['comments_del_spam'] = true; $core->adminurl->redirect("admin.comments"); } catch (Exception $e) { $core->error->add($e->getMessage()); } } # Creating filter combo boxes # Filter form we'll put in html_block $status_combo = array_merge(array('-' => ''), dcAdminCombos::getCommentStatusescombo()); $type_combo = array('-' => '', __('Comment') => 'co', __('Trackback') => 'tb'); $sortby_combo = array(__('Date') => 'comment_dt', __('Entry title') => 'post_title', __('Author') => 'comment_author', __('Status') => 'comment_status'); $order_combo = array(__('Descending') => 'desc', __('Ascending') => 'asc'); /* Get comments -------------------------------------------------------- */ $author = isset($_GET['author']) ? $_GET['author'] : ''; $status = isset($_GET['status']) ? $_GET['status'] : ''; $type = !empty($_GET['type']) ? $_GET['type'] : ''; $sortby = !empty($_GET['sortby']) ? $_GET['sortby'] : 'comment_dt'; $order = !empty($_GET['order']) ? $_GET['order'] : 'desc'; $ip = !empty($_GET['ip']) ? $_GET['ip'] : ''; $with_spam = $author || $status || $type || $sortby != 'comment_dt' || $order != 'desc' || $ip; $show_filters = false; $page = !empty($_GET['page']) ? max(1, (int) $_GET['page']) : 1; $nb_per_page = 30;
$categories_combo = array_merge(array(new formSelectOption('-', ''), new formSelectOption(__('(No cat)'), 'NULL')), dcAdminCombos::getCategoriesCombo($categories, false)); $categories_values = array(); foreach ($categories_combo as $cat) { if (isset($cat->value)) { $categories_values[$cat->value] = true; } } $status_combo = array_merge(array('-' => ''), dcAdminCombos::getPostStatusesCombo()); $selected_combo = array('-' => '', __('Selected') => '1', __('Not selected') => '0'); $comment_combo = array('-' => '', __('Opened') => '1', __('Closed') => '0'); $trackback_combo = array('-' => '', __('Opened') => '1', __('Closed') => '0'); $attachment_combo = array('-' => '', __('With attachments') => '1', __('Without attachments') => '0'); $password_combo = array('-' => '', __('With password') => '1', __('Without password') => '0'); # Months array $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()) {
} $dashboardItems .= ''; } } # Dashboard elements echo '<div id="dashboard-main">'; # Dashboard icons echo '<div id="icons">'; foreach ($__dashboard_icons as $i) { echo '<p><a href="' . $i[1] . '"><img src="' . dc_admin_icon_url($i[2]) . '" alt="" />' . '<br /><span>' . $i[0] . '</span></a></p>'; } echo '</div>'; if ($core->auth->user_prefs->dashboard->quickentry) { if ($core->auth->check('usage,contentadmin', $core->blog->id)) { # Getting categories $categories_combo = dcAdminCombos::getCategoriesCombo($core->blog->getCategories(array('post_type' => 'post'))); echo '<div id="quick">' . '<h3>' . __('Quick entry') . sprintf(' › %s', $core->auth->getOption('post_format')) . '</h3>' . '<form id="quick-entry" action="' . $core->adminurl->get('admin.post') . '" method="post" class="fieldset">' . '<h4>' . __('New entry') . '</h4>' . '<p class="col"><label for="post_title" class="required"><abbr title="' . __('Required field') . '">*</abbr> ' . __('Title:') . '</label>' . form::field('post_title', 20, 255, '', 'maximal') . '</p>' . '<p class="area"><label class="required" ' . 'for="post_content"><abbr title="' . __('Required field') . '">*</abbr> ' . __('Content:') . '</label> ' . form::textarea('post_content', 50, 10) . '</p>' . '<p><label for="cat_id" class="classic">' . __('Category:') . '</label> ' . form::combo('cat_id', $categories_combo) . '</p>' . ($core->auth->check('categories', $core->blog->id) ? '<div>' . '<p id="new_cat" class="q-cat">' . __('Add a new category') . '</p>' . '<p class="q-cat"><label for="new_cat_title">' . __('Title:') . '</label> ' . form::field('new_cat_title', 30, 255, '', '') . '</p>' . '<p class="q-cat"><label for="new_cat_parent">' . __('Parent:') . '</label> ' . form::combo('new_cat_parent', $categories_combo, '', '') . '</p>' . '<p class="form-note info clear">' . __('This category will be created when you will save your post.') . '</p>' . '</div>' : '') . '<p><input type="submit" value="' . __('Save') . '" name="save" /> ' . ($core->auth->check('publish', $core->blog->id) ? '<input type="hidden" value="' . __('Save and publish') . '" name="save-publish" />' : '') . $core->formNonce() . form::hidden('post_status', -2) . form::hidden('post_format', $core->auth->getOption('post_format')) . form::hidden('post_excerpt', '') . form::hidden('post_lang', $core->auth->getInfo('user_lang')) . form::hidden('post_notes', '') . '</p>' . '</form>' . '</div>'; } } foreach ($__dashboard_contents as $i) { if ($i->count() > 0) { $dashboardContents .= ''; foreach ($i as $v) { $dashboardContents .= $v; } $dashboardContents .= ''; } } if ($dashboardContents != '' || $dashboardItems != '') { echo '<div id="dashboard-boxes">' . '<div class="db-items">' . $dashboardItems . $dashboardContents . '</div>' . '</div>'; }
$user_pwd = ''; $user_change_pwd = ''; $user_name = ''; $user_firstname = ''; $user_displayname = ''; $user_email = ''; $user_url = ''; $user_lang = $core->auth->getInfo('user_lang'); $user_tz = $core->auth->getInfo('user_tz'); $user_post_status = ''; $user_options = $core->userDefaults(); # Formaters combo $formaters_combo = dcAdminCombos::getFormatersCombo(); $status_combo = dcAdminCombos::getPostStatusesCombo(); # Language codes $lang_combo = dcAdminCombos::getAdminLangsCombo(); # Get user if we have an ID if (!empty($_REQUEST['id'])) { try { $rs = $core->getUser($_REQUEST['id']); $user_id = $rs->user_id; $user_super = $rs->user_super; $user_pwd = $rs->user_pwd; $user_change_pwd = $rs->user_change_pwd; $user_name = $rs->user_name; $user_firstname = $rs->user_firstname; $user_displayname = $rs->user_displayname; $user_email = $rs->user_email; $user_url = $rs->user_url; $user_lang = $rs->user_lang; $user_tz = $rs->user_tz;
$starting_script .= dcPage::jsLoad('js/jquery/jquery.ui.touch-punch.js'); $starting_script .= dcPage::jsLoad('js/jquery/jquery.mjs.nestedSortable.js'); } $starting_script .= dcPage::jsConfirmClose('form-categories'); $starting_script .= dcPage::jsLoad('js/_categories.js'); dcPage::open(__('Categories'), $starting_script, dcPage::breadcrumb(array(html::escapeHTML($core->blog->name) => '', __('Categories') => ''))); if (!empty($_GET['del'])) { dcPage::success(__('The category has been successfully removed.')); } if (!empty($_GET['reord'])) { dcPage::success(__('Categories have been successfully reordered.')); } if (!empty($_GET['move'])) { dcPage::success(__('Entries have been successfully moved to the category you choose.')); } $categories_combo = dcAdminCombos::getCategoriesCombo($rs); echo '<p class="top-add"><a class="button add" href="' . $core->adminurl->get("admin.category") . '">' . __('New category') . '</a></p>'; echo '<div class="col">'; if ($rs->isEmpty()) { echo '<p>' . __('No category so far.') . '</p>'; } else { echo '<form action="' . $core->adminurl->get("admin.categories") . '" method="post" id="form-categories">' . '<div id="categories">'; $ref_level = $level = $rs->level - 1; while ($rs->fetch()) { $attr = 'id="cat_' . $rs->cat_id . '" class="cat-line clearfix"'; if ($rs->level > $level) { echo str_repeat('<ul><li ' . $attr . '>', $rs->level - $level); } elseif ($rs->level < $level) { echo str_repeat('</li></ul>', -($rs->level - $level)); } if ($rs->level <= $level) {
dcPage::check('admin'); $page_title = __('Simple menu'); # Url de base $p_url = $core->adminurl->get('admin.plugin.simpleMenu'); # Url du blog $blog_url = html::stripHostURL($core->blog->url); # Liste des catégories $categories_label = array(); $rs = $core->blog->getCategories(array('post_type' => 'post')); $categories_combo = dcAdminCombos::getCategoriesCombo($rs, false, true); $rs->moveStart(); while ($rs->fetch()) { $categories_label[$rs->cat_url] = html::escapeHTML($rs->cat_title); } # Liste des langues utilisées $langs_combo = dcAdminCombos::getLangscombo($core->blog->getLangs(array('order' => 'asc'))); # Liste des mois d'archive $rs = $core->blog->getDates(array('type' => 'month')); $months_combo = array_merge(array(__('All months') => '-'), dcAdmincombos::getDatesCombo($rs)); $first_year = $last_year = 0; while ($rs->fetch()) { if ($first_year == 0 || $rs->year() < $first_year) { $first_year = $rs->year(); } if ($last_year == 0 || $rs->year() > $last_year) { $last_year = $rs->year(); } } unset($rs); # Liste des pages -- Doit être pris en charge plus tard par le plugin ? $pages_combo = array();
public static function doChangePostCategory($core, dcPostsActionsPage $ap, $post) { if (isset($post['new_cat_id'])) { $posts_ids = $ap->getIDs(); if (empty($posts_ids)) { throw new Exception(__('No entry selected')); } $new_cat_id = $post['new_cat_id']; if (!empty($post['new_cat_title']) && $core->auth->check('categories', $core->blog->id)) { $cur_cat = $core->con->openCursor($core->prefix . 'category'); $cur_cat->cat_title = $post['new_cat_title']; $cur_cat->cat_url = ''; $title = $cur_cat->cat_title; $parent_cat = !empty($post['new_cat_parent']) ? $post['new_cat_parent'] : ''; # --BEHAVIOR-- adminBeforeCategoryCreate $core->callBehavior('adminBeforeCategoryCreate', $cur_cat); $new_cat_id = $core->blog->addCategory($cur_cat, (int) $parent_cat); # --BEHAVIOR-- adminAfterCategoryCreate $core->callBehavior('adminAfterCategoryCreate', $cur_cat, $new_cat_id); } $core->blog->updPostsCategory($posts_ids, $new_cat_id); $title = $core->blog->getCategory($new_cat_id); dcPage::addSuccessNotice(sprintf(__('%d entry has been successfully moved to category "%s"', '%d entries have been successfully moved to category "%s"', count($posts_ids)), count($posts_ids), html::escapeHTML($title->cat_title))); $ap->redirect(true); } else { $ap->beginPage(dcPage::breadcrumb(array(html::escapeHTML($core->blog->name) => '', $ap->getCallerTitle() => $ap->getRedirection(true), __('Change category for this selection') => ''))); # categories list # Getting categories $categories_combo = dcAdminCombos::getCategoriesCombo($core->blog->getCategories()); echo '<form action="' . $ap->getURI() . '" method="post">' . $ap->getCheckboxes() . '<p><label for="new_cat_id" class="classic">' . __('Category:') . '</label> ' . form::combo(array('new_cat_id'), $categories_combo, ''); if ($core->auth->check('categories', $core->blog->id)) { echo '<div>' . '<p id="new_cat">' . __('Create a new category for the post(s)') . '</p>' . '<p><label for="new_cat_title">' . __('Title:') . '</label> ' . form::field('new_cat_title', 30, 255, '', '') . '</p>' . '<p><label for="new_cat_parent">' . __('Parent:') . '</label> ' . form::combo('new_cat_parent', $categories_combo, '', '') . '</p>' . '</div>'; } echo $core->formNonce() . $ap->getHiddenFields() . form::hidden(array('action'), 'category') . '<input type="submit" value="' . __('Save') . '" /></p>' . '</form>'; $ap->endPage(); } }
# -- END LICENSE BLOCK ----------------------------------------- require dirname(__FILE__) . '/../inc/admin/prepend.php'; dcPage::check('usage,contentadmin'); $comment_id = null; $comment_dt = ''; $comment_author = ''; $comment_email = ''; $comment_site = ''; $comment_content = ''; $comment_ip = ''; $comment_status = ''; $comment_trackback = 0; $comment_spam_status = ''; $comment_editor = $core->auth->getOption('editor'); # Status combo $status_combo = dcAdminCombos::getCommentStatusescombo(); # Adding comment if (!empty($_POST['add']) && !empty($_POST['post_id'])) { try { $rs = $core->blog->getPosts(array('post_id' => $_POST['post_id'], 'post_type' => '')); if ($rs->isEmpty()) { throw new Exception(__('Entry does not exist.')); } $cur = $core->con->openCursor($core->prefix . 'comment'); $cur->comment_author = $_POST['comment_author']; $cur->comment_email = html::clean($_POST['comment_email']); $cur->comment_site = html::clean($_POST['comment_site']); $cur->comment_content = $core->HTMLfilter($_POST['comment_content']); $cur->post_id = (int) $_POST['post_id']; # --BEHAVIOR-- adminBeforeCommentCreate $core->callBehavior('adminBeforeCommentCreate', $cur);
$post_status = -2; } # Status combo $status_combo = dcAdminCombos::getPostStatusesCombo(); $img_status_pattern = '<img class="img_select_option" alt="%1$s" title="%1$s" src="images/%2$s" />'; # Formaters combo $core_formaters = $core->getFormaters(); $available_formats = array('' => ''); foreach ($core_formaters as $editor => $formats) { foreach ($formats as $format) { $available_formats[$format] = $format; } } # Languages combo $rs = $core->blog->getLangs(array('order' => 'asc')); $lang_combo = dcAdminCombos::getLangsCombo($rs, true); # Validation flag $bad_dt = false; # Get page informations if (!empty($_REQUEST['id'])) { $params['post_type'] = 'page'; $params['post_id'] = $_REQUEST['id']; $post = $core->blog->getPosts($params); if ($post->isEmpty()) { $core->error->add(__('This page does not exist.')); $can_view_page = false; } else { $post_id = $post->post_id; $post_dt = date('Y-m-d H:i', strtotime($post->post_dt)); $post_format = $post->post_format; $post_password = $post->post_password;
return $formaters_combo; } /** Returns a combo containing available blog statuses @return <b>array</b> the combo box (form::combo -compatible format) */ public static function getBlogStatusesCombo() { $status_combo = array(); foreach (self::$core->getAllBlogStatus() as $k => $v) { $status_combo[$v] = (string) $k; } return $status_combo; } /** Returns a combo containing available comment statuses @return <b>array</b> the combo box (form::combo -compatible format) */ public static function getCommentStatusescombo() { $status_combo = array(); foreach (self::$core->blog->getAllCommentStatus() as $k => $v) { $status_combo[$v] = (string) $k; } return $status_combo; } } dcAdminCombos::$core = $GLOBALS['core'];
$blog_id = $rs->blog_id; $blog_status = $rs->blog_status; $blog_name = $rs->blog_name; $blog_desc = $rs->blog_desc; $blog_settings = new dcSettings($core, $blog_id); $blog_url = $rs->blog_url; } catch (Exception $e) { $core->error->add($e->getMessage()); } $action = $core->adminurl->get("admin.blog"); $redir = $core->adminurl->get("admin.blog", array('id' => "%s"), '&', true); } # Language codes $lang_combo = dcAdminCombos::getAdminLangsCombo(); # Status combo $status_combo = dcAdminCombos::getBlogStatusescombo(); # Date format combo $now = time(); $date_formats = unserialize($blog_settings->system->date_formats); $time_formats = unserialize($blog_settings->system->time_formats); $date_formats_combo = array('' => ''); foreach ($date_formats as $format) { $date_formats_combo[dt::str($format, $now)] = $format; } $time_formats_combo = array('' => ''); foreach ($time_formats as $format) { $time_formats_combo[dt::str($format, $now)] = $format; } # URL scan modes $url_scan_combo = array('PATH_INFO' => 'path_info', 'QUERY_STRING' => 'query_string'); # Post URL combo