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

PHP fix_permissions函数代码示例

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

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



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

示例1: 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


示例2: _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


示例3: fix_permissions

function fix_permissions($ff)
{
    $ff->setPermissions("-rwxrwxr-x");
    if ($ff->isDir()) {
        $all_files = $ff->listFiles();
        foreach ($all_files as $f) {
            fix_permissions($f);
        }
    }
}
开发者ID:mbcraft,项目名称:frozen,代码行数:10,代码来源:fix_permissions.php


示例4: 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


示例5: data_to_disk

 /**
  * Convert a AEF database file to an ocPortal uploaded file (stored on disk).
  *
  * @param  string			The file data
  * @param  string			The optimal filename
  * @param  ID_TEXT		The upload type (e.g. ocf_photos)
  * @param  PATH			The base directory we are importing from
  * @return array			Pair: The URL, the thumb url
  */
 function data_to_disk($data, $filename, $sections, $file_base)
 {
     $globals = array();
     require $file_base . '/universal.php';
     $attachments_dir = $globals['server_url'] . '/uploads/attachments/';
     //forum attachments directory
     $file_path = $attachments_dir . $filename;
     $data = $data == '' ? file_get_contents($file_path) : $data;
     $filename = find_derivative_filename('uploads/' . $sections, $filename);
     $path = get_custom_file_base() . '/uploads/' . $sections . '/' . $filename;
     $myfile = @fopen($path, 'wb') or warn_exit(do_lang_tempcode('WRITE_ERROR', escape_html('uploads/' . $sections . '/' . $filename)));
     if (fwrite($myfile, $data) < strlen($data)) {
         warn_exit(do_lang_tempcode('COULD_NOT_SAVE_FILE'));
     }
     fclose($myfile);
     fix_permissions($path);
     sync_file($path);
     $url = 'uploads/' . $sections . '/' . $filename;
     return array($url, $url);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:29,代码来源:aef.php


示例6: _xml_breadcrumbs

 /**
  * The UI actualiser edit the breadcrumbs XML file.
  *
  * @return tempcode		The UI
  */
 function _xml_breadcrumbs()
 {
     $title = get_page_title('BREADCRUMB_OVERRIDES');
     $myfile = @fopen(get_custom_file_base() . '/data_custom/breadcrumbs.xml', 'wt');
     if ($myfile === false) {
         intelligent_write_error(get_custom_file_base() . '/data_custom/breadcrumbs.xml');
     }
     $xml = post_param('xml');
     if (fwrite($myfile, $xml) < strlen($xml)) {
         warn_exit(do_lang_tempcode('COULD_NOT_SAVE_FILE'));
     }
     fclose($myfile);
     fix_permissions(get_custom_file_base() . '/data_custom/breadcrumbs.xml');
     sync_file(get_custom_file_base() . '/data_custom/breadcrumbs.xml');
     return inform_screen($title, do_lang_tempcode('SUCCESS'));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:21,代码来源:admin_config.php


示例7: write_file

 /**
  * Standard modular file writing function for OcCLE FS hooks.
  *
  * @param  array	The current meta-directory path
  * @param  string	The root node of the current meta-directory
  * @param  string	The file name
  * @param  string	The new file contents
  * @param  array	A reference to the OcCLE filesystem object
  * @return boolean	Success?
  */
 function write_file($meta_dir, $meta_root_node, $file_name, $contents, &$occle_fs)
 {
     $file_name = filter_naughty($file_name);
     $path = get_custom_file_base() . '/data/modules/admin_occle';
     foreach ($meta_dir as $meta_dir_section) {
         $path .= '/' . filter_naughty($meta_dir_section);
     }
     if (is_dir($path) && (file_exists($path . '/' . $file_name) && is_writable_wrap($path . '/' . $file_name) || !file_exists($path . '/' . $file_name) && is_writable_wrap($path))) {
         $fh = @fopen($path . '/' . $file_name, 'wt') or intelligent_write_error($path . '/' . $file_name);
         $output = fwrite($fh, $contents);
         fclose($fh);
         if ($output < strlen($contents)) {
             warn_exit(do_lang_tempcode('COULD_NOT_SAVE_FILE'));
         }
         fix_permissions($path . '/' . $file_name);
         sync_file($path . '/' . $file_name);
         return $output;
     } else {
         return false;
     }
     //File doesn't exist
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:32,代码来源:bin.php


示例8: ocf_switch

 /**
  * Special import-esque function to aid switching to OCF after importing forum previously served by a forum driver.
  *
  * @return tempcode	Information about progress
  */
 function ocf_switch()
 {
     $out = new ocp_tempcode();
     $todos = array('USER' => array('member', db_get_first_id(), NULL), 'GROUP' => array('group', NULL, 'group_id'));
     foreach ($todos as $db_abstraction => $definition) {
         list($import_code, $default_id, $field_name_also) = $definition;
         $count = 0;
         $extra = is_null($field_name_also) ? '' : ' OR ' . db_string_equal_to('m_name', $field_name_also);
         $fields = $GLOBALS['SITE_DB']->query('SELECT m_table,m_name FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'db_meta WHERE (NOT (m_table LIKE \'' . db_encode_like('f_%') . '\')) AND (' . db_string_equal_to('m_type', $db_abstraction) . ' OR ' . db_string_equal_to('m_type', '*' . $db_abstraction) . ' OR ' . db_string_equal_to('m_type', '?' . $db_abstraction) . $extra . ')');
         foreach ($fields as $field) {
             if ($field['m_table'] == 'stats') {
                 continue;
             }
             // Lots of data and it's not important
             //echo '(working) '.$field['m_table'].'/'.$field['m_name'].'<br />';
             $values = $GLOBALS['SITE_DB']->query_select($field['m_table'], array('*'));
             foreach ($values as $value) {
                 $current = $value[$field['m_name']];
                 $remapped = import_id_remap_get($import_code, $current, true);
                 if (is_null($remapped)) {
                     $remapped = $default_id;
                 }
                 if (!is_null($remapped)) {
                     $value2 = $value;
                     $value2[$field['m_name']] = -$remapped;
                     $c = $GLOBALS['SITE_DB']->query_update($field['m_table'], $value2, $value, '', NULL, NULL, true, true);
                     if (is_null($c)) {
                         $GLOBALS['SITE_DB']->query_delete($field['m_table'], $value);
                     } else {
                         $count += $c;
                     }
                 } else {
                     $GLOBALS['SITE_DB']->query_delete($field['m_table'], $value);
                 }
             }
             $GLOBALS['SITE_DB']->query('UPDATE ' . $GLOBALS['SITE_DB']->get_table_prefix() . $field['m_table'] . ' SET ' . $field['m_name'] . '=-' . $field['m_name'] . ' WHERE ' . $field['m_name'] . '<0');
         }
         $out->attach(paragraph(do_lang_tempcode('OCF_CONVERTED_' . $db_abstraction, $count == 0 ? '?' : strval($count))));
     }
     // info.php
     global $FILE_BASE;
     $info_file = (file_exists('use_comp_name') ? array_key_exists('COMPUTERNAME', $_ENV) ? $_ENV['COMPUTERNAME'] : $_SERVER['SERVER_NAME'] : 'info') . '.php';
     $info = @fopen($FILE_BASE . '/' . $info_file, 'wt') or intelligent_write_error($FILE_BASE . '/' . $info_file);
     fwrite($info, "<" . "?php\n");
     global $SITE_INFO;
     $SITE_INFO['forum_type'] = 'ocf';
     $SITE_INFO['ocf_table_prefix'] = $SITE_INFO['table_prefix'];
     $SITE_INFO['db_forums'] = $SITE_INFO['db_site'];
     $SITE_INFO['db_forums_host'] = array_key_exists('db_site_host', $SITE_INFO) ? $SITE_INFO['db_site_host'] : 'localhost';
     $SITE_INFO['db_forums_user'] = $SITE_INFO['db_site_user'];
     $SITE_INFO['db_forums_password'] = $SITE_INFO['db_site_password'];
     $SITE_INFO['board_prefix'] = get_base_url();
     foreach ($SITE_INFO as $key => $val) {
         $_val = str_replace('\\', '\\\\', $val);
         fwrite($info, '$SITE_INFO[\'' . $key . '\']=\'' . $_val . "';\n");
     }
     fwrite($info, "?" . ">\n");
     fclose($info);
     fix_permissions($FILE_BASE . '/' . $info_file);
     sync_file($FILE_BASE . '/' . $info_file);
     $out->attach(paragraph(do_lang_tempcode('OCF_CONVERTED_INFO')));
     $LANG = get_site_default_lang();
     $trans5 = insert_lang(do_lang('FORUM'), 1, NULL, false, NULL, $LANG);
     $GLOBALS['SITE_DB']->query_insert('zones', array('zone_name' => 'forum', 'zone_title' => insert_lang(do_lang('SECTION_FORUMS'), 1), 'zone_default_page' => 'forumview', 'zone_header_text' => $trans5, 'zone_theme' => '-1', 'zone_wide' => NULL, 'zone_require_session' => 0, 'zone_displayed_in_menu' => 1));
     require_code('menus2');
     add_menu_item_simple('zone_menu', NULL, 'SECTION_FORUMS', 'forum' . ':forumview', 0, 1);
     return $out;
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:73,代码来源:admin_import.php


示例9: step_5_ftp


//.........这里部分代码省略.........
        // Test tmp file isn't currently being used by another iteration of process (race issue, causing horrible corruption)
        $lock_myfile = fopen(get_file_base() . '/ocp_inst_tmp/tmp', 'ab');
        if (!defined('PHALANGER')) {
            if (!flock($lock_myfile, LOCK_EX)) {
                warn_exit(do_lang_tempcode('DATA_FILE_CONFLICT'));
            }
        }
        $file_size_before = @filesize(get_file_base() . '/ocp_inst_tmp/tmp');
        sleep(1);
        $file_size_after = @filesize(get_file_base() . '/ocp_inst_tmp/tmp');
        if ($file_size_before !== $file_size_after) {
            warn_exit(do_lang_tempcode('DATA_FILE_CONFLICT'));
        }
        fclose($lock_myfile);
    } else {
        $overwrite_ok = true;
        $files = array();
        if (file_exists(get_file_base() . '/info.php')) {
            $files[] = 'info.php';
        }
    }
    // Make folders
    $langs1 = get_dir_contents('lang');
    $langs2 = get_dir_contents('lang_custom');
    $langs = array_merge($langs1, $langs2);
    foreach ($DIR_ARRAY as $dir) {
        if (strpos($dir, '/' . fallback_lang()) !== false) {
            foreach (array_keys($langs) as $lang) {
                if ($lang == fallback_lang() || strpos($lang, '.') !== false) {
                    continue;
                }
                if (is_suexec_like()) {
                    @mkdir(get_file_base() . '/' . str_replace('/' . fallback_lang(), '/' . $lang, $dir), 0777);
                    fix_permissions(get_file_base() . '/' . str_replace('/' . fallback_lang(), '/' . $lang, $dir), 0777);
                } else {
                    @ftp_mkdir($conn, str_replace('/' . fallback_lang(), '/' . $lang, $dir));
                    @ftp_site($conn, 'CHMOD 755 ' . str_replace('/' . fallback_lang(), '/' . $lang, $dir));
                }
            }
        }
        if (is_suexec_like()) {
            @mkdir(get_file_base() . '/' . $dir, 0777);
            fix_permissions(get_file_base() . '/' . $dir, 0777);
        } else {
            @ftp_mkdir($conn, $dir);
            if ($dir == 'exports/mods' && !is_suexec_like()) {
                @ftp_site($conn, 'CHMOD 777 ' . $dir);
            } else {
                @ftp_site($conn, 'CHMOD 755 ' . $dir);
            }
        }
    }
    // Upload files
    $count = file_array_count();
    $php_perms = fileperms(get_file_base() . '/install.php');
    $start_pos = get_param_integer('start_from', 0);
    $done_all = false;
    $time_start = time();
    $max_time = intval(round(floatval(ini_get('max_execution_time')) / 1.5));
    $max = post_param_integer('max', is_suexec_like() ? 5000 : 1000);
    for ($i = $start_pos; $i < $start_pos + $max; $i++) {
        list($filename, $contents) = file_array_get_at($i);
        if (is_string($contents)) {
            $file_size = strlen($contents);
        } else {
            list($file_size, $dump_myfile, $dump_offset) = $contents;
开发者ID:erico-deh,项目名称:ocPortal,代码行数:67,代码来源:install.php


示例10: 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


示例11: 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


示例12: filter_naughty

            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);
                    actual_edit_theme_image($image_code, $theme, 'EN', $image_code, $saveat_url, true);
                    echo '<li>' . escape_html($image_code) . '</li>';
                }
            }
        }
    }
}
echo '</ul><p>Finished theme images.</p>';
开发者ID:erico-deh,项目名称:ocPortal,代码行数:31,代码来源:fix_partial_themewizard_css.php


示例13: _import

 /**
  * The actualiser to import in bulk from an archive file.
  *
  * @return tempcode		The UI
  */
 function _import()
 {
     post_param('test');
     // To pick up on max file size exceeded errors
     require_code('uploads');
     require_code('images');
     is_swf_upload(true);
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('EMOTICONS')), array('_SELF:_SELF:import', do_lang_tempcode('CHOOSE')), array('_SELF:_SELF:import', do_lang_tempcode('IMPORT_EMOTICONS'))));
     foreach ($_FILES as $attach_name => $__file) {
         $tmp_name = $__file['tmp_name'];
         $file = $__file['name'];
         switch (get_file_extension($file)) {
             case 'zip':
                 if (!function_exists('zip_open') && get_option('unzip_cmd') == '') {
                     warn_exit(do_lang_tempcode('ZIP_NOT_ENABLED'));
                 }
                 if (!function_exists('zip_open')) {
                     require_code('m_zip');
                     $mzip = true;
                 } else {
                     $mzip = false;
                 }
                 $myfile = zip_open($tmp_name);
                 if (!is_integer($myfile)) {
                     while (false !== ($entry = zip_read($myfile))) {
                         // Load in file
                         zip_entry_open($myfile, $entry);
                         $_file = zip_entry_name($entry);
                         if (is_image($_file)) {
                             if (file_exists(get_file_base() . '/themes/default/images/emoticons/index.html')) {
                                 $path = get_custom_file_base() . '/themes/default/images_custom/emoticons__' . basename($_file);
                             } else {
                                 $path = get_custom_file_base() . '/themes/default/images_custom/ocf_emoticons__' . basename($_file);
                             }
                             $outfile = @fopen($path, 'wb') or intelligent_write_error($path);
                             $more = mixed();
                             do {
                                 $more = zip_entry_read($entry);
                                 if (fwrite($outfile, $more) < strlen($more)) {
                                     warn_exit(do_lang_tempcode('COULD_NOT_SAVE_FILE'));
                                 }
                             } while ($more !== false && $more != '');
                             fclose($outfile);
                             fix_permissions($path);
                             sync_file($path);
                             $this->_import_emoticon($path);
                         }
                         zip_entry_close($entry);
                     }
                     zip_close($myfile);
                 } else {
                     require_code('failure');
                     warn_exit(zip_error($myfile, $mzip));
                 }
                 break;
             case 'tar':
                 require_code('tar');
                 $myfile = tar_open($tmp_name, 'rb');
                 if ($myfile !== false) {
                     $directory = tar_get_directory($myfile);
                     foreach ($directory as $entry) {
                         // Load in file
                         $_file = $entry['path'];
                         if (is_image($_file)) {
                             if (file_exists(get_file_base() . '/themes/default/images/emoticons/index.html')) {
                                 $path = get_custom_file_base() . '/themes/default/images_custom/emoticons__' . basename($_file);
                             } else {
                                 $path = get_custom_file_base() . '/themes/default/images_custom/ocf_emoticons__' . basename($_file);
                             }
                             $_in = tar_get_file($myfile, $entry['path'], false, $path);
                             $this->_import_emoticon($path);
                         }
                     }
                     tar_close($myfile);
                 }
                 break;
             default:
                 if (is_image($file)) {
                     $urls = get_url('', $attach_name, 'themes/default/images_custom');
                     $path = $urls[0];
                     $this->_import_emoticon($path);
                 } else {
                     attach_message(do_lang_tempcode('BAD_ARCHIVE_FORMAT'), 'warn');
                 }
         }
     }
     $title = get_page_title('IMPORT_EMOTICONS');
     log_it('IMPORT_EMOTICONS');
     return $this->do_next_manager($title, do_lang_tempcode('SUCCESS'), NULL);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:95,代码来源:admin_ocf_emoticons.php


示例14: actual

 /**
  * The actualiser for super debranding.
  *
  * @return tempcode		The UI
  */
 function actual()
 {
     require_code('config2');
     if (get_file_base() == get_custom_file_base()) {
         require_code('abstract_file_manager');
         force_have_afm_details();
     }
     set_value('rebrand_name', post_param('rebrand_name'));
     set_value('rebrand_base_url', post_param('rebrand_base_url'));
     set_value('company_name', post_param('company_name'));
     set_option('show_docs', post_param('show_docs', '0'));
     require_code('database_action');
     //set_option('allow_member_integration','off');
     foreach (array(get_file_base() . '/pages/comcode_custom/' . get_site_default_lang(), get_file_base() . '/adminzone/pages/comcode_custom/' . get_site_default_lang()) as $dir) {
         if (!file_exists($dir)) {
             require_code('files');
             if (@mkdir($dir, 0777) === false) {
                 warn_exit(do_lang_tempcode('WRITE_ERROR_DIRECTORY_REPAIR', escape_html($dir)));
             }
             fix_permissions($dir, 0777);
             sync_file($dir);
         }
     }
     $keyboard_map_path = get_file_base() . '/pages/comcode_custom/' . get_site_default_lang() . '/keymap.txt';
     $myfile = @fopen($keyboard_map_path, 'wb');
     if ($myfile === false) {
         intelligent_write_error($keyboard_map_path);
     }
     $km = post_param('keyboard_map');
     if (fwrite($myfile, $km) < strlen($km)) {
         warn_exit(do_lang_tempcode('COULD_NOT_SAVE_FILE'));
     }
     fclose($myfile);
     fix_permissions($keyboard_map_path);
     sync_file($keyboard_map_path);
     $adminguide_path = get_file_base() . '/adminzone/pages/comcode_custom/' . get_site_default_lang() . '/website.txt';
     $adminguide = post_param('adminguide');
     $adminguide = str_replace('__company__', post_param('company_name'), $adminguide);
     $myfile = @fopen($adminguide_path, 'wb');
     if ($myfile === false) {
         intelligent_write_error($adminguide_path);
     }
     if (fwrite($myfile, $adminguide) < strlen($adminguide)) {
         warn_exit(do_lang_tempcode('COULD_NOT_SAVE_FILE'));
     }
     fclose($myfile);
     fix_permissions($adminguide_path);
     sync_file($adminguide_path);
     $start_path = get_file_base() . '/adminzone/pages/comcode_custom/' . get_site_default_lang() . '/start.txt';
     if (!file_exists($start_path)) {
         $start = post_param('start_page');
         $myfile = @fopen($start_path, 'wb');
         if ($myfile === false) {
             intelligent_write_error($start_path);
         }
         if (fwrite($myfile, $start) < strlen($start)) {
             warn_exit(do_lang_tempcode('COULD_NOT_SAVE_FILE'));
         }
         fclose($myfile);
         fix_permissions($start_path);
         sync_file($start_path);
     }
     if (get_file_base() == get_custom_file_base()) {
         $critical_errors = file_get_contents(get_file_base() . '/sources/critical_errors.php');
         $critical_errors = str_replace('ocPortal', post_param('rebrand_name'), $critical_errors);
         $critical_errors = str_replace('http://ocportal.com', post_param('rebrand_base_url'), $critical_errors);
         $critical_errors = str_replace('ocProducts', 'ocProducts/' . post_param('company_name'), $critical_errors);
         $critical_errors_path = 'sources_custom/critical_errors.php';
         afm_make_file($critical_errors_path, $critical_errors, false);
     }
     $save_header_path = get_file_base() . '/themes/' . $GLOBALS['FORUM_DRIVER']->get_theme() . '/templates_custom/HEADER.tpl';
     $header_path = $save_header_path;
     if (!file_exists($header_path)) {
         $header_path = get_file_base() . '/themes/default/templates/HEADER.tpl';
     }
     $header_tpl = file_get_contents($header_path);
     $header_tpl = str_replace('Copyright ocProducts Limited', '', $header_tpl);
     $myfile = @fopen($save_header_path, 'wb');
     if ($myfile === false) {
         intelligent_write_error($save_header_path);
     }
     if (fwrite($myfile, $header_tpl) < strlen($header_tpl)) {
         warn_exit(do_lang_tempcode('COULD_NOT_SAVE_FILE'));
     }
     fclose($myfile);
     fix_permissions($save_header_path);
     sync_file($save_header_path);
     if (post_param_integer('churchy', 0) == 1) {
         if (is_object($GLOBALS['FORUM_DB'])) {
             $GLOBALS['FORUM_DB']->query_delete('f_emoticons', array('e_code' => ':devil:'), '', 1);
         } else {
             $GLOBALS['SITE_DB']->query_delete('f_emoticons', array('e_code' => ':devil:'), '', 1);
         }
     }
     // Make sure some stuff is disabled for non-admin staff
//.........这里部分代码省略.........
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:admin_debrand.php


示例15: _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. foo_mobile)
 * @param  LANGUAGE_NAME	The language the template is in the context of
 * @param  string				File type suffix of template file (e.g. .tpl)
 * @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;
    }
    if (is_null($GLOBALS['CURRENT_SHARE_USER'])) {
        $base_dir = ($theme == 'default' && ($suffix != '.css' || strpos($path, '/css_custom') === false) ? get_file_base() : get_custom_file_base()) . '/themes/';
    } else {
        $base_dir = get_custom_file_base() . '/themes/';
        if (!is_file($base_dir . $theme . $path . $codename . $suffix)) {
            $base_dir = get_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) . $suf 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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