• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP fatal_exit函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: add_config_option

/**
 * Add a configuration option into the database, and initialise it with a specified value.
 *
 * @param  ID_TEXT		The language code to the human name of the config option
 * @param  ID_TEXT		The codename for the config option
 * @param  ID_TEXT		The type of the config option
 * @set    float integer tick line text transline transtext list date forum category usergroup colour
 * @param  SHORT_TEXT	The PHP code to execute to get the default value for this option. Be careful not to make a get_option loop.
 * @param  ID_TEXT		The language code for the option category to store the option in
 * @param  ID_TEXT		The language code for the option group to store the option in
 * @param  BINARY			Whether the option is not settable when on a shared ocportal-hosting environment
 * @param  SHORT_TEXT	Extra data for the option
 */
function add_config_option($human_name, $name, $type, $eval, $category, $group, $shared_hosting_restricted = 0, $data = '')
{
    if (!in_array($type, array('float', 'integer', 'tick', 'line', 'text', 'transline', 'transtext', 'list', 'date', '?forum', 'forum', 'category', 'usergroup', 'colour'))) {
        fatal_exit('Invalid config option type');
    }
    $map = array('c_set' => 0, 'config_value' => '', 'the_name' => $name, 'human_name' => $human_name, 'the_type' => $type, 'eval' => $eval, 'the_page' => $category, 'section' => $group, 'explanation' => 'CONFIG_OPTION_' . $name, 'shared_hosting_restricted' => $shared_hosting_restricted, 'c_data' => $data);
    if ($GLOBALS['IN_MINIKERNEL_VERSION'] == 0) {
        $GLOBALS['SITE_DB']->query_insert('config', $map, false, true);
        // Allow failure in case the config option got auto-installed through searching (can happen if the option is referenced efore the module installs right)
    } else {
        $GLOBALS['SITE_DB']->query_insert('config', $map);
        // From installer we want to know if there are errors in our install cycle
    }
    if (function_exists('persistant_cache_delete')) {
        persistant_cache_delete('OPTIONS');
    }
    global $OPTIONS;
    if ($OPTIONS == array()) {
        load_options();
    } else {
        $OPTIONS[$name] = $map;
        if (multi_lang()) {
            unset($OPTIONS[$name]['config_value_translated']);
        }
    }
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:39,代码来源:database_action.php


示例2: give_award

/**
 * Give an award.
 *
 * @param  AUTO_LINK			The award ID
 * @param  ID_TEXT			The content ID
 * @param  ?TIME				Time the award was given (NULL: now)
 */
function give_award($award_id, $content_id, $time = NULL)
{
    require_lang('awards');
    if (is_null($time)) {
        $time = time();
    }
    $awards = $GLOBALS['SITE_DB']->query_select('award_types', array('*'), array('id' => $award_id), '', 1);
    if (!array_key_exists(0, $awards)) {
        warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
    }
    $award_title = get_translated_text($awards[0]['a_title']);
    log_it('GIVE_AWARD', strval($award_id), $award_title);
    require_code('hooks/systems/awards/' . filter_naughty_harsh($awards[0]['a_content_type']));
    $object = object_factory('Hook_awards_' . $awards[0]['a_content_type']);
    $info = $object->info();
    if (is_null($info)) {
        fatal_exit(do_lang_tempcode('INTERNAL_ERROR'));
    }
    if (array_key_exists('submitter_field', $info) && $awards[0]['a_content_type'] != 'author' && !is_null($info['submitter_field'])) {
        require_code('content');
        list($content_title, $member_id, , $content) = content_get_details($awards[0]['a_content_type'], $content_id);
        if (is_null($content)) {
            warn_exit(do_lang_tempcode('_MISSING_RESOURCE', escape_html($awards[0]['a_content_type'] . ':' . $content_id)));
        }
        // Lots of fiddling around to work out how to check permissions for this
        $permission_type_code = convert_ocportal_type_codes('award_hook', $awards[0]['a_content_type'], 'permissions_type_code');
        $module = convert_ocportal_type_codes('module', $awards[0]['a_content_type'], 'permissions_type_code');
        if ($module == '') {
            $module = $content_id;
        }
        $category_id = mixed();
        if (isset($info['category_field'])) {
            if (is_array($info['category_field'])) {
                $category_id = $content[$info['category_field'][1]];
            } else {
                $category_id = $content[$info['category_field']];
            }
        }
        if (has_actual_page_access($GLOBALS['FORUM_DRIVER']->get_guest_id(), 'awards') && has_actual_page_access($GLOBALS['FORUM_DRIVER']->get_guest_id(), $module) && ($permission_type_code == '' || is_null($category_id) || has_category_access($GLOBALS['FORUM_DRIVER']->get_guest_id(), $permission_type_code, is_integer($category_id) ? strval($category_id) : $category_id))) {
            syndicate_described_activity(is_null($member_id) || is_guest($member_id) ? 'awards:_ACTIVITY_GIVE_AWARD' : 'awards:ACTIVITY_GIVE_AWARD', $award_title, $content_title, '', '_SEARCH:awards:award:' . strval($award_id), '', '', 'awards', 1, NULL, false, $member_id);
        }
    } else {
        $member_id = NULL;
    }
    if (is_null($member_id)) {
        $member_id = $GLOBALS['FORUM_DRIVER']->get_guest_id();
    }
    if (!is_guest($member_id) && addon_installed('points')) {
        require_code('points2');
        system_gift_transfer(do_lang('_AWARD', get_translated_text($awards[0]['a_title'])), $awards[0]['a_points'], $member_id);
    }
    $GLOBALS['SITE_DB']->query_insert('award_archive', array('a_type_id' => $award_id, 'member_id' => $member_id, 'content_id' => $content_id, 'date_and_time' => $time));
    decache('main_awards');
    decache('main_multi_content');
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:62,代码来源:awards.php


示例3: find_lost_option

/**
 * An option has dissappeared somehow - find it via searching our code-base for it's install code. It doesn't get returned, just loaded up. This function will produce a fatal error if we cannot find it.
 *
 * @param  ID_TEXT		The name of the value
 */
function find_lost_option($name)
{
    global $OPTIONS;
    // In the dark dark past, we'd bomb out...
    if (function_exists('find_all_zones') && !defined('HIPHOP_PHP')) {
        // However times are pleasant, the grass is green, the sun high is the summer sky. Let's perform some voodoo magic...
        $all_zones = find_all_zones();
        $search = array();
        $types = array('modules_custom', 'modules');
        foreach ($all_zones as $zone) {
            foreach ($types as $type) {
                $pages = find_all_pages($zone, $type);
                foreach ($pages as $page => $type2) {
                    $search[] = zone_black_magic_filterer(get_file_base() . '/' . $zone . ($zone != '' ? '/' : '') . 'pages/' . $type2 . '/' . $page . '.php');
                }
            }
        }
        require_code('zones2');
        require_code('zones3');
        $all_blocks = find_all_blocks();
        foreach ($all_blocks as $block => $type) {
            $search[] = get_file_base() . '/' . $type . '/blocks/' . $block . '.php';
        }
        if (file_exists(get_file_base() . '/sources_custom/ocf_install.php')) {
            $search[] = get_file_base() . '/sources_custom/ocf_install.php';
        }
        $search[] = get_file_base() . '/sources/ocf_install.php';
        $matches = array();
        foreach ($search as $s) {
            //			echo $s.'<br />';
            $code = file_get_contents($s);
            if (preg_match('#add_config_option\\(\'\\w+\',\'' . str_replace('#', '\\#', preg_quote($name)) . '\',\'\\w+\',\'.+\',\'\\w+\',\'\\w+\'(,1)?\\);#', $code, $matches) > 0) {
                require_code('database_action');
                $upgrade_from = NULL;
                // In case referenced in add_config_option line
                eval($matches[0]);
                load_options();
                break;
                //				fatal_exit(do_ lang_tempcode('CONFIG_OPTION_FETCHED',escape_html($name)));	 CONFIG_OPTION_FETCHED=A config option ({1}) was missing, but has been hunted down and installed. This is an unexpected inconsistency, please refresh the page, and hopefully it has been permanently corrected.
            }
        }
    }
    if (!array_key_exists($name, $OPTIONS)) {
        fatal_exit(do_lang_tempcode('_MISSING_OPTION', escape_html($name)));
    }
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:51,代码来源:config2.php


示例4: bump_member_group_timeout

/**
 * Put a member into a usergroup temporarily / extend such a temporary usergroup membership. Note that if people are subsequently removed from the usergroup they won't be put back in; this allows the admin to essentially cancel the subscription - however, if it is then extended, they do keep the time they had before too.
 *
 * @param  MEMBER		The member going in the usergroup.
 * @param  GROUP		The usergroup.
 * @param  integer	The number of minutes (may be negative to take time away).
 * @param  boolean	Whether to put the member into as a primary group if this is a new temporary membership (it is recommended to NOT use this, since we don't track the source group and hence on expiry the member is put back to the first default group - but also generally you probably don't want to box yourself in with moving people's primary group, it ties your future flexibility down a lot).
 */
function bump_member_group_timeout($member_id, $group_id, $num_minutes, $prefer_for_primary_group = false)
{
    // We don't want guests here!
    if (is_guest($member_id)) {
        fatal_exit(do_lang_tempcode('INTERNAL_ERROR'));
    }
    require_code('ocf_groups_action');
    require_code('ocf_groups_action2');
    require_code('ocf_members');
    // Add to group if not already there
    $test = in_array($group_id, $GLOBALS['FORUM_DRIVER']->get_members_groups($member_id));
    if (!$test) {
        // Add them to the group
        if (get_value('unofficial_ecommerce') == '1' && get_forum_type() != 'ocf') {
            $GLOBALS['FORUM_DB']->add_member_to_group($member_id, $group_id);
        } else {
            if ($prefer_for_primary_group) {
                $GLOBALS[get_forum_type() == 'ocf' ? 'FORUM_DB' : 'SITE_DB']->query_update('f_members', array('m_primary_group' => $group_id), array('id' => $member_id), '', 1);
                $GLOBALS['FORUM_DRIVER']->MEMBER_ROWS_CACHED = array();
            } else {
                ocf_add_member_to_group($member_id, $group_id);
            }
        }
    }
    // Extend or add, depending on whether they're in it yet
    $existing_timeout = $GLOBALS[get_forum_type() == 'ocf' ? 'FORUM_DB' : 'SITE_DB']->query_value_null_ok('f_group_member_timeouts', 'timeout', array('member_id' => $member_id, 'group_id' => $group_id));
    if (is_null($existing_timeout)) {
        // Add
        $GLOBALS[get_forum_type() == 'ocf' ? 'FORUM_DB' : 'SITE_DB']->query_insert('f_group_member_timeouts', array('member_id' => $member_id, 'group_id' => $group_id, 'timeout' => time() + 60 * $num_minutes));
    } else {
        // Extend
        $GLOBALS[get_forum_type() == 'ocf' ? 'FORUM_DB' : 'SITE_DB']->query_update('f_group_member_timeouts', array('timeout' => $existing_timeout + 60 * $num_minutes), array('member_id' => $member_id, 'group_id' => $group_id), '', 1);
    }
    global $USERS_GROUPS_CACHE, $GROUP_MEMBERS_CACHE;
    $USERS_GROUPS_CACHE = array();
    $GROUP_MEMBERS_CACHE = array();
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:45,代码来源:group_member_timeouts.php


示例5: db_query

 /**
  * This function is a very basic query executor. It shouldn't usually be used by you, as there are abstracted versions available.
  *
  * @param  string			The complete SQL query
  * @param  array			A DB connection
  * @param  ?integer		The maximum number of rows to affect (NULL: no limit)
  * @param  ?integer		The start row to affect (NULL: no specification)
  * @param  boolean		Whether to output an error on failure
  * @param  boolean		Whether to get the autoincrement ID created for an insert query
  * @return ?mixed			The results (NULL: no results), or the insert ID
  */
 function db_query($query, $db, $max = NULL, $start = NULL, $fail_ok = false, $get_insert_id = false)
 {
     if (!is_null($max)) {
         if (is_null($start)) {
             $max += $start;
         }
         if (strtoupper(substr($query, 0, 7)) == 'SELECT ') {
             $query .= ' FETCH FIRST ' . strval($max + $start) . ' ROWS ONLY';
         }
     }
     $results = @odbc_exec($db, $query);
     if ($results === false && !$fail_ok) {
         $err = odbc_errormsg($db);
         if (function_exists('ocp_mark_as_escaped')) {
             ocp_mark_as_escaped($err);
         }
         if (!running_script('upgrader') && get_page_name() != 'admin_import') {
             if (!function_exists('do_lang') || is_null(do_lang('QUERY_FAILED', NULL, NULL, NULL, NULL, false))) {
                 fatal_exit(htmlentities('Query failed: ' . $query . ' : ' . $err));
             }
             fatal_exit(do_lang_tempcode('QUERY_FAILED', escape_html($query), $err));
         } else {
             echo htmlentities('Database query failed: ' . $query . ' [') . $err . htmlentities(']' . '<br />' . chr(10));
             return NULL;
         }
     }
     if (strtoupper(substr($query, 0, 7)) == 'SELECT ' && !$results !== false) {
         return $this->db_get_query_rows($results);
     }
     if ($get_insert_id) {
         if (strtoupper(substr($query, 0, 7)) == 'UPDATE ') {
             return NULL;
         }
         $pos = strpos($query, '(');
         $table_name = substr($query, 12, $pos - 13);
         $res2 = odbc_exec($db, 'SELECT MAX(id) FROM ' . $table_name);
         $ar2 = odbc_fetch_row($res2);
         return $ar2[0];
     }
     return NULL;
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:52,代码来源:ibm.php


示例6: do_template

/**
 * Get a tempcoded version of a normal XHTML template. It is perhaps the most common ocPortal function to load up templates using do_template, and then attach them together either as parameters to each other, or via the tempcode attach method.
 *
 * @param  ID_TEXT			The codename of the template being loaded
 * @param  ?array				A map of parameters for the template (key to value) (NULL: no parameters)
 * @param  ?LANGUAGE_NAME 	The language to load the template in (templates can embed language references) (NULL: users own language)
 * @param  boolean			Whether to not produce a stack dump if the template is missing
 * @param  ?ID_TEXT			Alternate template to use if the primary one does not exist (NULL: none)
 * @param  string				File type suffix of template file (e.g. .tpl)
 * @param  string				Subdirectory type to look in
 * @set    templates css
 * @param  ID_TEXT			Theme to use
 * @return tempcode			The tempcode for this template
 */
function do_template($codename, $parameters = NULL, $lang = NULL, $light_error = false, $fallback = NULL, $suffix = '.tpl', $type = 'templates', $theme = NULL)
{
    if (is_null($lang) || $lang == '') {
        global $USER_LANG_CACHED;
        $lang = isset($USER_LANG_CACHED) ? $USER_LANG_CACHED : (function_exists('user_lang') ? user_lang() : 'EN');
    }
    if ($GLOBALS['SEMI_DEBUG_MODE']) {
        if ($codename != 'tempcode_test' && $codename != 'handle_conflict_resolution' && strtoupper($codename) != strtoupper($codename)) {
            fatal_exit('Template names should be in upper case, and the files should be stored in upper case.');
        }
        if (substr($codename, -7) == '_SCREEN' || $codename == 'POOR_XHTML_WRAPPER' || $codename == 'OCF_WRAPPER') {
            $GLOBALS['SCREEN_TEMPLATE_CALLED'] = $codename;
        }
    }
    if (is_null($parameters)) {
        $parameters = array();
    }
    global $RECORD_TEMPLATES_USED, $FILE_ARRAY, $MEM_CACHE, $CACHE_TEMPLATES, $KEEP_MARKERS, $SHOW_EDIT_LINKS, $XHTML_SPIT_OUT, $TEMPLATE_CACHE, $MOBILE, $FORUM_DRIVER;
    $special_treatment = ($KEEP_MARKERS || $SHOW_EDIT_LINKS) && is_null($XHTML_SPIT_OUT);
    // Is it already loaded?
    if ($RECORD_TEMPLATES_USED) {
        global $RECORDED_TEMPLATES_USED;
        $RECORDED_TEMPLATES_USED[] = $codename;
    }
    // Variables we'll need
    if (!isset($theme)) {
        $theme = isset($FORUM_DRIVER) && is_object($FORUM_DRIVER) && method_exists($FORUM_DRIVER, 'get_theme') ? filter_naughty($FORUM_DRIVER->get_theme()) : 'default';
    }
    $_codename = $MOBILE ? $codename . '_mobile' : $codename;
    if (isset($TEMPLATE_CACHE[$theme][$codename][$lang])) {
        $_data = $TEMPLATE_CACHE[$theme][$codename][$lang]->bind($parameters, $codename);
        // Copy and pasted to remove need for an function call
        if ($special_treatment) {
            if ($KEEP_MARKERS) {
                $__data = make_string_tempcode('<!-- START-TEMPLATE=' . $codename . ' -->');
                $__data->attach($_data);
                $__data->attach('<!-- END-TEMPLATE=' . $codename . ' -->');
                $_data = $__data;
            }
            if ($SHOW_EDIT_LINKS) {
                $edit_url = build_url(array('page' => 'admin_themes', 'theme' => $FORUM_DRIVER->get_theme(), 'template' => $codename), 'adminzone');
                $_data->attach('<br /><a href="' . escape_html($edit_url->evaluate()) . '">' . do_lang('EDIT') . ' ' . $codename . '</a>');
            }
        }
        return $_data;
    }
    // Is it structurally cached on disk yet?
    $data = mixed();
    if ($CACHE_TEMPLATES) {
        if (!is_null($MEM_CACHE)) {
            $data = persistant_cache_get(array('TEMPLATE', $theme, $lang, $_codename));
            if (!is_null($data)) {
                $_data = new ocp_tempcode();
                $_data->from_assembly($data);
                if ($_data->bits == array()) {
                    $data = false;
                }
                // Corrupt somehow
            } else {
                $data = false;
            }
        } elseif (is_null($data)) {
            $_data = new ocp_tempcode();
            $tcp_path = get_custom_file_base() . '/themes/' . $theme . '/templates_cached/' . $lang . '/' . $_codename . $suffix . '.tcd';
            $data = @file_get_contents($tcp_path, FILE_BINARY);
            if ($data === '') {
                $data = false;
            }
            // '' needed for PHP4 - weird
            if ($data !== false) {
                $_data->from_assembly($data);
                if ($_data->bits == array()) {
                    $data = false;
                }
                // Corrupt somehow
            }
        }
    } else {
        $data = false;
    }
    if ($data === false) {
        if (!isset($FILE_ARRAY)) {
            $_data = NULL;
            $prefix_default = get_file_base() . '/themes/';
            $prefix = $theme == 'default' ? $prefix_default : get_custom_file_base() . '/themes/';
            if (file_exists($prefix . $theme . '/' . $type . '_custom/' . $_codename . $suffix)) {
//.........这里部分代码省略.........
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:tempcode__runtime.php


示例7: require_lang_compile

/**
 * Load up a language file, compiling it (it's not cached yet).
 *
 * @param  ID_TEXT			The language file name
 * @param  ?LANGUAGE_NAME	The language (NULL: uses the current language)
 * @param  ?string			The language type (lang_custom, or custom) (NULL: normal priorities are used)
 * @set    lang_custom custom
 * @param  PATH				Where we are cacheing too
 * @param  boolean			Whether to just return if there was a loading error
 * @return boolean			Whether we FAILED to load
 */
function require_lang_compile($codename, $lang, $type, $cache_path, $ignore_errors = false)
{
    global $LANGUAGE, $REQUIRE_LANG_LOOP, $LANG_LOADED_LANG;
    $desire_cache = function_exists('get_option') && (get_option('is_on_lang_cache', true) == '1' || get_param_integer('keep_cache', 0) == 1 || get_param_integer('cache', 0) == 1) && get_param_integer('keep_cache', NULL) !== 0 && get_param_integer('cache', NULL) !== 0;
    if ($desire_cache) {
        if ($GLOBALS['IN_MINIKERNEL_VERSION'] == 0) {
            global $DECACHED_COMCODE_LANG_STRINGS;
            // Cleanup language strings
            if (!$DECACHED_COMCODE_LANG_STRINGS) {
                $DECACHED_COMCODE_LANG_STRINGS = true;
                $comcode_lang_strings = $GLOBALS['SITE_DB']->query_select('cached_comcode_pages', array('string_index'), array('the_zone' => '!'), '', NULL, NULL, true);
                if (!is_null($comcode_lang_strings)) {
                    $GLOBALS['SITE_DB']->query_delete('cached_comcode_pages', array('the_zone' => '!'));
                    foreach ($comcode_lang_strings as $comcode_lang_string) {
                        delete_lang($comcode_lang_string['string_index']);
                    }
                }
            }
        }
        $load_target = array();
    } else {
        $load_target =& $LANGUAGE[$lang];
    }
    global $FILE_ARRAY;
    if (@is_array($FILE_ARRAY) && file_array_exists('lang/' . $lang . '/' . $codename . '.ini')) {
        $lang_file = 'lang/' . $lang . '/' . $codename . '.ini';
        $file = file_array_get($lang_file);
        _get_lang_file_map($file, $load_target, NULL, true);
        $bad = true;
    } else {
        $bad = true;
        $dirty = false;
        // Load originals
        $lang_file = get_file_base() . '/lang/' . $lang . '/' . filter_naughty($codename) . '.ini';
        if (file_exists($lang_file)) {
            _get_lang_file_map($lang_file, $load_target, NULL, false);
            $bad = false;
        }
        // Load overrides now if they are there
        if ($type != 'lang') {
            $lang_file = get_custom_file_base() . '/lang_custom/' . $lang . '/' . $codename . '.ini';
            if (!file_exists($lang_file) && get_file_base() != get_custom_file_base()) {
                $lang_file = get_file_base() . '/lang_custom/' . $lang . '/' . $codename . '.ini';
            }
            if (!file_exists($lang_file)) {
                $lang_file = get_custom_file_base() . '/lang_custom/' . $lang . '/' . $codename . '.po';
                if (!file_exists($lang_file)) {
                    $lang_file = get_file_base() . '/lang_custom/' . $lang . '/' . $codename . '-' . strtolower($lang) . '.po';
                }
            }
        }
        if ($type != 'lang' && file_exists($lang_file)) {
            _get_lang_file_map($lang_file, $load_target, NULL, false);
            $bad = false;
            $dirty = true;
            // Tainted from the official pack, so can't store server wide
        }
        // NB: Merge op doesn't happen in require_lang. It happens when do_lang fails and then decides it has to force a recursion to do_lang(xx,fallback_lang()) which triggers require_lang(xx,fallback_lang()) when it sees it's not loaded
        if ($bad && $lang != fallback_lang()) {
            require_lang($codename, fallback_lang(), $type, $ignore_errors);
            $REQUIRE_LANG_LOOP--;
            $fallback_cache_path = get_custom_file_base() . '/lang_cached/' . fallback_lang() . '/' . $codename . '.lcd';
            if (file_exists($fallback_cache_path)) {
                require_code('files');
                @copy($fallback_cache_path, $cache_path);
                fix_permissions($cache_path);
            }
            if (!array_key_exists($lang, $LANG_LOADED_LANG)) {
                $LANG_LOADED_LANG[$lang] = array();
            }
            $LANG_LOADED_LANG[$lang][$codename] = 1;
            return $bad;
        }
        if ($bad) {
            if ($ignore_errors) {
                return true;
            }
            if ($codename != 'critical_error' || $lang != get_site_default_lang()) {
                fatal_exit(do_lang_tempcode('MISSING_LANG_FILE', escape_html($codename), escape_html($lang)));
            } else {
                critical_error('CRIT_LANG');
            }
        }
    }
    if (is_null($GLOBALS['MEM_CACHE'])) {
        // Cache
        if ($desire_cache) {
            $file = @fopen($cache_path, 'wt');
            // Will fail if cache dir missing .. e.g. in quick installer
//.........这里部分代码省略.........
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:lang_compile.php


示例8: do_transaction

 /**
  * Perform a transaction.
  *
  * @param  ?ID_TEXT		The transaction ID (NULL: generate one)
  * @param  SHORT_TEXT	Cardholder name
  * @param  SHORT_TEXT	Card number
  * @param  SHORT_TEXT	Transaction amount
  * @param  SHORT_TEXT	Card Expiry date
  * @param  integer		Card Issue number
  * @param  SHORT_TEXT	Card Start date
  * @param  SHORT_TEXT	Card Type
  * @set    "Visa" "Master Card" "Switch" "UK Maestro" "Maestro" "Solo" "Delta" "American Express" "Diners Card" "JCB"
  * @param  SHORT_TEXT	Card CV2 number (security number)
  * @param  ?integer		The subscription length in the units. (NULL: not a subscription)
  * @param  ?ID_TEXT		The length units. (NULL: not a subscription)
  * @set    d w m y
  * @return array			A tuple: success (boolean), trans-id (string), message (string), raw message (string)
  */
 function do_transaction($trans_id, $name, $card_number, $amount, $expiry_date, $issue_number, $start_date, $card_type, $cv2, $length = NULL, $length_units = NULL)
 {
     if (is_null($trans_id)) {
         $trans_id = $this->generate_trans_id();
     }
     $username = $this->_get_username();
     $password_2 = get_option('vpn_password');
     $digest = md5($trans_id . strval($amount) . get_option('ipn_password'));
     $options = 'currency=' . get_option('currency') . ',card_type=' . str_replace(',', '', $card_type) . ',digest=' . $digest . ',cv2=' . strval(intval($cv2));
     if (ecommerce_test_mode()) {
         $options .= ',test_status=true';
     }
     if (!is_null($length)) {
         list($length_units_2, $first_repeat) = $this->_translate_subscription_details($length, $length_units);
         $options .= ',repeat=' . $first_repeat . '/' . $length_units_2 . '/0/' . $amount;
     }
     require_lang('ecommerce');
     require_code('xmlrpc');
     $result = xml_rpc('https://www.secpay.com:443/secxmlrpc/make_call', 'SECVPN.validateCardFull', array($username, $password_2, $trans_id, get_ip_address(), $name, $card_number, $amount, $expiry_date, $issue_number, $start_date, '', '', '', $options));
     $pos_1 = strpos($result, '<value>');
     if ($pos_1 === false) {
         fatal_exit(do_lang('INTERNAL_ERROR'));
     }
     $pos_2 = strpos($result, '</value>');
     $value = @html_entity_decode(trim(substr($result, $pos_1 + 7, $pos_2 - $pos_1 - 7)), ENT_QUOTES, get_charset());
     if (substr($value, 0, 1) == '?') {
         $value = substr($value, 1);
     }
     $_map = explode('&', $value);
     $map = array();
     foreach ($_map as $x) {
         $explode = explode('=', $x);
         if (count($explode) == 2) {
             $map[$explode[0]] = $explode[1];
         }
     }
     $success = array_key_exists('code', $map) && ($map['code'] == 'A' || $map['code'] == 'P:P');
     $message_raw = array_key_exists('message', $map) ? $map['message'] : '';
     $message = $success ? do_lang('ACCEPTED_MESSAGE', $message_raw) : do_lang('DECLINED_MESSAGE', $message_raw);
     $purchase_id = post_param_integer('customfld1', '-1');
     if (addon_installed('shopping')) {
         $this->store_shipping_address($purchase_id);
     }
     return array($success, $trans_id, $message, $message_raw);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:63,代码来源:secpay.php


示例9: calculate_dynamic_css_colours

/**
 * Augment an array of CSS colours with colours that are derived actually inside the CSS-sheets.
 *
 * @param  array		Map of colours.
 * @param  ID_TEXT	The theme it's being generated from
 * @return array		A pair: extended map of colours, colour expression landscape
 */
function calculate_dynamic_css_colours($colours, $source_theme)
{
    $theme = filter_naughty($source_theme);
    $css_dir = $theme == 'default' ? 'css' : 'css_custom';
    $dh = opendir(get_file_base() . '/themes/' . $theme . '/' . $css_dir . '/');
    require_lang('themes');
    // First we build up our landscape
    $landscape = array();
    while (($sheet = readdir($dh)) !== false) {
        if (substr($sheet, -4) == '.css') {
            $path = get_file_base() . '/themes/' . $theme . '/' . $css_dir . '/' . $sheet;
            $contents = unixify_line_format(file_get_contents($path, FILE_TEXT));
            $matches = array();
            $num_matches = preg_match_all('#/\\* *\\{\\$,([^,\\n\\r\\$\']*),([^}{\\n\\r\\$\']*)\\}#', $contents, $matches);
            for ($i = 0; $i < $num_matches; $i++) {
                $parsed = parse_css_colour_expression($matches[2][$i]);
                if (!is_null($parsed)) {
                    //					  Colour name	  Parsed expression									 Full match string	 Final colour
                    $landscape[] = array($matches[1][$i], $parsed, substr($matches[0][$i], 6, strlen($matches[0][$i]) - 7), NULL);
                }
            }
        }
    }
    // Then we resolve our expressions
    $resolved_landscaped = array();
    $safety_count = 0;
    while (count($landscape) != 0) {
        foreach ($landscape as $i => $peak) {
            $peak[3] = execute_css_colour_expression($peak[1], $colours);
            if (!is_null($peak[3])) {
                $resolved_landscaped[] = $peak;
                unset($landscape[$i]);
                // Then we add to the colours array
                if ($peak[0] != 'wizard') {
                    $colours[$peak[0]] = $peak[3];
                }
            }
        }
        $safety_count++;
        if ($safety_count == 100) {
            $_landscape = '';
            foreach ($landscape as $x) {
                if ($_landscape != '') {
                    $_landscape .= '; ';
                }
                $_landscape .= $x[2];
            }
            fatal_exit(do_lang_tempcode('UNRESOLVABLE_COLOURS', escape_html($_landscape)));
        }
    }
    return array($colours, $resolved_landscaped);
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:59,代码来源:themewizard.php


示例10: comcode_breadcrumbs

/**
 * Get a UI element of a route from a known Comcode page back to the declared root of the tree.
 *
 * @param  ID_TEXT		The Comcode page name
 * @param  ID_TEXT		The Comcode page zone
 * @param  ID_TEXT		The virtual root
 * @param  boolean		Whether not to put a link at this point in the navigation tree (usually, because the viewer is already at it)
 * @param  integer		The number of jumps we have gone through so far (cuts out after 10 as a failsafe)
 * @return tempcode		The navigation element
 */
function comcode_breadcrumbs($the_page, $the_zone, $root = '', $no_link_for_me_sir = true, $jumps = 0)
{
    if ($jumps == 10) {
        return new ocp_tempcode();
    }
    $map = array('page' => $the_page);
    if ($jumps == 0) {
        $map['root'] = $the_page;
    } elseif ($root != '') {
        $map['root'] = $root;
    }
    $url = build_url($map, $the_zone);
    if ($the_page == '') {
        return new ocp_tempcode();
    }
    if ($the_page == $root) {
        if ($no_link_for_me_sir) {
            return new ocp_tempcode();
        }
        $_title = $GLOBALS['SITE_DB']->query_value_null_ok('cached_comcode_pages', 'cc_page_title', array('the_page' => $the_page, 'the_zone' => $the_zone));
        $title = NULL;
        if ($_title !== NULL) {
            $title = get_translated_text($_title, NULL, NULL, true);
        }
        if ($_title === NULL) {
            $title = escape_html($the_page);
        }
        return hyperlink($url, $title, false, false, do_lang_tempcode('GO_BACKWARDS_TO', @html_entity_decode(strip_tags($title), ENT_QUOTES, get_charset())), NULL, NULL, 'up');
    }
    global $PT_PAIR_CACHE_CP;
    if (!array_key_exists($the_page, $PT_PAIR_CACHE_CP)) {
        $page_rows = $GLOBALS['SITE_DB']->query_select('cached_comcode_pages a JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'comcode_pages b ON (a.the_page=b.the_page AND a.the_zone=b.the_zone)', array('cc_page_title', 'p_parent_page', 'string_index'), array('a.the_page' => $the_page, 'a.the_zone' => $the_zone), '', 1, NULL, false, array('string_index', 'cc_page_title'));
        if (!array_key_exists(0, $page_rows)) {
            request_page($the_page, false, $the_zone, NULL, true);
            // It's not cached, force the issue and then try again...
            $page_rows = $GLOBALS['SITE_DB']->query_select('cached_comcode_pages a JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'comcode_pages b ON (a.the_page=b.the_page AND a.the_zone=b.the_zone)', array('cc_page_title', 'p_parent_page', 'string_index'), array('a.the_page' => $the_page, 'a.the_zone' => $the_zone), '', 1, NULL, false, array('string_index', 'cc_page_title'));
            if (!array_key_exists(0, $page_rows)) {
                $_title = $the_page;
                $PT_PAIR_CACHE_CP[$the_page] = array();
                $PT_PAIR_CACHE_CP[$the_page]['cc_page_title'] = escape_html($_title);
                $PT_PAIR_CACHE_CP[$the_page]['p_parent_page'] = NULL;
            }
        }
        if (array_key_exists(0, $page_rows)) {
            $PT_PAIR_CACHE_CP[$the_page] = $page_rows[0];
            $_title = get_translated_text($PT_PAIR_CACHE_CP[$the_page]['cc_page_title'], NULL, NULL, true);
            if ($_title === NULL) {
                $_title = $the_page;
            }
            $PT_PAIR_CACHE_CP[$the_page]['cc_page_title'] = $_title;
        }
    }
    $title = $PT_PAIR_CACHE_CP[$the_page]['cc_page_title'];
    if ($title === NULL) {
        $title = $the_page;
    }
    if (!$no_link_for_me_sir) {
        $tpl_url = $PT_PAIR_CACHE_CP[$the_page]['p_parent_page'] == '' ? new ocp_tempcode() : do_template('BREADCRUMB_ESCAPED');
        $_title = is_object($title) ? $title->evaluate() : $title;
        $tooltip = $jumps == 0 ? do_lang_tempcode('VIRTUAL_ROOT') : do_lang_tempcode('GO_BACKWARDS_TO', @html_entity_decode(strip_tags($_title), ENT_QUOTES, get_charset()));
        $title = symbol_truncator(array($_title, BREADCRUMB_CROP_LENGTH, '1', '1'), 'spread', $tooltip);
        $tpl_url->attach(hyperlink($url, $title, false, false, strlen($_title) > BREADCRUMB_CROP_LENGTH ? new ocp_tempcode() : $tooltip, NULL, NULL, 'up'));
    } else {
        $tpl_url = new ocp_tempcode();
        if ($jumps == 0) {
            $tpl_url = $PT_PAIR_CACHE_CP[$the_page]['p_parent_page'] == '' ? new ocp_tempcode() : do_template('BREADCRUMB_ESCAPED');
            $_title = is_object($title) ? $title->evaluate() : $title;
            if ($_title != '') {
                $tpl_url->attach('<span>' . $_title . '</span>');
            }
        }
    }
    if ($PT_PAIR_CACHE_CP[$the_page]['p_parent_page'] == $the_page) {
        fatal_exit(do_lang_tempcode('RECURSIVE_TREE_CHAIN', escape_html($the_page)));
    }
    $below = comcode_breadcrumbs($PT_PAIR_CACHE_CP[$the_page]['p_parent_page'], $the_zone, $root, false, $jumps + 1);
    $below->attach($tpl_url);
    return $below;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:89,代码来源:site.php


示例11: occle_script

/**
 * OcCLE entry script.
 */
function occle_script()
{
    $cli = php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR']);
    // Closed site
    if (!$cli) {
        $site_closed = get_option('site_closed');
        if ($site_closed == '1' && !has_specific_permission(get_member(), 'access_closed_site') && !$GLOBALS['IS_ACTUALLY_ADMIN']) {
            header('Content-Type: text/plain');
            @exit(get_option('closed'));
        }
        if (get_file_base() != get_custom_file_base()) {
            warn_exit(do_lang_tempcode('SHARED_INSTALL_PROHIBIT'));
        }
        if (!has_actual_page_access(get_member(), 'admin_occle')) {
            fatal_exit(do_lang_tempcode('ACCESS_DENIED__PAGE_ACCESS', escape_html($GLOBALS['FORUM_DRIVER']->get_username(get_member()))));
        }
    }
    // Check the action
    convert_data_encodings(true);
    $action = get_param('action', 'occle');
    if ($action == 'message') {
        // We're receiving an OcCLEchat message
        $url = get_param('base_url') . '/data/occle.php?action=confirm&message=' . urlencode(get_param('message'));
        $return = http_download_file($url, NULL, false);
        if ($return == '1') {
            if (ocp_srv('HTTP_USER_AGENT') == 'ocPortal') {
                $GLOBALS['SITE_DB']->query_insert('occlechat', array('c_message' => get_param('message'), 'c_url' => get_param('base_url'), 'c_incoming' => 1, 'c_timestamp' => time()));
                echo '1';
            } else {
                echo '0';
            }
        } else {
            echo '0';
        }
    } elseif ($action == 'confirm') {
        // We're confirming a received message
        if (ocp_srv('HTTP_USER_AGENT') == 'ocPortal') {
            $results = $GLOBALS['SITE_DB']->query_value_null_ok('occlechat', 'COUNT(*)', array('c_message' => get_param('message'), 'c_incoming' => false));
            if (!is_null($results)) {
                echo '1';
            } else {
                echo '0';
            }
        } else {
            echo '0';
        }
    } else {
        // Executing a command from the command-line
        $command = post_param('command', $cli ? NULL : false);
        if (is_null($command)) {
            require_code('comcode_from_html');
            require_code('mail');
            $stdin = @fopen('php://stdin', 'rt');
            $stderr = @fopen('php://stderr', 'wt');
            $stdout = @fopen('php://stdout', 'wt');
            while (true) {
                fwrite($stdout, "\n> ");
                $command = fgets($stdin, 102400);
                if (trim($command) == 'exit') {
                    break;
                }
                $temp = new virtual_bash(trim($command));
                if (trim($temp->output[STREAM_STDHTML]) != '') {
                    fwrite($stdout, trim(comcode_to_clean_text(semihtml_to_comcode(preg_replace('#<(\\w+) [^<>]*>#', '<${1}>', $temp->output[STREAM_STDHTML])))));
                }
                if (trim($temp->output[STREAM_STDOUT]) != '') {
                    fwrite($stdout, trim($temp->output[STREAM_STDOUT]));
                }
                if (trim($temp->output[STREAM_STDERR]) != '') {
                    fwrite($stderr, trim($temp->output[STREAM_STDERR]));
                }
            }
            fclose($stdin);
            fclose($stderr);
            fclose($stdout);
        } else {
            $temp = new virtual_bash(trim($command));
            $temp->output_xml();
        }
        if (get_option('occle_chat_announce') == '1') {
            http_download_file('http://ocportal.com/data_custom/occle.php?title=' . urlencode(get_site_name()) . '&url=' . urlencode(get_custom_base_url()), NULL, false, true);
        }
    }
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:87,代码来源:occle.php


示例12: banners_script

/**
 * Show a banner according to GET parameter specification.
 *
 * @param  boolean		Whether to return a result rather than outputting
 * @param  ?string		Whether we are displaying or click-processing (NULL: get from URL param)
 * @set    "click" ""
 * @param  ?string		Specific banner to display (NULL: get from URL param) (blank: randomise)
 * @param  ?string		Banner type to display (NULL: get from URL param)
 * @param  ?integer		Whether we are only showing our own banners, rather than allowing external rotation ones (NULL: get from URL param)
 * @param  ?string		The banner advertisor who is actively displaying the banner (calling up this function) and hence is rewarded (NULL: get from URL param) (blank: our own site)
 * @return ?tempcode		Result (NULL: we weren't asked to return the result)
 */
function banners_script($ret = false, $type = NULL, $dest = NULL, $b_type = NULL, $internal_only = NULL, $source = NULL)
{
    require_code('images');
    require_lang('banners');
    // If this is being called for a click through
    if (is_null($type)) {
        $type = get_param('type', '');
    }
    if ($type == 'click') {
        // Input parameters
        if (is_null($source)) {
            $source = get_param('source', '');
        }
        if (is_null($dest)) {
            $dest = get_param('dest', '');
        }
        // Has the banner been clicked before?
        $test = $GLOBALS['SITE_DB']->query_value('banner_clicks', 'MAX(c_date_and_time)', array('c_ip_address' => get_ip_address(), 'c_banner_id' => $dest));
        $unique = is_null($test) || $test < time() - 60 * 60 * 24;
        // Find the information about the dest
        $rows = $GLOBALS['SITE_DB']->query_select('banners', array('site_url', 'hits_to', 'campaign_remaining'), array('name' => $dest));
        if (!array_key_exists(0, $rows)) {
            fatal_exit(do_lang_tempcode('MISSING_RESOURCE'));
        }
        $myrow = $rows[0];
        $url = $myrow['site_url'];
        $page_link = url_to_pagelink($url);
        if ($page_link != '') {
            $keep = symbol_tempcode('KEEP', array(strpos($url, '?') === false ? '1' : '0'));
            $url .= $keep->evaluate();
        }
        if ($unique) {
            if (get_db_type() != 'xml') {
                $GLOBALS['SITE_DB']->query('UPDATE ' . get_table_prefix() . 'banners SET hits_to=(hits_to+1) WHERE ' . db_string_equal_to('name', $dest), 1);
            }
            $campaignremaining = $myrow['campaign_remaining'];
            if (!is_null($campaignremaining)) {
                if (get_db_type() != 'xml') {
                    $GLOBALS['SITE_DB']->query('UPDATE ' . get_table_prefix() . 'banners SET campaign_remaining=(campaign_remaining-1) WHERE ' . db_string_equal_to('name', $dest), 1);
                }
            }
        }
        // Find the information about the source
        if ($source != '' && $unique) {
            $rows = $GLOBALS['SITE_DB']->query_select('banners', array('hits_from', 'campaign_remaining'), array('name' => $source));
            if (!array_key_exists(0, $rows)) {
                fatal_exit(do_lang_tempcode('BANNER_MISSING_SOURCE'));
            }
            $myrow = $rows[0];
            if (get_db_type() != 'xml') {
                $GLOBALS['SITE_DB']->query('UPDATE ' . get_table_prefix() . 'banners SET hits_from=(hits_from+1) WHERE ' . db_string_equal_to('name', $source), 1);
            }
            $campaignremaining = $myrow['campaign_remaining'];
            if (!is_null($campaignremaining)) {
                if (get_db_type() != 'xml') {
                    $GLOBALS['SITE_DB']->query('UPDATE ' . get_table_prefix() . 'banners SET campaign_remaining=(campaign_remaining+1) WHERE ' . db_string_equal_to('name', $source), 1);
                }
            }
        }
        // Log the click
        load_user_stuff();
        $GLOBALS['SITE_DB']->query_insert('banner_clicks', array('c_date_and_time' => time(), 'c_member_id' => get_member(), 'c_ip_address' => get_ip_address(), 'c_source' => $source, 'c_banner_id' => $dest));
        if (strpos($url, chr(10)) !== false || strpos($url, chr(13)) !== false) {
            log_hack_attack_and_exit('HEADER_SPLIT_HACK');
        }
        header('Location: ' . $url);
    } else {
        if (is_null($dest)) {
            $dest = get_param('dest', '');
        }
        if (is_null($b_type)) {
            $b_type = get_param('b_type', '');
        }
        if (is_null($internal_only)) {
            $internal_only = get_param_integer('internal_only', 0);
        }
        if ($internal_only == 0 && $dest == '' && $b_type == '') {
            $adcode = get_option('money_ad_code');
            if ($adcode != '' && (0 == $GLOBALS['SITE_DB']->query_value('banners', 'COUNT(*)', array('validated' => 1)) || mt_rand(0, 100) > intval(get_option('advert_chance')))) {
                if ($ret) {
                    return make_string_tempcode($adcode);
                }
                $echo = do_template('BASIC_HTML_WRAP', array('_GUID' => 'fd6fc24384dd13e7931ceb369a500672', 'TITLE' => do_lang_tempcode('BANNER'), 'CONTENT' => $adcode));
                $echo->evaluate_echo();
                return NULL;
            }
        }
        // A community banner then...
//.........这里部分代码省略.........
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:banners.php


示例13: run

 /**
  * Standard modular run function for CRON hooks. Searches for tasks to perform.
  */
 function run()
 {
     //if (!running_script('execute_temp')) return;
     $time_now = time();
     //$time_now=1335726076;
     $last_cron_time = intval(get_value('last_welcome_mail_time'));
     if ($last_cron_time == 0) {
         $last_cron_time = $time_now - 24 * 60 * 60 * 7;
     }
     set_value('last_welcome_mail_time', strval($time_now));
     //$last_cron_time=$time_now-60*60*1;
     require_code('mail');
     $GLOBALS['NO_DB_SCOPE_CHECK'] = true;
     $mails = $GLOBALS['SITE_DB']->query_select('f_welcome_emails', array('*'));
     $GLOBALS['NO_DB_SCOPE_CHECK'] = false;
     foreach ($mails as $mail) {
         $send_seconds_after_joining = $mail['w_send_time'] * 60 * 60;
         $newsletter_style = get_value('welcome_nw_choice') === '1' && !is_null($mail['w_newsletter']) || get_value('welcome_nw_choice') !== '1' && ($mail['w_newsletter'] == 1 || get_forum_type() != 'ocf');
         if ($newsletter_style) {
             if (addon_installed('newsletter')) {
                 // Think of it like this, m_join_time (members join time) must between $last_cron_time and $time_now, but offset back by $send_seconds_after_joining
                 $where = ' WHERE join_time>' . strval($last_cron_time - $send_seconds_after_joining) . ' AND join_time<=' . strval($time_now - $send_seconds_after_joining) . ' AND (the_level=3 OR the_level=4)';
                 if (get_value('welcome_nw_choice') === '1') {
                     $where .= ' AND newsletter_id=' . strval($mail['w_newsletter']);
                 }
                 $members = $GLOBALS['SITE_DB']->query('SELECT s.email AS m_email_address,the_password,n_forename,n_surname,n.id,join_time AS m_join_time FROM ' . get_table_prefix() . 'newsletter_subscribe s JOIN ' . get_table_prefix() . 'newsletter n ON n.email=s.email ' . $where . ' GROUP BY s.email');
             } else {
                 $members = array();
             }
         } el 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP fatal_lang_error函数代码示例发布时间:2022-05-15
下一篇:
PHP fatal_error函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap