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


PHP ocp_version_number函数代码示例

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


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

示例1: get_file

 /**
  * This will get the XML file from ocportal.com.
  *
  * @param  ?ID_TEXT		The ID to do under (NULL: root)
  * @return string			The XML file
  */
 function get_file($id)
 {
     $stub = get_param_integer('localhost', 0) == 1 ? get_base_url() : 'http://ocportal.com';
     $v = 'Version ' . float_to_raw_string(ocp_version_number(), 1);
     if (!is_null($id)) {
         $v = $id;
     }
     $url = $stub . '/data/ajax_tree.php?hook=choose_download&id=' . rawurlencode($v) . '&file_type=tar';
     require_code('character_sets');
     $contents = http_download_file($url);
     $utf = $GLOBALS['HTTP_CHARSET'] == 'utf-8';
     // We have to use 'U' in the regexp to work around a Chrome parser bug (we can't rely on convert_to_internal_encoding being 100% correct)
     require_code('character_sets');
     $contents = convert_to_internal_encoding($contents);
     $contents = preg_replace('#^\\s*\\<' . '\\?xml version="1.0" encoding="[^"]*"\\?' . '\\>\\<request\\>#' . ($utf ? 'U' : ''), '', $contents);
     $contents = preg_replace('#</request>#' . ($utf ? 'U' : ''), '', $contents);
     $contents = preg_replace('#<category [^>]*has_children="false"[^>]*>[^>]*</category>#' . ($utf ? 'U' : ''), '', $contents);
     $contents = preg_replace('#<category [^>]*title="Manual install required"[^>]*>[^>]*</category>#' . ($utf ? 'U' : ''), '', $contents);
     return $contents;
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:26,代码来源:choose_ocportalcom_addon.php

示例2: run

 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  array	A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     require_code('version');
     require_code('version2');
     require_lang('version');
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('version', array('h', 'f', 't', 'v', 'm'), array()), '', '');
     } elseif (array_key_exists('f', $options) || array_key_exists('future', $options)) {
         return array('', get_future_version_information(), '', '');
     } elseif (array_key_exists('t', $options) || array_key_exists('time', $options)) {
         return array('', '', ocp_version_time(), '');
     } elseif ((array_key_exists('v', $options) || array_key_exists('major-version', $options)) && (!array_key_exists('m', $options) && !array_key_exists('minor-version', $options))) {
         return array('', '', ocp_version(), '');
     } elseif ((array_key_exists('m', $options) || array_key_exists('minor-version', $options)) && (!array_key_exists('v', $options) && !array_key_exists('major-version', $options))) {
         return array('', '', ocp_version_minor(), '');
     } elseif ((array_key_exists('g', $options) || array_key_exists('general-version', $options)) && (!array_key_exists('v', $options) && !array_key_exists('major-version', $options))) {
         return array('', '', ocp_version_number(), '');
     } else {
         return array('', '', ocp_version_full(), '');
     }
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:29,代码来源:version.php

示例3: get_version

 /**
  * Get the version of ocPortal this addon is for
  *
  * @return float			Version number
  */
 function get_version()
 {
     return ocp_version_number();
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:9,代码来源:guestbook.php

示例4: install


//.........这里部分代码省略.........
         add_config_option('GLOBAL_DONEXT_ICONS', 'global_donext_icons', 'tick', 'return is_null($old=get_value(\'disable_donext_global\'))?\'1\':invert_value($old);', 'SITE', 'ADVANCED');
         add_config_option('NO_STATS_WHEN_CLOSED', 'no_stats_when_closed', 'tick', 'return \'' . (substr(ocp_srv('HTTP_HOST'), 0, 8) == '192.168.' || substr(ocp_srv('HTTP_HOST'), 0, 7) == '10.0.0.' || in_array(ocp_srv('HTTP_HOST'), array('localhost', 'test.ocportal.com')) ? '0' : '1') . '\';', 'SITE', 'CLOSED_SITE');
         add_config_option('NO_BOT_STATS', 'no_bot_stats', 'tick', 'return \'0\';', 'SITE', 'GENERAL');
         add_config_option('FILE_SYSTEM_CACHING', 'filesystem_caching', 'tick', 'return \'0\';', 'SITE', 'CACHES');
         // Java/FTP upload
         add_config_option('ENABLE_JAVA_UPLOAD', 'java_upload', 'tick', 'return \'0\';', 'SITE', 'JAVA_UPLOAD');
         add_config_option('JAVA_FTP_HOST', 'java_ftp_host', 'line', 'return ocp_srv(\'HTTP_HOST\');', 'SITE', 'JAVA_UPLOAD');
         add_config_option('JAVA_FTP_USERNAME', 'java_username', 'line', 'return \'anonymous\';', 'SITE', 'JAVA_UPLOAD');
         add_config_option('JAVA_FTP_PASSWORD', 'java_password', 'line', 'return \'someone@example.com\';', 'SITE', 'JAVA_UPLOAD');
         add_config_option('JAVA_FTP_PATH', 'java_ftp_path', 'line', 'return \'/public_html/uploads/incoming/\';', 'SITE', 'JAVA_UPLOAD');
     }
     if (is_null($upgrade_from) || $upgrade_from < 10) {
         add_config_option('ADVANCED_ADMIN_CACHE', 'advanced_admin_cache', 'tick', 'return \'0\';', 'SITE', 'CACHES');
         add_config_option('COLLAPSE_USER_ZONES', 'collapse_user_zones', 'tick', 'return \'1\';', 'SITE', 'GENERAL');
         add_config_option('CHECK_BROKEN_URLS', 'check_broken_urls', 'tick', 'return \'1\';', 'SITE', '_COMCODE');
         add_config_option('GOOGLE_ANALYTICS', 'google_analytics', 'line', 'return \'\';', 'SITE', 'GENERAL');
         add_config_option('FIXED_WIDTH', 'fixed_width', 'tick', 'return \'1\';', 'THEME', 'GENERAL');
         add_config_option('SHOW_CONTENT_TAGGING', 'show_content_tagging', 'tick', 'return \'0\';', 'THEME', 'GENERAL');
         add_config_option('SHOW_CONTENT_TAGGING_INLINE', 'show_content_tagging_inline', 'tick', 'return \'0\';', 'THEME', 'GENERAL');
         add_config_option('SHOW_SCREEN_ACTIONS', 'show_screen_actions', 'tick', 'return \'1\';', 'THEME', 'GENERAL');
         add_config_option('PERSONAL_SUB_LINKS', 'ocp_show_personal_sub_links', 'tick', 'return \'1\';', 'BLOCKS', 'PERSONAL_BLOCK');
     }
     if (is_null($upgrade_from) || $upgrade_from < 11) {
         add_config_option('LONG_GOOGLE_COOKIES', 'long_google_cookies', 'tick', 'return \'0\';', 'SITE', 'GENERAL');
         add_config_option('REMEMBER_ME_BY_DEFAULT', 'remember_me_by_default', 'tick', 'return \'0\';', 'SITE', 'GENERAL');
         add_config_option('DETECT_JAVASCRIPT', 'detect_javascript', 'tick', 'return \'0\';', 'SITE', 'ADVANCED');
         add_config_option('MOBILE_SUPPORT', 'mobile_support', 'tick', 'return \'1\';', 'SITE', 'GENERAL');
     }
     if (is_null($upgrade_from) || $upgrade_from < 12) {
         add_config_option('MAIL_QUEUE', 'mail_queue', 'tick', 'return \'0\';', 'SITE', 'EMAIL');
         add_config_option('MAIL_QUEUE_DEBUG', 'mail_queue_debug', 'tick', 'return \'0\';', 'SITE', 'EMAIL');
         add_config_option('COMMENTS_TO_SHOW_IN_THREAD', 'comments_to_show_in_thread', 'integer', 'return \'30\';', 'FEATURE', 'USER_INTERACTION');
         add_config_option('MAX_THREAD_DEPTH', 'max_thread_depth', 'integer', 'return \'6\';', 'FEATURE', 'USER_INTERACTION');
     }
     if (!is_null($upgrade_from) && $upgrade_from < 12) {
         foreach (array('send_error_emails', 'ocf_show_personal_myhome_link', 'twitter_login', 'twitter_password', 'facebook_api', 'facebook_appid', 'facebook_secret_code', 'facebook_uid', 'facebook_target_ids') as $option_to_delete) {
             delete_config_option($option_to_delete);
         }
     }
     if (is_null($upgrade_from) || $upgrade_from < 13) {
         add_config_option('COMPLEX_UPLOADER', 'complex_uploader', 'tick', 'return \'1\';', 'ACCESSIBILITY', 'GENERAL');
         add_config_option('ENABLE_WYSIWYG', 'wysiwyg', 'tick', 'return \'1\';', 'ACCESSIBILITY', 'GENERAL');
         add_config_option('EDITAREA', 'editarea', 'tick', 'return \'1\';', 'ACCESSIBILITY', 'GENERAL');
         add_config_option('JS_OVERLAYS', 'js_overlays', 'tick', 'return \'1\';', 'ACCESSIBILITY', 'GENERAL');
         add_config_option('TREE_LISTS', 'tree_lists', 'tick', 'return \'1\';', 'ACCESSIBILITY', 'GENERAL');
         add_config_option('CSS_CAPTCHA', 'css_captcha', 'tick', 'return addon_installed(\'captcha\')?\'1\':NULL;', 'SECURITY', 'SECURITY_IMAGE');
         add_config_option('CAPTCHA_SINGLE_GUESS', 'captcha_single_guess', 'tick', 'return addon_installed(\'captcha\')?\'1\':NULL;', 'SECURITY', 'SECURITY_IMAGE');
         add_config_option('ENABLE_AUTOBAN', 'autoban', 'tick', 'return \'1\';', 'SECURITY', 'GENERAL');
         add_config_option('ENABLE_LIKES', 'likes', 'tick', 'return \'0\';', 'FEATURE', 'USER_INTERACTION');
     }
     if (!is_null($upgrade_from) && $upgrade_from < 8) {
         delete_config_option('logo_map');
         $GLOBALS['SITE_DB']->query('UPDATE ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'config SET the_type=\'forum\' WHERE the_name LIKE \'' . db_encode_like('%_forum_name') . '\'');
     }
     if (is_null($upgrade_from)) {
         set_value('version', float_to_raw_string(ocp_version_number()));
         set_value('ocf_version', float_to_raw_string(ocp_version_number()));
         // Site Configuration
         //  General
         add_config_option('SITE_NAME', 'site_name', 'line', 'return do_lang(\'UNNAMED\');', 'SITE', 'GENERAL');
         add_config_option('SITE_SCOPE', 'site_scope', 'transline', 'return \'???\';', 'SITE', 'GENERAL');
         add_config_option('DESCRIPTION', 'description', 'transline', 'return \'\';', 'SITE', 'GENERAL');
         add_config_option('COPYRIGHT', 'copyright', 'transline', 'return \'Copyright &copy; \'.get_site_name().\' \'.date(\'Y\').\'\';', 'SITE', 'GENERAL');
         add_config_option('WELCOME_MESSAGE', 'welcome_message', 'transtext', 'return \'\';', 'SITE', 'GENERAL');
         add_config_option('MAIN_FORUM_NAME', 'main_forum_name', 'forum', 'return has_no_forum()?NULL:do_lang(\'DEFAULT_FORUM_TITLE\',\'\',\'\',\'\',get_site_default_lang());', 'FEATURE', 'USER_INTERACTION');
         add_config_option('KEYWORDS', 'keywords', 'line', 'return \'\';', 'SITE', 'GENERAL');
         //  Advanced
         //add_config_option('LOGO_MAP','logo_map','text','$tpl=do_template(\'IMAGE_MAP\'); return $tpl->evaluate();','SITE','ADVANCED');
         add_config_option('GZIP_OUTPUT', 'gzip_output', 'tick', 'return \'0\';', 'SITE', 'ADVANCED', 1);
         //  Environment
         add_config_option('FORUM_IN_PORTAL', 'forum_in_portal', 'tick', 'return has_no_forum()?NULL:\'0\';', 'SITE', 'ENVIRONMENT', 1);
         add_config_option('EMAIL', 'staff_address', 'line', 'return \'staff@\'.get_domain();', 'SITE', 'EMAIL');
         add_config_option('GD', 'is_on_gd', 'tick', 'return function_exists(\'imagetypes\')?\'1\':\'0\';', 'SITE', 'ENVIRONMENT', 1);
         add_config_option('FOLDER_CREATE', 'is_on_folder_create', 'tick', 'return \'1\';', 'SITE', 'ENVIRONMENT', 1);
         //  Closed Site
         add_config_option('CLOSED_SITE', 'site_closed', 'tick', 'return \'' . (substr(ocp_srv('HTTP_HOST'), 0, 8) == '192.168.' || substr(ocp_srv('HTTP_HOST'), 0, 7) == '10.0.0.' || in_array(ocp_srv('HTTP_HOST'), array('localhost', 'test.ocportal.com')) ? '0' : '1') . '\';', 'SITE', 'CLOSED_SITE');
         add_config_option('MESSAGE', 'closed', 'transtext', 'return do_lang(\'BEING_INSTALLED\');', 'SITE', 'CLOSED_SITE');
         add_config_option('MAXIMUM_USERS', 'maximum_users', 'integer', 'return \'100\';', 'SITE', 'CLOSED_SITE', 1);
         //  Logging
         add_config_option('CC_ADDRESS', 'cc_address', 'line', 'return \'\';', 'SITE', 'EMAIL');
         // \'staff_cc@\'.get_domain()
         add_config_option('LOG_PHP_ERRORS', 'log_php_errors', 'tick', 'return \'1\';', 'SITE', 'LOGGING');
         add_config_option('DISPLAY_PHP_ERRORS', 'display_php_errors', 'tick', 'return \'0\';', 'SITE', 'LOGGING');
         // Security/Usergroup Options
         //  Uploading
         add_config_option('FILE_TYPES', 'valid_types', 'line', 'return \'swf,sql,odg,odp,odt,ods,pdf,pgp,dot,doc,ppt,csv,xls,docx,pptx,xlsx,pub,txt,log,psd,tga,tif,gif,png,ico,bmp,jpg,jpeg,flv,avi,mov,3gp,mpg,mpeg,mp4,webm,asf,wmv,zip,tar,rar,gz,wav,mp3,ogg,ogv,torrent,php,css,tpl,ini,eml,patch,diff,iso,dmg\';', 'SECURITY', 'UPLOADED_FILES');
         // fla,html,htm,svg,xml kept out for security reasons. NB: Can't add any more due to length limit.
         add_config_option('IMAGE_TYPES', 'valid_images', 'line', 'return \'jpg,jpeg,gif,png,ico\';', 'SECURITY', 'UPLOADED_FILES');
         // Feature Options
         //  User Interaction
         add_config_option('RATING', 'is_on_rating', 'tick', 'return \'1\';', 'FEATURE', 'USER_INTERACTION');
         add_config_option('COMMENTS', 'is_on_comments', 'tick', 'return has_no_forum()?NULL:\'1\';', 'FEATURE', 'USER_INTERACTION');
         add_config_option('COMMENTS_FORUM_NAME', 'comments_forum_name', 'forum', 'return has_no_forum()?NULL:do_lang(\'COMMENT_FORUM_NAME\',\'\',\'\',\'\',get_site_default_lang());', 'FEATURE', 'USER_INTERACTION');
         add_config_option('COMMENT_FORM_TEXT', 'comment_text', 'transtext', 'return has_no_forum()?NULL:static_evaluate_tempcode(do_template(\'COMMENTS_DEFAULT_TEXT\'));', 'FEATURE', 'USER_INTERACTION');
         //  Images
         add_config_option('THUMB_WIDTH', 'thumb_width', 'integer', 'return \'200\';', 'FEATURE', 'IMAGES');
         add_config_option('IMAGES', 'max_image_size', 'integer', 'return \'700\';', 'SITE', 'UPLOAD');
         add_config_option('USERS_ONLINE_TIME', 'users_online_time', 'integer', 'return \'5\';', 'SITE', 'LOGGING');
     }
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:admin_config.php

示例5: substr

    }
    $RELATIVE_PATH = substr($FILE_BASE, ($a > $b ? $a : $b) + 1);
    $FILE_BASE = substr($FILE_BASE, 0, $a > $b ? $a : $b);
} else {
    $RELATIVE_PATH = '';
}
@chdir($FILE_BASE);
if (!is_file($FILE_BASE . '/sources/global.php')) {
    exit('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . chr(10) . '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="EN" lang="EN"><head><title>Critical startup error</title></head><body><h1>ocPortal startup error</h1><p>The second most basic ocPortal startup file, sources/global.php, could not be located. This is almost always due to an incomplete upload of the ocPortal system, so please check all files are uploaded correctly.</p><p>Once all ocPortal files are in place, ocPortal must actually be installed by running the installer. You must be seeing this message either because your system has become corrupt since installation, or because you have uploaded some but not all files from our manual installer package: the quick installer is easier, so you might consider using that instead.</p><p>ocProducts maintains full documentation for all procedures and tools, especially those for installation. These may be found on the <a href="http://ocportal.com">ocPortal website</a>. If you are unable to easily solve this problem, we may be contacted from our website and can help resolve it for you.</p><hr /><p style="font-size: 0.8em">ocPortal is a website engine created by ocProducts.</p></body></html>');
}
require $FILE_BASE . '/sources/global.php';
require_code('addons');
require_code('dump_addons');
require_code('version');
require_code('downloads2');
$version = ocp_version_number();
$version_for_name = preg_replace('/\\./', '', float_to_raw_string($version));
$get_cat = get_param('cat', NULL);
if ($get_cat === NULL) {
    exit("Please pass the category name in the URL (?cat=name).");
}
// $file_list = get_file_list_of_addons();
$addon_list = get_details_of_addons();
$parent_id = $GLOBALS['SITE_DB']->query_value_null_ok('download_categories c JOIN ' . get_table_prefix() . 'translate t ON t.id=c.category', 'c.id AS id', array('parent_id' => 1, 't.text_original' => 'Addons'));
$c_main_id = check_and_add_category($get_cat, $parent_id);
/*$cat_id=add_download_category('Themes',$c_main_id,'','','');
$all_groups=$GLOBALS['FORUM_DRIVER']->get_usergroup_list(true);
foreach (array_keys($all_groups) as $_group_id)
{
	$GLOBALS['SITE_DB']->query_insert('group_category_access',array('module_the_name'=>'downloads','category_name'=>strval($cat_id),'group_id'=>$_group_id));
}*/
开发者ID:erico-deh,项目名称:ocPortal,代码行数:31,代码来源:publish_addons_as_downloads.php

示例6: init__global2


//.........这里部分代码省略.........
    	$func=get_defined_functions();
    	print_r($func['user']);*/
    if (tacit_https() || is_page_https(get_zone_name(), get_page_name())) {
        @header('Cache-Control: private');
        @header('Pragma: private');
    }
    $BOOTSTRAPPING = 0;
    if ($GLOBALS['SEMI_DEBUG_MODE'] && $MICRO_AJAX_BOOTUP == 0) {
        if ($GLOBALS['SEMI_DEBUG_MODE']) {
            /*if ((mt_rand(0,2)==1) && ($GLOBALS['DEBUG_MODE']) && (running_script('index')))	We know this works now, so let's stop messing up our development speed
            		{
            			require_code('view_modes');
            			erase_cached_templates(true); // Stop anything trying to read a template cache item (E.g. CSS, JS) that might not exist!
            		}*/
            if (strpos(ocp_srv('HTTP_REFERER'), ocp_srv('HTTP_HOST')) !== false && strpos(ocp_srv('HTTP_REFERER'), 'keep_devtest') !== false && !running_script('attachment') && !running_script('upgrader') && strpos(ocp_srv('HTTP_REFERER'), 'login') === false && is_null(get_param('keep_devtest', NULL))) {
                $_GET['keep_devtest'] = '1';
                fatal_exit('URL not constructed properly: development mode in use but keep_devtest was not specified. This indicates that links have been made without build_url (in PHP) or keep_stub (in Javascript). Whilst not fatal this time, failure to use these functions can cause problems when your site goes live. See the ocPortal codebook for more details.');
            } else {
                $_GET['keep_devtest'] = '1';
            }
        }
        if (browser_matches('true_xhtml') && get_value('html5') !== '1' && get_value('html5') !== '_true' && get_param_integer('keep_no_xhtml', 0) == 0 && !running_script('upgrader')) {
            @header('Content-type: application/xhtml+xml; charset=' . get_charset());
        }
        if (isset($_CREATED_FILES)) {
            /**
             * Run after-tests for debug mode, to make sure coding standards are met.
             */
            function debug_mode_aftertests()
            {
                global $_CREATED_FILES, $_MODIFIED_FILES;
                // Use the info from ocProduct's custom PHP version to make sure that all files that were created/modified got synched as they should have been.
                foreach ($_CREATED_FILES as $file) {
                    if (substr($file, 0, strlen(get_file_base())) == get_file_base() && substr($file, -4) != '.log' && basename($file) != 'permissioncheckslog.php') {
                        @exit(escape_html('File not permission-synched: ' . $file));
                    }
                }
                foreach ($_MODIFIED_FILES as $file) {
                    if (strpos($file, '_cache') === false && substr($file, 0, strlen(get_file_base())) == get_file_base() && substr($file, -4) != '.log' && basename($file) != 'permissioncheckslog.php') {
                        @exit(escape_html('File not change-synched: ' . $file));
                    }
                }
                global $TITLE_CALLED, $SCREEN_TEMPLATE_CALLED, $EXITING;
                if (is_null($SCREEN_TEMPLATE_CALLED) && $EXITING == 0 && strpos(ocp_srv('PHP_SELF'), 'index.php') !== false) {
                    @exit(escape_html('No screen template called.'));
                }
                if (!$TITLE_CALLED && (is_null($SCREEN_TEMPLATE_CALLED) || $SCREEN_TEMPLATE_CALLED != '') && $EXITING == 0 && strpos(ocp_srv('PHP_SELF'), 'index.php') !== false) {
                    @exit(escape_html('No title used on screen.'));
                }
            }
            register_shutdown_function('debug_mode_aftertests');
        }
        if (ocp_srv('SCRIPT_FILENAME') != '' && $GLOBALS['DEBUG_MODE'] && strpos(ocp_srv('SCRIPT_FILENAME'), 'data_custom') === false) {
            if (@strlen(file_get_contents(ocp_srv('SCRIPT_FILENAME'), FILE_TEXT)) > 4500) {
                fatal_exit('Entry scripts (front controllers) should not be shoved full of code.');
            }
        }
    }
    // FirePHP console support, only for administrators
    if ((get_param_integer('keep_firephp', 0) == 1 || get_param_integer('keep_queries', 0) == 1) && ($GLOBALS['FORUM_DRIVER']->is_super_admin(get_member()) || $GLOBALS['IS_ACTUALLY_ADMIN'])) {
        require_code('firephp');
    }
    $default_memory_limit = get_value('memory_limit');
    if (is_null($default_memory_limit) || $default_memory_limit == '' || $default_memory_limit == '0' || $default_memory_limit == '-1') {
        $default_memory_limit = '64M';
    }
    @ini_set('memory_limit', $default_memory_limit);
    if (isset($GLOBALS['FORUM_DRIVER']) && $GLOBALS['FORUM_DRIVER']->is_super_admin(get_member())) {
        if (get_param_integer('keep_avoid_memory_limit', 0) == 1) {
            disable_php_memory_limit();
        }
        $memory_test = get_param_integer('keep_memory_limit_test', 0);
        if ($memory_test != 0 && $memory_test <= 32) {
            @ini_set('memory_limit', strval($memory_test) . 'M');
        }
    }
    if (get_option('sitewide_im', true) === '1' && running_script('index') && get_param('type', 'misc', true) != 'room') {
        require_code('chat');
        enter_chat_lobby();
    }
    // Startup hooks
    if (!running_script('upgrader')) {
        $startup_hooks = find_all_hooks('systems', 'startup');
        foreach (array_keys($startup_hooks) as $hook) {
            require_code('hooks/systems/startup/' . filter_naughty_harsh($hook));
            $ob = object_factory('Hook_startup_' . filter_naughty_harsh($hook), true);
            if ($ob === NULL) {
                continue;
            }
            $ob->run($MICRO_BOOTUP, $MICRO_AJAX_BOOTUP, 0);
        }
        if ($CURRENT_SHARE_USER !== NULL && float_to_raw_string(ocp_version_number()) != get_value('version')) {
            require_code('upgrade');
            clear_caches_2();
            version_specific();
            upgrade_modules();
            ocf_upgrade();
        }
    }
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:global2.php

示例7: import_from_xml

/**
 * Import to ocPortal database table from the equivalent XML format.
 *
 * @param  string			Data in XML format
 * @param  boolean		Synchronise deletes as well as inserts/updates
 * @return array			List of operations performed
 */
function import_from_xml($xml_data, $delete_missing_rows = false)
{
    $parsed = new ocp_simple_xml_reader($xml_data);
    if (!is_null($parsed->error)) {
        warn_exit($parsed->error);
    }
    $GLOBALS['NO_QUERY_LIMIT'] = true;
    $GLOBALS['NO_DB_SCOPE_CHECK'] = true;
    $ops = array();
    $insert_ids = array();
    list($root_tag, $root_attributes, , $this_children) = $parsed->gleamed;
    if ($root_tag == 'ocportal') {
        $_all_fields = $GLOBALS['SITE_DB']->query_select('db_meta', array('*'));
        $all_fields = array();
        foreach ($_all_fields as $f) {
            if (!array_key_exists($f['m_table'], $all_fields)) {
                $all_fields[$f['m_table']] = array();
            }
            $all_fields[$f['m_table']][] = $f;
        }
        $version = array_key_exists('version', $root_attributes) ? floatval($root_attributes['version']) : ocp_version_number();
        $origin = array_key_exists('origin', $root_attributes) ? $root_attributes['origin'] : get_base_url();
        $all_id_fields = array();
        $hooks = find_all_hooks('systems', 'content_meta_aware');
        foreach (array_keys($hooks) as $hook) {
            require_code('hooks/systems/content_meta_aware/' . $hook);
            $ob = object_factory('Hook_content_meta_aware_' . $hook);
            $info = $ob->info();
            if (is_null($info)) {
                continue;
            }
            if (array_key_exists('id_field', $info)) {
                $all_id_fields[$info['table']] = $info['id_field'];
            }
        }
        // Table rows
        $all_existing_data = array();
        foreach ($this_children as $table) {
            $_ops = _import_xml_row($parsed, $all_existing_data, $all_fields, $all_id_fields, $table, $insert_ids, NULL);
            $ops = array_merge($ops, $_ops);
        }
    }
    // Sync deletes
    if ($delete_missing_rows) {
        foreach ($all_existing_data as $table => $es) {
            foreach ($es as $e) {
                $GLOBALS['SITE_DB']->query_delete($table[0], $e, '', 1);
                $ops[] = array(do_lang('DELETED_FROM_TABLE', $table[0]), do_lang('RECORD_IDENTIFIED_BY', make_map_nice($e)));
            }
        }
    }
    return $ops;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:60,代码来源:xml_storage.php

示例8: get_webservice_result

/**
 * Lookup error on ocportal.com, to see if there is more information.
 *
 * @param  mixed				The error message (string or tempcode)
 * @return ?string			The result from the web service (NULL: no result)
 */
function get_webservice_result($error_message)
{
    if (get_domain() == 'ocportal.com') {
        return NULL;
    }
    if (!function_exists('has_zone_access') || !has_zone_access(get_member(), 'adminzone')) {
        return NULL;
    }
    require_code('files');
    global $DONE_ONE_WEB_SERVICE;
    if ($GLOBALS['DOWNLOAD_LEVEL'] > 0 || $DONE_ONE_WEB_SERVICE) {
        return NULL;
    }
    $DONE_ONE_WEB_SERVICE = true;
    if (is_object($error_message)) {
        $error_message = $error_message->evaluate();
    }
    if ($GLOBALS['HTTP_STATUS_CODE'] == '401') {
        return NULL;
    }
    // Get message IN ENGLISH
    if (user_lang() != fallback_lang()) {
        global $LANGUAGE;
        foreach ($LANGUAGE as $_) {
            foreach ($_ as $key => $val) {
                $regexp = preg_replace('#\\\\{\\d+\\\\}#', '.*', str_replace('#', '\\#', preg_quote($val)));
                if ($regexp != '.*') {
                    if (preg_match('#' . $regexp . '#', $error_message) != 0) {
                        $_error_message = do_lang($key, '', '', '', fallback_lang(), false);
                        if (!is_null($_error_message)) {
                            $error_message = $_error_message;
                        }
                        break;
                    }
                }
            }
        }
    }
    // Talk to web service
    $brand = get_value('rebrand_name');
    if (is_null($brand)) {
        $brand = 'ocPortal';
    }
    $result = http_download_file('http://ocportal.com/uploads/website_specific/ocportal.com/scripts/errorservice.php?version=' . float_to_raw_string(ocp_version_number()) . '&error_message=' . rawurlencode($error_message) . '&product=' . rawurlencode($brand), NULL, false);
    if ($GLOBALS['HTTP_DOWNLOAD_MIME_TYPE'] != 'text/plain') {
        return NULL;
    }
    if ($result == '') {
        return NULL;
    }
    if (function_exists('ocp_mark_as_escaped')) {
        ocp_mark_as_escaped($result);
    }
    return $result;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:61,代码来源:failure.php

示例9: persistant_cache_set

/**
 * Put data into the persistant cache.
 *
 * @param  mixed			Key
 * @param  mixed			The data
 * @param  boolean		Whether it is server-wide data
 * @param  ?integer		The expiration time in seconds. (NULL: Default expiry in 60 minutes, or never if it is server-wide).
 */
function persistant_cache_set($key, $data, $server_wide = false, $expire_secs = NULL)
{
    $server_wide = false;
    global $MEM_CACHE;
    if ($MEM_CACHE === NULL) {
        return NULL;
    }
    if ($expire_secs === NULL) {
        $expire_secs = $server_wide ? 0 : 60 * 60;
    }
    $MEM_CACHE->set(($server_wide ? 'ocp' . float_to_raw_string(ocp_version_number()) : get_file_base()) . serialize($key), $data, 0, $expire_secs);
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:20,代码来源:caches.php

示例10: automate_upgrade

/**
 * Automatically go through full upgrade for current site.
 */
function automate_upgrade()
{
    // Database
    clear_caches_1();
    clear_caches_2();
    version_specific();
    upgrade_modules();
    // OCF
    ocf_upgrade();
    // Themes
    require_code('themes2');
    $themes = find_all_themes();
    foreach (array_keys($themes) as $theme) {
        $from = round(ocp_version_number()) - 1;
        $to = ocp_version_number();
        upgrade_theme($theme, $from, $to, false);
    }
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:21,代码来源:upgrade.php

示例11: install_addon

/**
 * Uninstall an addon.
 *
 * @param  string			Name of the addon
 * @param  ?array			The files to install (NULL: all)
 */
function install_addon($file, $files = NULL)
{
    $full = get_custom_file_base() . '/imports/mods/' . $file;
    require_code('zones2');
    require_code('zones3');
    require_code('tar');
    $tar = tar_open($full, 'rb');
    $info_file = tar_get_file($tar, 'mod.inf');
    if (is_null($info_file)) {
        warn_exit(do_lang_tempcode('NOT_ADDON'));
    }
    $info = better_parse_ini_file(NULL, $info_file['data']);
    $directory = tar_get_directory($tar);
    tar_extract_to_folder($tar, '', true, $files, true);
    $addon = $info['name'];
    $author = $info['author'];
    $organisation = $info['organisation'];
    $version = $info['version'];
    if ($version == '(version-synched)') {
        $version = float_to_raw_string(ocp_version_number());
    }
    $dependencies = explode(',', array_key_exists('dependencies', $info) ? $info['dependencies'] : '');
    $incompatibilities = explode(',', array_key_exists('incompatibilities', $info) ? $info['incompatibilities'] : '');
    $description = $info['description'];
    $GLOBALS['SITE_DB']->query_delete('addons', array('addon_name' => $addon), '', 1);
    $GLOBALS['SITE_DB']->query_insert('addons', array('addon_name' => $addon, 'addon_author' => $author, 'addon_organisation' => $organisation, 'addon_version' => $version, 'addon_description' => $description, 'addon_install_time' => time()));
    foreach ($dependencies as $dependency) {
        $GLOBALS['SITE_DB']->query_insert('addons_dependencies', array('addon_name' => $addon, 'addon_name_dependant_upon' => trim($dependency), 'addon_name_incompatibility' => 0));
    }
    foreach ($incompatibilities as $dependency) {
        $GLOBALS['SITE_DB']->query_insert('addons_dependencies', array('addon_name' => $addon, 'addon_name_dependant_upon' => trim($dependency), 'addon_name_incompatibility' => 1));
    }
    foreach ($directory as $dir) {
        $addon_file = $dir['path'];
        if (substr($addon_file, -1) == '/') {
            continue;
        }
        if (is_null($files) || in_array($addon_file, $files)) {
            $GLOBALS['SITE_DB']->query_insert('addons_files', array('addon_name' => $addon, 'filename' => $addon_file));
        }
    }
    // Install new zones
    $zones = array('');
    foreach ($directory as $dir) {
        $addon_file = $dir['path'];
        if (is_null($files) || in_array($addon_file, $files)) {
            $matches = array();
            if (preg_match('#(\\w*)/index.php#', $addon_file, $matches) != 0) {
                $zone = $matches[1];
                $test = $GLOBALS['SITE_DB']->query_value_null_ok('zones', 'zone_name', array('zone_name' => $zone));
                if (is_null($test)) {
                    require_code('menus2');
                    add_menu_item_simple('zone_menu', NULL, $zone, $zone . ':', 0, 1);
                    $GLOBALS['SITE_DB']->query_insert('zones', array('zone_name' => $zone, 'zone_title' => insert_lang($zone, 1), 'zone_default_page' => 'start', 'zone_header_text' => insert_lang('???', 2), 'zone_theme' => 'default', 'zone_wide' => 0, 'zone_require_session' => 0, 'zone_displayed_in_menu' => 1));
                    $groups = $GLOBALS['FORUM_DRIVER']->get_usergroup_list(false, true);
                    foreach (array_keys($groups) as $group_id) {
                        $GLOBALS['SITE_DB']->query_insert('group_zone_access', array('zone_name' => $zone, 'group_id' => $group_id));
                    }
                }
                $zones[] = $zone;
            }
        }
    }
    // Install new modules
    $zones = array_unique(array_merge(find_all_zones(), $zones));
    if (get_option('collapse_user_zones') == '1') {
        $zones[] = 'site';
    }
    foreach ($zones as $zone) {
        $prefix = $zone == '' ? '' : $zone . '/';
        foreach ($directory as $dir) {
            $addon_file = $dir['path'];
            if (is_null($files) || in_array($addon_file, $files)) {
                if (preg_match('#^' . $prefix . 'pages/(modules|modules\\_custom)/([^/]*)\\.php$#', $addon_file, $matches) != 0) {
                    if (!module_installed($matches[2])) {
                        reinstall_module($zone, $matches[2]);
                    }
                }
            }
        }
    }
    // Install new blocks
    foreach ($directory as $dir) {
        $addon_file = $dir['path'];
        if (is_null($files) || in_array($addon_file, $files)) {
            if (preg_match('#^(sources|sources\\_custom)/blocks/([^/]*)\\.php$#', $addon_file, $matches) != 0) {
                if (!block_installed($matches[2])) {
                    reinstall_block($matches[2]);
                }
            }
        }
    }
    // Clear some cacheing
    require_code('view_modes');
//.........这里部分代码省略.........
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:addons.php

示例12: addon_install

 /**
  * The UI to confirm the install of an addon.
  *
  * @return tempcode		The UI
  */
 function addon_install()
 {
     $title = get_page_title('INSTALL_ADDON');
     $file = get_param('file');
     list($warnings, $files, $info) = inform_about_addon_install($file);
     $url = build_url(array('page' => '_SELF', 'type' => '_addon_install'), '_SELF');
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('ADDONS'))));
     $_description = comcode_to_tempcode(str_replace('\\n', "\n", $info['description']), $GLOBALS['FORUM_DRIVER']->get_guest_id());
     if ($info['version'] == '(version-synched)') {
         $info['version'] = float_to_raw_string(ocp_version_number());
     }
     return do_template('ADDON_INSTALL_CONFIRM_SCREEN', array('_GUID' => '79b8c0e900a498cfb166392163295a07', 'TITLE' => $title, 'FILE' => $file, 'URL' => $url, 'FILES' => $files, 'WARNINGS' => $warnings, 'NAME' => $info['name'], 'AUTHOR' => $info['author'], 'ORGANISATION' => $info['organisation'], 'VERSION' => $info['version'], 'DESCRIPTION' => $_description));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:18,代码来源:admin_addons.php


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