本文整理汇总了PHP中http_download_file函数的典型用法代码示例。如果您正苦于以下问题:PHP http_download_file函数的具体用法?PHP http_download_file怎么用?PHP http_download_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了http_download_file函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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
示例2: get_future_version_information
/**
* Get information about new versions of ocPortal (or more accurately, what's wrong with this version).
*
* @return tempcode Information about the installed ocPortal version
*/
function get_future_version_information()
{
require_lang('version');
$url = 'http://ocportal.com/version.php?version=' . rawurlencode(ocp_version_full()) . '&lang=' . rawurlencode(user_lang());
$data = http_download_file($url, NULL, false);
if (!is_null($data)) {
$data = str_replace('"../upgrader.php"', '"' . get_base_url() . '/upgrader.php"', $data);
if ($GLOBALS['XSS_DETECT']) {
ocp_mark_as_escaped($data);
}
require_code('character_sets');
$data = convert_to_internal_encoding($data);
$table = new ocp_tempcode();
$lines = explode(chr(10), $data);
foreach ($lines as $line) {
if (trim($line) != '') {
$table->attach(paragraph($line));
}
}
$table = make_string_tempcode(preg_replace('#<p>\\s*</p>#', '', $table->evaluate()));
} else {
$table = paragraph(do_lang_tempcode('CANNOT_CONNECT_HOME'), 'dfsdff32ffd');
}
require_code('xhtml');
/*$table->attach('<script type="text/javascript">// <![CDATA[
window.open(\''.$url.'\');
//]]></script>');*/
return make_string_tempcode(xhtmlise_html($table->evaluate()));
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:34,代码来源:version2.php
示例3: retrieveGoogleSearch
function retrieveGoogleSearch($searchTerms = "ocportal", $searchURL = "related:ocportal.com")
{
require_code('files');
$googleBaseUrl = "http://ajax.googleapis.com/ajax/services/search/web";
$googleBaseQuery = "?v=1.0&rsz=large&q=";
$googleFullUrl = $googleBaseUrl . $googleBaseQuery . $searchURL . "%20" . $searchTerms;
$returnGoogleSearch = http_download_file($googleFullUrl);
$returnGoogleSearch = json_decode($returnGoogleSearch, true);
return $returnGoogleSearch["responseData"]["results"];
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:10,代码来源:side_similar_sites.php
示例4: testAdminZone
function testAdminZone()
{
if (function_exists('set_time_limit')) {
@set_time_limit(0);
}
$result = http_download_file(get_base_url() . '/_tests/codechecker/phpdoc_parser.php', NULL, true, false, 'ocPortal', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 10000.0);
foreach (explode('<br />', $result) as $line) {
$this->assertTrue(trim($line) == '' || substr($line, 0, 4) == 'Done' || substr($line, 0, 6) == 'FINAL ' || strpos($line, 'TODO') !== false || strpos($line, 'HACKHACK') !== false, $line);
}
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:10,代码来源:cqc__function_sigs.php
示例5: testDatabase
function testDatabase()
{
if (function_exists('set_time_limit')) {
@set_time_limit(0);
}
$result = http_download_file(get_base_url() . '/_tests/codechecker/code_quality.php?subdir=sources/database&api=1', NULL, true, false, 'ocPortal', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 10000.0);
foreach (explode('<br />', $result) as $line) {
$this->assertTrue(trim($line) == '' || substr($line, 0, 5) == 'SKIP:' || substr($line, 0, 5) == 'DONE ' || substr($line, 0, 6) == 'FINAL ' || strpos($line, 'TODO') !== false || strpos($line, 'HACKHACK') !== false, $line);
}
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:10,代码来源:cqc_database.php
示例6: get_video_thumbnail
/**
* If we can handle this URL, get the thumbnail URL.
*
* @param URLPATH Video URL
* @return ?string The thumbnail URL (NULL: no match).
*/
function get_video_thumbnail($src_url)
{
$matches = array();
if (preg_match('#^http://www\\.facebook\\.com/video/video\\.php\\?v=(\\w+)#', $src_url, $matches) != 0) {
require_code('files');
$contents = http_download_file($src_url);
if (preg_match('#addVariable\\("thumb_url", "([^"]*)"\\);#', $contents, $matches) != 0) {
return rawurldecode(str_replace('\\u0025', '%', $matches[1]));
}
}
return NULL;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:18,代码来源:facebook.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
function run()
{
$file = basename(rawurldecode($_GET['url']));
//get old media file data
$get_old_file = $GLOBALS['SITE_DB']->query('SELECT url FROM ' . get_table_prefix() . 'videos WHERE url LIKE "uploads/galleries/' . rawurlencode(basename(basename($file, '.m4v'), '.mp3')) . '%"');
$type = 'galleries';
if (!array_key_exists(0, $get_old_file)) {
$get_old_file = $GLOBALS['SITE_DB']->query('SELECT a_url AS url FROM ' . get_table_prefix() . 'attachments WHERE a_url LIKE "uploads/attachments/' . rawurlencode(basename(basename($file, '.m4v'), '.mp3')) . '%"');
$type = 'attachments';
if (!array_key_exists(0, $get_old_file)) {
$get_old_file = $GLOBALS['SITE_DB']->query('SELECT cv_value AS url FROM ' . get_table_prefix() . 'catalogue_efv_short WHERE cv_value LIKE "uploads/catalogues/' . rawurlencode(basename(basename($file, '.m4v'), '.mp3')) . '%"');
$type = 'catalogues';
}
}
require_code('files');
$file_handle = @fopen(get_custom_file_base() . '/uploads/' . $type . '/' . $file, 'wb') or intelligent_write_error(get_custom_file_base() . '/uploads/' . $type . '/' . $file);
http_download_file($_GET['url'], NULL, false, false, 'ocPortal', NULL, NULL, NULL, NULL, NULL, $file_handle, NULL, NULL, 6.0);
fclose($file_handle);
//move the old media file to the archive directory - '/uploads/'.$type.'/archive/'
$new_url = 'uploads/' . $type . '/' . rawurlencode($file);
if (isset($get_old_file[0]['url']) && is_string($get_old_file[0]['url']) && $get_old_file[0]['url'] != $new_url && strlen($get_old_file[0]['url']) > 0) {
$movedir = dirname(str_replace('/uploads/' . $type . '/', '/uploads/' . $type . '_archive_addon/', str_replace('\\', '/', get_custom_file_base()) . '/' . rawurldecode($get_old_file[0]['url'])));
@mkdir($movedir, 0777);
require_code('files');
fix_permissions($movedir, 0777);
rename(str_replace('\\', '/', get_custom_file_base()) . '/' . rawurldecode($get_old_file[0]['url']), str_replace('/uploads/' . $type . '/', '/uploads/' . $type . '_archive_addon/', str_replace('\\', '/', get_custom_file_base()) . '/' . rawurldecode($get_old_file[0]['url'])));
}
switch ($type) {
case 'galleries':
$GLOBALS['SITE_DB']->query('UPDATE ' . get_table_prefix() . 'videos SET video_width=600,video_height=400,url="' . db_escape_string($new_url) . '" WHERE url LIKE "uploads/' . $type . '/' . db_escape_string(rawurlencode(basename(basename($file, '.m4v'), '.mp3'))) . '%"');
// Replaces row that referenced $file without .m4v on the end (the original filename) with row that references the new $file we just copied
break;
case 'attachments':
$GLOBALS['SITE_DB']->query('UPDATE ' . get_table_prefix() . 'attachments SET a_url="' . db_escape_string($new_url) . '" WHERE a_url LIKE "uploads/' . $type . '/' . db_escape_string(rawurlencode(basename(basename($file, '.m4v'), '.mp3'))) . '%"');
// Replaces row that referenced $file without .m4v on the end (the original filename) with row that references the new $file we just copied
break;
case 'catalogues':
$GLOBALS['SITE_DB']->query('UPDATE ' . get_table_prefix() . 'catalogue_efv_short SET cv_value="' . db_escape_string($new_url) . '" WHERE cv_value LIKE "uploads/' . $type . '/' . db_escape_string(rawurlencode(basename(basename($file, '.m4v'), '.mp3'))) . '%"');
// Replaces row that referenced $file without .m4v on the end (the original filename) with row that references the new $file we just copied
break;
}
$transcoding_server = get_option('transcoding_server', true);
if (is_null($transcoding_server)) {
//add option and default value
add_config_option('TRANSCODING_SERVER', 'transcoding_server', 'line', 'return \'http://localhost/convertor\';', 'FEATURE', 'GALLERIES');
$transcoding_server = get_option('transcoding_server', true);
}
file_get_contents($transcoding_server . '/move_to_sent.php?file=' . $_GET['url']);
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:49,代码来源:receive_transcoded_file.php
示例9: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
unset($map);
require_css('side_blocks');
$netlinks = get_option('network_links');
if (strlen($netlinks) > 0) {
require_code('character_sets');
$data = http_download_file($netlinks, NULL, false);
if (is_null($data)) {
$if_network = do_lang_tempcode('HTTP_DOWNLOAD_NO_SERVER', escape_html($netlinks));
} else {
$if_network = make_string_tempcode(convert_to_internal_encoding($data));
}
return do_template('BLOCK_SIDE_NETWORK', array('_GUID' => '5fe8867b9f69670ad61e6c78b956fab2', 'CONTENT' => $if_network));
}
return new ocp_tempcode();
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:23,代码来源:side_network.php
示例10: incoming_uploads_script
/**
* Function to process the file upload process
*/
function incoming_uploads_script()
{
$image_url_sub_for = get_param('image_url_sub_for', NULL);
if ($image_url_sub_for !== NULL) {
require_code('files');
if (!url_is_local($image_url_sub_for) || strpos($image_url_sub_for, '/incoming/') !== false) {
$url_to = 'uploads/website_specific/' . md5(uniqid('', true)) . '.png';
} else {
$url_to = dirname($image_url_sub_for) . '/' . md5(uniqid('', true)) . '.png';
}
$write_to_file = fopen($url_to, 'wb');
http_download_file(either_param('imageurl'), NULL, true, false, 'ocPortal', NULL, NULL, NULL, NULL, NULL, $write_to_file);
fclose($write_to_file);
$GLOBALS['SITE_DB']->query_insert('image_url_sub_for', array('url_from' => $image_url_sub_for, 'url_to' => $url_to, 'member_id' => get_member(), 'expire' => time() + 60 * 60 * 24));
exit;
}
non_overrided__incoming_uploads_script();
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:21,代码来源:incoming_uploads.php
示例11: xml_rpc
/**
* Do a highly-simplified XML-RPC request (no actual calling supported - just messaging).
*
* @param URLPATH The XML-RPC call URL
* @param string The method name to call.
* @param array An array of parameters.
* @param boolean Whether to accept failure.
* @return ?string The result (NULL: failed).
*/
function xml_rpc($url, $method, $params, $accept_failure = false)
{
$rpc = "\n<" . "?xml version=\"1.0\"?" . ">\n<methodCall>\n <methodName>{$method}</methodName>\n <params>\n";
foreach ($params as $_value) {
$value = _xml_rpc_type_convert($_value);
$rpc .= <<<END
\t <param>
\t\t\t<value>{$value}</value>
\t </param>
END;
}
$rpc .= <<<END
</params>
</methodCall>
END;
$result = http_download_file($url, NULL, true, false, 'ocPortal', array('_' => $rpc));
return $result;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:29,代码来源:xmlrpc.php
示例12: get_file
/**
* This will get the XML file from ocportal.com.
*
* @param ?ID_TEXT The ID to do under (NULL: root)
* @return string The XML file
*/
function get_file($id)
{
$stub = get_param_integer('localhost', 0) == 1 ? get_base_url() : 'http://ocportal.com';
$v = 'Version ' . float_to_raw_string(ocp_version_number(), 1);
if (!is_null($id)) {
$v = $id;
}
$url = $stub . '/data/ajax_tree.php?hook=choose_download&id=' . rawurlencode($v) . '&file_type=tar';
require_code('character_sets');
$contents = http_download_file($url);
$utf = $GLOBALS['HTTP_CHARSET'] == 'utf-8';
// We have to use 'U' in the regexp to work around a Chrome parser bug (we can't rely on convert_to_internal_encoding being 100% correct)
require_code('character_sets');
$contents = convert_to_internal_encoding($contents);
$contents = preg_replace('#^\\s*\\<' . '\\?xml version="1.0" encoding="[^"]*"\\?' . '\\>\\<request\\>#' . ($utf ? 'U' : ''), '', $contents);
$contents = preg_replace('#</request>#' . ($utf ? 'U' : ''), '', $contents);
$contents = preg_replace('#<category [^>]*has_children="false"[^>]*>[^>]*</category>#' . ($utf ? 'U' : ''), '', $contents);
$contents = preg_replace('#<category [^>]*title="Manual install required"[^>]*>[^>]*</category>#' . ($utf ? 'U' : ''), '', $contents);
return $contents;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:26,代码来源:choose_ocportalcom_addon.php
示例13: 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
示例14: 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('occlechat', array('h'), array(true, true)), '', '');
} else {
if (!array_key_exists(0, $parameters)) {
return array('', '', '', do_lang('MISSING_PARAM', '1', 'occlechat'));
}
if (!array_key_exists(1, $parameters)) {
return array('', '', '', do_lang('MISSING_PARAM', '2', 'occlechat'));
}
$GLOBALS['SITE_DB']->query_insert('occlechat', array('c_message' => $parameters[1], 'c_url' => $parameters[0], 'c_incoming' => 0, 'c_timestamp' => time()));
$url = $parameters[0] . '/data/occle.php?action=message&base_url=' . urlencode(get_base_url()) . '&message=' . urlencode($parameters[1]);
$return = http_download_file($url, NULL, false);
if (is_null($return)) {
return array('', '', '', do_lang('HTTP_DOWNLOAD_NO_SERVER', $parameters[0]));
} elseif ($return == '1') {
return array('', '', do_lang('SUCCESS'), '');
} else {
return array('', '', '', do_lang('INCOMPLETE_ERROR'));
}
}
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:31,代码来源:occlechat.php
示例15: 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)
{
require_code('xhtml');
if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
return array('', do_command_help('fix_perms', array('h'), array(true, true, true)), '', '');
} else {
if (!array_key_exists(0, $parameters)) {
return array('', '', '', do_lang('MISSING_PARAM', '1', 'fix_perms'));
}
if (!array_key_exists(1, $parameters)) {
return array('', '', '', do_lang('MISSING_PARAM', '2', 'fix_perms'));
}
if (!array_key_exists(2, $parameters)) {
return array('', '', '', do_lang('MISSING_PARAM', '3', 'fix_perms'));
}
$return = http_download_file(get_base_url() . '/upgrader.php?check_perms=1&user=' . $parameters[0] . '&pass=' . $parameters[1] . '&root=' . $parameters[2], NULL, false);
if (is_null($return)) {
return array('', '', '', do_lang('HTTP_DOWNLOAD_NO_SERVER', get_base_url() . '/upgrader.php?check_perms=1'));
} else {
return array('', occle_make_normal_html_visible(extract_html_body($return)), '', '');
}
}
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:31,代码来源:fix_perms.php
示例16: comcode_text__to__comcode_xml
//.........这里部分代码省略.........
$xml .= '<table summary="' . escape_html($caption) . '">';
foreach ($rows as $table_row) {
$xml .= '<tr>';
$cells = preg_split('/(\\n\\! | \\!\\! |\\n\\| | \\|\\| )/', $table_row, -1, PREG_SPLIT_DELIM_CAPTURE);
array_shift($cells);
// First one is non-existant empty
$spec = true;
$c_type = '';
foreach ($cells as $cell) {
if ($spec) {
$c_type = strpos($cell, '!') !== false ? 'th' : 'td';
} else {
$xml .= '<' . $c_type . '>';
$xml .= comcode_text__to__comcode_xml(rtrim($cell), true);
$xml .= '</' . $c_type . '>';
}
$spec = !$spec;
}
$xml .= '</tr>';
}
$xml .= '</table>';
}
$pos = $end_tbl + 3;
$differented = true;
}
}
}
// Link lookahead
if (!$differented) {
if (!$in_semihtml && $next == 'h' && (substr($comcode, $pos - 1, strlen('http://')) == 'http://' || substr($comcode, $pos - 1, strlen('https://')) == 'https://' || substr($comcode, $pos - 1, strlen('ftp://')) == 'ftp://')) {
list($link_end_pos, $auto_link) = detect_link($comcode, $pos);
$xml .= $continuation;
$continuation = '';
$downloaded_at_link = http_download_file($auto_link, 3000, false);
$link_captions_title = '';
if (is_string($downloaded_at_link)) {
$matches = array();
if (preg_match('#<title>\\s*(.*)\\s*</title>#', $downloaded_at_link, $matches) != 0) {
require_code('character_sets');
$link_captions_title = @html_entity_decode(convert_to_internal_encoding($matches[1]), ENT_QUOTES, get_charset());
}
}
$xml .= '<url param="' . escape_html($auto_link) . '">' . escape_html($link_captions_title) . '</url>';
$pos += $link_end_pos - $pos;
$differented = true;
break;
}
}
}
if (!$differented) {
if (!$in_separate_parse_section && (!$in_semihtml || !$comcode_dangerous && !$is_all_semihtml)) {
if ($next == '&') {
$ahead = substr($comcode, $pos, 20);
$ahead_lower = strtolower($ahead);
$matches = array();
$entity = preg_match('#(\\#)?([\\w]*);#', $ahead_lower, $matches) != 0;
// If it is a SAFE entity, use it
if ($entity) {
if ($matches[1] == '' && isset($ALLOWED_ENTITIES[$matches[2]])) {
$pos += strlen($matches[2]) + 1;
$continuation .= '&' . $matches[2] . ';';
} elseif (is_numeric($matches[2]) && $matches[1] == '#') {
$matched_entity = intval(base_convert($matches[1], 16, 10));
if ($matched_entity < 127 && array_key_exists(chr($matched_entity), $POTENTIAL_JS_NAUGHTY_ARRAY)) {
$continuation .= escape_html($next);
} else {
开发者ID:erico-deh,项目名称:ocPortal,代码行数:67,代码来源:comcode_conversion.php
示例17: is_image
/**
* Find whether the image specified is actually an image, based on file extension
*
* @param string A URL or file path to the image
* @param boolean Whether to check mime too
* @return boolean Whether the string pointed to a file appeared to be an image
*/
function is_image($name, $mime_too = false)
{
if (substr(basename($name), 0, 1) == '.') {
return false;
}
// Temporary file that some OS's make
$ext = get_file_extension($name);
$types = explode(',', get_option('valid_images'));
foreach ($types as $val) {
if (strtolower($val) == $ext) {
return true;
}
}
if ($mime_too && looks_like_url($name)) {
http_download_file($name, 0, false);
global $HTTP_DOWNLOAD_MIME_TYPE;
if (preg_match('#^image/(png|gif|jpeg)$#', $HTTP_DOWNLOAD_MIME_TYPE) != 0) {
return true;
}
}
return false;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:29,代码来源:images.php
示例18: download_gallery_script
/**
* Script handler for downloading a gallery, as specified by GET parameters.
*/
function download_gallery_script()
{
if (function_exists('set_time_limit')) {
@set_time_limit(0);
}
require_code('galleries');
// Closed site
$site_closed = get_option('site_closed');
if ($site_closed == '1' && !has_specific_permission(get_member(), 'access_closed_site') && !$GLOBALS['IS_ACTUALLY_ADMIN']) {
header('Content-Type: text/plain');
@exit(get_option('closed'));
}
require_lang('galleries');
require_code('zip');
$cat = get_param('cat');
if (!has_category_access(get_member(), 'galleries', $cat)) {
access_denied('CATEGORY_ACCESS');
}
check_specific_permission('may_download_gallery', array('galleries', $cat));
if (strpos($cat, chr(10)) !== false || strpos($cat, chr(13)) !== false) {
log_hack_attack_and_exit('HEADER_SPLIT_HACK');
}
$gallery_rows = $GLOBALS['SITE_DB']->query_select('galleries', array('*'), array('name' => $cat), '', 1);
if (!array_key_exists(0, $gallery_rows)) {
warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
}
$gallery_row = $gallery_rows[0];
// Send header
header('Content-Type: application/octet-stream' . '; authoritative=true;');
if (strstr(ocp_srv('HTTP_USER_AGENT'), 'MSIE') !== false) {
header('Content-Disposition: filename="gallery-' . $cat . '.zip"');
} else {
header('Content-Disposition: attachment; filename="gallery-' . $cat . '.zip"');
}
disable_php_memory_limit();
$rows = array_merge($GLOBALS['SITE_DB']->query_select('videos', array('url', 'add_date'), array('cat' => $cat, 'validated' => 1)), $GLOBALS['SITE_DB']->query_select('images', array('url', 'add_date'), array('cat' => $cat, 'validated' => 1)));
$array = array();
foreach ($rows as $row) {
$full_path = NULL;
$data = NULL;
if (url_is_local($row['url']) && file_exists(get_file_base() . '/' . urldecode($row['url']))) {
$path = urldecode($row['url']);
$full_path = get_file_base() . '/' . $path;
if (file_exists($full_path)) {
$time = filemtime($full_path);
$name = $path;
} else {
continue;
}
} else {
continue;
// Actually we won't include them, if they are not local it implies it is not reasonable for them to lead to server load, and they may not even be native files
$time = $row['add_date'];
$name = basename(urldecode($row['url']));
$data = http_download_file($row['url']);
}
$array[] = array('name' => preg_replace('#^uploads/galleries/#', '', $name), 'time' => $time, 'data' => $data, 'full_path' => $full_path);
}
if ($gallery_row['rep_image'] != '') {
if (url_is_local($gallery_row['rep_image']) && file_exists(get_file_base() . '/' . urldecode($gallery_row['rep_image']))) {
$path = urldecode($gallery_row['rep_image']);
$full_path = get_file_base() . '/' . $path;
if (file_exists($full_path)) {
$time = filemtime($full_path);
$name = $path;
$data = file_get_contents($full_path);
}
} else {
$time = $gallery_row['add_date'];
$name = basename(urldecode($gallery_row['rep_image']));
$data = http_download_file($gallery_row['rep_image']);
}
$array[] = array('name' => preg_replace('#^uploads/(galleries|grepimages)/#', '', $name), 'time' => $time, 'data' => $data);
}
@ini_set('zlib.output_compression', 'Off');
//$zip_file=create_zip_file($array);
//header('Content-Length: '.strval(strlen($zip_file)));
//echo $zip_file;
create_zip_file($array, true);
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:83,代码来源:galleries3.php
示例19: mail_wrap
//.........这里部分代码省略.........
foreach (array('#<([^"<>]*\\s)style="([^"]*)"#', '#<style( [^<>]*)?' . '>(.*)</style>#Us') as $over) {
$num_matches = preg_match_all($over, $html_evaluated, $matches);
for ($i = 0; $i < $num_matches; $i++) {
$altered_inner = preg_replace_callback('#url\\(["\']?(http://[^"]*)["\']?\\)#U', '_mail_css_rep_callback', $matches[2][$i]);
if ($matches[2][$i] != $altered_inner) {
$altered_outer = str_replace($matches[2][$i], $altered_inner, $matches[0][$i]);
$html_evaluated = str_replace($matches[0][$i], $altered_outer, $html_evaluated);
}
}
}
}
if ($base64_encode) {
$sending_message .= 'Content-Transfer-Encoding: base64' . $line_term . $line_term;
$sending_message .= chunk_split(base64_encode(unixify_line_format($html_evaluated)) . $line_term, 76, $line_term);
} else {
$sending_message .= 'Content-Transfer-Encoding: 8bit' . $line_term . $line_term;
// Requires RFC 1652
$sending_message .= wordwrap(str_replace(chr(10), $line_term, unixify_line_format($html_evaluated)) . $line_term, 998, $line_term);
}
$total_filesize = 0;
foreach ($CID_IMG_ATTACHMENT as $id => $img) {
$sending_message .= '--' . $boundary3 . $line_term;
$file_path_stub = convert_url_to_path($img);
$mime_type = get_mime_type(get_file_extension($img));
$filename = basename($img);
if (!is_null($file_path_stub)) {
$total_filesize += @filesize($file_path_stub);
if ($total_filesize > 1024 * 1024 * 5) {
continue;
}
// Too large to process into an email
$file_contents = @file_get_contents($file_path_stub);
} else {
$file_contents = http_download_file($img, NULL, false);
$total_filesize += strlen($file_contents);
if ($total_filesize >= 1024 * 1024 * 5) {
continue;
}
// Too large to process into an email
if (!is_null($GLOBALS['HTTP_DOWNLOAD_MIME_TYPE'])) {
$mime_type = $GLOBALS['HTTP_DOWNLOAD_MIME_TYPE'];
}
if (!is_null($GLOBALS['HTTP_FILENAME'])) {
$filename = $GLOBALS['HTTP_FILENAME'];
}
}
$sending_message .= 'Content-Type: ' . str_replace("\r", '', str_replace("\n", '', $mime_type)) . $line_term;
$sending_message .= 'Content-ID: <' . $id . '>' . $line_term;
$sending_message .= 'Content-Disposition: inline; filename="' . str_replace("\r", '', str_replace("\n", '', $filename)) . '"' . $line_term;
$sending_message .= 'Content-Transfer-Encoding: base64' . $line_term . $line_term;
if (is_string($file_contents)) {
$sending_message .= chunk_split(base64_encode($file_contents), 76, $line_term);
}
}
$sending_message .= $line_term . '--' . $boundary3 . '--' . $line_term . $line_term;
$sending_message .= $line_term . '--' . $boundary2 . '--' . $line_term . $line_term;
// Attachments
if (!is_null($attachments)) {
foreach ($attachments as $path => $filename) {
$sending_message .= '--' . $boundary . $line_term;
$sending_message .= 'Content-Type: ' . get_mime_type(get_file_extension($filename)) . $line_term;
// .'; name="'.str_replace("\r",'',str_replace("\n",'',$filename)).'"' http://www.imc.org/ietf-822/old-archive2/msg02121.html
$sending_message .= 'Content-Transfer-Encoding: base64' . $line_term;
$sending_message .= 'Content-Disposition: attachment; filename="' . str_replace("\r", '', str_replace("\n", '', $filename)) . '"' . $line_term . $line_term;
if (strpos($path, '://') === false) {
$sending_message .= chunk_split(base64_encode(file_get_contents($path)), 76, $line_term);
开发者ID:erico-deh,项目名称:ocPortal,代码行数:67,代码来源:mail.php
示例20: test_htaccess
//.........这里部分代码省略.........
# And these for those nasty situations where index.php was missing and we couldn't do anything about it (usually due to keep_session creeping into a semi-cached URL)
RewriteRule ^([^=]*)pg/s/([^\\&\\?\\.]*)&(.*)\$ \$1index.php\\?\$3&page=cedi&id=\$2 [L,QSA]
RewriteRule ^([^=]*)pg/galleries/image/([^/\\&\\?\\.]*)&(.*)\$ \$1index.php\\?\$5&page=galleries&type=image&id=\$2&wide=1&\$3 [L,QSA]
RewriteRule ^([^=]*)pg/galleries/video/([^/\\&\\?\\.]*)&(.*)\$ \$1index.php\\?\$5&page=galleries&type=video&id=\$2&wide=1&\$3 [L,QSA]
RewriteRule ^([^=]*)pg/iotds/view/([^/\\&\\?\\.]*)&(.*)\$ \$1index.php\\?\$3&page=iotds&type=view&id=\$2&wide=1 [L,QSA]
RewriteRule ^([^=]*)pg/([^/\\&\\?\\.]*)/([^/\\&\\?\\.]*)/([^/\\&\\?\\.]*)&(.*)\$ \$1index.php\\?\$5&page=\$2&type=\$3&id=\$4 [L,QSA]
RewriteR
|
请发表评论