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

PHP running_script函数代码示例

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

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



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

示例1: ajax_tree

 /**
  * Get details for an ajax-tree-list of entries for the content covered by this search hook.
  *
  * @return array			A pair: the hook, and the options
  */
 function ajax_tree()
 {
     $catalogue_name = get_param('catalogue_name', '');
     if ($catalogue_name == '') {
         @ob_end_clean();
         $tree = nice_get_catalogues(NULL, true);
         if ($tree->is_empty()) {
             inform_exit(do_lang_tempcode('NO_ENTRIES'));
         }
         require_code('form_templates');
         $fields = form_input_list(do_lang_tempcode('NAME'), '', 'catalogue_name', $tree, NULL, true);
         if (running_script('iframe')) {
             $post_url = get_self_url_easy();
         } else {
             $post_url = get_self_url(false, false, NULL, false, true);
         }
         $submit_name = do_lang_tempcode('PROCEED');
         $hidden = build_keep_post_fields();
         $title = get_page_title('SEARCH');
         $tpl = do_template('FORM_SCREEN', array('_GUID' => 'a2812ac8056903811f444682d45ee448', 'TARGET' => '_self', 'GET' => true, 'SKIP_VALIDATION' => true, 'HIDDEN' => $hidden, 'TITLE' => $title, 'TEXT' => '', 'URL' => $post_url, 'FIELDS' => $fields, 'SUBMIT_NAME' => $submit_name));
         $echo = globalise($tpl, NULL, '', true);
         $echo->evaluate_echo();
         exit;
     }
     return array('choose_catalogue_category', array('catalogue_name' => $catalogue_name));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:31,代码来源:catalogue_entries.php


示例2: init__database__xml

/**
 * Standard code module initialisation function.
 */
function init__database__xml()
{
    global $SCHEMA_CACHE, $DIR_CONTENTS_CACHE;
    $SCHEMA_CACHE = array();
    $DIR_CONTENTS_CACHE = array();
    global $DELIMITERS_FLIPPED, $DELIMITERS, $SYMBOL_DELIMINITER, $DELIMITERS_ALPHA;
    $DELIMITERS = array_merge(array("\t", ' ', "\n"), _get_sql_keywords());
    sort($DELIMITERS);
    $DELIMITERS_FLIPPED = array_flip($DELIMITERS);
    $SYMBOL_DELIMINITER = array_flip(array("\t", ' ', "\n", '+', '-', '*', '/', '>', '<', '=', "'", '"', "\\'", '(', ')', ','));
    foreach ($DELIMITERS as $d) {
        if (!isset($DELIMITERS_ALPHA[$d[0]])) {
            $DELIMITERS_ALPHA[$d[0]] = array();
        }
        $DELIMITERS_ALPHA[$d[0]][] = $d;
    }
    global $TABLE_BASES;
    $TABLE_BASES = array();
    // Support for chaining a DB- to make reads faster
    global $SITE_INFO;
    if (array_key_exists('db_chain_type', $SITE_INFO) && !running_script('xml_db_import') && get_param_integer('keep_no_chain', 0) != 1) {
        require_code('database/' . $SITE_INFO['db_chain_type']);
        $GLOBALS['XML_CHAIN_DB'] = new database_driver($SITE_INFO['db_chain'], $SITE_INFO['db_chain_host'], $SITE_INFO['db_chain_user'], $SITE_INFO['db_chain_password'], get_table_prefix(), false, object_factory('Database_Static_' . $SITE_INFO['db_chain_type']));
    } else {
        $GLOBALS['XML_CHAIN_DB'] = NULL;
    }
    if (function_exists('set_time_limit')) {
        @set_time_limit(100);
    }
    // XML DB is *slow*
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:34,代码来源:xml.php


示例3: ocf_check_post

/**
 * Check a post would be valid.
 *
 * @param  LONG_TEXT		The post.
 * @param  ?AUTO_LINK	The ID of the topic the post would be in (NULL: don't check with regard to any particular topic).
 * @param  ?MEMBER		The poster (NULL: current member).
 * @return ?array			Row of the existing post if a double post (single row map-element in a list of rows) (NULL: not a double post).
 */
function ocf_check_post($post, $topic_id = NULL, $poster = NULL)
{
    if (is_null($poster)) {
        $poster = get_member();
    }
    require_code('comcode_check');
    check_comcode($post, NULL, false, NULL, true);
    if (strlen($post) == 0) {
        warn_exit(do_lang_tempcode('POST_TOO_SHORT'));
    }
    require_code('ocf_groups');
    if (strlen($post) > ocf_get_member_best_group_property($poster, 'max_post_length_comcode')) {
        warn_exit(make_string_tempcode(escape_html(do_lang('_POST_TOO_LONG'))));
    }
    if (!is_null($topic_id)) {
        if (running_script('stress_test_loader')) {
            return NULL;
        }
        // Check this isn't the same as the last post here
        $last_posts = $GLOBALS['FORUM_DB']->query_select('f_posts', array('p_post', 'p_poster', 'p_ip_address'), array('p_topic_id' => $topic_id), 'ORDER BY p_time DESC,id DESC', 1);
        if (array_key_exists(0, $last_posts)) {
            if ($last_posts[0]['p_poster'] == $GLOBALS['OCF_DRIVER']->get_guest_id() && get_ip_address() != $last_posts[0]['p_ip_address']) {
                $last_posts[0]['p_poster'] = -1;
            }
            if ($last_posts[0]['p_poster'] == $poster && get_translated_text($last_posts[0]['p_post'], $GLOBALS['FORUM_DB']) == $post && get_param_integer('keep_debug_notifications', 0) != 1) {
                warn_exit(do_lang_tempcode('DOUBLE_POST_PREVENTED'));
            }
        }
        return $last_posts;
    }
    return NULL;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:40,代码来源:ocf_posts_action.php


示例4: check_comcode

/**
 * Check the Comcode is valid.
 *
 * @param  LONG_TEXT		The comcode to convert
 * @param  ?MEMBER		The member the evaluation is running as. This is a security issue, and you should only run as an administrator if you have considered where the comcode came from carefully (NULL: current member)
 * @param  boolean		Whether to explicitly execute this with admin rights. There are a few rare situations where this should be done, for data you know didn't come from a member, but is being evaluated by one.
 * @param  ?object		The database connection to use (NULL: standard site connection)
 * @param  boolean		Whether there might be new attachments. If there are, we will check as lax- as attachments are always preserved by forcing lax parsing.
 */
function check_comcode($comcode, $source_member = NULL, $as_admin = false, $connection = NULL, $attachment_possibility = false)
{
    if (running_script('stress_test_loader')) {
        return;
    }
    global $LAX_COMCODE;
    $temp = $LAX_COMCODE;
    if ($attachment_possibility) {
        $has_one = false;
        foreach ($_POST as $key => $value) {
            if (preg_match('#^hidFileID\\_#i', $key) != 0) {
                require_code('uploads');
                $has_one = is_swf_upload();
            }
        }
        foreach ($_FILES as $key => $file) {
            $matches = array();
            if (is_uploaded_file($file['tmp_name']) && preg_match('#file(\\d)#', $key, $matches) != 0) {
                $has_one = true;
            }
        }
        if ($has_one) {
            $LAX_COMCODE = true;
        }
        // We don't want a simple syntax error to cause us to lose our attachments
    }
    comcode_to_tempcode($comcode, $source_member, $as_admin, 60, NULL, $connection, false, false, false, false, true);
    $LAX_COMCODE = $temp;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:38,代码来源:comcode_check.php


示例5: activities_addon_syndicate_described_activity

/**
 * @license		http://opensource.org/licenses/cpal_1.0 Common Public Attribution License
 * @copyright	ocProducts Ltd
 * @package		activity_feed
 */
function activities_addon_syndicate_described_activity($a_language_string_code = '', $a_label_1 = '', $a_label_2 = '', $a_label_3 = '', $a_pagelink_1 = '', $a_pagelink_2 = '', $a_pagelink_3 = '', $a_addon = '', $a_is_public = 1, $a_member_id = NULL, $sitewide_too = false, $a_also_involving = NULL)
{
    require_code('activities');
    require_lang('activities');
    if (get_db_type() == 'xml' && get_param_integer('keep_testing_logging', 0) != 1) {
        return NULL;
    }
    $stored_id = 0;
    if (is_null($a_member_id)) {
        $a_member_id = get_member();
    }
    if (is_guest($a_member_id)) {
        return NULL;
    }
    $go = array('a_language_string_code' => $a_language_string_code, 'a_label_1' => $a_label_1, 'a_label_2' => $a_label_2, 'a_label_3' => $a_label_3, 'a_is_public' => $a_is_public);
    $stored_id = mixed();
    // Check if this has been posted previously (within the last 10 minutes) to
    // stop spamming but allow generalised repeat status messages.
    $test = $GLOBALS['SITE_DB']->query_select('activities', array('a_language_string_code', 'a_label_1', 'a_label_2', 'a_label_3', 'a_is_public'), NULL, 'WHERE a_time>' . strval(time() - 600), 1);
    if (!array_key_exists(0, $test) || $test[0] != $go || running_script('execute_temp')) {
        // Log the activity
        $row = $go + array('a_member_id' => $a_member_id, 'a_also_involving' => $a_also_involving, 'a_pagelink_1' => $a_pagelink_1, 'a_pagelink_2' => $a_pagelink_2, 'a_pagelink_3' => $a_pagelink_3, 'a_time' => time(), 'a_addon' => $a_addon, 'a_is_public' => $a_is_public);
        $stored_id = $GLOBALS['SITE_DB']->query_insert('activities', $row, true);
        // Update the latest activity file
        log_newest_activity($stored_id, 1000);
        // External places
        if ($a_is_public == 1 && !$GLOBALS['IS_ACTUALLY_ADMIN']) {
            $dests = find_all_hooks('systems', 'syndication');
            foreach (array_keys($dests) as $hook) {
                require_code('hooks/systems/syndication/' . $hook);
                $ob = object_factory('Hook_Syndication_' . $hook);
                if ($ob->is_available()) {
                    $ob->syndicate_user_activity($a_member_id, $row);
                    if ($sitewide_too && has_specific_permission(get_member(), 'syndicate_site_activity') && post_param_integer('syndicate_this', 0) == 1) {
                        $ob->syndicate_site_activity($row);
                    }
                }
            }
        }
        list($message) = render_activity($row, false);
        require_code('notifications');
        $username = $GLOBALS['FORUM_DRIVER']->get_username($a_member_id);
        $subject = do_lang('ACTIVITY_NOTIFICATION_MAIL_SUBJECT', get_site_name(), $username, html_entity_decode(strip_tags($message->evaluate()), ENT_QUOTES, get_charset()));
        $mail = do_lang('ACTIVITY_NOTIFICATION_MAIL', comcode_escape(get_site_name()), comcode_escape($username), array('[semihtml]' . $message->evaluate() . '[/semihtml]'));
        dispatch_notification('activity', strval($a_member_id), $subject, $mail);
    }
    return $stored_id;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:53,代码来源:activities_submission.php


示例6: install

 /**
  * Standard modular install function.
  *
  * @param  ?integer	What version we're upgrading from (NULL: new install)
  * @param  ?integer	What hack version we're upgrading from (NULL: new-install/not-upgrading-from-a-hacked-version)
  */
 function install($upgrade_from = NULL, $upgrade_from_hack = NULL)
 {
     add_config_option('_MESSAGING_FORUM_NAME', 'messaging_forum_name', 'forum', 'return do_lang(\'MESSAGING_FORUM_NAME\',\'\',\'\',\'\',get_site_default_lang());', 'FEATURE', 'CONTACT_US_MESSAGING');
     if (get_forum_type() == 'ocf' && !running_script('upgrader')) {
         $moderator_groups = $GLOBALS['FORUM_DRIVER']->get_moderator_groups();
         $staff_access = array();
         foreach ($moderator_groups as $id) {
             $staff_access[$id] = 5;
         }
         ocf_require_all_forum_stuff();
         require_code('ocf_forums_action');
         require_code('ocf_forums_action2');
         $GLOBALS['OCF_DRIVER'] = $GLOBALS['FORUM_DRIVER'];
         ocf_make_forum(do_lang('MESSAGING_FORUM_NAME'), '', db_get_first_id() + 1, $staff_access, db_get_first_id());
     }
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:22,代码来源:admin_messaging.php


示例7: render_tab

 /**
  * Standard modular render function for profile tab 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 triple: The tab title, the tab contents, the suggested tab order
  */
 function render_tab($member_id_of, $member_id_viewing, $leave_to_ajax_if_possible = false)
 {
     $GLOBALS['FEED_URL'] = find_script('backend') . '?mode=activities&filter=' . strval($member_id_of);
     require_lang('activities');
     $title = do_lang_tempcode('ACTIVITIES_TITLE');
     $order = 70;
     // Need to declare these here as the Tempcode engine can't look as deep, into a loop (I think), as it would need to, to find the block declaring the dependency
     require_css('activities');
     require_javascript('javascript_activities_state');
     require_javascript('javascript_activities');
     require_javascript('javascript_jquery');
     require_javascript('javascript_base64');
     // Allow user to link up things for syndication
     $syndications = array();
     if ($member_id_of == $member_id_viewing) {
         $dests = find_all_hooks('systems', 'syndication');
         foreach (array_keys($dests) as $hook) {
             require_code('hooks/systems/syndication/' . $hook);
             $ob = object_factory('Hook_Syndication_' . $hook);
             if ($ob->is_available()) {
                 if (either_param('syndicate_stop__' . $hook, NULL) !== NULL) {
                     $ob->auth_unset($member_id_of);
                 } elseif (either_param('syndicate_start__' . $hook, NULL) !== NULL) {
                     $url_map = array('page' => '_SELF', 'type' => 'view', 'id' => $member_id_of, 'oauth_in_progress' => 1);
                     $url_map['syndicate_start__' . $hook] = 1;
                     $oauth_url = build_url($url_map, '_SELF', NULL, false, false, false, 'tab__activities');
                     $ob->auth_set($member_id_of, $oauth_url);
                 } elseif (running_script('index') && !$leave_to_ajax_if_possible && $ob->auth_is_set($member_id_of) && either_param('oauth_in_progress', NULL) === NULL && !$GLOBALS['IS_ACTUALLY_ADMIN']) {
                     /*	running_script('index') won't work currently due to execution contexts, and it is never non-AJAX, and it's probably not needed anyway
                     			// Do a refresh to make sure the token is updated
                     			$url_map=array('page'=>'_SELF','type'=>'view','id'=>$member_id_of,'oauth_in_progress'=>1);
                     			$url_map['syndicate_start__'.$hook]=1;
                     			$oauth_url=build_url($url_map,'_SELF',NULL,false,false,false,'tab__activities');
                     			$ob->auth_set($member_id_of,$oauth_url);
                     			*/
                 }
                 $syndications[$hook] = array('SYNDICATION_IS_SET' => $ob->auth_is_set($member_id_of), 'SYNDICATION_SERVICE_NAME' => $ob->get_service_name());
             }
         }
     }
     if ($leave_to_ajax_if_possible) {
         return array($title, NULL, $order);
     }
     $content = do_template('OCF_MEMBER_PROFILE_ACTIVITIES', array('MEMBER_ID' => strval($member_id_of), 'SYNDICATIONS' => $syndications));
     return array($title, $content, $order);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:54,代码来源:activities.php


示例8: reply_to_any_communication

 /**
  * Give ability to reply to any communication.
  *
  * @param  AUTO_LINK		The ID of the chat room
  * @param  string			The message used.
  * @return ?string		Bot reply (NULL: bot does not handle the command)
  */
 function reply_to_any_communication($room_id, $string)
 {
     $people = get_chatters_in_room($room_id);
     if (count($people) > 2) {
         return NULL;
     }
     // Don't spam if noone is here
     if (running_script('shoutbox')) {
         return NULL;
     }
     // Messes up shoutbox
     $is_im = $GLOBALS['SITE_DB']->query_value('chat_rooms', 'is_im', array('id' => $room_id));
     if ($is_im == 1) {
         return NULL;
     }
     $message = preg_replace('#\\[[^\\[\\]]*\\]#U', '', $string);
     if ($message == '') {
         return NULL;
     }
     return $this->handle_commands($room_id, $message);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:28,代码来源:octavius.php


示例9: add_download

/**
 * Add a download.
 *
 * @param  AUTO_LINK			The ID of the category the download is to be in
 * @param  SHORT_TEXT		The name of the download
 * @param  URLPATH			The URL to the download
 * @param  LONG_TEXT			The description of the download
 * @param  ID_TEXT			The author of the download (not necessarily same as the submitter)
 * @param  LONG_TEXT			The comments for the download
 * @param  ?AUTO_LINK		The out-mode-id (the ID of a download that this download is an old version of). Often people wonder why this is specified with the old version, and not the opposite with the new version - it is because statistically, we perceive more chance of downloads merging than splitting (NULL: none)
 * @param  BINARY				Whether the download has been validated
 * @param  BINARY				Whether the download may be rated
 * @param  SHORT_INTEGER	Whether comments are allowed (0=no, 1=yes, 2=review style)
 * @param  BINARY				Whether the download may be trackbacked
 * @param  LONG_TEXT			Hidden notes pertaining to the download
 * @param  SHORT_TEXT		The downloads original filename (the URL may be obfuscated)
 * @param  integer			The file size of the download (we can't really detect this in real-time for remote URLs)
 * @param  integer			The cost of the download that members will have to pay to get it
 * @param  BINARY				Whether the submitter gets the points for the download (they are selling it) (otherwise they are just thrown out, which is an alternative model - one of enforcing community point building)
 * @param  ?AUTO_LINK		The licence to use (NULL: none)
 * @param  ?TIME				The add date for the download (NULL: now)
 * @param  integer			The number of downloads that this download has had
 * @param  integer			The number of views that this download has had
 * @param  ?MEMBER			The submitter (NULL: current user)
 * @param  ?TIME				The edit date (NULL: never)
 * @param  ?AUTO_LINK		Force an ID (NULL: don't force an ID)
 * @return AUTO_LINK			The ID of the newly added download
 */
function add_download($category_id, $name, $url, $description, $author, $comments, $out_mode_id, $validated, $allow_rating, $allow_comments, $allow_trackbacks, $notes, $original_filename, $file_size, $cost, $submitter_gets_points, $licence = NULL, $add_date = NULL, $num_downloads = 0, $views = 0, $submitter = NULL, $edit_date = NULL, $id = NULL)
{
    if (is_null($add_date)) {
        $add_date = time();
    }
    if (is_null($submitter)) {
        $submitter = get_member();
    }
    if ($file_size == 0 || url_is_local($url)) {
        if (url_is_local($url)) {
            $file_size = @filesize(get_custom_file_base() . '/' . rawurldecode($url)) or $file_size = NULL;
        } else {
            $file_size = @filesize($url) or $file_size = NULL;
        }
    }
    $met = @ini_get('max_execution_time');
    $data_mash = $url == '' ? '' : create_data_mash($url, NULL, get_file_extension($original_filename));
    if (function_exists('set_time_limit')) {
        @set_time_limit($met);
    }
    if (!addon_installed('unvalidated')) {
        $validated = 1;
    }
    $map = array('download_data_mash' => $data_mash, 'download_licence' => $licence, 'rep_image' => '', 'edit_date' => $edit_date, 'download_submitter_gets_points' => $submitter_gets_points, 'download_cost' => $cost, 'original_filename' => $original_filename, 'download_views' => $views, 'allow_rating' => $allow_rating, 'allow_comments' => $allow_comments, 'allow_trackbacks' => $allow_trackbacks, 'notes' => $notes, 'submitter' => $submitter, 'default_pic' => 1, 'num_downloads' => $num_downloads, 'out_mode_id' => $out_mode_id, 'category_id' => $category_id, 'name' => insert_lang($name, 2), 'url' => $url, 'description' => insert_lang_comcode($description, 3), 'author' => $author, 'comments' => insert_lang_comcode($comments, 3), 'validated' => $validated, 'add_date' => $add_date, 'file_size' => $file_size);
    if (!is_null($id)) {
        $map['id'] = $id;
    }
    $id = $GLOBALS['SITE_DB']->query_insert('download_downloads', $map, true);
    require_code('seo2');
    seo_meta_set_for_implicit('downloads_download', strval($id), array($name, $description, $comments), $description);
    // Make its gallery
    if (addon_installed('galleries') && !running_script('stress_test_loader')) {
        $test = $GLOBALS['SITE_DB']->query_value_null_ok('galleries', 'name', array('name' => 'download_' . strval($id)));
        if (is_null($test)) {
            require_code('galleries2');
            $download_gallery_root = get_option('download_gallery_root');
            if (is_null($download_gallery_root)) {
                $download_gallery_root = 'root';
            }
            add_gallery('download_' . strval($id), do_lang('GALLERY_FOR_DOWNLOAD', $name), '', '', '', $download_gallery_root);
        }
    }
    // Stat
    update_stat('num_archive_downloads', 1);
    if ($file_size > 0) {
        update_stat('archive_size', $file_size);
    }
    if ($validated == 1) {
        require_lang('downloads');
        require_code('notifications');
        $subject = do_lang('DOWNLOAD_NOTIFICATION_MAIL_SUBJECT', get_site_name(), $name);
        $self_url = build_url(array('page' => 'downloads', 'type' => 'entry', 'id' => $id), get_module_zone('downloads'), NULL, false, false, true);
        $mail = do_lang('DOWNLOAD_NOTIFICATION_MAIL', comcode_escape(get_site_name()), comcode_escape($name), array(comcode_escape($self_url->evaluate())));
        dispatch_notification('download', strval($category_id), $subject, $mail);
    }
    log_it('ADD_DOWNLOAD', strval($id), $name);
    decache('main_recent_downloads');
    decache('main_top_downloads');
    decache('main_download_category');
    decache('main_download_tease');
    return $id;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:90,代码来源:downloads2.php


示例10: _get_catalogue_entry_field

/**
 * Get the value for the specified field, for the stated catalogue entry.
 *
 * @param  AUTO_LINK		The ID of the field we are getting
 * @param  mixed			The ID of the entry we are getting for OR the row
 * @param  ID_TEXT		The type of field
 * @set    short long
 * @param  ?array			A list of field IDs that we are limiting ourselves to (NULL: get ALL fields)
 * @return string			The value
 */
function _get_catalogue_entry_field($field_id, $entry_id, $type = 'short', $only_field_ids = NULL)
{
    if (is_array($entry_id)) {
        $entry_id = $entry_id['id'];
    }
    global $SITE_INFO;
    if (!running_script('ajax_tree') && (!isset($SITE_INFO['mysql_old']) || $SITE_INFO['mysql_old'] == '0') && (!isset($SITE_INFO['mysql_old']) || !is_file(get_file_base() . '/mysql_old'))) {
        // Pre-caching of whole entry
        static $catalogue_entry_cache = array();
        if (!isset($catalogue_entry_cache[$entry_id][$field_id])) {
            if (!isset($catalogue_entry_cache[$entry_id])) {
                $catalogue_entry_cache[$entry_id] = array();
            }
            $query = '';
            foreach (array('catalogue_efv_float', 'catalogue_efv_integer', 'catalogue_efv_long', 'catalogue_efv_long_trans', 'catalogue_efv_short', 'catalogue_efv_short_trans') as $table) {
                if ($query != '') {
                    $query .= ' UNION ';
                }
                $query .= 'SELECT f.id,v.cv_value,';
                if (strpos($table, '_trans') !== false) {
                    $query .= 't.text_original,t.text_parsed';
                } else {
                    $query .= 'NULL AS text_original,NULL AS text_parsed';
                }
                $query .= ' FROM ' . get_table_prefix() . 'catalogue_fields f JOIN ' . get_table_prefix() . $table . ' v ON v.cf_id=f.id';
                if (strpos($table, '_trans') !== false) {
                    $query .= ' JOIN ' . get_table_prefix() . 'translate t ON t.id=v.cv_value';
                }
                $query .= ' WHERE v.ce_id=' . strval($entry_id);
                if (!is_null($only_field_ids)) {
                    $query .= ' AND (';
                    if ($only_field_ids != array()) {
                        foreach ($only_field_ids as $i => $_field_id) {
                            if ($i != 0) {
                                $query .= ' OR ';
                            }
                            $query .= 'f.id=' . strval($_field_id);
                        }
                    } else {
                        $query .= '1=0';
                    }
                    $query .= ')';
                }
            }
            foreach ($GLOBALS['SITE_DB']->query($query, NULL, NULL, false, true) as $line) {
                $catalogue_entry_cache[$entry_id][$line['id']] = $line['cv_value'];
                if (isset($line['text_original'])) {
                    $GLOBALS['SITE_DB']->text_lookup_original_cache[$line['cv_value']] = $line['text_original'];
                    $GLOBALS['SITE_DB']->text_lookup_cache[$line['cv_value']] = $line['text_parsed'];
                }
            }
        }
        $value = isset($catalogue_entry_cache[$entry_id][$field_id]) ? $catalogue_entry_cache[$entry_id][$field_id] : NULL;
    } else {
        $value = $GLOBALS['SITE_DB']->query_value_null_ok('catalogue_efv_' . $type, 'cv_value', array('cf_id' => $field_id, 'ce_id' => $entry_id));
    }
    if (is_integer($value)) {
        $value = strval($value);
    }
    if (is_float($value)) {
        $value = float_to_raw_string($value);
    }
    return $value;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:74,代码来源:catalogues.php


示例11: is_suexec_like

/**
 * Find whether we can get away with natural file access, not messing with AFMs, world-writability, etc.
 *
 * @return boolean		Whether we have this
 */
function is_suexec_like()
{
    return function_exists('posix_getuid') && strpos(@ini_get('disable_functions'), 'posix_getuid') === false && !isset($_SERVER['HTTP_X_MOSSO_DT']) && is_integer(@posix_getuid()) && @posix_getuid() == @fileowner(get_file_base() . '/' . (running_script('install') ? 'install.php' : 'index.php')) || is_writable_wrap(get_file_base() . '/' . (running_script('index') ? 'index.php' : 'install.php'));
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:9,代码来源:files.php


示例12: dispatch

 /**
  * Send out a notification to members enabled.
  */
 function dispatch()
 {
     if (running_script('stress_test_loader')) {
         return;
     }
     if (get_page_name() == 'admin_import') {
         return;
     }
     $subject = $this->subject;
     $message = $this->message;
     $no_cc = $this->no_cc;
     if ($GLOBALS['DEBUG_MODE']) {
         if (strpos($this->message, 'keep_devtest') !== false && $this->notification_code != 'hack_attack' && $this->notification_code != 'auto_ban' && strpos($this->message, running_script('index') ? static_evaluate_tempcode(build_url(array('page' => '_SELF'), '_SELF', NULL, true, false, true)) : get_self_url_easy()) === false && (strpos(ocp_srv('HTTP_REFERER'), 'keep_devtest') === false || strpos($this->message, ocp_srv('HTTP_REFERER')) === false)) {
             // Bad URL - it has to be general, not session-specific
             fatal_exit(do_lang_tempcode('INTERNAL_ERROR'));
         }
     }
     $ob = _get_notification_ob_for_code($this->notification_code);
     if (is_null($ob)) {
         if (get_page_name() != 'admin_setupwizard') {
             // Setupwizard may have removed after register_shutdown_function was called
             fatal_exit('Missing notification code: ' . $this->notification_code);
         }
         return;
     }
     require_lang('notifications');
     require_code('mail');
     if (function_exists('set_time_limit')) {
         @set_time_limit(0);
     }
     if ($this->store_in_staff_messaging_system && addon_installed('staff_messaging')) {
         require_lang('messaging');
         list($type, $id) = explode('_', $this->code_category, 2);
         $message_url = build_url(array('page' => 'admin_messaging', 'type' => 'view', 'id' => $id, 'message_type' => $type), get_module_zone('admin_messaging'), NULL, false, false, true);
         $message = do_lang('MESSAGING_NOTIFICATION_WRAPPER', $message, $message_url->evaluate());
         require_code('feedback');
         actualise_post_comment(true, $type, $id, $message_url, $subject, get_option('messaging_forum_name'), true, 1, true, true, true);
     }
     $testing = get_param_integer('keep_debug_notifications', 0) == 1;
     $start = 0;
     $max = 300;
     do {
         list($members, $possibly_has_more) = $ob->list_members_who_have_enabled($this->notification_code, $this->code_category, $this->to_member_ids, $start, $max);
         if (get_value('notification_safety_testing') === '1') {
             if (count($members) > 20) {
                 $members = array(6 => A_INSTANT_EMAIL);
                 // This is just for testing on ocportal.com, if lots of notifications going out it's probably a scary bug, so send just to Chris (#6) with a note
                 $message = 'OVER-ADDRESSED?' . "\n\n" . $message;
             }
         }
         foreach ($members as $to_member_id => $setting) {
             if (!is_null($this->no_notify_for__notification_code)) {
                 if (notifications_enabled($this->no_notify_for__notification_code, $this->no_notify_for__code_category, $to_member_id)) {
                     continue;
                 }
                 // Signal they are getting some other notification for this
             }
             if ($to_member_id !== $this->from_member_id || $testing) {
                 $no_cc = _dispatch_notification_to_member($to_member_id, $setting, $this->notification_code, $this->code_category, $subject, $message, $this->from_member_id, $this->priority, $no_cc);
             }
         }
         $start += $max;
     } while ($possibly_has_more);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:67,代码来源:notifications.php


示例13: mail_wrap

/**
 * Attempt to send an e-mail to the specified recipient. The mail will be forwarding to the CC address specified in the options (if there is one, and if not specified not to cc).
 * The mail will be sent in dual HTML/text format, where the text is the unconverted comcode source: if a member does not read HTML mail, they may wish to fallback to reading that.
 *
 * @param  string			The subject of the mail in plain text
 * @param  LONG_TEXT		The message, as Comcode
 * @param  ?array			The destination (recipient) e-mail addresses [array of strings] (NULL: site staff address)
 * @param  ?mixed			The recipient name. Array or string. (NULL: site name)
 * @param  EMAIL			The from address (blank: site staff address)
 * @param  string			The from name (blank: site name)
 * @param  integer		The message priority (1=urgent, 3=normal, 5=low)
 * @range  1 5
 * @param  ?array			An list of attachments (each attachment being a map, path=>filename) (NULL: none)
 * @param  boolean		Whether to NOT CC to the CC address
 * @param  ?MEMBER		Convert comcode->tempcode as this member (a privilege thing: we don't want people being able to use admin rights by default!) (NULL: guest)
 * @param  boolean		Replace above with arbitrary admin
 * @param  boolean		HTML-only
 * @param  boolean		Whether to bypass queueing, because this code is running as a part of the queue management tools
 * @param  ID_TEXT		The template used to show the email
 * @param  boolean		Whether to bypass queueing
 * @return ?tempcode		A full page (not complete XHTML) piece of tempcode to output (NULL: it worked so no tempcode message)
 */
function mail_wrap($subject_tag, $message_raw, $to_email = NULL, $to_name = NULL, $from_email = '', $from_name = '', $priority = 3, $attachments = NULL, $no_cc = false, $as = NULL, $as_admin = false, $in_html = false, $coming_out_of_queue = false, $mail_template = 'MAIL', $bypass_queue = false)
{
    if (get_option('smtp_sockets_use') == '0') {
        return non_overrided__mail_wrap($subject_tag, $message_raw, $to_email, $to_name, $from_email, $from_name, $priority, $attachments, $no_cc, $as, $as_admin, $in_html, $coming_out_of_queue);
    }
    if (running_script('stress_test_loader')) {
        return NULL;
    }
    if (is_null($bypass_queue)) {
        $bypass_queue = $priority < 3 || strpos(serialize($attachments), 'tmpfile') !== false;
    }
    global $EMAIL_ATTACHMENTS;
    $EMAIL_ATTACHMENTS = array();
    require_code('site');
    require_code('mime_types');
    if (is_null($as)) {
        $as = $GLOBALS['FORUM_DRIVER']->get_guest_id();
    }
    if (!$coming_out_of_queue) {
        $GLOBALS['SITE_DB']->query('DELETE FROM ' . get_table_prefix() . 'logged_mail_messages WHERE m_date_and_time<' . strval(time() - 60 * 60 * 24 * 14) . ' AND m_queued=0');
        // Log it all for 2 weeks, then delete
        $through_queue = !$bypass_queue && (get_option('mail_queue_debug') === '1' || get_option('mail_queue') === '1' && cron_installed());
        $GLOBALS['SITE_DB']->query_insert('logged_mail_messages', array('m_subject' => $subject_tag, 'm_message' => $message_raw, 'm_to_email' => serialize($to_email), 'm_to_name' => serialize($to_name), 'm_from_email' => $from_email, 'm_from_name' => $from_name, 'm_priority' => 3, 'm_attachments' => serialize($attachments), 'm_no_cc' => $no_cc ? 1 : 0, 'm_as' => $as, 'm_as_admin' => $as_admin ? 1 : 0, 'm_in_html' => $in_html ? 1 : 0, 'm_date_and_time' => time(), 'm_member_id' => get_member(), 'm_url' => get_self_url(true), 'm_queued' => $through_queue ? 1 : 0, 'm_template' => $mail_template));
        if ($through_queue) {
            return NULL;
        }
    }
    if (count($attachments) == 0) {
        $attachments = NULL;
    }
    global $SENDING_MAIL;
    if ($SENDING_MAIL) {
        return NULL;
    }
    $SENDING_MAIL = true;
    // To and from, and language
    $staff_address = get_option('staff_address');
    if (is_null($to_email)) {
        $to_email = array($staff_address);
    }
    $to_email_new = array();
    foreach ($to_email as $test_address) {
        if ($test_address != '') {
            $to_email_new[] = $test_address;
        }
    }
    $to_email = $to_email_new;
    if ($to_email == array()) {
        $SENDING_MAIL = false;
        return NULL;
    }
    if ($to_email[0] == $staff_address) {
        $lang = get_site_default_lang();
    } else {
        $lang = user_lang();
        if (method_exists($GLOBALS['FORUM_DRIVER'], 'get_member_from_email_address')) {
            $member_id = $GLOBALS['FORUM_DRIVER']->get_member_from_email_address($to_email[0]);
            if (!is_null($member_id)) {
                $lang = get_lang($member_id);
            }
        }
    }
    if (is_null($to_name)) {
        if ($to_email[0] == $staff_address) {
            $to_name = get_site_name();
        } else {
            $to_name = '';
        }
    }
    if ($from_email == '') {
        $from_email = get_option('staff_address');
    }
    if ($from_name == '') {
        $from_name = get_site_name();
    }
    $theme = method_exists($GLOBALS['FORUM_DRIVER'], 'get_theme') ? $GLOBALS['FORUM_DRIVER']->get_theme() : 'default';
    if ($theme == 'default') {
        $theme = $GLOBALS['FORUM_DRIVER']->get_theme('');
//.........这里部分代码省略.........
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:mail.php


示例14: _helper_make_post_forum_topic

/**
 * Makes a post in the specified forum, in the specified topic according to the given specifications. If the topic doesn't exist, it is created along with a spacer-post.
 * Spacer posts exist in order to allow staff to delete the first true post in a topic. Without spacers, this would not be possible with most forum systems. They also serve to provide meta information on the topic that cannot be encoded in the title (such as a link to the content being commented upon).
 *
 * @param  object			Link to the real forum driver
 * @param  SHORT_TEXT	The forum name
 * @param  SHORT_TEXT	The topic identifier (usually <content-type>_<content-id>)
 * @param  MEMBER			The member ID
 * @param  LONG_TEXT		The post title
 * @param  LONG_TEXT		The post content in Comcode format
 * @param  string			The topic title; must be same as content title if this is for a comment topic
 * @param  string			This is put together with the topic identifier to make a more-human-readable topic title or topic description (hopefully the latter and a $content_title title, but only if the forum supports descriptions)
 * @param  ?URLPATH		URL to the content (NULL: do not make spacer post)
 * @param  ?TIME			The post time (NULL: use current time)
 * @param  ?IP				The post IP address (NULL: use current members IP address)
 * @param  ?BINARY		Whether the post is validated (NULL: unknown, find whether it needs to be marked unvalidated initially). This only works with the OCF driver.
 * @param  ?BINARY		Whether the topic is validated (NULL: unknown, find whether it needs to be marked unvalidated initially). This only works with the OCF driver.
 * @param  boolean		Whether to skip post checks
 * @param  SHORT_TEXT	The name of the poster
 * @param  ?AUTO_LINK	ID of post being replied to (NULL: N/A)
 * @param  boolean		Whether the reply is only visible to staff
 * @param  ?ID_TEXT		DO NOT send notifications to: The notification code (NULL: no restriction)
 * @param  ?SHORT_TEXT	DO NOT send notifications to: The category within the notification code (NULL: none / no restriction)
 * @return array			Topic ID (may be NULL), and whether a hidden post has been made
 */
function _helper_make_post_forum_topic($this_ref, $forum_name, $topic_identifier, $member_id, $post_title, $post, $content_title, $topic_identifier_encapsulation_prefix, $content_url, $time, $ip, $validated, $topic_validated, $skip_post_checks, $poster_name_if_guest, $parent_id, $staff_only, $no_notify_for__notification_code, $no_notify_for__code_category)
{
    if (is_null($time)) {
        $time = time();
    }
    if (is_null($ip)) {
        $ip = get_ip_address();
    }
    require_code('comcode_check');
    check_comcode($post, NULL, false, NULL, true);
    require_code('ocf_topics');
    require_code('ocf_posts');
    //require_code('ocf_forums');
    require_lang('ocf');
    require_code('ocf_posts_action');
    require_code('ocf_posts_action2');
    if (!is_integer($forum_name)) {
        $forum_id = $this_ref->forum_id_from_name($forum_name);
        if (is_null($forum_id)) {
            warn_exit(do_lang_tempcode('MISSING_FORUM', escape_html($forum_name)));
        }
    } else {
        $forum_id = (int) $forum_name;
    }
    $topic_id = $this_ref->find_topic_id_for_topic_identifier($forum_name, $topic_identifier);
    $update_caching = false;
    $support_attachments = false;
    if (!running_script('stress_test_loader') && get_page_name() != 'admin_import') {
        $update_caching = true;
        $support_attachments = true;
    }
    if (is_null($topic_id)) {
        $is_starter = true;
        require_code('ocf_topics_action');
        $topic_id = ocf_make_topic($forum_id, $topic_identifier_encapsulation_prefix . ': #' . $topic_identifier, '', $topic_validated, 1, 0, 0, 0, NULL, NULL, false, 0, NULL, $content_url);
        if (strpos($topic_identifier, ':') !== false) {
            // Sync comment_posted ones to also monitor the forum ones; no need for opposite way as comment ones already trigger forum ones
            $start = 0;
            $max = 300;
            require_code('notifications');
            $ob = _get_notification_ob_for_code('comment_posted');
            do {
                list($members, $possibly_has_more) = $ob->list_members_who_have_enabled('comment_posted', $topic_identifier, NULL, $start, $max);
                foreach ($members as $to_member_id => $setting) {
                    enable_notifications('ocf_topic', strval($topic_id), $to_member_id);
                }
                $start += $max;
            } while ($possibly_has_more);
        }
        // Make spacer post
        if (!is_null($content_url)) {
            $spacer_title = $content_title;
            $home_link = hyperlink($content_url, escape_html($content_title));
            $spacer_post = '[semihtml]' . do_lang('SPACER_POST', $home_link->evaluate(), '', '', get_site_default_lang()) . '[/semihtml]';
            ocf_make_post($topic_id, $spacer_title, $spacer_post, 0, true, 1, 0, do_lang('SYSTEM'), $ip, $time, db_get_first_id(), NULL, NULL, NULL, false, $update_caching, $forum_id, $support_attachments, $content_title, 0, NULL, false, false, false, false);
            $is_starter = false;
        }
        $is_new = true;
    } else {
        $is_starter = false;
        $is_new = false;
    }
    $GLOBALS['LAST_TOPIC_ID'] = $topic_id;
    $GLOBALS['LAST_TOPIC_IS_NEW'] = $is_new;
    if ($post == '') {
        return array(NULL, false);
    }
    ocf_check_post($post, $topic_id, $member_id);
    $poster_name = $poster_name_if_guest;
    if ($poster_name == '') {
        $poster_name = $this_ref->get_username($member_id);
    }
    $post_id = ocf_make_post($topic_id, $post_title, $post, 0, $is_starter, $validated, 0, $poster_name, $ip, $time, $member_id, $staff_only ? $GLOBALS['FORUM_DRIVER']->get_guest_id() : NULL, NULL, NULL, false, $update_caching, $forum_id, $support_attachments, $content_title, 0, NULL, false, $skip_post_checks, false, false, $parent_id);
    $GLOBALS['LAST_POST_ID'] = $post_id;
    if ($is_new) {
//.........这里部分代码省略.........
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:ocf_forum_driver_helper.php


示例15: get_self_url

/**
 * Get a well formed URL equivalent to the current URL.
 *
 * @param  boolean		Whether to evaluate the URL (so as we don't return tempcode)
 * @param  boolean		Whether to direct to the default page if there was a POST request leading to where we are now (i.e. to avoid missing post fields when we go to this URL)
 * @param  ?array			A map of extra parameters for the URL (NULL: none)
 * @param  boolean		Whether to also keep POSTed data, in the GET request (useful if either_param is used to get the data instead of post_param - of course the POST data must be of the not--persistant-state-changing variety)
 * @param  boolean		Whether to avoid mod_rewrite (sometimes essential so we can assume the standard URL parameter addition scheme in templates)
 * @return mixed			The URL (tempcode or string)
 */
function get_self_url($evaluate = false, $root_if_posted = false, $extra_params = NULL, $posted_too = false, $avoid_remap = false)
{
    global $SELF_URL_CACHED;
    $cacheable = $evaluate && !$root_if_posted && $extra_params === NULL && !$posted_too && !$avoid_remap;
    if ($cacheable && $SELF_URL_CACHED !== NULL) {
        return $SELF_URL_CACHED;
    }
    if (isset($_SERVER['PHP_SELF']) || isset($_ENV['PHP_SELF'])) {
        if (running_script('execute_temp')) {
            return get_self_url_easy();
        }
    }
    if ($extra_params === NULL) {
        $extra_params = array();
    }
    if ($posted_too) {
        $post_array = array();
        foreach ($_POST as $key => $val) {
            if (is_array($val)) {
                continue;
            }
            if (get_magic_quotes_gpc()) {
                $val = stripslashes($val);
            }
            $post_array[$key] = $val;
        }
        $extra_params = array_merge($post_array, $extra_params);
    }
    $page = '_SELF';
    if ($root_if_posted && count($_POST) != 0) {
        $page = '';
    }
    $params = array('page' => $page);
    foreach ($extra_params as $key => $val) {
        if ($val === NULL) {
            unset($params[$key]);
        }
        $params[$key] = $val;
    }
    $url = build_url($params, '_SELF', NULL, true, $avoid_remap);
    if ($evaluate) {
        $ret = $url->evaluate();
        if ($cacheable) {
            $SELF_URL_CACHED = $ret;
        }
        return $ret;
    }
    return $url;
}

鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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