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

PHP warn_exit函数代码示例

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

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



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

示例1: rules_script

/**
 * Pop-up some rules.
 */
function rules_script()
{
    $id = get_param_integer('id', NULL);
    if (is_null($id)) {
        require_code('site');
        $output = request_page('rules', true);
        $title = do_lang_tempcode('RULES');
    } else {
        if (!has_category_access(get_member(), 'forums', strval($id))) {
            warn_exit(do_lang_tempcode('ACCESS_DENIED'));
        }
        $forum_rows = $GLOBALS['FORUM_DB']->query_select('f_forums', array('*'), array('id' => $id), '', 1);
        if (!array_key_exists(0, $forum_rows)) {
            warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
        }
        $forum_row = $forum_rows[0];
        require_lang('ocf');
        $question = get_translated_tempcode($forum_row['f_intro_question'], $GLOBALS['FORUM_DB']);
        $answer = $forum_row['f_intro_answer'];
        $output = do_template('OCF_FORUM_INTRO_QUESTION_POPUP', array('_GUID' => '6f2dc12b616219ff982654b73ef979b2', 'QUESTION' => $question, 'ANSWER' => $answer));
        $title = $answer == '' ? do_lang_tempcode('FORUM_RULES') : do_lang_tempcode('INTRO_QUESTION');
    }
    $tpl = do_template('POPUP_HTML_WRAP', array('_GUID' => '26c4dbc7a4737310f089583f1048cb13', 'TITLE' => $title, 'TARGET' => '_top', 'CONTENT' => $output));
    $tpl->evaluate_echo();
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:28,代码来源:ocf_popups.php


示例2: run

 /**
  * Standard modular run function for award hooks. Renders a content box for an award/randomisation.
  *
  * @param  array		The database row for the content
  * @param  ID_TEXT	The zone to display in
  * @return tempcode	Results
  */
 function run($row, $zone)
 {
     $url = build_url(array('page' => 'news', 'type' => 'view', 'id' => $row['id']), $zone);
     $title = get_translated_tempcode($row['title']);
     $title_plain = get_translated_text($row['title']);
     $news_cat_rows = $GLOBALS['SITE_DB']->query_select('news_categories', array('nc_title', 'nc_img'), array('id' => $row['news_category']), '', 1);
     if (!array_key_exists(0, $news_cat_rows)) {
         warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
     }
     $news_cat_row = $news_cat_rows[0];
     $category = get_translated_text($news_cat_row['nc_title']);
     $img = find_theme_image($news_cat_row['nc_img']);
     if ($row['news_image'] != '') {
         $img = $row['news_image'];
         if (url_is_local($img)) {
             $img = get_base_url() . '/' . $img;
         }
     }
     $news = get_translated_tempcode($row['news']);
     if ($news->is_empty()) {
         $news = get_translated_tempcode($row['news_article']);
         $truncate = true;
     } else {
         $truncate = false;
     }
     $author_url = addon_installed('authors') ? build_url(array('page' => 'authors', 'type' => 'misc', 'id' => $row['author']), get_module_zone('authors')) : new ocp_tempcode();
     $author = $row['author'];
     require_css('news');
     $seo_bits = seo_meta_get_for('news', strval($row['id']));
     $map = array('_GUID' => 'jd89f893jlkj9832gr3uyg2u', 'TAGS' => get_loaded_tags('news', explode(',', $seo_bits[0])), 'TRUNCATE' => $truncate, 'AUTHOR' => $author, 'BLOG' => false, 'AUTHOR_URL' => $author_url, 'CATEGORY' => $category, 'IMG' => $img, 'NEWS' => $news, 'ID' => strval($row['id']), 'SUBMITTER' => strval($row['submitter']), 'DATE' => get_timezoned_date($row['date_and_time']), 'DATE_RAW' => strval($row['date_and_time']), 'FULL_URL' => $url, 'NEWS_TITLE' => $title, 'NEWS_TITLE_PLAIN' => $title_plain);
     if (get_option('is_on_comments') == '1' && !has_no_forum() && $row['allow_comments'] >= 1) {
         $map['COMMENT_COUNT'] = '1';
     }
     return put_in_standard_box(do_template('NEWS_PIECE_SUMMARY', $map));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:42,代码来源:news.php


示例3: ocf_may_attach_poll

/**
 * Find whether a member may attach a poll to a detailed topic.
 *
 * @param  AUTO_LINK The topic.
 * @param  ?MEMBER	The topic owner (NULL: ask the DB for it).
 * @param  ?boolean  Whether the topic already has a poll (NULL: ask the DB for it).
 * @param  ?MEMBER	The forum the topic is in (NULL: ask the DB for it).
 * @param  ?MEMBER	The member we are checking for (NULL: current member).
 * @return boolean	The answer.
 */
function ocf_may_attach_poll($topic_id, $topic_owner = NULL, $has_poll_already = NULL, $forum_id = NULL, $member_id = NULL)
{
    if (is_null($topic_owner)) {
        $topic_info = $GLOBALS['FORUM_DB']->query_select('f_topics', array('*'), array('id' => $topic_id), '', 1);
        if (!array_key_exists(0, $topic_info)) {
            warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
        }
        $topic_owner = $topic_info[0]['t_cache_first_member_id'];
        $has_poll_already = !is_null($topic_info[0]['t_poll_id']);
        $forum_id = $topic_info[0]['t_forum_id'];
    }
    if (is_null($member_id)) {
        $member_id = get_member();
    }
    if ($has_poll_already) {
        return false;
    }
    if ($topic_owner == $member_id && !is_guest($member_id)) {
        return true;
    }
    if (ocf_may_moderate_forum($forum_id, $member_id)) {
        return true;
    }
    return false;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:35,代码来源:ocf_polls.php


示例4: make_functions_dat

/**
 * Make the functions.dat file
 */
function make_functions_dat()
{
    $files = make_functions_dat_do_dir(get_custom_file_base());
    $classes = array();
    $global = array();
    foreach ($files as $filename) {
        if (strpos($filename, '_custom') !== false) {
            continue;
        }
        $_filename = substr($filename, strlen(get_custom_file_base()) + 1);
        if ($_filename == 'sources/minikernel.php') {
            continue;
        }
        $result = get_php_file_api($_filename, false);
        foreach ($result as $i => $r) {
            if ($r['name'] == '__global') {
                $global = array_merge($global, $r['functions']);
                unset($result[$i]);
            }
        }
        $classes = array_merge($classes, $result);
    }
    $classes['__global'] = array('functions' => $global);
    $myfile = @fopen(get_custom_file_base() . '/data_custom/functions.dat', 'wt') or intelligent_write_error(get_custom_file_base() . '/data_custom/functions.dat');
    if (fwrite($myfile, serialize($classes)) == 0) {
        warn_exit(do_lang_tempcode('COULD_NOT_SAVE_FILE'));
    }
    fclose($myfile);
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:32,代码来源:find_function.php


示例5: run

 /**
  * Standard modular run function.
  *
  * @return tempcode	The result of execution.
  */
 function run()
 {
     require_lang('leader_board');
     require_code('points');
     require_css('points');
     $title = get_page_title('POINT_LEADERBOARD');
     $start_date = intval(get_option('leaderboard_start_date'));
     $weeks = $GLOBALS['SITE_DB']->query('SELECT DISTINCT date_and_time FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'leader_board WHERE date_and_time>=' . strval($start_date) . ' ORDER BY date_and_time DESC');
     if (count($weeks) == 0) {
         warn_exit(do_lang_tempcode('NO_ENTRIES'));
     }
     $first_week = $weeks[count($weeks) - 1]['date_and_time'];
     $weeks = collapse_1d_complexity('date_and_time', $weeks);
     $out = new ocp_tempcode();
     foreach ($weeks as $week) {
         $rows = collapse_2d_complexity('lb_member', 'lb_points', $GLOBALS['SITE_DB']->query_select('leader_board', array('lb_member', 'lb_points'), array('date_and_time' => $week)));
         $week_tpl = new ocp_tempcode();
         foreach ($rows as $member => $points) {
             $points_url = build_url(array('page' => 'points', 'type' => 'member', 'id' => $member), get_module_zone('points'));
             $profile_url = $GLOBALS['FORUM_DRIVER']->member_profile_url($member, false, true);
             $name = $GLOBALS['FORUM_DRIVER']->get_username($member);
             if (is_null($name)) {
                 $name = do_lang('UNKNOWN');
             }
             $week_tpl->attach(do_template('POINTS_LEADERBOARD_ROW', array('_GUID' => '6d323b4b5abea0e82a14cb4745c4af4f', 'POINTS_URL' => $points_url, 'PROFILE_URL' => $profile_url, 'POINTS' => integer_format($points), 'NAME' => $name, 'ID' => strval($member))));
         }
         $nice_week = intval(($week - $first_week) / (7 * 24 * 60 * 60) + 1);
         $out->attach(do_template('POINTS_LEADERBOARD_WEEK', array('_GUID' => '3a0f71bf20f9098e5711e85cf25f6549', 'WEEK' => integer_format($nice_week), 'ROWS' => $week_tpl)));
     }
     return do_template('POINTS_LEADERBOARD_SCREEN', array('_GUID' => 'bab5f7b661435b83800532d3eebd0d54', 'TITLE' => $title, 'WEEKS' => $out));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:36,代码来源:leader_board.php


示例6: action_done

 /**
  * Standard actualisation stage of pointstore item purchase.
  *
  * @return tempcode		The UI
  */
 function action_done()
 {
     $class = str_replace('hook_pointstore_', '', strtolower(get_class($this)));
     if (get_option('is_on_' . $class . '_buy') == '0' || get_forum_type() != 'ocf') {
         return new ocp_tempcode();
     }
     if ($GLOBALS['FORUM_DRIVER']->get_member_row_field(get_member(), 'm_highlighted_name') == 1) {
         warn_exit(do_lang_tempcode('_ALREADY_HAVE'));
     }
     $title = get_page_title('NAME_HIGHLIGHTING');
     post_param_integer('confirm');
     // To make sure we're not being passed by a GET
     // Check points
     $cost = intval(get_option($class));
     $points_left = available_points(get_member());
     if ($points_left < $cost && !has_specific_permission(get_member(), 'give_points_self')) {
         return warn_screen($title, do_lang_tempcode('_CANT_AFFORD', integer_format($cost), integer_format($points_left)));
     }
     // Actuate
     $GLOBALS['FORUM_DB']->query_update('f_members', array('m_highlighted_name' => 1), array('id' => get_member()), '', 1);
     require_code('points2');
     charge_member(get_member(), $cost, do_lang('NAME_HIGHLIGHTING'));
     $GLOBALS['SITE_DB']->query_insert('sales', array('date_and_time' => time(), 'memberid' => get_member(), 'purchasetype' => 'NAME_HIGHLIGHTING', 'details' => '', 'details2' => ''));
     // Show message
     $url = build_url(array('page' => '_SELF', 'type' => 'misc'), '_SELF');
     return redirect_screen($title, $url, do_lang_tempcode('ORDER_GENERAL_DONE'));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:32,代码来源:highlight_name.php


示例7: run

 /**
  * Standard modular run function for preview hooks.
  *
  * @return array			A pair: The preview, the updated post Comcode
  */
 function run()
 {
     require_code('uploads');
     $urls = get_url('', 'file', 'uploads/iotds', 0, OCP_UPLOAD_IMAGE, true, '', 'file2');
     if ($urls[0] == '') {
         if (!is_null(post_param_integer('id', NULL))) {
             $rows = $GLOBALS['SITE_DB']->query_select('iotds', array('url', 'thumb_url'), array('id' => post_param_integer('id')), '', 1);
             $urls = $rows[0];
             $url = $urls['url'];
             $thumb_url = $urls['thumb_url'];
         } else {
             warn_exit(do_lang_tempcode('IMPROPERLY_FILLED_IN_UPLOAD'));
         }
     } else {
         $url = $urls[0];
         $thumb_url = $urls[1];
     }
     $caption = comcode_to_tempcode(post_param('caption', ''));
     $title = comcode_to_tempcode(post_param('title', ''));
     require_code('images');
     $thumb = do_image_thumb(url_is_local($thumb_url) ? get_custom_base_url() . '/' . $thumb_url : $thumb_url, $caption, true);
     $url = url_is_local($url) ? get_custom_base_url() . '/' . $url : $url;
     $preview = do_template('IOTD', array('ID' => '', 'IMAGE_URL' => $url, 'SUBMITTER' => strval(get_member()), 'VIEW_URL' => $url, 'IMAGE' => $thumb, 'CAPTION' => $title));
     return array($preview, NULL);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:30,代码来源:iotd.php


示例8: render_tab

 /**
  * Standard modular render function for profile tabs edit hooks.
  *
  * @param  MEMBER			The ID of the member who is being viewed
  * @param  MEMBER			The ID of the member who is doing the viewing
  * @param  boolean		Whether to leave the tab contents NULL, if tis hook supports it, so that AJAX can load it later
  * @return ?array			A tuple: The tab title, the tab body text (may be blank), the tab fields, extra Javascript (may be blank) the suggested tab order, hidden fields (optional) (NULL: if $leave_to_ajax_if_possible was set)
  */
 function render_tab($member_id_of, $member_id_viewing, $leave_to_ajax_if_possible = false)
 {
     $title = do_lang_tempcode('DELETE_MEMBER');
     $order = 200;
     // Actualiser
     $delete_account = post_param_integer('delete', 0);
     if ($delete_account == 1) {
         if (is_guest($member_id_of)) {
             warn_exit(do_lang_tempcode('INTERNAL_ERROR'));
         }
         ocf_delete_member($member_id_of);
         inform_exit(do_lang_tempcode('SUCCESS'));
     }
     if ($leave_to_ajax_if_possible) {
         return NULL;
     }
     // UI fields
     $username = $GLOBALS['FORUM_DRIVER']->get_username($member_id_of);
     $text = do_lang_tempcode('_DELETE_MEMBER' . ($member_id_of == get_member() ? '_SUICIDAL' : ''), escape_html($username));
     $fields = new ocp_tempcode();
     require_code('form_templates');
     $fields->attach(form_input_tick(do_lang_tempcode('DELETE'), do_lang_tempcode('DESCRIPTION_DELETE'), 'delete', false));
     $javascript = '';
     return array($title, $fields, $text, $javascript, $order);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:33,代码来源:delete.php


示例9: sitemaps_build

/**
 * Top level function to (re)generate a Sitemap (xml file, Google-style).
 */
function sitemaps_build()
{
    $GLOBALS['NO_QUERY_LIMIT'] = true;
    $path = get_custom_file_base() . '/ocp_sitemap.xml';
    if (!file_exists($path)) {
        if (!is_writable_wrap(dirname($path))) {
            warn_exit(do_lang_tempcode('WRITE_ERROR_CREATE', escape_html('/')));
        }
    } else {
        if (!is_writable_wrap($path)) {
            warn_exit(do_lang_tempcode('WRITE_ERROR', escape_html('ocp_sitemap.xml')));
        }
    }
    // Runs via a callback mechanism, so we don't need to load an arbitrary complex structure into memory.
    sitemaps_xml_initialise($path);
    spawn_page_crawl('pagelink_to_sitemapsxml', $GLOBALS['FORUM_DRIVER']->get_guest_id(), NULL, DEPTH__ENTRIES);
    sitemaps_xml_finished();
    // Ping search engines
    if (get_option('auto_submit_sitemap') == '1') {
        $ping = true;
        $base_url = get_base_url();
        $not_local = substr($base_url, 0, 16) != 'http://localhost' && substr($base_url, 0, 16) != 'http://127.0.0.1' && substr($base_url, 0, 15) != 'http://192.168.' && substr($base_url, 0, 10) != 'http://10.';
        if ($ping && get_option('site_closed') == '0' && $not_local) {
            // Submit to search engines
            $services = array('http://www.google.com/webmasters/tools/ping?sitemap=', 'http://submissions.ask.com/ping?sitemap=', 'http://www.bing.com/webmaster/ping.aspx?siteMap=', 'http://search.yahooapis.com/SiteExplorerService/V1/updateNotification?appid=SitemapWriter&url=');
            foreach ($services as $service) {
                http_download_file($service . urlencode(get_custom_base_url() . '/ocp_sitemap.xml'), NULL, false);
            }
        }
    }
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:34,代码来源:sitemap.php


示例10: splurgh_master_build

/**
 * Get a splurghified version of the specified item.
 *
 * @param  string			The name of what the key we want to reference is in our array of maps (e.g. 'id')
 * @param  array			A row of maps for data we are splurghing; this is probably just the result of $GLOBALS['SITE_DB']->query_select
 * @param  URLPATH		The stub that links will be passed through
 * @param  ID_TEXT		The page name we will be saving customised HTML under
 * @param  TIME			The time we did our last change to the data being splurghed (so it can see if we can simply decache instead of deriving)
 * @param  ?AUTO_LINK	The ID that is at the root of our tree (NULL: db_get_first_id)
 * @return string			A string of HTML that represents our splurghing (will desplurgh in the users browser)
 */
function splurgh_master_build($key_name, $map, $url_stub, $_cache_file, $last_change_time, $first_id = NULL)
{
    if (is_null($first_id)) {
        $first_id = db_get_first_id();
    }
    if (!array_key_exists($first_id, $map)) {
        return '';
    }
    if (!has_js()) {
        warn_exit(do_lang_tempcode('MSG_JS_NEEDED'));
    }
    require_javascript('javascript_splurgh');
    if (is_browser_decacheing()) {
        $last_change_time = time();
    }
    $cache_file = zone_black_magic_filterer(get_custom_file_base() . '/' . get_zone_name() . '/pages/html_custom/' . filter_naughty(user_lang()) . '/' . filter_naughty($_cache_file) . '.htm');
    if (!file_exists($cache_file) || is_browser_decacheing() || filesize($cache_file) == 0 || $last_change_time > filemtime($cache_file)) {
        $myfile = @fopen($cache_file, 'wt');
        if ($myfile === false) {
            intelligent_write_error($cache_file);
        }
        $fulltable = array();
        $splurgh = _splurgh_do_node($map, $first_id, '', $fulltable, 0);
        $page = do_template('SPLURGH', array('_GUID' => '8775edfc5a386fdf2cec69b0fc889952', 'KEY_NAME' => $key_name, 'URL_STUB' => $url_stub, 'SPLURGH' => str_replace('"', '\'', $splurgh)));
        $ev = $page->evaluate();
        if (fwrite($myfile, $ev) < strlen($ev)) {
            warn_exit(do_lang_tempcode('COULD_NOT_SAVE_FILE'));
        }
        fclose($myfile);
        fix_permissions($cache_file);
        sync_file($cache_file);
        return $ev;
    }
    return file_get_contents($cache_file, FILE_TEXT);
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:46,代码来源:splurgh.php


示例11: pointstore_handle_error_already_has

/**
 * Check to see if the member already has an account of this type. If so, an error message is shown, as you can only own of each type.
 *
 * @param  ID_TEXT		The type of mail domain
 * @set    pop3 forw
 */
function pointstore_handle_error_already_has($type)
{
    $userid = get_member();
    // If we already own a forwarding account, inform our users.
    $has_one_already = $GLOBALS['SITE_DB']->query_value_null_ok('sales', 'memberid', array('memberid' => $userid, 'purchasetype' => $type));
    if (!is_null($has_one_already)) {
        warn_exit(do_lang_tempcode('ALREADY_HAVE'));
    }
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:15,代码来源:pointstore.php


示例12: ocf_make_emoticon

/**
 * Make an emoticon.
 *
 * @param  SHORT_TEXT	The textual code entered to make the emoticon appear.
 * @param  ID_TEXT		The image code used for the emoticon.
 * @param  integer		The relevance level.
 * @range  0 4
 * @param  BINARY			Whether this may be used as a topic emoticon.
 * @param  BINARY			Whether this may only be used by privileged members
 */
function ocf_make_emoticon($code, $theme_img_code, $relevance_level = 1, $use_topics = 1, $is_special = 0)
{
    $test = $GLOBALS['FORUM_DB']->query_value_null_ok('f_emoticons', 'e_code', array('e_code' => $code));
    if (!is_null($test)) {
        warn_exit(do_lang_tempcode('CONFLICTING_EMOTICON_CODE', escape_html($test)));
    }
    $GLOBALS['FORUM_DB']->query_insert('f_emoticons', array('e_code' => $code, 'e_theme_img_code' => $theme_img_code, 'e_relevance_level' => $relevance_level, 'e_use_topics' => $use_topics, 'e_is_special' => $is_special));
    log_it('ADD_EMOTICON', $code, $theme_img_code);
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:19,代码来源:ocf_general_action.php


示例13: _do_template

/**
 * A template has not been structurally cached, so compile it and store in the cache.
 *
 * @param  ID_TEXT			The theme the template is in the context of
 * @param  PATH				The path to the template file
 * @param  ID_TEXT			The codename of the template (e.g. foo)
 * @param  ID_TEXT			The actual codename to use for the template (e.g. thin_foo)
 * @param  LANGUAGE_NAME	The language the template is in the context of
 * @param  string				File type suffix of template file
 * @param  ?ID_TEXT			The theme to cache in (NULL: main theme)
 * @return tempcode			The compiled tempcode
 */
function _do_template($theme, $path, $codename, $_codename, $lang, $suffix, $theme_orig = NULL)
{
    if (is_null($theme_orig)) {
        $theme_orig = $theme;
    }
    $base_dir = ($theme == 'default' && ($suffix != '.css' || strpos($path, '/css_custom') === false) ? get_file_base() : get_custom_file_base()) . '/themes/';
    global $CACHE_TEMPLATES, $FILE_ARRAY, $TEMPLATE_PREVIEW_OP, $MEM_CACHE;
    if (isset($FILE_ARRAY)) {
        $html = unixify_line_format(file_array_get('themes/' . $theme . $path . $codename . $suffix));
    } else {
        $html = unixify_line_format(file_get_contents($base_dir . filter_naughty($theme . $path . $codename) . $suffix, FILE_TEXT));
    }
    if (strpos($html, '{$,Parser hint: pure}') !== false) {
        return make_string_tempcode(preg_replace('#\\{\\$,.*\\}#U', '/*no minify*/', $html));
    }
    if ($GLOBALS['SEMI_DEBUG_MODE'] && strpos($html, '.innerHTML') !== false && strpos($html, 'Parser hint: .innerHTML okay') === false) {
        require_code('site');
        attach_message('Do not use the .innerHTML property in your Javascript because it will not work in true XHTML (when the browsers real XML parser is in action). Use ocPortal\'s global setInnerHTML/getInnerHTML functions.', 'warn');
    }
    // Strip off trailing final lines from single lines templates. Editors often put these in, and it causes annoying "visible space" issues
    if (substr($html, -1, 1) == chr(10) && substr_count($html, chr(10)) == 1) {
        $html = substr($html, 0, strlen($html) - 1);
    }
    if ($TEMPLATE_PREVIEW_OP) {
        $test = post_param($codename, NULL);
        if (!is_null($test)) {
            $html = post_param($test . '_new');
        }
    }
    $result = template_to_tempcode($html, 0, false, $codename, $theme, $lang);
    if ($CACHE_TEMPLATES && ($suffix == '.tpl' || $codename == 'no_cache')) {
        if (!is_null($MEM_CACHE)) {
            persistant_cache_set(array('TEMPLATE', $theme, $lang, $_codename), $result->to_assembly(), strpos($path, 'default/templates/') !== false);
        } else {
            $path2 = get_custom_file_base() . '/themes/' . $theme_orig . '/templates_cached/' . filter_naughty($lang) . '/';
            $myfile = @fopen($path2 . filter_naughty($_codename) . $suffix . '.tcd', 'wb');
            if ($myfile === false) {
                if (@mkdir($path2, 0777)) {
                    require_code('files');
                    fix_permissions($path2, 0777);
                } else {
                    if (file_exists($path2 . filter_naughty($_codename) . $suffix . '.tcd')) {
                        warn_exit(do_lang_tempcode('WRITE_ERROR', $path2 . filter_naughty($_codename) . $suffix . '.tcd'));
                    } else {
                        warn_exit(do_lang_tempcode('WRITE_ERROR_CREATE', $path2 . filter_naughty($_codename) . $suffix . '.tcd'));
                    }
                }
            } else {
                fwrite($myfile, $result->to_assembly($lang));
                fclose($myfile);
                fix_permissions($path2 . filter_naughty($_codename) . $suffix . '.tcd');
            }
        }
    }
    return $result;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:68,代码来源:tempcode_compiler__runtime.php


示例14: action_done

 /**
  * Standard actualisation stage of pointstore item purchase.
  *
  * @return tempcode		The UI
  */
 function action_done()
 {
     $class = str_replace('hook_pointstore_', '', strtolower(get_class($this)));
     if (get_option('is_on_' . $class . '_buy') == '0') {
         return new ocp_tempcode();
     }
     $amount = post_param_integer('amount', -1);
     $title = get_page_title('GAMBLING');
     // Check points
     $cost = intval(get_option('minimum_gamble_amount'));
     $points_left = available_points(get_member());
     $max = min(intval(get_option('maximum_gamble_amount')), $points_left);
     if (!has_specific_permission(get_member(), 'give_points_self') || $amount < 0) {
         if ($amount < $cost || $amount > $max) {
             warn_exit(do_lang_tempcode('INVALID_GAMBLE_AMOUNT'));
         }
         if ($points_left < $amount) {
             return warn_screen($title, do_lang_tempcode('_CANT_AFFORD', integer_format($cost), integer_format($points_left)));
         }
     }
     // Calculate
     $average_gamble_multiplier = floatval(get_option('average_gamble_multiplier')) / 100.0;
     $maximum_gamble_multiplier = floatval(get_option('maximum_gamble_multiplier')) / 100.0;
     $above_average = mt_rand(0, 10) < 5;
     if ($above_average) {
         //			$winnings=round($average_gamble_multiplier*$amount+mt_rand(0,round($maximum_gamble_multiplier*$amount-$average_gamble_multiplier*$amount)));	  Even distribution is NOT wise
         $peak = $maximum_gamble_multiplier * $amount;
         $under = 0.0;
         $number = intval(round($average_gamble_multiplier * $amount + mt_rand(0, intval(round($maximum_gamble_multiplier * $amount - $average_gamble_multiplier * $amount)))));
         for ($x = 1; $x < intval($peak); $x++) {
             $p = $peak * (1.0 / pow(floatval($x) + 0.4, 2.0) - 1.0 / pow($maximum_gamble_multiplier * floatval($amount), 2.0));
             // Using a 1/x^2 curve. 0.4 is a bit of a magic number to get the averaging right
             $under += $p;
             if ($under > floatval($number)) {
                 break;
             }
         }
         $winnings = intval(round($average_gamble_multiplier * $amount + $x * 1.1));
         // 1.1 is a magic number to make it seem a bit fairer
     } else {
         $winnings = mt_rand(0, intval(round($average_gamble_multiplier * $amount)));
     }
     // Actuate
     require_code('points2');
     charge_member(get_member(), $amount - $winnings, do_lang('GAMBLING'));
     $GLOBALS['SITE_DB']->query_insert('sales', array('date_and_time' => time(), 'memberid' => get_member(), 'purchasetype' => 'GAMBLING', 'details' => strval($amount), 'details2' => ''));
     // Show message
     if ($winnings > $amount) {
         $result = do_lang_tempcode('GAMBLE_CONGRATULATIONS', integer_format($winnings - $amount), integer_format($amount));
     } else {
         $result = do_lang_tempcode('GAMBLE_COMMISERATIONS', integer_format($amount - $winnings), integer_format($amount));
     }
     $url = build_url(array('page' => '_SELF', 'type' => 'misc'), '_SELF');
     return redirect_screen($title, $url, $result);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:60,代码来源:gambling.php


示例15: _get_input_date

/**
 * Check a POST inputted date for validity, and get the Unix timestamp for the inputted date.
 *
 * @param  ID_TEXT		The stub of the parameter name (stub_year, stub_month, stub_day, stub_hour, stub_minute)
 * @param  boolean		Whether to allow over get parameters also
 * @return ?TIME			The timestamp of the date (NULL: no input date was chosen)
 */
function _get_input_date($stub, $get_also = false)
{
    $timezone = post_param('timezone', get_users_timezone());
    if ($get_also) {
        //		if (either_param_integer($stub,0)==0) return NULL; // NULL was chosen		Doesn't work like this now
        $year = either_param_integer($stub . '_year', NULL);
        if (is_null($year)) {
            return NULL;
        }
        $month = either_param_integer($stub . '_month', NULL);
        if (is_null($month)) {
            return NULL;
        }
        $day = either_param_integer($stub . '_day', NULL);
        if (is_null($day)) {
            return NULL;
        }
        $hour = either_param_integer($stub . '_hour', NULL);
        $minute = either_param_integer($stub . '_minute', NULL);
    } else {
        //		if (post_param_integer($stub,0)==0) return NULL; // NULL was chosen		Doesn't work like this now
        $year = post_param_integer($stub . '_year', NULL);
        if (is_null($year)) {
            return NULL;
        }
        $month = post_param_integer($stub . '_month', NULL);
        if (is_null($month)) {
            return NULL;
        }
        $day = post_param_integer($stub . '_day', NULL);
        if (is_null($day)) {
            return NULL;
        }
        $hour = post_param_integer($stub . '_hour', NULL);
        $minute = post_param_integer($stub . '_minute', NULL);
    }
    if (!checkdate($month, $day, $year)) {
        warn_exit(do_lang_tempcode('INVALID_DATE_GIVEN'));
    }
    if (is_null($hour)) {
        if (strpos($stub, 'end') !== false) {
            $hour = 23;
            $minute = 59;
        } else {
            $hour = 0;
            $minute = 0;
        }
    }
    $time = mktime($hour, $minute, 0, $month, $day, $year);
    if ($year >= 1970 || @strftime('%Y', @mktime(0, 0, 0, 1, 1, 1963)) == '1963') {
        $amount_forward = tz_time($time, $timezone) - $time;
        $time = $time - $amount_forward;
    }
    return $time;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:62,代码来源:temporal2.php


示例16: get_loc_details

/**
 * Get a member's position.
 *
 * @param  MEMBER		The member
 * @param  boolean	Whether it's excusable if the member does not exist (i.e. doesn't exit with error)
 * @return ?array		Tuple: Realm, X ordinate, Y ordinate (NULL: no such member)
 */
function get_loc_details($member_id, $null_ok = false)
{
    $rows = $GLOBALS['SITE_DB']->query_select('w_members', array('location_realm', 'location_x', 'location_y'), array('id' => $member_id), '', 1);
    if (!array_key_exists(0, $rows)) {
        if ($null_ok) {
            return NULL;
        }
        warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
    }
    return array($rows[0]['location_realm'], $rows[0]['location_x'], $rows[0]['location_y']);
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:18,代码来源:ocworld.php


示例17: run

 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     $file = array_key_exists('param', $map) ? $map['param'] : 'ocprocks';
     require_code('textfiles');
     require_lang('ocprocks');
     $place = _find_text_file_path($file, '');
     if (!file_exists($place)) {
         warn_exit(do_lang_tempcode('DIRECTORY_NOT_FOUND', escape_html($place)));
     }
     $edit_url = new ocp_tempcode();
     return do_template('BLOCK_MAIN_OCPROCKS', array('FILE' => $file, 'CONTENT' => apply_emoticons($this->get_random_line($place))));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:18,代码来源:main_ocprocks.php


示例18: new_posts

 /**
  * The UI to show topics with new posts since last visit time.
  *
  * @return array			A pair: The Title, The UI
  */
 function new_posts()
 {
     $title = do_lang('POSTS_SINCE_LAST_VISIT');
     if (!array_key_exists('last_visit', $_COOKIE)) {
         warn_exit(do_lang_tempcode('NO_LAST_VISIT'));
     }
     $condition = 't_cache_last_time>' . strval((int) $_COOKIE['last_visit']);
     $order2 = 't_cache_last_time DESC';
     if (get_value('disable_sunk') !== '1') {
         $order2 = 't_sunk ASC,' . $order2;
     }
     return array(get_page_title('POSTS_SINCE_LAST_VISIT'), $this->_vforum($title, $condition, 't_cascading DESC,t_pinned DESC,' . $order2, true));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:18,代码来源:vforums.php


示例19: run

 /**
  * Standard modular run function for snippet hooks. Generates XHTML to insert into a page using AJAX.
  *
  * @return tempcode  The snippet
  */
 function run()
 {
     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')) {
         require_code('occle');
         require_lang('occle');
         $title = get_page_title('OCCLE');
         return do_template('OCCLE_MAIN', array('COMMANDS' => '', 'SUBMIT_URL' => build_url(array('page' => 'admin_occle'), 'adminzone'), 'PROMPT' => do_lang_tempcode('COMMAND_PROMPT', escape_html($GLOBALS['FORUM_DRIVER']->get_username(get_member())))));
     }
     return new ocp_tempcode();
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:18,代码来源:occle.php


示例20: give_points

/**
 * Give a member some points, from another member.
 *
 * @param  integer		The amount being given
 * @param  MEMBER			The member receiving the points
 * @param  MEMBER			The member sending the points
 * @param  SHORT_TEXT	The reason for the gift
 * @param  boolean		Does the sender want to remain anonymous?
 * @param  boolean		Whether to send out an email about it
 */
function give_points($amount, $recipient_id, $sender_id, $reason, $anonymous = false, $send_email = true)
{
    require_lang('points');
    require_code('points');
    $your_username = $GLOBALS['FORUM_DRIVER']->get_username($sender_id);
    $GLOBALS['SITE_DB']->query_insert('gifts', array('date_and_time' => time(), 'amount' => $amount, 'gift_from' => $sender_id, 'gift_to' => $recipient_id, 'reason' => insert_lang_comcode($reason, 4), 'anonymous' => $anonymous ? 1 : 0));
    $sender_gift_points_used = point_info($sender_id);
    $sender_gift_points_used = array_key_exists('gift_points_used', $sender_gift_points_used) ? $sender_gift_points_used['gift_points_used'] : 0;
    $GLOBALS['FORUM_DRIVER']->set_custom_field($sender_id, 'gift_points_used', strval($sender_gift_points_used + $amount));
    $temp_points = point_info($recipient_id);
    $GLOBALS['FORUM_DRIVER']->set_custom_field($recipient_id, 'points_gained_given', strval((array_key_exists('points_gained_given', $temp_points) ? $temp_points['points_gained_given'] : 0) + $amount));
    $their_username = $GLOBALS['FORUM_DRIVER']->get_username($recipient_id);
    if (is_null($their_username)) {
        warn_exit(do_lang_tempcode('_USER_NO_EXIST', $recipient_id));
    }
    $yes = $GLOBALS['FORUM_DRIVER']->get_member_email_allowed($recipient_id);
    if ($yes && $send_email) {
        $_url = build_url(array('page' => 'points', 'type' => 'member', 'id' => $recipient_id), get_module_zone('points'), NULL, false, false, true);
        $url = $_url->evaluate();
        require_code('notifications');
        if ($anonymous) {
            $message_raw = do_lang('GIVEN_POINTS_FOR_ANON', comcode_escape(get_site_name()), comcode_escape(integer_format($amount)), array(comcode_escape($reason), comcode_escape($url)), get_lang($recipient_id));
            dispatch_notification('received_points', NULL, do_lang('YOU_GIVEN_POINTS', integer_format($amount), NULL, NULL, get_lang($recipient_id)), $message_raw, array($recipient_id), A_FROM_SYSTEM_UNPRIVILEGED);
        } else {
            $message_raw = do_lang('GIVEN_POINTS_FOR', comcode_escape(get_site_name()), comcode_escape(integer_format($amount)), array(comcode_escape($reason), comcode_escape($url), comcode_escape($your_username)), get_lang($recipient_id));
            dispatch_notification('received_points', NULL, do_lang('YOU_GIVEN_POINTS', integer_format($amount), NULL, NULL, get_lang($recipient_id)), $message_raw, array($recipient_id), $sender_id);
        }
        $message_raw = do_lang('USER_GIVEN_POINTS_FOR', comcode_escape($their_username), comcode_escape(integer_format($amount)), array(comcode_escape($reason), comcode_escape($url), comcode_escape($your_username)), get_site_default_lang());
        dispatch_notification('receive_points_staff', NULL, do_lang('USER_GIVEN_POINTS', integer_format($amount), NULL, NULL, get_site_default_lang()), $message_raw, NULL, $sender_id);
    }
    global $TOTAL_POINTS_CACHE, $POINT_INFO_CACHE;
    if (array_key_exists($recipient_id, $TOTAL_POINTS_CACHE)) {
        $TOTAL_POINTS_CACHE[$recipient_id] += $amount;
    }
    if (array_key_exists($recipient_id, $POINT_INFO_CACHE) && array_key_exists('points_gained_given', $POINT_INFO_CACHE[$recipient_id])) {
        $POINT_INFO_CACHE[$recipient_id]['points_gained_given'] += $amount;
    }
    if (array_key_exists($sender_id, $POINT_INFO_CACHE) && array_key_exists('gift_points_used', $POINT_INFO_CACHE[$sender_id])) {
        $POINT_INFO_CACHE[$sender_id]['gift_points_used'] += $amount;
    }
    if (get_forum_type() == 'ocf') {
        require_code('ocf_posts_action');
        require_code('ocf_posts_action2');
        ocf_member_handle_promotion($recipient_id);
    }
    if (!$anonymous) {
        if (has_actual_page_access($GLOBALS['FORUM_DRIVER']->get_guest_id(), 'points')) {
            syndicate_described_activity(is_null($recipient_id) || is_guest($recipient_id) ? 'points:_ACTIVITY_GIVE_POINTS' : 'points:ACTIVITY_GIVE_POINTS', $reason, integer_format($amount), '', '_SEARCH:points:member:' . strval($recipient_id), '', '', 'points', 1, NULL, false, $recipient_id);
        }
    }
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:61,代码来源:points2.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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