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

PHP get_custom_base_url函数代码示例

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

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



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

示例1: run

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


示例2: run

 /**
  * Standard modular run function.
  *
  * @return tempcode	Results
  */
 function run()
 {
     $dbs_bak = $GLOBALS['NO_DB_SCOPE_CHECK'];
     $GLOBALS['NO_DB_SCOPE_CHECK'] = true;
     // Find known paths
     $known_urls = array();
     $urlpaths = $GLOBALS['SITE_DB']->query_select('db_meta', array('m_name', 'm_table'), array('m_type' => 'URLPATH'));
     $base_url = get_custom_base_url();
     foreach ($urlpaths as $urlpath) {
         $ofs = $GLOBALS['SITE_DB']->query_select($urlpath['m_table'], array($urlpath['m_name']));
         foreach ($ofs as $of) {
             $url = $of[$urlpath['m_name']];
             if (url_is_local($url)) {
                 $known_urls[rawurldecode($url)] = 1;
             } else {
                 if (substr($url, 0, strlen($base_url)) == $base_url) {
                     $known_urls[substr($url, strlen($base_url) + 1)] = 1;
                 }
             }
         }
     }
     $all_files = $this->do_dir('uploads');
     $orphaned = array();
     foreach ($all_files as $file) {
         if (!array_key_exists($file, $known_urls)) {
             $orphaned[] = array('URL' => get_custom_base_url() . '/' . str_replace('%2F', '/', rawurlencode($file)));
         }
     }
     $GLOBALS['NO_DB_SCOPE_CHECK'] = $dbs_bak;
     return do_template('CLEANUP_ORPHANED_UPLOADS', array('_GUID' => '21049d738f67554cff0891d343c02ad3', 'FOUND' => $orphaned));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:36,代码来源:orphaned_uploads.php


示例3: get_sections

 /**
  * 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 get_sections($member_id)
 {
     require_lang('ocgifts');
     $rows = $GLOBALS['SITE_DB']->query_select('members_gifts', array('*'), array('to_user_id' => $member_id), '', NULL, 0, true);
     if (is_null($rows)) {
         return array();
     }
     $gifts = array();
     foreach ($rows as $gift) {
         $gift_info = $GLOBALS['SITE_DB']->query_select('ocgifts', array('*'), array('id' => $gift['gift_id']));
         if (strlen($gift_info[0]['name']) > 0) {
             if ($gift['is_anonymous'] == 0) {
                 $sender_name = $GLOBALS['FORUM_DRIVER']->get_username($gift['from_user_id']);
                 $sender_link = $GLOBALS['FORUM_DRIVER']->member_profile_url($gift['from_user_id']);
                 $gift_explanation = do_lang('GIFT_EXPLANATION1', $sender_name, $gift_info[0]['name'], $sender_link);
             } else {
                 $gift_explanation = do_lang('GIFT_EXPLANATION2', $gift_info[0]['name']);
             }
             $image_url = '';
             if (is_file(get_file_base() . '/' . urldecode($gift_info[0]['image']))) {
                 $image_url = get_custom_base_url() . '/' . $gift_info[0]['image'];
             }
             $gifts[] = array('GIFT_EXPLANATION' => $gift_explanation, 'IMAGE_URL' => $image_url);
         }
     }
     $gifts_block = do_template('OCF_MEMBER_SCREEN_GIFTS_WRAP', array('_GUID' => 'fd4b5344b3b16cdf129e49bae903cbb2', 'GIFTS' => $gifts));
     return array($gifts_block);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:34,代码来源:gifts.php


示例4: render_field_value

 /**
  * Convert a field value to something renderable.
  *
  * @param  array			The field details
  * @param  mixed			The raw value
  * @param  integer		Position in fieldset
  * @param  ?array			List of fields the output is being limited to (NULL: N/A)
  * @return mixed			Rendered field (tempcode or string)
  */
 function render_field_value($field, $ev, $i, $only_fields)
 {
     if (is_object($ev)) {
         return $ev;
     }
     if ($ev == '') {
         return '';
     }
     require_code('galleries');
     require_code('galleries2');
     require_code('transcoding');
     $ev = transcode_video($ev, 'catalogue_efv_short', 'cv_value', NULL, NULL, NULL);
     $thumb_url = create_video_thumb($ev);
     if (substr($ev, 0, strlen(get_custom_base_url() . '/')) == get_custom_base_url() . '/') {
         $ev = substr($ev, strlen(get_custom_base_url() . '/'));
     }
     if (url_is_local($ev)) {
         $width = 600;
         $height = 400;
         $length = 0;
     } else {
         list($width, $height, $length) = get_video_details(get_custom_file_base() . '/' . rawurldecode($ev), basename($ev));
     }
     return show_gallery_media($ev, $thumb_url, $width, $height, $length);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:34,代码来源:video.php


示例5: sitemaps_build

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


示例6: run

 /**
  * Standard modular run function for ajax-tree hooks. Generates XML for a tree list, which is interpreted by Javascript and expanded on-demand (via new calls).
  *
  * @param  ?ID_TEXT		The ID to do under (NULL: root)
  * @param  array			Options being passed through
  * @param  ?ID_TEXT		The ID to select by default (NULL: none)
  * @return string			XML in the special category,entry format
  */
 function run($id, $options, $default = NULL)
 {
     if ($id === NULL) {
         $id = '';
     }
     require_code('files2');
     require_code('images');
     $fullpath = get_custom_file_base() . '/uploads/filedump';
     if ($id != '') {
         $fullpath .= '/' . $id;
     }
     $folder = isset($options['folder']) && $options['folder'];
     // We want to select folders, not files
     $out = '';
     if (has_actual_page_access(NULL, 'filedump') && file_exists($fullpath)) {
         $files = get_directory_contents($fullpath, '', false, false);
         foreach ($files as $f) {
             $description = $GLOBALS['SITE_DB']->query_value_null_ok('filedump', 'description', array('name' => basename($f), 'path' => $id . '/'));
             if (isset($options['attachment_ready']) && $options['attachment_ready']) {
                 $entry_id = 'url_' . 'uploads/filedump/' . ($id == '' ? '' : rawurlencode($id) . '/') . rawurlencode($f);
             } else {
                 $entry_id = 'uploads/filedump/' . ($id == '' ? '' : rawurlencode($id) . '/') . rawurlencode($f);
             }
             if (is_dir($fullpath . '/' . $f)) {
                 $has_children = count(get_directory_contents($fullpath . '/' . $f, '', false, false)) > 0;
                 $out .= '<category id="' . xmlentities(($id == '' ? '' : $id . '/') . $f) . '" title="' . xmlentities($f) . '" has_children="' . ($has_children ? 'true' : 'false') . '" selectable="' . ($folder ? 'true' : 'false') . '"></category>';
             } elseif (!$folder) {
                 if (!isset($options['only_images']) || !$options['only_images'] || is_image($f)) {
                     if (is_null($description) || get_translated_text($description) == '') {
                         $_description = '';
                         if (is_image($f)) {
                             $url = get_custom_base_url() . '/uploads/filedump/' . ($id == '' ? '' : $id . '/') . $f;
                             $_description = static_evaluate_tempcode(do_image_thumb($url, '', true, true));
                         }
                     } else {
                         $_description = escape_html(get_translated_text($description));
                     }
                     $out .= '<entry id="' . xmlentities($entry_id) . '" title="' . xmlentities($f) . '" description_html="' . xmlentities($_description) . '" selectable="true"></entry>';
                 }
             }
         }
         // Mark parent cats for pre-expansion
         if (!is_null($default) && $default != '') {
             $cat = '';
             foreach (explode('/', $default) as $_cat) {
                 if ($_cat != '') {
                     $cat .= '/';
                     $cat .= $_cat;
                 }
                 $out .= '<expand>' . $cat . '</expand>';
             }
         }
     }
     return '<result>' . $out . '</result>';
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:63,代码来源:choose_filedump_file.php


示例7: 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('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('feedback', array('h'), array(true)), '', '');
     } else {
         if (!array_key_exists(0, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '1', 'feedback'));
         }
         $url = 'http://ocportal.com/pg/feedback';
         $post = array('title' => 'OcCLE feedback', 'post' => '(From "' . get_custom_base_url() . '" via OcCLE.)[quote]' . $parameters[0] . '[/quote]');
         http_download_file($url, NULL, true, true, 'ocPortal', $post);
         return array('', '', do_lang('SUCCESS'), '');
     }
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:22,代码来源:feedback.php


示例8: run

 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     require_lang('iotds');
     require_css('iotds');
     $mode = array_key_exists('param', $map) ? $map['param'] : 'current';
     $zone = array_key_exists('zone', $map) ? $map['zone'] : get_module_zone('iotds');
     if (has_actual_page_access(NULL, 'cms_iotds', NULL, NULL) && has_submit_permission('mid', get_member(), get_ip_address(), 'cms_iotds')) {
         $submit_url = build_url(array('page' => 'cms_iotds', 'type' => 'ad', 'redirect' => SELF_REDIRECT), get_module_zone('cms_iotds'));
     } else {
         $submit_url = new ocp_tempcode();
     }
     if ($mode == 'current') {
         $iotd = $GLOBALS['SITE_DB']->query_select('iotd', array('*'), array('is_current' => 1), 'ORDER BY id DESC', 1);
     } elseif (is_numeric($mode)) {
         $iotd = $GLOBALS['SITE_DB']->query_select('iotd', array('*'), array('id' => intval($mode)), '', 1);
         if (!array_key_exists(0, $iotd)) {
             return do_template('BLOCK_NO_ENTRIES', array('HIGH' => true, 'TITLE' => do_lang_tempcode('IOTD'), 'MESSAGE' => do_lang_tempcode('NO_ENTRIES'), 'ADD_NAME' => do_lang_tempcode('ADD_IOTD'), 'SUBMIT_URL' => $submit_url));
         }
     } else {
         $cnt = $GLOBALS['SITE_DB']->query_value('iotd', 'COUNT(*)', array('used' => 1));
         if ($cnt == 0) {
             return do_template('BLOCK_NO_ENTRIES', array('HIGH' => true, 'TITLE' => do_lang_tempcode('IOTD'), 'MESSAGE' => do_lang_tempcode('NO_ENTRIES'), 'ADD_NAME' => do_lang_tempcode('ADD_IOTD'), 'SUBMIT_URL' => $submit_url));
         }
         $at = mt_rand(0, $cnt - 1);
         $iotd = $GLOBALS['SITE_DB']->query_select('iotd', array('*'), array('used' => 1), '', 1, $at);
     }
     if (!array_key_exists(0, $iotd)) {
         return do_template('BLOCK_NO_ENTRIES', array('_GUID' => '62baa388e068d4334f7a6c6093ead56a', 'HIGH' => true, 'TITLE' => do_lang_tempcode('IOTD'), 'MESSAGE' => do_lang_tempcode('NO_ENTRIES'), 'ADD_NAME' => do_lang_tempcode('ADD_IOTD'), 'SUBMIT_URL' => $submit_url));
     }
     $myrow = $iotd[0];
     $image_url = $myrow['url'];
     if (url_is_local($image_url)) {
         $image_url = get_custom_base_url() . '/' . $image_url;
     }
     $view_url = build_url(array('page' => 'iotds', 'wide' => 1, 'type' => 'view', 'id' => $myrow['id']), $zone);
     require_code('images');
     $thumb_url = ensure_thumbnail($myrow['url'], $myrow['thumb_url'], 'iotds', 'iotd', $myrow['id']);
     $caption = get_translated_tempcode($myrow['i_title']);
     $image = do_image_thumb($thumb_url, do_lang('IOTD'));
     $archive_url = build_url(array('page' => 'iotds', 'type' => 'misc'), $zone);
     $tpl = do_template('IOTD', array('_GUID' => 'ca9c4b4941c12c15f7bdfe4cb57cd266', 'ID' => strval($myrow['id']), 'IMAGE_URL' => $image_url, 'SUBMITTER' => strval($myrow['submitter']), 'VIEW_URL' => $view_url, 'CAPTION' => $caption, 'IMAGE' => $image));
     $map2 = array('_GUID' => 'd710da3675a1775867168ae37db02ad4', 'CURRENT' => $mode == 'current', 'FULL_URL' => $view_url, 'ID' => strval($myrow['id']), 'CONTENT' => $tpl, 'ARCHIVE_URL' => $archive_url, 'SUBMIT_URL' => $submit_url);
     if (get_option('is_on_comments') == '1' && get_forum_type() != 'none' && $myrow['allow_comments'] >= 1) {
         $map2['COMMENT_COUNT'] = '1';
     }
     return do_template('BLOCK_MAIN_IOTD', $map2);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:53,代码来源:main_iotd.php


示例9: run

 /**
  * Standard modular run function for preview hooks.
  *
  * @return array			A pair: The preview, the updated post Comcode
  */
 function run()
 {
     require_code('uploads');
     $urls = get_url('', 'file', 'safe_mode_temp', 0, OCP_UPLOAD_IMAGE, false);
     if ($urls[0] == '') {
         if (!is_null(post_param_integer('id', NULL))) {
             $rows = $GLOBALS['SITE_DB']->query_select('calendar_types', array('t_logo'), array('id' => post_param_integer('id')), '', 1);
             $urls = $rows[0];
             $url = find_theme_image($urls['t_logo']);
         } elseif (!is_null(post_param('theme_img_code', NULL))) {
             $url = find_theme_image(post_param('theme_img_code'));
         } else {
             warn_exit(do_lang_tempcode('IMPROPERLY_FILLED_IN_UPLOAD'));
         }
     } else {
         $url = $urls[0];
     }
     require_code('images');
     $preview = do_image_thumb(url_is_local($url) ? get_custom_base_url() . '/' . $url : $url, post_param('title'), true);
     return array($preview, NULL);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:26,代码来源:calendar_type.php


示例10: run

 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     require_lang('newsletter');
     require_lang('javascript');
     $newsletter_id = array_key_exists('param', $map) ? intval($map['param']) : db_get_first_id();
     $_newsletter_title = $GLOBALS['SITE_DB']->query_value_null_ok('newsletters', 'title', array('id' => $newsletter_id));
     if (is_null($_newsletter_title)) {
         return paragraph(do_lang_tempcode('MISSING_RESOURCE'));
     }
     $newsletter_title = get_translated_text($_newsletter_title);
     $address = post_param('address' . strval($newsletter_id), '');
     if ($address != '') {
         require_code('newsletter');
         require_code('type_validation');
         if (!is_valid_email_address($address)) {
             $msg = do_template('INLINE_WIP_MESSAGE', array('MESSAGE' => do_lang_tempcode('INVALID_EMAIL_ADDRESS')));
             return do_template('BLOCK_MAIN_NEWSLETTER_SIGNUP', array('URL' => get_self_url(), 'MSG' => $msg));
         }
         if (!array_key_exists('path', $map)) {
             $map['path'] = 'uploads/website_specific/signup.txt';
         }
         require_code('character_sets');
         $password = basic_newsletter_join($address, 4, NULL, !file_exists(get_custom_file_base() . '/' . $map['path']), $newsletter_id, post_param('firstname' . strval($newsletter_id), ''), post_param('lastname' . strval($newsletter_id), ''));
         if ($password == '') {
             return do_template('INLINE_WIP_MESSAGE', array('MESSAGE' => do_lang_tempcode('NEWSLETTER_THIS_ALSO')));
         }
         if ($password == do_lang('NA')) {
             $manage_url = build_url(array('page' => 'newsletter', 'email' => $address), get_module_zone('newsletter'));
             return do_template('INLINE_WIP_MESSAGE', array('MESSAGE' => do_lang_tempcode('ALREADY_EMAIL_ADDRESS', escape_html($manage_url->evaluate()))));
         }
         require_code('mail');
         if (file_exists(get_custom_file_base() . '/' . $map['path'])) {
             $url = (url_is_local($map['path']) ? get_custom_base_url() . '/' : '') . $map['path'];
             mail_wrap(array_key_exists('subject', $map) ? $map['subject'] : do_lang('WELCOME'), convert_to_internal_encoding(http_download_file($url)), array($address), array_key_exists('to', $map) ? $map['to'] : '', '', '', 3, NULL, false, NULL, true);
         }
         return do_template('BLOCK_MAIN_NEWSLETTER_SIGNUP_DONE', array('_GUID' => '9953c83685df4970de8f23fcd5dd15bb', 'NEWSLETTER_TITLE' => $newsletter_title, 'NID' => strval($newsletter_id), 'PASSWORD' => $password));
     } else {
         return do_template('BLOCK_MAIN_NEWSLETTER_SIGNUP', array('NEWSLETTER_TITLE' => $newsletter_title, 'NID' => strval($newsletter_id), 'URL' => get_self_url()));
     }
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:46,代码来源:main_newsletter_signup.php


示例11: run

 /**
  * Standard modular run function for realtime-rain hooks.
  *
  * @param  TIME			Start of time range.
  * @param  TIME			End of time range.
  * @return array			A list of template parameter sets for rendering a 'drop'.
  */
 function run($from, $to)
 {
     $drops = array();
     if (has_actual_page_access(get_member(), 'admin_banners')) {
         $rows = $GLOBALS['SITE_DB']->query('SELECT b.name,img_url,c_ip_address,c_member_id AS member_id,c_date_and_time AS timestamp FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'banner_clicks c LEFT JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'banners b ON b.name=c.c_banner_id WHERE c_date_and_time BETWEEN ' . strval($from) . ' AND ' . strval($to));
         require_lang('banners');
         foreach ($rows as $row) {
             $timestamp = $row['timestamp'];
             $member_id = $row['member_id'];
             $image = is_guest($member_id) ? rain_get_country_image($row['c_ip_address']) : $GLOBALS['FORUM_DRIVER']->get_member_avatar_url($member_id);
             require_code('images');
             if (is_image($row['img_url'])) {
                 $image = $row['img_url'];
             }
             if (url_is_local($image)) {
                 $image = get_custom_base_url() . '/' . $image;
             }
             $drops[] = rain_get_special_icons($row['c_ip_address'], $timestamp) + array('TYPE' => 'banners', 'FROM_MEMBER_ID' => strval($member_id), 'TO_MEMBER_ID' => NULL, 'TITLE' => do_lang('BANNER_CLICKED'), 'IMAGE' => $image, 'TIMESTAMP' => strval($timestamp), 'RELATIVE_TIMESTAMP' => strval($timestamp - $from), 'TICKER_TEXT' => NULL, 'URL' => NULL, 'IS_POSITIVE' => true, 'IS_NEGATIVE' => false, 'FROM_ID' => 'member_' . strval($member_id), 'TO_ID' => NULL, 'GROUP_ID' => 'banner_' . $row['name']);
         }
     }
     return $drops;
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:29,代码来源:banners.php


示例12: run

 /**
  * Standard modular run function for preview hooks.
  *
  * @return array			A pair: The preview, the updated post Comcode
  */
 function run()
 {
     require_code('uploads');
     $cat = post_param('cat');
     $urls = get_url('url', 'file', 'uploads/galleries' . (get_value('use_gallery_subdirs') == '1' ? '/' . $cat : ''), 0, OCP_UPLOAD_IMAGE, true, '', 'file2');
     if ($urls[0] == '') {
         if (!is_null(post_param_integer('id', NULL))) {
             $rows = $GLOBALS['SITE_DB']->query_select('images', array('url', 'thumb_url'), array('id' => post_param_integer('id')), '', 1);
             $urls = $rows[0];
             $url = $urls['url'];
             $thumb_url = $urls['thumb_url'];
         } else {
             warn_exit(do_lang_tempcode('IMPROPERLY_FILLED_IN_UPLOAD'));
         }
     } else {
         $url = $urls[0];
         $thumb_url = $urls[1];
     }
     require_code('images');
     $thumb = do_image_thumb(url_is_local($thumb_url) ? get_custom_base_url() . '/' . $thumb_url : $thumb_url, post_param('comments'), true);
     $preview = hyperlink(url_is_local($url) ? get_custom_base_url() . '/' . $url : $url, $thumb);
     return array($preview, NULL);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:28,代码来源:image.php


示例13: 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;
            }
//.........这里部分代码省略.........
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:attachments.php


示例14: show_video

 /**
  * The UI to show a video.
  *
  * @param  ?string		Alternate category name to use (NULL: use standard one). This is useful if you are overriding this code to show images in virtual galleries.
  * @param  ?tempcode		Breadcrumbs (NULL: derive in this function).
  * @return tempcode		The UI
  */
 function show_video($category_name = NULL, $tree = NULL)
 {
     $id = get_param_integer('id');
     if (get_param_integer('ajax', 0) == 1) {
         header('Content-type: text/xml');
     }
     list($sort, $sort_backwards, $sql_suffix_images, $sql_suffix_videos) = $this->get_sort_order();
     if (addon_installed('awards')) {
         require_code('awards');
         $awards = find_awards_for('video', strval($id));
     } else {
         $awards = array();
     }
     // Pic up some info
     $rows = $GLOBALS['SITE_DB']->query_select('videos', array('*'), array('id' => $id), '', 1);
     if (!array_key_exists(0, $rows)) {
         return warn_screen(get_page_title('ERROR_OCCURRED'), do_lang_tempcode('MISSING_RESOURCE'));
     }
     $myrow = $rows[0];
     $url = $myrow['url'];
     if (url_is_local($url)) {
         $url = get_custom_base_url() . '/' . $url;
     }
     $cat = $myrow['cat'];
     $GLOBALS['FEED_URL'] = find_script('backend') . '?mode=galleries&filter=' . urlencode($cat);
     if (get_value('no_individual_gallery_view') === '1' && $GLOBALS['SITE_DB']->query_value('galleries', 'flow_mode_interface', array('name' => $cat)) == '1') {
         require_code('site2');
         assign_refresh(build_url(array('page' => '_SELF', 'type' => 'misc', 'id' => $cat, 'probe_id' => $id, 'probe_type' => 'video'), '_SELF'), 0.0);
     }
     $true_category_name = get_translated_text($GLOBALS['SITE_DB']->query_value('galleries', 'fullname', array('name' => $cat)));
     if (is_null($category_name)) {
         $category_name = $true_category_name;
     }
     if (get_param_integer('slideshow', 0) == 1) {
         $title = get_page_title('VIEW_SLIDESHOW', true, array(escape_html($category_name)));
         global $EXTRA_HEAD;
         $EXTRA_HEAD->attach('<meta name="robots" content="noindex" />');
         // XHTMLXHTML
     } else {
         $title = get_page_title(get_translated_text($myrow['title']) == '' ? 'VIEW_VIDEO' : '_VIEW_VIDEO', true, array(escape_html(get_translated_text($myrow['title']))), NULL, $awards);
     }
     $root = get_param('root', 'root');
     seo_meta_load_for('video', strval($id));
     $thumb_url = $myrow['thumb_url'];
     if (url_is_local($thumb_url)) {
         $thumb_url = get_custom_base_url() . '/' . $thumb_url;
     }
     if (!has_category_access(get_member(), 'galleries', $cat)) {
         access_denied('CATEGORY_ACCESS');
     }
     // Views
     if (get_db_type() != 'xml') {
         $myrow['video_views']++;
         $GLOBALS['SITE_DB']->query_update('videos', array('video_views' => $myrow['video_views']), array('id' => $id), '', 1, NULL, false, true);
     }
     list($rating_details, $comment_details, $trackback_details) = embed_feedback_systems('videos', strval($id), $myrow['allow_rating'], $myrow['allow_comments'], $myrow['allow_trackbacks'], $myrow['validated'], $myrow['submitter'], build_url(array('page' => '_SELF', 'type' => 'video', 'id' => $id), '_SELF', NULL, false, false, true), get_translated_text($myrow['title']) == '' ? do_lang('VIEW_VIDEO_IN', $true_category_name) : get_translated_text($myrow['title']), get_value('comment_forum__videos'));
     // Validation
     if ($myrow['validated'] == 0) {
         if (!has_specific_permission(get_member(), 'jump_to_unvalidated')) {
             access_denied('SPECIFIC_PERMISSION', 'jump_to_unvalidated');
         }
         $warning_details = do_template('WARNING_TABLE', array('_GUID' => 'b32faacba974e648a67e5e91ffd3d8e5', 'WARNING' => do_lang_tempcode(get_param_integer('redirected', 0) == 1 ? 'UNVALIDATED_TEXT_NON_DIRECT' : 'UNVALIDATED_TEXT')));
     } else {
         $warning_details = new ocp_tempcode();
     }
     // Comments
     $comments = get_translated_tempcode($myrow['comments']);
     if (has_actual_page_access(NULL, 'cms_galleries', NULL, NULL) && has_edit_permission('mid', get_member(), $myrow['submitter'], 'cms_galleries', array('galleries', $cat))) {
         $edit_url = build_url(array('page' => 'cms_galleries', 'type' => '_ev', 'id' => $id), get_module_zone('cms_galleries'));
     } else {
         $edit_url = new ocp_tempcode();
     }
     $add_date = get_timezoned_date($myrow['add_date']);
     $edit_date = is_null($myrow['edit_date']) ? '' : get_timezoned_date($myrow['edit_date']);
     // Video HTML
     $video = show_gallery_media($url, $thumb_url, $myrow['video_width'], $myrow['video_height'], $myrow['video_length']);
     $extension = get_file_extension($url);
     require_code('mime_types');
     $mime_type = get_mime_type($extension);
     list($n, $x, $nav) = $this->build_set_navigation(db_string_equal_to('cat', $cat), '', $category_name, $id, $root, 'video', get_param_integer('slideshow', 0), get_param_integer('wide_high', 0), get_param_integer('start', 0), get_param_integer('max', get_default_gallery_max()), $cat, $sort, $sort_backwards, $sql_suffix_images, $sql_suffix_videos, get_param('select', '*'), get_param('video_select', '*'));
     $member_id = get_member_id_from_gallery_name($cat, NULL, true);
     if (get_forum_type() == 'ocf') {
         require_code('ocf_members');
         require_code('ocf_members2');
     }
     $member_details = is_null($member_id) || get_forum_type() != 'ocf' ? new ocp_tempcode() : ocf_show_member_box($member_id);
     $video_details = show_video_details($myrow);
     if (is_null($tree)) {
         $tree = gallery_breadcrumbs($cat, $root, false, get_module_zone('galleries'));
     }
     breadcrumb_add_segment($tree, do_lang_tempcode('VIEW_VIDEO'));
     $GLOBALS['META_DATA'] += array('created' => date('Y-m-d', $myrow['add_date']), 'creator' => $GLOBALS['FORUM_DRIVER']->get_username($myrow['submitter']), 'publisher' => '', 'modified' => is_null($myrow['edit_date']) ? '' : date('Y-m-d', $myrow['edit_date']), 'type' => 'Video', 'title' => get_translated_text($myrow['title']), 'identifier' => '_SEARCH:galleries:video:' . strval($id), 'description' => get_translated_text($myrow['comments']), 'image' => $thumb_url, 'video' => $url, 'video:height' => strval($myrow['video_height']), 'video:width' => strval($myrow['video_width']), 'video:type' => $mime_type);
     return do_template('GALLERY_ENTRY_SCREEN', array('_GUID' => '91e231906ed899513ec2db8a2974dddf', 'MEDIA_TYPE' => 'video', 'E_TITLE' => get_translated_text($myrow['title']), 'CAT' => $cat, 'SLIDESHOW' => get_param_integer('slideshow', 0) == 1, 'TRUE_GALLERY_TITLE' => $true_category_name, 'GALLERY_TITLE' => $category_name, 'MEMBER_ID' => is_null($member_id) ? '' : strval($member_id), 'ID' => strval($id), 'TAGS' => get_loaded_tags('videos'), 'TITLE' => $title, 'SUBMITTER' => strval($myrow['submitter']), 'URL' => $url, 'VIDEO_DETAILS' => $video_details, 'MEMBER_DETAILS' => $member_details, 'X' => integer_format($x), 'N' => integer_format($n), 'VIEWS' => integer_format($myrow['video_views']), 'ADD_DATE_RAW' => strval($myrow['add_date']), 'EDIT_DATE_RAW' => is_null($myrow['edit_date']) ? '' : strval($myrow['edit_date']), 'ADD_DATE' => $add_date, 'EDIT_DATE' => $edit_date, 'RATING_DETAILS' => $rating_details, 'TRACKBACK_DETAILS' => $trackback_details, 'COMMENT_DETAILS' => $comment_details, 'EDIT_URL' => $edit_url, 'NAV' => $nav, 'COMMENTS' => $comments, 'VIDEO' => $video, 'WARNING_DETAILS' => $warning_details));
//.........这里部分代码省略.........
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:galleries.php


示例15: module_do_gui

 /**
  * The main user interface for the file dump.
  *
  * @return tempcode	The UI.
  */
 function module_do_gui()
 {
     $title = get_page_title('FILE_DUMP');
     $place = filter_naughty(get_param('place', '/'));
     if (substr($place, -1, 1) != '/') {
         $place .= '/';
     }
     $GLOBALS['FEED_URL'] = find_script('backend') . '?mode=filedump&filter=' . $place;
     // Show tree
     $dirs = explode('/', substr($place, 0, strlen($place) - 1));
     $i = 0;
     $pre = '';
     $file_tree = new ocp_tempcode();
     while (array_key_exists($i, $dirs)) {
         if ($i > 0) {
             $d = $dirs[$i];
         } else {
             $d = do_lang('FILE_DUMP');
         }
         if (array_key_exists($i + 1, $dirs)) {
             $tree_url = build_url(array('page' => '_SELF', 'place' => $pre . $dirs[$i] . '/'), '_SELF');
             if (!$file_tree->is_empty()) {
                 $file_tree->attach(do_template('BREADCRUMB', array('_GUID' => '7ee62e230d53344a7d9667dc59be21c6')));
             }
             $file_tree->attach(hyperlink($tree_url, $d));
         }
         $pre .= $dirs[$i] . '/';
         $i++;
     }
     if (!$file_tree->is_empty()) {
         breadcrumb_add_segment($file_tree, $d);
     } else {
         breadcrumb_set_self($i == 1 ? do_lang_tempcode('FILE_DUMP') : make_string_tempcode(escape_html($d)));
     }
     // Check directory exists
     $fullpath = get_custom_file_base() . '/uploads/filedump' . $place;
     if (!file_exists(get_custom_file_base() . '/uploads/filedump' . $place)) {
         if (has_specific_permission(get_member(), 'upload_filedump')) {
             @mkdir($fullpath, 0777) or warn_exit(do_lang_tempcode('WRITE_ERROR_DIRECTORY', escape_html($fullpath), escape_html(dirname($fullpath))));
             fix_permissions($fullpath, 0777);
             sync_file($fullpath);
         }
     }
     // Find all files in the incoming directory
     $handle = opendir(get_custom_file_base() . '/uploads/filedump' . $place);
     $i = 0;
     $filename = array();
     $description = array();
     $filesize = array();
     $filetime = array();
     $directory = array();
     $deletable = array();
     while (false !== ($file = readdir($handle))) {
         if (!should_ignore_file('uploads/filedump' . $place . $file, IGNORE_ACCESS_CONTROLLERS | IGNORE_HIDDEN_FILES)) {
             $directory[$i] = !is_file(get_custom_file_base() . '/uploads/filedump' . $place . $file);
             $filename[$i] = $directory[$i] ? $file . '/' : $file;
             if ($directory[$i]) {
                 $filesize[$i] = do_lang_tempcode('NA_EM');
             }
             $dbrows = $GLOBALS['SITE_DB']->query_select('filedump', array('description', 'the_member'), array('name' => $file, 'path' => $place));
             if (!array_key_exists(0, $dbrows)) {
                 $description[$i] = $directory[$i] ? do_lang_tempcode('NA_EM') : do_lang_tempcode('NONE_EM');
             } else {
                 $description[$i] = make_string_tempcode(escape_html(get_translated_text($dbrows[0]['description'])));
             }
             if ($description[$i]->is_empty()) {
                 $description[$i] = do_lang_tempcode('NONE_EM');
             }
             $deletable[$i] = array_key_exists(0, $dbrows) && $dbrows[0]['the_member'] == get_member() || has_specific_permission(get_member(), 'delete_anything_filedump');
             if ($directory[$i]) {
                 $size = get_directory_size(get_custom_file_base() . '/uploads/filedump' . $place . $file);
                 $timestamp = NULL;
             } else {
                 $size = filesize(get_custom_file_base() . '/uploads/filedump' . $place . $file);
                 $timestamp = filemtime(get_custom_file_base() . '/uploads/filedump' . $place . $file);
             }
             $filesize[$i] = clean_file_size($size);
             $filetime[$i] = is_null($timestamp) ? NULL : get_timezoned_date($timestamp);
             $i++;
         }
     }
     closedir($handle);
     if ($i != 0) {
         require_code('templates_table_table');
         $header_row = table_table_header_row(array(do_lang_tempcode('FILENAME'), do_lang_tempcode('DESCRIPTION'), do_lang_tempcode('SIZE'), do_lang_tempcode('DATE_TIME'), do_lang_tempcode('ACTIONS')));
         $rows = new ocp_tempcode();
         for ($a = 0; $a < $i; $a++) {
             if ($directory[$a]) {
                 $link = build_url(array('page' => '_SELF', 'place' => $place . $filename[$a]), '_SELF');
             } else {
                 $link = make_string_tempcode(get_custom_base_url() . '/uploads/filedump' . str_replace('%2F', '/', rawurlencode($place . $filename[$a])));
             }
             if (!$directory[$a]) {
                 if ($deletable[$a]) {
                     $delete_url = build_url(array('page' => '_SELF', 'type' => 'ed', 'file' => $filename[$a], 'place' => $place), '_SELF');
//.........这里部分代码省略.........
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:filedump.php


示例16: create_video_thumb

/**
 * Create a video thumbnail.
 *
 * @param  URLPATH		Video to get thumbail from (must be local)
 * @param  ?PATH			Where to save to (NULL: decide for ourselves)
 * @return URLPATH		Thumbnail, only valid if expected_output_path was passed as NULL (blank: could not generate)
 */
function create_video_thumb($src_url, $expected_output_path = NULL)
{
    // Audio ones should have automatic thumbnails
    require_code('mime_types');
    $file_ext = get_file_extension($src_url);
    $input_mime_type = get_mime_type($file_ext);
    if (preg_match('#audio\\/#i', $inp 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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