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


PHP object_factory函数代码示例

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


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

示例1: 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

示例2: run

 /**
  * Standard modular run function for CRON hooks. Searches for tasks to perform.
  */
 function run()
 {
     if (get_value('implicit_usergroup_sync') === '1') {
         $last = get_value('last_implicit_sync');
         if (is_null($last) || intval($last) < time() - 60 * 60) {
             $hooks = find_all_hooks('systems', 'ocf_implicit_usergroups');
             foreach (array_keys($hooks) as $hook) {
                 require_code('hooks/systems/ocf_implicit_usergroups/' . $hook);
                 $ob = object_factory('Hook_implicit_usergroups_' . $hook);
                 $group_id = $ob->get_bound_group_id();
                 $GLOBALS['FORUM_DB']->query_delete('f_group_members', array('gm_group_id' => $group_id));
                 $list = $ob->get_member_list();
                 if (!is_null($list)) {
                     foreach ($list as $member_row) {
                         $GLOBALS['FORUM_DB']->query_insert('f_group_members', array('gm_group_id' => $group_id, 'gm_member_id' => $member_row['id'], 'gm_validated' => 1));
                     }
                 } else {
                     $start = 0;
                     do {
                         $members = collapse_1d_complexity('id', $GLOBALS['FORUM_DB']->query_select('f_members', array('id'), NULL, '', 400, $start));
                         foreach ($members as $member_id) {
                             if ($ob->is_member_within($member_id)) {
                                 $GLOBALS['FORUM_DB']->query_insert('f_group_members', array('gm_group_id' => $group_id, 'gm_member_id' => $member_id, 'gm_validated' => 1));
                             }
                         }
                         $start += 400;
                     } while (count($members) == 400);
                 }
             }
             set_value('last_implicit_sync', strval(time()));
         }
     }
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:36,代码来源:implicit_usergroup_sync.php

示例3: run

 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  array	A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists(0, $parameters)) {
         // Load up the relevant block and grab its help output
         $hooks = find_all_hooks('modules', 'admin_occle_commands');
         $hook_return = NULL;
         foreach (array_keys($hooks) as $hook) {
             if ($hook == $parameters[0]) {
                 require_code('hooks/modules/admin_occle_commands/' . filter_naughty_harsh($hook));
                 $object = object_factory('Hook_' . filter_naughty_harsh($hook), true);
                 if (is_null($object)) {
                     continue;
                 }
                 $hook_return = $object->run(array('help' => NULL), array(), $occle_fs);
                 break;
             }
         }
         if (!is_null($hook_return)) {
             return array($hook_return[0], $hook_return[1], $hook_return[2], $hook_return[3]);
         } else {
             return array('', '', '', do_lang('NO_HELP'));
         }
     } else {
         // Output a standard "how to use Occle" help page
         return array('window.open(unescape("' . urlencode('http://ocportal.com/docs' . strval(ocp_version()) . '/pg/tut_occle') . '"),"occle_window1","");', '', do_lang('SUCCESS'), '');
     }
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:35,代码来源:help.php

示例4: run

 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     unset($map);
     require_lang('custom_comcode');
     $tags = array();
     $wmap = array('tag_enabled' => 1);
     if (!has_specific_permission(get_member(), 'comcode_dangerous')) {
         $wmap['tag_dangerous_tag'] = 0;
     }
     $tags = array_merge($tags, $GLOBALS['SITE_DB']->query_select('custom_comcode', array('tag_title', 'tag_description', 'tag_example', 'tag_parameters', 'tag_replace', 'tag_tag', 'tag_dangerous_tag', 'tag_block_tag', 'tag_textual_tag'), $wmap));
     if (isset($GLOBALS['FORUM_DB']) && $GLOBALS['FORUM_DB']->connection_write != $GLOBALS['SITE_DB']->connection_write && get_forum_type() == 'ocf') {
         $tags = array_merge($tags, $GLOBALS['FORUM_DB']->query_select('custom_comcode', array('tag_title', 'tag_description', 'tag_example', 'tag_parameters', 'tag_replace', 'tag_tag', 'tag_dangerous_tag', 'tag_block_tag', 'tag_textual_tag'), $wmap));
     }
     // From Comcode hooks
     $hooks = find_all_hooks('systems', 'comcode');
     foreach (array_keys($hooks) as $hook) {
         require_code('hooks/systems/comcode/' . filter_naughty_harsh($hook));
         $object = object_factory('Hook_comcode_' . filter_naughty_harsh($hook), true);
         $tags[] = $object->get_tag();
     }
     if (!array_key_exists(0, $tags)) {
         return paragraph(do_lang_tempcode('NONE_EM'), '', 'nothing_here');
     }
     $content = new ocp_tempcode();
     foreach ($tags as $tag) {
         $content->attach(do_template('CUSTOM_COMCODE_TAG_ROW', array('_GUID' => '28c257f5d0c596aa828fd9556b0df4a9', 'TITLE' => is_string($tag['tag_title']) ? $tag['tag_title'] : get_translated_text($tag['tag_title']), 'DESCRIPTION' => is_string($tag['tag_description']) ? $tag['tag_description'] : get_translated_text($tag['tag_description']), 'EXAMPLE' => $tag['tag_example'])));
     }
     return do_template('BLOCK_MAIN_CUSTOM_COMCODE_TAGS', array('_GUID' => 'b8d3436e6e5fe679ae9b0a368e607610', 'TAGS' => $content));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:35,代码来源:main_custom_comcode_tags.php

示例5: get_num_unvalidated

 /**
  * Get the number of unvalidated items.
  *
  * @return array		A pair: Number of major things, number of minor things
  */
 function get_num_unvalidated()
 {
     $sum = 0;
     $sum2 = 0;
     $_hooks = find_all_hooks('modules', 'admin_unvalidated');
     foreach (array_keys($_hooks) as $hook) {
         require_code('hooks/modules/admin_unvalidated/' . filter_naughty_harsh($hook));
         $object = object_factory('Hook_unvalidated_' . filter_naughty_harsh($hook), true);
         if (is_null($object)) {
             continue;
         }
         $info = $object->info();
         if (is_null($info)) {
             continue;
         }
         $db = array_key_exists('db', $info) ? $info['db'] : $GLOBALS['SITE_DB'];
         $amount = $db->query_value($info['db_table'], 'COUNT(*)', array($info['db_validated'] => 0));
         if (is_null($info) || array_key_exists('is_minor', $info) && $info['is_minor']) {
             $sum2 += $amount;
         } else {
             $sum += $amount;
         }
     }
     return array($sum, $sum2);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:30,代码来源:unvalidated.php

示例6: init__themewizard

/**
 * Standard code module initialisation function.
 */
function init__themewizard()
{
    global $THEME_WIZARD_IMAGES_CACHE, $THEME_SEED_CACHE, $THEME_DARK_CACHE;
    $THEME_WIZARD_IMAGES_CACHE = array();
    $THEME_SEED_CACHE = array();
    $THEME_DARK_CACHE = array();
    global $THEME_WIZARD_IMAGES, $THEME_WIZARD_IMAGES_NO_WILD;
    $THEME_WIZARD_IMAGES = array();
    $THEME_WIZARD_IMAGES_NO_WILD = array();
    if (function_exists('imagecreatefromgif')) {
        $THEME_WIZARD_IMAGES[] = '';
    }
    $hooks = find_all_hooks('modules', 'admin_themewizard');
    foreach (array_keys($hooks) as $hook) {
        require_code('hooks/modules/admin_themewizard/' . filter_naughty_harsh($hook));
        $ob = object_factory('Hook_admin_themewizard_' . filter_naughty_harsh($hook), true);
        if (is_null($ob)) {
            continue;
        }
        $results = $ob->run();
        if (is_null($results)) {
            continue;
        }
        list($a, $b) = $results;
        $THEME_WIZARD_IMAGES = array_merge($THEME_WIZARD_IMAGES, $a);
        $THEME_WIZARD_IMAGES_NO_WILD = array_merge($THEME_WIZARD_IMAGES_NO_WILD, $b);
    }
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:31,代码来源:themewizard.php

示例7: get_chmod_array

/**
 * Get the list of files that need CHmodding for write access.
 *
 * @return array			The list of files
 */
function get_chmod_array()
{
    global $LANG;
    //	if ((function_exists('ocp_enterprise')) && (ocp_enterprise()))
    //	{
    $extra_files = array('collaboration/pages/html_custom', 'collaboration/pages/html_custom/' . $LANG, 'collaboration/pages/comcode_custom', 'collaboration/pages/comcode_custom/' . $LANG);
    //	} else $extra_files=array();
    if (function_exists('find_all_hooks')) {
        $hooks = find_all_hooks('systems', 'addon_registry');
        $hook_keys = array_keys($hooks);
        foreach ($hook_keys as $hook) {
            //require_code('hooks/systems/addon_registry/'.filter_naughty_harsh($hook));
            //$object=object_factory('Hook_addon_registry_'.filter_naughty_harsh($hook));
            //$extra_files=array_merge($extra_files,$object->get_chmod_array());
            // Save memory compared to above commented code...
            $path = get_custom_file_base() . '/sources/hooks/systems/addon_registry/' . filter_naughty_harsh($hook) . '.php';
            if (!file_exists($path)) {
                $path = get_file_base() . '/sources/hooks/systems/addon_registry/' . filter_naughty_harsh($hook) . '.php';
            }
            $matches = array();
            if (preg_match('#function get_chmod_array\\(\\)\\s*\\{([^\\}]*)\\}#', file_get_contents($path), $matches) != 0) {
                if (!defined('HIPHOP_PHP')) {
                    $extra_files = array_merge($extra_files, eval($matches[1]));
                } else {
                    require_code('hooks/systems/addon_registry/' . $hook);
                    $hook = object_factory('Hook_addon_registry_' . $hook);
                    $extra_files = array_merge($extra_files, $hook->get_chmod_array());
                }
            }
        }
    }
    return array_merge($extra_files, array('safe_mode_temp', 'persistant_cache', 'data_custom/modules/admin_backup', 'data_custom/modules/chat', 'data_custom/fields.xml', 'data_custom/breadcrumbs.xml', 'data_custom/modules/admin_stats', 'data_custom/spelling/write.log', 'data_custom/spelling/output.log', 'data_custom/spelling/personal_dicts', 'themes/map.ini', 'text_custom', 'text_custom/' . $LANG, 'data_custom/modules/chat/chat_last_msg.dat', 'data_custom/modules/chat/chat_last_event.dat', 'lang_cached', 'lang_cached/' . $LANG, 'lang_custom', 'lang_custom/' . $LANG, 'data_custom/errorlog.php', 'ocp_sitemap.xml', 'data_custom/permissioncheckslog.php', 'pages/html_custom', 'site/pages/html_custom', 'docs/pages/html_custom', 'adminzone/pages/html_custom', 'forum/pages/html_custom', 'cms/pages/html_custom', 'pages/html_custom/' . $LANG, 'site/pages/html_custom/' . $LANG, 'docs/pages/html_custom/' . $LANG, 'adminzone/pages/html_custom/' . $LANG, 'forum/pages/html_custom/' . $LANG, 'cms/pages/html_custom/' . $LANG, 'pages/comcode_custom', 'site/pages/comcode_custom', 'docs/pages/comcode_custom', 'adminzone/pages/comcode_custom', 'forum/pages/comcode_custom', 'cms/pages/comcode_custom', 'pages/comcode_custom/' . $LANG, 'site/pages/comcode_custom/' . $LANG, 'docs/pages/comcode_custom/' . $LANG, 'adminzone/pages/comcode_custom/' . $LANG, 'forum/pages/comcode_custom/' . $LANG, 'cms/pages/comcode_custom/' . $LANG, 'themes/default/css_custom', 'themes/default/images_custom', 'themes/default/templates_custom', 'themes/default/templates_cached', 'themes/default/templates_cached/' . $LANG, 'themes/default/theme.ini', 'uploads/incoming', 'uploads/website_specific', 'uploads/personal_sound_effects', 'uploads/banners', 'uploads/downloads', 'uploads/galleries', 'uploads/watermarks', 'uploads/grepimages', 'uploads/galleries_thumbs', 'uploads/iotds', 'uploads/iotds_thumbs', 'uploads/catalogues', 'uploads/attachments', 'uploads/attachments_thumbs', 'uploads/auto_thumbs', 'uploads/ocf_avatars', 'uploads/ocf_cpf_upload', 'uploads/ocf_photos', 'uploads/ocf_photos_thumbs', 'uploads/filedump', 'info.php', 'exports/backups', 'exports/file_backups', 'exports/mods', 'imports/mods', 'site/pages/html_custom/' . $LANG . '/download_tree_made.htm', 'site/pages/html_custom/' . $LANG . '/cedi_tree_made.htm'));
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:38,代码来源:inst_special.php

示例8: run

 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     require_code('textfiles');
     $file = array_key_exists('param', $map) ? $map['param'] : 'admin_notes';
     $title = array_key_exists('title', $map) ? $map['title'] : do_lang('NOTES');
     $lang_none = array_key_exists('lang_none', $map) ? $map['lang_none'] : '0';
     $scrolls = array_key_exists('scrolls', $map) ? $map['scrolls'] : '0';
     $lang = $lang_none == '1' ? NULL : '';
     $file = filter_naughty($file, true);
     $new = post_param('new', NULL);
     if (!is_null($new)) {
         $hooks = find_all_hooks('blocks', 'main_notes');
         foreach (array_keys($hooks) as $hook) {
             require_code('hooks/blocks/main_notes/' . filter_naughty_harsh($hook));
             $ob = object_factory('Hook_notes_' . filter_naughty_harsh($hook), true);
             if (is_null($ob)) {
                 continue;
             }
             $ob->run($file);
         }
         write_text_file($file, $lang, $new);
         log_it('NOTES', $file);
         attach_message(do_lang_tempcode('SUCCESS'), 'inform');
     }
     $contents = read_text_file($file, $lang, true);
     $post_url = get_self_url();
     $map_comcode = '';
     foreach ($map as $key => $val) {
         $map_comcode .= ' ' . $key . '="' . addslashes($val) . '"';
     }
     return do_template('BLOCK_MAIN_NOTES', array('_GUID' => 'f737053505de3bd8ccfe806ec014b8fb', 'TITLE' => $title, 'BLOCK_NAME' => 'main_notes', 'MAP' => $map_comcode, 'CONTENTS' => $contents, 'SCROLLS' => array_key_exists('scrolls', $map) && $map['scrolls'] == '1', 'URL' => $post_url));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:38,代码来源:main_notes.php

示例9: run

 /**
  * Standard modular run function.
  *
  * @return tempcode	The result of execution.
  */
 function run()
 {
     require_lang('unvalidated');
     $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/unvalidated';
     $GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_censor';
     $_title = get_page_title('UNVALIDATED_RESOURCES');
     $out = new ocp_tempcode();
     require_code('form_templates');
     $_hooks = find_all_hooks('modules', 'admin_unvalidated');
     foreach (array_keys($_hooks) as $hook) {
         require_code('hooks/modules/admin_unvalidated/' . filter_naughty_harsh($hook));
         $object = object_factory('Hook_unvalidated_' . filter_naughty_harsh($hook), true);
         if (is_null($object)) {
             continue;
         }
         $info = $object->info();
         if (is_null($info)) {
             continue;
         }
         $identifier_select = is_array($info['db_identifier']) ? implode(',', $info['db_identifier']) : $info['db_identifier'];
         $db = array_key_exists('db', $info) ? $info['db'] : $GLOBALS['SITE_DB'];
         $rows = $db->query('SELECT ' . $identifier_select . (array_key_exists('db_title', $info) ? ',' . $info['db_title'] : '') . ' FROM ' . $db->get_table_prefix() . $info['db_table'] . ' WHERE ' . $info['db_validated'] . '=0', 100);
         $content = new ocp_tempcode();
         foreach ($rows as $row) {
             if (is_array($info['db_identifier'])) {
                 $id = '';
                 foreach ($info['db_identifier'] as $_id) {
                     if ($id != '') {
                         $id .= ':';
                     }
                     $id .= $row[$_id];
                 }
             } else {
                 $id = $row[$info['db_identifier']];
             }
             if (array_key_exists('db_title', $info)) {
                 $title = $row[$info['db_title']];
                 if ($info['db_title_dereference']) {
                     $title = get_translated_text($title, $db);
                 }
                 // May actually be comcode (can't be certain), but in which case it will be shown as source
             } else {
                 $title = '#' . (is_integer($id) ? strval($id) : $id);
             }
             if ($title == '') {
                 $title = '#' . strval($id);
             }
             $content->attach(form_input_list_entry(is_integer($id) ? strval($id) : $id, false, strip_comcode($title)));
         }
         $post_url = build_url(array('page' => $info['edit_module'], 'type' => $info['edit_type'], 'validated' => 1), get_module_zone($info['edit_module']), NULL, false, true);
         $fields = form_input_list(do_lang_tempcode('EDIT'), do_lang_tempcode('DESCRIPTION_EDIT'), $info['edit_identifier'], $content);
         if (!$content->is_empty()) {
             // Could debate whether to include "'TARGET'=>'_blank',". However it does redirect back, so it's a nice linear process like this. If it was new window it could be more efficient, but also would confuse people with a lot of new windows opening and not closing.
             $content = do_template('FORM', array('_GUID' => '51dcee39273a0fee29569190344f2e41', 'GET' => true, 'HIDDEN' => '', 'SUBMIT_NAME' => do_lang_tempcode('EDIT'), 'FIELDS' => $fields, 'URL' => $post_url, 'TEXT' => ''));
         }
         $out->attach(do_template('UNVALIDATED_SECTION', array('_GUID' => '838240008e190b9cbaa0280fbddd6baf', 'TITLE' => $info['title'], 'CONTENT' => $content)));
     }
     return do_template('UNVALIDATED_SCREEN', array('_GUID' => '4e971f1c8851b821af030b5c7bbcb3fb', 'TITLE' => $_title, 'SECTIONS' => $out));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:64,代码来源:admin_unvalidated.php

示例10: send_validation_request

/**
 * Send (by e-mail) a validation request for a submitted item to the admin.
 *
 * @param  ID_TEXT		The validation request will say one of this type has been submitted. By convention it is the language code of what was done, e.g. ADD_DOWNLOAD
 * @param  ?ID_TEXT		The table saved into (NULL: unknown)
 * @param  boolean		Whether the ID field is not an integer
 * @param  ID_TEXT		The validation request will say this ID has been submitted
 * @param  tempcode		The validation request will link to this URL
 * @param  ?MEMBER		Member doing the submitting (NULL: current member)
 */
function send_validation_request($type, $table, $non_integer_id, $id, $url, $member_id = NULL)
{
    $good = NULL;
    if (!is_null($table)) {
        $_hooks = find_all_hooks('modules', 'admin_unvalidated');
        foreach (array_keys($_hooks) as $hook) {
            require_code('hooks/modules/admin_unvalidated/' . filter_naughty_harsh($hook));
            $object = object_factory('Hook_unvalidated_' . filter_naughty_harsh($hook), true);
            if (is_null($object)) {
                continue;
            }
            $info = $object->info();
            if (is_null($info)) {
                continue;
            }
            if ($info['db_table'] == $table) {
                $good = $info;
                break;
            }
        }
    }
    $title = mixed();
    $title = '';
    if (!is_null($good) && !is_array($good['db_identifier'])) {
        $db = array_key_exists('db', $good) ? $good['db'] : $GLOBALS['SITE_DB'];
        $where = $good['db_identifier'] . '=' . $id;
        if ($non_integer_id) {
            $where = db_string_equal_to($good['db_identifier'], $id);
        }
        $rows = $db->query('SELECT ' . $good['db_identifier'] . (array_key_exists('db_title', $good) ? ',' . $good['db_title'] : '') . ' FROM ' . $db->get_table_prefix() . $good['db_table'] . ' WHERE ' . $where, 100);
        if (array_key_exists('db_title', $good)) {
            $title = $rows[0][$good['db_title']];
            if ($good['db_title_dereference']) {
                $title = get_translated_text($title, $db);
            }
            // May actually be comcode (can't be certain), but in which case it will be shown as source
        } else {
            $title = '#' . (is_integer($id) ? strval($id) : $id);
        }
    }
    if ($title == '') {
        $title = '#' . (is_integer($id) ? strval($id) : $id);
    }
    if (is_null($member_id)) {
        $member_id = get_member();
    }
    require_lang('unvalidated');
    $_type = do_lang($type, NULL, NULL, NULL, NULL, false);
    if (!is_null($_type)) {
        $type = $_type;
    }
    $comcode = do_template('VALIDATION_REQUEST', array('_GUID' => '1885be371b2ff7810287715ef2f7b948', 'USERNAME' => $GLOBALS['FORUM_DRIVER']->get_username($member_id), 'TYPE' => $type, 'ID' => $id, 'URL' => $url), get_site_default_lang());
    require_code('notifications');
    $subject = do_lang('UNVALIDATED_TITLE', $title, '', '', get_site_default_lang());
    $message = $comcode->evaluate(get_site_default_lang(), false);
    dispatch_notification('needs_validation', NULL, $subject, $message);
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:67,代码来源:submit.php

示例11: find_installed_addons

/**
 * Find all the installed addons.
 *
 * @return array		List of maps describing the available addons (simulating partial-extended versions of the traditional ocPortal-addon database row)
 */
function find_installed_addons()
{
    // Find installed addons- database registration method
    $_rows = $GLOBALS['SITE_DB']->query_select('addons', array('*'));
    $addons_installed = array();
    foreach ($_rows as $row) {
        $files_rows = array_unique(collapse_1d_complexity('filename', $GLOBALS['SITE_DB']->query_select('addons_files', array('filename'), array('addon_name' => $row['addon_name']))));
        $row['addon_files'] = '';
        foreach ($files_rows as $file_row_name) {
            $row['addon_files'] .= $file_row_name . chr(10);
        }
        $addons_installed[$row['addon_name']] = $row;
    }
    // Find installed addons- file system method (for ocProducts addons). ocProducts addons don't need to be in the DB, although they will be if they are (re)installed after the original ocPortal installation finished.
    $hooks = find_all_hooks('systems', 'addon_registry');
    foreach (array_keys($hooks) as $hook) {
        if (substr($hook, 0, 4) != 'core') {
            if (false) {
                require_code('hooks/systems/addon_registry/' . filter_naughty_harsh($hook));
                $hook_ob = object_factory('Hook_addon_registry_' . $hook, true);
                if (is_null($hook_ob)) {
                    continue;
                }
                $description = $hook_ob->get_description();
                $file_list = $hook_ob->get_file_list();
                $version = $hook_ob->get_version();
            } else {
                $path = get_file_base() . '/sources_custom/hooks/systems/addon_registry/' . filter_naughty_harsh($hook) . '.php';
                if (!file_exists($path)) {
                    $path = get_file_base() . '/sources/hooks/systems/addon_registry/' . filter_naughty_harsh($hook) . '.php';
                }
                if (!file_exists($path)) {
                    continue;
                }
                // Race condition?
                $_hook_bits = extract_module_functions($path, array('get_description', 'get_file_list', 'get_version'));
                if (is_null($_hook_bits[0])) {
                    $description = '';
                } else {
                    $description = is_array($_hook_bits[0]) ? call_user_func_array($_hook_bits[0][0], $_hook_bits[0][1]) : @eval($_hook_bits[0]);
                }
                if (is_null($_hook_bits[1])) {
                    $file_list = array();
                } else {
                    $file_list = is_array($_hook_bits[1]) ? call_user_func_array($_hook_bits[1][0], $_hook_bits[1][1]) : @eval($_hook_bits[1]);
                }
                if (is_null($_hook_bits[2])) {
                    $version = '';
                } else {
                    $version = is_array($_hook_bits[2]) ? call_user_func_array($_hook_bits[2][0], $_hook_bits[2][1]) : @eval($_hook_bits[2]);
                }
            }
            $addons_installed[$hook] = array('addon_name' => $hook, 'addon_author' => 'Core Team', 'addon_organisation' => 'ocProducts', 'addon_version' => $version == ocp_version_number() ? ocp_version_full() : float_format($version, 1), 'addon_description' => $description, 'addon_install_time' => filemtime($path), 'addon_files' => implode(chr(10), make_global_file_list($file_list)));
        }
    }
    return $addons_installed;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:62,代码来源:addons.php

示例12: 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

示例13: run

 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     // Loads up correct hook and returns rendering
     require_lang('custom_comcode');
     $type_id = $map['param'];
     if (!file_exists(get_file_base() . '/sources/hooks/blocks/main_custom_gfx/' . filter_naughty_harsh($type_id) . '.php') && !file_exists(get_file_base() . '/sources_custom/hooks/blocks/main_custom_gfx/' . filter_naughty_harsh($type_id) . '.php')) {
         return paragraph(do_lang_tempcode('NO_SUCH_RENDERER', $type_id));
     }
     require_code('hooks/blocks/main_custom_gfx/' . filter_naughty_harsh($type_id), true);
     $object = object_factory('Hook_main_custom_gfx_' . $type_id);
     return $object->run($map, $this);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:18,代码来源:main_custom_gfx.php

示例14: get_realtime_events

/**
 * Get all the events within a timestamp range.
 *
 * @param  TIME			From time (inclusive).
 * @param  TIME			To time (inclusive).
 * @return array			List of template parameter sets (perfect for use in a Tempcode LOOP).
 */
function get_realtime_events($from, $to)
{
    //restrictify();
    $drops = array();
    $hooks = find_all_hooks('systems', 'realtime_rain');
    foreach (array_keys($hooks) as $hook) {
        require_code('hooks/systems/realtime_rain/' . filter_naughty($hook));
        $ob = object_factory('Hook_realtime_rain_' . $hook);
        $drops = array_merge($drops, $ob->run($from, $to));
    }
    return $drops;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:19,代码来源:realtime_rain.php

示例15: 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)
 {
     $title = do_lang_tempcode('EDIT_EM');
     require_lang('ocf');
     require_css('ocf');
     $order = 200;
     if ($leave_to_ajax_if_possible && strtoupper(ocp_srv('REQUEST_METHOD')) != 'POST') {
         return array($title, NULL, $order);
     }
     $tabs = array();
     $hooks = find_all_hooks('systems', 'profiles_tabs_edit');
     if (isset($hooks['settings'])) {
         $hooks = array('settings' => $hooks['settings']) + $hooks;
     }
     foreach (array_keys($hooks) as $hook) {
         require_code('hooks/systems/profiles_tabs_edit/' . $hook);
         $ob = object_factory('Hook_Profiles_Tabs_Edit_' . $hook);
         if ($ob->is_active($member_id_of, $member_id_viewing)) {
             $tabs[] = $ob->render_tab($member_id_of, $member_id_viewing, $leave_to_ajax_if_possible);
         }
     }
     if ($leave_to_ajax_if_possible) {
         return array($title, NULL, $order);
     }
     global $M_SORT_KEY;
     $M_SORT_KEY = 4;
     usort($tabs, 'multi_sort');
     $javascript = '';
     $hidden = new ocp_tempcode();
     // Session ID check, if saving
     if (count($_POST) != 0 && count($tabs) != 0) {
         global $SESSION_CONFIRMED;
         if ($SESSION_CONFIRMED == 0) {
             access_denied('SESSION', '', true);
         }
     }
     $_tabs = array();
     $first = true;
     foreach ($tabs as $i => $tab) {
         if (is_null($tab)) {
             continue;
         }
         $javascript .= $tab[3];
         if (isset($tab[5])) {
             $hidden->attach($tab[5]);
         }
         $_tabs[] = array('TAB_TITLE' => $tab[0], 'TAB_FIELDS' => $tab[1], 'TAB_TEXT' => $tab[2], 'TAB_FIRST' => $first, 'TAB_LAST' => !array_key_exists($i + 1, $tabs));
         $first = false;
     }
     $url = build_url(array('page' => '_SELF'), '_SELF', NULL, true, false, false);
     $content = do_template('OCF_MEMBER_PROFILE_EDIT', array('JAVASCRIPT' => $javascript, 'HIDDEN' => $hidden, 'URL' => $url, 'SUBMIT_NAME' => do_lang_tempcode('SAVE'), 'AUTOCOMPLETE' => false, 'SKIP_VALIDATION' => true, 'TABS' => $_tabs));
     return array($title, $content, $order);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:61,代码来源:edit.php


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