本文整理汇总了PHP中get_custom_file_base函数的典型用法代码示例。如果您正苦于以下问题:PHP get_custom_file_base函数的具体用法?PHP get_custom_file_base怎么用?PHP get_custom_file_base使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_custom_file_base函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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('find_codes', array('h'), array(true)), '', '');
} else {
if (!array_key_exists(0, $parameters)) {
return array('', '', '', do_lang('MISSING_PARAM', '1', 'find_codes'));
}
$path = get_custom_file_base() . '/sources/';
$files = array();
if (is_dir($path)) {
$dh = opendir($path);
while (($file = readdir($dh)) !== false) {
if ($file != '.' && $file != '..') {
if (!is_dir($path . $file)) {
$contents = file_get_contents($path . $file, FILE_TEXT);
if (strpos($contents, $parameters[0]) !== false) {
$files[] = $path . $file;
}
}
unset($contents);
// Got to be careful with that memory :-(
}
}
return array('', do_template('OCCLE_FIND_CODES', array('_GUID' => '3374d1a80727aecc271722f2184743d0', 'FILES' => $files)), '', '');
} else {
return array('', '', '', do_lang('INCOMPLETE_ERROR'));
}
// Directory doesn't exist
}
}
示例2: splurgh_master_build
/**
* Get a splurghified version of the specified item.
*
* @param string The name of what the key we want to reference is in our array of maps (e.g. 'id')
* @param array A row of maps for data we are splurghing; this is probably just the result of $GLOBALS['SITE_DB']->query_select
* @param URLPATH The stub that links will be passed through
* @param ID_TEXT The page name we will be saving customised HTML under
* @param TIME The time we did our last change to the data being splurghed (so it can see if we can simply decache instead of deriving)
* @param ?AUTO_LINK The ID that is at the root of our tree (NULL: db_get_first_id)
* @return string A string of HTML that represents our splurghing (will desplurgh in the users browser)
*/
function splurgh_master_build($key_name, $map, $url_stub, $_cache_file, $last_change_time, $first_id = NULL)
{
if (is_null($first_id)) {
$first_id = db_get_first_id();
}
if (!array_key_exists($first_id, $map)) {
return '';
}
if (!has_js()) {
warn_exit(do_lang_tempcode('MSG_JS_NEEDED'));
}
require_javascript('javascript_splurgh');
if (is_browser_decacheing()) {
$last_change_time = time();
}
$cache_file = zone_black_magic_filterer(get_custom_file_base() . '/' . get_zone_name() . '/pages/html_custom/' . filter_naughty(user_lang()) . '/' . filter_naughty($_cache_file) . '.htm');
if (!file_exists($cache_file) || is_browser_decacheing() || filesize($cache_file) == 0 || $last_change_time > filemtime($cache_file)) {
$myfile = @fopen($cache_file, 'wt');
if ($myfile === false) {
intelligent_write_error($cache_file);
}
$fulltable = array();
$splurgh = _splurgh_do_node($map, $first_id, '', $fulltable, 0);
$page = do_template('SPLURGH', array('_GUID' => '8775edfc5a386fdf2cec69b0fc889952', 'KEY_NAME' => $key_name, 'URL_STUB' => $url_stub, 'SPLURGH' => str_replace('"', '\'', $splurgh)));
$ev = $page->evaluate();
if (fwrite($myfile, $ev) < strlen($ev)) {
warn_exit(do_lang_tempcode('COULD_NOT_SAVE_FILE'));
}
fclose($myfile);
fix_permissions($cache_file);
sync_file($cache_file);
return $ev;
}
return file_get_contents($cache_file, FILE_TEXT);
}
示例3: action
/**
* Standard interface stage of pointstore item purchase.
*
* @return tempcode The UI
*/
function action()
{
require_code('database_action');
$class = str_replace('hook_pointstore_', '', strtolower(get_class($this)));
$title = get_page_title('OCGIFTS_TITLE');
require_code('form_templates');
$map = NULL;
$category = either_param('category', '');
if ($category != '') {
$map = array('category' => $category);
}
$max_rows = $GLOBALS['SITE_DB']->query_value('ocgifts', 'COUNT(*)', $map);
$max = get_param_integer('max', 20);
$start = get_param_integer('start', 0);
require_code('templates_results_browser');
$results_browser = results_browser(do_lang_tempcode('OCGIFTS_TITLE'), get_param('id'), $start, 'start', $max, 'max', $max_rows, NULL, NULL, true, true);
$rows = $GLOBALS['SITE_DB']->query_select('ocgifts g', array('*', '(SELECT COUNT(*) FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'members_gifts m WHERE m.gift_id=g.id) AS popularity'), $map, 'ORDER BY popularity DESC', $max, $start);
$username = get_param('username', '');
$gifts = array();
foreach ($rows as $gift) {
$gift_url = build_url(array('page' => 'pointstore', 'type' => 'action_done', 'id' => 'ocgifts', 'gift' => $gift['id'], 'username' => $username), '_SEARCH');
$image_url = '';
if (is_file(get_custom_file_base() . '/' . rawurldecode($gift['image']))) {
$image_url = get_custom_base_url() . '/' . $gift['image'];
}
$gifts[] = array('NAME' => $gift['name'], 'PRICE' => integer_format($gift['price']), 'POPULARITY' => integer_format($gift['popularity']), 'GIFT_URL' => $gift_url, 'IMAGE_URL' => $image_url);
}
$categories = collapse_1d_complexity('category', $GLOBALS['SITE_DB']->query_select('ocgifts', array('DISTINCT category'), NULL, 'ORDER BY category'));
return do_template('POINTSTORE_OCGIFTS_GIFTS', array('TITLE' => $title, 'GIFTS' => $gifts, 'RESULTS_BROWSER' => $results_browser, 'CATEGORY' => $category, 'CATEGORIES' => $categories));
}
示例4: run
/**
* Standard modular run function.
*
* @return tempcode The result of execution.
*/
function run()
{
require_lang('bulkupload');
$GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/bulkuploadassistant';
$GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_adv_comcode';
$GLOBALS['HELPER_PANEL_TEXT'] = comcode_lang_string('DOC_BULK_UPLOAD');
$title = get_page_title('BULK_UPLOAD');
$parameter = post_param('parameter', '');
require_code('form_templates');
if ($parameter == '') {
$post_url = build_url(array('page' => '_SELF'), '_SELF');
$text = paragraph(do_lang_tempcode('BULK_UPLOAD_HELP'));
$submit_name = do_lang_tempcode('BULK_UPLOAD');
$fields = form_input_line(do_lang_tempcode('DIRECTORY'), do_lang_tempcode('DIRECTORY_BULK'), 'parameter', 'uploads/attachments/' . date('Y-m-d', utctime_to_usertime()), true);
return do_template('FORM_SCREEN', array('_GUID' => '77a2ca460745145d8a1d18cf24971fea', 'SKIP_VALIDATION' => true, 'HIDDEN' => '', 'FIELDS' => $fields, 'URL' => $post_url, 'TITLE' => $title, 'TEXT' => $text, 'SUBMIT_NAME' => $submit_name));
} else {
breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('BULK_UPLOAD'))));
breadcrumb_set_self(do_lang_tempcode('_RESULTS'));
$out = $this->do_dir(get_custom_file_base() . '/' . filter_naughty($parameter, true));
if ($out->is_empty()) {
inform_exit(do_lang_tempcode('NO_FILES'));
}
return do_template('BULK_HELPER_RESULTS_SCREEN', array('_GUID' => '5d373553cf21a58f15006bd4e600a9ee', 'TITLE' => $title, 'RESULTS' => $out));
}
}
示例5: chat_poller
/**
* Function to quickly (efficiently) check to see if there's been any chat activity.
*/
function chat_poller()
{
$message_id = get_param_integer('message_id', -1);
$event_id = get_param_integer('event_id', -1);
if (file_exists(get_custom_file_base() . '/data_custom/modules/chat/chat_last_full_check.dat') && filemtime(get_custom_file_base() . '/data_custom/modules/chat/chat_last_full_check.dat') > time() - 3 && ($message_id != -1 && file_exists(get_custom_file_base() . '/data_custom/modules/chat/chat_last_msg.dat') && intval(file_get_contents(get_custom_file_base() . '/data_custom/modules/chat/chat_last_msg.dat', FILE_TEXT)) <= $message_id) && ($event_id != -1 && file_exists(get_custom_file_base() . '/data_custom/modules/chat/chat_last_event.dat') && intval(file_get_contents(get_custom_file_base() . '/data_custom/modules/chat/chat_last_event.dat', FILE_TEXT)) <= $event_id)) {
load_user_stuff();
require_code('zones');
// Zone is needed because zones are where all ocPortal pages reside
require_code('config');
// Config is needed for much active stuff
require_code('users');
// Users are important due to permissions
$room_id = get_param_integer('room_id', -1);
require_code('chat');
chat_room_prune($room_id);
header("Cache-Control: no-cache, must-revalidate");
// HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// Date in the past
header('Content-Type: application/xml');
$output = '<?xml version="1.0" encoding="' . get_charset() . '" ?' . '>
<response>
<result>
<chat_null>' . strval($room_id) . '</chat_null>
</result>
</response>';
exit($output);
}
touch(get_custom_file_base() . '/data_custom/modules/chat/chat_last_full_check.dat');
}
示例6: uninstall
/**
* Standard modular uninstall function.
*/
function uninstall()
{
$GLOBALS['SITE_DB']->drop_if_exists('catalogues');
$GLOBALS['SITE_DB']->drop_if_exists('catalogue_fields');
$GLOBALS['SITE_DB']->drop_if_exists('catalogue_categories');
$GLOBALS['SITE_DB']->drop_if_exists('catalogue_entries');
$GLOBALS['SITE_DB']->drop_if_exists('catalogue_efv_long_trans');
$GLOBALS['SITE_DB']->drop_if_exists('catalogue_efv_short_trans');
$GLOBALS['SITE_DB']->drop_if_exists('catalogue_efv_long');
$GLOBALS['SITE_DB']->drop_if_exists('catalogue_efv_short');
$GLOBALS['SITE_DB']->drop_if_exists('catalogue_efv_float');
$GLOBALS['SITE_DB']->drop_if_exists('catalogue_efv_integer');
$GLOBALS['SITE_DB']->drop_if_exists('catalogue_entry_linkage');
$GLOBALS['SITE_DB']->drop_if_exists('catalogue_cat_treecache');
$GLOBALS['SITE_DB']->drop_if_exists('catalogue_childcountcache');
$GLOBALS['SITE_DB']->query_delete('group_category_access', array('module_the_name' => 'catalogues_category'));
$GLOBALS['SITE_DB']->query_delete('group_category_access', array('module_the_name' => 'catalogues_catalogue'));
$GLOBALS['SITE_DB']->query_delete('trackbacks', array('trackback_for_type' => 'catalogues'));
deldir_contents(get_custom_file_base() . '/uploads/catalogues', true);
delete_specific_permission('high_catalogue_entry_timeout');
delete_menu_item_simple('_SEARCH:catalogues:type=misc');
$cf = $GLOBALS['SITE_DB']->query_value_null_ok('menu_items', 'id', array('i_menu' => 'collab_features', 'i_url' => ''));
if (!is_null($cf)) {
delete_menu_item($cf);
}
delete_menu_item_simple('_SEARCH:catalogues:id=projects:type=index');
delete_menu_item_simple('_SEARCH:cms_catalogues:catalogue_name=projects:type=add_entry');
}
示例7: uninstall
/**
* Standard modular uninstall function.
*/
function uninstall()
{
$GLOBALS['SITE_DB']->drop_if_exists('download_categories');
$GLOBALS['SITE_DB']->drop_if_exists('download_downloads');
$GLOBALS['SITE_DB']->drop_if_exists('download_logging');
$GLOBALS['SITE_DB']->drop_if_exists('download_licences');
delete_config_option('maximum_download');
delete_config_option('is_on_downloads');
delete_config_option('show_dload_trees');
delete_config_option('points_ADD_DOWNLOAD');
delete_config_option('downloads_show_stats_count_total');
delete_config_option('downloads_show_stats_count_archive');
delete_config_option('downloads_show_stats_count_downloads');
delete_config_option('downloads_show_stats_count_bandwidth');
delete_config_option('immediate_downloads');
delete_config_option('download_gallery_root');
$GLOBALS['SITE_DB']->query_delete('group_category_access', array('module_the_name' => 'downloads'));
$GLOBALS['SITE_DB']->query_delete('trackbacks', array('trackback_for_type' => 'downloads'));
delete_value('download_bandwidth');
delete_value('archive_size');
delete_value('num_archive_downloads');
delete_value('num_downloads_downloaded');
deldir_contents(get_custom_file_base() . '/uploads/downloads', true);
delete_menu_item_simple('_SEARCH:downloads:type=misc');
}
示例8: get_chmod_array
/**
* Get the list of files that need CHmodding for write access.
*
* @return array The list of files
*/
function get_chmod_array()
{
global $LANG;
// if ((function_exists('ocp_enterprise')) && (ocp_enterprise()))
// {
$extra_files = array('collaboration/pages/html_custom', 'collaboration/pages/html_custom/' . $LANG, 'collaboration/pages/comcode_custom', 'collaboration/pages/comcode_custom/' . $LANG);
// } else $extra_files=array();
if (function_exists('find_all_hooks')) {
$hooks = find_all_hooks('systems', 'addon_registry');
$hook_keys = array_keys($hooks);
foreach ($hook_keys as $hook) {
//require_code('hooks/systems/addon_registry/'.filter_naughty_harsh($hook));
//$object=object_factory('Hook_addon_registry_'.filter_naughty_harsh($hook));
//$extra_files=array_merge($extra_files,$object->get_chmod_array());
// Save memory compared to above commented code...
$path = get_custom_file_base() . '/sources/hooks/systems/addon_registry/' . filter_naughty_harsh($hook) . '.php';
if (!file_exists($path)) {
$path = get_file_base() . '/sources/hooks/systems/addon_registry/' . filter_naughty_harsh($hook) . '.php';
}
$matches = array();
if (preg_match('#function get_chmod_array\\(\\)\\s*\\{([^\\}]*)\\}#', file_get_contents($path), $matches) != 0) {
if (!defined('HIPHOP_PHP')) {
$extra_files = array_merge($extra_files, eval($matches[1]));
} else {
require_code('hooks/systems/addon_registry/' . $hook);
$hook = object_factory('Hook_addon_registry_' . $hook);
$extra_files = array_merge($extra_files, $hook->get_chmod_array());
}
}
}
}
return array_merge($extra_files, array('safe_mode_temp', 'persistant_cache', 'data_custom/modules/admin_backup', 'data_custom/modules/chat', 'data_custom/fields.xml', 'data_custom/breadcrumbs.xml', 'data_custom/modules/admin_stats', 'data_custom/spelling/write.log', 'data_custom/spelling/output.log', 'data_custom/spelling/personal_dicts', 'themes/map.ini', 'text_custom', 'text_custom/' . $LANG, 'data_custom/modules/chat/chat_last_msg.dat', 'data_custom/modules/chat/chat_last_event.dat', 'lang_cached', 'lang_cached/' . $LANG, 'lang_custom', 'lang_custom/' . $LANG, 'data_custom/errorlog.php', 'ocp_sitemap.xml', 'data_custom/permissioncheckslog.php', 'pages/html_custom', 'site/pages/html_custom', 'docs/pages/html_custom', 'adminzone/pages/html_custom', 'forum/pages/html_custom', 'cms/pages/html_custom', 'pages/html_custom/' . $LANG, 'site/pages/html_custom/' . $LANG, 'docs/pages/html_custom/' . $LANG, 'adminzone/pages/html_custom/' . $LANG, 'forum/pages/html_custom/' . $LANG, 'cms/pages/html_custom/' . $LANG, 'pages/comcode_custom', 'site/pages/comcode_custom', 'docs/pages/comcode_custom', 'adminzone/pages/comcode_custom', 'forum/pages/comcode_custom', 'cms/pages/comcode_custom', 'pages/comcode_custom/' . $LANG, 'site/pages/comcode_custom/' . $LANG, 'docs/pages/comcode_custom/' . $LANG, 'adminzone/pages/comcode_custom/' . $LANG, 'forum/pages/comcode_custom/' . $LANG, 'cms/pages/comcode_custom/' . $LANG, 'themes/default/css_custom', 'themes/default/images_custom', 'themes/default/templates_custom', 'themes/default/templates_cached', 'themes/default/templates_cached/' . $LANG, 'themes/default/theme.ini', 'uploads/incoming', 'uploads/website_specific', 'uploads/personal_sound_effects', 'uploads/banners', 'uploads/downloads', 'uploads/galleries', 'uploads/watermarks', 'uploads/grepimages', 'uploads/galleries_thumbs', 'uploads/iotds', 'uploads/iotds_thumbs', 'uploads/catalogues', 'uploads/attachments', 'uploads/attachments_thumbs', 'uploads/auto_thumbs', 'uploads/ocf_avatars', 'uploads/ocf_cpf_upload', 'uploads/ocf_photos', 'uploads/ocf_photos_thumbs', 'uploads/filedump', 'info.php', 'exports/backups', 'exports/file_backups', 'exports/mods', 'imports/mods', 'site/pages/html_custom/' . $LANG . '/download_tree_made.htm', 'site/pages/html_custom/' . $LANG . '/cedi_tree_made.htm'));
}
示例9: run
/**
* Standard modular run function for snippet hooks. Generates XHTML to insert into a page using AJAX.
*
* @return tempcode The snippet
*/
function run()
{
$val = get_param('name');
$test = file_exists(get_file_base() . '/themes/' . $val) || file_exists(get_custom_file_base() . '/themes/' . $val);
if (!$test) {
return new ocp_tempcode();
}
return make_string_tempcode(str_replace(array('‘', '’', '“', '”'), array('"', '"', '"', '"'), html_entity_decode(do_lang('ALREADY_EXISTS', escape_html($val)), ENT_QUOTES)));
}
示例10: _do_template
/**
* A template has not been structurally cached, so compile it and store in the cache.
*
* @param ID_TEXT The theme the template is in the context of
* @param PATH The path to the template file
* @param ID_TEXT The codename of the template (e.g. foo)
* @param ID_TEXT The actual codename to use for the template (e.g. thin_foo)
* @param LANGUAGE_NAME The language the template is in the context of
* @param string File type suffix of template file
* @param ?ID_TEXT The theme to cache in (NULL: main theme)
* @return tempcode The compiled tempcode
*/
function _do_template($theme, $path, $codename, $_codename, $lang, $suffix, $theme_orig = NULL)
{
if (is_null($theme_orig)) {
$theme_orig = $theme;
}
$base_dir = ($theme == 'default' && ($suffix != '.css' || strpos($path, '/css_custom') === false) ? get_file_base() : get_custom_file_base()) . '/themes/';
global $CACHE_TEMPLATES, $FILE_ARRAY, $TEMPLATE_PREVIEW_OP, $MEM_CACHE;
if (isset($FILE_ARRAY)) {
$html = unixify_line_format(file_array_get('themes/' . $theme . $path . $codename . $suffix));
} else {
$html = unixify_line_format(file_get_contents($base_dir . filter_naughty($theme . $path . $codename) . $suffix, FILE_TEXT));
}
if (strpos($html, '{$,Parser hint: pure}') !== false) {
return make_string_tempcode(preg_replace('#\\{\\$,.*\\}#U', '/*no minify*/', $html));
}
if ($GLOBALS['SEMI_DEBUG_MODE'] && strpos($html, '.innerHTML') !== false && strpos($html, 'Parser hint: .innerHTML okay') === false) {
require_code('site');
attach_message('Do not use the .innerHTML property in your Javascript because it will not work in true XHTML (when the browsers real XML parser is in action). Use ocPortal\'s global setInnerHTML/getInnerHTML functions.', 'warn');
}
// Strip off trailing final lines from single lines templates. Editors often put these in, and it causes annoying "visible space" issues
if (substr($html, -1, 1) == chr(10) && substr_count($html, chr(10)) == 1) {
$html = substr($html, 0, strlen($html) - 1);
}
if ($TEMPLATE_PREVIEW_OP) {
$test = post_param($codename, NULL);
if (!is_null($test)) {
$html = post_param($test . '_new');
}
}
$result = template_to_tempcode($html, 0, false, $codename, $theme, $lang);
if ($CACHE_TEMPLATES && ($suffix == '.tpl' || $codename == 'no_cache')) {
if (!is_null($MEM_CACHE)) {
persistant_cache_set(array('TEMPLATE', $theme, $lang, $_codename), $result->to_assembly(), strpos($path, 'default/templates/') !== false);
} else {
$path2 = get_custom_file_base() . '/themes/' . $theme_orig . '/templates_cached/' . filter_naughty($lang) . '/';
$myfile = @fopen($path2 . filter_naughty($_codename) . $suffix . '.tcd', 'wb');
if ($myfile === false) {
if (@mkdir($path2, 0777)) {
require_code('files');
fix_permissions($path2, 0777);
} else {
if (file_exists($path2 . filter_naughty($_codename) . $suffix . '.tcd')) {
warn_exit(do_lang_tempcode('WRITE_ERROR', $path2 . filter_naughty($_codename) . $suffix . '.tcd'));
} else {
warn_exit(do_lang_tempcode('WRITE_ERROR_CREATE', $path2 . filter_naughty($_codename) . $suffix . '.tcd'));
}
}
} else {
fwrite($myfile, $result->to_assembly($lang));
fclose($myfile);
fix_permissions($path2 . filter_naughty($_codename) . $suffix . '.tcd');
}
}
}
return $result;
}
示例11: uninstall
/**
* Standard modular uninstall function.
*/
function uninstall()
{
$GLOBALS['SITE_DB']->drop_if_exists('iotd');
delete_specific_permission('choose_iotd');
$GLOBALS['SITE_DB']->query_delete('trackbacks', array('trackback_for_type' => 'iotds'));
deldir_contents(get_custom_file_base() . '/uploads/iotds', true);
delete_config_option('points_ADD_IOTD');
delete_config_option('points_CHOOSE_IOTD');
delete_config_option('iotd_update_time');
}
示例12: run
/**
* Standard modular run function for snippet hooks. Generates XHTML to insert into a page using AJAX.
*
* @return tempcode The snippet
*/
function run()
{
if (get_file_base() != get_custom_file_base()) {
warn_exit(do_lang_tempcode('SHARED_INSTALL_PROHIBIT'));
}
if (has_actual_page_access(get_member(), 'admin_occle')) {
require_code('occle');
require_lang('occle');
$title = get_page_title('OCCLE');
return do_template('OCCLE_MAIN', array('COMMANDS' => '', 'SUBMIT_URL' => build_url(array('page' => 'admin_occle'), 'adminzone'), 'PROMPT' => do_lang_tempcode('COMMAND_PROMPT', escape_html($GLOBALS['FORUM_DRIVER']->get_username(get_member())))));
}
return new ocp_tempcode();
}
示例13: 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']);
}
示例14: directory_thumb_mirror
/**
* Create filename-mirrored thumbnails for the given directory stub (mirrors stub/foo with stub_thumbs/foo).
*
* @param string Directory to mirror
*/
function directory_thumb_mirror($dir)
{
require_code('images');
$full = get_custom_file_base() . '/uploads/' . $dir;
$dh = @opendir($full);
if ($dh !== false) {
while (($file = readdir($dh)) !== false) {
$target = get_custom_file_base() . '/' . $dir . '_thumbs/' . $file;
if (!file_exists($target) && is_image($full . '/' . $file)) {
require_code('images');
convert_image($full . '/' . $file, $target, -1, -1, intval(get_option('thumb_width')));
}
}
}
closedir($dh);
}
示例15: run
/**
* Standard modular run function.
*
* @return tempcode Results
*/
function run()
{
$GLOBALS['SITE_DB']->query('DELETE FROM ' . get_table_prefix() . 'theme_images WHERE path LIKE \'themes/%/images/%\'');
persistant_cache_delete('THEME_IMAGES');
$paths = $GLOBALS['SITE_DB']->query_select('theme_images', array('path', 'id'));
foreach ($paths as $path) {
if ($path['path'] == '') {
$GLOBALS['SITE_DB']->query_delete('theme_images', $path, '', 1);
} elseif (preg_match('#^themes/[^/]+/images_custom/+' . str_replace('#', '\\#', preg_quote($path['id'])) . '\\.#', $path['path']) != 0) {
if (!file_exists(get_custom_file_base() . '/' . $path['path']) && !file_exists(get_file_base() . '/' . $path['path'])) {
$GLOBALS['SITE_DB']->query_delete('theme_images', $path, '', 1);
}
}
}
return new ocp_tempcode();
}