本文整理汇总了PHP中filter_naughty函数的典型用法代码示例。如果您正苦于以下问题:PHP filter_naughty函数的具体用法?PHP filter_naughty怎么用?PHP filter_naughty使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了filter_naughty函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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
示例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);
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:46,代码来源:splurgh.php
示例3: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
require_code('textfiles');
$file = array_key_exists('param', $map) ? $map['param'] : 'admin_notes';
$title = array_key_exists('title', $map) ? $map['title'] : do_lang('NOTES');
$lang_none = array_key_exists('lang_none', $map) ? $map['lang_none'] : '0';
$scrolls = array_key_exists('scrolls', $map) ? $map['scrolls'] : '0';
$lang = $lang_none == '1' ? NULL : '';
$file = filter_naughty($file, true);
$new = post_param('new', NULL);
if (!is_null($new)) {
$hooks = find_all_hooks('blocks', 'main_notes');
foreach (array_keys($hooks) as $hook) {
require_code('hooks/blocks/main_notes/' . filter_naughty_harsh($hook));
$ob = object_factory('Hook_notes_' . filter_naughty_harsh($hook), true);
if (is_null($ob)) {
continue;
}
$ob->run($file);
}
write_text_file($file, $lang, $new);
log_it('NOTES', $file);
attach_message(do_lang_tempcode('SUCCESS'), 'inform');
}
$contents = read_text_file($file, $lang, true);
$post_url = get_self_url();
$map_comcode = '';
foreach ($map as $key => $val) {
$map_comcode .= ' ' . $key . '="' . addslashes($val) . '"';
}
return do_template('BLOCK_MAIN_NOTES', array('_GUID' => 'f737053505de3bd8ccfe806ec014b8fb', 'TITLE' => $title, 'BLOCK_NAME' => 'main_notes', 'MAP' => $map_comcode, 'CONTENTS' => $contents, 'SCROLLS' => array_key_exists('scrolls', $map) && $map['scrolls'] == '1', 'URL' => $post_url));
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:38,代码来源:main_notes.php
示例4: 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
示例5: 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));
}
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:30,代码来源:admin_bulkupload.php
示例6: run_testset
function run_testset($testset)
{
require_code('_tests/tests/' . filter_naughty($testset) . '.php');
$loader = new SimpleFileLoader();
$suite = $loader->createSuiteFromClasses($testset, array(basename($testset) . '_test_set'));
/*$result = */
$suite->run(new DefaultReporter());
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:8,代码来源:bootstrap.php
示例7: _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
示例8: get_realtime_events
/**
* Get all the events within a timestamp range.
*
* @param TIME From time (inclusive).
* @param TIME To time (inclusive).
* @return array List of template parameter sets (perfect for use in a Tempcode LOOP).
*/
function get_realtime_events($from, $to)
{
//restrictify();
$drops = array();
$hooks = find_all_hooks('systems', 'realtime_rain');
foreach (array_keys($hooks) as $hook) {
require_code('hooks/systems/realtime_rain/' . filter_naughty($hook));
$ob = object_factory('Hook_realtime_rain_' . $hook);
$drops = array_merge($drops, $ob->run($from, $to));
}
return $drops;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:19,代码来源:realtime_rain.php
示例9: put_in_standard_box
/**
* Get the tempcode for a standard box (CSS driven), with the specified content entered. Please rarely use this function; it is not good to assume people want anythings in one of these boxes... use templates instead
*
* @param tempcode The content being put inside the box
* @param mixed The title of the standard box, string or Tempcode (blank: titleless standard box)
* @param ?string The width/height classification (e.g. 100%, 100%|300px, ...) (NULL: unset)
* @param ID_TEXT The type of the table. Refers to a template (STANDARDBOX_type)
* @param string '|' separated list of options (meaning dependant upon templates interpretation)
* @param string '|' separated list of meta information (key|value|key|value|...)
* @param string '|' separated list of link information (linkhtml|...)
* @param boolean If the box will be allowed to expand.
* @param string Link to be added to the header of the box
* @return tempcode The contents, put inside a standard box, according to the other parameters
*/
function put_in_standard_box($content, $title = '', $dimensions = NULL, $type = 'classic', $options = '', $meta = '', $links = '', $expand = false, $toplink = '')
{
if (get_page_name() == 'start' && get_zone_name() == 'adminzone' && ($options == '' || $options == 'tray_open')) {
$expand = true;
$options = 'tray_open';
}
if ($dimensions === NULL) {
$dimensions = $type == 'panel' ? get_option('panel_width') : '100%';
}
if ($type == '') {
$type = 'classic';
}
$height = 'auto';
$dimensions_bits = explode('|', $dimensions);
$width = $dimensions_bits[0];
if (is_numeric($width)) {
$width .= 'px';
}
if ($width == '') {
$width = 'auto';
}
if (array_key_exists(1, $dimensions_bits)) {
$height = $dimensions_bits[1];
}
if (is_numeric($height)) {
$height .= 'px';
}
$_meta = array();
if ($meta != '') {
$meta_bits = explode('|', $meta);
if (count($meta_bits) % 2 == 1) {
unset($meta_bits[count($meta_bits) - 1]);
}
for ($i = 0; $i < count($meta_bits); $i += 2) {
$_meta[] = array('KEY' => $meta_bits[$i + 0], 'VALUE' => $meta_bits[$i + 1]);
}
}
$_links = array();
if ($links != '') {
$_links = explode('|', $links);
if ($_links[count($_links) - 1] == '') {
array_pop($_links);
}
}
$_options = explode('|', $options);
//$interlock=in_array('interlock',$_options);
return do_template('STANDARDBOX_' . filter_naughty($type), array('CONTENT' => $content, 'LINKS' => $_links, 'META' => $_meta, 'OPTIONS' => $_options, 'WIDTH' => $width, 'HEIGHT' => $height, 'TITLE' => $title, 'EXPAND' => $expand, 'TOPLINK' => $toplink), NULL, true);
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:62,代码来源:templates.php
示例10: handle_salmon
/**
* Takes Salmon values from POST and handles their assimilation into the
* site.
*/
function handle_salmon($id)
{
// Find out what the type our feedback should be for
require_code('hooks/systems/content_meta_aware/iotd');
$cma = object_factory('Hook_content_meta_aware_iotd');
$info = $cma->info();
$db_id = $info['id_field_numeric'] ? intval($id) : $id;
$_title = $GLOBALS['SITE_DB']->query_value_null_ok($info['table'], $info['title_field'], array($info['id_field'] => $db_id));
if (is_null($_title)) {
warn_exit('');
}
$title = $info['title_field_dereference'] ? get_translated_text($_title) : $_title;
require_code('urls');
list($zone, $attributes, $_) = page_link_decode(str_replace('_WILD', $id, $info['view_pagelink_pattern']));
$url = build_url($attributes, $zone)->evaluate();
require_code('salmon/salmon');
parse_salmon_post($info['feedback_type_code'], filter_naughty($id), $url, $title);
}
开发者ID:Warbo,项目名称:ocportal-salmon,代码行数:22,代码来源:iotds.php
示例11: get_random_line
/**
* Get a random line from a file.
*
* @param PATH The filename
* @return string The random line
*/
function get_random_line($filename)
{
$myfile = @fopen(filter_naughty($filename, true), 'rt');
if ($myfile === false) {
return '';
}
$i = 0;
$line = array();
while (true) {
$line[$i] = fgets($myfile, 1024);
if ($line[$i] === false || is_null($line[$i])) {
break;
}
$i++;
}
$r = mt_rand(0, $i - 1);
fclose($myfile);
return trim($line[$r]);
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:25,代码来源:main_ocprocks.php
示例12: require_lang_compile
/**
* Load up a language file, compiling it (it's not cached yet).
*
* @param ID_TEXT The language file name
* @param ?LANGUAGE_NAME The language (NULL: uses the current language)
* @param ?string The language type (lang_custom, or custom) (NULL: normal priorities are used)
* @set lang_custom custom
* @param PATH Where we are cacheing too
* @param boolean Whether to just return if there was a loading error
* @return boolean Whether we FAILED to load
*/
function require_lang_compile($codename, $lang, $type, $cache_path, $ignore_errors = false)
{
global $LANGUAGE, $REQUIRE_LANG_LOOP, $LANG_LOADED_LANG;
$desire_cache = function_exists('get_option') && (get_option('is_on_lang_cache', true) == '1' || get_param_integer('keep_cache', 0) == 1 || get_param_integer('cache', 0) == 1) && get_param_integer('keep_cache', NULL) !== 0 && get_param_integer('cache', NULL) !== 0;
if ($desire_cache) {
if ($GLOBALS['IN_MINIKERNEL_VERSION'] == 0) {
global $DECACHED_COMCODE_LANG_STRINGS;
// Cleanup language strings
if (!$DECACHED_COMCODE_LANG_STRINGS) {
$DECACHED_COMCODE_LANG_STRINGS = true;
$comcode_lang_strings = $GLOBALS['SITE_DB']->query_select('cached_comcode_pages', array('string_index'), array('the_zone' => '!'), '', NULL, NULL, true);
if (!is_null($comcode_lang_strings)) {
$GLOBALS['SITE_DB']->query_delete('cached_comcode_pages', array('the_zone' => '!'));
foreach ($comcode_lang_strings as $comcode_lang_string) {
delete_lang($comcode_lang_string['string_index']);
}
}
}
}
$load_target = array();
} else {
$load_target =& $LANGUAGE[$lang];
}
global $FILE_ARRAY;
if (@is_array($FILE_ARRAY) && file_array_exists('lang/' . $lang . '/' . $codename . '.ini')) {
$lang_file = 'lang/' . $lang . '/' . $codename . '.ini';
$file = file_array_get($lang_file);
_get_lang_file_map($file, $load_target, NULL, true);
$bad = true;
} else {
$bad = true;
$dirty = false;
// Load originals
$lang_file = get_file_base() . '/lang/' . $lang . '/' . filter_naughty($codename) . '.ini';
if (file_exists($lang_file)) {
_get_lang_file_map($lang_file, $load_target, NULL, false);
$bad = false;
}
// Load overrides now if they are there
if ($type != 'lang') {
$lang_file = get_custom_file_base() . '/lang_custom/' . $lang . '/' . $codename . '.ini';
if (!file_exists($lang_file) && get_file_base() != get_custom_file_base()) {
$lang_file = get_file_base() . '/lang_custom/' . $lang . '/' . $codename . '.ini';
}
if (!file_exists($lang_file)) {
$lang_file = get_custom_file_base() . '/lang_custom/' . $lang . '/' . $codename . '.po';
if (!file_exists($lang_file)) {
$lang_file = get_file_base() . '/lang_custom/' . $lang . '/' . $codename . '-' . strtolower($lang) . '.po';
}
}
}
if ($type != 'lang' && file_exists($lang_file)) {
_get_lang_file_map($lang_file, $load_target, NULL, false);
$bad = false;
$dirty = true;
// Tainted from the official pack, so can't store server wide
}
// NB: Merge op doesn't happen in require_lang. It happens when do_lang fails and then decides it has to force a recursion to do_lang(xx,fallback_lang()) which triggers require_lang(xx,fallback_lang()) when it sees it's not loaded
if ($bad && $lang != fallback_lang()) {
require_lang($codename, fallback_lang(), $type, $ignore_errors);
$REQUIRE_LANG_LOOP--;
$fallback_cache_path = get_custom_file_base() . '/lang_cached/' . fallback_lang() . '/' . $codename . '.lcd';
if (file_exists($fallback_cache_path)) {
require_code('files');
@copy($fallback_cache_path, $cache_path);
fix_permissions($cache_path);
}
if (!array_key_exists($lang, $LANG_LOADED_LANG)) {
$LANG_LOADED_LANG[$lang] = array();
}
$LANG_LOADED_LANG[$lang][$codename] = 1;
return $bad;
}
if ($bad) {
if ($ignore_errors) {
return true;
}
if ($codename != 'critical_error' || $lang != get_site_default_lang()) {
fatal_exit(do_lang_tempcode('MISSING_LANG_FILE', escape_html($codename), escape_html($lang)));
} else {
critical_error('CRIT_LANG');
}
}
}
if (is_null($GLOBALS['MEM_CACHE'])) {
// Cache
if ($desire_cache) {
$file = @fopen($cache_path, 'wt');
// Will fail if cache dir missing .. e.g. in quick installer
//.........这里部分代码省略.........
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:lang_compile.php
示例13: get_page_name
/**
* Get the name of the current page
*
* @return ID_TEXT The current page name
*/
function get_page_name()
{
global $PAGE_NAME_CACHE;
if (isset($PAGE_NAME_CACHE)) {
return $PAGE_NAME_CACHE;
}
global $ZONE, $GETTING_PAGE_NAME;
if ($GETTING_PAGE_NAME) {
return 'unknown';
}
$GETTING_PAGE_NAME = true;
$page = get_param('page', '');
if (strlen($page) > 80) {
warn_exit(do_lang_tempcode('INTERNAL_ERROR'));
}
if ($page == '' && $ZONE !== NULL) {
$page = ocp_srv('QUERY_STRING');
if (strpos($page, '=') !== false || $page == '') {
$page = $ZONE['zone_default_page'];
if ($page === NULL) {
$page = '';
}
}
}
$page = filter_naughty($page);
if ($ZONE !== NULL) {
$PAGE_NAME_CACHE = $page;
}
$GETTING_PAGE_NAME = false;
return $page;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:36,代码来源:support.php
示例14: choose_actions
/**
* The UI to choose what to import.
*
* @param mixed Output to show from last action (blank: none)
* @return tempcode The UI
*/
function choose_actions($extra = '')
{
$title = get_page_title('IMPORT');
$session = either_param_integer('session', get_session_id());
$importer = filter_naughty(get_param('importer'));
require_code('hooks/modules/admin_import/' . filter_naughty_harsh($importer));
$object = object_factory('Hook_' . filter_naughty_harsh($importer));
// Test import source is good
if (method_exists($object, 'probe_db_access')) {
list($db_name, $db_user, $db_password, $db_table_prefix) = $object->probe_db_access(either_param('old_base_dir'));
} else {
$db_name = either_param('db_name');
$db_user = either_param('db_user');
$db_password = either_param('db_password');
$db_table_prefix = either_param('db_table_prefix');
}
if ($db_name == get_db_site() && $importer == 'ocp_merge' && $db_table_prefix == $GLOBALS['SITE_DB']->get_table_prefix()) {
warn_exit(do_lang_tempcode('IMPORT_SELF_NO'));
}
$import_source = is_null($db_name) ? NULL : new database_driver($db_name, get_db_site_host(), $db_user, $db_password, $db_table_prefix);
unset($import_source);
$lang_array = array();
$hooks = find_all_hooks('modules', 'admin_import_types');
foreach (array_keys($hooks) as $hook) {
require_code('hooks/modules/admin_import_types/' . filter_naughty_harsh($hook));
$_hook = object_factory('Hook_admin_import_types_' . filter_naughty_harsh($hook));
$lang_array += $_hook->run();
}
$info = $object->info();
$session_row = $GLOBALS['SITE_DB']->query_select('import_session', array('*'), array('imp_session' => get_session_id()), '', 1);
if (array_key_exists(0, $session_row)) {
$old_base_dir = $session_row[0]['imp_old_base_dir'];
$db_name = $session_row[0]['imp_db_name'];
$db_user = $session_row[0]['imp_db_user'];
$db_table_prefix = $session_row[0]['imp_db_table_prefix'];
$refresh_time = $session_row[0]['imp_refresh_time'];
} else {
$old_base_dir = get_file_base() . '/old';
$db_name = get_db_site();
$db_user = get_db_site_user();
$db_table_prefix = array_key_exists('prefix', $info) ? $info['prefix'] : $GLOBALS['SITE_DB']->get_table_prefix();
$refresh_time = 15;
}
$_import_list = $info['import'];
$_import_list_2 = array();
foreach ($_import_list as $import) {
if (is_null($import)) {
continue;
}
if (!array_key_exists($import, $lang_array)) {
continue;
}
if (is_null($lang_array[$import])) {
continue;
}
$text = do_lang(strtolower($lang_array[$import]) != $lang_array[$import] ? $lang_array[$import] : strtoupper($lang_array[$import]));
$_import_list_2[$import] = $text;
}
if (array_key_exists('ocf_members', $_import_list_2) && get_forum_type() == $importer && $db_name == get_db_forums() && $db_table_prefix == $GLOBALS['FORUM_DB']->get_table_prefix()) {
$_import_list_2['ocf_switch'] = do_lang_tempcode('SWITCH_TO_OCF');
}
$import_list = new ocp_tempcode();
// asort($_import_list_2); Let's preserve order here
$just = get_param('just', NULL);
$first = true;
$skip_hidden = array();
$parts_done = collapse_2d_complexity('imp_id', 'imp_session', $GLOBALS['SITE_DB']->query_select('import_parts_done', array('imp_id', 'imp_session'), array('imp_session' => get_session_id())));
foreach ($_import_list_2 as $import => $text) {
if (array_key_exists($import, $parts_done)) {
$import_list->attach(do_template('IMPORT_ACTION_LINE', array('CHECKED' => false, 'DISABLED' => true, 'NAME' => 'import_' . $import, 'TEXT' => $text, 'ADVANCED_URL' => $info['supports_advanced_import'] ? build_url(array('page' => '_SELF', 'type' => 'advanced_hook', 'session' => $session, 'content_type' => $import, 'importer' => $importer), '_SELF') : new ocp_tempcode())));
} else {
$checked = is_null($just) && $first;
$import_list->attach(do_template('IMPORT_ACTION_LINE', array('_GUID' => 'f2215115f920200a0a1ba6bc776ad945', 'CHECKED' => $checked, 'NAME' => 'import_' . $import, 'TEXT' => $text, 'ADVANCED_URL' => $info['supports_advanced_import'] ? build_url(array('page' => '_SELF', 'type' => 'advanced_hook', 'session' => $session, 'content_type' => $import, 'importer' => $importer), '_SELF') : new ocp_tempcode())));
}
if ($just == $import) {
$first = true;
$just = NULL;
} else {
$first = false;
}
$skip_hidden[] = 'import_' . $import;
}
$message = array_key_exists('message', $info) ? $info['message'] : '';
if (count($parts_done) == count($_import_list_2)) {
inform_exit(do_lang_tempcode($message === '' ? '_IMPORT_ALL_FINISHED' : 'IMPORT_ALL_FINISHED', $message));
}
$url = build_url(array('page' => '_SELF', 'type' => 'import', 'session' => $session, 'importer' => $importer), '_SELF');
breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('IMPORT')), array('_SELF:_SELF:session:importer=' . $importer, do_lang_tempcode('IMPORT_SESSION'))));
$hidden = new ocp_tempcode();
$hidden->attach(build_keep_post_fields($skip_hidden));
$hidden->attach(build_keep_form_fields('', true));
return do_template('IMPORT_ACTION_SCREEN', array('_GUID' => 'a3a69637e541923ad76e9e7e6ec7e1af', 'EXTRA' => $extra, 'MESSAGE' => $message, 'TITLE' => $title, 'FIELDS' => '', 'HIDDEN' => $hidden, 'IMPORTER' => $importer, 'IMPORT_LIST' => $import_list, 'URL' => $url));
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:99,代码来源:admin_import.php
示例15: set_lang_code_2
/**
* The actualiser to translate code (called externally, and may operate on many lang files).
*
* @return tempcode The UI
*/
function set_lang_code_2()
{
$lang = post_param('lang');
$lang_files = get_lang_files(fallback_lang());
foreach (array_keys($lang_files) as $lang_file) {
$for_base_lang = get_lang_file_map(fallback_lang(), $lang_file, true);
$for_base_lang_2 = get_lang_file_map($lang, $lang_file, false);
$descriptions = get_lang_file_descriptions(fallback_lang(), $lang_file);
$out = '';
foreach ($for_base_lang_2 + $for_base_lang as $key => $now_val) {
$val = post_param('l_' . $key, array_key_exists($key, $for_base_lang_2) ? $for_base_lang_2[$key] : $now_val);
if (str_replace(chr(10), '\\n', $val) != $now_val || !array_key_exists($key, $for_base_lang) || $for_base_lang[$key] != $val || !file_exists(get_file_base() . '/lang/' . fallback_lang() . '/' . $lang_file . '.ini')) {
// if it's changed from default ocPortal, or not in default ocPortal, or was already changed in language file, or whole file is not in default ocPortal
$out .= $key . '=' . str_replace(chr(10), '\\n', $val) . "\n";
}
}
if ($out != '') {
$path = get_custom_file_base() . '/lang_custom/' . filter_naughty($lang) . '/' . filter_naughty($lang_file) . '.ini';
$path_backup = $path . '.' . strval(time());
if (file_exists($path)) {
@copy($path, $path_backup) or intelligent_write_error($path_backup);
sync_file($path_backup);
}
$myfile = @fopen($path, 'wt');
if ($myfile === false) {
intelligent_write_error($path);
}
fwrite($myfile, "[descriptions]\n");
foreach ($descriptions as $key => $description) {
if (fwrite($myfile, $key . '=' . $description . "\n") == 0) {
warn_exit(do_lang_tempcode('COULD_NOT_SAVE_FILE'));
}
}
fwrite($myfile, "\n[strings]\n");
fwrite($myfile, $out);
fclose($myfile);
fix_permissions($path);
sync_file($path);
$path_backup2 = $path . '.latest_in_ocp_edit';
@copy($path, $path_backup2) or intelligent_write_error($path_backup2);
sync_file($path_backup2);
}
}
$title = get_page_title('TRANSLATE_CODE');
log_it('TRANSLATE_CODE');
require_code('view_modes');
erase_cached_language();
erase_cached_templates();
// Show it worked / Refresh
$url = post_param('redirect', '');
if ($url == '') {
return inform_screen($title, do_lang_tempcode('SUCCESS'));
}
return redirect_screen($title, $url, do_lang_tempcode('SUCCESS'));
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:60,代码来源:admin_lang.php
示例16: collapse_2d_complexity
}
$temp_all_ids = collapse_2d_complexity('id', 'path', $GLOBALS['SITE_DB']->query_select('theme_images', array('id', 'path'), array('theme' => $theme)));
foreach ($full_img_set as $image_code) {
if (!in_array($image_code, $THEME_WIZARD_IMAGES_NO_WILD)) {
if (array_key_exists($image_code, $temp_all_ids) && strpos($temp_all_ids[$image_code], $theme . '/images_custom/') !== false && (!url_is_local($temp_all_ids[$image_code]) || file_exists(get_custom_file_base() . '/' . $temp_all_ids[$image_code]))) {
continue;
}
$orig_path = find_theme_image($image_code, true, true, 'default', 'EN');
if ($orig_path == '') {
continue;
}
// Theme has specified non-existent image as themewizard-compatible
if (strpos($orig_path, '/' . fallback_lang() . '/') !== false) {
$composite = 'themes/' . filter_naughty($theme) . '/images/EN/';
} else {
$composite = 'themes/' . filter_naughty($theme) . '/images/';
}
afm_make_directory($composite, true);
$saveat = get_custom_file_base() . '/' . $composite . $image_code . '.png';
$saveat_url = $composite . $image_code . '.png';
if (!file_exists($saveat)) {
$image = calculate_theme($seed, 'default', 'equations', $image_code, $dark, $theme_map, $theme_landscape, 'EN');
if (!is_null($image)) {
$pos = strpos($image_code, '/');
if ($pos !== false || strpos($orig_path, '/EN/') !== false) {
afm_make_directory($composite . substr($image_code, 0, $pos), true, true);
}
@imagepng($image, $saveat) or intelligent_write_error($saveat);
imagedestroy($image);
fix_permissions($saveat);
sync_file($saveat);
开发者ID:erico-deh,项目名称:ocPortal,代码行数:31,代码来源:fix_partial_themewizard_css.php
示例17: module_do_upload
/**
* The actualiser for uploading a file.
*
* @return tempcode The UI.
*/
function module_do_upload()
{
if (!has_specific_permission(get_member(), 'upload_filedump')) {
access_denied('I_ERROR');
}
$title = get_page_title('FILEDUMP_UPLOAD');
if (function_exists('set_time_limit')) {
@set_time_limit(0);
}
// Slowly uploading a file can trigger time limit, on some servers
$place = filter_naughty(post_param('place'));
require_code('uploads');
if (!is_swf_upload(true) && (!array_key_exists('file', $_FILES) || !is_uploaded_file($_FILES['file']['tmp_name']))) {
$attach_name = 'file';
$max_size = get_max_file_size();
if (isset($_FILES[$attach_name]) && ($_FILES[$attach_name]['error'] == 1 || $_FILES[$attach_name]['error'] == 2)) {
warn_exit(do_lang_tempcode('FILE_TOO_BIG', integer_format($max_size)));
} elseif (isset($_FILES[$attach_name]) && ($_FILES[$attach_name]['error'] == 3 || $_FILES[$attach_name]['error'] == 6 || $_FILES[$attach_name]['error'] == 7)) {
warn_exit(do_lang_tempcode('ERROR_UPLOADING_' . strval($_FILES[$attach_name]['error'])));
} else {
warn_exit(do_lang_tempcode('ERROR_UPLOADING'));
}
}
$file = $_FILES['file']['name'];
if (get_magic_quotes_gpc()) {
$file = stripslashes($file);
}
if (!has_specific_permission(get_member(), 'upload_anything_filedump') || get_file_base() != get_custom_file_base()) {
check_extension($file);
}
$file = str_replace('.', '-', basename($file, '.' . get_file_extension($file))) . '.' . get_file_extension($file);
if (!file_exists(get_custom_file_base() . '/uploads/filedump' . $place . $file)) {
$max_size = get_max_file_size();
if ($_FILES['file']['size'] > $max_size) {
warn_exit(do_lang_tempcode('FILE_TOO_BIG', integer_format(intval($max_size))));
}
$full = get_custom_file_base() . '/uploads/filedump' . $place . $file;
if (is_swf_upload(true)) {
@rename($_FILES['file']['tmp_name'], $full) or warn_exit(do_lang_tempcode('FILE_MOVE_ERROR', escape_html($file), escape_html('uploads/filedump' . $place)));
} else {
@move_uploaded_file($_FILES['file']['tmp_name'], $full) or warn_exit(do_lang_tempcode('FILE_MOVE_ERROR', escape_html($file), escape_html('uploads/filedump' . $place)));
}
fix_permissions($full);
sync_file($full);
$return_url = build_url(array('page' => '_SELF', 'place' => $place), '_SELF');
$test = $GLOBALS['SITE_DB']->query_value_null_ok('filedump', 'description', array('name' => $file, 'path' => $place));
if (!is_null($test)) {
delete_lang($test);
}
$GLOBALS['SITE_DB']->query_delete('filedump', array('name' => $file, 'path' => $place), '', 1);
$description = post_param('description');
$GLOBALS['SITE_DB']->query_insert('filedump', array('name' => $file, 'path' => $place, 'the_member' => get_member(), 'description' => insert_lang_comcode($description, 3)));
require_code('notifications');
$subject = do_lang('FILEDUMP_NOTIFICATION_MAIL_SUBJECT', get_site_name(), $file, $place);
$mail = do_lang('FILEDUMP_NOTIFICATION_MAIL', comcode_escape(get_site_name()), comcode_escape($file), array(comcode_escape($place), comcode_escape($description)));
dispatch_notification('filedump', $place, $subject, $mail);
log_it('FILEDUMP_UPLOAD', $file, $place);
if (has_actual_page_access($GLOBALS['FORUM_DRIVER']->get_guest_id(), get_page_name(), get_zone_name())) {
syndicate_described_activity('filedump:ACTIVITY_FILEDUMP_UPLOAD', $place . '/' . $file, '', '', '', '', '', 'filedump');
}
return redirect_screen($title, $return_url, do_lang_tempcode('SUCCESS'));
} else {
warn_exit(do_lang_tempcode('OVERWRITE_ERROR'));
}
return new ocp_tempcode();
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:71,代码来源:filedump.php
|
请发表评论