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


PHP phpbb_version_compare函数代码示例

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


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

示例1: main

 function main($id, $mode)
 {
     global $config, $user, $template, $request;
     global $phpbb_root_path, $phpEx, $phpbb_container;
     $user->add_lang('install');
     $this->tpl_name = 'acp_update';
     $this->page_title = 'ACP_VERSION_CHECK';
     /* @var $version_helper \phpbb\version_helper */
     $version_helper = $phpbb_container->get('version_helper');
     try {
         $recheck = $request->variable('versioncheck_force', false);
         $updates_available = $version_helper->get_suggested_updates($recheck);
     } catch (\RuntimeException $e) {
         $template->assign_var('S_VERSIONCHECK_FAIL', true);
         $updates_available = array();
     }
     foreach ($updates_available as $branch => $version_data) {
         $template->assign_block_vars('updates_available', $version_data);
     }
     $update_link = $phpbb_root_path . 'install/app.' . $phpEx;
     $template->assign_vars(array('S_UP_TO_DATE' => empty($updates_available), 'U_ACTION' => $this->u_action, 'U_VERSIONCHECK_FORCE' => append_sid($this->u_action . '&versioncheck_force=1'), 'CURRENT_VERSION' => $config['version'], 'UPDATE_INSTRUCTIONS' => sprintf($user->lang['UPDATE_INSTRUCTIONS'], $update_link)));
     // Incomplete update?
     if (phpbb_version_compare($config['version'], PHPBB_VERSION, '<')) {
         $database_update_link = $phpbb_root_path . 'install/app.php/update';
         $template->assign_vars(array('S_UPDATE_INCOMPLETE' => true, 'FILES_VERSION' => PHPBB_VERSION, 'INCOMPLETE_INSTRUCTIONS' => $user->lang('UPDATE_INCOMPLETE_EXPLAIN', $database_update_link)));
     }
 }
开发者ID:phpbb,项目名称:phpbb,代码行数:27,代码来源:acp_update.php

示例2: init

    /**
     * Checks for correct MySQL version and stores min/max word length in the config
     */
    function init()
    {
        global $db, $user;
        if ($db->sql_layer != 'mysql4' && $db->sql_layer != 'mysqli') {
            return $user->lang['FULLTEXT_MYSQL_INCOMPATIBLE_VERSION'];
        }
        $result = $db->sql_query('SHOW TABLE STATUS LIKE \'' . POSTS_TABLE . '\'');
        $info = $db->sql_fetchrow($result);
        $db->sql_freeresult($result);
        $engine = '';
        if (isset($info['Engine'])) {
            $engine = $info['Engine'];
        } else {
            if (isset($info['Type'])) {
                $engine = $info['Type'];
            }
        }
        $fulltext_supported = $engine === 'MyISAM' || $engine === 'InnoDB' && phpbb_version_compare($db->sql_server_info(true), '5.6.4', '>=');
        if (!$fulltext_supported) {
            return $user->lang['FULLTEXT_MYSQL_NOT_SUPPORTED'];
        }
        $sql = 'SHOW VARIABLES
			LIKE \'ft\\_%\'';
        $result = $db->sql_query($sql);
        $mysql_info = array();
        while ($row = $db->sql_fetchrow($result)) {
            $mysql_info[$row['Variable_name']] = $row['Value'];
        }
        $db->sql_freeresult($result);
        set_config('fulltext_mysql_max_word_len', $mysql_info['ft_max_word_len']);
        set_config('fulltext_mysql_min_word_len', $mysql_info['ft_min_word_len']);
        return false;
    }
开发者ID:eyumay,项目名称:ju.ejhs,代码行数:36,代码来源:fulltext_mysql.php

示例3: main

    function main($id, $mode)
    {
        global $config, $db, $user, $auth, $template, $cache;
        global $phpbb_root_path, $phpbb_admin_path, $phpEx;
        $user->add_lang('install');
        $this->tpl_name = 'acp_update';
        $this->page_title = 'ACP_VERSION_CHECK';
        // Get current and latest version
        $info = htmlspecialchars(obtain_latest_version_info(request_var('versioncheck_force', false)));
        if (empty($info)) {
            trigger_error('VERSIONCHECK_FAIL', E_USER_WARNING);
        }
        $info = explode("\n", $info);
        $latest_version = trim($info[0]);
        $announcement_url = trim($info[1]);
        $announcement_url = strpos($announcement_url, '&amp;') === false ? str_replace('&', '&amp;', $announcement_url) : $announcement_url;
        $update_link = append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=update');
        // next feature release
        $next_feature_version = $next_feature_announcement_url = false;
        if (isset($info[2]) && trim($info[2]) !== '') {
            $next_feature_version = trim($info[2]);
            $next_feature_announcement_url = trim($info[3]);
        }
        // Determine automatic update...
        $sql = 'SELECT config_value
			FROM ' . CONFIG_TABLE . "\n\t\t\tWHERE config_name = 'version_update_from'";
        $result = $db->sql_query($sql);
        $version_update_from = (string) $db->sql_fetchfield('config_value');
        $db->sql_freeresult($result);
        $current_version = !empty($version_update_from) ? $version_update_from : $config['version'];
        $template->assign_vars(array('S_UP_TO_DATE' => phpbb_version_compare($latest_version, $config['version'], '<='), 'S_UP_TO_DATE_AUTO' => phpbb_version_compare($latest_version, $current_version, '<='), 'S_VERSION_CHECK' => true, 'U_ACTION' => $this->u_action, 'U_VERSIONCHECK_FORCE' => append_sid($this->u_action . '&amp;versioncheck_force=1'), 'LATEST_VERSION' => $latest_version, 'CURRENT_VERSION' => $config['version'], 'AUTO_VERSION' => $version_update_from, 'NEXT_FEATURE_VERSION' => $next_feature_version, 'UPDATE_INSTRUCTIONS' => sprintf($user->lang['UPDATE_INSTRUCTIONS'], $announcement_url, $update_link), 'UPGRADE_INSTRUCTIONS' => $next_feature_version ? $user->lang('UPGRADE_INSTRUCTIONS', $next_feature_version, $next_feature_announcement_url) : false));
    }
开发者ID:PetsFundation,项目名称:Pets,代码行数:32,代码来源:acp_update.php

示例4: main

    function main($id, $mode)
    {
        global $config, $db, $user, $auth, $template, $cache;
        global $phpbb_root_path, $phpbb_admin_path, $phpEx;
        $user->add_lang('install');
        $this->tpl_name = 'acp_update';
        $this->page_title = 'ACP_VERSION_CHECK';
        // Get current and latest version
        $errstr = '';
        $errno = 0;
        $info = obtain_latest_version_info(request_var('versioncheck_force', false));
        if ($info === false) {
            trigger_error('VERSIONCHECK_FAIL', E_USER_WARNING);
        }
        $info = explode("\n", $info);
        $latest_version = trim($info[0]);
        $announcement_url = trim($info[1]);
        $announcement_url = strpos($announcement_url, '&amp;') === false ? str_replace('&', '&amp;', $announcement_url) : $announcement_url;
        $update_link = append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=update');
        // www.phpBB-SEO.com SEO TOOLKIT BEGIN
        // moved a little bellow
        // next feature release
        /*$next_feature_version = $next_feature_announcement_url = false;
        		if (isset($info[2]) && trim($info[2]) !== '')
        		{
        			$next_feature_version = trim($info[2]);
        			$next_feature_announcement_url = trim($info[3]);
        		}*/
        // www.phpBB-SEO.com SEO TOOLKIT BEGIN
        // Determine automatic update...
        $sql = 'SELECT config_value
			FROM ' . CONFIG_TABLE . "\n\t\t\tWHERE config_name = 'version_update_from'";
        $result = $db->sql_query($sql);
        $version_update_from = (string) $db->sql_fetchfield('config_value');
        $db->sql_freeresult($result);
        $current_version = !empty($version_update_from) ? $version_update_from : $config['version'];
        // www.phpBB-SEO.com SEO TOOLKIT BEGIN
        $phpbb_seo_update = '';
        if ($up_to_date) {
            $phpbb_seo_update = trim(str_replace($current_version, '', $latest_version));
        }
        $update_instruction = sprintf($user->lang['UPDATE_INSTRUCTIONS'], $announcement_url, $update_link);
        if (!empty($phpbb_seo_update)) {
            $auto_package = trim($info[2]);
            $auto_update = $auto_package === 'auto_update:yes' ? true : false;
            $up_to_date = $latest_version === @$config['seo_premod_version'] ? true : false;
            if (!$auto_update) {
                $update_instruction = '<br/><br/><hr/>' . sprintf($user->lang['ACP_PREMOD_UPDATE'], $latest_version, $announcement_url) . '<br/><hr/>';
            }
        }
        // next feature release
        $next_feature_version = $next_feature_announcement_url = false;
        if (isset($info[3]) && trim($info[3]) !== '') {
            $next_feature_version = trim($info[3]);
            $next_feature_announcement_url = trim($info[4]);
        }
        // www.phpBB-SEO.com SEO TOOLKIT END
        $template->assign_vars(array('S_UP_TO_DATE' => phpbb_version_compare($latest_version, $config['version'], '<='), 'S_UP_TO_DATE_AUTO' => phpbb_version_compare($latest_version, $current_version, '<='), 'S_VERSION_CHECK' => true, 'U_ACTION' => $this->u_action, 'U_VERSIONCHECK_FORCE' => append_sid($this->u_action . '&amp;versioncheck_force=1'), 'LATEST_VERSION' => $latest_version, 'CURRENT_VERSION' => $config['version'], 'AUTO_VERSION' => $version_update_from, 'NEXT_FEATURE_VERSION' => $next_feature_version, 'UPDATE_INSTRUCTIONS' => sprintf($user->lang['UPDATE_INSTRUCTIONS'], $announcement_url, $update_link), 'UPGRADE_INSTRUCTIONS' => $next_feature_version ? $user->lang('UPGRADE_INSTRUCTIONS', $next_feature_version, $next_feature_announcement_url) : false));
    }
开发者ID:Ibrahim-Abdelkader,项目名称:phpbb3,代码行数:59,代码来源:acp_update.php

示例5: is_enableable

 /**
  * Enable extension if phpBB version requirement is met
  *
  * @var string Require 3.2.0-a1 due to updated 3.2 syntax
  *
  * @return bool
  * @access public
  */
 public function is_enableable()
 {
     $config = $this->container->get('config');
     if (!phpbb_version_compare($config['version'], '3.2.0-a1', '>=')) {
         $this->container->get('language')->add_lang('ext_pmstats', 'david63/pmstats');
         trigger_error($this->container->get('language')->lang('VERSION_32') . adm_back_link(append_sid('index.' . $this->container->getParameter('core.php_ext'), 'i=acp_extensions&amp;mode=main')), E_USER_WARNING);
     } else {
         return true;
     }
 }
开发者ID:david63,项目名称:david63-pmstats,代码行数:18,代码来源:ext.php

示例6: page_header

 public function page_header($event)
 {
     $nru_group_id = $this->applicationform->getnruid();
     if (!$this->config['appform_nru'] && $nru_group_id === (int) $this->user->data['group_id'] || $this->user->data['is_bot'] || $this->user->data['user_id'] == ANONYMOUS) {
         $this->template->assign_var('U_APP_FORM', false);
         return false;
     }
     $version = phpbb_version_compare($this->config['version'], '3.2.0-b2', '>=');
     $this->user->add_lang_ext('rmcgirr83/applicationform', 'common');
     $this->template->assign_vars(array('U_APP_FORM' => $this->helper->route('rmcgirr83_applicationform_displayform'), 'S_FORUM_VERSION' => $version));
 }
开发者ID:rmcgirr83,项目名称:phpBB-3.1-applicationform,代码行数:11,代码来源:listener.php

示例7: check_php_version

 /**
  * A self-written function that checks the php version in the requirement section of this extension.
  * 
  * @return bool TRUE, if the version is matching, otherwise FALSE.
  */
 function check_php_version()
 {
     $this->manager = $this->container->get('ext.manager');
     $this->metadata_manager = $this->manager->create_extension_metadata_manager($this->extension_name, $this->container->get('template'));
     $meta_data = $this->metadata_manager->get_metadata();
     $require_fields = $meta_data['require'];
     // If the PHP field exists, we check the version
     if ($require_fields && isset($require_fields['php'])) {
         $php_require_field = $this->split_version_and_operator(html_entity_decode($require_fields['php']));
         return $php_require_field && phpbb_version_compare(PHP_VERSION, $php_require_field['version'], $php_require_field['operator']);
     }
     return true;
 }
开发者ID:melvingb,项目名称:mentions,代码行数:18,代码来源:ext.php

示例8: acp_manage_forums_display_form

 /**
  * Event: core.acp_manage_forums_display_form
  *
  * @param Event $event
  */
 public function acp_manage_forums_display_form($event)
 {
     $this->user->add_lang_ext('kasimi/movetopicswhenlocked', 'acp_forum_settings');
     $is_edit = $event['action'] == 'edit';
     $forum_data = $event['forum_data'];
     $template_vars = array('MOVE_TOPICS_WHEN_LOCKED_VERSION' => $this->config['kasimi.movetopicswhenlocked.version'], 'S_MOVE_TOPICS' => $is_edit ? $forum_data['move_topics_when_locked'] : false, 'S_MOVE_TOPICS_TO_OPTIONS' => make_forum_select($is_edit ? $forum_data['move_topics_when_locked_to'] : false, false, false, true));
     $topic_solved_extension = $this->user->lang('MOVE_TOPICS_SOLVED_EXTENSION');
     if ($this->extension_manager->is_enabled(self::EXT_TOPIC_SOLVED_NAME)) {
         $metadata = $this->extension_manager->create_extension_metadata_manager(self::EXT_TOPIC_SOLVED_NAME, $this->template)->get_metadata();
         $is_valid_version = phpbb_version_compare($metadata['version'], self::EXT_TOPIC_SOLVED_MIN_VERSION, '>=');
         $template_vars = array_merge($template_vars, array('S_MOVE_TOPICS_SOLVED' => $is_edit ? $forum_data['move_topics_when_locked_solved'] : false, 'MOVE_TOPICS_SOLVED_ENABLED' => $is_valid_version ? $this->user->lang('MOVE_TOPICS_SOLVED_ENABLED', $topic_solved_extension) : false, 'MOVE_TOPICS_SOLVED_VERSION' => $is_valid_version ? false : $this->user->lang('MOVE_TOPICS_SOLVED_VERSION', self::EXT_TOPIC_SOLVED_MIN_VERSION, $topic_solved_extension)));
     } else {
         $template_vars['MOVE_TOPICS_SOLVED_DISABLED'] = $this->user->lang('EXTENSION_DISABLED', $topic_solved_extension);
     }
     $this->template->assign_vars($template_vars);
 }
开发者ID:kasimi,项目名称:phpbb-ext-movetopicswhenlocked,代码行数:21,代码来源:acp_listener.php

示例9: effectively_installed

 public function effectively_installed()
 {
     return isset($this->config['post_models_version']) && phpbb_version_compare($this->config['post_models_version'], '1.0.3', '>=');
 }
开发者ID:Zoddo,项目名称:phpbb-postmodels,代码行数:4,代码来源:v103.php

示例10: check_requirements

 /**
  * Checks if all requirements in the "require" section of the composer.json file are fulfilled.
  * 
  * @param array $require_fields The array of requirements specified, containing KeyValuePairs with extension name and version string.
  * @return bool TRUE, if the requirements are fulfilled, FALSE if they aren't.
  */
 public function check_requirements($require_fields)
 {
     if (!isset($require_fields) || empty($require_fields)) {
         return true;
     }
     if (!is_array($require_fields)) {
         return false;
     }
     foreach ($require_fields as $ext_name => $require) {
         $require = $this->split_version_and_operator($require);
         // If version string is formatted wrong we consider the requirement is not fullfilled. Sorry.
         if ($require === false) {
             return false;
         }
         // If the field is PHP, we need to check the php version. Just to make sure (:
         if (strtolower($ext_name) == "php") {
             return phpbb_version_compare(PHP_VERSION, $require['version'], $require['operator']);
         }
         // If the extension is disabled, return false. If the extension is currently enabling, it counts as enabled.
         if (!$this->manager->is_enabled($ext_name) && !(isset($this->currently_enabling_extension) && $this->currently_enabling_extension == $ext_name)) {
             return false;
         }
         // gets the actual version number of this extension
         $ext_meta = $this->manager->create_extension_metadata_manager($ext_name, $this->template);
         $version = $ext_meta->get_metadata()['version'];
         if (!phpbb_version_compare($version, $require['version'], $require['operator'])) {
             return false;
         }
     }
     return true;
 }
开发者ID:Galixte,项目名称:core,代码行数:37,代码来源:requirements_helper.php

示例11: is_enableable

 /**
  * Enable extension if phpBB version requirement is met
  *
  * @return bool
  * @access public
  */
 public function is_enableable()
 {
     $config = $this->container->get('config');
     return phpbb_version_compare($config['version'], '3.2.0', '<=');
 }
开发者ID:rmcgirr83,项目名称:phpBB-3.1-sfpo,代码行数:11,代码来源:ext.php

示例12: display_similar_topics


//.........这里部分代码省略.........
        // If the cleaned up topic_title is empty, no need to continue
        if (empty($topic_title)) {
            return;
        }
        // Similar Topics query
        $sql_array = array('SELECT' => "f.forum_id, f.forum_name, t.*,\n\t\t\t\tMATCH (t.topic_title) AGAINST ('" . $this->db->sql_escape($topic_title) . "') AS score", 'FROM' => array(TOPICS_TABLE => 't'), 'LEFT_JOIN' => array(array('FROM' => array(FORUMS_TABLE => 'f'), 'ON' => 'f.forum_id = t.forum_id')), 'WHERE' => "MATCH (t.topic_title) AGAINST ('" . $this->db->sql_escape($topic_title) . "') >= 0.5\n\t\t\t\tAND t.topic_status <> " . ITEM_MOVED . '
				AND t.topic_visibility = ' . ITEM_APPROVED . '
				AND t.topic_time > (UNIX_TIMESTAMP() - ' . $this->config['similar_topics_time'] . ')
				AND t.topic_id <> ' . (int) $topic_data['topic_id']);
        // Add topic tracking data to the query (only if query caching is off)
        if ($this->user->data['is_registered'] && $this->config['load_db_lastread'] && !$this->config['similar_topics_cache']) {
            $sql_array['LEFT_JOIN'][] = array('FROM' => array(TOPICS_TRACK_TABLE => 'tt'), 'ON' => 'tt.topic_id = t.topic_id AND tt.user_id = ' . $this->user->data['user_id']);
            $sql_array['LEFT_JOIN'][] = array('FROM' => array(FORUMS_TRACK_TABLE => 'ft'), 'ON' => 'ft.forum_id = f.forum_id AND ft.user_id = ' . $this->user->data['user_id']);
            $sql_array['SELECT'] .= ', tt.mark_time, ft.mark_time as f_mark_time';
        } else {
            if ($this->config['load_anon_lastread'] || $this->user->data['is_registered']) {
                // Cookie based tracking copied from search.php
                $tracking_topics = $this->request->variable($this->config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE);
                $tracking_topics = $tracking_topics ? tracking_unserialize($tracking_topics) : array();
            }
        }
        // We need to exclude passworded forums so we do not leak the topic title
        $passworded_forums = $this->user->get_passworded_forums();
        // See if the admin set this forum to only search a specific group of other forums, and include them
        if (!empty($topic_data['similar_topic_forums'])) {
            // Remove any passworded forums from this group of forums we will be searching
            $included_forums = array_diff(json_decode($topic_data['similar_topic_forums'], true), $passworded_forums);
            // if there's nothing left to display (user has no access to the forums we want to search)
            if (empty($included_forums)) {
                return;
            }
            $sql_array['WHERE'] .= ' AND ' . $this->db->sql_in_set('f.forum_id', $included_forums);
        } else {
            // Remove any passworded forums
            if (count($passworded_forums)) {
                $sql_array['WHERE'] .= ' AND ' . $this->db->sql_in_set('f.forum_id', $passworded_forums, true);
            }
            $sql_array['WHERE'] .= ' AND f.similar_topics_ignore = 0';
        }
        /**
         * Event to modify the sql_array for similar topics
         *
         * @event vse.similartopics.get_topic_data
         * @var array sql_array SQL array to get similar topics data
         * @since 1.3.0
         */
        $vars = array('sql_array');
        extract($this->dispatcher->trigger_event('vse.similartopics.get_topic_data', compact($vars)));
        $sql = $this->db->sql_build_query('SELECT', $sql_array);
        $result = $this->db->sql_query_limit($sql, $this->config['similar_topics_limit'], 0, $this->config['similar_topics_cache']);
        // Grab icons
        $icons = $this->cache->obtain_icons();
        $rowset = array();
        while ($row = $this->db->sql_fetchrow($result)) {
            $similar_forum_id = (int) $row['forum_id'];
            $similar_topic_id = (int) $row['topic_id'];
            $rowset[$similar_topic_id] = $row;
            if ($this->auth->acl_get('f_read', $similar_forum_id)) {
                // Get topic tracking info
                if ($this->user->data['is_registered'] && $this->config['load_db_lastread'] && !$this->config['similar_topics_cache']) {
                    $topic_tracking_info = get_topic_tracking($similar_forum_id, $similar_topic_id, $rowset, array($similar_forum_id => $row['f_mark_time']));
                } else {
                    if ($this->config['load_anon_lastread'] || $this->user->data['is_registered']) {
                        $topic_tracking_info = get_complete_topic_tracking($similar_forum_id, $similar_topic_id);
                        if (!$this->user->data['is_registered']) {
                            $this->user->data['user_lastmark'] = isset($tracking_topics['l']) ? (int) base_convert($tracking_topics['l'], 36, 10) + (int) $this->config['board_startdate'] : 0;
                        }
                    }
                }
                // Replies
                $replies = $this->content_visibility->get_count('topic_posts', $row, $similar_forum_id) - 1;
                // Get folder img, topic status/type related information
                $folder_img = $folder_alt = $topic_type = '';
                $unread_topic = isset($topic_tracking_info[$similar_topic_id]) && $row['topic_last_post_time'] > $topic_tracking_info[$similar_topic_id];
                topic_status($row, $replies, $unread_topic, $folder_img, $folder_alt, $topic_type);
                $topic_unapproved = $row['topic_visibility'] == ITEM_UNAPPROVED && $this->auth->acl_get('m_approve', $similar_forum_id);
                $posts_unapproved = $row['topic_visibility'] == ITEM_APPROVED && $row['topic_posts_unapproved'] && $this->auth->acl_get('m_approve', $similar_forum_id);
                //$topic_deleted = $row['topic_visibility'] == ITEM_DELETED;
                $u_mcp_queue = $topic_unapproved || $posts_unapproved ? append_sid("{$this->root_path}mcp.{$this->php_ext}", 'i=queue&amp;mode=' . ($topic_unapproved ? 'approve_details' : 'unapproved_posts') . "&amp;t={$similar_topic_id}", true, $this->user->session_id) : '';
                //$u_mcp_queue = (!$u_mcp_queue && $topic_deleted) ? append_sid("{$this->root_path}mcp.{$this->php_ext}", "i=queue&amp;mode=deleted_topics&amp;t=$similar_topic_id", true, $this->user->session_id) : $u_mcp_queue;
                $base_url = append_sid("{$this->root_path}viewtopic.{$this->php_ext}", 'f=' . $similar_forum_id . '&amp;t=' . $similar_topic_id);
                $topic_row = array('TOPIC_AUTHOR_FULL' => get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'FIRST_POST_TIME' => $this->user->format_date($row['topic_time']), 'LAST_POST_TIME' => $this->user->format_date($row['topic_last_post_time']), 'LAST_POST_AUTHOR_FULL' => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'TOPIC_REPLIES' => $replies, 'TOPIC_VIEWS' => $row['topic_views'], 'TOPIC_TITLE' => censor_text($row['topic_title']), 'FORUM_TITLE' => $row['forum_name'], 'TOPIC_IMG_STYLE' => $folder_img, 'TOPIC_FOLDER_IMG' => $this->user->img($folder_img, $folder_alt), 'TOPIC_FOLDER_IMG_ALT' => $this->user->lang($folder_alt), 'TOPIC_ICON_IMG' => !empty($icons[$row['icon_id']]) ? $icons[$row['icon_id']]['img'] : '', 'TOPIC_ICON_IMG_WIDTH' => !empty($icons[$row['icon_id']]) ? $icons[$row['icon_id']]['width'] : '', 'TOPIC_ICON_IMG_HEIGHT' => !empty($icons[$row['icon_id']]) ? $icons[$row['icon_id']]['height'] : '', 'ATTACH_ICON_IMG' => $this->auth->acl_get('u_download') && $this->auth->acl_get('f_download', $similar_forum_id) && $row['topic_attachment'] ? $this->user->img('icon_topic_attach', $this->user->lang('TOTAL_ATTACHMENTS')) : '', 'UNAPPROVED_IMG' => $topic_unapproved || $posts_unapproved ? $this->user->img('icon_topic_unapproved', $topic_unapproved ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '', 'S_UNREAD_TOPIC' => $unread_topic, 'S_TOPIC_REPORTED' => !empty($row['topic_reported']) && $this->auth->acl_get('m_report', $similar_forum_id), 'S_TOPIC_UNAPPROVED' => $topic_unapproved, 'S_POSTS_UNAPPROVED' => $posts_unapproved, 'S_HAS_POLL' => (bool) $row['poll_start'], 'U_NEWEST_POST' => append_sid("{$this->root_path}viewtopic.{$this->php_ext}", 'f=' . $similar_forum_id . '&amp;t=' . $similar_topic_id . '&amp;view=unread') . '#unread', 'U_LAST_POST' => append_sid("{$this->root_path}viewtopic.{$this->php_ext}", 'f=' . $similar_forum_id . '&amp;t=' . $similar_topic_id . '&amp;p=' . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'], 'U_VIEW_TOPIC' => append_sid("{$this->root_path}viewtopic.{$this->php_ext}", 'f=' . $similar_forum_id . '&amp;t=' . $similar_topic_id), 'U_VIEW_FORUM' => append_sid("{$this->root_path}viewforum.{$this->php_ext}", 'f=' . $similar_forum_id), 'U_MCP_REPORT' => append_sid("{$this->root_path}mcp.{$this->php_ext}", 'i=reports&amp;mode=reports&amp;f=' . $similar_forum_id . '&amp;t=' . $similar_topic_id, true, $this->user->session_id), 'U_MCP_QUEUE' => $u_mcp_queue);
                /**
                 * Event to modify the similar topics template block
                 *
                 * @event vse.similartopics.modify_topicrow
                 * @var array row       Array with similar topic data
                 * @var array topic_row Template block array
                 * @since 1.3.0
                 */
                $vars = array('row', 'topic_row');
                extract($this->dispatcher->trigger_event('vse.similartopics.modify_topicrow', compact($vars)));
                $this->template->assign_block_vars('similar', $topic_row);
                $this->pagination->generate_template_pagination($base_url, 'similar.pagination', 'start', $replies + 1, $this->config['posts_per_page'], 1, true, true);
            }
        }
        $this->db->sql_freeresult($result);
        $this->user->add_lang_ext('vse/similartopics', 'similar_topics');
        $this->template->assign_vars(array('L_SIMILAR_TOPICS' => $this->user->lang('SIMILAR_TOPICS'), 'NEWEST_POST_IMG' => $this->user->img('icon_topic_newest', 'VIEW_NEWEST_POST'), 'LAST_POST_IMG' => $this->user->img('icon_topic_latest', 'VIEW_LATEST_POST'), 'REPORTED_IMG' => $this->user->img('icon_topic_reported', 'TOPIC_REPORTED'), 'POLL_IMG' => $this->user->img('icon_topic_poll', 'TOPIC_POLL'), 'S_PST_BRANCH' => phpbb_version_compare(max($this->config['phpbb_version'], PHPBB_VERSION), '3.2.0-dev', '<') ? '31x' : '32x'));
    }
开发者ID:VSEphpbb,项目名称:similartopics,代码行数:101,代码来源:similar_topics.php

示例13: main


//.........这里部分代码省略.........
                            trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
                        }
                        $tables = array(CONFIRM_TABLE, SESSIONS_TABLE);
                        foreach ($tables as $table) {
                            switch ($db->sql_layer) {
                                case 'sqlite':
                                case 'firebird':
                                    $db->sql_query("DELETE FROM {$table}");
                                    break;
                                default:
                                    $db->sql_query("TRUNCATE TABLE {$table}");
                                    break;
                            }
                        }
                        // let's restore the admin session
                        $reinsert_ary = array('session_id' => (string) $user->session_id, 'session_page' => (string) substr($user->page['page'], 0, 199), 'session_forum_id' => $user->page['forum'], 'session_user_id' => (int) $user->data['user_id'], 'session_start' => (int) $user->data['session_start'], 'session_last_visit' => (int) $user->data['session_last_visit'], 'session_time' => (int) $user->time_now, 'session_browser' => (string) trim(substr($user->browser, 0, 149)), 'session_forwarded_for' => (string) $user->forwarded_for, 'session_ip' => (string) $user->ip, 'session_autologin' => (int) $user->data['session_autologin'], 'session_admin' => 1, 'session_viewonline' => (int) $user->data['session_viewonline']);
                        $sql = 'INSERT INTO ' . SESSIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $reinsert_ary);
                        $db->sql_query($sql);
                        add_log('admin', 'LOG_PURGE_SESSIONS');
                        break;
                }
            }
        }
        // Version check
        $user->add_lang('install');
        if ($auth->acl_get('a_server') && version_compare(PHP_VERSION, '5.3.3', '<')) {
            $template->assign_vars(array('S_PHP_VERSION_OLD' => true, 'L_PHP_VERSION_OLD' => sprintf($user->lang['PHP_VERSION_OLD'], '<a href="https://www.phpbb.com/community/viewtopic.php?f=14&amp;t=2152375">', '</a>')));
        }
        $latest_version_info = false;
        if (($latest_version_info = obtain_latest_version_info(request_var('versioncheck_force', false))) === false) {
            $template->assign_var('S_VERSIONCHECK_FAIL', true);
        } else {
            $latest_version_info = explode("\n", $latest_version_info);
            $template->assign_vars(array('S_VERSION_UP_TO_DATE' => phpbb_version_compare(trim($latest_version_info[0]), $config['version'], '<=')));
        }
        // Get forum statistics
        $total_posts = $config['num_posts'];
        $total_topics = $config['num_topics'];
        $total_users = $config['num_users'];
        $total_files = $config['num_files'];
        $start_date = $user->format_date($config['board_startdate']);
        $boarddays = (time() - $config['board_startdate']) / 86400;
        $posts_per_day = sprintf('%.2f', $total_posts / $boarddays);
        $topics_per_day = sprintf('%.2f', $total_topics / $boarddays);
        $users_per_day = sprintf('%.2f', $total_users / $boarddays);
        $files_per_day = sprintf('%.2f', $total_files / $boarddays);
        $upload_dir_size = get_formatted_filesize($config['upload_dir_size']);
        $avatar_dir_size = 0;
        if ($avatar_dir = @opendir($phpbb_root_path . $config['avatar_path'])) {
            while (($file = readdir($avatar_dir)) !== false) {
                if ($file[0] != '.' && $file != 'CVS' && strpos($file, 'index.') === false) {
                    $avatar_dir_size += filesize($phpbb_root_path . $config['avatar_path'] . '/' . $file);
                }
            }
            closedir($avatar_dir);
            $avatar_dir_size = get_formatted_filesize($avatar_dir_size);
        } else {
            // Couldn't open Avatar dir.
            $avatar_dir_size = $user->lang['NOT_AVAILABLE'];
        }
        if ($posts_per_day > $total_posts) {
            $posts_per_day = $total_posts;
        }
        if ($topics_per_day > $total_topics) {
            $topics_per_day = $total_topics;
        }
开发者ID:eyumay,项目名称:ju.ejhs,代码行数:67,代码来源:acp_main.php

示例14: assign_details

 /**
  * Assign variables to the template
  */
 public function assign_details()
 {
     if (!sizeof($this->styles)) {
         return false;
     }
     // Get siblings
     $prev = $this->sibling($this->default_style, 'prev');
     $next = $this->sibling($this->default_style, 'next');
     $this->template->assign_vars(array('U_PREV' => $prev['url'], 'PREV_ID' => $prev['id'], 'U_NEXT' => $next['url'], 'NEXT_ID' => $next['id']));
     $category = '';
     $style = new \titania_contribution();
     $style->set_type(TITANIA_TYPE_STYLE);
     $style->options = array('demo' => true);
     foreach ($this->styles as $id => $data) {
         $style->__set_array(array('contrib_id' => $id, 'contrib_name_clean' => $data['contrib_name_clean'], 'contrib_demo' => $data['contrib_demo']));
         $preview_img = false;
         if (isset($data['thumb_id'])) {
             $parameters = array('id' => $data['thumb_id']);
             if ($data['thumbnail']) {
                 $parameters += array('mode' => 'view', 'thumb' => 1);
             }
             $preview_img = $this->controller_helper->route('phpbb.titania.download', $parameters);
         }
         $authors = $this->get_author_profile(array('username_clean' => $data['username_clean'], 'username' => $data['username'], 'user_id' => $data['contrib_user_id'], 'user_colour' => $data['user_colour']));
         $authors .= $data['coauthors'];
         $data['category_name'] = $this->user->lang($data['category_name']);
         $phpbb_version = $data['phpbb_versions']['branch'][0] . '.' . $data['phpbb_versions']['branch'][1] . '.' . $data['phpbb_versions']['revision'];
         $current_phpbb_version = $data['phpbb_versions']['branch'][0] . '.' . $data['phpbb_versions']['branch'][1] . '.' . $this->ext_config->phpbb_versions[$data['phpbb_versions']['branch']]['latest_revision'];
         $vars = array('AUTHORS' => $authors, 'CATEGORY' => $category != $data['category_name'] ? $data['category_name'] : false, 'ID' => $id, 'IFRAME' => $style->get_demo_url($this->phpbb_branch), 'LICENSE' => $data['revision_license'] ? $data['revision_license'] : $this->user->lang['UNKNOWN'], 'NAME' => $data['contrib_name'], 'PHPBB_VERSION' => $phpbb_version, 'PREVIEW' => $preview_img, 'S_OUTDATED' => phpbb_version_compare($phpbb_version, $current_phpbb_version, '<'), 'U_DEMO' => $style->get_demo_url($this->phpbb_branch, true), 'U_DOWNLOAD' => $this->controller_helper->route('phpbb.titania.download', array('id' => $data['attachment_id'])), 'U_VIEW' => $style->get_url());
         if ($this->default_style == $id) {
             $this->template->assign_vars($vars);
         }
         $category = $data['category_name'];
         $this->template->assign_block_vars('stylerow', $vars);
         unset($this->styles[$id], $vars, $this->coauthors[$id]);
     }
 }
开发者ID:Sajaki,项目名称:customisation-db,代码行数:40,代码来源:demo.php

示例15: main

    function main($id, $mode)
    {
        global $db, $user, $auth, $template, $cache, $phpEx;
        global $config, $phpbb_root_path, $phpbb_admin_path;
        include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
        include $phpbb_root_path . 'includes/functions_invite.' . $phpEx;
        $user->add_lang(array('ucp', 'mods/info_acp_invite', 'acp/board', 'acp/email'));
        $invite = new invite();
        $action = request_var('action', '');
        $submit = isset($_POST['submit']) ? true : false;
        $error = array();
        foreach ($invite->config as $k => $v) {
            $new_config[$k] = utf8_normalize_nfc(request_var($k, $v, true));
        }
        $form_key = 'acp_invite';
        add_form_key($form_key);
        if (request_var('version_check', false)) {
            $mode = 'version';
        }
        if (!$invite->config['enable']) {
            $error[] = $user->lang['ACP_IAF_DISABLED'];
        }
        if ($invite->config['enable'] && !$config['email_enable']) {
            $error[] = sprintf($user->lang['ERROR_EMAIL_DISABLED'], append_sid("{$phpbb_admin_path}index.{$phpEx}?i=board&amp;mode=email"));
        }
        switch ($mode) {
            case 'overview':
                $this->page_title = 'ACP_INVITE_OVERVIEW';
                $this->tpl_name = 'acp_invite_overview';
                // Calculate stats
                $days_installed = (time() - $invite->config['tracking_time']) / 86400;
                $invitations_per_day = sprintf('%.2f', $invite->config['num_invitations'] / $days_installed);
                $registrations_per_day = sprintf('%.2f', $invite->config['num_registrations'] / $days_installed);
                $referrals_per_day = sprintf('%.2f', $invite->config['num_referrals'] / $days_installed);
                $install_date = $user->format_date($invite->config['tracking_time']);
                // Version check
                $latest_version_info = $update_to_date = false;
                if (($latest_version_info = $this->latest_version_info(request_var('versioncheck_force', false))) === false) {
                    $template->assign_var('S_VERSIONCHECK_FAIL', true);
                } else {
                    $latest_version_info = explode("\n", $latest_version_info);
                    $up_to_date = phpbb_version_compare($invite->config['version'], trim($latest_version_info[0]), '<') ? false : true;
                }
                if ($action) {
                    if (!confirm_box(true)) {
                        switch ($action) {
                            case 'sync_referral_data':
                                $confirm = true;
                                $confirm_lang = 'ACP_INVITE_CONFIRM_SYNC_REFERRAL_DATA';
                                break;
                            default:
                                $confirm = false;
                                break;
                        }
                        if ($confirm) {
                            confirm_box(false, $user->lang[$confirm_lang], build_hidden_fields(array('i' => $id, 'mode' => $mode, 'action' => $action)));
                        }
                    } else {
                        switch ($action) {
                            case 'sync_referral_data':
                                // Get an idea of which users need to be updated
                                $sql = 'SELECT invite_user_id, register_user_id, invite_time
										FROM ' . INVITE_LOG_TABLE . '
										WHERE register_key_used = 1';
                                $result = $db->sql_query($sql);
                                $uid_array = $db->sql_fetchrowset($result);
                                $db->sql_freeresult($result);
                                for ($i = 0; $i < sizeof($uid_array); $i++) {
                                    if ($invite->config['referral_invitation_bridge']) {
                                        $sql = 'SELECT COUNT(referrer_id) AS is_existent
											FROM ' . INVITE_REFERRALS_TABLE . '
											WHERE referrer_id = ' . (int) $uid_array[$i]['invite_user_id'] . '
												AND referral_id = ' . (int) $uid_array[$i]['register_user_id'];
                                        $result = $db->sql_query($sql);
                                        $exists = $db->sql_fetchfield('is_existent');
                                        $db->sql_freeresult($result);
                                        if (!$exists) {
                                            $sql_ary = array('user_referrer_id' => $uid_array[$i]['invite_user_id'], 'user_referrer_name' => $invite->user_return_data($uid_array[$i]['invite_user_id'], 'user_id', 'username_clean'));
                                            $sql = 'UPDATE ' . USERS_TABLE . '
													SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
													WHERE user_id = ' . (int) $uid_array[$i]['register_user_id'];
                                            $result = $db->sql_query($sql);
                                            $db->sql_freeresult($result);
                                            $sql_ary = array('referrer_id' => $uid_array[$i]['invite_user_id'], 'referral_id' => $uid_array[$i]['register_user_id'], 'time' => $uid_array[$i]['invite_time']);
                                            $sql = 'INSERT INTO ' . INVITE_REFERRALS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
                                            $db->sql_query($sql);
                                        }
                                    } else {
                                        $sql_ary = array('user_referrer_id' => 0, 'user_referrer_name' => '');
                                        $sql = 'UPDATE ' . USERS_TABLE . '
												SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
												WHERE user_id = ' . (int) $uid_array[$i]['register_user_id'];
                                        $result = $db->sql_query($sql);
                                        $db->sql_freeresult($result);
                                        $sql = 'DELETE FROM ' . INVITE_REFERRALS_TABLE . '
												WHERE referrer_id = ' . (int) $uid_array[$i]['invite_user_id'] . '
												AND referral_id = ' . (int) $uid_array[$i]['register_user_id'];
                                        $db->sql_query($sql);
                                        $sql = 'SELECT COUNT(referrer_id) AS total_referrals
											FROM ' . INVITE_REFERRALS_TABLE;
//.........这里部分代码省略.........
开发者ID:janukobytsch,项目名称:invite-a-friend,代码行数:101,代码来源:acp_invite.php


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