当前位置: 首页>>代码示例>>PHP>>正文


PHP phpbb_chmod函数代码示例

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


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

示例1: create_directories

 /**
  * Create directories for banners/icons uploaded
  *
  * @return null
  */
 public function create_directories()
 {
     $directories = array('files/ext/ernadoo/phpbbdirectory/banners/', 'files/ext/ernadoo/phpbbdirectory/icons/');
     foreach ($directories as $dir) {
         if (!file_exists($this->phpbb_root_path . $dir)) {
             @mkdir($this->phpbb_root_path . $dir, 0777, true);
             phpbb_chmod($this->phpbb_root_path . $dir, CHMOD_READ | CHMOD_WRITE);
         }
     }
 }
开发者ID:rmcgirr83,项目名称:ext-phpbb-directory,代码行数:15,代码来源:v1_0_0.php

示例2: write

 public static function write($file, $data)
 {
     if (self::is_enabled()) {
         $file = self::get_root() . preg_replace('{[^' . self::$whitelist . ']}i', '-', $file);
         $lock = new \phpbb\lock\flock($file);
         $lock->acquire();
         if ($handle = @fopen($file, 'wb')) {
             fwrite($handle, $data);
             fclose($handle);
             phpbb_chmod($file, CHMOD_READ | CHMOD_WRITE);
             $return_value = true;
         } else {
             $return_value = false;
         }
         $lock->release();
         return $return_value;
     }
     return false;
 }
开发者ID:boardtools,项目名称:upload,代码行数:19,代码来源:cache.php

示例3: recursive_mkdir

 /**
  * @author Michal Nazarewicz (from the php manual)
  * Creates all non-existant directories in a path
  * @param $path - path to create
  * @param $mode - CHMOD the new dir to these permissions
  * @return bool
  */
 function recursive_mkdir($path, $mode = false)
 {
     if (!$mode) {
         global $config;
         $mode = octdec($config['am_dir_perms']);
     }
     $dirs = explode('/', $path);
     $count = sizeof($dirs);
     $path = '.';
     for ($i = 0; $i < $count; $i++) {
         $path .= '/' . $dirs[$i];
         if (!is_dir($path)) {
             @mkdir($path);
             @phpbb_chmod($path, CHMOD_ALL);
             // PHP needs write permission.
             if (!is_dir($path)) {
                 return false;
             }
         }
     }
     return true;
 }
开发者ID:phpbb,项目名称:automod,代码行数:29,代码来源:editor.php

示例4: create_config_file


//.........这里部分代码省略.........
		);

		foreach ($config_data_array as $key => $value)
		{
			$config_data .= "\${$key} = '" . str_replace("'", "\\'", str_replace('\\', '\\\\', $value)) . "';\n";
		}
		unset($config_data_array);

		$config_data .= "\n@define('PHPBB_INSTALLED', true);\n";
		$config_data .= "// @define('DEBUG', true);\n";
		$config_data .= "// @define('DEBUG_EXTRA', true);\n";
		$config_data .= '?' . '>'; // Done this to prevent highlighting editors getting confused!

		// Attempt to write out the config file directly. If it works, this is the easiest way to do it ...
		if ((file_exists($phpbb_root_path . 'config.' . $phpEx) && is_writable($phpbb_root_path . 'config.' . $phpEx)) || is_writable($phpbb_root_path))
		{
			// Assume it will work ... if nothing goes wrong below
			$written = true;

			if (!($fp = @fopen($phpbb_root_path . 'config.' . $phpEx, 'w')))
			{
				// Something went wrong ... so let's try another method
				$written = false;
			}

			if (!(@fwrite($fp, $config_data)))
			{
				// Something went wrong ... so let's try another method
				$written = false;
			}

			@fclose($fp);

			if ($written)
			{
				// We may revert back to chmod() if we see problems with users not able to change their config.php file directly
				phpbb_chmod($phpbb_root_path . 'config.' . $phpEx, CHMOD_READ);
			}
		}

		if (isset($_POST['dldone']))
		{
			// Do a basic check to make sure that the file has been uploaded
			// Note that all we check is that the file has _something_ in it
			// We don't compare the contents exactly - if they can't upload
			// a single file correctly, it's likely they will have other problems....
			if (filesize($phpbb_root_path . 'config.' . $phpEx) > 10)
			{
				$written = true;
			}
		}

		$config_options = array_merge($this->db_config_options, $this->admin_config_options);

		foreach ($config_options as $config_key => $vars)
		{
			if (!is_array($vars))
			{
				continue;
			}
			$s_hidden_fields .= '<input type="hidden" name="' . $config_key . '" value="' . $data[$config_key] . '" />';
		}

		if (!$written)
		{
			// OK, so it didn't work let's try the alternatives

			if (isset($_POST['dlconfig']))
			{
				// They want a copy of the file to download, so send the relevant headers and dump out the data
				header("Content-Type: text/x-delimtext; name=\"config.$phpEx\"");
				header("Content-disposition: attachment; filename=config.$phpEx");
				echo $config_data;
				exit;
			}

			// The option to download the config file is always available, so output it here
			$template->assign_vars(array(
				'BODY'					=> $lang['CONFIG_FILE_UNABLE_WRITE'],
				'L_DL_CONFIG'			=> $lang['DL_CONFIG'],
				'L_DL_CONFIG_EXPLAIN'	=> $lang['DL_CONFIG_EXPLAIN'],
				'L_DL_DONE'				=> $lang['DONE'],
				'L_DL_DOWNLOAD'			=> $lang['DL_DOWNLOAD'],
				'S_HIDDEN'				=> $s_hidden_fields,
				'S_SHOW_DOWNLOAD'		=> true,
				'U_ACTION'				=> $this->p_master->module_url . "?mode=$mode&amp;sub=config_file",
			));
			return;
		}
		else
		{
			$template->assign_vars(array(
				'BODY'		=> $lang['CONFIG_FILE_WRITTEN'],
				'L_SUBMIT'	=> $lang['NEXT_STEP'],
				'S_HIDDEN'	=> $s_hidden_fields,
				'U_ACTION'	=> $this->p_master->module_url . "?mode=$mode&amp;sub=advanced",
			));
			return;
		}
	}
开发者ID:steveh,项目名称:phpbb,代码行数:101,代码来源:install_install.php

示例5: save

 /**
  * Save queue
  */
 function save()
 {
     if (!sizeof($this->data)) {
         return;
     }
     if (file_exists($this->cache_file)) {
         include $this->cache_file;
         foreach ($this->queue_data as $object => $data_ary) {
             if (isset($this->data[$object]) && sizeof($this->data[$object])) {
                 $this->data[$object]['data'] = array_merge($data_ary['data'], $this->data[$object]['data']);
             } else {
                 $this->data[$object]['data'] = $data_ary['data'];
             }
         }
     }
     if ($fp = @fopen($this->cache_file, 'w')) {
         @flock($fp, LOCK_EX);
         fwrite($fp, "<?php\n\$this->queue_data = unserialize(" . var_export(serialize($this->data), true) . ");\n\n?>");
         @flock($fp, LOCK_UN);
         fclose($fp);
         phpbb_chmod($this->cache_file, CHMOD_WRITE);
     }
 }
开发者ID:jvinhit,项目名称:php,代码行数:26,代码来源:functions_messenger.php

示例6: move_file

 /**
  * Move file to destination folder
  *
  * @param string $destination_path Destination path, for example $config['avatar_path']
  * @param bool $overwrite If set to true, an already existing file will be overwritten
  * @param string $chmod Permission mask for chmodding the file after a successful move. The mode entered here reflects the mode defined by {@link phpbb_chmod()}
  *
  * @access public
  */
 function move_file($destination, $overwrite = false, $skip_image_check = false, $chmod = false)
 {
     if (sizeof($this->error)) {
         return false;
     }
     $chmod = $chmod === false ? CHMOD_READ | CHMOD_WRITE : $chmod;
     // We need to trust the admin in specifying valid upload directories and an attacker not being able to overwrite it...
     $this->destination_path = $destination;
     // Check if the destination path exist...
     if (!file_exists($this->destination_path)) {
         @unlink($this->filename);
         return false;
     }
     $upload_mode = @ini_get('open_basedir') || @ini_get('safe_mode') || strtolower(@ini_get('safe_mode')) == 'on' ? 'move' : 'copy';
     $upload_mode = $this->local ? 'local' : $upload_mode;
     $this->destination_file = $this->destination_path . '/' . basename($this->realname);
     // Check if the file already exist, else there is something wrong...
     if (file_exists($this->destination_file) && !$overwrite) {
         @unlink($this->filename);
     } else {
         if (file_exists($this->destination_file)) {
             @unlink($this->destination_file);
         }
         switch ($upload_mode) {
             case 'copy':
                 if (!@copy($this->filename, $this->destination_file)) {
                     if (!@move_uploaded_file($this->filename, $this->destination_file)) {
                         $this->error[] = sprintf(phpbb::$user->lang[$this->upload->error_prefix . 'GENERAL_UPLOAD_ERROR'], $this->destination_file);
                         return false;
                     }
                 }
                 @unlink($this->filename);
                 break;
             case 'move':
                 if (!@move_uploaded_file($this->filename, $this->destination_file)) {
                     if (!@copy($this->filename, $this->destination_file)) {
                         $this->error[] = sprintf(phpbb::$user->lang[$this->upload->error_prefix . 'GENERAL_UPLOAD_ERROR'], $this->destination_file);
                         return false;
                     }
                 }
                 @unlink($this->filename);
                 break;
             case 'local':
                 if (!@copy($this->filename, $this->destination_file)) {
                     $this->error[] = sprintf(phpbb::$user->lang[$this->upload->error_prefix . 'GENERAL_UPLOAD_ERROR'], $this->destination_file);
                     return false;
                 }
                 @unlink($this->filename);
                 break;
         }
         phpbb_chmod($this->destination_file, $chmod);
     }
     // Try to get real filesize from destination folder
     $this->filesize = @filesize($this->destination_file) ? @filesize($this->destination_file) : $this->filesize;
     if ($this->is_image() && !$skip_image_check) {
         $this->width = $this->height = 0;
         if (($this->image_info = @getimagesize($this->destination_file)) !== false) {
             $this->width = $this->image_info[0];
             $this->height = $this->image_info[1];
             if (!empty($this->image_info['mime'])) {
                 $this->mimetype = $this->image_info['mime'];
             }
             // Check image type
             $types = $this->upload->image_types();
             if (!isset($types[$this->image_info[2]]) || !in_array($this->extension, $types[$this->image_info[2]])) {
                 if (!isset($types[$this->image_info[2]])) {
                     $this->error[] = sprintf(phpbb::$user->lang['IMAGE_FILETYPE_INVALID'], $this->image_info[2], $this->mimetype);
                 } else {
                     $this->error[] = sprintf(phpbb::$user->lang['IMAGE_FILETYPE_MISMATCH'], $types[$this->image_info[2]][0], $this->extension);
                 }
             }
             // Make sure the dimensions match a valid image
             if (empty($this->width) || empty($this->height)) {
                 $this->error[] = phpbb::$user->lang['ATTACHED_IMAGE_NOT_IMAGE'];
             }
         } else {
             $this->error[] = phpbb::$user->lang['UNABLE_GET_IMAGE_SIZE'];
         }
     }
     $this->file_moved = true;
     $this->additional_checks();
     unset($this->upload);
     return true;
 }
开发者ID:kairion,项目名称:customisation-db,代码行数:93,代码来源:filespec.php

示例7: save

 /**
  * Save queue
  */
 function save()
 {
     if (!sizeof($this->data)) {
         return;
     }
     $lock = new \phpbb\lock\flock($this->cache_file);
     $lock->acquire();
     if (file_exists($this->cache_file)) {
         include $this->cache_file;
         foreach ($this->queue_data as $object => $data_ary) {
             if (isset($this->data[$object]) && sizeof($this->data[$object])) {
                 $this->data[$object]['data'] = array_merge($data_ary['data'], $this->data[$object]['data']);
             } else {
                 $this->data[$object]['data'] = $data_ary['data'];
             }
         }
     }
     if ($fp = @fopen($this->cache_file, 'w')) {
         fwrite($fp, "<?php\nif (!defined('IN_PHPBB')) exit;\n\$this->queue_data = unserialize(" . var_export(serialize($this->data), true) . ");\n\n?>");
         fclose($fp);
         phpbb_chmod($this->cache_file, CHMOD_READ | CHMOD_WRITE);
         $this->data = array();
     }
     $lock->release();
 }
开发者ID:mysteriou,项目名称:educafacile.com,代码行数:28,代码来源:functions_messenger.php

示例8: set_template

 /**
  * function set_template
  * Updates or creates the designated template file
  *
  * @param string $template_data
  * @param string $template_file
  * @param optional string $template_lang
  * @param optional string $template_path
  * @return string $template
  */
 function set_template($template_data, $template_file, $template_lang = '', $template_path = '')
 {
     global $phpbb_root_path, $user;
     if (!trim($template_file)) {
         trigger_error('invite->get_template(): No template file set.', E_USER_ERROR);
     }
     $template_lang = !trim($template_lang) ? basename($user->data['user_lang']) : $template_lang;
     $template_path = !trim($template_path) ? "{$phpbb_root_path}language/{$template_lang}/email/" : $template_path;
     $destination = $template_path . $template_file;
     if ($fp = @fopen($destination, 'wb')) {
         @flock($fp, LOCK_EX);
         @fwrite($fp, $template_data);
         @flock($fp, LOCK_UN);
         @fclose($fp);
         phpbb_chmod($destination, CHMOD_READ | CHMOD_WRITE);
     }
 }
开发者ID:janukobytsch,项目名称:invite-a-friend,代码行数:27,代码来源:functions_invite.php

示例9: compile_write

 /**
  * Write compiled file to cache directory
  * @access private
  */
 function compile_write($handle, $data)
 {
     global $phpEx;
     $filename = $this->template->cachepath . str_replace('/', '.', $this->template->filename[$handle]) . '.' . $phpEx;
     if ($fp = @fopen($filename, 'wb')) {
         @flock($fp, LOCK_EX);
         @fwrite($fp, $data);
         @flock($fp, LOCK_UN);
         @fclose($fp);
         phpbb_chmod($filename, CHMOD_WRITE);
     }
     return;
 }
开发者ID:BackupTheBerlios,项目名称:phpbb-hu-svn,代码行数:17,代码来源:functions_template.php

示例10: display_results

 /**
  * Display results
  *
  * Display the results from the previous command, or you may enter your own command/result if you would like.
  *
  * @param string $command The command you would like shown (leave blank to use the last command saved in $this->command)
  * @param string $result The result you would like shown (leave blank to use the last result saved in $this->result)
  */
 function display_results($command = '', $result = '')
 {
     global $config, $template, $user, $phpbb_root_path;
     $command = $command ? $command : $this->command;
     $command = isset($user->lang[$command]) ? $user->lang[$command] : $command;
     $result = $result ? $result : $this->result;
     $result = isset($user->lang[$result]) ? $user->lang[$result] : $result;
     $this->results = true;
     if ($result != $user->lang['SUCCESS']) {
         // Check if the umil/error_files/ is writable
         if (!is_writable("{$phpbb_root_path}umil/error_files/")) {
             phpbb_chmod("{$phpbb_root_path}umil/error_files/", CHMOD_ALL);
         }
         // Hopefully it is writable now.  If not there is nothing we can do.
         if (is_writable("{$phpbb_root_path}umil/error_files/")) {
             if ($this->errors == false) {
                 $this->errors = true;
                 // Setting up an error recording file
                 $append = 0;
                 $this->error_file = "{$phpbb_root_path}umil/error_files/" . strtolower($this->title) . '.txt';
                 while (file_exists($this->error_file)) {
                     $this->error_file = "{$phpbb_root_path}umil/error_files/" . strtolower($this->title) . $append . '.txt';
                     $append++;
                 }
             }
             if (file_exists($this->error_file) && filesize($this->error_file)) {
                 $fp = fopen($this->error_file, 'rb');
                 $contents = fread($fp, filesize($this->error_file));
                 fclose($fp);
                 phpbb_chmod($this->error_file, CHMOD_ALL);
             } else {
                 $contents = (isset($user->lang[$this->title]) ? $user->lang[$this->title] : $this->title) . "\n";
                 $contents .= 'PHP Version: ' . phpversion() . "\n";
                 $contents .= 'DBMS: ' . $this->db->sql_server_info() . "\n";
                 $contents .= 'phpBB3 Version: ' . $config['version'] . "\n\n";
             }
             $contents .= "{$command}\n{$result}\n\n";
             $fp = fopen($this->error_file, 'wb');
             fwrite($fp, $contents);
             fclose($fp);
             phpbb_chmod($this->error_file, CHMOD_ALL);
         } else {
             $this->errors = true;
         }
     }
     if ($result != $user->lang['SUCCESS'] || $this->force_display_results == true) {
         $template->assign_block_vars('results', array('COMMAND' => $command, 'RESULT' => $result, 'S_SUCCESS' => $result == $user->lang['SUCCESS'] ? true : false));
     }
 }
开发者ID:kairion,项目名称:customisation-db,代码行数:57,代码来源:umil_frontend.php

示例11: create_config_file

 /**
  * Writes the config file to disk, or if unable to do so offers alternative methods
  */
 function create_config_file($mode, $sub)
 {
     global $lang, $template, $phpbb_root_path, $phpEx;
     $this->page_title = $lang['STAGE_CONFIG_FILE'];
     // Obtain any submitted data
     $data = $this->get_submitted_data();
     if ($data['dbms'] == '') {
         // Someone's been silly and tried calling this page direct
         // So we send them back to the start to do it again properly
         $this->p_master->redirect("index.{$phpEx}?mode=install");
     }
     $s_hidden_fields = $data['img_imagick'] ? '<input type="hidden" name="img_imagick" value="' . addslashes($data['img_imagick']) . '" />' : '';
     $s_hidden_fields .= '<input type="hidden" name="language" value="' . $data['language'] . '" />';
     $written = false;
     // Create a list of any PHP modules we wish to have loaded
     $available_dbms = get_available_dbms($data['dbms']);
     // Create a lock file to indicate that there is an install in progress
     $fp = @fopen($phpbb_root_path . 'cache/install_lock', 'wb');
     if ($fp === false) {
         // We were unable to create the lock file - abort
         $this->p_master->error($lang['UNABLE_WRITE_LOCK'], __LINE__, __FILE__);
     }
     @fclose($fp);
     @chmod($phpbb_root_path . 'cache/install_lock', 0777);
     // Time to convert the data provided into a config file
     $config_data = phpbb_create_config_file_data($data, $available_dbms[$data['dbms']]['DRIVER']);
     // Attempt to write out the config file directly. If it works, this is the easiest way to do it ...
     if (file_exists($phpbb_root_path . 'config.' . $phpEx) && phpbb_is_writable($phpbb_root_path . 'config.' . $phpEx) || phpbb_is_writable($phpbb_root_path)) {
         // Assume it will work ... if nothing goes wrong below
         $written = true;
         if (!($fp = @fopen($phpbb_root_path . 'config.' . $phpEx, 'w'))) {
             // Something went wrong ... so let's try another method
             $written = false;
         }
         if (!@fwrite($fp, $config_data)) {
             // Something went wrong ... so let's try another method
             $written = false;
         }
         @fclose($fp);
         if ($written) {
             // We may revert back to chmod() if we see problems with users not able to change their config.php file directly
             phpbb_chmod($phpbb_root_path . 'config.' . $phpEx, CHMOD_READ);
         }
     }
     if (isset($_POST['dldone'])) {
         // Do a basic check to make sure that the file has been uploaded
         // Note that all we check is that the file has _something_ in it
         // We don't compare the contents exactly - if they can't upload
         // a single file correctly, it's likely they will have other problems....
         if (filesize($phpbb_root_path . 'config.' . $phpEx) > 10) {
             $written = true;
         }
     }
     $config_options = array_merge($this->db_config_options, $this->admin_config_options);
     foreach ($config_options as $config_key => $vars) {
         if (!is_array($vars)) {
             continue;
         }
         $s_hidden_fields .= '<input type="hidden" name="' . $config_key . '" value="' . $data[$config_key] . '" />';
     }
     if (!$written) {
         // OK, so it didn't work let's try the alternatives
         if (isset($_POST['dlconfig'])) {
             // They want a copy of the file to download, so send the relevant headers and dump out the data
             header("Content-Type: text/x-delimtext; name=\"config.{$phpEx}\"");
             header("Content-disposition: attachment; filename=config.{$phpEx}");
             echo $config_data;
             exit;
         }
         // The option to download the config file is always available, so output it here
         $template->assign_vars(array('BODY' => $lang['CONFIG_FILE_UNABLE_WRITE'], 'L_DL_CONFIG' => $lang['DL_CONFIG'], 'L_DL_CONFIG_EXPLAIN' => $lang['DL_CONFIG_EXPLAIN'], 'L_DL_DONE' => $lang['DONE'], 'L_DL_DOWNLOAD' => $lang['DL_DOWNLOAD'], 'S_HIDDEN' => $s_hidden_fields, 'S_SHOW_DOWNLOAD' => true, 'U_ACTION' => $this->p_master->module_url . "?mode={$mode}&amp;sub=config_file"));
         return;
     } else {
         $template->assign_vars(array('BODY' => $lang['CONFIG_FILE_WRITTEN'], 'L_SUBMIT' => $lang['NEXT_STEP'], 'S_HIDDEN' => $s_hidden_fields, 'U_ACTION' => $this->p_master->module_url . "?mode={$mode}&amp;sub=advanced"));
         return;
     }
 }
开发者ID:tassinmael,项目名称:thatforum,代码行数:80,代码来源:install_install.php

示例12: titania_mkdir_recursive

/**
* Make a directory recursively (from functions_compress)
*
* @param string $target_filename The target directory we wish to have
*/
function titania_mkdir_recursive($target_filename)
{
    if (!is_dir($target_filename)) {
        $str = '';
        $folders = explode('/', $target_filename);
        // Create and folders and subfolders if they do not exist
        foreach ($folders as $folder) {
            $folder = trim($folder);
            if (!$folder) {
                continue;
            }
            $str = !empty($str) ? $str . '/' . $folder : $folder;
            if (!is_dir($str)) {
                @mkdir($str, 0777);
                phpbb_chmod($str, CHMOD_READ | CHMOD_WRITE);
            }
        }
    }
}
开发者ID:Noxwizard,项目名称:customisation-db,代码行数:24,代码来源:ariel_convert.php

示例13: repair

    function repair()
    {
        global $critical_repair, $user;
        $critical_repair->user_setup($user);
        include PHPBB_ROOT_PATH . 'includes/functions_install.' . PHP_EXT;
        include STK_ROOT_PATH . 'includes/functions.' . PHP_EXT;
        $available_dbms = get_available_dbms();
        $error = array();
        $data = array('dbms' => isset($_POST['dbms']) ? $_POST['dbms'] : '', 'dbhost' => isset($_POST['dbhost']) ? $_POST['dbhost'] : '', 'dbport' => isset($_POST['dbport']) ? $_POST['dbport'] : '', 'dbname' => isset($_POST['dbname']) ? $_POST['dbname'] : '', 'dbuser' => isset($_POST['dbuser']) ? $_POST['dbuser'] : '', 'dbpasswd' => isset($_POST['dbpasswd']) ? $_POST['dbpasswd'] : '', 'table_prefix' => isset($_POST['table_prefix']) ? $_POST['table_prefix'] : 'phpbb_');
        if (isset($_POST['submit'])) {
            if (!isset($available_dbms[$data['dbms']])) {
                $error[] = $user->lang['CONFIG_REPAIR_NO_DBMS'];
            } else {
                $connect_test = $this->critical_connect_check_db($user, true, $error, $available_dbms[$data['dbms']], $data['table_prefix'], $data['dbhost'], $data['dbuser'], htmlspecialchars_decode($data['dbpasswd']), $data['dbname'], $data['dbport']);
                if (!$connect_test) {
                    $error[] = $user->lang['CONFIG_REPAIR_CONNECT_FAIL'];
                }
            }
        }
        if (isset($_POST['submit']) && empty($error)) {
            // Time to convert the data provided into a config file
            $config_data = "<?php\n";
            $config_data .= "// phpBB 3.1.x auto-generated configuration file\n// Do not change anything in this file!\n";
            $config_data_array = array('dbms' => $available_dbms[$data['dbms']]['DRIVER'], 'dbhost' => $data['dbhost'], 'dbport' => $data['dbport'], 'dbname' => $data['dbname'], 'dbuser' => $data['dbuser'], 'dbpasswd' => htmlspecialchars_decode($data['dbpasswd']), 'table_prefix' => $data['table_prefix'], 'phpbb_adm_relative_path' => 'adm/', 'acm_type' => 'phpbb\\cache\\driver\\file');
            foreach ($config_data_array as $key => $value) {
                $config_data .= "\${$key} = '" . str_replace("'", "\\'", str_replace('\\', '\\\\', $value)) . "';\n";
            }
            unset($config_data_array);
            $config_data .= "\n@define('PHPBB_INSTALLED', true);\n";
            $config_data .= "// @define('PHPBB_DISPLAY_LOAD_TIME', true);\n";
            $config_data .= "// @define('DEBUG', true);\n";
            $config_data .= "// @define('DEBUG_CONTAINER', true);\n";
            $config_data .= '?' . '>';
            // Done this to prevent highlighting editors getting confused!
            // Assume it will work ... if nothing goes wrong below
            $written = true;
            if (!($fp = @fopen(PHPBB_ROOT_PATH . 'config.' . PHP_EXT, 'w'))) {
                // Something went wrong ... so let's try another method
                $written = false;
            }
            if (!@fwrite($fp, $config_data)) {
                // Something went wrong ... so let's try another method
                $written = false;
            }
            @fclose($fp);
            if ($written) {
                // We may revert back to chmod() if we see problems with users not able to change their config.php file directly
                if (!function_exists('phpbb_chmod')) {
                    include PHPBB_ROOT_PATH . 'includes/functions.' . PHP_EXT;
                }
                phpbb_chmod(PHPBB_ROOT_PATH . 'config.' . PHP_EXT, CHMOD_READ);
            } else {
                header('Content-type: text/html; charset=UTF-8');
                echo $user->lang['CONFIG_REPAIR_WRITE_ERROR'];
                echo nl2br(htmlspecialchars($config_data));
                exit;
            }
        } else {
            header('Content-type: text/html; charset=UTF-8');
            ?>
	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
		<head>
			<meta http-equiv="content-type" content="text/html; charset=utf-8" />
			<meta http-equiv="content-style-type" content="text/css" />
			<meta http-equiv="imagetoolbar" content="no" />
			<title>Config Repair - Support Toolkit</title>
			<link href="<?php 
            echo STK_ROOT_PATH;
            ?>
style/style.css" rel="stylesheet" type="text/css" media="screen" />
			<link href="<?php 
            echo STK_ROOT_PATH;
            ?>
style/erk_style.css" rel="stylesheet" type="text/css" media="screen" />
		</head>
		<body id="errorpage">
			<div id="wrap">
				<div id="page-header">

				</div>
				<div id="page-body">
					<div id="acp">
						<div class="panel">
							<span class="corners-top"><span></span></span>
								<div id="content">
									<h1><?php 
            echo $user->lang['CONFIG_REPAIR'];
            ?>
</h1>
									<br />
									<p>
										<?php 
            echo $user->lang['CONFIG_REPAIR_EXPLAIN'];
            ?>
									</p>
									<form id="stk" method="post" action="<?php 
            echo STK_ROOT_PATH . 'erk.' . PHP_EXT;
            ?>
" name="support_tool_kit">
//.........这里部分代码省略.........
开发者ID:melvingb,项目名称:phpbb3.1-STK,代码行数:101,代码来源:config_repair.php

示例14: directory_delete

 function directory_delete($dir)
 {
     if (!file_exists($dir)) {
         return true;
     }
     if (!is_dir($dir) && is_file($dir)) {
         phpbb_chmod($dir, CHMOD_ALL);
         return unlink($dir);
     }
     foreach (scandir($dir) as $item) {
         if ($item == '.' || $item == '..') {
             continue;
         }
         if (!$this->directory_delete($dir . "/" . $item)) {
             phpbb_chmod($dir . "/" . $item, CHMOD_ALL);
             if (!$this->directory_delete($dir . "/" . $item)) {
                 return false;
             }
         }
     }
     // Make sure we don't delete the MODs directory
     if ($dir != $this->mods_dir) {
         return rmdir($dir);
     }
 }
开发者ID:kairion,项目名称:customisation-db,代码行数:25,代码来源:acp_mods.php

示例15: add_htm_files

 private function add_htm_files($lang_root_path, $reference_path)
 {
     $htm_files = array('', 'acp/', 'mods/');
     if (!is_dir($lang_root_path . 'mods')) {
         mkdir($lang_root_path . 'mods');
         phpbb_chmod($lang_root_path . 'mods', CHMOD_READ | CHMOD_WRITE);
     }
     foreach ($htm_files as $htm_file) {
         $res = fopen($lang_root_path . $htm_file . 'index.htm', 'w');
         fwrite($res, file_get_contents($reference_path . '/language/en/index.htm'));
         fclose($res);
     }
 }
开发者ID:kairion,项目名称:customisation-db,代码行数:13,代码来源:translation_validation.php


注:本文中的phpbb_chmod函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。