Changeset 580

Show
Ignore:
Timestamp:
09/19/06 11:56:24 (2 years ago)
Author:
ben
Message:

Weblogs can be filtered by tag.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • devel/htaccess-dist

    r551 r580  
    5252RewriteRule ^([A-Za-z0-9]+)\/weblog\/?$ _weblog/index.php?weblog_name=$1 
    5353ReWriteRule ^([A-Za-z0-9]+)\/weblog\/skip=([0-9]+)$ _weblog/index.php?weblog_name=$1&weblog_offset=$2 
     54RewriteRule ^([A-Za-z0-9]+)\/weblog\/([^\/]+)\/?$ _weblog/index.php?weblog_name=$1&filter=$2 
     55ReWriteRule ^([A-Za-z0-9]+)\/weblog\/([^\/]+)\/skip=([0-9]+)$ _weblog/index.php?weblog_name=$1&filter=$2&weblog_offset=$3 
    5456RewriteRule ^([A-Za-z0-9]+)\/weblog\/archive\/?$ _weblog/archive.php?weblog_name=$1 
    5557RewriteRule ^([A-Za-z0-9]+)\/weblog\/archive\/([0-9]+)\/([0-9]+)\/?$ _weblog/archive_month.php?weblog_name=$1&year=$2&month=$3 
     
    8183RewriteRule ^([A-Za-z0-9]+)\/icons\/([-0-9]+)\/([A-Za-z])\/([0-9]+)\/([A-Za-z])\/([0-9]+)\/?$ _icons/icon.php?id=$2&constraint1=$3&size1=$4&constraint2=$5&size2=$6 
    8284 
    83 RewriteRule ^([A-Za-z0-9]+)\/calendar\/rss\/?$ _calendar/rss.php?username=$1 
    84 RewriteRule ^([A-Za-z0-9]+)\/calendar\/rss\/(.+)\/?$ _calendar/rss.php?tag=$2 
    85 RewriteRule ^([A-Za-z0-9]+)\/calendar\/([0-9]+)\.html$ _calendar/view_events.php?event_id=$2 
    86 RewriteRule ^([A-Za-z0-9]+)\/calendar\/import\/?$ _calendar/ical_import.php 
    87 RewriteRule ^([A-Za-z0-9]+)\/calendar\/archive\/?$ _calendar/archive.php?username=$1 
    88 RewriteRule ^([A-Za-z0-9]+)\/calendar\/archive\/([0-9]+)\/([0-9]+)\/?$ _calendar/archive_month.php?username=$1&year=$2&month=$3 
    89  
    90 RewriteRule ^([A-Za-z0-9]+)\/calendar\/?$ _calendar/index.php?context=private 
    91 RewriteRule ^([A-Za-z0-9]+)\/calendar\/friends\/?$ _calendar/index.php?context=friends 
    92 RewriteRule ^([A-Za-z0-9]+)\/calendar\/communities\/?$ _calendar/index.php?context=communities 
    93  
    9485# Some blogging clients probe Wordpress or MoveableType endpoints, 
    9586# redirect them to the Elgg xml-rpc endpoint 
  • devel/units/weblogs/weblogs_view.php

    r454 r580  
    55// Get the current profile ID 
    66 
    7 global $profile_id; 
    8 global $CFG; 
     7global $profile_id, $CFG, $db; 
    98 
    109// If the weblog offset hasn't been set, it's 0 
    1110$weblog_offset = optional_param('weblog_offset',0,PARAM_INT); 
     11$filter = optional_param('filter'); 
    1212 
    1313// Get all posts in the system that we can see 
    1414 
    1515$where = run("users:access_level_sql_where",$_SESSION['userid']); 
    16 $posts = get_records_select('weblog_posts','('.$where.') AND weblog = '.$profile_id,null,'posted DESC','*',$weblog_offset,'25'); 
    17 $numberofposts = count_records_select('weblog_posts','('.$where.') AND weblog = '.$profile_id); 
     16if (empty($filter)) { 
     17    $posts = get_records_select('weblog_posts','('.$where.') AND weblog = '.$profile_id,null,'posted DESC','*',$weblog_offset,'25'); 
     18    $numberofposts = count_records_select('weblog_posts','('.$where.') AND weblog = '.$profile_id); 
     19} else { 
     20    $where = str_replace("access","wp.access",$where); 
     21    $where = str_replace("owner","wp.owner",$where); 
     22    $posts = get_records_sql("select * from ".$CFG->prefix."tags t join ".$CFG->prefix."weblog_posts wp on wp.ident = t.ref where ($where) AND t.tagtype = 'weblog' AND wp.weblog = $profile_id AND t.tag = " . $db->qstr($filter) . " order by posted desc limit $weblog_offset,25"); 
     23    $numberofposts = get_record_sql("select count(wp.ident) as numberofposts from ".$CFG->prefix."tags t join ".$CFG->prefix."weblog_posts wp on wp.ident = t.ref where ($where) AND t.tagtype = 'weblog' AND wp.weblog = $profile_id AND t.tag = " . $db->qstr($filter)); 
     24    $numberofposts = $numberofposts->numberofposts; 
     25
    1826 
    1927if (!empty($posts)) {