当前位置: 首页>>代码示例>>PHP>>正文


PHP COM_getLangSQL函数代码示例

本文整理汇总了PHP中COM_getLangSQL函数的典型用法代码示例。如果您正苦于以下问题:PHP COM_getLangSQL函数的具体用法?PHP COM_getLangSQL怎么用?PHP COM_getLangSQL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了COM_getLangSQL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fixTopic

/**
 * Update array if need be with correct topic.
 *
 * @param    array  $A        Array of articles from db
 * @param    string $tid_list List of child topics of current topic
 */
function fixTopic(&$A, $tid_list)
{
    global $_TABLES, $topic;
    if (!empty($topic)) {
        // This case may happen if a article belongs to the current topic but the default topic for the article is a child  of the current topic.
        $sql = "SELECT t.topic, t.imageurl\n            FROM {$_TABLES['topics']} t, {$_TABLES['topic_assignments']} ta\n            WHERE t.tid = ta.tid\n            AND ta.type = 'article' AND ta.id = '{$A['sid']}' AND ta.tid = '{$topic}'\n            " . COM_getLangSQL('tid', 'AND', 't') . COM_getPermSQL('AND', 0, 2, 't');
        $result = DB_query($sql);
        $nrows = DB_numRows($result);
        if ($nrows > 0) {
            $B = DB_fetchArray($result);
            $A['topic'] = $B['topic'];
            $A['imageurl'] = $B['imageurl'];
        } else {
            // Does not belong to current topic so check inherited
            // Make sure sort order the same as in TOPIC_getTopic or articles with multiple topics might not display in the right topic when clicked
            $sql = "SELECT t.topic, t.imageurl\n                FROM {$_TABLES['topics']} t, {$_TABLES['topic_assignments']} ta\n                WHERE t.tid = ta.tid\n                AND ta.type = 'article' AND ta.id = '{$A['sid']}'\n                AND (ta.tid IN({$tid_list}) AND (ta.inherit = 1 OR (ta.inherit = 0 AND ta.tid = '{$topic}')))\n                " . COM_getLangSQL('tid', 'AND', 't') . COM_getPermSQL('AND', 0, 2, 't') . "\n                ORDER BY ta.tdefault DESC, ta.tid ASC";
            $result = DB_query($sql);
            $nrows = DB_numRows($result);
            if ($nrows > 0) {
                $B = DB_fetchArray($result);
                $A['topic'] = $B['topic'];
                $A['imageurl'] = $B['imageurl'];
            }
        }
    }
}
开发者ID:Geeklog-Core,项目名称:geeklog,代码行数:32,代码来源:index.php

示例2: COM_whatsNewBlock

/**
* Shows any new information in a block
*
* Return the HTML that shows any new stories, comments, etc
*
* @param    string  $help     Help file for block
* @param    string  $title    Title used in block header
* @param    string  $position Position in which block is being rendered 'left', 'right' or blank (for centre)
* @return   string  Return the HTML that shows any new stories, comments, etc
*
*/
function COM_whatsNewBlock($help = '', $title = '', $position = '')
{
    global $_CONF, $_TABLES, $_USER, $LANG01, $LANG_WHATSNEW, $page, $newstories;
    $retval = COM_startBlock($title, $help, COM_getBlockTemplate('whats_new_block', 'header', $position));
    $topicsql = '';
    if ($_CONF['hidenewstories'] == 0 || $_CONF['hidenewcomments'] == 0 || $_CONF['trackback_enabled'] && $_CONF['hidenewtrackbacks'] == 0) {
        $topicsql = COM_getTopicSql('AND', 0, $_TABLES['stories']);
    }
    if ($_CONF['hidenewstories'] == 0) {
        $archsql = '';
        $archivetid = DB_getItem($_TABLES['topics'], 'tid', "archive_flag=1");
        if (!empty($archivetid)) {
            $archsql = " AND (tid <> '" . addslashes($archivetid) . "')";
        }
        // Find the newest stories
        $sql = "SELECT COUNT(*) AS count FROM {$_TABLES['stories']} WHERE (date >= (date_sub(NOW(), INTERVAL {$_CONF['newstoriesinterval']} SECOND))) AND (date <= NOW()) AND (draft_flag = 0)" . $archsql . COM_getPermSQL('AND') . $topicsql . COM_getLangSQL('sid', 'AND');
        $result = DB_query($sql);
        $A = DB_fetchArray($result);
        $nrows = $A['count'];
        if (empty($title)) {
            $title = DB_getItem($_TABLES['blocks'], 'title', "name='whats_new_block'");
        }
        // Any late breaking news stories?
        $retval .= '<h3>' . $LANG01[99] . '</h3>';
        if ($nrows > 0) {
            $newmsg = COM_formatTimeString($LANG_WHATSNEW['new_string'], $_CONF['newstoriesinterval'], $LANG01[11], $nrows);
            if ($newstories && $page < 2) {
                $retval .= $newmsg . '<br' . XHTML . '>';
            } else {
                $retval .= COM_createLink($newmsg, $_CONF['site_url'] . '/index.php?display=new') . '<br' . XHTML . '>';
            }
        } else {
            $retval .= $LANG01[100] . '<br' . XHTML . '>';
        }
        if ($_CONF['hidenewcomments'] == 0 || $_CONF['trackback_enabled'] && $_CONF['hidenewtrackbacks'] == 0 || $_CONF['hidenewplugins'] == 0) {
            $retval .= '<br' . XHTML . '>';
        }
    }
    if ($_CONF['hidenewcomments'] == 0) {
        // Go get the newest comments
        $retval .= '<h3>' . $LANG01[83] . ' <small>' . COM_formatTimeString($LANG_WHATSNEW['new_last'], $_CONF['newcommentsinterval']) . '</small></h3>';
        $stwhere = '';
        if (!COM_isAnonUser()) {
            $stwhere .= "({$_TABLES['stories']}.owner_id IS NOT NULL AND {$_TABLES['stories']}.perm_owner IS NOT NULL) OR ";
            $stwhere .= "({$_TABLES['stories']}.group_id IS NOT NULL AND {$_TABLES['stories']}.perm_group IS NOT NULL) OR ";
            $stwhere .= "({$_TABLES['stories']}.perm_members IS NOT NULL)";
        } else {
            $stwhere .= "({$_TABLES['stories']}.perm_anon IS NOT NULL)";
        }
        $sql = "SELECT DISTINCT COUNT(*) AS dups, type, {$_TABLES['stories']}.title, {$_TABLES['stories']}.sid, max({$_TABLES['comments']}.date) AS lastdate FROM {$_TABLES['comments']} LEFT JOIN {$_TABLES['stories']} ON (({$_TABLES['stories']}.sid = {$_TABLES['comments']}.sid)" . COM_getPermSQL('AND', 0, 2, $_TABLES['stories']) . " AND ({$_TABLES['stories']}.draft_flag = 0) AND ({$_TABLES['stories']}.commentcode >= 0)" . $topicsql . COM_getLangSQL('sid', 'AND', $_TABLES['stories']) . ") WHERE ({$_TABLES['comments']}.date >= (DATE_SUB(NOW(), INTERVAL {$_CONF['newcommentsinterval']} SECOND))) AND ((({$stwhere}))) GROUP BY {$_TABLES['comments']}.sid,type, {$_TABLES['stories']}.title, {$_TABLES['stories']}.title, {$_TABLES['stories']}.sid ORDER BY 5 DESC LIMIT 15";
        $result = DB_query($sql);
        $nrows = DB_numRows($result);
        if ($nrows > 0) {
            $newcomments = array();
            for ($x = 0; $x < $nrows; $x++) {
                $A = DB_fetchArray($result);
                if ($A['type'] == 'article' || empty($A['type'])) {
                    $url = COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $A['sid']) . '#comments';
                }
                $title = COM_undoSpecialChars(stripslashes($A['title']));
                $titletouse = COM_truncate($title, $_CONF['title_trim_length'], '...');
                if ($title != $titletouse) {
                    $attr = array('title' => htmlspecialchars($title));
                } else {
                    $attr = array();
                }
                $acomment = str_replace('$', '&#36;', $titletouse);
                $acomment = str_replace(' ', '&nbsp;', $acomment);
                if ($A['dups'] > 1) {
                    $acomment .= ' [+' . $A['dups'] . ']';
                }
                $newcomments[] = COM_createLink($acomment, $url, $attr);
            }
            $retval .= COM_makeList($newcomments, 'list-new-comments');
        } else {
            $retval .= $LANG01[86] . '<br' . XHTML . '>' . LB;
        }
        if ($_CONF['hidenewplugins'] == 0 || $_CONF['trackback_enabled'] && $_CONF['hidenewtrackbacks'] == 0) {
            $retval .= '<br' . XHTML . '>';
        }
    }
    if ($_CONF['trackback_enabled'] && $_CONF['hidenewtrackbacks'] == 0) {
        $retval .= '<h3>' . $LANG01[114] . ' <small>' . COM_formatTimeString($LANG_WHATSNEW['new_last'], $_CONF['newtrackbackinterval']) . '</small></h3>';
        $sql = "SELECT DISTINCT COUNT(*) AS count,{$_TABLES['stories']}.title,t.sid,max(t.date) AS lastdate FROM {$_TABLES['trackback']} AS t,{$_TABLES['stories']} WHERE (t.type = 'article') AND (t.sid = {$_TABLES['stories']}.sid) AND (t.date >= (DATE_SUB(NOW(), INTERVAL {$_CONF['newtrackbackinterval']} SECOND)))" . COM_getPermSQL('AND', 0, 2, $_TABLES['stories']) . " AND ({$_TABLES['stories']}.draft_flag = 0) AND ({$_TABLES['stories']}.trackbackcode = 0)" . $topicsql . COM_getLangSQL('sid', 'AND', $_TABLES['stories']) . " GROUP BY t.sid, {$_TABLES['stories']}.title ORDER BY lastdate DESC LIMIT 15";
        $result = DB_query($sql);
        $nrows = DB_numRows($result);
        if ($nrows > 0) {
            $newcomments = array();
            for ($i = 0; $i < $nrows; $i++) {
//.........这里部分代码省略.........
开发者ID:hostellerie,项目名称:nexpro,代码行数:101,代码来源:lib-common.php

示例3: DIR_displayAll

/**
* Display main view (list of years)
*
* Displays an overview of all the years and months, starting with the first
* year for which a story has been posted. Can optionally display a list of
* the stories for the current month at the top of the page.
*
* @param    ref    &$template  reference of the template
* @param    string  $dir_topic current topic
* @return   string             list of all the years in the db
*
*/
function DIR_displayAll(&$template, $dir_topic)
{
    global $_TABLES, $LANG_DIR;
    $retval = '';
    $yearsql = array();
    $yearsql['mysql'] = "SELECT DISTINCT YEAR(date) AS year,date FROM {$_TABLES['stories']} WHERE (draft_flag = 0) AND (date <= NOW())" . COM_getTopicSql('AND') . COM_getPermSql('AND') . COM_getLangSQL('sid', 'AND');
    $ysql = array();
    $ysql['mysql'] = $yearsql['mysql'] . " GROUP BY YEAR(date) ORDER BY date DESC";
    $yresult = DB_query($ysql);
    $numyears = DB_numRows($yresult);
    if ($numyears > 0) {
        for ($i = 0; $i < $numyears; $i++) {
            $Y = DB_fetchArray($yresult);
            $template->set_var('section_title', $Y['year']);
            $retval .= $template->parse('title', 'section-title') . LB;
            $retval .= DIR_displayYear($template, $dir_topic, $Y['year']);
        }
    } else {
        $retval .= $template->parse('message', 'no-articles') . LB;
    }
    return $retval;
}
开发者ID:spacequad,项目名称:glfusion,代码行数:34,代码来源:directory.php

示例4: _searchStories

 /**
  * Performs search on all stories
  *
  * @return object plugin object
  *
  */
 private function _searchStories()
 {
     global $_TABLES, $_DB_dbms, $LANG09;
     // Make sure the query is SQL safe
     $query = trim(DB_escapeString($this->_query));
     $sql = 'SELECT s.sid AS id, s.title AS title, s.introtext AS description, ';
     $sql .= 'UNIX_TIMESTAMP(s.date) AS date, s.uid AS uid, s.hits AS hits, ';
     $sql .= 'CONCAT(\'/article.php?story=\',s.sid) AS url ';
     $sql .= 'FROM ' . $_TABLES['stories'] . ' AS s, ' . $_TABLES['users'] . ' AS u, ' . $_TABLES['topic_assignments'] . ' AS ta ';
     $sql .= 'WHERE (draft_flag = 0) AND (date <= NOW()) AND (u.uid = s.uid) ';
     $sql .= 'AND ta.type = \'article\' AND ta.id = sid ';
     $sql .= COM_getPermSQL('AND') . COM_getTopicSQL('AND', 0, 'ta') . COM_getLangSQL('sid', 'AND') . ' ';
     if (!empty($this->_topic)) {
         // Retrieve list of inherited topics
         if ($this->_topic == TOPIC_ALL_OPTION) {
             // Stories do not have an all option so just return all stories that meet the requirements and permissions
             //$sql .= "AND (ta.inherit = 1 OR (ta.inherit = 0 AND ta.tid = '".$this->_topic."')) ";
         } else {
             $tid_list = TOPIC_getChildList($this->_topic);
             $sql .= "AND (ta.tid IN({$tid_list}) AND (ta.inherit = 1 OR (ta.inherit = 0 AND ta.tid = '" . $this->_topic . "'))) ";
         }
     }
     if (!empty($this->_author)) {
         $sql .= 'AND (s.uid = \'' . $this->_author . '\') ';
     }
     $search_s = new SearchCriteria('stories', $LANG09[65]);
     $columns = array('title' => 'title', 'introtext', 'bodytext');
     $sql .= $search_s->getDateRangeSQL('AND', 'date', $this->_dateStart, $this->_dateEnd);
     list($sql, $ftsql) = $search_s->buildSearchSQL($this->_keyType, $query, $columns, $sql);
     $sql .= " GROUP BY s.sid";
     $search_s->setSQL($sql);
     $search_s->setFTSQL($ftsql);
     $search_s->setRank(5);
     $search_s->setURLRewrite(true);
     // Search Story Comments
     $sql = 'SELECT c.cid AS id, c.title AS title, c.comment AS description, ';
     $sql .= 'UNIX_TIMESTAMP(c.date) AS date, c.uid AS uid, \'0\' AS hits, ';
     // MSSQL has a problem when concatenating numeric values
     if ($_DB_dbms == 'mssql') {
         $sql .= '\'/comment.php?mode=view&amp;cid=\' + CAST(c.cid AS varchar(10)) AS url ';
     } else {
         $sql .= 'CONCAT(\'/comment.php?mode=view&amp;cid=\',c.cid) AS url ';
     }
     $sql .= 'FROM ' . $_TABLES['users'] . ' AS u, ' . $_TABLES['topic_assignments'] . ' AS ta, ' . $_TABLES['comments'] . ' AS c ';
     $sql .= 'LEFT JOIN ' . $_TABLES['stories'] . ' AS s ON ((s.sid = c.sid) ';
     $sql .= COM_getPermSQL('AND', 0, 2, 's') . COM_getLangSQL('sid', 'AND', 's') . ') ';
     $sql .= 'WHERE (u.uid = c.uid) AND (s.draft_flag = 0) AND (s.commentcode >= 0) AND (s.date <= NOW()) ';
     $sql .= 'AND ta.type = \'article\' AND ta.id = s.sid ' . COM_getTopicSQL('AND', 0, 'ta');
     if (!empty($this->_topic)) {
         if ($this->_topic == TOPIC_ALL_OPTION) {
             // Stories do not have an all option so just return all story comments that meet the requirements and permissions
             //$sql .= "AND (ta.inherit = 1 OR (ta.inherit = 0 AND ta.tid = '".$this->_topic."')) ";
         } else {
             $sql .= "AND (ta.tid IN({$tid_list}) AND (ta.inherit = 1 OR (ta.inherit = 0 AND ta.tid = '" . $this->_topic . "'))) ";
         }
     }
     if (!empty($this->_author)) {
         $sql .= 'AND (c.uid = \'' . $this->_author . '\') ';
     }
     $search_c = new SearchCriteria('comments', array($LANG09[65], $LANG09[66]));
     $columns = array('title' => 'c.title', 'comment');
     $sql .= $search_c->getDateRangeSQL('AND', 'c.date', $this->_dateStart, $this->_dateEnd);
     list($sql, $ftsql) = $search_c->buildSearchSQL($this->_keyType, $query, $columns, $sql);
     $sql .= " GROUP BY id";
     $search_c->setSQL($sql);
     $search_c->setFTSQL($ftsql);
     $search_c->setRank(2);
     return array($search_s, $search_c);
 }
开发者ID:milk54,项目名称:geeklog-japan,代码行数:75,代码来源:search.class.php

示例5: getItemsByDate

 /**
  * Returns an array of (
  *   'id'        => $id (string),
  *   'title'     => $title (string),
  *   'uri'       => $uri (string),
  *   'date'      => $date (int: Unix timestamp),
  *   'image_uri' => $image_uri (string)
  * )
  */
 public function getItemsByDate($tid = '', $all_langs = FALSE)
 {
     global $_CONF, $_TABLES;
     $entries = array();
     if (empty(Dataproxy::$startDate) or empty(Dataproxy::$endDate)) {
         return $entries;
     }
     $sql = "SELECT sid, title, UNIX_TIMESTAMP(date) AS day " . "  FROM {$_TABLES['stories']} " . "WHERE (draft_flag = 0) AND (date <= NOW()) " . "  AND (UNIX_TIMESTAMP(date) BETWEEN '" . Dataproxy::$startDate . "' AND '" . Dataproxy::$endDate . "') ";
     if (!empty($tid)) {
         $sql .= "AND (tid = '" . addslashes($tid) . "') ";
     }
     if (!Dataproxy::isRoot()) {
         $sql .= COM_getTopicSql('AND', Dataproxy::uid()) . COM_getPermSql('AND', Dataproxy::uid());
         if (function_exists('COM_getLangSQL') and $all_langs === FALSE) {
             $sql .= COM_getLangSQL('sid', 'AND');
         }
     }
     $result = DB_query($sql);
     if (DB_error()) {
         return $entries;
     }
     while (($A = DB_fetchArray($result, FALSE)) !== FALSE) {
         $entry = array();
         $entry['id'] = stripslashes($A['sid']);
         $entry['title'] = stripslashes($A['title']);
         $entry['uri'] = COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . stripslashes($A['sid']));
         $entry['date'] = $A['day'];
         $entry['imageurl'] = FALSE;
         $entries[] = $entry;
     }
     return $entries;
 }
开发者ID:milk54,项目名称:geeklog-japan,代码行数:41,代码来源:article.class.php

示例6: plugin_getwhatsnewcomment_story

/**
 * Return new Story comments for the What's New block
 *
 * @param    string $numreturn   If 0 will return results for What's New Block.
 *                               If > 0 will return last X new comments for User Profile.
 * @param    string $uid         ID of the user to return results for. 0 = all users.
 * @return   array list of new comments (dups, type, title, sid, lastdate) or (sid, title, cid, unixdate)
 */
function plugin_getwhatsnewcomment_story($numreturn = 0, $uid = 0)
{
    global $_CONF, $_TABLES;
    $topicsql = COM_getTopicSql('AND', 0, 'ta');
    $stwhere = '';
    if (!COM_isAnonUser()) {
        $stwhere .= "((s.owner_id IS NOT NULL AND s.perm_owner IS NOT NULL) OR ";
        $stwhere .= "(s.group_id IS NOT NULL AND s.perm_group IS NOT NULL) OR ";
        $stwhere .= "(s.perm_members IS NOT NULL))";
    } else {
        $stwhere .= "(s.perm_anon IS NOT NULL)";
    }
    if ($uid > 0) {
        $stwhere .= " AND (c.uid = {$uid})";
    }
    if ($numreturn == 0) {
        $sql['mysql'] = "SELECT DISTINCT COUNT(*) AS dups, c.type, s.title, s.sid, max(c.date) AS lastdate\n            FROM {$_TABLES['comments']} c LEFT JOIN {$_TABLES['stories']} s ON ((s.sid = c.sid) AND type = 'article' " . COM_getPermSQL('AND', 0, 2, 's') . " AND (s.draft_flag = 0) AND (s.commentcode >= 0)" . COM_getLangSQL('sid', 'AND', 's') . ")\n            , {$_TABLES['topic_assignments']} ta\n            WHERE ta.type = 'article' AND ta.id = s.sid AND ta.tdefault = 1 {$topicsql} AND (c.date >= (DATE_SUB(NOW(), INTERVAL {$_CONF['newcommentsinterval']} SECOND))) AND ((({$stwhere})))\n            GROUP BY c.sid, c.type, s.title, s.title, s.sid\n            ORDER BY 5 DESC LIMIT 15";
        $sql['pgsql'] = "SELECT DISTINCT COUNT(*) AS dups, c.type, s.title, s.sid, max(c.date) AS lastdate\n            FROM {$_TABLES['comments']} c LEFT JOIN {$_TABLES['stories']} s ON ((s.sid = c.sid) AND type = 'article' " . COM_getPermSQL('AND', 0, 2, 's') . " AND (s.draft_flag = 0) AND (s.commentcode >= 0)" . COM_getLangSQL('sid', 'AND', 's') . ")\n            , {$_TABLES['topic_assignments']} ta\n            WHERE ta.type = 'article' AND ta.id = s.sid AND ta.tdefault = 1 {$topicsql} AND (c.date >= (NOW()+ INTERVAL '{$_CONF['newcommentsinterval']} SECOND')) AND ((({$stwhere})))\n            GROUP BY c.sid,c.type, s.title, s.title, s.sid\n            ORDER BY 5 DESC LIMIT 15";
    } else {
        $sql = "SELECT s.sid, c.title, cid, UNIX_TIMESTAMP(c.date) AS unixdate\n            FROM {$_TABLES['comments']} c LEFT JOIN {$_TABLES['stories']} s ON ((s.sid = c.sid) AND type = 'article' " . COM_getPermSQL('AND', 0, 2, 's') . " AND (s.draft_flag = 0) AND (s.commentcode >= 0)" . COM_getLangSQL('sid', 'AND', 's') . ")\n            , {$_TABLES['topic_assignments']} ta\n            WHERE ta.type = 'article' AND ta.id = s.sid AND ta.tdefault = 1 {$topicsql} AND ({$stwhere}) ORDER BY unixdate DESC LIMIT {$numreturn}";
    }
    $result = DB_query($sql);
    $nrows = DB_numRows($result);
    if ($nrows > 0) {
        for ($x = 0; $x < $nrows; $x++) {
            $A[] = DB_fetchArray($result);
        }
        return $A;
    }
}
开发者ID:mystralkk,项目名称:geeklog,代码行数:38,代码来源:lib-story.php

示例7: COM_whatsNewBlock

/**
* Shows any new information in a block
*
* Return the HTML that shows any new stories, comments, etc
*
* @param    string  $help     Help file for block
* @param    string  $title    Title used in block header
* @param    string  $position Position in which block is being rendered 'left', 'right' or blank (for centre)
* @return   string  Return the HTML that shows any new stories, comments, etc
*
*/
function COM_whatsNewBlock($help = '', $title = '', $position = '')
{
    global $_CONF, $_TABLES, $LANG01, $LANG_WHATSNEW, $page, $newstories;
    $retval = COM_startBlock($title, $help, COM_getBlockTemplate('whats_new_block', 'header', $position));
    $topicsql = '';
    if ($_CONF['hidenewstories'] == 0 || $_CONF['hidenewcomments'] == 0 || $_CONF['trackback_enabled'] && $_CONF['hidenewtrackbacks'] == 0) {
        $topicsql = COM_getTopicSql('AND', 0, $_TABLES['stories']);
    }
    if ($_CONF['hidenewstories'] == 0) {
        $archsql = '';
        $archivetid = DB_getItem($_TABLES['topics'], 'tid', "archive_flag=1");
        if (!empty($archivetid)) {
            $archsql = " AND (tid <> '" . addslashes($archivetid) . "')";
        }
        // Find the newest stories
        $sql['mssql'] = "SELECT COUNT(*) AS count FROM {$_TABLES['stories']} WHERE (date >= (date_sub(NOW(), INTERVAL {$_CONF['newstoriesinterval']} SECOND))) AND (date <= NOW()) AND (draft_flag = 0)" . $archsql . COM_getPermSQL('AND') . $topicsql . COM_getLangSQL('sid', 'AND');
        $sql['mysql'] = "SELECT COUNT(*) AS count FROM {$_TABLES['stories']} WHERE (date >= (date_sub(NOW(), INTERVAL {$_CONF['newstoriesinterval']} SECOND))) AND (date <= NOW()) AND (draft_flag = 0)" . $archsql . COM_getPermSQL('AND') . $topicsql . COM_getLangSQL('sid', 'AND');
        $sql['pgsql'] = "SELECT COUNT(*) AS count FROM {$_TABLES['stories']} WHERE (date >= (NOW() - INTERVAL '{$_CONF['newstoriesinterval']} SECOND')) AND (date <= NOW()) AND (draft_flag = 0)" . $archsql . COM_getPermSQL('AND') . $topicsql . COM_getLangSQL('sid', 'AND');
        $result = DB_query($sql);
        $A = DB_fetchArray($result);
        $nrows = $A['count'];
        if (empty($title)) {
            $title = DB_getItem($_TABLES['blocks'], 'title', "name='whats_new_block'");
        }
        // Any late breaking news stories?
        $retval .= '<h3>' . $LANG01[99] . '</h3>';
        if ($nrows > 0) {
            $newmsg = COM_formatTimeString($LANG_WHATSNEW['new_string'], $_CONF['newstoriesinterval'], $LANG01[11], $nrows);
            if ($newstories && $page < 2) {
                $retval .= $newmsg . '<br' . XHTML . '>';
            } else {
                $retval .= COM_createLink($newmsg, $_CONF['site_url'] . '/index.php?display=new') . '<br' . XHTML . '>';
            }
        } else {
            $retval .= $LANG01[100] . '<br' . XHTML . '>';
        }
        if ($_CONF['hidenewcomments'] == 0 || $_CONF['trackback_enabled'] && $_CONF['hidenewtrackbacks'] == 0 || $_CONF['hidenewplugins'] == 0) {
            $retval .= '<br' . XHTML . '>';
        }
    }
    if ($_CONF['hidenewcomments'] == 0) {
        // Go get the newest comments
        $retval .= '<h3>' . $LANG01[83] . ' <small>' . COM_formatTimeString($LANG_WHATSNEW['new_last'], $_CONF['newcommentsinterval']) . '</small></h3>';
        $new_plugin_comments = array();
        $new_plugin_comments = PLG_getWhatsNewComment();
        if (!empty($new_plugin_comments)) {
            // Sort array by element lastdate newest to oldest
            foreach ($new_plugin_comments as $k => $v) {
                $b[$k] = strtolower($v['lastdate']);
            }
            arsort($b);
            foreach ($b as $key => $val) {
                $temp[] = $new_plugin_comments[$key];
            }
            $new_plugin_comments = $temp;
            $newcomments = array();
            $count = 0;
            foreach ($new_plugin_comments as $A) {
                $count .= +1;
                $url = '';
                $info = PLG_getItemInfo($A['type'], $A['sid'], 'url');
                if (!empty($info)) {
                    $url = $info . '#comments';
                }
                // Check to see if url (plugin may not support PLG_getItemInfo
                if (!empty($url)) {
                    $title = COM_undoSpecialChars(stripslashes($A['title']));
                    $titletouse = COM_truncate($title, $_CONF['title_trim_length'], '...');
                    if ($title != $titletouse) {
                        $attr = array('title' => htmlspecialchars($title));
                    } else {
                        $attr = array();
                    }
                    $acomment = str_replace('$', '&#36;', $titletouse);
                    $acomment = str_replace(' ', '&nbsp;', $acomment);
                    if ($A['dups'] > 1) {
                        $acomment .= ' [+' . $A['dups'] . ']';
                    }
                    $newcomments[] = COM_createLink($acomment, $url, $attr);
                    if ($count == 15) {
                        break;
                    }
                }
            }
            $retval .= COM_makeList($newcomments, 'list-new-comments');
        } else {
            $retval .= $LANG01[86] . '<br' . XHTML . '>' . LB;
        }
        if ($_CONF['hidenewplugins'] == 0 || $_CONF['trackback_enabled'] && $_CONF['hidenewtrackbacks'] == 0) {
//.........这里部分代码省略.........
开发者ID:alxstuart,项目名称:ajfs.me,代码行数:101,代码来源:lib-common.php

示例8: _searchStories

 /**
  * Performs search on all stories
  *
  * @access private
  * @return object plugin object
  *
  */
 function _searchStories()
 {
     global $_TABLES, $_DB_dbms, $LANG09;
     // Make sure the query is SQL safe
     $query = trim(addslashes($this->_query));
     $sql = 'SELECT s.sid AS id, s.title AS title, s.introtext AS description, ';
     $sql .= 'UNIX_TIMESTAMP(s.date) AS date, s.uid AS uid, s.hits AS hits, ';
     $sql .= 'CONCAT(\'/article.php?story=\',s.sid) AS url ';
     $sql .= 'FROM ' . $_TABLES['stories'] . ' AS s, ' . $_TABLES['users'] . ' AS u ';
     $sql .= 'WHERE (draft_flag = 0) AND (date <= NOW()) AND (u.uid = s.uid) ';
     $sql .= COM_getPermSQL('AND') . COM_getTopicSQL('AND') . COM_getLangSQL('sid', 'AND') . ' ';
     if (!empty($this->_topic)) {
         $sql .= 'AND (s.tid = \'' . $this->_topic . '\') ';
     }
     if (!empty($this->_author)) {
         $sql .= 'AND (s.uid = \'' . $this->_author . '\') ';
     }
     $search_s = new SearchCriteria('stories', $LANG09[65]);
     $columns = array('title' => 'title', 'introtext', 'bodytext');
     $sql .= $search_s->getDateRangeSQL('AND', 'date', $this->_dateStart, $this->_dateEnd);
     list($sql, $ftsql) = $search_s->buildSearchSQL($this->_keyType, $query, $columns, $sql);
     $search_s->setSQL($sql);
     $search_s->setFTSQL($ftsql);
     $search_s->setRank(5);
     $search_s->setURLRewrite(true);
     // Search Story Comments
     $sql = 'SELECT c.cid AS id, c.title AS title, c.comment AS description, ';
     $sql .= 'UNIX_TIMESTAMP(c.date) AS date, c.uid AS uid, ';
     // MSSQL has a problem when concatenating numeric values
     if ($_DB_dbms == 'mssql') {
         $sql .= '\'/comment.php?mode=view&amp;cid=\' + CAST(c.cid AS varchar(10)) AS url ';
     } else {
         $sql .= 'CONCAT(\'/comment.php?mode=view&amp;cid=\',c.cid) AS url ';
     }
     $sql .= 'FROM ' . $_TABLES['users'] . ' AS u, ' . $_TABLES['comments'] . ' AS c ';
     $sql .= 'LEFT JOIN ' . $_TABLES['stories'] . ' AS s ON ((s.sid = c.sid) ';
     $sql .= COM_getPermSQL('AND', 0, 2, 's') . COM_getTopicSQL('AND', 0, 's') . COM_getLangSQL('sid', 'AND', 's') . ') ';
     $sql .= 'WHERE (u.uid = c.uid) AND (s.draft_flag = 0) AND (s.commentcode >= 0) AND (s.date <= NOW()) ';
     if (!empty($this->_topic)) {
         $sql .= 'AND (s.tid = \'' . $this->_topic . '\') ';
     }
     if (!empty($this->_author)) {
         $sql .= 'AND (c.uid = \'' . $this->_author . '\') ';
     }
     $search_c = new SearchCriteria('comments', array($LANG09[65], $LANG09[66]));
     $columns = array('title' => 'c.title', 'comment');
     $sql .= $search_c->getDateRangeSQL('AND', 'c.date', $this->_dateStart, $this->_dateEnd);
     list($sql, $ftsql) = $search_c->buildSearchSQL($this->_keyType, $query, $columns, $sql);
     $search_c->setSQL($sql);
     $search_c->setFTSQL($ftsql);
     $search_c->setRank(2);
     return array($search_s, $search_c);
 }
开发者ID:hostellerie,项目名称:nexpro,代码行数:60,代码来源:search.class.php

示例9: fncList

function fncList()
{
    global $_CONF;
    global $_TABLES;
    global $LANG_ADMIN;
    global $LANG09;
    global $LANG28;
    global $LANG_USERBOX_ADMIN;
    global $LANG_USERBOX;
    global $_USERBOX_CONF;
    $table = $_TABLES['USERBOX_base'];
    $table1 = $_TABLES['users'];
    require_once $_CONF['path_system'] . 'lib-admin.php';
    $retval = '';
    $retval .= COM_startBlock($LANG_USERBOX['list']);
    //MENU1:管理画面
    $menu_arr = array();
    if ($_USERBOX_CONF['hide_whatsnew'] == 'modified') {
        $datecolumn = 'modified';
    } else {
        $datecolumn = 'created';
    }
    //ヘッダ:編集~
    $header_arr[] = array('text' => $LANG28['2'], 'field' => 'id', 'sort' => true);
    $header_arr[] = array('text' => $LANG28['3'], 'field' => 'username', 'sort' => username);
    $header_arr[] = array('text' => $LANG_USERBOX_ADMIN[$datecolumn], 'field' => $datecolumn, 'sort' => true);
    $header_arr[] = array('text' => $LANG28['4'], 'field' => 'fullname', 'sort' => fullname);
    //
    $text_arr = array('has_menu' => true, 'has_extras' => true, 'form_url' => $_CONF['site_url'] . "/" . THIS_SCRIPT);
    //kokokara
    $sql = "SELECT ";
    $sql .= " id";
    $sql .= " ,draft_flag";
    $sql .= " ,UNIX_TIMESTAMP(udatetime) AS udatetime";
    $sql .= " ,orderno";
    $sql .= " ,UNIX_TIMESTAMP(" . $datecolumn . ") AS " . $datecolumn;
    $sql .= " ,t1.username";
    $sql .= " ,t1.fullname";
    $sql .= " FROM ";
    $sql .= " {$table} AS t";
    $sql .= " ,{$table1} AS t1";
    $sql .= " WHERE ";
    $sql .= " t.id=t1.uid";
    $sql .= COM_getLangSQL('username', 'AND', 't1') . LB;
    //管理者の時,下書データも含む
    //if ( SEC_hasRights('userbox.admin')) {
    //}else{
    $sql .= " AND draft_flag=0" . LB;
    //}
    //アクセス権のないデータ はのぞく
    $sql .= COM_getPermSql('AND');
    //公開日以前のデータはのぞく
    $sql .= " AND (released <= NOW())";
    //公開終了日を過ぎたデータはのぞく
    $sql .= " AND (expired=0 OR expired > NOW())";
    //
    $query_arr = array('table' => " {$table} AS t ,{$table1} AS t1", 'sql' => $sql, 'query_fields' => array('id', 'username', 'fullname', 'draft_flag'), 'default_filter' => $exclude);
    //デフォルトソート項目:
    $defsort_arr = array('field' => 'id', 'direction' => 'ASC');
    //List 取得
    //ADMIN_list($component, $fieldfunction, $header_arr, $text_arr,
    //       $query_arr, $menu_arr, $defsort_arr, $filter = '', $extra = '', $options = '')
    $retval .= ADMIN_list('userbox', "fncGetListField", $header_arr, $text_arr, $query_arr, $defsort_arr);
    $retval .= COM_endBlock();
    return $retval;
}
开发者ID:mistgrass,项目名称:geeklog-ivywe,代码行数:66,代码来源:list.php

示例10: getItemsByDate

 /**
  * Returns an array of (
  *   'id'        => $id (string),
  *   'title'     => $title (string),
  *   'uri'       => $uri (string),
  *   'date'      => $date (int: Unix timestamp),
  *   'image_uri' => $image_uri (string)
  * )
  */
 public function getItemsByDate($tid = '', $all_langs = FALSE)
 {
     global $_CONF, $_TABLES;
     $retval = array();
     if (empty(Dataproxy::$startDate) or empty(Dataproxy::$endDate)) {
         return $retval;
     }
     // Collects sids
     $sql = "SELECT id " . "  FROM {$_TABLES['topic_assignments']} " . "WHERE (type= 'article') AND (tdefault = 1) ";
     if (!empty($tid)) {
         $sql .= "  AND (tid = '" . addslashes($tid) . "') ";
     }
     if (!Dataproxy::isRoot()) {
         $sql .= COM_getTopicSql('AND', Dataproxy::uid());
     }
     $result = DB_query($sql);
     if (DB_error()) {
         return $retval;
     } else {
         $sids = array();
         while (($A = DB_fetchArray($result, FALSE)) !== FALSE) {
             $sids[] = addslashes($A['id']);
         }
         if (count($sids) === 0) {
             return $retval;
         }
     }
     $sql = "SELECT sid, title, UNIX_TIMESTAMP(date) AS day " . "  FROM {$_TABLES['stories']} " . "WHERE (draft_flag = 0) AND (date <= NOW()) " . "  AND (UNIX_TIMESTAMP(date) BETWEEN '" . Dataproxy::$startDate . "' AND '" . Dataproxy::$endDate . "') " . "  AND (sid IN ('" . implode("', '", $sids) . "')) ";
     if (!Dataproxy::isRoot()) {
         $sql .= COM_getPermSql('AND', Dataproxy::uid());
         if ($all_langs === FALSE) {
             $sql .= COM_getLangSQL('sid', 'AND');
         }
     }
     $sql .= " ORDER BY date DESC ";
     $result = DB_query($sql);
     if (DB_error()) {
         return $retval;
     }
     while (($A = DB_fetchArray($result, FALSE)) !== FALSE) {
         $entry = array();
         $entry['id'] = stripslashes($A['sid']);
         $entry['title'] = stripslashes($A['title']);
         $entry['uri'] = COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . stripslashes($A['sid']));
         $entry['date'] = $A['day'];
         $entry['imageurl'] = FALSE;
         $retval[] = $entry;
     }
     return $retval;
 }
开发者ID:milk54,项目名称:geeklog-japan,代码行数:59,代码来源:article2.class.php

示例11: DIR_displayAll

/**
* Display main view (list of years)
*
* Displays an overview of all the years and months, starting with the first
* year for which a story has been posted. Can optionally display a list of
* the stories for the current month at the top of the page.
*
* @param    string  $topic                  current topic
* @param    boolean $list_current_month     true = list stories f. current month
* @return   string                          list of all the years in the db
*
*/
function DIR_displayAll($topic, $list_current_month = false)
{
    global $_TABLES, $LANG_DIR;
    $retval = '';
    if ($list_current_month) {
        $currentyear = date('Y', time());
        $currentmonth = date('n', time());
        $retval .= DIR_displayMonth($topic, $currentyear, $currentmonth);
        $retval .= '<hr' . XHTML . '>' . LB;
    }
    $retval .= '<div><h1 style="display:inline">' . $LANG_DIR['title'] . '</h1> ' . DIR_topicList($topic) . '</div>' . LB;
    $yearsql = array();
    $yearsql['mysql'] = "SELECT DISTINCT YEAR(date) AS year,date FROM {$_TABLES['stories']} WHERE (draft_flag = 0) AND (date <= NOW())" . COM_getTopicSql('AND') . COM_getPermSql('AND') . COM_getLangSQL('sid', 'AND');
    $yearsql['mssql'] = "SELECT YEAR(date) AS year FROM {$_TABLES['stories']} WHERE (draft_flag = 0) AND (date <= NOW())" . COM_getTopicSql('AND') . COM_getPermSql('AND') . COM_getLangSQL('sid', 'AND');
    $yearsql['pgsql'] = "SELECT EXTRACT( YEAR from date) AS year FROM {$_TABLES['stories']} WHERE (draft_flag = 0) AND (date <= NOW())" . COM_getTopicSql('AND') . COM_getPermSql('AND') . COM_getLangSQL('sid', 'AND');
    $ysql = array();
    $ysql['mysql'] = $yearsql['mysql'] . " GROUP BY YEAR(date) ORDER BY date DESC";
    $ysql['mssql'] = $yearsql['mssql'] . " GROUP BY YEAR(date) ORDER BY YEAR(date) DESC";
    $ysql['pgsql'] = $yearsql['pgsql'] . " GROUP BY year,date ORDER BY year DESC";
    $yresult = DB_query($ysql);
    $numyears = DB_numRows($yresult);
    for ($i = 0; $i < $numyears; $i++) {
        $Y = DB_fetchArray($yresult);
        $retval .= DIR_displayYear($topic, $Y['year']);
    }
    return $retval;
}
开发者ID:alxstuart,项目名称:ajfs.me,代码行数:39,代码来源:directory.php

示例12: plugin_getwhatsnewcomment_story

/**
* Return new Story comments for the What's New block
*
* @param    string  $numreturn  If 0 will return results for What's New Block. 
*                               If > 0 will return last X new comments for User Profile.
* @param    string  $uid        ID of the user to return results for. 0 = all users.
* @return   array list of new comments (dups, type, title, sid, lastdate) or (sid, title, cid, unixdate)
*
*/
function plugin_getwhatsnewcomment_story($numreturn = 0, $uid = 0)
{
    global $_CONF, $_TABLES;
    $topicsql = COM_getTopicSql('AND', 0, $_TABLES['stories']);
    $stwhere = '';
    if (!COM_isAnonUser()) {
        $stwhere .= "(({$_TABLES['stories']}.owner_id IS NOT NULL AND {$_TABLES['stories']}.perm_owner IS NOT NULL) OR ";
        $stwhere .= "({$_TABLES['stories']}.group_id IS NOT NULL AND {$_TABLES['stories']}.perm_group IS NOT NULL) OR ";
        $stwhere .= "({$_TABLES['stories']}.perm_members IS NOT NULL))";
    } else {
        $stwhere .= "({$_TABLES['stories']}.perm_anon IS NOT NULL)";
    }
    if ($uid > 0) {
        $stwhere .= " AND ({$_TABLES['comments']}.uid = {$uid})";
    }
    if ($numreturn == 0) {
        $sql['mssql'] = "SELECT DISTINCT COUNT(*) AS dups, type, {$_TABLES['stories']}.title, {$_TABLES['stories']}.sid, max({$_TABLES['comments']}.date) AS lastdate FROM {$_TABLES['comments']} LEFT JOIN {$_TABLES['stories']} ON (({$_TABLES['stories']}.sid = {$_TABLES['comments']}.sid) AND type = 'article' " . COM_getPermSQL('AND', 0, 2, $_TABLES['stories']) . " AND ({$_TABLES['stories']}.draft_flag = 0) AND ({$_TABLES['stories']}.commentcode >= 0)" . $topicsql . COM_getLangSQL('sid', 'AND', $_TABLES['stories']) . ") WHERE ({$_TABLES['comments']}.date >= (DATE_SUB(NOW(), INTERVAL {$_CONF['newcommentsinterval']} SECOND))) AND ((({$stwhere}))) GROUP BY {$_TABLES['comments']}.sid,type, {$_TABLES['stories']}.title, {$_TABLES['stories']}.title, {$_TABLES['stories']}.sid ORDER BY 5 DESC LIMIT 15";
        $sql['mysql'] = "SELECT DISTINCT COUNT(*) AS dups, type, {$_TABLES['stories']}.title, {$_TABLES['stories']}.sid, max({$_TABLES['comments']}.date) AS lastdate FROM {$_TABLES['comments']} LEFT JOIN {$_TABLES['stories']} ON (({$_TABLES['stories']}.sid = {$_TABLES['comments']}.sid) AND type = 'article' " . COM_getPermSQL('AND', 0, 2, $_TABLES['stories']) . " AND ({$_TABLES['stories']}.draft_flag = 0) AND ({$_TABLES['stories']}.commentcode >= 0)" . $topicsql . COM_getLangSQL('sid', 'AND', $_TABLES['stories']) . ") WHERE ({$_TABLES['comments']}.date >= (DATE_SUB(NOW(), INTERVAL {$_CONF['newcommentsinterval']} SECOND))) AND ((({$stwhere}))) GROUP BY {$_TABLES['comments']}.sid,type, {$_TABLES['stories']}.title, {$_TABLES['stories']}.title, {$_TABLES['stories']}.sid ORDER BY 5 DESC LIMIT 15";
        $sql['pgsql'] = "SELECT DISTINCT COUNT(*) AS dups, type, {$_TABLES['stories']}.title, {$_TABLES['stories']}.sid, max({$_TABLES['comments']}.date) AS lastdate FROM {$_TABLES['comments']} LEFT JOIN {$_TABLES['stories']} ON (({$_TABLES['stories']}.sid = {$_TABLES['comments']}.sid) AND type = 'article' " . COM_getPermSQL('AND', 0, 2, $_TABLES['stories']) . " AND ({$_TABLES['stories']}.draft_flag = 0) AND ({$_TABLES['stories']}.commentcode >= 0)" . $topicsql . COM_getLangSQL('sid', 'AND', $_TABLES['stories']) . ") WHERE ({$_TABLES['comments']}.date >= (NOW()+ INTERVAL '{$_CONF['newcommentsinterval']} SECOND')) AND ((({$stwhere}))) GROUP BY {$_TABLES['comments']}.sid,type, {$_TABLES['stories']}.title, {$_TABLES['stories']}.title, {$_TABLES['stories']}.sid ORDER BY 5 DESC LIMIT 15";
    } else {
        $sql = "SELECT {$_TABLES['stories']}.sid, {$_TABLES['comments']}.title, cid, UNIX_TIMESTAMP({$_TABLES['comments']}.date) AS unixdate FROM {$_TABLES['comments']} LEFT JOIN {$_TABLES['stories']} ON (({$_TABLES['stories']}.sid = {$_TABLES['comments']}.sid) AND type = 'article' " . COM_getPermSQL('AND', 0, 2, $_TABLES['stories']) . " AND ({$_TABLES['stories']}.draft_flag = 0) AND ({$_TABLES['stories']}.commentcode >= 0)" . $topicsql . COM_getLangSQL('sid', 'AND', $_TABLES['stories']) . ") WHERE ({$stwhere}) ORDER BY unixdate DESC LIMIT {$numreturn}";
    }
    $result = DB_query($sql);
    $nrows = DB_numRows($result);
    if ($nrows > 0) {
        for ($x = 0; $x < $nrows; $x++) {
            $A[] = DB_fetchArray($result);
        }
        return $A;
    }
}
开发者ID:alxstuart,项目名称:ajfs.me,代码行数:40,代码来源:lib-story.php

示例13: COM_whatsNewBlock

/**
 * Shows any new information in a block
 * Return the HTML that shows any new stories, comments, etc
 *
 * @param    string $help     Help file for block
 * @param    string $title    Title used in block header
 * @param    string $position Position in which block is being rendered 'left', 'right' or blank (for centre)
 * @return   string           Return the HTML that shows any new stories, comments, etc
 */
function COM_whatsNewBlock($help = '', $title = '', $position = '')
{
    global $_CONF, $_TABLES, $LANG01, $LANG_WHATSNEW;
    if ($_CONF['whatsnew_cache_time'] > 0) {
        $cacheInstance = 'whatsnew__' . CACHE_security_hash() . '__' . $_CONF['theme'];
        $retval = CACHE_check_instance($cacheInstance);
        if ($retval) {
            $lu = CACHE_get_instance_update($cacheInstance);
            $now = time();
            if ($now - $lu < $_CONF['whatsnew_cache_time']) {
                return $retval;
            }
        }
    }
    $retval = COM_startBlock($title, $help, COM_getBlockTemplate('whats_new_block', 'header', $position));
    $topicSql = '';
    if ($_CONF['hidenewstories'] == 0 || $_CONF['hidenewcomments'] == 0 || $_CONF['trackback_enabled'] && $_CONF['hidenewtrackbacks'] == 0) {
        $topicSql = COM_getTopicSQL('AND', 0, 'ta');
    }
    if ($_CONF['hidenewstories'] == 0) {
        $where_sql = " AND ta.type = 'article' AND ta.id = sid";
        $archiveTid = DB_getItem($_TABLES['topics'], 'tid', "archive_flag=1");
        if (!empty($archiveTid)) {
            $where_sql .= " AND (ta.tid <> '{$archiveTid}')";
        }
        // Find the newest stories
        $sql['mysql'] = "SELECT sid, title FROM {$_TABLES['stories']}, {$_TABLES['topic_assignments']} ta\n            WHERE (date >= (date_sub(NOW(), INTERVAL {$_CONF['newstoriesinterval']} SECOND))) AND (date <= NOW()) AND (draft_flag = 0)" . $where_sql . COM_getPermSQL('AND') . $topicSql . COM_getLangSQL('sid', 'AND') . "\n            GROUP BY sid, title, date ORDER BY date DESC";
        $sql['pgsql'] = "SELECT sid, title FROM {$_TABLES['stories']}, {$_TABLES['topic_assignments']} ta\n            WHERE (date >= (NOW() - INTERVAL '{$_CONF['newstoriesinterval']} SECOND')) AND (date <= NOW()) AND (draft_flag = 0)" . $where_sql . COM_getPermSQL('AND') . $topicSql . COM_getLangSQL('sid', 'AND') . "\n            GROUP BY sid, title, date ORDER BY date DESC";
        $result = DB_query($sql);
        $numRows = DB_numRows($result);
        if (empty($title)) {
            $title = DB_getItem($_TABLES['blocks'], 'title', "name='whats_new_block'");
        }
        // Any late breaking news stories?
        $retval .= '<h3>' . $LANG01[99] . ' <small>' . COM_formatTimeString($LANG_WHATSNEW['new_last'], $_CONF['newstoriesinterval']) . '</small></h3>';
        if ($numRows > 0) {
            $newArticles = array();
            for ($x = 0; $x < $numRows; $x++) {
                $A = DB_fetchArray($result);
                $url = COM_buildURL($_CONF['site_url'] . '/article.php?story=' . $A['sid']);
                $title = COM_undoSpecialChars(stripslashes($A['title']));
                $titleToUse = COM_truncate($title, $_CONF['title_trim_length'], '...');
                if ($title != $titleToUse) {
                    $attr = array('title' => htmlspecialchars($title));
                } else {
                    $attr = array();
                }
                $anchorText = str_replace('$', '&#36;', $titleToUse);
                $anchorText = str_replace(' ', '&nbsp;', $anchorText);
                $newArticles[] = COM_createLink($anchorText, $url, $attr);
            }
            $retval .= COM_makeList($newArticles, 'list-new-plugins');
        } else {
            $retval .= $LANG01[100] . '<br' . XHTML . '>' . LB;
            // No new stories
        }
        if ($_CONF['hidenewcomments'] == 0 || $_CONF['hidenewplugins'] == 0 || $_CONF['trackback_enabled'] && $_CONF['hidenewtrackbacks'] == 0) {
            $retval .= '<div class="divider-whats-new"></div>';
        }
    }
    if ($_CONF['hidenewcomments'] == 0) {
        // Go get the newest comments
        $retval .= '<h3>' . $LANG01[83] . ' <small>' . COM_formatTimeString($LANG_WHATSNEW['new_last'], $_CONF['newcommentsinterval']) . '</small></h3>';
        $new_plugin_comments = PLG_getWhatsNewComment();
        if (!empty($new_plugin_comments)) {
            // Sort array by element lastdate newest to oldest
            foreach ($new_plugin_comments as $k => $v) {
                $b[$k] = strtolower($v['lastdate']);
            }
            arsort($b);
            $temp = array();
            foreach ($b as $key => $val) {
                $temp[] = $new_plugin_comments[$key];
            }
            $new_plugin_comments = $temp;
            $newComments = array();
            $count = 0;
            foreach ($new_plugin_comments as $A) {
                $count .= +1;
                $url = '';
                $info = PLG_getItemInfo($A['type'], $A['sid'], 'url');
                if (!empty($info)) {
                    $url = $info . '#comments';
                }
                // Check to see if url (plugin may not support PLG_getItemInfo
                if (!empty($url)) {
                    $title = COM_undoSpecialChars(stripslashes($A['title']));
                    $titleToUse = COM_truncate($title, $_CONF['title_trim_length'], '...');
                    if ($title != $titleToUse) {
                        $attr = array('title' => htmlspecialchars($title));
                    } else {
//.........这里部分代码省略.........
开发者ID:Geeklog-Japan,项目名称:geeklog-japan,代码行数:101,代码来源:lib-common.php

示例14: parse

 public function parse($p1, $p2 = '', $fulltag)
 {
     global $_CONF, $_TABLES, $_USER, $LANG01;
     USES_lib_comments();
     $retval = '';
     $skip = 0;
     $dt = new Date('now', $_USER['tzid']);
     // topic = specific topic or 'all'
     // display = how many stories to display, if 0, then all
     // meta = show meta data (i.e.; who when etc)
     // titleLink - make title a hot link
     // featured - 0 = show all, 1 = only featured, 2 = all except featured
     // frontpage - 1 = show only items marked for frontpage - 0 = show all
     // cols - number of columns to show
     // template - the template name
     $topic = $p1;
     if ($topic == 'all') {
         $topic = '';
     }
     $uniqueID = md5($p1 . $p2);
     $display = 10;
     // display 10 articles
     $meta = 0;
     // do not display meta data
     $titleLink = 0;
     // do not use links in title
     $featured = 0;
     // 0 = show all, 1 = only featured, 2 = all except featured
     $frontpage = 0;
     // only show items marked for frontpage
     $cols = 3;
     // number of columns
     $truncate = 0;
     // maximum number of characters to include in story text
     $template = 'headlines.thtml';
     $px = explode(' ', trim($p2));
     if (is_array($px)) {
         foreach ($px as $part) {
             if (substr($part, 0, 8) == 'display:') {
                 $a = explode(':', $part);
                 $display = $a[1];
                 $skip++;
             } elseif (substr($part, 0, 5) == 'meta:') {
                 $a = explode(':', $part);
                 $meta = $a[1];
                 $skip++;
             } elseif (substr($part, 0, 10) == 'titlelink:') {
                 $a = explode(':', $part);
                 $titleLink = $a[1];
                 $skip++;
             } elseif (substr($part, 0, 9) == 'featured:') {
                 $a = explode(':', $part);
                 $featured = $a[1];
                 $skip++;
             } elseif (substr($part, 0, 10) == 'frontpage:') {
                 $a = explode(':', $part);
                 $frontpage = (int) $a[1];
                 $skip++;
             } elseif (substr($part, 0, 5) == 'cols:') {
                 $a = explode(':', $part);
                 $cols = $a[1];
                 $skip++;
             } elseif (substr($part, 0, 9) == 'template:') {
                 $a = explode(':', $part);
                 $template = $a[1];
                 $skip++;
             } elseif (substr($part, 0, 9) == 'truncate:') {
                 $a = explode(':', $part);
                 $truncate = (int) $a[1];
                 $skip++;
             } else {
                 break;
             }
         }
         if ($skip != 0) {
             if (count($px) > $skip) {
                 for ($i = 0; $i < $skip; $i++) {
                     array_shift($px);
                 }
                 $caption = trim(implode(' ', $px));
             } else {
                 $caption = '';
             }
         }
     } else {
         $caption = trim($p2);
     }
     if ($display < 0) {
         $display = 3;
     }
     $hash = CACHE_security_hash();
     $instance_id = 'whatsnew_headlines_' . $uniqueID . '_' . $hash . '_' . $_USER['theme'];
     if (($cache = CACHE_check_instance($instance_id, 0)) !== FALSE) {
         return $cache;
     }
     $archivetid = DB_getItem($_TABLES['topics'], 'tid', "archive_flag=1");
     $sql = " (date <= NOW()) AND (draft_flag = 0)";
     if (empty($topic)) {
         $sql .= COM_getLangSQL('tid', 'AND', 's');
     }
//.........这里部分代码省略.........
开发者ID:spacequad,项目名称:glfusion,代码行数:101,代码来源:headlines.class.php

示例15: MYCALJP_showStoriesIntro

function MYCALJP_showStoriesIntro()
{
    global $_CONF, $_TABLES, $_MYCALJP2_CONF;
    if (!$_MYCALJP2_CONF['showstoriesintro']) {
        return '';
    }
    $retval = '';
    $_dateStart = COM_applyFilter($_GET['datestart']);
    $_dateEnd = COM_applyFilter($_GET['dateend']);
    if (!empty($_dateStart) && !empty($_dateEnd)) {
        $ds = explode("-", $_dateStart);
        $de = explode("-", $_dateEnd);
        $startdate = mktime(0, 0, 0, $ds[1], $ds[2], $ds[0]);
        $enddate = mktime(23, 59, 59, $de[1], $de[2], $de[0]);
        $sql = "AND (UNIX_TIMESTAMP(date) BETWEEN '{$startdate}' AND '{$enddate}') ";
    }
    $sql .= "AND (draft_flag = 0) ";
    $sql .= COM_getPermSQL('AND', 0, 2, 's') . ' ';
    $sql .= COM_getTopicSQL('AND', 0, 'ta') . ' ';
    $sql .= COM_getLangSQL('sid', 'AND', 's') . ' ';
    $userfields = 'u.username, u.fullname';
    if ($_CONF['allow_user_photo'] == 1) {
        $userfields .= ', u.photo';
        if ($_CONF['use_gravatar']) {
            $userfields .= ', u.email';
        }
    }
    $msql = array();
    $msql['mysql'] = "SELECT DISTINCT STRAIGHT_JOIN s.*, UNIX_TIMESTAMP(s.date) AS unixdate, " . "UNIX_TIMESTAMP(s.expire) AS expireunix, " . $userfields . ", t.topic, t.imageurl " . "FROM {$_TABLES['stories']} AS s, {$_TABLES['users']} AS u, " . "{$_TABLES['topics']} AS t, {$_TABLES['topic_assignments']} AS ta " . "WHERE (ta.type = 'article') AND (ta.tdefault = 1) AND (s.uid = u.uid) AND (ta.tid = t.tid) AND (s.sid = ta.id) " . $sql . "ORDER BY featured DESC, date DESC";
    /*
        $msql['mssql']="SELECT STRAIGHT_JOIN s.sid, s.uid, s.draft_flag, s.tid, s.date, s.title, cast(s.introtext as text) as introtext, cast(s.bodytext as text) as bodytext, s.hits, s.numemails, s.comments, s.trackbacks, s.related, s.featured, s.show_topic_icon, s.commentcode, s.trackbackcode, s.statuscode, s.expire, s.postmode, s.frontpage, s.in_transit, s.owner_id, s.group_id, s.perm_owner, s.perm_group, s.perm_members, s.perm_anon, s.advanced_editor_mode, "
                 . " UNIX_TIMESTAMP(s.date) AS unixdate, "
                 . 'UNIX_TIMESTAMP(s.expire) as expireunix, '
                 . $userfields . ", t.topic, t.imageurl "
                 . "FROM {$_TABLES['stories']} AS s, {$_TABLES['users']} AS u, "
                 . "{$_TABLES['topics']} AS t, {$_TABLES['topic_assignments']} AS ta "
                 . "WHERE (ta.type = 'article') AND (ta.tdefault = 1) AND (s.uid = u.uid) AND (ta.tid = t.tid) AND (s.sid = ta.id) "
                 . $sql . "ORDER BY featured DESC, date DESC";
    */
    $result = DB_query($msql);
    require_once $_CONF['path_system'] . 'lib-story.php';
    $story = new Story();
    while ($A = DB_fetchArray($result)) {
        $story->loadFromArray($A);
        $retval .= STORY_renderArticle($story, 'y');
    }
    return $retval;
}
开发者ID:Geeklog-Japan,项目名称:geeklog-japan,代码行数:48,代码来源:calsearch.php


注:本文中的COM_getLangSQL函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。