Пример #1
0
function add_tag_post_association($tags_array, $post_id)
{
    global $tprefix, $db;
    for ($i = 0; $i < count($tags_array); $i++) {
        $tag_id = get_tag_id($tags_array[$i]);
        $sql = "insert into `{$tprefix}" . "_tag_post` (`tag_id`,`post_id`) values ('" . $tag_id . "','{$post_id}')";
        //echo '<br>XXZEN'.$sql ;
        $db->query($sql);
    }
}
Пример #2
0
/**
    * @author Ivan Lucas
*/
function remove_tag($id, $type, $tag)
{
    global $dbSetTags, $dbTags;
    if ($tag != '') {
        $tagid = get_tag_id($tag);
        // Ignore errors, die silently
        $sql = "DELETE FROM `{$dbSetTags}` WHERE id = '{$id}' AND type = '{$type}' AND tagid = '{$tagid}'";
        $result = @mysql_query($sql);
        // Check tag usage count and remove disused tags completely
        $sql = "SELECT COUNT(id) FROM `{$dbSetTags}` WHERE tagid = '{$tagid}'";
        $result = mysql_query($sql);
        list($count) = mysql_fetch_row($result);
        if ($count == 0) {
            $sql = "DELETE FROM `{$dbTags}` WHERE tagid = '{$tagid}' LIMIT 1";
            @mysql_query($sql);
        }
        purge_tag($tagid);
    }
    return true;
}
Пример #3
0
function popular_posts_block($options)
{
    $mydirname = empty($options[0]) ? 'xpress' : $options[0];
    $this_template = empty($options[1]) ? 'db:' . $mydirname . '_block_popular.html' : trim($options[1]);
    $disp_count = empty($options[2]) ? '10' : $options[2];
    $show_month_range = empty($options[3]) ? '0' : $options[3];
    $date_format = empty($options[4]) ? '' : $options[4];
    $time_format = empty($options[5]) ? '' : $options[5];
    $tag_select = $options[6];
    $cat_select = empty($options[7]) ? '0' : $options[7];
    $selected = explode(',', $cat_select);
    $mydirpath = get_xpress_dir_path();
    if (empty($date_format)) {
        $date_format = get_settings('date_format');
    }
    if (empty($time_format)) {
        $time_format = get_settings('time_format');
    }
    if (array_search(0, $selected) === 0) {
        $cat_select = 0;
    }
    $cat_select;
    $block = array();
    $item_no = 0;
    $selected_author_id = xpress_selected_author_id('echo=0');
    global $wpdb, $wp_query, $xoops_db;
    $db_prefix = get_wp_prefix();
    $post_tb = $wpdb->posts;
    $view_tb = $db_prefix . 'views';
    $user_tb = $db_prefix . 'users';
    $term_relationships_tb = $wpdb->term_relationships;
    // upper 2.3
    $term_taxonomy = $wpdb->term_taxonomy;
    // upper 2.3
    $terms_tb = $wpdb->terms;
    // upper 2.3
    $post2cat_tb = $wpdb->post2cat;
    //under 2.3
    $categories_tb = $wpdb->categories;
    //under 2.3
    include $mydirpath . '/wp-includes/version.php';
    $select = "SELECT {$view_tb}.post_views, {$post_tb}.ID, {$post_tb}.post_title, {$post_tb}.post_date";
    if ($wp_db_version >= 6124) {
        $from = " FROM (((";
        $from .= " {$post_tb} LEFT JOIN {$view_tb} ON {$post_tb}.ID = {$view_tb}.post_id)";
        $from .= " INNER JOIN {$term_relationships_tb} ON {$post_tb}.ID = {$term_relationships_tb}.object_id)";
        $from .= " INNER JOIN {$term_taxonomy} ON {$term_relationships_tb}.term_taxonomy_id = {$term_taxonomy}.term_taxonomy_id)";
        $from .= " INNER JOIN {$terms_tb} ON {$term_taxonomy}.term_id = {$terms_tb}.term_id ";
        $where = " WHERE {$post_tb}.post_type = 'post' AND {$post_tb}.post_status = 'publish'";
        //		if (!empty($selected_author_id)){
        //			$where  .= " AND ($post_tb.post_author = $selected_author_id) ";
        //			$where  .= " AND ($post_tb.post_author = 2) ";
        //		}
        if ($cat_select) {
            $where .= " AND ({$term_taxonomy}.term_id IN ({$cat_select}))";
        }
        if (!empty($tag_select)) {
            $tag_id_list = get_tag_id($tag_select);
            if (!empty($tag_id_list)) {
                $where .= " AND ({$term_taxonomy}.term_id IN ({$tag_id_list}))";
            }
        }
    } else {
        $from = " FROM ((";
        $from .= " {$post_tb} LEFT JOIN {$view_tb} ON {$post_tb}.ID = {$view_tb}.post_id)";
        $from .= " LEFT JOIN {$post2cat_tb} ON {$post_tb}.ID = {$post2cat_tb}.post_id)";
        $from .= " INNER JOIN {$user_tb} ON {$post_tb}.post_author = {$user_tb}.ID";
        $where = " WHERE ({$post_tb}.post_status = 'publish') AND  (UNIX_TIMESTAMP({$post_tb}.post_date) <= UNIX_TIMESTAMP())";
        if ($cat_select) {
            $where .= " AND ({$post2cat_tb}.category_id IN ({$cat_select}))";
        }
    }
    if ($show_month_range > 0) {
        $where .= " AND (UNIX_TIMESTAMP({$post_tb}.post_date) >= UNIX_TIMESTAMP(DATE_ADD(CURRENT_DATE, INTERVAL -{$show_month_range} month)))";
    }
    $order_limmit = " GROUP BY {$post_tb}.ID ORDER BY {$view_tb}.post_views DESC LIMIT 0, {$disp_count}";
    $sql = $select . $from . $where . $order_limmit;
    $populars = $wpdb->get_results($sql);
    foreach ($populars as $popular) {
        $wp_query->in_the_loop = true;
        //for use the_tags() in multi lopp
        $r = new WP_Query("p={$popular->ID}");
        if ($r->have_posts()) {
            $r->the_post();
            ob_start();
            the_ID();
            $post_id = ob_get_contents();
            ob_end_clean();
            ob_start();
            the_title();
            $title = ob_get_contents();
            ob_end_clean();
            ob_start();
            the_permalink();
            $permalink = ob_get_contents();
            ob_end_clean();
            ob_start();
            the_author_posts_link();
            $author = ob_get_contents();
            ob_end_clean();
            ob_start();
            the_category(' &bull; ');
            $category = ob_get_contents();
            ob_end_clean();
            if (function_exists('the_tags')) {
                ob_start();
                the_tags(__('Tags:', 'xpress') . ' ', ' &bull; ', '');
                $tags = ob_get_contents();
                ob_end_clean();
            } else {
                $tags = '';
            }
            ob_start();
            the_modified_date($date_format);
            $post_modified_date = ob_get_contents();
            ob_end_clean();
            ob_start();
            the_modified_date($time_format);
            $post_modified_time = ob_get_contents();
            ob_end_clean();
            ob_start();
            the_time($date_format);
            $post_date = ob_get_contents();
            ob_end_clean();
            ob_start();
            the_time($time_format);
            $post_time = ob_get_contents();
            ob_end_clean();
            ob_start();
            comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)'));
            $comments_popup_link = ob_get_contents();
            ob_end_clean();
            $post_title = '<a href="' . $permalink . '">' . $title . '</a>';
            $post_date_time = $post_date . ' ' . $post_time;
            $post_modified_date_time = $post_modified_date . ' ' . $post_modified_time;
            $trackback_url = trackback_url(false);
            $post_viwes = xpress_post_views_count('post_id=' . $post_id . '&format=' . __('Views :%d', 'xpress') . '&echo=0');
            //			if (empty($tags)) $tags = __('Not Tag');
            $row_data = array('post_id' => $post_id, 'post_title' => $post_title, 'post_date' => $post_date, 'post_time' => $post_time, 'post_date_time' => $post_date_time, 'post_modified_date' => $post_modified_date, 'post_modified_time' => $post_modified_time, 'post_modified_date_time' => $post_modified_date_time, 'post_author' => $author, 'post_category' => $category, 'post_tags' => $tags, 'post_views' => $post_viwes, 'comment_link' => $comments_popup_link, 'trackback_url' => $trackback_url);
            $block['contents']['item' . $item_no] = $row_data;
            $item_no++;
        }
    }
    // end of foreach
    $block['data_count'] = $item_no;
    //xml unserialise error
    return $block;
}
"><?php 
    the_time('F j, Y');
    ?>
</a></p>
						<p class="excerpt"><?php 
    get_excerpt();
    ?>
</p>
					</div>
				</article>
				<div class="hline hline-medium"></div>
				<?php 
}
?>
				<?php 
$args = array('posts_per_page' => 5, 'cat' => $sports, 'category__not_in' => $top_story, 'tag__not_in' => array(get_tag_id('4th-and-goal')));
?>
				<?php 
$myposts = new WP_Query($args);
?>
				<?php 
if ($myposts->have_posts()) {
    ?>
				<?php 
    while ($myposts->have_posts()) {
        ?>
				<?php 
        $myposts->the_post();
        ?>
				<article class="hmedia-list">
					<h4 id="post-<?php 
/**
 * process request
 * 
 * this function is called at the top of the main index page
 * it processes the GET parameters created by process_url()
 * and determines which data should be retrieved, creating additional
 * parameters if necessary for specific datasets
 */
function process_request()
{
    // search request - redirect to keep tidy url
    if (isset($_POST['search'])) {
        $search_redirect = WW_WEB_ROOT . '/search/' . $_POST['search'] . '/';
        header('HTTP/1.1 302 Moved Temporarily');
        header('Location: ' . $search_redirect);
    }
    // redirect jump links from select boxes
    if (isset($_POST['select_link'])) {
        $select_redirect = $_POST['select_link'];
        header('HTTP/1.1 302 Moved Temporarily');
        header('Location: ' . $select_redirect);
    }
    // now get urldata
    $urldata = process_url();
    // author url
    if (isset($_GET['author_url']) && !empty($_GET['author_url'])) {
        $author_id = get_author_id($_GET['author_url']);
        if (!empty($author_id)) {
            $_GET['author_id'] = $author_id;
        } else {
            $_GET['page_name'] = '404';
        }
    }
    // category url
    if (isset($_GET['category_url']) && !empty($_GET['category_url'])) {
        $category_id = get_category_id($_GET['category_url']);
        if (!empty($category_id)) {
            $_GET['category_id'] = $category_id;
        } else {
            $_GET['page_name'] = '404';
        }
    }
    // tag url
    if (isset($_GET['tag_url']) && !empty($_GET['tag_url'])) {
        $tag_id = get_tag_id($_GET['tag_url']);
        if (!empty($tag_id)) {
            $_GET['tag_id'] = $tag_id;
        } else {
            $_GET['page_name'] = '404';
        }
    }
    // have we already 404ed?
    if (isset($_GET['page_name']) && $_GET['page_name'] == '404') {
        show_404($urldata);
        return false;
    }
    // start getting data
    // was a single article requested?
    if (isset($_GET['article_id']) && !empty($_GET['article_id']) || isset($_GET['article_url']) && !empty($_GET['article_url'])) {
        $article_id = get_article_id();
        if (!empty($article_id)) {
            // n.b. page_name could be 'feed' if looking for article comments rss
            $_GET['page_name'] = isset($_GET['page_name']) ? $_GET['page_name'] : 'article';
            $_GET['article_id'] = $article_id;
            return true;
        } else {
            show_404($urldata);
            return false;
        }
        // or a search term or feed request
    } elseif (isset($_GET['feed']) || isset($_GET['feed_listing'])) {
        return true;
        // or did we get a valid author, category, or tag id - or a search, or date request?
    } elseif (!empty($author_id) || !empty($category_id) || !empty($tag_id) || isset($_GET['year']) || isset($_GET['search'])) {
        $_GET['page_name'] = 'listing';
        return true;
        // if anything else has been requested we sure can't find it
    } elseif (!empty($urldata)) {
        show_404($urldata);
        return false;
    }
    // default
    $_GET['page_name'] = 'front';
    return false;
}
Пример #6
0
"><?php 
    the_time('F j, Y');
    ?>
</a></p>
						<p class="excerpt"><?php 
    get_excerpt();
    ?>
</p>
					</div>
				</article>
				<div class="hline hline-medium"></div>
				<?php 
}
?>
				<?php 
$args = array('posts_per_page' => 5, 'cat' => $news, 'category__not_in' => $top_story, 'tag__not_in' => array(get_tag_id('campus-briefing'), get_tag_id('under-the-microscope')));
?>
				<?php 
$myposts = new WP_Query($args);
?>
				<?php 
if ($myposts->have_posts()) {
    ?>
				<?php 
    while ($myposts->have_posts()) {
        ?>
				<?php 
        $myposts->the_post();
        ?>
				<article class="hmedia-list">
					<h4 id="post-<?php 
"><?php 
    the_time('F j, Y');
    ?>
</a></p>
						<p class="excerpt"><?php 
    get_excerpt();
    ?>
</p>
					</div>
				</article>
				<div class="hline hline-medium"></div>
				<?php 
}
?>
				<?php 
$args = array('posts_per_page' => 5, 'cat' => $arts_and_entertainment, 'category__not_in' => $top_story, 'tag__not_in' => array(get_tag_id('campus-spotlight'), get_tag_id('college-gal-cooking')));
?>
				<?php 
$myposts = new WP_Query($args);
?>
				<?php 
if ($myposts->have_posts()) {
    ?>
				<?php 
    while ($myposts->have_posts()) {
        ?>
				<?php 
        $myposts->the_post();
        ?>
				<article class="hmedia-list">
					<h4 id="post-<?php 
Пример #8
0
        $t['list'][] = array('id' => $r['id'], 'name' => htmlarray($r['name']));
    }
    echo json_encode($t);
    exit;
} elseif (isset($_GET['loadTasks'])) {
    check_read_access();
    stop_gpc($_GET);
    $listId = (int) _get('list');
    $sqlWhere = ' AND list_id=' . $listId;
    if (_get('compl') == 0) {
        $sqlWhere .= ' AND compl=0';
    }
    $inner = '';
    $tag = trim(_get('t'));
    if ($tag != '') {
        $tag_id = get_tag_id($tag, $listId);
        $inner = "INNER JOIN tag2task ON id=tag2task.task_id";
        $sqlWhere .= " AND tag_id={$tag_id} ";
    }
    $s = trim(_get('s'));
    if ($s != '') {
        $sqlWhere .= " AND (title LIKE " . $db->quoteForLike("%%%s%%", $s) . " OR note LIKE " . $db->quoteForLike("%%%s%%", $s) . ")";
    }
    $sort = (int) _get('sort');
    $sqlSort = "ORDER BY compl ASC, ";
    if ($sort == 1) {
        $sqlSort .= "prio DESC, ddn ASC, duedate ASC, ow ASC";
    } elseif ($sort == 2) {
        $sqlSort .= "ddn ASC, duedate ASC, prio DESC, ow ASC";
    } else {
        $sqlSort .= "ow ASC";
Пример #9
0
"><?php 
    the_time('F j, Y');
    ?>
</a></p>
						<p class="excerpt"><?php 
    get_excerpt();
    ?>
</p>
					</div>
				</article>
				<div class="hline hline-medium"></div>
				<?php 
}
?>
				<?php 
$args = array('posts_per_page' => 5, 'cat' => $opinions, 'category__not_in' => $top_story, 'tag__not_in' => array(get_tag_id('column'), get_tag_id('letter-to-the-editor')));
?>
				<?php 
$myposts = new WP_Query($args);
?>
				<?php 
if ($myposts->have_posts()) {
    ?>
				<?php 
    while ($myposts->have_posts()) {
        ?>
				<?php 
        $myposts->the_post();
        ?>
				<article class="hmedia-list">
					<h4 id="post-<?php 
Пример #10
0
}
?>
	</section>
	<div class="hline hline-medium"></div>
	<section class="row">
		<div class="threecolumn vline-medium">
			<h6>Issue Archive</h6>
			<a href="http://issuu.com/sbstatesman"><img src="<?php 
bloginfo('template_url');
?>
/images/footer-logo.png" alt="The Statesman" width="268" /></a>
		</div>
		<div class="threecolumn vline-medium">
			<h6>Podcast</h6>
			<a href="<?php 
echo get_tag_link(get_tag_id('deadline'));
?>
"><img src="<?php 
bloginfo('template_url');
?>
/images/deadline.png" alt="Deadline" width="268" /></a>
		</div>
		<div class="threecolumn">
			<h6>Social Media</h6>
			<div class="iconbar iconbar-social">
				<a href="http://facebook.com/sbstatesman"><img src="<?php 
bloginfo('template_url');
?>
/images/facebook.png" alt="Facebook" /></a>
				<a href="http://twitter.com/sbstatesman"><img src="<?php 
bloginfo('template_url');