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


PHP Globals::getGlobal方法代码示例

本文整理汇总了PHP中Globals::getGlobal方法的典型用法代码示例。如果您正苦于以下问题:PHP Globals::getGlobal方法的具体用法?PHP Globals::getGlobal怎么用?PHP Globals::getGlobal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Globals的用法示例。


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

示例1: ICDCodeSearch

 public function ICDCodeSearch($params)
 {
     ini_set('memory_limit', '256M');
     $type = Globals::getGlobal('dx_code_type');
     $query = is_object($params) ? $params->query : $params;
     /**
      * get last icd9 code revision
      */
     $revision = $this->getLastRevisionByCodeType('ICD9');
     $records = array();
     $whereQuery = '';
     $queries = explode(' ', $query);
     $wheres = array();
     $wheresIndex = 0;
     foreach ($queries as $q) {
         $q = trim($q);
         $w0 = ':W0' . $wheresIndex;
         $wheres[$w0] = '%' . $q . '%';
         $w1 = ':W1' . $wheresIndex;
         $wheres[$w1] = $q . '%';
         $w2 = ':W2' . $wheresIndex;
         $wheres[$w2] = $q . '%';
         $w3 = ':W3' . $wheresIndex++;
         $wheres[$w3] = $q . '%';
         $whereQuery .= " AND (short_desc \tLIKE {$w0}\n                         OR long_desc \t\t    LIKE {$w1}\n                         OR dx_code\t\t\t    LIKE {$w2}\n                         OR formatted_dx_code\tLIKE {$w3}) ";
     }
     if ($type == 'ICD9' || $type == 'BOTH') {
         /**
          * ICD9
          */
         $sql = "SELECT dx_id AS id,\n\t\t\t\t\t\t  formatted_dx_code,\n\t\t\t\t\t\t  formatted_dx_code AS code,\n\t\t\t\t\t\t  dx_code,\n\t\t\t\t\t\t  dx_code \t\t\tAS xcode,\n\t\t\t\t\t\t  long_desc,\n\t\t\t\t\t\t  long_desc \t\tAS code_text,\n\t\t\t\t\t\t  short_desc,\n\t\t\t\t\t\t  'ICD9-DX'\t\t\tAS code_type\n\t\t\t\t     FROM icd9_dx_code\n\t                WHERE active = '1'\n\t                  AND revision = '{$revision}'\n\t                  {$whereQuery}\n\t             ORDER BY formatted_dx_code ASC";
         $recordSet = $this->conn->prepare($sql);
         $recordSet->execute($wheres);
         $records = array_merge($records, $recordSet->fetchAll(PDO::FETCH_ASSOC));
     } elseif ($type == 'ICD10' || $type == 'BOTH') {
         /**
          *  get last icd10 code revision
          */
         $revision = $this->getLastRevisionByCodeType('ICD10');
         /**
          * ICD10 DX
          */
         $sql = "SELECT dx_id AS id,\n\t\t\t\t\t\t  formatted_dx_code,\n\t\t\t\t\t\t  formatted_dx_code AS code,\n\t\t\t\t\t\t  dx_code,\n\t\t\t\t\t\t  dx_code \t\t\tAS xcode,\n\t\t\t\t\t\t  long_desc,\n\t\t\t\t\t\t  TRIM(long_desc) \t\tAS code_text,\n\t\t\t\t\t\t  short_desc,\n\t\t\t\t\t\t  'ICD10-CM'\t\tAS code_type\n\t\t\t\t\t FROM icd10_dx_order_code\n                    WHERE active = '1'\n                      AND revision = '{$revision}'\n                     {$whereQuery}\n                 ORDER BY formatted_dx_code ASC";
         $recordSet = $this->conn->prepare($sql);
         $recordSet->execute($wheres);
         $records = array_merge($records, $recordSet->fetchAll(PDO::FETCH_ASSOC));
     }
     if (is_object($params)) {
         $total = count($records);
         if (isset($params->start) && isset($params->limit)) {
             $records = array_slice($records, $params->start, $params->limit, true);
         }
         return array('totals' => $total, 'rows' => $records);
     } else {
         return $records;
     }
 }
开发者ID:igez,项目名称:gaiaehr,代码行数:57,代码来源:DiagnosisCodes.php

示例2:

 function &current()
 {
     $temp = parent::current();
     if ($temp['invisible'] == 1) {
         Globals::setGlobal('num_online_invisible', Globals::getGlobal('num_online_invisible') + 1);
     }
     if ($temp['user_id'] != 0) {
         $group = get_user_max_group($temp, $this->groups);
         $temp['color'] = !isset($group['color']) || $group['color'] == '' ? '000000' : $group['color'];
         $temp['font_weight'] = @$group['min_perm'] > MEMBER ? 'bold' : 'normal';
     }
     /* Should we free the result? */
     if ($this->row == $this->size - 1) {
         $this->result->freeResult();
     }
     if ($temp['name'] != '' && (isset($temp['invisible']) && $temp['invisible'] == 0 || !isset($temp['invisible']))) {
         return $temp;
     }
 }
开发者ID:BackupTheBerlios,项目名称:k4bb,代码行数:19,代码来源:online_users.class.php

示例3: current

 function current()
 {
     $temp = parent::current();
     if ($temp['invisible'] == 1) {
         Globals::setGlobal('num_online_invisible', Globals::getGlobal('num_online_invisible') + 1);
     }
     if ($temp['user_id'] >= 0) {
         $group = get_user_max_group($temp, $this->groups);
         $temp['color'] = !isset($group['color']) || $group['color'] == '' ? '000000' : $group['color'];
         $temp['font_weight'] = @$group['min_perm'] > MEMBER ? 'bold' : 'normal';
     }
     /* Should we free the result? */
     if (!$this->hasNext()) {
         $this->result->free();
     }
     $temp['U_MEMBERURL'] = K4Url::getMemberUrl($temp['user_id']);
     //if($temp['name'] != '') {
     //	if(((isset($temp['invisible']) && $temp['invisible'] == 0) || !isset($temp['invisible']))) {
     return $temp;
     //	}
     //}
 }
开发者ID:BackupTheBerlios,项目名称:k4bb-svn,代码行数:22,代码来源:online_users.class.php

示例4: Execute

 function Execute(&$template, $request, &$dba, &$session, &$user)
 {
     global $_URL, $_QUERYPARAMS, $_USERGROUPS, $_SESS;
     /**
      * Error Checking
      */
     if (!isset($request['id']) || !$request['id'] || intval($request['id']) == 0) {
         /* set the breadcrumbs bit */
         $template = BreadCrumbs($template, $template->getVar('L_INVALIDTOPIC'));
         $template->setInfo('content', $template->getVar('L_TOPICDOESNTEXIST'), FALSE);
         return TRUE;
     }
     /* Get our topic */
     $topic = $dba->getRow("SELECT " . $_QUERYPARAMS['info'] . $_QUERYPARAMS['topic'] . " FROM " . TOPICS . " t LEFT JOIN " . INFO . " i ON t.topic_id = i.id WHERE i.id = " . intval($request['id']));
     if (!$topic || !is_array($topic) || empty($topic)) {
         /* set the breadcrumbs bit */
         $template = BreadCrumbs($template, $template->getVar('L_INVALIDTOPIC'));
         $template->setInfo('content', $template->getVar('L_TOPICDOESNTEXIST'), FALSE);
         return TRUE;
     }
     if ($topic['is_draft'] == 1) {
         /* set the breadcrumbs bit */
         $template = BreadCrumbs($template, $template->getVar('L_INVALIDTOPICVIEW'));
         $template->setInfo('content', $template->getVar('L_CANTVIEWDRAFT'), FALSE);
         return TRUE;
     }
     if ($topic['queue'] == 1) {
         /* set the breadcrumbs bit */
         $template = BreadCrumbs($template, $template->getVar('L_INVALIDTOPICVIEW'));
         $template->setInfo('content', $template->getVar('L_TOPICPENDINGMOD'), FALSE);
         return TRUE;
     }
     if ($topic['display'] == 0) {
         /* set the breadcrumbs bit */
         $template = BreadCrumbs($template, $template->getVar('L_INVALIDTOPICVIEW'));
         $template->setInfo('content', $template->getVar('L_TOPICISHIDDEN'), FALSE);
         return TRUE;
     }
     /* Get the current forum */
     $forum = $dba->getRow("SELECT " . $_QUERYPARAMS['info'] . $_QUERYPARAMS['forum'] . " FROM " . FORUMS . " f LEFT JOIN " . INFO . " i ON f.forum_id = i.id WHERE i.id = " . intval($topic['forum_id']));
     if (!$forum || !is_array($forum) || empty($forum)) {
         /* set the breadcrumbs bit */
         $template = BreadCrumbs($template, $template->getVar('L_INVALIDFORUM'));
         $template->setInfo('content', $template->getVar('L_FORUMDOESNTEXIST'), FALSE);
         return TRUE;
     }
     if (get_map($user, 'forums', 'can_view', array()) > $user['perms'] || get_map($user, 'topics', 'can_view', array('forum_id' => $forum['id'])) > $user['perms']) {
         /* set the breadcrumbs bit */
         $template = BreadCrumbs($template, $template->getVar('L_INFORMATION'), $forum['row_left'], $forum['row_right']);
         $template->setInfo('content', $template->getVar('L_PERMCANTVIEWTOPIC'), FALSE);
         return TRUE;
     }
     /**
      * Set the new breadcrumbs bit
      */
     $template = BreadCrumbs($template, $topic['name'], iif($topic['topic_type'] == TOPIC_GLOBAL, FALSE, $forum['row_left']), iif($topic['topic_type'] == TOPIC_GLOBAL, FALSE, $forum['row_right']));
     /** 
      * Get the users Browsing this topic 
      */
     /* Set the extra SQL query fields to check */
     $extra = " AND s.location_file = '" . $dba->Quote($_URL->file) . "' AND s.location_id = " . intval($topic['id']);
     $expired = time() - ini_get('session.gc_maxlifetime');
     $num_online_total = $dba->getValue("SELECT COUNT(s.id) FROM " . SESSIONS . " s WHERE s.seen >= {$expired} {$extra}");
     if ($num_online_total > 0) {
         $users_browsing =& new OnlineUsersIterator($extra);
         /* Set the users browsing list */
         $template->setList('users_browsing', $users_browsing);
         $stats = array('num_online_members' => Globals::getGlobal('num_online_members'), 'num_invisible' => Globals::getGlobal('num_online_invisible'), 'num_online_total' => $num_online_total);
         $stats['num_guests'] = $stats['num_online_total'] - $stats['num_online_members'] - $stats['num_invisible'];
         $template->setVar('num_online_members', $stats['num_online_members']);
         $template->setVar('users_browsing', $template->getVar('L_USERSBROWSINGTOPIC'));
         $template->setVar('online_stats', sprintf($template->getVar('L_USERSBROWSINGSTATS'), $stats['num_online_total'], $stats['num_online_members'], $stats['num_guests'], $stats['num_invisible']));
         /* Set the User's Browsing file */
         $template->setFile('users_browsing', 'users_browsing.html');
         $groups = array();
         /* Set the usergroups legend list */
         foreach ($_USERGROUPS as $group) {
             if ($group['display_legend'] == 1) {
                 $groups[] = $group;
             }
         }
         $groups =& new FAArrayIterator($groups);
         $template->setList('usergroups_legend', $groups);
     }
     /**
      * Is this topic expired?
      */
     $extra = '';
     if ($topic['topic_type'] > TOPIC_NORMAL && $topic['topic_expire'] > 0) {
         if ($topic['created'] + 3600 * 24 * $topic['topic_expire'] > time()) {
             $extra = ",topic_expire=0,topic_type=" . TOPIC_NORMAL;
         }
     }
     /**
      * Is this user subscribed to this topic?
      */
     $subscription = $dba->getRow("SELECT * FROM " . SUBSCRIPTIONS . " WHERE topic_id = " . intval($topic['id']) . " AND user_id = " . intval($user['id']));
     if (is_array($subscription) && !empty($subscription)) {
         if ($subscription['last_visit'] < $topic['reply_time']) {
             /* Set the user to keep subscribing to this topic */
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:k4bb,代码行数:101,代码来源:viewtopic.php

示例5: execute

 function execute(&$request)
 {
     global $_QUERYPARAMS, $_DATASTORE, $_SETTINGS;
     $this->dba = $request['dba'];
     /* set the breadcrumbs bit */
     k4_bread_crumbs($request['template'], $request['dba'], 'L_INFORMATION');
     /* Check the request ID */
     if (!isset($_REQUEST['forum_id']) || !$_REQUEST['forum_id'] || intval($_REQUEST['forum_id']) == 0) {
         $action = new K4InformationAction(new K4LanguageElement('L_FORUMDOESNTEXIST'), 'content', FALSE);
         return !USE_XMLHTTP ? $action->execute($request) : xmlhttp_message('L_FORUMDOESNTEXIST');
     }
     /* Check the request ID */
     if (!isset($_REQUEST['forum_id']) || !$_REQUEST['forum_id'] || intval($_REQUEST['forum_id']) == 0) {
         $action = new K4InformationAction(new K4LanguageElement('L_FORUMDOESNTEXIST'), 'content', FALSE);
         return !USE_XMLHTTP ? $action->execute($request) : xmlhttp_message('L_FORUMDOESNTEXIST');
     }
     $forum = $request['dba']->getRow("SELECT * FROM " . K4FORUMS . " WHERE forum_id = " . intval($_REQUEST['forum_id']));
     /* Check the forum data given */
     if (!$forum || !is_array($forum) || empty($forum)) {
         $action = new K4InformationAction(new K4LanguageElement('L_FORUMDOESNTEXIST'), 'content', FALSE);
         return !USE_XMLHTTP ? $action->execute($request) : xmlhttp_message('L_FORUMDOESNTEXIST');
     }
     /* Make sure the we are trying to post into a forum */
     if (!($forum['row_type'] & FORUM) || $forum['forum_id'] == GARBAGE_BIN) {
         $action = new K4InformationAction(new K4LanguageElement('L_CANTPOSTTONONFORUM'), 'content', FALSE);
         return !USE_XMLHTTP ? $action->execute($request) : xmlhttp_message('L_CANTPOSTTONONFORUM');
     }
     /* Do we have permission to post to this forum? */
     if ($request['user']->get('perms') < get_map('topics', 'can_add', array('forum_id' => $forum['forum_id']))) {
         $action = new K4InformationAction(new K4LanguageElement('L_PERMCANTPOST'), 'content', FALSE);
         return !USE_XMLHTTP ? $action->execute($request) : xmlhttp_message('L_PERMCANTPOST');
     }
     /* General error checking */
     if (!isset($_REQUEST['name']) || $_REQUEST['name'] == '') {
         $action = new K4InformationAction(new K4LanguageElement('L_INSERTTOPICNAME'), 'content', TRUE);
         return !USE_XMLHTTP ? $action->execute($request) : xmlhttp_message('L_INSERTTOPICNAME');
     }
     if (!$this->runPostFilter('name', new FALengthFilter(intval($_SETTINGS['topicmaxchars'])))) {
         $action = new K4InformationAction(new K4LanguageElement('L_TITLETOOSHORT', intval($_SETTINGS['topicminchars']), intval($_SETTINGS['topicmaxchars'])), 'content', TRUE);
         return !USE_XMLHTTP ? $action->execute($request) : xmlhttp_message(new K4LanguageElement('L_TITLETOOSHORT', intval($_SETTINGS['topicminchars']), intval($_SETTINGS['topicmaxchars'])));
     }
     if (!$this->runPostFilter('name', new FALengthFilter(intval($_SETTINGS['topicmaxchars']), intval($_SETTINGS['topicminchars'])))) {
         $action = new K4InformationAction(new K4LanguageElement('L_TITLETOOSHORT', intval($_SETTINGS['topicminchars']), intval($_SETTINGS['topicmaxchars'])), 'content', TRUE);
         return !USE_XMLHTTP ? $action->execute($request) : xmlhttp_message(new K4LanguageElement('L_TITLETOOSHORT', intval($_SETTINGS['topicminchars']), intval($_SETTINGS['topicmaxchars'])));
     }
     if (!isset($_REQUEST['message']) || $_REQUEST['message'] == '') {
         $action = new K4InformationAction(new K4LanguageElement('L_INSERTTOPICMESSAGE'), 'content', TRUE);
         return !USE_XMLHTTP ? $action->execute($request) : xmlhttp_message('L_INSERTTOPICMESSAGE');
     }
     /* Get our topic */
     $draft = $request['dba']->getRow("SELECT * FROM " . K4POSTS . " WHERE post_id = " . intval($_REQUEST['post_id']) . " AND is_draft = 1 AND poster_id = " . intval($request['user']->get('id')));
     if (!$draft || !is_array($draft) || empty($draft)) {
         $action = new K4InformationAction(new K4LanguageElement('L_DRAFTDOESNTEXIST'), 'content', FALSE);
         return !USE_XMLHTTP ? $action->execute($request) : xmlhttp_message('L_DRAFTDOESNTEXIST');
     }
     /* set the breadcrumbs bit */
     k4_bread_crumbs($request['template'], $request['dba'], 'L_POSTTOPIC', $forum);
     $created = time();
     /* Initialize the bbcode parser with the topic message */
     $_REQUEST['message'] = substr($_REQUEST['message'], 0, $_SETTINGS['postmaxchars']);
     /* Parse the bbcode */
     $body_text = $_REQUEST['message'];
     $submit_type = isset($_REQUEST['submit_type']) ? $_REQUEST['submit_type'] : 'post';
     if (!isset($_REQUEST['disable_bbcode']) || !$_REQUEST['disable_bbcode']) {
         $parser =& new BBParser();
         Globals::setGlobal('forum_id', $forum['forum_id']);
         Globals::setGlobal('maxpolloptions', $request['template']->getVar('maxpolloptions') > $forum['maxpolloptions'] ? $forum['maxpolloptions'] : $request['template']->getVar('maxpolloptions'));
         Globals::setGlobal('maxpollquestions', $request['template']->getVar('maxpollquestions') > $forum['maxpollquestions'] ? $forum['maxpollquestions'] : $request['template']->getVar('maxpollquestions'));
         if ($submit_type == 'post' || $submit_type == 'draft' || isset($_REQUEST['post'])) {
             $parser->register('BBPollNode');
         }
         $body_text = $parser->parse($body_text);
         $is_poll = Globals::getGlobal('is_poll');
     }
     // permissions are taken into account inside the poller
     //$poller		= &new K4BBPolls($body_text, $draft['body_text'], $forum, $draft['post_id']);
     /**
      * Figure out what type of topic type this is
      */
     $post_type = isset($_REQUEST['post_type']) && intval($_REQUEST['post_type']) != 0 ? $_REQUEST['post_type'] : TOPIC_NORMAL;
     if ($post_type == TOPIC_STICKY && $request['user']->get('perms') < get_map('sticky', 'can_add', array('forum_id' => $forum['forum_id']))) {
         $post_type = TOPIC_NORMAL;
     } else {
         if ($post_type == TOPIC_ANNOUNCE && $request['user']->get('perms') < get_map('announce', 'can_add', array('forum_id' => $forum['forum_id']))) {
             $post_type = TOPIC_NORMAL;
         }
     }
     $is_feature = isset($_REQUEST['is_feature']) && $_REQUEST['is_feature'] == 'yes' ? 1 : 0;
     if ($is_feature == 1 && $request['user']->get('perms') < get_map('feature', 'can_add', array('forum_id' => $forum['forum_id']))) {
         $is_feature = 0;
     }
     /* If we are submitting or saving a draft */
     if ($submit_type == 'post' || $submit_type == 'draft' || (isset($_REQUEST['post']) || isset($_REQUEST['draft']))) {
         /**
          * Build the queries to add the draft
          */
         $poster_name = $request['user']->get('id') <= 0 ? k4_htmlentities(isset($_REQUEST['poster_name']) ? $_REQUEST['poster_name'] : '', ENT_QUOTES) : $request['user']->get('name');
         $update_a = $request['dba']->prepareStatement("UPDATE " . K4POSTS . " SET name=?,body_text=?,posticon=?,disable_html=?,disable_bbcode=?,disable_emoticons=?,disable_sig=?,disable_areply=?,disable_aurls=?,is_draft=?,post_type=?,is_feature=?,is_poll=?,created=? WHERE post_id=?");
         /* Set the informtion */
         $update_a->setInt(1, $created);
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:k4bb-svn,代码行数:101,代码来源:topics.class.php

示例6: Execute

 function Execute(&$template, $request, &$dba, &$session, &$user)
 {
     global $_URL, $_QUERYPARAMS, $_USERGROUPS, $_SESS, $_ALLFORUMS;
     if (!isset($request['id']) || !$request['id'] || intval($request['id']) == 0) {
         /* set the breadcrumbs bit */
         $template = BreadCrumbs($template, $template->getVar('L_INVALIDFORUM'));
         $template->setInfo('content', $template->getVar('L_FORUMDOESNTEXIST'), FALSE);
         return TRUE;
     }
     /* Get the current forum/category */
     $forum = $_ALLFORUMS[$request['id']];
     $query = $forum['row_type'] & FORUM ? "SELECT " . $_QUERYPARAMS['info'] . $_QUERYPARAMS['forum'] . " FROM " . FORUMS . " f LEFT JOIN " . INFO . " i ON f.forum_id = i.id WHERE i.id = " . intval($request['id']) : "SELECT " . $_QUERYPARAMS['info'] . $_QUERYPARAMS['category'] . " FROM " . CATEGORIES . " c LEFT JOIN " . INFO . " i ON c.category_id = i.id WHERE i.id = " . intval($request['id']);
     $forum = $dba->getRow($query);
     if (!$forum || !is_array($forum) || empty($forum)) {
         /* set the breadcrumbs bit */
         $template = BreadCrumbs($template, $template->getVar('L_INVALIDFORUM'));
         $template->setInfo('content', $template->getVar('L_FORUMDOESNTEXIST'), FALSE);
         return TRUE;
     }
     if ($forum['row_type'] == FORUM && @$forum['is_link'] == 1) {
         $template = BreadCrumbs($template, $template->getVar('L_INFORMATION'), $forum['row_left'], $forum['row_right']);
         $template->setInfo('content', $template->getVar('L_REDIRECTING'));
         if ($forum['link_show_redirects'] == 1) {
             $template->setRedirect('redirect.php?id=' . $forum['id'], 3);
         } else {
             $template->setRedirect($forum['link_href'], 3);
         }
         return TRUE;
     }
     /* Set the extra SQL query fields to check */
     $extra = " AND s.location_file = '" . $dba->Quote($_URL->file) . "' AND s.location_id = " . intval($forum['id']);
     $forum_can_view = $forum['row_type'] & CATEGORY ? get_map($user, 'categories', 'can_view', array()) : get_map($user, 'forums', 'can_view', array());
     $expired = time() - ini_get('session.gc_maxlifetime');
     $num_online_total = $dba->getValue("SELECT COUNT(s.id) as num_online_total FROM " . SESSIONS . " s WHERE s.seen >= {$expired} {$extra}");
     /* If there are more than 0 people browsing the forum, display the stats */
     if ($num_online_total > 0 && $forum_can_view <= $user['perms'] && ($forum['row_type'] & CATEGORY || $forum['row_type'] & FORUM)) {
         $users_browsing =& new OnlineUsersIterator($extra);
         /* Set the users browsing list */
         $template->setList('users_browsing', $users_browsing);
         $stats = array('num_online_members' => Globals::getGlobal('num_online_members'), 'num_invisible' => Globals::getGlobal('num_online_invisible'), 'num_online_total' => $num_online_total);
         $stats['num_guests'] = $stats['num_online_total'] - $stats['num_online_members'] - $stats['num_invisible'];
         $element = $forum['row_type'] & CATEGORY ? 'L_USERSBROWSINGCAT' : 'L_USERSBROWSINGFORUM';
         $template->setVar('num_online_members', $stats['num_online_members']);
         $template->setVar('users_browsing', $template->getVar($element));
         $template->setVar('online_stats', sprintf($template->getVar('L_USERSBROWSINGSTATS'), $stats['num_online_total'], $stats['num_online_members'], $stats['num_guests'], $stats['num_invisible']));
         /* Set the User's Browsing file */
         $template->setFile('users_browsing', 'users_browsing.html');
         $groups = array();
         /* Set the usergroups legend list */
         foreach ($_USERGROUPS as $group) {
             if ($group['display_legend'] == 1) {
                 $groups[] = $group;
             }
         }
         $groups =& new FAArrayIterator($groups);
         $template->setList('usergroups_legend', $groups);
     }
     if ($forum_can_view > $user['perms']) {
         /* set the breadcrumbs bit */
         $template = BreadCrumbs($template, $template->getVar('L_INFORMATION'), $forum['row_left'], $forum['row_right']);
         $template->setInfo('content', $template->getVar('L_PERMCANTVIEW'), FALSE);
         return TRUE;
     }
     /* Set the breadcrumbs bit */
     $template = BreadCrumbs($template, NULL, $forum['row_left'], $forum['row_right']);
     /* Set all of the category/forum info to the template */
     $template->setVarArray($forum);
     /* If we are looking at a category */
     if ($forum['row_type'] & CATEGORY) {
         if (get_map($user, 'categories', 'can_view', array()) > $user['perms']) {
             /* set the breadcrumbs bit */
             $template = BreadCrumbs($template, $template->getVar('L_INFORMATION'), $forum['row_left'], $forum['row_right']);
             $template->setInfo('content', $template->getVar('L_PERMCANTVIEW'));
             return TRUE;
         }
         /* Set the proper query params */
         $query_params = $_QUERYPARAMS['info'] . $_QUERYPARAMS['category'];
         /* Set the Categories list */
         $categories =& new CategoriesIterator("SELECT {$query_params} FROM " . INFO . " i LEFT JOIN " . CATEGORIES . " c ON c.category_id = i.id WHERE i.row_type = " . CATEGORY . " AND i.row_left = " . $forum['row_left'] . " AND i.row_right = " . $forum['row_right'] . " AND i.id = " . $forum['id'] . " ORDER BY i.row_order ASC");
         $template->setList('categories', $categories);
         /* Hide the welcome message at the top of the forums.html template */
         $template->hide('welcome_msg');
         /* Show the forum status icons */
         $template->show('forum_status_icons');
         /* Show the 'Mark these forums Read' link */
         $template->show('mark_these_forums');
         /* Set the forums template to content variable */
         $template->setFile('content', 'forums.html');
         /* If we are looking at a forum */
     } else {
         if ($forum['row_type'] & FORUM) {
             /* Add the forum info to the template */
             foreach ($forum as $key => $val) {
                 $template->setVar('forum_' . $key, $val);
             }
             /* If this forum has sub-forums */
             if (isset_forum_cache_item('subforums', $forum['id']) && $forum['subforums'] == 1) {
                 /* Cache this forum as having subforums */
                 set_forum_cache_item('subforums', 1, $forum['id']);
                 /* Show the table that holds the subforums */
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:k4bb,代码行数:101,代码来源:viewforum.php

示例7: execute

 function execute(&$request)
 {
     global $_QUERYPARAMS, $_USERGROUPS, $_URL;
     /* set the breadcrumbs bit */
     k4_bread_crumbs($request['template'], $request['dba'], 'L_INFORMATION');
     if (isset($_REQUEST['f']) && intval($_REQUEST['f']) != 0 || isset($_REQUEST['c']) && intval($_REQUEST['c']) != 0) {
         $thing = isset($_REQUEST['f']) ? 'f' : 'c';
         $forum = $request['dba']->getRow("SELECT * FROM " . K4FORUMS . " WHERE forum_id = " . intval($_REQUEST[$thing]));
     } else {
         $action = new K4InformationAction(new K4LanguageElement('L_FORUMDOESNTEXIST'), 'content', TRUE);
         return $action->execute($request);
     }
     if (!$forum || !is_array($forum) || empty($forum)) {
         $action = new K4InformationAction(new K4LanguageElement('L_FORUMDOESNTEXIST'), 'content', FALSE);
         return $action->execute($request);
     }
     if ($forum['row_type'] & FORUM && $forum['is_link'] == 1) {
         if ($forum['link_show_redirects'] == 1) {
             $action = new K4InformationAction(new K4LanguageElement('L_REDIRECTING'), 'content', FALSE, 'redirect.php?id=' . $forum['forum_id'], 3);
         } else {
             $action = new K4InformationAction(new K4LanguageElement('L_REDIRECTING'), 'content', FALSE, $forum['link_href'], 3);
         }
         return $action->execute($request);
     }
     /* Set the extra SQL query fields to check */
     $extra = " AND location_file = '" . $request['dba']->Quote($_URL->file) . "' AND location_id = " . ($forum['row_type'] & CATEGORY ? intval($forum['category_id']) : intval($forum['forum_id']));
     $user_extra = $request['user']->isMember() ? ' OR (seen > 0 AND user_id = ' . intval($request['user']->get('id')) . ')' : '';
     $forum_can_view = $forum['row_type'] & CATEGORY ? get_map('', 'can_view', array('category_id' => $forum['category_id'])) : get_map('', 'can_view', array('forum_id' => $forum['forum_id']));
     $expired = time() - ini_get('session.gc_maxlifetime');
     $num_online_total = $request['dba']->getValue("SELECT COUNT(id) FROM " . K4SESSIONS . " WHERE ((seen >= {$expired} {$extra}) {$user_extra})");
     $num_online_total = !$request['user']->isMember() ? $num_online_total + 1 : $num_online_total;
     /* If there are more than 0 people browsing the forum, display the stats */
     if ($num_online_total > 0 && $forum_can_view <= $request['user']->get('perms')) {
         $query = "SELECT * FROM " . K4SESSIONS . " WHERE ((seen >= {$expired} {$extra}) {$user_extra}) AND ((user_id > 0) OR (user_id = 0 AND name <> '')) GROUP BY name ORDER BY seen DESC";
         $users_browsing =& new K4OnlineUsersIterator($request['dba'], '', $request['dba']->executeQuery($query));
         /* Set the users browsing list */
         $request['template']->setList('users_browsing', $users_browsing);
         $stats = array('num_online_members' => Globals::getGlobal('num_online_members'), 'num_invisible' => Globals::getGlobal('num_online_invisible'), 'num_online_total' => $num_online_total);
         $stats['num_guests'] = $stats['num_online_total'] - $stats['num_online_members'] - $stats['num_invisible'];
         $element = $forum['row_type'] & CATEGORY ? 'L_USERSBROWSINGCAT' : 'L_USERSBROWSINGFORUM';
         $request['template']->setVar('num_online_members', $stats['num_online_members']);
         $request['template']->setVar('users_browsing', $request['template']->getVar($element));
         $request['template']->setVar('online_stats', sprintf($request['template']->getVar('L_USERSBROWSINGSTATS'), $stats['num_online_total'], $stats['num_online_members'], $stats['num_guests'], $stats['num_invisible']));
         /* Set the User's Browsing file */
         $request['template']->setFile('users_browsing', 'users_browsing.html');
         $groups = array();
         /* Set the usergroups legend list */
         foreach ($_USERGROUPS as $group) {
             if ($group['display_legend'] == 1) {
                 $groups[] = $group;
             }
         }
         $groups =& new FAArrayIterator($groups);
         $request['template']->setList('usergroups_legend', $groups);
     }
     if ($forum_can_view > $request['user']->get('perms')) {
         $action = new K4InformationAction(new K4LanguageElement('L_PERMCANTVIEW'), 'content', FALSE);
         return $action->execute($request);
     }
     /**
      * Breadcrumbs 
      */
     /* Set the breadcrumbs bit */
     k4_bread_crumbs($request['template'], $request['dba'], NULL, $forum);
     /* Set if this breadcrumb should be 'new' or not */
     $icon = NULL;
     $new = $forum['row_type'] & FORUM ? forum_icon($forum, $icon) : FALSE;
     $request['template']->setVar('breadcrumb_new', $new == TRUE ? 'new' : '');
     /**
      * Forum/cateogry checking
      */
     /* Set all of the category/forum info to the template */
     $request['template']->setVarArray($forum);
     /**
      *
      * CATEGORY
      *
      */
     if ($forum['row_type'] & CATEGORY) {
         if (get_map('categories', 'can_view', array()) > $request['user']->get('perms')) {
             $action = new K4InformationAction(new K4LanguageElement('L_PERMCANTVIEW'), 'content', FALSE);
             return $action->execute($request);
         }
         /* Set the Categories list */
         $categories =& new K4ForumsIterator($request['dba'], "SELECT * FROM " . K4FORUMS . " WHERE forum_id = " . $forum['forum_id'] . " ORDER BY row_order ASC");
         $request['template']->setList('tlforums', $categories);
         /* Hide the welcome message at the top of the forums.html template */
         $request['template']->setVisibility('welcome_msg', FALSE);
         /* Show the forum status icons */
         $request['template']->setVisibility('forum_status_icons', TRUE);
         /* Show the 'Mark these forums Read' link */
         $request['template']->setVisibility('mark_these_forums', TRUE);
         /* Set the forums template to content variable */
         $request['template']->setFile('content', 'forums.html');
         /**
          *
          * FORUM / META FORUM
          *
          */
     } else {
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:k4bb-svn,代码行数:101,代码来源:viewforum.php

示例8: getFields

 /**
  * @brief       Get Form Fields by Form ID or Form Title
  * @details     We can get the form fields by form name or form if
  *              example: getFields('Demographics') or getFields('1')
  *              The logic of the function is to get the form parent field
  *              and its options, then get the child items if any with it options.
  *              Then.. use reg Expression to remove the double quotes from all
  *              the options and leave the double quotes to all options values,
  *              unless the value is a int or bool.
  *
  * @author      Ernesto J. Rodriguez (Certun) <erodriguez@certun.com>
  * @version     Vega 1.0
  *
  * @param       stdClass $params With the form Title or Form ID
  * @internal    $params->formToRender Holds the Title or ID of the form to render
  * @return      string String of javascript array
  */
 function getFields(stdClass $params)
 {
     $this->setModels();
     /**
      * define $items as an array to push all the $item into.
      */
     $items = [];
     /**
      * get the form parent fields
      */
     $records = $this->ff->sql("Select ff.*\n                         FROM `forms_fields` AS ff\n                    LEFT JOIN `forms_layout` AS fl\n                           ON ff.`form_id` = fl.`id`\n                        WHERE (fl.`name` = '{$params->formToRender}' OR fl.`id` = '{$params->formToRender}')\n                          AND ff.`parentId` = 'root'\n                     ORDER BY ff.`x_index` ASC, ff.`id` ASC")->all();
     /**
      * for each parent item lets get all the options and children items
      */
     foreach ($records as $item) {
         /**
          * get parent field options using the parent item "id" as parameter and
          * store the return array in $opts.
          */
         $opts = $this->getItemsOptions($item['id']);
         /**
          * now take each option and add it to this $item array
          */
         foreach ($opts as $opt => $val) {
             if ($opt != 'pos') {
                 $item[$opt] = $val;
             }
         }
         if ($item['xtype'] == 'combobox') {
             $item = $this->getComboDefaults($item);
             $item['store'] = $this->getStore($item['list_id']);
         }
         if ($item['xtype'] == 'datefield') {
             $item['format'] = 'Y-m-d';
         }
         /**
          * now lets get the the child items using the parent item ID parameter
          */
         $item['items'] = $this->getChildItems($item['id']);
         if ($item['xtype'] == 'fieldset' && $item['title'] == 'Assessment') {
             $item['items'][] = ['xtype' => 'icdsfieldset', 'emptyText' => 'Search For Diagnosis Codes', 'name' => 'dxCodes'];
         }
         /**
          * lets check if this item has a child items. If not, the unset the $item['Items']
          * this way we make sure the we done return a items property
          */
         if ($item['items'] == null) {
             unset($item['items']);
         }
         /**
          * unset the stuff that are not properties
          */
         unset($item['id'], $item['form_id'], $item['parentId'], $item['x_index']);
         /**
          * push this item into the $items Array
          */
         if (Globals::getGlobal('compact_demographics') && $item['xtype'] == 'fieldset' && $params->formToRender == 1) {
             $item['xtype'] = 'panel';
             $item['border'] = false;
             $item['bodyBorder'] = false;
             $item['bodyPadding'] = 10;
             //				if($item['title'] == 'Primary Insurance' || $item['title'] == 'Secondary Insurance' || $item['title'] == 'Tertiary Insurance' ){
             //					array_push($items2, $item);
             //				}else{
             array_push($items, $item);
             //				}
         } else {
             array_push($items, $item);
         }
     }
     /**
      * <p>In this next block of code we are going to clean the json output using a reg expression
      * to remove the unnecessary double quotes from the properties, bools, and ints values.
      * basically we start we this input..</p>
      * <code>
      * [{
      *      "xtype":"fieldset",
      *      "title":"Who",
      *      "collapsible":"true",
      *      "items":[{
      *          "xtype":"fieldcontainer",
      *          "fieldLabel":"Name",
      *          "layout":"hbox",
//.........这里部分代码省略.........
开发者ID:songhongji,项目名称:gaiaehr,代码行数:101,代码来源:FormLayoutEngine.php

示例9: execute

 function execute(&$request)
 {
     if (USE_XMLHTTP) {
         if (!isset($_REQUEST['post_id']) || intval($_REQUEST['post_id']) == 0) {
             return xmlhttp_message('L_YOUNEEDPERMS');
         }
         // get the post
         $post = $request['dba']->getRow("SELECT * FROM " . K4POSTS . " WHERE post_id = " . intval($_REQUEST['post_id']));
         if (!is_array($post) || empty($post)) {
             return xmlhttp_message('L_POSTDOESNTEXIST');
         }
         if ($post['row_type'] & TOPIC) {
             if ($request['user']->get('id') == $post['poster_id'] && $request['user']->get('perms') < get_map($user, 'topics', 'can_edit', array('forum_id' => $post['forum_id']))) {
                 return xmlhttp_message('L_YOUNEEDPERMS');
             }
             if ($request['user']->get('id') != $post['poster_id'] && $request['user']->get('perms') < get_map($user, 'other_topics', 'can_edit', array('forum_id' => $post['forum_id']))) {
                 return xmlhttp_message('L_YOUNEEDPERMS');
             }
         } else {
             if ($post['row_type'] & REPLY) {
                 if ($request['user']->get('id') == $post['poster_id'] && $request['user']->get('perms') < get_map($user, 'replies', 'can_edit', array('forum_id' => $post['forum_id']))) {
                     return xmlhttp_message('L_YOUNEEDPERMS');
                 }
                 if ($request['user']->get('id') != $post['poster_id'] && $request['user']->get('perms') < get_map($user, 'other_replies', 'can_edit', array('forum_id' => $post['forum_id']))) {
                     return xmlhttp_message('L_YOUNEEDPERMS');
                 }
             } else {
                 return xmlhttp_message('L_YOUNEEDPERMS');
             }
         }
         if (!isset($_REQUEST['message']) || $_REQUEST['message'] == '') {
             return xmlhttp_message('L_INSERTPOSTMESSAGE');
         }
         global $_ALLFORUMS;
         Globals::setGlobal('forum_id', $post['forum_id']);
         Globals::setGlobal('maxpolloptions', $request['template']->getVar('maxpolloptions') > $_ALLFORUMS[$post['forum_id']]['maxpolloptions'] ? $_ALLFORUMS[$post['forum_id']]['maxpolloptions'] : $request['template']->getVar('maxpolloptions'));
         Globals::setGlobal('maxpollquestions', $request['template']->getVar('maxpollquestions') > $_ALLFORUMS[$post['forum_id']]['maxpollquestions'] ? $_ALLFORUMS[$post['forum_id']]['maxpollquestions'] : $request['template']->getVar('maxpollquestions'));
         $parser =& new BBParser();
         $parser->register('BBPollNode');
         $body_text = $parser->parse($_REQUEST['message']);
         $body_text = $parser->comparePolls($post['post_id'], $body_text, $post['body_text'], $request['dba']);
         $is_poll = Globals::getGlobal('is_poll');
         /* If this topic is a redirect/ connects to one, update the original */
         if ($post['row_type'] & TOPIC && ($post['moved_new_post_id'] > 0 || $post['moved_old_post_id'] > 0)) {
             $update = $request['dba']->prepareStatement("UPDATE " . K4POSTS . " SET body_text=?,edited_time=?,edited_username=?,edited_userid=?,is_poll=? WHERE post_id=?");
             $update->setString(1, $body_text);
             $update->setInt(2, time());
             $update->setString(3, $request['user']->get('name'));
             $update->setInt(4, $request['user']->get('id'));
             $update->setInt(5, $is_poll);
             $update->setInt(6, $post['moved_new_post_id'] > 0 ? $post['moved_new_post_id'] : $post['moved_old_post_id']);
             $update->executeUpdate();
         }
         /* Update the original */
         $update = $request['dba']->prepareStatement("UPDATE " . K4POSTS . " SET body_text=?,edited_time=?,edited_username=?,edited_userid=?,is_poll=? WHERE post_id=?");
         $update->setString(1, $body_text);
         $update->setInt(2, time());
         $update->setString(3, $request['user']->get('name'));
         $update->setInt(4, $request['user']->get('id'));
         $update->setInt(5, $is_poll);
         $update->setInt(6, $post['post_id']);
         $update->executeUpdate();
         xmlhttp_header();
         echo $body_text;
         xmlhttp_footer();
     }
     return TRUE;
 }
开发者ID:BackupTheBerlios,项目名称:k4bb-svn,代码行数:68,代码来源:misc.php

示例10: execute

 function execute(&$request)
 {
     global $_QUERYPARAMS, $_DATASTORE, $_SETTINGS;
     /* set the breadcrumbs bit */
     k4_bread_crumbs($request['template'], $request['dba'], 'L_INFORMATION');
     /* Check the request ID */
     if (!isset($_REQUEST['forum_id']) || !$_REQUEST['forum_id'] || intval($_REQUEST['forum_id']) == 0) {
         $action = new K4InformationAction(new K4LanguageElement('L_FORUMDOESNTEXIST'), 'content', FALSE);
         return !USE_XMLHTTP ? $action->execute($request) : xmlhttp_message('L_FORUMDOESNTEXIST');
     }
     $forum = $request['dba']->getRow("SELECT * FROM " . K4FORUMS . " WHERE forum_id=" . intval($_REQUEST['forum_id']));
     /* Check the forum data given */
     if (!$forum || !is_array($forum) || empty($forum)) {
         $action = new K4InformationAction(new K4LanguageElement('L_FORUMDOESNTEXIST'), 'content', FALSE);
         return !USE_XMLHTTP ? $action->execute($request) : xmlhttp_message('L_FORUMDOESNTEXIST');
     }
     /* Make sure the we are trying to edit in a forum */
     if (!($forum['row_type'] & FORUM) || $forum['forum_id'] == GARBAGE_BIN) {
         $action = new K4InformationAction(new K4LanguageElement('L_CANTEDITTONONFORUM'), 'content', FALSE);
         return !USE_XMLHTTP ? $action->execute($request) : xmlhttp_message('L_CANTEDITTONONFORUM');
     }
     /* General error checking */
     if ($this->row_type & TOPIC) {
         if (!isset($_REQUEST['name']) || $_REQUEST['name'] == '') {
             $action = new K4InformationAction(new K4LanguageElement('L_INSERTTOPICNAME'), 'content', TRUE);
             return !USE_XMLHTTP ? $action->execute($request) : xmlhttp_message('L_INSERTTOPICNAME');
         }
         $len = strlen($_REQUEST['name']);
         if ($len < intval($_SETTINGS['topicminchars']) || $len > intval($_SETTINGS['topicmaxchars'])) {
             $action = new K4InformationAction(new K4LanguageElement('L_TITLETOOSHORT', intval($_SETTINGS['topicminchars']), intval($_SETTINGS['topicmaxchars'])), 'content', TRUE);
             return !USE_XMLHTTP ? $action->execute($request) : xmlhttp_message(new K4LanguageElement('L_TITLETOOSHORT', intval($_SETTINGS['topicminchars']), intval($_SETTINGS['topicmaxchars'])));
         }
     }
     if (!isset($_REQUEST['message']) || $_REQUEST['message'] == '') {
         $action = new K4InformationAction(new K4LanguageElement('L_INSERTTOPICMESSAGE'), 'content', TRUE);
         return !USE_XMLHTTP ? $action->execute($request) : xmlhttp_message('L_INSERTTOPICMESSAGE');
     }
     /* Get our post */
     $post = $request['dba']->getRow("SELECT * FROM " . K4POSTS . " WHERE post_id = " . intval($_REQUEST['post_id']));
     if (!is_array($post) || empty($post)) {
         $action = new K4InformationAction(new K4LanguageElement('L_POSTDOESNTEXIST'), 'content', FALSE);
         return !USE_XMLHTTP ? $action->execute($request) : xmlhttp_message('L_POSTDOESNTEXIST');
     }
     $type = $this->row_type & TOPIC ? 'topics' : 'replies';
     /* Does this person have permission to edit this topic? */
     if ($post['poster_id'] == $request['user']->get('id')) {
         if (get_map($type, 'can_edit', array('forum_id' => $forum['forum_id'])) > $request['user']->get('perms')) {
             $action = new K4InformationAction(new K4LanguageElement('L_YOUNEEDPERMS'), 'content', FALSE);
             return !USE_XMLHTTP ? $action->execute($request) : xmlhttp_message('L_YOUNEEDPERMS');
         }
     } else {
         if (get_map('other_' . $type, 'can_edit', array('forum_id' => $forum['forum_id'])) > $request['user']->get('perms')) {
             $action = new K4InformationAction(new K4LanguageElement('L_YOUNEEDPERMS'), 'content', FALSE);
             return !USE_XMLHTTP ? $action->execute($request) : xmlhttp_message('L_YOUNEEDPERMS');
         }
     }
     if ($post['is_poll'] == 1) {
         // TODO: something here.
     }
     /* Does this user have permission to edit this topic if it is locked? */
     if ($post['post_locked'] == 1 && get_map('closed', 'can_edit', array('forum_id' => $forum['forum_id'])) > $request['user']->get('perms')) {
         $action = new K4InformationAction(new K4LanguageElement('L_YOUNEEDPERMS'), 'content', FALSE);
         return !USE_XMLHTTP ? $action->execute($request) : xmlhttp_message('L_YOUNEEDPERMS');
     }
     /* set the breadcrumbs bit */
     k4_bread_crumbs($request['template'], $request['dba'], $this->row_type & TOPIC ? 'L_EDITTOPIC' : 'L_EDITREPLY', $post, $forum);
     /* Initialize the bbcode parser with the topic message */
     $_REQUEST['message'] = substr($_REQUEST['message'], 0, $_SETTINGS['postmaxchars']);
     /* Parse the bbcode */
     $body_text = $_REQUEST['message'];
     $submit_type = isset($_REQUEST['submit_type']) ? $_REQUEST['submit_type'] : 'post';
     if (!isset($_REQUEST['disable_bbcode']) || !$_REQUEST['disable_bbcode']) {
         $parser =& new BBParser();
         Globals::setGlobal('forum_id', $forum['forum_id']);
         Globals::setGlobal('maxpolloptions', $request['template']->getVar('maxpolloptions') > $forum['maxpolloptions'] ? $forum['maxpolloptions'] : $request['template']->getVar('maxpolloptions'));
         Globals::setGlobal('maxpollquestions', $request['template']->getVar('maxpollquestions') > $forum['maxpollquestions'] ? $forum['maxpollquestions'] : $request['template']->getVar('maxpollquestions'));
         if ($submit_type == 'post' || isset($_REQUEST['post'])) {
             $parser->register('BBPollNode');
         }
         $body_text = $parser->parse($body_text);
         if ($submit_type == 'post' || isset($_REQUEST['post'])) {
             $body_text = $parser->comparePolls($post['post_id'], $body_text, $post['body_text'], $request['dba']);
         }
         $is_poll = Globals::getGlobal('is_poll');
     }
     // permissions are taken into account inside the poller
     //$poller		= &new K4BBPolls($body_text, $topic['body_text'], $forum, $topic['post_id']);
     $request['template']->setVar('newtopic_action', 'newtopic.php?act=updatetopic');
     if ($this->row_type & TOPIC) {
         /* Get the topic type */
         $post_type = isset($_REQUEST['post_type']) && intval($_REQUEST['post_type']) != 0 ? $_REQUEST['post_type'] : TOPIC_NORMAL;
         /* Check the topic type and check if this user has permission to post that type of topic */
         if ($post_type == TOPIC_STICKY && $request['user']->get('perms') < get_map('sticky', 'can_add', array('forum_id' => $forum['forum_id']))) {
             $post_type = TOPIC_NORMAL;
         } else {
             if ($post_type == TOPIC_ANNOUNCE && $request['user']->get('perms') < get_map('announce', 'can_add', array('forum_id' => $forum['forum_id']))) {
                 $post_type = TOPIC_NORMAL;
             }
         }
         /* Is this a featured topic? */
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:k4bb-svn,代码行数:101,代码来源:posts.class.php

示例11: Execute

 function Execute(&$template, $request, &$dba, &$session, &$user)
 {
     //$dba->executeUpdate("UPDATE ". USERINFO ." SET msn = 'peter.goodman@gmail.com' WHERE user_id = 1");
     global $_DATASTORE, $_USERGROUPS, $_SESS;
     //$str = "[poll][question=hello?][answer]maybe[/answer][answer]good[/answer][/question][question=yes][answer]maybe[/answer][answer]good[/answer][/question][/poll]";
     //$dba->executeUpdate("UPDATE k4_topics set display=1");
     /*
     
     //echo str_replace('"','\"', serialize(array('spiderstrings'=>'googlebot|lycos|ask jeeves|scooter|fast-webcrawler|slurp@inktomi|turnitinbot','spidernames'=>array('googlebot' => 'Google','lycos' => 'Lycos','ask jeeves' => 'Ask Jeeves','scooter' => 'Altavista','fast-webcrawler' => 'AllTheWeb','slurp@inktomi' => 'Inktomi','turnitinbot' => 'Turnitin.com'))));
     
     
     $bbcode	= &new BBCodex(&$user, $text, 2, TRUE, TRUE, TRUE, TRUE);
     
     $text = $bbcode->parse();
     
     echo $text;
     echo '<br />';
     $bbcode	= &new BBCodex(&$user, $text, 2, TRUE, TRUE, TRUE, TRUE);
     
     $text = $bbcode->revert();
     
     echo '<textarea rows="5" cols="100">'. $text .'</textarea>';
     */
     /* Set the breadcrumbs bit */
     $template = BreadCrumbs($template, $template->getVar('L_HOME'));
     //$dba->executeUpdate("update k4_information set row_level = 3 where row_type = 2 and parent_id = 2");
     /*$dba->executeQuery("delete from k4_information");
     		$dba->executeQuery("delete from k4_categories");
     		$dba->executeQuery("delete from k4_forums");
     		$dba->executeQuery("delete from k4_topics");
     		$dba->executeQuery("delete from k4_replies");
     		$dba->executeQuery("delete from k4_maps");
     		$dba->executeQuery("delete from k4_topicqueue");
     		$dba->executeQuery("delete from k4_mailqueue");
     		$dba->executeUpdate("UPDATE ". USERINFO ." SET num_posts = 0");*/
     //print_r($dba->getRow("SELECT sql, name, type FROM sqlite_master WHERE tbl_name = '". USERINFO ."' ORDER BY type DESC"));
     //$dba->executeQuery("delete from ". PROFILEFIELDS ." where name = 'field6'");
     /* Set the Categories list */
     $categories =& new CategoriesIterator(NULL);
     $template->setList('categories', $categories);
     if (!is_a($session['user'], 'Member')) {
         $template->setVar('welcome_title', sprintf($template->getVar('L_WELCOMETITLE'), $template->getVar('bbtitle')));
         $template->show('welcome_msg');
         $template->setFile('quick_login', 'login_form_quick.html');
     }
     /* Set the online users list */
     $online_users =& new OnlineUsersIterator(NULL);
     $template->setList('online_users', $online_users);
     $newest_user = $dba->getRow("SELECT name, id FROM " . USERS . " ORDER BY id DESC LIMIT 1");
     $expired = time() - ini_get('session.gc_maxlifetime');
     $stats = array('num_online_members' => Globals::getGlobal('num_online_members'), 'num_invisible' => Globals::getGlobal('num_online_invisible'), 'num_topics' => intval($_DATASTORE['forumstats']['num_topics']), 'num_replies' => intval($_DATASTORE['forumstats']['num_replies']), 'num_members' => intval($_DATASTORE['forumstats']['num_members']), 'num_online_total' => $dba->getValue("SELECT COUNT(*) FROM " . SESSIONS . " WHERE seen >= {$expired}") + iif(is_a($session['user'], 'Guest') && $_SESS->is_new, 1, 0), 'newest_uid' => $newest_user['id'], 'newest_user' => $newest_user['name']);
     $stats['num_guests'] = $stats['num_online_total'] - $stats['num_online_members'] - $stats['num_invisible'];
     $template->setVar('num_online_members', $stats['num_online_members']);
     $template->setVar('newest_member', sprintf($template->getVar('L_NEWESTMEMBER'), $stats['newest_uid'], $stats['newest_user']));
     $template->setVar('total_users', sprintf($template->getVar('L_TOTALUSERS'), $stats['num_members']));
     $template->setVar('total_posts', sprintf($template->getVar('L_TOTALPOSTS'), $stats['num_topics'] + $stats['num_replies'], $stats['num_topics'], $stats['num_replies']));
     $template->setVar('online_stats', sprintf($template->getVar('L_ONLINEUSERSTATS'), $stats['num_online_total'], $stats['num_online_members'], $stats['num_guests'], $stats['num_invisible']));
     $template->setVar('most_users_ever', sprintf($template->getVar('L_MOSTUSERSEVERONLINE'), $_DATASTORE['maxloggedin']['maxonline'], date("n/j/Y", bbtime($_DATASTORE['maxloggedin']['maxonlinedate'])), date("g:ia", bbtime($_DATASTORE['maxloggedin']['maxonlinedate']))));
     if ($stats['num_online_total'] >= $_DATASTORE['maxloggedin']['maxonline']) {
         $maxloggedin = array('maxonline' => $stats['num_online_total'], 'maxonlinedate' => time());
         $query = $dba->prepareStatement("UPDATE " . DATASTORE . " SET data = ? WHERE varname = ?");
         $query->setString(1, serialize($maxloggedin));
         $query->setString(2, 'maxloggedin');
         $query->executeUpdate();
         if (!@touch(CACHE_FILE, time() - 86460)) {
             @unlink(CACHE_FILE);
         }
     }
     /* Show the forum status icons */
     $template->show('forum_status_icons');
     $groups = array();
     /* Set the usergroups legend list */
     foreach ($_USERGROUPS as $group) {
         if ($group['display_legend'] == 1) {
             $groups[] = $group;
         }
     }
     $groups =& new FAArrayIterator($groups);
     $template->setList('usergroups_legend', $groups);
     /* Set the forums template to content variable */
     $template->setFile('content', 'forums.html');
     $template->setFile('forum_info', 'forum_info.html');
     return TRUE;
 }
开发者ID:BackupTheBerlios,项目名称:k4bb,代码行数:84,代码来源:index.php

示例12: flatten

 function flatten($noparse = FALSE)
 {
     if ($noparse) {
         return $this->getUnparsed($noparse);
     }
     $body = parent::flatten($noparse);
     $question = trim($this->_attrib);
     $items = explode('[*]', $body);
     $param = $this->_attrib;
     $maxpolloptions = intval(Globals::getGlobal('maxpolloptions'));
     $forum_id = intval(Globals::getGlobal('forum_id'));
     if (!Globals::getGlobal('num_polls')) {
         Globals::setGlobal('num_polls', 0);
     }
     $can_poll = $forum_id > 0 && $_SESSION['user']->get('perms') >= get_map('bbcode', 'can_add', array('forum_id' => $forum_id));
     $ret = '';
     if (count($items) > 0 && $maxpolloptions > 0 && $can_poll && $question != '' && Globals::getGlobal('num_polls') <= Globals::getGlobal('maxpollquestions')) {
         global $_DBA;
         $question = $_DBA->quote(k4_htmlentities($question, ENT_QUOTES));
         $insert_question = $_DBA->executeUpdate("INSERT INTO " . K4POLLQUESTIONS . " (question, created, user_id, user_name) VALUES ('{$question}', " . time() . ", " . intval($_SESSION['user']->get('id')) . ", '" . $_DBA->quote($_SESSION['user']->get('name')) . "')");
         $question_id = $_DBA->getInsertId(K4POLLQUESTIONS, 'id');
         $buffer = '';
         $i = 0;
         foreach ($items as $item) {
             if ($i >= $maxpolloptions) {
                 break;
             }
             $item = trim(strip_tags(preg_replace("~(\r\n|\r|\n|\t|<br>|<br\\/>|<br \\/>)~i", "", $item)));
             if ($item != '') {
                 $_DBA->executeUpdate("INSERT INTO " . K4POLLANSWERS . " (question_id,answer) VALUES (" . intval($question_id) . ", '" . $_DBA->quote(k4_htmlentities($item, ENT_QUOTES)) . "')");
                 $i++;
             }
         }
         Globals::setGlobal('is_poll', TRUE);
         Globals::setGlobal('num_polls', Globals::getGlobal('num_polls') + 1);
         $ret = "[poll={$question_id}]";
     }
     return $ret;
 }
开发者ID:BackupTheBerlios,项目名称:k4bb-svn,代码行数:39,代码来源:bbparser.php

示例13: ForumsIterator

 function ForumsIterator($query = NULL, $do_recurse = TRUE)
 {
     global $_SETTINGS, $_DBA, $_QUERYPARAMS, $_USERGROUPS;
     $query = $query == NULL ? "" : $query;
     $this->usergroups = $_USERGROUPS;
     $this->user =& Globals::getGlobal('user');
     $this->dba = $_DBA;
     $this->settings = $_SETTINGS;
     $this->query_params = $_QUERYPARAMS;
     $this->do_recurse = $do_recurse;
     $this->result =& $this->dba->executeQuery($query);
     //$this->forums		= isset($_COOKIE['forums']) && $_COOKIE['forums'] != NULL && $_COOKIE['forums'] != '' ? iif(!unserialize($_COOKIE['forums']), array(), unserialize($_COOKIE['forums'])) : array();
     parent::FAProxyIterator($this->result);
 }
开发者ID:BackupTheBerlios,项目名称:k4bb,代码行数:14,代码来源:forums.class.php

示例14: execute


//.........这里部分代码省略.........
      * Set the new breadcrumbs bit
      */
     k4_bread_crumbs($request['template'], $request['dba'], $topic['name'], $forum);
     /* Set if this breadcrumb should be 'new' or not */
     $new = topic_icon($cookieinfo, $topic, '');
     $request['template']->setVar('breadcrumb_new', $new == TRUE ? 'new' : '');
     /**
      * Now tell the cookies that we've read this topic
      */
     $cookieinfo[$topic['post_id']] = time();
     $cookiestr = '';
     foreach ($cookieinfo as $key => $val) {
         // make sure to weed out 30-day old topic views
         if ((time() - intval($val)) / 30 <= 2592000) {
             $cookiestr .= ',' . $key . ',' . intval($val);
         }
     }
     setcookie(K4TOPICINFO, trim($cookiestr, ','), time() + 2592000, $domain);
     unset($cookieinfo, $cookiestr);
     /** 
      * Get the users Browsing this topic 
      */
     /* Set the extra SQL query fields to check */
     $extra = " AND location_file = '" . $request['dba']->quote($_URL->file) . "' AND location_id = " . intval($topic['post_id']);
     $expired = time() - ini_get('session.gc_maxlifetime');
     $user_extra = $request['user']->isMember() ? ' OR (seen > 0 AND user_id = ' . intval($request['user']->get('id')) . ')' : '';
     $num_online_total = $request['dba']->getValue("SELECT COUNT(id) FROM " . K4SESSIONS . " WHERE ((seen >= {$expired} {$extra}) {$user_extra})");
     $num_online_total = !$request['user']->isMember() ? $num_online_total + 1 : $num_online_total;
     if ($num_online_total > 0) {
         $query = "SELECT * FROM " . K4SESSIONS . " WHERE ((seen >= {$expired} {$extra}) {$user_extra}) AND ((user_id > 0) OR (user_id = 0 AND name <> '')) GROUP BY name ORDER BY seen DESC";
         $users_browsing =& new K4OnlineUsersIterator($request['dba'], '', $request['dba']->executeQuery($query));
         /* Set the users browsing list */
         $request['template']->setList('users_browsing', $users_browsing);
         $stats = array('num_online_members' => Globals::getGlobal('num_online_members'), 'num_invisible' => Globals::getGlobal('num_online_invisible'), 'num_online_total' => $num_online_total);
         $stats['num_guests'] = $stats['num_online_total'] - $stats['num_online_members'] - $stats['num_invisible'];
         $request['template']->setVar('num_online_members', $stats['num_online_members']);
         $request['template']->setVar('users_browsing', $request['template']->getVar('L_USERSBROWSINGTOPIC'));
         $request['template']->setVar('online_stats', sprintf($request['template']->getVar('L_USERSBROWSINGSTATS'), $stats['num_online_total'], $stats['num_online_members'], $stats['num_guests'], $stats['num_invisible']));
         /* Set the User's Browsing file */
         $request['template']->setFile('users_browsing', 'users_browsing.html');
         $groups = array();
         /* Set the usergroups legend list */
         foreach ($_USERGROUPS as $group) {
             if ($group['display_legend'] == 1) {
                 $groups[] = $group;
             }
         }
         $groups =& new FAArrayIterator($groups);
         $request['template']->setList('usergroups_legend', $groups);
     }
     /**
      * Is this topic expired?
      */
     $extra = '';
     if ($topic['post_type'] > TOPIC_NORMAL && $topic['post_expire'] > 0) {
         if ($topic['created'] + 3600 * 24 * $topic['post_expire'] > time()) {
             $extra = ",post_expire=0,post_type=" . TOPIC_NORMAL;
         }
     }
     /* Add the topic info to the template */
     foreach ($topic as $key => $val) {
         $request['template']->setVar('topic_' . $key, $val);
     }
     /* Add the forum info to the template */
     foreach ($forum as $key => $val) {
         $request['template']->setVar('forum_' . $key, $val);
开发者ID:BackupTheBerlios,项目名称:k4bb-svn,代码行数:67,代码来源:viewtopic.php

示例15: execute

 function execute(&$request)
 {
     //$action = new AdminCSSRequestAction();
     //return $action->execute($request);
     global $_DATASTORE, $_USERGROUPS, $_QUERYPARAMS;
     // Member/Guest specifics
     if (!$request['user']->isMember()) {
         $request['template']->setVar('welcome_title', sprintf($request['template']->getVar('L_WELCOMETITLE'), $request['template']->getVar('bbtitle')));
         $request['template']->setFile('quick_login', 'login_form_quick.html');
         $request['template']->setVisibility('welcome_msg', TRUE);
     }
     // The content panel
     $request['template']->setFile('content', 'forums.html');
     $forums =& new K4ForumsIterator($request['dba'], "SELECT * FROM " . K4FORUMS . " WHERE parent_id=0 ORDER BY row_order ASC");
     //$categories	= &new K4ForumsIterator($request['dba'], "SELECT * FROM ". K4FORUMS ." WHERE row_type=". CATEGORY ." AND parent_id = 0 ORDER BY row_order ASC");
     $request['template']->setVisibility('no_forums', !$forums->hasNext() ? TRUE : FALSE);
     $request['template']->setList('tlforums', $forums);
     //$request['template']->setList('categories', $categories);
     // Set the online users list
     $user_extra = $request['user']->isMember() ? ' OR (seen > 0 AND user_id = ' . intval($request['user']->get('id')) . ')' : '';
     $expired = time() - ini_get('session.gc_maxlifetime');
     $online_users = $request['dba']->executeQuery("SELECT * FROM " . K4SESSIONS . " WHERE ((seen >= {$expired}) {$user_extra}) AND ((user_id > 0) OR (user_id = 0 AND name <> '')) GROUP BY name ORDER BY seen DESC");
     $online_users =& new K4OnlineUsersIterator($request['dba'], '', $online_users);
     $request['template']->setList('online_users', $online_users);
     //$newest_user						= $request['dba']->getRow("SELECT name, id FROM ". K4USERS ." ORDER BY id DESC LIMIT 1");
     $expired = time() - ini_get('session.gc_maxlifetime');
     //print_r($_DATASTORE); exit;
     $stats = array('num_online_members' => intval(Globals::getGlobal('num_online_members')), 'num_invisible' => intval(Globals::getGlobal('num_online_invisible')), 'num_topics' => intval($_DATASTORE['forumstats']['num_topics']), 'num_replies' => intval($_DATASTORE['forumstats']['num_replies']), 'num_members' => intval($_DATASTORE['forumstats']['num_members']), 'num_guests' => $request['dba']->getValue("SELECT COUNT(*) FROM " . K4SESSIONS . " WHERE seen >= {$expired} AND user_id=0"), 'newest_uid' => $_DATASTORE['forumstats']['newest_user_id'], 'newest_user' => $_DATASTORE['forumstats']['newest_user_name']);
     $stats['num_online_total'] = $stats['num_online_members'] + $stats['num_invisible'] + $stats['num_guests'];
     $request['template']->setVar('num_online_members', $stats['num_online_members']);
     $request['template']->setVar('newest_member', sprintf($request['template']->getVar('L_NEWESTMEMBER'), $stats['newest_uid'], $stats['newest_user']));
     $request['template']->setVar('total_users', sprintf($request['template']->getVar('L_TOTALUSERS'), $stats['num_members']));
     $request['template']->setVar('total_posts', sprintf($request['template']->getVar('L_TOTALPOSTS'), $stats['num_topics'] + $stats['num_replies'], $stats['num_topics'], $stats['num_replies']));
     $request['template']->setVar('online_stats', sprintf($request['template']->getVar('L_ONLINEUSERSTATS'), $stats['num_online_total'], $stats['num_online_members'], $stats['num_guests'], $stats['num_invisible']));
     $request['template']->setVar('most_users_ever', sprintf($request['template']->getVar('L_MOSTUSERSEVERONLINE'), $_DATASTORE['maxloggedin']['maxonline'], date("n/j/Y", bbtime($_DATASTORE['maxloggedin']['maxonlinedate'])), date("g:ia", bbtime($_DATASTORE['maxloggedin']['maxonlinedate']))));
     if ($stats['num_online_total'] >= $_DATASTORE['maxloggedin']['maxonline']) {
         $maxloggedin = array('maxonline' => $stats['num_online_total'], 'maxonlinedate' => time());
         $query = $request['dba']->prepareStatement("UPDATE " . K4DATASTORE . " SET data = ? WHERE varname = ?");
         $query->setString(1, serialize($maxloggedin));
         $query->setString(2, 'maxloggedin');
         $query->executeUpdate();
         reset_cache('datastore');
     }
     // Show the forum status icons
     $request['template']->setVisibility('forum_status_icons', TRUE);
     $request['template']->setFile('content_extra', 'forum_status_icons.html');
     if ($request['user']->get('perms') >= get_map('can_see_board', 'can_add', array())) {
         $request['template']->setVisibility('forum_midsection', TRUE);
         $groups = array();
         // Set the usergroups legend list
         if (is_array($_USERGROUPS) && !empty($_USERGROUPS)) {
             foreach ($_USERGROUPS as $group) {
                 if ($group['display_legend'] == 1) {
                     $group['U_USERGROUPURL'] = K4Url::getUserGroupUrl($group['id']);
                     $groups[] = $group;
                 }
             }
         }
     }
     $groups =& new FAArrayIterator($groups);
     $request['template']->setList('usergroups_legend', $groups);
     /* Set the forum stats */
     $request['template']->setFile('forum_info', 'forum_info.html');
     $request['template']->setVar('can_see_board', get_map('can_see_board', 'can_view', array()));
     k4_bread_crumbs($request['template'], $request['dba'], 'L_HOME');
 }
开发者ID:BackupTheBerlios,项目名称:k4bb-svn,代码行数:66,代码来源:index.php


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