コード例 #1
0
ファイル: ajax.php プロジェクト: nerdling/gregarius
function __exp__getFeedContent($cid)
{
    $cid = sanitize($cid, RSS_SANITIZER_NUMERIC);
    ob_start();
    rss_require('cls/items.php');
    $readItems = new ItemList();
    $readItems->populate(" not(i.unread & " . RSS_MODE_UNREAD_STATE . ") and i.cid= {$cid}", "", 0, 2, ITEM_SORT_HINT_READ);
    $readItems->setTitle(__('Recent items'));
    $readItems->setRenderOptions(IL_TITLE_NO_ESCAPE);
    foreach ($readItems->feeds[0]->items as $item) {
        $item->render();
    }
    $c = ob_get_contents();
    ob_end_clean();
    return "{$cid}|@|{$c}";
}
コード例 #2
0
ファイル: author.php プロジェクト: jphpsf/gregarius
# more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  or visit
# http://www.gnu.org/licenses/gpl.html
#
###############################################################################
# E-mail:	   mbonetti at gmail dot com
# Web page:	   http://gregarius.net/
#
###############################################################################
require_once 'init.php';
$a = trim(sanitize($_REQUEST['author'], RSS_SANITIZER_WORDS));
$sql = "select distinct(author) from " . getTable('item') . " where author  like '%{$a}'";
list($ra) = rss_fetch_row(rss_query($sql));
if (!$ra) {
    rss_404();
    exit;
}
$t = ucfirst(__('items')) . " " . __(' by ') . " " . $ra;
$GLOBALS['rss']->header = new Header($t);
$GLOBALS['rss']->feedList = new FeedList(false);
$authorItems = new ItemList();
$sqlWhere = " i.author like '%{$a}' ";
$numItems = getConfig('rss.output.frontpage.numitems');
$authorItems->populate($sqlWhere, "", 0, $numItems);
$authorItems->setTitle($t);
$authorItems->setRenderOptions(IL_NO_COLLAPSE | IL_TITLE_NO_ESCAPE);
$GLOBALS['rss']->appendContentObject($authorItems);
$GLOBALS['rss']->renderWithTemplate('index.php', 'items');
コード例 #3
0
ファイル: search.php プロジェクト: jphpsf/gregarius
 function populate()
 {
     if (!$this->query) {
         return;
     }
     $this->matchMode = sanitize(!array_key_exists(QUERY_MATCH_MODE, $_REQUEST) ? QUERY_MATCH_AND : $_REQUEST[QUERY_MATCH_MODE], RSS_SANITIZER_CHARACTERS_EXT);
     $this->matchType = sanitize(!array_key_exists(QUERY_MATCH_TYPE, $_REQUEST) ? "" : $_REQUEST[QUERY_MATCH_TYPE], RSS_SANITIZER_CHARACTERS_EXT);
     $this->channelId = sanitize(array_key_exists(QUERY_CHANNEL, $_REQUEST) ? $_REQUEST[QUERY_CHANNEL] : ALL_CHANNELS_ID, RSS_SANITIZER_NUMERIC);
     if (!$this->resultsPerPage) {
         $this->resultsPerPage = sanitize(array_key_exists(QUERY_RESULTS, $_REQUEST) ? $_REQUEST[QUERY_RESULTS] : 15, RSS_SANITIZER_NUMERIC);
     }
     $this->currentPage = sanitize(array_key_exists(QUERY_CURRENT_PAGE, $_REQUEST) ? $_REQUEST[QUERY_CURRENT_PAGE] : 0, RSS_SANITIZER_NUMERIC);
     $this->startItem = $this->resultsPerPage * $this->currentPage;
     $this->endItem = $this->startItem + $this->resultsPerPage - 1;
     if ($this->resultsPerPage == INFINE_RESULTS) {
         $this->endItem = 99999999;
     }
     $this->orderBy = sanitize(array_key_exists(QUERY_ORDER_BY, $_REQUEST) ? $_REQUEST[QUERY_ORDER_BY] : QUERY_ORDER_BY_DATE, RSS_SANITIZER_CHARACTERS_EXT);
     $qWhere = "";
     $this->regMatch = "";
     $term = "";
     if ($this->matchMode == QUERY_MATCH_OR || $this->matchMode == QUERY_MATCH_AND) {
         $this->logicSep = $this->matchMode == QUERY_MATCH_OR ? "or" : "and";
         $this->searchTerms = explode(" ", $this->query);
         foreach ($this->searchTerms as $term) {
             $term = trim($term);
             if ($term != "") {
                 $qWhere .= "(i.description like '%{$term}%' or " . " i.title like '%{$term}%') " . $this->logicSep;
             }
             // this will be used later for the highliting regexp
             if ($this->regMatch != "") {
                 $this->regMatch .= "|";
             }
             $this->regMatch .= $term;
         }
         $qWhere .= $this->matchMode == QUERY_MATCH_OR ? " 1=0 " : " 1=1 ";
     } else {
         $this->logicSep = "";
         $this->searchTerms[0] = $this->query;
         $term = $this->query;
         $qWhere .= "(i.description like '%{$term}%' or " . " i.title like '%{$term}%') ";
         $this->regMatch = $this->query;
     }
     $qWhere = "(" . $qWhere . ") ";
     if ($this->channelId != ALL_CHANNELS_ID) {
         $qWhere .= " and c.id = " . $this->channelId . " ";
     }
     if (hidePrivate()) {
         $qWhere .= " and not(i.unread & " . RSS_MODE_PRIVATE_STATE . ") ";
     }
     $qWhere .= " and not(i.unread & " . RSS_MODE_DELETED_STATE . ") ";
     if (array_key_exists(QUERY_MATCH_STATE, $_REQUEST) && QUERY_MATCH_READ == $_REQUEST[QUERY_MATCH_STATE]) {
         // Show only read items.
         $qWhere .= " and not (i.unread & " . RSS_MODE_UNREAD_STATE . ") ";
     } else {
         if (array_key_exists(QUERY_MATCH_STATE, $_REQUEST) && QUERY_MATCH_UNREAD == $_REQUEST[QUERY_MATCH_STATE]) {
             // Show only unread items.
             $qWhere .= " and (i.unread & " . RSS_MODE_UNREAD_STATE . ") ";
         }
     }
     if ($this->orderBy == QUERY_ORDER_BY_DATE) {
         $qOrder = "  ts desc";
     } else {
         if (getConfig('rss.config.absoluteordering')) {
             $qOrder = "  f.position asc, c.position asc";
         } else {
             $qOrder = "  f.name asc, c.title asc";
         }
     }
     $qOrder .= ", i.added desc";
     parent::populate($qWhere, $qOrder, 0, getConfig("rss.search.maxitems"), ITEM_SORT_HINT_MIXED, true);
     $this->filterItems();
     $this->nav();
 }
コード例 #4
0
 function populate($sqlWhere, $sqlOrder = "", $startItem = 0, $itemCount = -1, $hint = ITEM_SORT_HINT_MIXED, $includeDeprecated = false)
 {
     $si = $this->page * $this->itemsPerPage;
     parent::populate($sqlWhere, $sqlOrder, $si, $itemCount > 0 ? $this->itemsPerPage : $itemCount, $hint, $includeDeprecated);
     $sql = "select count(*) as cnt " . " from " . $this->_sqlActualFrom . " where " . $this->_sqlActualWhere;
     list($this->numItems) = rss_fetch_row(rss_query($sql));
     if ($this->itemsPerPage && $this->numItems > $this->itemsPerPage) {
         $this->navigation = new ItemListNavigation($this);
     }
 }