Esempio n. 1
0
 /**
  * Load a settings file. 
  * Can auto detect file type from the file's extention.
  * @param string $filename file to load.
  * @param string|null $type The type of file being loaded.
  * @param boolean $array Return data as an array or object.
  * @return array|stdClass Data from file.
  */
 public function load($filename, $type = null, $array = false)
 {
     if ($type == null) {
         $type = strtoupper(pathinfo($filename, PATHINFO_EXTENSION));
     }
     $data = NULL;
     if (file_exists($filename)) {
         switch ($type) {
             case 'JSON':
                 $io = new IO();
                 $data = $io->read($filename);
                 if ($data === false) {
                     return null;
                 }
                 $data = json_decode($data, $array);
                 break;
             case 'INI':
                 $data = $array ? parse_ini_file($filename, true) : (object) parse_ini_file($filename, true);
                 if ($data === false) {
                     $data = NULL;
                 }
                 break;
             default:
                 $data = NULL;
         }
     }
     return $data;
 }
Esempio n. 2
0
 function process()
 {
     Console::initCore();
     if ($r = ArgsHolder::get()->getOption('count')) {
         $this->count = $r;
     }
     if (($c = ArgsHolder::get()->shiftCommand()) == 'help') {
         return $this->cmdHelp();
     }
     try {
         IO::out("");
         $sql = 'SELECT * FROM ' . self::TABLE . ' where not isnull(finished_at) and not 
             isnull(locked_at) and isnull(failed_at) ORDER BY run_at DESC';
         if ($this->count) {
             $list = DB::query($sql . ' LIMIT ' . $this->count);
         } else {
             $list = DB::query($sql);
         }
         if (!count($list)) {
             IO::out("No finished work!", IO::MESSAGE_FAIL);
             return;
         }
         io::out(sprintf("%-10s %-7s %-3s %-20s %-20s %-19s %-4s %-5s", "~CYAN~id", "queue", "pr", "run_at", "locked_at", "finished_at", "att", "call_to~~~"));
         foreach ($list as $l) {
             $handler = unserialize($l["handler"]);
             io::out(sprintf("%-4s %-7s %-3s %-20s %-20s %-20s %-3s %-5s", $l["id"], $l["queue"], $l["priority"], $l["run_at"], $l["locked_at"], $l["finished_at"], $l["attempts"], $handler["class"] . "::" . $handler["method"] . "(...)"));
         }
     } catch (Exception $e) {
         io::out($e->getMessage(), IO::MESSAGE_FAIL);
         return;
     }
     IO::out("");
 }
Esempio n. 3
0
 /**
  * Fetches gallery info for the specified gallery and immediate children.
  */
 function get_gallery($gallery_name, $getChildGalleries = 1)
 {
     $gal = new gallery($gallery_name);
     //if fail then try to open generic metadata
     $fp = @fopen($this->config->base_path . $this->config->pathto_galleries . $gallery_name . "/metadata.csv", "r");
     if ($fp) {
         while ($temp[] = fgetcsv($fp, 2048)) {
         }
         fclose($fp);
         list($gal->filename, $gal->name, $gal->desc, $gal->long_desc, $gal->date) = $temp[1];
         for ($i = 0; $i < count($temp) - 3; $i++) {
             $gal->images[$i] = new image();
             list($gal->images[$i]->filename, $gal->images[$i]->name, $gal->images[$i]->desc, $gal->images[$i]->long_desc, $gal->images[$i]->date, $gal->images[$i]->sort) = $temp[$i + 2];
             $gal->images[$i]->full_path = $gal->name . "/" . $gal->images[$i]->filename;
             //get image size and type
             list($gal->images[$i]->width, $gal->images[$i]->height, $gal->images[$i]->type) = substr($gal->images[$i]->filename, 0, 7) == "http://" ? @GetImageSize($gal->images[$i]->filename) : @GetImageSize($this->config->base_path . $this->config->pathto_galleries . $gal->id . "/" . $gal->images[$i]->filename);
         }
         //discover child galleries
         $dir = photostack::get_listing($this->config->base_path . $this->config->pathto_galleries . $gallery_name . "/", "dirs");
         if ($getChildGalleries) {
             //but only fetch their info if required too
             foreach ($dir->dirs as $gallery) {
                 $gal->galleries[] = $this->get_gallery($gallery_name . "/" . $gallery, $getChildGalleries);
             }
         } else {
             //otherwise just copy their names in so they can be counted
             $gal->galleries = $dir->dirs;
         }
         return $gal;
     } else {
         return parent::get_gallery($gallery_name, $getChildGalleries);
     }
 }
Esempio n. 4
0
 public function RestartById($c)
 {
     if (!count(DB::query('SELECT * from ' . self::TABLE . ' WHERE id="' . $c . '"'))) {
         io::out("Work with id={$c} is not exists", IO::MESSAGE_FAIL);
         return;
     }
     $list = DB::query('SELECT * FROM ' . self::TABLE . ' where isnull(finished_at) and not 
         isnull(locked_at) and isnull(failed_at) and id=' . $c . ' ORDER BY run_at DESC');
     if (count($list)) {
         IO::out("This is working now...You cant restart!", IO::MESSAGE_FAIL);
         return;
     }
     if (IO::YES == io::dialog('Do you really want to restart work with id ' . $c . '?', IO::NO | IO::YES, IO::NO)) {
         DB::query("UPDATE " . self::TABLE . " set attempts='1',finished_at=null, locked_at=null, \n                failed_at=null, run_at=now()  WHERE  id='" . $c . "'");
         $php_path = exec("which php");
         if (empty($php_path)) {
             return $this->log("###" . date("c") . " Call from console PHP executable not found");
         }
         if (!is_executable($php_path)) {
             return $this->log("###" . date("c") . " Call from console {$php_path} could not be executed");
         }
         exec($php_path . ' ' . trim(escapeshellarg(Config::get('ROOT_DIR') . "/vendors/delayedjob/JobHandler.php"), "'") . ' >> ' . Config::get('ROOT_DIR') . '/logs/delayedjob.log 2>&1 &');
         io::done('Restarting...');
     } else {
         io::done('Cancel restart');
     }
     IO::out("");
 }
Esempio n. 5
0
function pick_count()
{
    //clear_pick_cache(1);//缓存定期清理
    //clear_search_index(1);//清除索引
    clear_log(1);
    //清除日志
    pload('C:cache');
    $arr['search_index']['name'] = milu_lang('rules_search_index');
    $arr['search_index']['msg'] = milu_lang('search_index_notice');
    $arr['search_index']['show'] = '<span style=" width:120px; float:left">' . milu_lang('search_index_c') . '<hr>';
    $type_arr = array('1' => milu_lang('fast_pick_rules'), '2' => milu_lang('dxc_system_rules'), '3' => milu_lang('fastpick_evo'));
    $type_arr2 = array('3' => milu_lang('server_'), '4' => milu_lang('local_'));
    foreach ($type_arr as $k => $v) {
        foreach ($type_arr2 as $k2 => $v2) {
            $type = $k . $k2;
            $show_name = '<span style=" width:120px; float:left">' . $type_arr[$k] . $type_arr2[$k2] . '</span>';
            $search_index_count = DB::result(DB::query("SELECT COUNT(*) FROM " . DB::table('strayer_searchindex') . " WHERE type='{$type}'"), 0);
            $arr['search_index']['show'] .= $show_name . ' ' . $search_index_count . '<br />';
        }
    }
    $log_info = IO::info(PICK_DIR . '/data/log');
    $arr['log']['name'] = milu_lang('log_size');
    $arr['log']['msg'] = milu_lang('auto_pick_notice');
    $arr['log']['show'] = sizecount($log_info['size']);
    $cache_info = IO::info(PICK_CACHE, 1, 1);
    $arr['cache']['name'] = milu_lang('cache_file_size');
    $arr['cache']['show'] = milu_lang('cache_size_value', array('s' => sizecount($cache_info['size']), 'p' => PICK_CACHE_SIZE));
    $arr['cache']['msg'] = milu_lang('cache_notice');
    return $arr;
}
Esempio n. 6
0
 /**
  * Edits php.ini
  *
  * @author Art <*****@*****.**>
  * @return PHP
  */
 protected function editIni()
 {
     $timezone = SET::$s->php_date_timezone;
     $ini = $this->unzipped_destination . 'php.ini';
     if (!$timezone) {
         $timezone = 'Europe/London';
         _echo('Your timezone setting wasn\'t found. Setting it to Europe/London.');
         SET::$s->php_date_timezone = $timezone;
         SET::$s->save();
     }
     $contents = file_get_contents($ini);
     $err_log_dir = '"' . str_replace(DIRECTORY_SEPARATOR, '/', DIR_LOGS) . 'php/php_errors.log"';
     if ($contents) {
         $contents = str_ireplace([';date.timezone =', '; extension_dir = "ext"', ';error_log = php_errors.log'], ['date.timezone = ' . $timezone, 'extension_dir = "' . $this->unzipped_destination . 'ext"', 'error_log = ' . $err_log_dir . ''], $contents);
         if (file_put_contents($ini, $contents) !== false) {
             _echo('php.ini edited');
         } else {
             $msg = 'Failed to edit php.ini. You will have to set the following yourself:' . PHP_EOL . "\t Find ';date.timezone =' and change it to 'date.timezone = ' . {$timezone}'" . PHP_EOL . "\t Find '; extension_dir = \"ext\"' and change it to 'extension_dir = \"ext\"'" . PHP_EOL . "\t Find ';error_log = php_errors.log' and change it to 'error_log = {$err_log_dir}'";
             _echo($msg . PHP_EOL . 'Press ENTER to continue');
             \IO::readline();
         }
     } else {
         _echo('Failed to open php.ini for editing. You will have to set the timezone yourself.');
     }
     return $this;
 }
Esempio n. 7
0
 function process()
 {
     Console::initCore();
     if (($c = ArgsHolder::get()->shiftCommand()) == 'help') {
         return $this->cmdHelp();
     }
     try {
         $format = "%-25s %s";
         IO::out("");
         $s = DB::query('SELECT * FROM ' . self::TABLE . ' where id="' . $c . '"');
         if (!count($s)) {
             io::out("Work with id={$c} is not exists", IO::MESSAGE_FAIL);
             return;
         }
         io::out(sprintf($format, "~CYAN~id~~~", $c));
         io::out(sprintf($format, "~CYAN~queue~~~", $this->emp($s[0]['queue'])));
         io::out(sprintf($format, "~CYAN~priority~~~", $this->emp($s[0]['priority'])));
         io::out(sprintf($format, "~CYAN~run at~~~", $this->emp($s[0]['run_at'])));
         io::out(sprintf($format, "~CYAN~locked at~~~", $this->emp($s[0]['locked_at'])));
         io::out(sprintf($format, "~CYAN~finished at~~~", $this->emp($s[0]['finished_at'])));
         io::out(sprintf($format, "~CYAN~failed at~~~", $this->emp($s[0]['failed_at'])));
         io::out(sprintf($format, "~CYAN~attemts~~~", $this->emp($s[0]['attempts'])));
         $handler = unserialize($s[0]["handler"]);
         io::out(sprintf($format, "~CYAN~call~~~", $handler["class"] . "::" . $handler["method"]) . "(...)");
         if (isset($handler["param"])) {
             io::out(sprintf($format, "~CYAN~params~~~", trim(self::walker($handler['param']), ',')));
         }
     } catch (Exception $e) {
         io::out($e->getMessage(), IO::MESSAGE_FAIL);
         return;
     }
     IO::out("");
 }
Esempio n. 8
0
File: IO.php Progetto: techart/tao
 /**
  * Возвращает объект класса IO.Stream.ResourceStream, соответствующий stderr.
  *
  * @return IO_Stream_ResourceStream
  */
 public static function stderr($stderr = null)
 {
     if ($stderr instanceof IO_Stream_AbstractStream) {
         self::$stderr = $stderr;
     }
     return self::$stderr ? self::$stderr : (self::$stderr = IO_Stream::ResourceStream(STDERR));
 }
Esempio n. 9
0
 /**
  * Проверяет условия указанные в теге condition.
  *
  * В данной момент реализована проверка установленного пакета
  *
  * @param DOMNode 
  * @return bool
  */
 private function checkCondition(DOMNode $node)
 {
     IO::info('Check Condition ', false);
     $attr = $node->attributes;
     $packageName = is_null($attr->getNamedItem('package')) ? null : $attr->getNamedItem('package')->nodeValue;
     if (!is_null($packageName)) {
         $version = is_null($attr->getNamedItem('version')) ? null : $attr->getNamedItem('version')->nodeValue;
         $rel = is_null($attr->getNamedItem('rel')) ? null : Deps::normalizeRel($attr->getNamedItem('rel')->nodeValue);
         if (is_null($version) && $rel != '!=') {
             $version = '0.0';
             $rel = '>=';
         } elseif (is_null($rel)) {
             $rel = '=';
         }
         io::info($packageName . ' ' . $rel . ' ' . $version . "\t", false);
         $p = PackageManager::getInstalledPackage($packageName);
         if ($rel == '!=') {
             $res = $p === false;
         } elseif ($p !== false) {
             $res = version_compare($p->version, $version, $rel);
         } else {
             $res = false;
         }
         io::info('', $res ? IO::MESSAGE_OK : IO::MESSAGE_FAIL);
         return $res;
     }
 }
Esempio n. 10
0
File: IO.php Progetto: rsms/phpab
 /**
  * Print something to stderr
  *
  * @param  mixed
  * @return void
  */
 public static function writeError($str)
 {
     if (!self::$stdErrFD) {
         self::$stdErrFD = fopen('php://stderr', 'w');
     }
     fwrite(self::$stdErrFD, $str);
 }
Esempio n. 11
0
 function cmdUnlock()
 {
     IO::out('Unlocking Package Manager', false);
     $pm = new PM();
     if ($pm->unlock(true)) {
         io::done();
     }
 }
Esempio n. 12
0
 function CmdList()
 {
     io::out('~WHITE~Current env~~~: ' . ($env = EnvManager::getCurrent()));
     io::out();
     IO::OUt('~WHITE~Avaible enviroments:~~~');
     foreach (EnvManager::envList() as $e) {
         if ($e != $env) {
             io::out('    ' . $e);
         }
     }
 }
Esempio n. 13
0
File: API.php Progetto: techart/tao
 public static function initialize(array $options = array())
 {
     self::options($options);
     if (!class_exists('Google_Client') && set_include_path(get_include_path() . PATH_SEPARATOR . self::option('lib_path') . 'src/')) {
         if (!@(include_once 'Google_Client.php')) {
             throw new Service_Google_API_ClientLibraryModuleNotFoundException('src/Google_Client.php', self::option('lib_path'));
         }
     }
     self::$cache = Cache::connect(self::option('cache_path'), 0);
     self::$stdin = IO::stdin();
 }
Esempio n. 14
0
 public function send(IO $io)
 {
     $io->send("GNTP/1.0 NOTIFY NONE");
     $io->send("Application-Name: " . $this->applicationName);
     $io->send("Notification-Name: " . $this->notificationName);
     $io->send("Notification-Title: " . $this->notificationTitle);
     if (isset($this->options['text'])) {
         $io->send("Notification-Text: " . $this->options['text']);
     }
     if (isset($this->options['icon_file'])) {
         $resource = $this->getResouce($this->options['icon_file']);
         $io->send("Notification-Icon: x-growl-resource://" . $resource['hash']);
     }
     $io->send("");
     $this->sendResources($io);
     $io->send("");
 }
Esempio n. 15
0
File: Dump.php Progetto: techart/tao
 /**
  * Запускает приложение
  *
  * @param array $argv
  *
  * @return int
  */
 public function run(array $argv)
 {
     $cache = Cache::connect($this->config->dsn);
     if ($this->config->modules != null) {
         foreach (Core_Strings::split_by(',', $this->config->modules) as $v) {
             Core::load($v);
         }
     }
     foreach ($argv as $v) {
         IO::stdout()->write_line($v)->write_line(var_export($cache[$v], true));
     }
     return 0;
 }
Esempio n. 16
0
 function cmdList()
 {
     $list = $this->rl->getList();
     if (!count($list)) {
         return IO::out('Repository List empty.');
     }
     io::out('~WHITE~List of  Repositories~~~:');
     for ($i = 0, $c = count($list); $i < $c; $i++) {
         io::out($list[$i]);
     }
     io::out();
     io::out('Total: ' . $c);
 }
Esempio n. 17
0
 /**
  * Checks if the www dir is set up
  *
  * @author Art <*****@*****.**>
  */
 protected function checkWebDir()
 {
     if (!SET::$s->web_dir) {
         $new_dir = \IO::readline('Your default website name was not found - please enter a name (defaults to my-default-website if left empty)');
         if (!$new_dir) {
             $new_dir = 'my-default-website';
         }
         SET::$s->web_dir = $new_dir;
         SET::$s->save();
     }
     if (!file_exists(DIR_WWW . SET::$s->web_dir . DIRECTORY_SEPARATOR)) {
         mkdir(DIR_WWW . SET::$s->web_dir . DIRECTORY_SEPARATOR, 777, true);
     }
 }
Esempio n. 18
0
 public function getDataByPath($path)
 {
     $data = array();
     $patharr = explode(':', $path);
     $bzarr = C::t('connect')->fetch_all_bz();
     if (in_array($patharr[0], $bzarr)) {
         $bz = $patharr[0];
     } else {
         $bz = 'dzz';
     }
     if ($bz == 'dzz') {
         list($idtype, $id) = explode('_', str_replace('dzz:', '', $path));
         if ($idtype == 'fid') {
             $data = C::t('folder')->fetch_by_fid($id);
             $data['name'] = $data['title'];
             $data['oid'] = $data['fid'];
             $data['bz'] = '';
             $data['path'] = $data['fid'];
             $data['topfid'] = array();
             $data['type'] = 'folder';
             $data['folderarr'] = IO::getFolderDatasByPath($id);
             foreach ($data['folderarr'] as $value) {
                 $data['topfid'][] = $value['fid'];
             }
         } elseif ($idtype == 'icoid') {
             $data = C::t('icos')->fetch_by_icoid($id);
             if ($data['type'] == 'folder') {
                 $data['topfid'] = array();
                 $data['folderarr'] = IO::getFolderDatasByPath($data['oid']);
                 foreach ($data['folderarr'] as $value) {
                     $data['topfid'][] = $value['fid'];
                 }
             }
         }
     } else {
         $data = IO::getMeta($path);
         if ($data['type'] == 'folder') {
             $data['topfid'] = array();
             $data['folderarr'] = IO::getFolderDatasByPath($data['path']);
             foreach ($data['folderarr'] as $value) {
                 if (!empty($value['fid'])) {
                     $data['topfid'][] = $value['fid'];
                 }
             }
             $data['topfid'] = array_reverse($data['topfid']);
         }
     }
     return $data;
 }
Esempio n. 19
0
 /**
  * @param IO $io
  */
 protected function sendResources(IO $io)
 {
     foreach ($this->getResouces() as $resource) {
         $io->send("Identifier: " . $resource['hash']);
         $io->send("Length: " . strlen($resource['bin']));
         $io->send("");
         $io->sendBin($resource['bin']);
         $io->send("");
     }
 }
Esempio n. 20
0
 function getGallery($galleryId, $getChildGalleries = 1)
 {
     $gal =& new gallery($galleryId, $parent);
     //try to open language specific gallery info
     $res = $this->query("SELECT * FROM " . $this->config->sql_prefix . "galleries " . "WHERE galleryid='" . $this->escape_string($galleryId) . "' " . "AND lang='" . $this->escape_string($language) . "'");
     //if fail then try to open generic gallery info
     if (!$res || !$this->num_rows($res)) {
         $res = $this->query("SELECT * FROM " . $this->config->sql_prefix . "galleries " . "WHERE galleryid='" . $this->escape_string($galleryId) . "' and lang=''");
     }
     //if that succeeds then get galleries from db
     if ($res && $this->num_rows($res)) {
         $galinfo = $this->fetch_array($res);
         $gal->filename = $galinfo['filename'];
         $gal->name = $galinfo['name'];
         $gal->desc = $galinfo['description'];
         $gal->date = $galinfo['date'];
         //try to open language specific image info
         $res = $this->query("SELECT * FROM " . $this->config->sql_prefix . "images " . "WHERE galleryid='" . $this->escape_string($galleryId) . "' ");
         //if fail then try to open generic image info
         if (!$res || !$this->num_rows($res)) {
             $res = $this->query("SELECT * FROM " . $this->config->sql_prefix . "images " . "WHERE galleryid='" . $this->escape_string($galleryId) . "'");
         }
         for ($i = 0; $i < $this->num_rows($res); $i++) {
             $imginfo = $this->fetch_array($res);
             $gal->images[$i] =& new image($imginfo['filename'], $gal);
             $gal->images[$i]->thumbnail = $imginfo['thumbnail'];
             $gal->images[$i]->name = $imginfo['name'];
             $gal->images[$i]->desc = $imginfo['description'];
             $gal->images[$i]->date = $imginfo['date'];
         }
     } else {
         //no record found so use iifn method implemented in parent class
         return parent::get_gallery($galleryId, $parent, $getChildGalleries, $language);
     }
     //discover child galleries
     $dir = photostack::get_listing($this->config->base_path . $this->config->pathto_galleries . $galleryId . "/");
     if ($getChildGalleries) {
         //but only fetch their info if required too
         foreach ($dir->dirs as $gallery) {
             $gal->galleries[] =& $this->get_gallery($galleryId . "/" . $gallery, $gal, $getChildGalleries - 1, $language);
         }
     } else {
         //otherwise just copy their names in so they can be counted
         $gal->galleries = $dir->dirs;
     }
     return $gal;
 }
Esempio n. 21
0
 public static function checkNext($view)
 {
     $name = array();
     preg_match('/@extends.+?\\)/', $view, $name);
     if (!$name) {
         return false;
     }
     $name = trim(str_replace(array('@extends', '(', ')', '"', '\''), '', $name[0]));
     $path = Ant::settings('view') . DIRECTORY_SEPARATOR . Helper::realPath($name) . '.' . Ant::settings('extension');
     if (false == file_exists($path)) {
         throw new Exception(sprintf('Template file not found at %s', $path));
     }
     $io = IO::init()->in($path);
     $nextview = $io->get();
     $io->out();
     return array('path' => $path, 'view' => $nextview);
 }
Esempio n. 22
0
 /**
  * Get parent template
  *
  * @param string $view template string
  *
  * @return array
  */
 public function checkNext($view)
 {
     $name = array();
     preg_match('/@extends.+?\\)/', $view, $name);
     if (!$name) {
         return false;
     }
     $name = Helper::clean(array('@extends', '(', ')', '"', "'"), $name[0]);
     $path = $this->ant->settings('view') . '/' . Helper::realPath($name) . '.' . $this->ant->settings('extension');
     if (false == file_exists($path)) {
         throw new Exception(sprintf('Template file not found at %s', $path));
     }
     $io = IO::init()->in($path);
     $nextview = $io->get();
     $io->out();
     return array('path' => $path, 'view' => $nextview);
 }
Esempio n. 23
0
 public function deleteById($c)
 {
     if (!DB::query('SELECT * from ' . self::TABLE . ' WHERE id="' . $c . '"')) {
         io::out("Work with id={$c} is not exists", IO::MESSAGE_FAIL);
         return;
     }
     $list = DB::query('SELECT * FROM ' . self::TABLE . ' where isnull(finished_at) and not isnull(locked_at) 
         and isnull(failed_at) and id=' . $c . ' ORDER BY run_at DESC');
     if (count($list)) {
         IO::out("This is working now...You cant delete!");
         return;
     }
     if (IO::YES == io::dialog('Do you really want to delete work with id ' . $c . '? ', IO::NO | IO::YES, IO::NO)) {
         DB::query("DELETE FROM " . self::TABLE . " WHERE  id='" . $c . "'");
         io::done('Deleting...');
     } else {
         io::done('Cancel delete');
     }
 }
Esempio n. 24
0
 function process()
 {
     if (!($c = ArgsHolder::get()->shiftCommand())) {
         return io::out('Incorrect parameter', IO::MESSAGE_FAIL) | 1;
     }
     $root = Config::get('ROOT_DIR');
     $file = $root . '/includes/env/' . strtolower($c) . '_env.php';
     if (!file_exists($file)) {
         return io::out('Mode ' . $c . ' not exists', IO::MESSAGE_FAIL) | 1;
     }
     IO::out('Updating Loader', false);
     $loader = fopen($root . '/includes/env/Loader.php', 'w');
     flock($loader, LOCK_EX);
     $put = '<?php require_once("' . $c . '_env.php");';
     fwrite($loader, $put);
     flock($loader, LOCK_UN);
     fclose($loader);
     io::done();
     io::out('Backup config.ini', false);
     if (copy($root . '/config/config.ini', $root . '/config/config.ini.bak')) {
         io::done();
     } else {
         return IO::out('Can\'t backup file config.ini', IO::MESSAGE_FAIL) | 1;
     }
     IO::out('Updating config.ini', false);
     $file_array = file($root . '/config/config.ini');
     $str = null;
     foreach ($file_array as $fa) {
         if (preg_match('/\\[\\s*config\\s*:\\s*\\S+\\]/', $fa, $match)) {
             $str .= '[config : ' . $c . ']' . PHP_EOL;
         } else {
             $str .= $fa;
         }
     }
     $config = fopen($root . '/config/config.ini', 'w');
     flock($config, LOCK_EX);
     fwrite($config, $str);
     flock($config, LOCK_UN);
     fclose($config);
     io::done();
     IO::done('Enviroments set to ~WHITE~' . $c . '~~~');
 }
Esempio n. 25
0
 public function cmdUserlist()
 {
     if (!count(ACL::getGroups())) {
         return io::out('There is no groups yet.');
     }
     $users = ACL::getUsers();
     if ($group = ArgsHolder::get()->shiftCommand()) {
         if (!in_array($group, array_values(ACL::getGroups()))) {
             return io::out("No such group {$group}", IO::MESSAGE_FAIL) | 3;
         }
         IO::out("~WHITE~User(s) from group " . $group . "~~~:");
         foreach ($users[$group] as $u) {
             IO::out(" " . $u);
         }
     } else {
         foreach (array_keys($users) as $g) {
             IO::out("~WHITE~Group " . $g . "~~~:");
             foreach ($users[$g] as $u) {
                 IO::out(" " . $u);
             }
         }
     }
 }
Esempio n. 26
0
 /**
  * Prompts to download a version
  *
  * @author Art <*****@*****.**>
  * @return AbstractBinSetup
  */
 protected function promptDownload()
 {
     if (!empty($this->links)) {
         $version_numbers = array_keys($this->links);
         _echo('The following versions were found for download: ' . PHP_EOL . "\t" . implode(PHP_EOL . "\t", $version_numbers));
         $io = trim(\IO::readline('Which version would you like to download? Input N to abort'));
         if (!$io) {
             $this->promptDownload();
         } elseif ($io == 'n') {
             die('Aborting.');
         } elseif (!isset($this->links[$io])) {
             _echo('The version you selected is not available for download.');
             $this->promptDownload();
         } else {
             _echo('Contacting download server...');
             $this->version = $io;
             $this->download();
             return $this;
         }
     } else {
         die('Aborting.');
     }
     return $this;
 }
Esempio n. 27
0
 //登録後のページ遷移指定
 define("HTML_SUCCESS", "./user_edit_suc.html");
 define("HTML_FAILURE", "./user_edit_fal.html");
 // url系情報の指定
 // CHECK_REFERER  非ブランクなら、フォーム内でリファラチェックを行う。初期アクセスではこの値を含むか、以降はフォーム内の遷移かをチェックする。
 // SALESFORCE     非ブランクなら、確認画面からのリンク先をこの値に変更する。ブランクなら、内部の登録処理へ進む。
 define("MY_NAME", basename($_SERVER["SCRIPT_NAME"]));
 define("MY_PATH", dirname($_SERVER["SCRIPT_NAME"]) . "/");
 define("URL_ACTION", "http://" . $_SERVER["SERVER_NAME"] . MY_PATH . MY_NAME);
 define("URL_SUCCESS", "http://" . $_SERVER["SERVER_NAME"] . MY_PATH . HTML_SUCCESS);
 define("URL_FAILURE", "http://" . $_SERVER["SERVER_NAME"] . MY_PATH . HTML_FAILURE);
 define("CHECK_REFERER", "");
 //
 define("PASS", "1:初期化");
 // 入出力インスタンスの生成
 $io = new IO(HTML_CODE, HTML_CODE, INNER_CODE, "step_from,x,y", KEY);
 $io->set_parameters($_POST);
 $pass = new Check("pass", PASS, $io);
 if ($io->is_not_falsification()) {
     // 登録処理 ================================================================
     if (CHECK_REFERER == "" or $_SERVER["HTTP_REFERER"] == URL_ACTION) {
         $decision = true;
         // csvファイルの作成 -----------------------------------------------------
         // 通し番号とユニークなファイル名を取得
         /*	$fp = fopen(CSV_PATH.CSV_COUNT, "r+");
                             if($fp)
                             {
                                     if(flock($fp, LOCK_EX))
                                     {
                                             $count = fgets($fp, 5);
                                             if($count == "9999")
Esempio n. 28
0
 public function getFolderInfo($path, $position = '', $zip)
 {
     static $data = array();
     try {
         $arr = IO::parsePath($path);
         $pcs = self::init($path, 1);
         if (is_array($pcs) && $pcs['error']) {
             return $pcs;
         }
         $meta = self::getMeta($path);
         switch ($meta['type']) {
             case 'folder':
                 $position .= $meta['name'] . '/';
                 $contents = self::listFiles($path);
                 foreach ($contents as $key => $value) {
                     self::getFolderInfo($value['path'], $position, $zip);
                 }
                 break;
             default:
                 $meta['url'] = self::getStream($meta['path']);
                 $meta['position'] = $position . $meta['name'];
                 //$data[$meta['icoid']]=$meta;
                 $zip->addLargeFile(fopen($meta['url'], 'rb'), $meta['position'], $meta['dateline']);
         }
     } catch (Exception $e) {
         //var_dump($e);
         $data['error'] = $e->getMessage();
         return $data;
     }
     //return $data;
 }
Esempio n. 29
0
 define("TEMP_BLOCK", "/login/login.html");
 //登録後のページ遷移指定
 define("HTML_SUCCESS", "./request_suc.html");
 define("HTML_FAILURE", "./request_fal.html");
 // url系情報の指定
 // CHECK_REFERER  非ブランクなら、フォーム内でリファラチェックを行う。初期アクセスではこの値を含むか、以降はフォーム内の遷移かをチェックする。
 // SALESFORCE     非ブランクなら、確認画面からのリンク先をこの値に変更する。ブランクなら、内部の登録処理へ進む。
 define("MY_NAME", basename($_SERVER["SCRIPT_NAME"]));
 define("MY_PATH", dirname($_SERVER["SCRIPT_NAME"]) . "/");
 define("URL_ACTION", "http://" . $_SERVER["SERVER_NAME"] . MY_PATH . MY_NAME);
 define("URL_SUCCESS", "http://" . $_SERVER["SERVER_NAME"] . MY_PATH . HTML_SUCCESS);
 define("URL_FAILURE", "http://" . $_SERVER["SERVER_NAME"] . MY_PATH . HTML_FAILURE);
 define("CHECK_REFERER", "");
 //
 // 入出力インスタンスの生成
 $io = new IO(HTML_CODE, HTML_CODE, INNER_CODE, "step_from,x,y", KEY);
 $io->set_parameters($_POST);
 if ($io->is_not_falsification()) {
     // 登録処理 ================================================================
     if (CHECK_REFERER == "" or $_SERVER["HTTP_REFERER"] == URL_ACTION) {
         $decision = true;
         // csvファイルの作成 -----------------------------------------------------
         // 通し番号とユニークなファイル名を取得
         /*	$fp = fopen(CSV_PATH.CSV_COUNT, "r+");
                             if($fp)
                             {
                                     if(flock($fp, LOCK_EX))
                                     {
                                             $count = fgets($fp, 5);
                                             if($count == "9999")
                                             {
Esempio n. 30
0
<?php

/*
 * @copyright   Leyun internet Technology(Shanghai)Co.,Ltd
 * @license     http://www.dzzoffice.com/licenses/license.txt
 * @package     DzzOffice
 * @link        http://www.dzzoffice.com
 * @author      zyx(zyx@dzz.cc)
 */
if (!defined('IN_DZZ')) {
    exit('Access Denied');
}
define('NOROBOT', TRUE);
$path = empty($_GET['icoid']) ? trim($_GET['path']) : $_GET['icoid'];
if ($path = dzzdecode($path)) {
    IO::download($path, $_GET['filename']);
}
exit;