예제 #1
0
파일: RawData.php 프로젝트: na2axl/FlatOS
 public function render()
 {
     $mime = $this->_getMimetype();
     $contents = $this->FS->read($this->path);
     $this->httpResponse->setCacheable();
     $this->httpResponse->addHeader("content-type: {$mime};charset=utf-8");
     $this->httpResponse->setContent($contents);
     $this->httpResponse->send();
 }
예제 #2
0
 function sql($name, $type = 'install')
 {
     $_file = self::path($name, $type . '.sql');
     if ($_file) {
         return FS::read($_file);
     }
 }
예제 #3
0
 function doedit()
 {
     $path = trim($_GET["path"]);
     $FileData = FS::read(iPATH . "templates" . $path);
     $strpos = strpos(__REF__, '?');
     $REFERER = $strpos === false ? '' : substr(__REF__, $strpos);
     include admincp::tpl();
 }
예제 #4
0
 function getVersion($force = false)
 {
     FS::mkdir(PATCH_DIR);
     $tFilePath = PATCH_DIR . 'version.txt';
     //临时文件夹
     if (FS::exists($tFilePath) && time() - FS::mtime($tFilePath) < 3600 && !$force) {
         $FileData = FS::read($tFilePath);
     } else {
         $FileData = FS::remote(PATCH_URL . '/version.txt');
         FS::write($tFilePath, $FileData);
     }
     return explode("\n", $FileData);
     //版本列表
 }
예제 #5
0
파일: api.php 프로젝트: osuisumi/OS.js
 /**
  * File Download Request
  */
 public static function FileGET(APIRequest $req)
 {
     $result = false;
     $error = false;
     $headers = array();
     $code = 0;
     $settings = Settings::get();
     $url = preg_replace('/\\/(([^\\/]+\\/)+)?(FS)/', "", urldecode($req->data));
     call_user_func_array(array(API::$Handler, 'checkPrivilege'), array(APIUser::GROUP_VFS));
     try {
         if ($url) {
             if (preg_match('/^(ftp|https?)\\:\\/\\//', $url)) {
                 if (empty($settings['vfs']['proxy']) || $settings['vfs']['proxy'] == false) {
                     $error = "VFS Proxy is disabled";
                     $code = 500;
                 } else {
                     $result = file_get_contents($url);
                 }
             } else {
                 list($dirname, $req->uri, $protocol, $file) = getRealPath($url);
                 if (file_exists($file)) {
                     session_write_close();
                     if (FS::read($url, array("raw" => true))) {
                         exit;
                     } else {
                         $code = 500;
                         $error = "File read error";
                     }
                 } else {
                     $code = 404;
                     $error = "File not found";
                 }
             }
         }
     } catch (Exception $e) {
         $error = $e->getMessage();
     }
     return new APIResponse(false, $result, $error, $code, $headers);
 }
예제 #6
0
 }
 if (!@mysql_select_db($dbname) && $_POST['create']) {
     //mysql_query("DROP DATABASE `$database`;");
     $database = addslashes($dbname);
     if (version_compare(mysql_get_server_info(), '4.1.0', '>=')) {
         //	$DATABASESQL=$dbcharset=='gbk'?"DEFAULT CHARACTER SET gbk COLLATE gbk_chinese_ci":"DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci";
         $DATABASESQL = "DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci";
     }
     mysql_query("CREATE DATABASE `{$database}` " . $DATABASESQL);
 }
 require_once $configfile;
 $installSQL = 'iCMS_SQL.sql';
 !is_readable($installSQL) && exit('数据库文件不存在或者读取失败');
 require_once iPATH . 'include/mysql.class.php';
 //iCMS_DB::$show_errors=true;
 runquery(FS::read($installSQL));
 iCMS_DB::query("INSERT INTO `#iCMS@__members` (`groupid`, `username`, `password`, `nickname`, `gender`, `info`, `power`, `cpower`, `regtime`, `lastip`, `lastlogintime`, `logintimes`, `post`, `type`, `status`) VALUES ('1', '{$admin}', '" . md5($password) . "', '管理员', '0', '', '', '', '" . time() . "', '', '0', '0', '0', '1', '1');");
 iCMS_DB::query("UPDATE `#iCMS@__config` SET `value` = '{$setupURL}' WHERE `name` ='setupURL'");
 iCMS_DB::query("UPDATE `#iCMS@__config` SET `value` = '{$publicURL}' WHERE `name` ='publicURL'");
 iCMS_DB::query("UPDATE `#iCMS@__config` SET `value` = '{$htmlURL}' WHERE `name` ='htmlURL'");
 iCMS_DB::query("UPDATE `#iCMS@__config` SET `value` = '{$uploadURL}' WHERE `name` ='uploadURL'");
 iCMS_DB::query("UPDATE `#iCMS@__config` SET `value` = '{$setupURL}' WHERE `name` ='tagURL'");
 iCMS_DB::query("UPDATE `#iCMS@__config` SET `value` = '{$usercpURL}' WHERE `name` ='usercpURL'");
 $tmp = iCMS_DB::getArray("SELECT * FROM `#iCMS@__config`");
 $config_data = "<?php\n\t\$config=array(\n";
 for ($i = 0; $i < count($tmp); $i++) {
     $_config .= "\t\t\"" . $tmp[$i]['name'] . "\"=>\"" . $tmp[$i]['value'] . "\",\n";
 }
 $config_data .= substr($_config, 0, -2);
 $config_data .= "\t\n);?>";
 FS::write(iPATH . 'include/site.config.php', $config_data);
예제 #7
0
 /**
  * File Download Request
  */
 public static function FileGET(APIRequest $req)
 {
     $result = false;
     $error = false;
     $headers = array();
     $code = 0;
     $url = preg_replace('/\\/(([^\\/]+\\/)+)?(FS)/', "", urldecode($req->data));
     call_user_func_array(array(API::$Handler, 'checkPrivilege'), array(APIUser::GROUP_VFS));
     try {
         if ($url) {
             list($dirname, $req->uri, $protocol, $file) = getRealPath($url);
             if (file_exists($file)) {
                 session_write_close();
                 if (FS::read($url, array("raw" => true))) {
                     exit;
                 } else {
                     $code = 500;
                     $error = "File read error";
                 }
             } else {
                 $code = 404;
                 $error = "File not found";
             }
         }
     } catch (Exception $e) {
         $error = $e->getMessage();
     }
     return new APIResponse(false, $result, $error, $code, $headers);
 }
예제 #8
0
파일: api.php 프로젝트: bobkingdom/OS.js-v2
 /**
  * File Download Request
  */
 public static function FileGET(APIRequest $req)
 {
     $result = false;
     $error = false;
     $headers = array();
     $code = 0;
     $root = "/";
     if (($settings = Settings::get()) && !empty($settings['rooturi'])) {
         $root = $settings['rooturi'];
     }
     $root = preg_quote($root, '/');
     $url = preg_replace(sprintf("/^%sFS/", $root), "", urldecode($req->data));
     call_user_func_array(array(API::$Handler, 'checkPrivilege'), array(APIUser::GROUP_VFS));
     try {
         if ($url) {
             list($dirname, $root, $protocol, $file) = getRealPath($url);
             if (file_exists($file)) {
                 session_write_close();
                 if ($data = FS::read($url, array("raw" => true))) {
                     list($mime, $etag, $length, $result) = $data;
                     $headers[] = "Etag: {$etag}";
                     $headers[] = "Content-type: {$mime}; charset=utf-8";
                     $headers[] = "Content-length: {$length}";
                 } else {
                     $code = 500;
                     $error = "File read error";
                 }
             } else {
                 $code = 404;
                 $error = "File not found";
             }
         }
     } catch (Exception $e) {
         $error = $e->getMessage();
     }
     return new APIResponse(false, $result, $error, $code, $headers);
 }
예제 #9
0
 function pinyin($str, $split = "", $pn = true)
 {
     if (!isset($GLOBALS["iCMS.PY"])) {
         $GLOBALS["iCMS.PY"] = unserialize(gzuncompress(FS::read(iPATH . 'include/pinyin.table')));
     }
     preg_match_all(__CN__, trim($str), $match);
     $s = $match[0];
     $c = count($s);
     for ($i = 0; $i < $c; $i++) {
         $uni = strtoupper(dechex(self::UTF8toUni($s[$i])));
         if (strlen($uni) > 2) {
             $pyArr = $GLOBALS["iCMS.PY"][$uni];
             $py = is_array($pyArr) ? $pyArr[0] : $pyArr;
             $pn && ($py = str_replace(array('1', '2', '3', '4', '5'), '', $py));
             $zh && $split && ($R[] = $split);
             $R[] = strtolower($py);
             $zh = true;
             $az09 = false;
         } else {
             if (eregi("[a-z0-9]", $s[$i])) {
                 $zh && $i != 0 && !$az09 && $split && ($R[] = $split);
                 $R[] = $s[$i];
                 $zh = true;
                 $az09 = true;
             } else {
                 $sp = true;
                 if ($split) {
                     if ($s[$i] == ' ') {
                         $R[] = $sp ? '' : $split;
                         $sp = false;
                     } else {
                         $R[] = $sp ? $split : '';
                         $sp = true;
                     }
                 } else {
                     $R[] = '';
                 }
                 $zh = false;
                 $az09 = false;
             }
         }
     }
     return implode('', (array) $R);
 }