예제 #1
0
파일: GWF_File.php 프로젝트: sinfocol/gwf3
 public static function createDir($path)
 {
     if (true === Common::isDir($path)) {
         return true;
     }
     return @mkdir($path, GWF_CHMOD, true);
 }
예제 #2
0
 private static function createTempDir()
 {
     if (Common::isDir(GWF_PATH . 'extra/temp/baim')) {
         return '';
     }
     if (false === mkdir(GWF_PATH . 'extra/temp/baim', GWF_CHMOD)) {
         return GWF_HTML::err('ERR_WRITE_FILE', array(GWF_PATH . 'extra/temp/baim'));
     }
     return '';
 }
예제 #3
0
 private static function installDirs(Module_PageBuilder $module, $dropTable)
 {
     $path = GWF_WWW_PATH . 'dbimg/content';
     $path = $module->getContentPath();
     if (Common::isDir($path)) {
         return '';
     }
     if (false === mkdir($path, GWF_CHMOD)) {
         return GWF_HTML::err('ERR_WRITE_FILE', array($path));
     }
     // 		if (false === chmod($path, GWF_CHMOD))
     // 		{
     // 			return GWF_HTML::err('ERR_WRITE_FILE', array($path));
     // 		}
     return '';
 }
예제 #4
0
파일: Dog_Init.php 프로젝트: sinfocol/gwf3
 private static function initModulesDir($dir)
 {
     if (false === ($files = @scandir(DOG_PATH . 'dog_modules/' . $dir))) {
         return Dog_Log::warn('Dog_Init::initModulesDir() - Directory not found: ' . (DOG_PATH . 'dog_modules/' . $dir));
     }
     foreach ($files as $filename) {
         if ($filename[0] !== '.') {
             $path = DOG_PATH . 'dog_modules/' . $dir . '/' . $filename;
             if (Common::isDir($path)) {
                 $modf = $path . '/DOGMOD_' . $filename . '.php';
                 require_once $modf;
                 Dog_Module::createModule($path . '/', $filename);
             }
         }
     }
 }
예제 #5
0
 public function loadLanguage($path)
 {
     if ($this->lang === NULL) {
         $mod = $this->getName();
         # Check for branch first
         $path2 = Common::substrFrom($path, 'lang/', $path);
         # remove lang/ from beginning.
         $branchfile = GWF_WWW_PATH . 'lang/module/' . $mod . '/' . $path2;
         # Branchfile
         if (Common::isDir(dirname($branchfile))) {
             $path3 = $branchfile;
         } else {
             # No branch
             $path3 = sprintf('%smodule/%s/%s', GWF_CORE_PATH, $mod, $path);
         }
         $this->lang = new GWF_LangTrans($path3);
     }
     return $this->lang;
 }
예제 #6
0
 public static function initCityQuests()
 {
     foreach (self::$cities as $city) {
         $city instanceof SR_City;
         $fullpath = self::getShadowDir() . 'city/' . $city->getName() . '/quest';
         if (Common::isDir($fullpath)) {
             GWF_File::filewalker($fullpath, array($city, 'initQuests'));
         }
     }
 }
예제 #7
0
 public function includeTables()
 {
     $path = $this->getTablePath();
     if (Common::isDir($path)) {
         foreach (scandir($path) as $entry) {
             if (Common::endsWith($entry, '.php')) {
                 require_once $path . $entry;
             }
         }
     }
 }
예제 #8
0
 public static function getAllMethods(GWF_Module $module)
 {
     $back = array();
     $name = $module->getName();
     $path = GWF_CORE_PATH . "module/{$name}/method";
     if (!Common::isDir($path)) {
         return array();
     }
     if (false === ($dir = scandir($path))) {
         GWF3::logDie('Cannot access ' . $path . ' in ' . __METHOD__ . ' line ' . __LINE__);
     }
     foreach ($dir as $file) {
         # starts with .
         if ($file[0] === '.' || false === Common::endsWith($file, '.php')) {
             continue;
         }
         $path2 = $path . '/' . $file;
         if (Common::isFile($path2)) {
             if (false === ($method = $module->getMethod(substr($file, 0, -4)))) {
                 GWF3::logDie('NO METHOD for ' . $file);
             }
             $back[] = $method;
         }
     }
     return $back;
 }
예제 #9
0
<?php

$dirname = $home . '/level/4';
if (!Common::isDir($dirname)) {
    GWF_File::removeDir($dirname);
    $dirname2 = "/root/kwd";
    @mkdir($dirname2, 0700, true);
    @chmod($dirname2, 0700);
    @chown($dirname2, $username);
    @chgrp($dirname2, $username);
    @rename($dirname2, $dirname);
}
$filename = $home . '/level/4/README.txt';
if (!Common::isFile($filename)) {
    $filename2 = tempnam("/tmp", "kwf");
    @file_put_contents($filename2, "The solution to level 4 is 'AndIknowchown' without the quotes.\n");
    @chmod($filename2, 00);
    @chown($filename2, $username);
    @chgrp($filename2, $username);
    @rename($filename2, $filename);
}