Changeset 1774

Show
Ignore:
Timestamp:
12/26/07 22:37:40 (9 months ago)
Author:
cfriesen
Message:

Individual update (hope nothing is missing)

Location:
trunk/gregarius
Files:
1 added
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/gregarius/admin/channels.php

    r1766 r1774  
    232232        ."&".CST_ADMIN_VIEW."=". CST_ADMIN_DOMAIN_CHANNEL 
    233233        ."&action=". CST_ADMIN_EDIT_ACTION. "&cid=$id\">" . __('edit') 
    234         ."</a>|<a href=\"".$_SERVER['PHP_SELF']. "?".CST_ADMIN_DOMAIN."=". CST_ADMIN_DOMAIN_CHANNEL 
     234        ."</a>"; 
     235        if(!getConfig('rss.config.restrictrefresh')) { 
     236            echo "|<a href=\"".getPath()."update.php?cid=$id\">" . __('update') . "</a>\n"; 
     237                } 
     238        echo "|<a href=\"".$_SERVER['PHP_SELF']. "?".CST_ADMIN_DOMAIN."=". CST_ADMIN_DOMAIN_CHANNEL 
    235239        ."&amp;".CST_ADMIN_VIEW."=". CST_ADMIN_DOMAIN_CHANNEL 
    236240        ."&amp;action=". CST_ADMIN_DELETE_ACTION ."&amp;cid=$id\">" . __('delete') ."</a></td>\n" 
     
    561565        // Parse into and OPML object 
    562566        $opml=getOpml($url); 
    563  
     567         
    564568        if (sizeof($opml) > 0) { 
    565569 
  • trunk/gregarius/cls/update.php

    r1629 r1774  
    3232define('NO_NEW_ITEMS', '-'); 
    3333define ('UPDATING','...'); 
     34define ('DEFAULT_CID', -1); 
    3435 
    3536 
     
    6465    var $chans = array (); 
    6566 
    66     function Update($doPopulate = true, $updatePrivateAlso = false) { 
     67    function Update($doPopulate = true, $updatePrivateAlso = false, $cid = DEFAULT_CID) { 
    6768        rss_plugin_hook('rss.plugins.updates.before', null); 
    6869        if($doPopulate) { 
    69             $this->populate($updatePrivateAlso); 
     70            $this->populate($updatePrivateAlso, $cid); 
    7071        } 
    7172 
     
    7576    } 
    7677 
    77     function populate($updatePrivateAlso = false) { 
     78    function populate($updatePrivateAlso = false, $cid) { 
    7879        $sql = "select c.id, c.url, c.title from ".getTable("channels") . " c " 
    7980               . " inner join " . getTable('folders') . " f on f.id = c.parent " 
     
    8384            $sql .= " and not(mode & ".RSS_MODE_PRIVATE_STATE.") "; 
    8485        } 
    85  
    86         if (getConfig('rss.config.absoluteordering')) { 
    87             $sql .= " order by f.position asc, c.position asc"; 
    88         } else { 
    89             $sql .= " order by f.name, c.title asc"; 
    90         } 
     86         
     87        if(DEFAULT_CID != $cid) { 
     88            $sql .= " and c.id = " . $cid . " "; 
     89                } else { 
     90                    if (getConfig('rss.config.absoluteordering')) { 
     91                            $sql .= " order by f.position asc, c.position asc"; 
     92                    } else { 
     93                            $sql .= " order by f.name, c.title asc"; 
     94                    } 
     95                } 
    9196 
    9297        $res = rss_query($sql); 
     
    159164} 
    160165 
    161  
    162166/** 
    163167 * HTTP Server Push update 
     
    165169class HTTPServerPushUpdate extends Update { 
    166170 
    167     function HTTPServerPushUpdate() { 
    168         parent::Update(); 
     171    function HTTPServerPushUpdate($cid) { 
     172        parent::Update($doPopulate = true, $updatePrivateAlso = false, $cid); 
    169173 
    170174        $GLOBALS['rss']->header->appendHeader("Connection: close"); 
     
    228232} 
    229233 
    230  
    231234/** 
    232235 * AJAXUpdate updates feeds via AJAX. It's a bit more server-intesive 
     
    235238class AJAXUpdate extends Update { 
    236239 
    237     function AJAXUpdate() { 
    238         parent::Update(); 
     240    function AJAXUpdate($cid) { 
     241        parent::Update($doPopulate = true, $updatePrivateAlso = false, $cid); 
    239242        $GLOBALS['rss']->header->extraHTML .= "<script type=\"text/javascript\" src=\"" 
    240243                                              .getPath()."update.php?js\"></script>\n"; 
     
    275278} 
    276279 
    277  
    278  
    279280class CommandLineUpdate extends Update { 
    280     function CommandLineUpdate() { 
    281         parent::Update($doPopulate = true, $updatePrivateAlso = true); 
     281    function CommandLineUpdate($cid) { 
     282        parent::Update($doPopulate = true, $updatePrivateAlso = true, $cid); 
    282283    } 
    283284 
     
    309310 
    310311class MobileUpdate extends Update { 
    311     function MobileUpdate() { 
    312         parent::Update($doPopulate = true); 
    313     } 
     312    function MobileUpdate($cid) { 
     313        parent::Update($doPopulate = true, $updatePrivateAlso = false, $cid); 
     314    } 
     315     
    314316    function render() { 
    315317        $newIds = array(); 
     
    334336    } 
    335337} 
    336  
    337338 
    338339/** 
     
    372373} 
    373374 
    374  
    375  
    376375/** 
    377376 * SilentUpdate updates the feeds silently for those lame  
     
    380379 */ 
    381380class SilentUpdate extends Update { 
    382     function SilentUpdate() { 
    383         parent::Update($doPopulate = false); 
     381    function SilentUpdate($cid) { 
     382        parent::Update($doPopulate = false, $updatePrivateAlso = false, $cid); 
    384383    } 
    385384 
  • trunk/gregarius/cls/wrappers/feeds.php

    r1561 r1774  
    112112} 
    113113 
     114function rss_feeds_feed_id() { 
     115    return ($GLOBALS['rss']->currentFeedsFeed-> id); 
     116} 
     117 
    114118function rss_feeds_feed_title_entities() { 
    115119    return htmlentities($GLOBALS['rss']->currentFeedsFeed-> title); 
  • trunk/gregarius/themes/default/web/feedsfeed.php

    r1302 r1774  
    22<?php if($icon = rss_feeds_feed_icon()) { ?> 
    33    <img src="<?php echo $icon; ?>" class="favicon" alt="" /> 
     4<?php } ?> 
     5<?php if(!getConfig('rss.config.restrictrefresh')) { ?> 
     6<?php echo "<a href=\"" . getPath() . "update.php?cid=" . rss_feeds_feed_id() . "\"><img src=\"" . getExternalThemeFile("media/arrow_refresh.png") . "\" width=\"16\" height=\"16\"></a>"; ?> 
    47<?php } ?> 
    58    <a class="<?php echo rss_feeds_feed_class(); ?>" title="<?php echo rss_feeds_feed_description_entities(); ?>" href="<?php echo rss_feeds_feed_link();  ?>"><?php echo rss_feeds_feed_title(); ?></a> 
  • trunk/gregarius/update.php

    r1581 r1774  
    2828define ('RSS_NO_CACHE',true); 
    2929require_once('init.php'); 
     30 
    3031$cline = isset($argv) && !$_REQUEST && isset($argc) && $argc; 
    3132if (!$cline && getConfig('rss.config.restrictrefresh')) { 
     
    4142sajax_init(); 
    4243 
    43      
    4444if (array_key_exists('js',$_GET)) { 
    4545    header('Content-Type: text/javascript'); 
     
    5252} 
    5353 
    54  
    5554$browser = new Browser(); 
    5655$silent = array_key_exists('silent', $_GET) || ($cline && in_array('--silent',$argv)); 
    5756$newsonly = array_key_exists('newsonly', $_GET) || ($cline && in_array('--newsonly', $argv)); 
    5857$mobile = array_key_exists('mobile',$_GET); 
     58 
     59$cid = DEFAULT_CID; 
     60if(array_key_exists('cid', $_GET)) { 
     61    $cid = $_GET['cid']; 
     62} else if ($cline && in_array('--update-only', $argv)) { 
     63    foreach($argv as $k => $v) { 
     64        if ('--update-only' == $v) { 
     65            $cid = $argv[$k+1]; 
     66            break; 
     67        } 
     68    } 
     69} 
    5970 
    6071$GLOBALS['rss'] -> header = new Header( 
     
    6879$GLOBALS['rss'] -> feedList = new FeedList(false); 
    6980 
    70  
    7181// Instantiate a different Update object, depending on the client 
    7282if ($cline && !$silent && !$newsonly) { 
    73     $update = new CommandLineUpdate(); 
     83    $update = new CommandLineUpdate($cid); 
    7484 
    7585} elseif ($cline && !$silent && $newsonly) { 
    76     $update = new CommandLineUpdateNews(); 
     86    $update = new CommandLineUpdateNews($cid); 
    7787     
    7888} elseif (getConfig('rss.config.serverpush') && !$silent && $browser->supportsServerPush()) { 
    79     $update = new HTTPServerPushUpdate();    
     89    $update = new HTTPServerPushUpdate($cid);    
    8090     
    8191} elseif(!$silent && $browser->supportsAJAX()) { 
    82     $update = new AJAXUpdate();  
     92    $update = new AJAXUpdate($cid);  
    8393 
    8494} elseif($mobile) { 
    85     $update = new MobileUpdate(); 
     95    $update = new MobileUpdate($cid); 
    8696     
    8797} else { 
    8898    error_reporting(0); 
    89     $update = new SilentUpdate(); 
     99    $update = new SilentUpdate($cid); 
    90100} 
    91101