本文整理汇总了PHP中get_file_base函数的典型用法代码示例。如果您正苦于以下问题:PHP get_file_base函数的具体用法?PHP get_file_base怎么用?PHP get_file_base使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_file_base函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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
示例2: get_chmod_array
/**
* Get the list of files that need CHmodding for write access.
*
* @return array The list of files
*/
function get_chmod_array()
{
global $LANG;
// if ((function_exists('ocp_enterprise')) && (ocp_enterprise()))
// {
$extra_files = array('collaboration/pages/html_custom', 'collaboration/pages/html_custom/' . $LANG, 'collaboration/pages/comcode_custom', 'collaboration/pages/comcode_custom/' . $LANG);
// } else $extra_files=array();
if (function_exists('find_all_hooks')) {
$hooks = find_all_hooks('systems', 'addon_registry');
$hook_keys = array_keys($hooks);
foreach ($hook_keys as $hook) {
//require_code('hooks/systems/addon_registry/'.filter_naughty_harsh($hook));
//$object=object_factory('Hook_addon_registry_'.filter_naughty_harsh($hook));
//$extra_files=array_merge($extra_files,$object->get_chmod_array());
// Save memory compared to above commented code...
$path = get_custom_file_base() . '/sources/hooks/systems/addon_registry/' . filter_naughty_harsh($hook) . '.php';
if (!file_exists($path)) {
$path = get_file_base() . '/sources/hooks/systems/addon_registry/' . filter_naughty_harsh($hook) . '.php';
}
$matches = array();
if (preg_match('#function get_chmod_array\\(\\)\\s*\\{([^\\}]*)\\}#', file_get_contents($path), $matches) != 0) {
if (!defined('HIPHOP_PHP')) {
$extra_files = array_merge($extra_files, eval($matches[1]));
} else {
require_code('hooks/systems/addon_registry/' . $hook);
$hook = object_factory('Hook_addon_registry_' . $hook);
$extra_files = array_merge($extra_files, $hook->get_chmod_array());
}
}
}
}
return array_merge($extra_files, array('safe_mode_temp', 'persistant_cache', 'data_custom/modules/admin_backup', 'data_custom/modules/chat', 'data_custom/fields.xml', 'data_custom/breadcrumbs.xml', 'data_custom/modules/admin_stats', 'data_custom/spelling/write.log', 'data_custom/spelling/output.log', 'data_custom/spelling/personal_dicts', 'themes/map.ini', 'text_custom', 'text_custom/' . $LANG, 'data_custom/modules/chat/chat_last_msg.dat', 'data_custom/modules/chat/chat_last_event.dat', 'lang_cached', 'lang_cached/' . $LANG, 'lang_custom', 'lang_custom/' . $LANG, 'data_custom/errorlog.php', 'ocp_sitemap.xml', 'data_custom/permissioncheckslog.php', 'pages/html_custom', 'site/pages/html_custom', 'docs/pages/html_custom', 'adminzone/pages/html_custom', 'forum/pages/html_custom', 'cms/pages/html_custom', 'pages/html_custom/' . $LANG, 'site/pages/html_custom/' . $LANG, 'docs/pages/html_custom/' . $LANG, 'adminzone/pages/html_custom/' . $LANG, 'forum/pages/html_custom/' . $LANG, 'cms/pages/html_custom/' . $LANG, 'pages/comcode_custom', 'site/pages/comcode_custom', 'docs/pages/comcode_custom', 'adminzone/pages/comcode_custom', 'forum/pages/comcode_custom', 'cms/pages/comcode_custom', 'pages/comcode_custom/' . $LANG, 'site/pages/comcode_custom/' . $LANG, 'docs/pages/comcode_custom/' . $LANG, 'adminzone/pages/comcode_custom/' . $LANG, 'forum/pages/comcode_custom/' . $LANG, 'cms/pages/comcode_custom/' . $LANG, 'themes/default/css_custom', 'themes/default/images_custom', 'themes/default/templates_custom', 'themes/default/templates_cached', 'themes/default/templates_cached/' . $LANG, 'themes/default/theme.ini', 'uploads/incoming', 'uploads/website_specific', 'uploads/personal_sound_effects', 'uploads/banners', 'uploads/downloads', 'uploads/galleries', 'uploads/watermarks', 'uploads/grepimages', 'uploads/galleries_thumbs', 'uploads/iotds', 'uploads/iotds_thumbs', 'uploads/catalogues', 'uploads/attachments', 'uploads/attachments_thumbs', 'uploads/auto_thumbs', 'uploads/ocf_avatars', 'uploads/ocf_cpf_upload', 'uploads/ocf_photos', 'uploads/ocf_photos_thumbs', 'uploads/filedump', 'info.php', 'exports/backups', 'exports/file_backups', 'exports/mods', 'imports/mods', 'site/pages/html_custom/' . $LANG . '/download_tree_made.htm', 'site/pages/html_custom/' . $LANG . '/cedi_tree_made.htm'));
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:38,代码来源:inst_special.php
示例3: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
require_code('type_validation');
require_lang('phpdoc');
require_code('php');
require_css('adminzone');
disable_php_memory_limit();
$filename = (array_key_exists('param', $map) ? $map['param'] : 'sources/global2') . '.php';
if (substr($filename, -8) == '.php.php') {
$filename = substr($filename, 0, strlen($filename) - 4);
}
$full_path = (get_file_base() != '' ? get_file_base() . '/' : '') . filter_naughty($filename);
if (!file_exists($full_path)) {
return paragraph(do_lang_tempcode('MISSING_RESOURCE'));
}
$_classes = get_php_file_api($filename);
$classes = new ocp_tempcode();
foreach ($_classes as $class) {
if ($class['name'] == '__global') {
$class['name'] = do_lang('GLOBAL_FUNCTIONS') . '_' . basename($filename);
}
$function_summaries = new ocp_tempcode();
$functions = new ocp_tempcode();
foreach ($class['functions'] as $function) {
$ret = render_php_function($function, $class);
$functions->attach($ret[0]);
$function_summaries->attach($ret[1]);
}
$classes->attach(do_template('PHP_CLASS', array('_GUID' => '5d58fc42c5fd3a5dd190f3f3699610c2', 'CLASS_NAME' => $class['name'], 'FUNCTION_SUMMARIES' => $function_summaries, 'FUNCTIONS' => $functions)));
}
return do_template('PHP_FILE', array('_GUID' => '6f422e6a6e846d49864d7325b212109f', 'FILENAME' => $filename, 'CLASSES' => $classes));
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:38,代码来源:main_code_documentor.php
示例4: init__users
function init__users()
{
//if (addon_installed('Facebook Support',true))
if (is_file(get_file_base() . '/sources/facebook_connect.php')) {
require_code('facebook_connect');
}
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:7,代码来源:users.php
示例5: get_fields_hook
/**
* Get a fields hook, from a given codename.
*
* @param ID_TEXT Codename
* @return object Hook object
*/
function get_fields_hook($type)
{
static $fields_hook_cache = array();
if (isset($fields_hook_cache[$type])) {
return $fields_hook_cache[$type];
}
$path = 'hooks/systems/fields/' . filter_naughty($type);
if (!in_array($type, array('author', 'auto_increment', 'codename', 'color', 'content_link', 'date', 'email', 'float', 'guid', 'integer', 'just_date', 'just_time', 'list', 'long_text', 'long_trans', 'page_link', 'password', 'picture', 'video', 'posting_field', 'radiolist', 'random', 'reference', 'short_text', 'short_trans', 'theme_image', 'tick', 'upload', 'url', 'user')) && !is_file(get_file_base() . '/sources/' . $path . '.php') && !is_file(get_file_base() . '/sources_custom/' . $path . '.php')) {
$hooks = find_all_hooks('systems', 'fields');
foreach (array_keys($hooks) as $hook) {
$path = 'hooks/systems/fields/' . filter_naughty($hook);
require_code($path);
$ob = object_factory('Hook_fields_' . filter_naughty($hook));
if (method_exists($ob, 'get_field_types')) {
if (array_key_exists($type, $ob->get_field_types())) {
$fields_hook_cache[$type] = $ob;
return $ob;
}
}
}
}
require_code($path);
$ob = object_factory('Hook_fields_' . filter_naughty($type), true);
if (is_null($ob)) {
return get_fields_hook('short_text');
}
$fields_hook_cache[$type] = $ob;
return $ob;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:35,代码来源:fields.php
示例6: destrictify
/**
* Remove ocPortal's strictness, to help integration of third-party code.
*
* @param boolean Whether to also set the content type to plain-HTML
* @param boolean Whether to destrictify MySQL commands over the ocPortal database driver
*/
function destrictify($change_content_type = true, $mysql_too = false)
{
// Turn off strictness
if (!headers_sent() && $change_content_type) {
@header('Content-type: text/html; charset=' . get_charset());
}
$GLOBALS['SCREEN_TEMPLATE_CALLED'] = '';
$GLOBALS['TITLE_CALLED'] = true;
error_reporting(E_ALL ^ E_NOTICE);
if (function_exists('set_time_limit')) {
@set_time_limit(200);
}
if (get_forum_type() == 'ocf' && $mysql_too) {
$GLOBALS['SITE_DB']->query('SET sql_mode=\'\'', NULL, NULL, true);
}
@ini_set('ocproducts.type_strictness', '0');
global $PREVIOUS_XSS_STATE;
array_push($PREVIOUS_XSS_STATE, ini_get('ocproducts.xss_detect'));
$include_path = './';
$include_path .= PATH_SEPARATOR . get_file_base() . '/';
$include_path .= PATH_SEPARATOR . get_file_base() . '/sources_custom/';
$include_path .= PATH_SEPARATOR . get_file_base() . '/uploads/website_specific/';
if (get_zone_name() != '') {
$include_path .= PATH_SEPARATOR . get_file_base() . '/' . get_zone_name() . '/';
}
@ini_set('include_path', $include_path);
//disable_php_memory_limit(); Don't do this, recipe for disaster
@ini_set('allow_url_fopen', '1');
@ini_set('suhosin.executor.disable_emodifier', '0');
@ini_set('suhosin.executor.multiheader', '0');
$GLOBALS['NO_DB_SCOPE_CHECK'] = true;
$GLOBALS['NO_QUERY_LIMIT'] = true;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:39,代码来源:developer_tools.php
示例7: adminzone_extend_breadcrumbs
/**
* Extend breadcrumbs for the Admin Zone (called by breadcrumbs_get_default_stub).
*
* @param tempcode Reference to the breadcrumbs stub we're assembling
*/
function adminzone_extend_breadcrumbs(&$stub)
{
global $BREADCRUMB_SET_PARENTS;
if (count($BREADCRUMB_SET_PARENTS) > 0 && !is_object($BREADCRUMB_SET_PARENTS[0][0])) {
// Works by finding where our oldest ancestor connects on to the do-next menus, and carries from there
list($zone, $attributes, ) = page_link_decode($BREADCRUMB_SET_PARENTS[0][0]);
$type = array_key_exists('type', $attributes) ? $attributes['type'] : 'misc';
$page = $attributes['page'];
if ($page == '_SELF') {
$page = get_page_name();
}
if ($zone == '_SEARCH') {
$zone = get_module_zone($page);
}
if ($zone == '_SELF') {
$zone = get_zone_name();
}
} else {
// Works by finding where we connect on to the do-next menus, and carries from there
$type = get_param('type', 'misc');
$page = get_page_name();
$zone = get_zone_name();
}
if ($page != 'admin' && $page != 'cms') {
// Loop over menus, hunting for connection
$hooks = find_all_hooks('systems', 'do_next_menus');
$_hooks = array();
$page_looking = $page;
$page_looking = preg_replace('#^(cms|admin)\\_#', '', $page_looking);
if (array_key_exists($page_looking, $hooks)) {
$_hooks[$page_looking] = $hooks[$page_looking];
unset($hooks[$page_looking]);
$hooks = array_merge($_hooks, $hooks);
}
foreach ($hooks as $hook => $sources_dir) {
$run_function = extract_module_functions(get_file_base() . '/' . $sources_dir . '/hooks/systems/do_next_menus/' . $hook . '.php', array('run'));
if ($run_function[0] !== NULL) {
$info = is_array($run_function[0]) ? call_user_func_array($run_function[0][0], $run_function[0][1]) : eval($run_function[0]);
foreach ($info as $i) {
if ($i === NULL) {
continue;
}
if ($page == $i[2][0] && (!array_key_exists('type', $i[2][1]) && $type == 'misc' || array_key_exists('type', $i[2][1]) && ($type == $i[2][1]['type'] || $i[2][1]['type'] == 'misc')) && $zone == $i[2][2]) {
if ($i[0] == 'cms') {
$url = build_url(array('page' => 'cms', 'type' => $i[0] == 'cms' ? NULL : $i[0]), 'cms');
} else {
$url = build_url(array('page' => 'admin', 'type' => $i[0]), 'adminzone');
}
require_lang('menus');
require_lang('security');
$stub->attach(hyperlink($url, do_lang_tempcode(strtoupper($i[0])), false, false, do_lang_tempcode('GO_BACKWARDS_TO', @html_entity_decode(strip_tags(do_lang(strtoupper($i[0]))), ENT_QUOTES, get_charset()))));
//if ((!array_key_exists('type',$i[2][1])) || ($type==$i[2][1]['type'])) break;
return;
}
}
}
}
}
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:64,代码来源:site_adminzone.php
示例8: delete
/**
* (Plug-in replacement for memcache API) Delete data from the persistant cache.
*
* @param mixed Key name
*/
function delete($key)
{
// Update list of e-objects
global $ECACHE_OBJECTS;
unset($ECACHE_OBJECTS[$key]);
@apc_store(get_file_base() . 'ECACHE_OBJECTS', $ECACHE_OBJECTS, 0);
apc_delete($key);
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:13,代码来源:caches_apc.php
示例9: delete
/**
* (Plug-in replacement for memcache API) Delete data from the persistant cache.
*
* @param mixed Key name
*/
function delete($key)
{
// Update list of e-objects
global $ECACHE_OBJECTS;
unset($ECACHE_OBJECTS[$key]);
xcache_set(get_file_base() . 'ECACHE_OBJECTS', $ECACHE_OBJECTS, 0);
xcache_unset($key);
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:13,代码来源:caches_xcache.php
示例10: 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)));
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:14,代码来源:exists_theme.php
示例11: testBotListInSync
function testBotListInSync()
{
require_code('files');
$file_bots = better_parse_ini_file(get_file_base() . '/text/bots.txt');
ksort($file_bots);
global $BOT_MAP;
ksort($BOT_MAP);
$this->assertTrue($BOT_MAP == $file_bots);
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:9,代码来源:bot_list_sync.php
示例12: _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;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:68,代码来源:tempcode_compiler__runtime.php
示例13: set
/**
* (Plug-in replacement for memcache API) Put data into the persistent cache.
*
* @param mixed Key
* @param mixed The data
* @param integer Various flags (parameter not used)
* @param integer The expiration time in seconds.
*/
function set($_key, $data, $flags, $expire_secs)
{
$key = serialize($_key);
// Update list of e-objects
global $ECACHE_OBJECTS;
if (!array_key_exists($key, $ECACHE_OBJECTS)) {
$ECACHE_OBJECTS[$key] = 1;
$this->set(get_file_base() . 'ECACHE_OBJECTS', $ECACHE_OBJECTS, 0, 0);
}
parent::set($key, serialize(array(time(), $data)), $flags, $expire_secs);
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:19,代码来源:caches_memcache.php
示例14: get_mime_type
/**
* Find the mime type for the given file extension. It does not take into account whether the file type has been white-listed or not, and returns a binary download mime type for any unknown extensions.
*
* @param string The file extension (no dot)
* @return string The MIME type
*/
function get_mime_type($extension)
{
$mime_types = array('1st' => 'text/plain', 'txt' => 'text/plain', '' => 'text/plain', 'pdf' => 'application/pdf', 'rtf' => 'text/richtext', 'ps' => 'application/postscript', 'html' => 'application/octet-stream', 'htm' => 'application/octet-stream', 'odt' => 'application/vnd.oasis.opendocument.text', 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', 'odp' => 'application/vnd.oasis.opendocument.presentation', 'doc' => 'application/msword', 'mdb' => 'application/x-msaccess', 'xls' => 'application/vnd.ms-excel', 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'xml' => 'application/octet-stream', 'rss' => 'application/octet-stream', 'atom' => 'application/octet-stream', 'ppt' => 'application/powerpoint', 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'svg' => 'application/octet-stream', 'wrl' => 'model/vrml', 'vrml' => 'model/vrml', 'swf' => 'application/octet-stream', 'png' => 'image/png', 'gif' => 'image/gif', 'jpg' => 'image/jpeg', 'jpe' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'psd' => 'image/x-photoshop', 'bmp' => 'image/x-MS-bmp', 'tga' => 'image/x-targa', 'tif' => 'image/tiff', 'tiff' => 'image/tiff', 'pcx' => 'image/x-pcx', 'ico' => 'image/vnd.microsoft.icon', 'avi' => 'video/mpeg', 'mpg' => 'video/mpeg', 'mpe' => 'video/mpeg', '3gp' => 'video/3gpp', 'mp4' => 'video/mp4', 'm4v' => 'video/mp4', 'mpeg' => 'video/mpeg', 'ogv' => 'video/ogg', 'webm' => 'video/webm', 'mov' => 'video/quicktime', 'qt' => 'video/quicktime', 'wmv' => 'video/x-ms-wmv', 'ram' => 'audio/x-pn-realaudio', 'rm' => 'audio/x-pn-realaudio', 'asf' => 'video/x-ms-asf', 'ra' => 'audio/x-pn-realaudio-plugin', 'wma' => 'audio/x-ms-wma', 'wav' => 'audio/x-wav', 'mp3' => 'audio/x-mpeg', 'ogg' => 'audio/ogg', 'mid' => 'audio/midi', 'torrent' => 'application/x-bittorrent');
if (file_exists(get_file_base() . '/data/flvplayer.swf')) {
$mime_types['flv'] = 'video/x-flv';
}
if (array_key_exists($extension, $mime_types)) {
return $mime_types[$extension];
}
return 'application/octet-stream';
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:17,代码来源:mime_types.php
示例15: 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();
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:18,代码来源:occle.php
示例16: setUp
function setUp()
{
parent::setUp();
require_code('rss');
$rssfeed = get_file_base() . "/_tests/tests/testrss.cms";
$atomfeed = get_file_base() . "/_tests/tests/testatom.cms";
$rss = new rss($rssfeed, true);
$atom = new rss($atomfeed, true);
$rsstitle = $rss->gleamed_items[0]['title'];
$atomtitle = $atom->gleamed_items[0]['title'];
$this->assertTrue('Item Example' == $rsstitle);
$this->assertTrue('Atom-Powered Robots Run Amok' == $atomtitle);
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:13,代码来源:rss.php
示例17: run
/**
* Standard modular run function for snippet hooks. Generates XHTML to insert into a page using AJAX.
*
* @return tempcode The snippet
*/
function run()
{
$zone = get_param('name');
$test = file_exists(get_file_base() . '/' . $zone);
if (!$test) {
return new ocp_tempcode();
}
$test = $GLOBALS['SITE_DB']->query_value_null_ok('zones', 'zone_header_text', array('zone_name' => $zone));
if (is_null($test)) {
return new ocp_tempcode();
}
return make_string_tempcode(str_replace(array('‘', '’', '“', '”'), array('"', '"', '"', '"'), html_entity_decode(do_lang('ALREADY_EXISTS', escape_html($zone)), ENT_QUOTES)));
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:18,代码来源:exists_zone.php
示例18: run
/**
* Standard modular run function for CRON hooks. Searches for tasks to perform.
*/
function run()
{
//if (!addon_installed('octhief')) return;
require_lang('insults');
// ensure it is done once per week
$time = time();
$last_time = intval(get_value('last_insult_time'));
if ($last_time > time() - 24 * 60 * 60) {
return;
}
// run it once a day
set_value('last_insult_time', strval($time));
// how many points a correct response will give
$_insult_points = get_option('insult_points', true);
if (is_null($_insult_points)) {
// add option and default value if not installed yet
require_code('database_action');
add_config_option('INSULT_POINTS', 'insult_points', 'integer', 'return \'10\';', 'POINTS', 'INSULT_TITLE');
}
$insult_points = isset($_insult_points) && is_numeric($_insult_points) ? intval($_insult_points) : 10;
// who to insult?
$selected_members = $GLOBALS['FORUM_DB']->query('SELECT id FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_members WHERE id <> ' . strval($GLOBALS['FORUM_DRIVER']->get_guest_id()) . ' ORDER BY RAND( ) ', 2, NULL, true);
$selected_member1 = isset($selected_members[0]['id']) && $selected_members[0]['id'] > 0 ? $selected_members[0]['id'] : 0;
$selected_member2 = isset($selected_members[1]['id']) && $selected_members[1]['id'] > 0 ? $selected_members[1]['id'] : 0;
// send insult to picked members
if ($selected_member1 != 0 && $selected_member2 != 0) {
$get_insult = '';
if (is_file(get_file_base() . '/text_custom/' . user_lang() . '/insults.txt')) {
$insults = file(get_file_base() . '/text_custom/' . user_lang() . '/insults.txt');
$insults_array = array();
foreach ($insults as $insult) {
$x = explode('=', $insult);
$insults_array[] = $x[0];
}
$rand_key = array_rand($insults_array, 1);
$rand_key = is_array($rand_key) ? $rand_key[0] : $rand_key;
$get_insult = $insults_array[$rand_key];
}
if ($get_insult != '') {
global $SITE_INFO;
$insult_pt_topic_post = do_lang('INSULT_EXPLANATION', get_site_name(), $get_insult, $insult_points);
$subject = do_lang('INSULT_PT_TOPIC', $GLOBALS['FORUM_DRIVER']->get_username($selected_member2), $GLOBALS['FORUM_DRIVER']->get_username($selected_member1));
require_code('ocf_topics_action');
$topic_id = ocf_make_topic(NULL, $subject, '', 1, 1, 0, 0, 0, $selected_member2, $selected_member1, true, 0, NULL, '');
require_code('ocf_posts_action');
$post_id = ocf_make_post($topic_id, $subject, $insult_pt_topic_post, 0, true, 1, 0, do_lang('SYSTEM'), NULL, NULL, $GLOBALS['FORUM_DRIVER']->get_guest_id(), NULL, NULL, NULL, false, true, NULL, true, $subject, 0, NULL, true, true, true);
require_code('ocf_topics_action2');
send_pt_notification($post_id, $subject, $topic_id, $selected_member2, $selected_member1);
}
}
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:54,代码来源:insults.php
示例19: get_field_types
/**
* Find what field types this hook can serve. This method only needs to be defined if it is not serving a single field type with a name corresponding to the hook itself.
*
* @return array Map of field type to field type title
*/
function get_field_types()
{
$hooks = find_all_hooks('systems', 'ajax_tree');
$ret = array();
foreach (array_keys($hooks) as $hook) {
if (substr($hook, 0, 7) == 'choose_' && $hook != 'catalogue_entry') {
$_hook = preg_replace('#^choose_#', '', $hook);
if ($_hook == 'forum_topic' || is_file(get_file_base() . '/sources_custom/hooks/systems/content_meta_aware/' . $_hook . '.php') || is_file(get_file_base() . '/sources/hooks/systems/content_meta_aware/' . $_hook . '.php')) {
$ret['at_' . $hook] = do_lang_tempcode('FIELD_TYPE_content_link_x', escape_html($_hook));
}
}
}
return $ret;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:19,代码来源:content_link.php
示例20: run
/**
* Standard modular run function.
*
* @return array An array of tuples: The task row to show, the number of seconds until it is due (or NULL if not on a timer), the number of things to sort out (or NULL if not on a queue), The name of the config option that controls the schedule (or NULL if no option).
*/
function run()
{
$award_types = $GLOBALS['SITE_DB']->query_select('award_types', array('*'));
$out = array();
foreach ($award_types as $award) {
// Find out how many submissions we've had since the last award was given
if (!file_exists(get_file_base() . '/sources/hooks/systems/awards/' . filter_naughty_harsh($award['a_content_type']) . '.php') && !file_exists(get_file_base() . '/sources_custom/hooks/systems/awards/' . filter_naughty_harsh($award['a_content_type']) . '.php')) {
continue;
}
require_code('hooks/systems/awards/' . $award['a_content_type']);
$hook_object = object_factory('Hook_awards_' . $award['a_content_type'], true);
if (is_null($hook_object)) {
continue;
}
$details = $hook_object->info();
if (!is_null($details)) {
$date = $GLOBALS['SITE_DB']->query_value_null_ok('award_archive', 'date_and_time', array('a_type_id' => $award['id']), 'ORDER BY date_and_time DESC');
$seconds_ago = mixed();
$limit_hours = $award['a_update_time_hours'];
if (!is_null($date)) {
$seconds_ago = time() - $date;
$status = $seconds_ago > $limit_hours * 60 * 60 ? 0 : 1;
} else {
$status = 0;
}
$config_url = build_url(array('page' => 'admin_awards', 'type' => '_ed', 'id' => $award['id']), get_module_zone('admin_awards'));
$_status = $status == 0 ? do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_0') : do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_1');
$url = $details['add_url'];
if (is_object($url)) {
$url = $url->evaluate();
}
$url = str_replace('=!', '_ignore=1', $url);
$task = escape_html(get_translated_text($award['a_title']));
if (!is_null($date) && !is_null($details['date_field'])) {
$where = filter_naughty_harsh($details['date_field']) . '>' . strval(intval($date));
$num_queue = $details['connection']->query_value_null_ok_full('SELECT COUNT(*) FROM ' . $details['connection']->get_table_prefix() . str_replace('1=1', $where, $details['table']) . ' r WHERE ' . $where);
$_num_queue = integer_format($num_queue);
$num_new_since = do_lang_tempcode('NUM_NEW_SINCE', $_num_queue);
} else {
$num_new_since = new ocp_tempcode();
}
list($info, $seconds_due_in) = staff_checklist_time_ago_and_due($seconds_ago, $limit_hours);
$info->attach($num_new_since);
$tpl = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM', array('_GUID' => '4049affae5a6f38712ee3e0237a2e18e', 'CONFIG_URL' => $config_url, 'URL' => $url, 'STATUS' => $_status, 'TASK' => $task, 'INFO' => $info));
$out[] = array($tpl, $seconds_due_in, NULL, NULL);
}
}
return $out;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:54,代码来源:awards.php
注:本文中的get_file_base函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论