Beispiel #1
0
    try {
        $meta->delMeta($tag, 'tag');
        http::redirect($p_url . '&m=tags&del=1');
    } catch (Exception $e) {
        $core->error->add($e->getMessage());
    }
}
$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 = $meta->getPostsByMeta($params);
    $counter = $meta->getPostsByMeta($params, true);
    $post_list = new adminPostList($core, $posts, $counter->f(0));
} catch (Exception $e) {
    $core->error->add($e->getMessage());
}
# Actions combo box
$combo_action = array();
if ($core->auth->check('publish,contentadmin', $core->blog->id)) {
    $combo_action[__('publish')] = 'publish';
    $combo_action[__('unpublish')] = 'unpublish';
    $combo_action[__('schedule')] = 'schedule';
    $combo_action[__('mark as pending')] = 'pending';
}
$combo_action[__('mark as selected')] = 'selected';
$combo_action[__('mark as unselected')] = 'unselected';
 public static function lastposts(&$w)
 {
     global $core;
     if ($w->homeonly && $core->url->type != 'default') {
         return;
     }
     $params['limit'] = abs((int) $w->limit);
     $params['order'] = 'post_dt desc';
     $params['no_content'] = true;
     if ($w->category) {
         if ($w->category == 'null') {
             $params['sql'] = ' AND p.cat_id IS NULL ';
         } elseif (is_numeric($w->category)) {
             $params['cat_id'] = (int) $w->category;
         } else {
             $params['cat_url'] = $w->category;
         }
     }
     if ($core->plugins->moduleExists('metadata') && $w->tag) {
         $m = new dcMeta($core);
         $params['meta_id'] = $w->tag;
         $rs = $m->getPostsByMeta($params);
     } else {
         $rs = $core->blog->getPosts($params);
     }
     if ($rs->isEmpty()) {
         return;
     }
     $res = '<div class="lastposts">' . ($w->title ? '<h2>' . html::escapeHTML($w->title) . '</h2>' : '') . '<ul>';
     while ($rs->fetch()) {
         $res .= '<li><a href="' . $rs->getURL() . '">' . html::escapeHTML($rs->post_title) . '</a></li>';
     }
     $res .= '</ul></div>';
     return $res;
 }