本文整理汇总了PHP中find_script函数的典型用法代码示例。如果您正苦于以下问题:PHP find_script函数的具体用法?PHP find_script怎么用?PHP find_script使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了find_script函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run_start
/**
* Standard aed_module run_start.
*
* @param ID_TEXT The type of module execution
* @return tempcode The output of the run
*/
function run_start($type)
{
$GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/emoticons';
$GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_emoticons';
$this->add_one_label = do_lang_tempcode('ADD_EMOTICON');
$this->edit_this_label = do_lang_tempcode('EDIT_THIS_EMOTICON');
$this->edit_one_label = do_lang_tempcode('EDIT_EMOTICON');
require_lang('dearchive');
require_code('images');
if (get_forum_type() != 'ocf') {
warn_exit(do_lang_tempcode('NO_OCF'));
} else {
ocf_require_all_forum_stuff();
}
require_code('ocf_general_action');
require_code('ocf_general_action2');
if ($type == 'ad') {
require_javascript('javascript_ajax');
$script = find_script('snippet');
$this->javascript = "\n\t\t\t\tvar form=document.getElementById('main_form');\n\t\t\t\tform.old_submit=form.onsubmit;\n\t\t\t\tform.onsubmit=function()\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.getElementById('submit_button').disabled=true;\n\t\t\t\t\t\tvar url='" . addslashes($script) . "?snippet=exists_emoticon&name='+window.encodeURIComponent(form.elements['code'].value);\n\t\t\t\t\t\tif (!do_ajax_field_test(url))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdocument.getElementById('submit_button').disabled=false;\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdocument.getElementById('submit_button').disabled=false;\n\t\t\t\t\t\tif (typeof form.old_submit!='undefined' && form.old_submit) return form.old_submit();\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t};\n\t\t\t";
}
if ($type == 'misc') {
return $this->misc();
}
if ($type == 'import') {
return $this->import();
}
if ($type == '_import') {
return $this->_import();
}
return new ocp_tempcode();
}
示例2: render_field_value
/**
* Convert a field value to something renderable.
*
* @param array The field details
* @param mixed The raw value
* @return mixed Rendered field (tempcode or string)
*/
function render_field_value($field, $ev)
{
if (is_object($ev)) {
return $ev;
}
if ($ev == '') {
return '';
}
$original_filename = basename($ev);
$download_url = (url_is_local($ev) ? get_custom_base_url() . '/' : '') . $ev;
if (strpos($ev, '::') !== false) {
list($ev, $original_filename) = explode('::', $ev);
$keep = symbol_tempcode('KEEP');
$download_url = find_script('catalogue_file') . '?original_filename=' . urlencode($original_filename) . '&file=' . urlencode(basename($ev)) . $keep->evaluate();
}
$extension = get_file_extension($ev);
require_code('mime_types');
$mime_type = get_mime_type($extension);
if ((strpos($mime_type, 'video') !== false || strpos($mime_type, 'audio') !== false) && addon_installed('galleries')) {
// Video/Audio HTML
switch ($mime_type) {
case 'video/quicktime':
$tpl = 'GALLERY_VIDEO_QT';
break;
case 'audio/x-pn-realaudio':
$tpl = 'GALLERY_VIDEO_RM';
break;
default:
$tpl = 'GALLERY_VIDEO_GENERAL';
}
return do_template($tpl, array('URL' => url_is_local($ev) ? get_custom_base_url() . '/' . $ev : $ev, 'WIDTH' => get_option('default_video_width'), 'HEIGHT' => get_option('default_video_height'), 'MIME_TYPE' => $mime_type));
}
return hyperlink($download_url, $original_filename, true, true);
}
示例3: bookmarks_script
/**
* Script to make a bookmark add-form popup.
*/
function bookmarks_script()
{
require_lang('bookmarks');
$type = get_param('type');
switch ($type) {
case '_ad':
$title = get_page_title('ADD_BOOKMARK');
$folder = post_param('folder_new', '');
if ($folder == '') {
$folder = post_param('folder');
}
if ($folder == '!') {
$folder = '';
}
add_bookmark(get_member(), $folder, post_param('title'), post_param('page_link'));
$content = inform_screen($title, do_lang_tempcode('SUCCESS'));
$content->attach('<script type="text/javascript">// <![CDATA[
if (window.opener) window.close();
//]]></script>');
break;
default:
$url = find_script('bookmarks') . '?no_redirect=1&type=_ad';
$keep = symbol_tempcode('KEEP');
$url .= $keep->evaluate();
$content = add_bookmark_form($url);
break;
}
$echo = do_template('POPUP_HTML_WRAP', array('TITLE' => do_lang_tempcode('ADD_BOOKMARK'), 'CONTENT' => $content));
$echo->handle_symbol_preprocessing();
$echo->evaluate_echo();
}
示例4: validate_ip_script
/**
* Validate an IP address, indirectly by passing through a confirmation code.
*/
function validate_ip_script()
{
@ob_end_clean();
global $EXTRA_HEAD;
$EXTRA_HEAD->attach('<meta name="robots" content="noindex" />');
// XHTMLXHTML
$keep = keep_symbol(array('1'));
$code = either_param('code', '');
if ($code == '') {
$title = get_page_title('CONFIRM');
require_code('form_templates');
$fields = new ocp_tempcode();
$fields->attach(form_input_codename(do_lang_tempcode('CODE'), '', 'code', '', true));
$submit_name = do_lang_tempcode('PROCEED');
$url = find_script('validateip') . $keep;
$middle = do_template('FORM_SCREEN', array('_GUID' => 'd92ce4ec82dc709f920a4ce6760778de', 'TITLE' => $title, 'SKIP_VALIDATION' => true, 'HIDDEN' => '', 'URL' => $url, 'FIELDS' => $fields, 'TEXT' => do_lang_tempcode('MISSING_CONFIRM_CODE'), 'SUBMIT_NAME' => $submit_name));
$echo = globalise($middle, NULL, '', true);
$echo->evaluate_echo();
exit;
}
// If we're still here, we're ok to go
require_lang('ocf');
$test = $GLOBALS['FORUM_DB']->query_value_null_ok('f_member_known_login_ips', 'i_val_code', array('i_val_code' => $code));
if (is_null($test)) {
warn_exit(do_lang_tempcode('ALREADY_VALIDATED'));
}
$GLOBALS['FORUM_DB']->query_update('f_member_known_login_ips', array('i_val_code' => ''), array('i_val_code' => $code), '', 1);
$title = get_page_title('CONFIRM');
$middle = redirect_screen($title, get_base_url() . $keep, do_lang_tempcode('SUCCESS'));
$echo = globalise($middle, NULL, '', true);
$echo->evaluate_echo();
exit;
}
示例5: run
/**
* Standard modular run function.
*
* @return tempcode The result of execution.
*/
function run()
{
$GLOBALS['FEED_URL'] = find_script('backend') . '?mode=authors&filter=';
require_code('authors');
require_lang('authors');
// Decide what we're doing
$type = get_param('type', 'misc');
if ($type == 'misc') {
return $this->show_author();
}
return new ocp_tempcode();
}
示例6: run
/**
* Standard modular run function.
*
* @param MEMBER The ID of the member we are getting link hooks for
* @return array List of tuples for results. Each tuple is: type,title,url
*/
function run($member_id)
{
if (!has_zone_access(get_member(), 'adminzone') && $member_id !== get_member()) {
return array();
}
require_code('ocf_join');
if (!referrer_is_qualified($member_id)) {
return array();
}
require_lang('referrals');
$keep = symbol_tempcode('KEEP');
return array(array('usage', do_lang_tempcode('REFERRALS'), find_script('referrer_report') . '?member_id=' . strval($member_id) . $keep->evaluate()));
}
示例7: internalise_own_screen
/**
* Put the contents of a page inside an iframe. This is typically used when a page is being used to traverse a result-set that spans multiple screens.
*
* @param tempcode The title
* @param ?integer The time between refreshes (NULL: do not refresh)
* @param ?mixed Data. A refresh will only happen if an AJAX-check indicates this data has changed (NULL: no check)
* @return ?tempcode The page output to finish off our current page stream such that it will spawn the iframe (NULL: not internalised)
*/
function internalise_own_screen($title, $refresh_time = NULL, $refresh_if_changed = NULL)
{
if (get_value('no_frames') === '1' || get_param_integer('no_frames', 0) == 1 || get_param_integer('keep_no_frames', 0) == 1) {
return NULL;
}
if (!has_js()) {
return NULL;
}
// We need JS to make this a seamless process
if (strpos(ocp_srv('REQUEST_URI'), '/iframe.php') !== false) {
return NULL;
}
// This is already in the iframe
require_javascript('javascript_ajax');
require_javascript('javascript_iframe_screen');
$url = find_script('iframe') . '?zone=' . rawurlencode(get_zone_name()) . '&wide_high=1&utheme=' . rawurlencode($GLOBALS['FORUM_DRIVER']->get_theme());
foreach (array_merge($_GET, $_POST) as $key => $param) {
if (!is_string($param)) {
continue;
}
if (substr($key, 0, 5) == 'keep_' && skippable_keep($key, $param)) {
continue;
}
if (get_magic_quotes_gpc()) {
$param = stripslashes($param);
}
$url .= '&' . $key . '=' . urlencode($param);
}
if (!is_null($refresh_if_changed)) {
require_javascript('javascript_sound');
$change_detection_url = find_script('change_detection') . '?whatever=1';
foreach ($_GET as $key => $param) {
if (!is_string($param)) {
continue;
}
if (substr($key, 0, 5) == 'keep_' && skippable_keep($key, $param)) {
continue;
}
if (get_magic_quotes_gpc()) {
$param = stripslashes($param);
}
$change_detection_url .= '&' . $key . '=' . urlencode($param);
}
} else {
$refresh_if_changed = '';
$change_detection_url = '';
}
return do_template('IFRAME_SCREEN', array('_GUID' => '06554eb227428fd5c648dee3c5b38185', 'TITLE' => $title, 'REFRESH_IF_CHANGED' => md5(serialize($refresh_if_changed)), 'CHANGE_DETECTION_URL' => $change_detection_url, 'REFRESH_TIME' => is_null($refresh_time) ? '' : strval($refresh_time), 'IFRAME_URL' => $url));
}
示例8: load_lib
function load_lib($relativePath)
{
$fileName = rectify_file_path($relativePath) . ".php";
if (!is_null($script = find_script($fileName))) {
if (!in_array($script, get_included_files())) {
require_once $script;
}
return;
} elseif (!is_null($combined_script = find_script(dirname($fileName) . ".php")) && !in_array($combined_script, get_included_files())) {
if (!in_array($combined_script, get_included_files())) {
require_once $combined_script;
}
return;
}
throw new PHPScriptNotFoundException($fileName);
}
示例9: 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);
}
示例10: authors_script
/**
* Shows an HTML page of all authors clickably.
*/
function authors_script()
{
require_lang('authors');
global $NON_CANONICAL_PARAMS;
$NON_CANONICAL_PARAMS[] = 'max';
$start = get_param_integer('start', 0);
$max = get_param_integer('max', 300);
$author_fields = $GLOBALS['SITE_DB']->query('SELECT m_name,m_table FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'db_meta WHERE m_name LIKE \'' . db_encode_like('%author') . '\'');
$rows = array();
foreach ($author_fields as $field) {
if ($field['m_table'] != 'addons' && $field['m_table'] != 'blocks' && $field['m_table'] != 'modules') {
$rows_new = $GLOBALS['SITE_DB']->query('SELECT DISTINCT ' . $field['m_name'] . ' AS author FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . $field['m_table'] . ' WHERE ' . db_string_not_equal_to($field['m_name'], '') . ' ORDER BY ' . $field['m_name'], $max + $start);
foreach ($rows_new as $a) {
if (!array_key_exists($a['author'], $rows) || $field['m_table'] == 'authors') {
$rows[$a['author']] = $field['m_table'];
}
}
}
}
$rows = array_unique($rows);
$field_name = get_param('field_name');
$content = new ocp_tempcode();
$i = 0;
foreach ($rows as $author => $table) {
if ($i >= $start && $i < $start + $max) {
if ($table == 'authors') {
$content->attach(do_template('AUTHOR_POPUP_WINDOW_DEFINED', array('_GUID' => 'cffa9926cebd3ec2920677266a3299ea', 'FIELD_NAME' => $field_name, 'AUTHOR' => $author)));
} else {
$content->attach(do_template('AUTHOR_POPUP_WINDOW_UNDEFINED', array('_GUID' => '6210be6d1eef4bc2bda7f49947301f97', 'FIELD_NAME' => $field_name, 'AUTHOR' => $author)));
}
}
$i++;
}
if ($content->is_empty()) {
$content = paragraph(do_lang_tempcode('NO_ENTRIES'), 'dfids09fi;lk;3');
}
if ($i >= $start + $max) {
$keep = symbol_tempcode('KEEP');
$next_link = find_script('authors') . '?field_name=' . urlencode($field_name) . '&start=' . strval($start + $max) . '&max=' . strval($max) . $keep->evaluate();
} else {
$next_link = NULL;
}
$echo = do_template('STYLED_HTML_WRAP', array('_GUID' => 'ab8d8c9d276530d82ddd84202aacf32f', 'TITLE' => do_lang_tempcode('CHOOSE_AUTHOR'), 'NEXT_LINK' => $next_link, 'CONTENT' => $content));
$echo->evaluate_echo();
}
示例11: build_bookmarks_menu
/**
* Build a bookmarks menu for the current member.
*
* @return array Faked database rows
*/
function build_bookmarks_menu()
{
require_lang('bookmarks');
$items = array();
$rows = $GLOBALS['SITE_DB']->query_select('bookmarks', array('*'), array('b_owner' => get_member()), 'ORDER BY b_folder');
// For managing existing bookmarks
if (count($rows) != 0) {
$rand_id = mt_rand(0, 1000000);
$_url = build_url(array('page' => 'bookmarks', 'type' => 'misc'), get_module_zone('bookmarks'));
$items[] = array('id' => $rand_id, 'i_parent' => NULL, 'cap' => do_lang('MANAGE_BOOKMARKS'), 'i_url' => $_url, 'i_check_permissions' => 0, 'i_expanded' => 0, 'i_new_window' => 1, 'i_page_only' => '');
}
// For adding a new bookmark
$self_url = get_param('url', '');
if ($self_url == '') {
$self_url = get_self_url(true);
}
$rand_id = mt_rand(0, 1000000);
//$url=build_url(array('page'=>'bookmarks','type'=>'ad','url'=>$self_url,'title'=>get_param('title','',true)),get_module_zone('bookmarks'));
$keep = symbol_tempcode('KEEP');
$url = find_script('bookmarks') . '?no_redirect=1&type=ad&url=' . urlencode(base64_encode($self_url)) . '&title=' . urlencode(get_param('title', '', true)) . $keep->evaluate();
$items[] = array('id' => $rand_id, 'i_parent' => NULL, 'cap' => do_lang('ADD_BOOKMARK'), 'i_popup' => 1, 'i_width' => 600, 'i_height' => 500, 'i_url' => $url, 'i_check_permissions' => 0, 'i_expanded' => 0, 'i_new_window' => 1, 'i_page_only' => '');
// Existing bookmarks
if (count($rows) != 0) {
// Spacer
$items[] = array('id' => $rand_id, 'i_parent' => NULL, 'cap' => '', 'i_url' => '', 'i_check_permissions' => 0, 'i_expanded' => 0, 'i_new_window' => 1, 'i_page_only' => '');
// Make our folders first
$parents = array('' => NULL);
foreach ($rows as $row) {
if (!array_key_exists($row['b_folder'], $parents)) {
$rand_id = mt_rand(0, 1000000);
$parents[$row['b_folder']] = $rand_id;
$items[] = array('id' => $rand_id, 'i_parent' => NULL, 'cap' => $row['b_folder'], 'i_url' => '', 'i_check_permissions' => 0, 'i_expanded' => 0, 'i_new_window' => 0, 'i_page_only' => '');
}
}
foreach ($rows as $row) {
$parent = $parents[$row['b_folder']];
list($zone, $attributes, $hash) = page_link_decode($row['b_page_link']);
$_url = build_url($attributes, $zone, NULL, false, false, false, $hash);
$items[] = array('id' => $row['id'], 'i_parent' => $parent, 'cap' => $row['b_title'], 'i_url' => $_url, 'i_check_permissions' => 0, 'i_expanded' => 0, 'i_new_window' => 0, 'i_page_only' => '');
}
}
return $items;
}
示例12: run
/**
* Standard modular run function for symbol hooks. Searches for tasks to perform.
*
* @param array Symbol parameters
* @return string Result
*/
function run($param)
{
$value = '';
if (get_option('sitewide_im', true) === '1' && !is_guest() && (!array_key_exists(get_session_id(), $GLOBALS['SESSION_CACHE']) || $GLOBALS['SESSION_CACHE'][get_session_id()]['session_invisible'] == 0)) {
require_code('chat');
require_lang('chat');
$messages_php = find_script('messages');
$im_area_template = do_template('CHAT_LOBBY_IM_AREA', array('_GUID' => '38de4f030d5980790d6d1db1a7e2ff39', 'MESSAGES_PHP' => $messages_php, 'ROOM_ID' => '__room_id__'));
$im_area_template = do_template('CHAT_SITEWIDE_IM_POPUP', array('_GUID' => 'e520e557f86d0dd4e32d25a208d8f154', 'CONTENT' => $im_area_template));
$im_area_template = do_template('STYLED_HTML_WRAP', array('_GUID' => '5032bfa802af3fe14e610d09078ef849', 'CSS' => 'sitewide_im_popup_body', 'TITLE' => '__room_name__', 'TARGET' => '_site_opener', 'CONTENT' => $im_area_template));
$make_buddy_url = build_url(array('page' => '_SELF', 'type' => 'buddy_add', 'member_id' => '__id__'), '_SELF');
$block_member_url = build_url(array('page' => '_SELF', 'type' => 'blocking_add', 'member_id' => '__id__'), '_SELF');
$profile_url = $GLOBALS['FORUM_DRIVER']->member_profile_url(-100, false, true);
if (is_object($profile_url)) {
$profile_url = $profile_url->evaluate();
}
$profile_url = str_replace('-100', '__id__', $profile_url);
$im_participant_template = do_template('CHAT_LOBBY_IM_PARTICIPANT', array('_GUID' => '0c5e080d0afb29814a6e3059f0204ad1', 'PROFILE_URL' => $profile_url, 'ID' => '__id__', 'ROOM_ID' => '__room_id__', 'USERNAME' => '__username__', 'ONLINE' => '__online__', 'AVATAR_URL' => '__avatar_url__', 'MAKE_BUDDY_URL' => $make_buddy_url, 'BLOCK_MEMBER_URL' => $block_member_url));
$_value = do_template('CHAT_SITEWIDE_IM', array('_GUID' => '5ab0404b3dac4578e8b4be699bd43c95', 'IM_AREA_TEMPLATE' => $im_area_template, 'IM_PARTICIPANT_TEMPLATE' => $im_participant_template, 'CHAT_SOUND' => get_chat_sound_tpl()));
$value = $_value->evaluate();
}
return $value;
}
示例13: run_start
/**
* Standard aed_module run_start.
*
* @param ID_TEXT The type of module execution
* @return tempcode The output of the run
*/
function run_start($type)
{
$this->cat_aed_module = new Module_cms_catalogues_cat();
$this->alt_aed_module = new Module_cms_catalogues_alt();
$GLOBALS['MODULE_CMS_CATALOGUES'] = $this;
if (get_value('disable_cat_cat_perms') === '1') {
$this->permissions_cat_require_b = NULL;
$this->permissions_cat_name_b = NULL;
$this->cat_aed_module->permissions_cat_require = NULL;
$this->cat_aed_module->permissions_cat_name = NULL;
}
$GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_catalogues';
$GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/catalogues';
require_lang('catalogues');
require_lang('fields');
require_code('catalogues');
if ($type == 'add_catalogue') {
require_javascript('javascript_ajax');
$script = find_script('snippet');
$this->alt_aed_module->javascript .= "\n\t\t\t\tvar form=document.getElementById('new_field_0_name').form;\n\t\t\t\tform.old_submit=form.onsubmit;\n\t\t\t\tform.onsubmit=function()\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.getElementById('submit_button').disabled=true;\n\t\t\t\t\t\tvar url='" . addslashes($script) . "?snippet=exists_catalogue&name='+window.encodeURIComponent(form.elements['name'].value);\n\t\t\t\t\t\tif (!do_ajax_field_test(url))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdocument.getElementById('submit_button').disabled=false;\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdocument.getElementById('submit_button').disabled=false;\n\t\t\t\t\t\tif (typeof form.old_submit!='undefined' && form.old_submit) return form.old_submit();\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t};\n\t\t\t";
}
// Decide what to do
if ($type == 'misc') {
return $this->misc();
}
if ($type == 'import') {
return $this->import_catalogue();
}
if ($type == '_import') {
return $this->_import_catalogue();
}
if ($type == 'export') {
return $this->export_catalogue();
}
return new ocp_tempcode();
}
示例14: _build_results_browser_cat_url
/**
* Helper function to work out a results browser URL.
*
* @param array Map of GET array segments to use (others will be added by this function)
* @param array Map of POST array segments (relayed as GET) to use
* @param ?ID_TEXT The page type this browser is browsing through (e.g. 'category') (NULL: none)
* @param ?mixed The virtual root category this browser uses (NULL: no such concept for our results browser)
* @param ?mixed The category ID we are browsing in (NULL: not applicable)
* @param boolean Whether to keep get data when browsing through
* @param ID_TEXT Hash component to URL
* @return mixed The URL
*/
function _build_results_browser_cat_url($url_array, $post_array, $type, $root, $category_id, $keep_all, $hash)
{
if (!is_null($category_id)) {
if (!is_string($category_id)) {
$category_id = strval($category_id);
}
}
$url_array = array_merge($url_array, $post_array);
if (!is_null($type)) {
$url_array['type'] = $type;
}
if (!is_null($root)) {
$url_array['root'] = $root;
}
if (!is_null($category_id)) {
$url_array['id'] = $category_id;
$url_array['kfs' . $category_id] = NULL;
// For OCF. We don't need this anymore because we're using 'start' explicitly here
}
if (strpos(ocp_srv('REQUEST_URI'), '/iframe.php') !== false) {
$cat_url = make_string_tempcode(find_script('iframe') . '?zone=' . get_zone_name());
if ($keep_all) {
$url_array = array_merge($_GET, $_POST, $url_array);
}
foreach ($url_array as $key => $param) {
if ($key == 'wide_high') {
continue;
}
if (is_array($param)) {
continue;
}
if (substr($key, 0, 5) == 'keep_' && skippable_keep($key, $param)) {
continue;
}
if ($param === '_SELF') {
$param = get_page_name();
}
if (get_magic_quotes_gpc()) {
$param = stripslashes($param);
}
if ($key != 'zone') {
$cat_url->attach('&' . $key . '=' . urlencode($param));
}
}
} else {
$cat_url = build_url($url_array, '_SELF', NULL, $keep_all, false, false, $hash);
}
return $cat_url;
}
示例15: render_attachment
/**
* Get tempcode for a Comcode rich-media attachment.
*
* @param ID_TEXT The attachment tag
* @set attachment attachment_safe attachment2
* @param array A map of the attributes (name=>val) for the tag
* @param array A map of the attachment properties (name=>val) for the attachment
* @param string A special identifier to mark where the resultant tempcode is going to end up (e.g. the ID of a post)
* @param MEMBER The member who is responsible for this Comcode
* @param boolean Whether to check as arbitrary admin
* @param object The database connection to use
* @param ?array A list of words to highlight (NULL: none)
* @param ?MEMBER The member we are running on behalf of, with respect to how attachments are handled; we may use this members attachments that are already within this post, and our new attachments will be handed to this member (NULL: member evaluating)
* @param boolean Whether to parse so as to create something that would fit inside a semihtml tag. It means we generate HTML, with Comcode written into it where the tag could never be reverse-converted (e.g. a block).
* @return tempcode The tempcode for the attachment
*/
function render_attachment($tag, $attributes, $attachment, $pass_id, $source_member, $as_admin, $connection, $highlight_bits = NULL, $on_behalf_of_member = NULL, $semiparse_mode = false)
{
require_code('comcode_renderer');
$extension = get_file_extension($attachment['a_original_filename']);
require_code('mime_types');
$mime_type = get_mime_type($extension);
$attachment['CLEAN_SIZE'] = clean_file_size($attachment['a_file_size']);
$attachment['MIME_TYPE'] = $mime_type;
$attachment['PASS_ID'] = intval($pass_id) < 0 ? strval(mt_rand(0, 10000)) : $pass_id;
$attachment['SCRIPT'] = find_script('attachment');
$attachment['RAND'] = strval(mt_rand(0, 32000));
if ($connection->connection_write != $GLOBALS['SITE_DB']->connection_write) {
$attachment['SUP_PARAMS'] = '&forum_db=1';
$attachment['FORUM_DB_BIN'] = '1';
} else {
$attachment['SUP_PARAMS'] = '';
$attachment['FORUM_DB_BIN'] = '';
}
$type = trim(array_key_exists('type', $attributes) ? $attributes['type'] : 'auto');
$attachment['id'] = strval($attachment['id']);
$attachment['a_member_id'] = strval($attachment['a_member_id']);
$attachment['a_file_size'] = strval($attachment['a_file_size']);
$attachment['a_last_downloaded_time'] = is_null($attachment['a_last_downloaded_time']) ? '' : strval($attachment['a_last_downloaded_time']);
$attachment['a_add_time'] = strval($attachment['a_add_time']);
$attachment['a_num_downloads'] = integer_format($attachment['a_num_downloads']);
require_code('images');
$attachment['a_width'] = array_key_exists('width', $attributes) ? strval(intval($attributes['width'])) : '';
$attachment['a_height'] = array_key_exists('height', $attributes) ? strval(intval($attributes['height'])) : '';
if ($attachment['a_width'] == '' || $attachment['a_height'] == '') {
if (addon_installed('galleries') && is_video($attachment['a_original_filename']) && url_is_local($attachment['a_url'])) {
require_code('galleries2');
$vid_details = get_video_details(get_custom_file_base() . '/' . rawurldecode($attachment['a_url']), $attachment['a_original_filename'], true);
if ($vid_details !== false) {
list($_width, $_height, ) = $vid_details;
if ($attachment['a_width'] == '') {
$attachment['a_width'] = strval($_width);
}
if ($attachment['a_height'] == '') {
$attachment['a_height'] = strval($_height);
}
}
}
if ($attachment['a_width'] == '' || $attachment['a_height'] == '') {
if ($attachment['a_width'] == '') {
$attachment['a_width'] = '240';
}
if ($attachment['a_height'] == '') {
$attachment['a_height'] = '216';
}
}
}
$attachment['a_align'] = array_key_exists('align', $attributes) ? $attributes['align'] : 'left';
if (!array_key_exists('a_description', $attachment)) {
if (array_key_exists('description', $attributes)) {
$attachment['description'] = $attributes['description'];
}
if (!array_key_exists('description', $attachment)) {
$attachment['description'] = '';
}
$attachment['a_description'] = is_object($attachment['description']) ? $attachment['description'] : comcode_to_tempcode($attachment['description'], $source_member, $as_admin, 60, NULL, $connection, false, false, false, false, false, NULL, $on_behalf_of_member);
} else {
$attachment['a_description'] = comcode_to_tempcode($attachment['a_description'], $source_member, $as_admin, 60, NULL, $connection, false, false, false, false, false, NULL, $on_behalf_of_member);
}
$attachment['a_type'] = $type;
$attachment['a_thumb'] = array_key_exists('thumb', $attributes) ? $attributes['thumb'] : '1';
if ($attachment['a_thumb'] != '0') {
$attachment['a_thumb'] = '1';
}
$attachment['a_thumb_url'] = array_key_exists('thumb_url', $attributes) ? $attributes['thumb_url'] : $attachment['a_thumb_url'];
switch ($type) {
case 'email':
require_code('mail');
global $EMAIL_ATTACHMENTS;
if (url_is_local($attachment['a_url'])) {
$attachment['a_url'] = get_custom_base_url() . '/' . $attachment['a_url'];
}
$EMAIL_ATTACHMENTS[$attachment['a_url']] = $attachment['a_original_filename'];
$temp_tpl = new ocp_tempcode();
break;
case 'code':
$url = $attachment['a_url'];
if (url_is_local($url)) {
$url = get_custom_base_url() . '/' . $url;
}
//.........这里部分代码省略.........