/**
	 * @param string $file
	 * @param int|bool $mode
	 * @param bool $recursive
	 * @return bool
	 */
	public function chmod($file, $mode = false, $recursive = false ) {
		if ( ! $mode ) {
			if ( $this->is_file($file) )
				$mode = FS_CHMOD_FILE;
			elseif ( $this->is_dir($file) )
				$mode = FS_CHMOD_DIR;
			else
				return false;
		}

		// chmod any sub-objects if recursive.
		if ( $recursive && $this->is_dir($file) ) {
			$filelist = $this->dirlist($file);
			foreach ( (array)$filelist as $filename => $filemeta )
				$this->chmod($file . '/' . $filename, $mode, $recursive);
		}

		// chmod the file or directory
		return $this->ftp->chmod($file, $mode);
	}
Пример #2
0
 public function mkdir($dir)
 {
     return $this->ftp->mkdir($dir) && ($this->ftp->chmod($dir, $this->permDir) || true);
 }
Пример #3
0
            if (!$ftp->chdir($config['ftp_path'])) {
                $ftp->quit();
                ?>
</pre></div>
	<div class="bbody">Directory "<?php 
                echo $config['ftp_path'];
                ?>
" does not exist!</div>
	<div class="bfoot center"><a class="submit" href="index.php?step=<?php 
                echo $step - 1;
                ?>
">Go back</a></div>
				<?php 
            } else {
                $ftp->chdir('install');
                $ftp->chmod('../data/config.inc.php', 0666);
                $ftp->cdup();
                $ftp->quit();
                require_once '../classes/class.filesystem.php';
                $filesystem = new filesystem($config['ftp_server'], $config['ftp_user'], $config['ftp_pw'], $config['ftp_port']);
                $filesystem->set_wd($config['ftp_path']);
                include '../classes/class.phpconfig.php';
                $c = new manageconfig();
                $c->getdata('../data/config.inc.php');
                $c->updateconfig('ftp_server', str);
                $c->updateconfig('ftp_user', str);
                $c->updateconfig('ftp_pw', str);
                $c->updateconfig('ftp_path', str);
                $c->updateconfig('ftp_port', int);
                $c->savedata();
                ?>
Пример #4
0
     flush();
     $datas_dir = ROOT_PATH . "{$mmktime}/";
     if (@rename(DATA_PATH, $datas_dir)) {
         copyDir($datas_dir, DATA_PATH);
     }
     gcms::rm_dir($datas_dir);
     echo '<li class=correct>ตรวจสอบโฟลเดอร์ <strong>' . DATA_FOLDER . '</strong> <i>เรียบร้อย</i></li>';
     ob_flush();
     flush();
 }
 $files = array();
 $files[] = ROOT_PATH . 'bin/config.php';
 $files[] = ROOT_PATH . 'bin/vars.php';
 foreach ($files as $file) {
     if (!is_writeable($file)) {
         $ftp->chmod($file, 0646);
     }
     if (is_writeable($file)) {
         echo '<li class=correct>ไฟล์ <strong>' . str_replace(ROOT_PATH, '', $file) . '</strong> <i>สามารถเขียนได้</i></li>';
     } else {
         $error = true;
         echo '<li class=incorrect>ไฟล์ <strong>' . str_replace(ROOT_PATH, '', $file) . '</strong> <em>ไม่สามารถเขียนได้</em> กรุณาสร้างไฟล์เปล่าๆและปรับ chmod ให้เป็น 755 ด้วยตัวเอง</li>';
     }
 }
 $folders[] = DATA_PATH . 'language/';
 foreach ($folders as $folder) {
     if ($ftp->mkdir($folder, 0755)) {
         echo '<li class=correct>โฟลเดอร์ <strong>' . str_replace(ROOT_PATH, '', $folder) . '</strong> <i>สามารถใช้งานได้</i></li>';
     } else {
         $error = true;
         echo '<li class=incorrect>โฟลเดอร์ <strong>' . str_replace(ROOT_PATH, '', $folder) . '</strong> <em>ไม่สามารถเขียนหรือสร้างได้</em> กรุณาสร้างโฟลเดอร์นี้และปรับ chmod ให้เป็น 755 ด้วยตัวเอง</li>';