Exemplo n.º 1
0
 function __construct($cacheLimitTime)
 {
     $this->cacheRoot = Watt_Config::getRootPath() . 'cache/cachefiles/';
     if (intval($cacheLimitTime)) {
         $this->cacheLimitTime = $cacheLimitTime;
     }
     $this->cacheFileName = $this->getCacheFileName();
     ob_start();
 }
Exemplo n.º 2
0
 /**
  * 集成工具
  * 将个人目录中的
  * app/
  * lib/
  * view/
  *
  * 目录中的文件复制到集成目录
  *
  * @author terry
  * @version v1.0
  */
 function indexAction()
 {
     return false;
     /**
      * 禁止提交;
      */
     //error_reporting(E_ALL);
     //include '/home/terry/integration.php';
     //$fromModelDir = dirname( __FILE__ );
     $fromModelDir = Watt_Config::getRootPath();
     $toModelDir = Watt_Config::getRootPath(1);
     //$toModelDir   = "/site/includes/tpm/";
     if ($toModelDir == "") {
         echo "Target dir is blank!";
         exit;
     }
     echo "<pre>";
     echo "1) copying app files...\n\n";
     $fromFolder = $fromModelDir . 'app/';
     $toFolder = $toModelDir . 'app/';
     folderFilesCopy($fromFolder, $toFolder, true);
     echo "2) copying lib files...\n\n";
     $fromFolder = $fromModelDir . 'lib/';
     $toFolder = $toModelDir . 'lib/';
     folderFilesCopy($fromFolder, $toFolder, true);
     echo "3) copying view files...\n\n";
     $fromFolder = $fromModelDir . 'view/';
     $toFolder = $toModelDir . 'view/';
     folderFilesCopy($fromFolder, $toFolder, true);
     echo "4) copying language files...\n\n";
     $fromFolder = $fromModelDir . 'language/';
     $toFolder = $toModelDir . 'language/';
     folderFilesCopy($fromFolder, $toFolder, true);
     echo "5) copying js files...\n\n";
     $fromFolder = $fromModelDir . 'htdocs/js/';
     $toFolder = $toModelDir . 'htdocs/js/';
     folderFilesCopy($fromFolder, $toFolder, true);
     echo "6) copying css files...\n\n";
     $fromFolder = $fromModelDir . 'htdocs/css/';
     $toFolder = $toModelDir . 'htdocs/css/';
     folderFilesCopy($fromFolder, $toFolder, true);
     echo "</pre>";
 }
Exemplo n.º 3
0
 /**
  * 翻译一个字串到指定的语言
  * 大小写敏感
  * @param string $strKey
  * @return string
  */
 public static function trans($strKey)
 {
     $theLoader = self::_getLoader();
     $rev = $theLoader->trans($strKey);
     if ($rev === false) {
         if (self::LOG_UNREG_LANG_KEY) {
             if (class_exists('Watt_Log')) {
                 $logger = new Watt_Log_File('LOG_UNREG_LANG');
                 $logger->log($strKey . "\t\t\t|\t" . self::$lang . "\t");
                 $fp = fopen(Watt_Config::getRootPath() . '/log/LOG_UNREG_LANG_' . self::$lang . "-" . date("Ymd") . '.txt', 'a+');
                 fwrite($fp, "\$s['{$strKey}']\t=\t'{$strKey}';\n");
                 fclose($fp);
             }
         }
         return $strKey;
     } else {
         return $rev;
     }
 }
Exemplo n.º 4
0
 public static function getAdodb($con_name = "propel")
 {
     /**
      * 数据库连结类:ADODB
      */
     $configuration = (include Watt_Config::getConfigPath() . "propel.conf.php");
     if (!isset($configuration['datasources'][$con_name])) {
         $con_name = $configuration['datasources']["default"];
     }
     $cfg = $configuration['datasources'][$con_name]['connection'];
     include_once Watt_Config::getLibPath(1) . "adodb/adodb.inc.php";
     $db_a = ADONewConnection("mysql");
     $ADODB_CACHE_DIR = Watt_Config::getRootPath() . "cache/adodb";
     $db_a->Connect($cfg["hostspec"] . ($cfg["port"] ? ":" . $cfg["port"] : ""), $cfg["username"], $cfg["password"], $cfg["database"]);
     $db_a->Execute("set names 'utf8'");
     //数据库字符编码设置
     $db_a->SetFetchMode(ADODB_FETCH_ASSOC);
     // 设置缓存有效时间为5分钟
     $db_a->cacheSecs = 300;
     return $db_a;
 }
Exemplo n.º 5
0
 /**
  *  检查ftp方式上传下载是否正常函数
  * 下载使用的是http方式
  * @return unknown
  * jute
  * 20080115
  */
 function checkftpfile()
 {
     $testuploadfiledir = Watt_Config::getRootPath() . 'htdocs/upload/';
     $testuploadfilepath = $testuploadfiledir . 'testupload.txt';
     if (!file_exists($testuploadfilepath)) {
         //上传测试文件不存在则创建
         $fp = fopen($testuploadfilepath, 'wb');
         fwrite($fp, 'aa');
         fclose($fp);
     }
     $file = Watt_Util_File::ftpuploadfile($testuploadfilepath);
     if ($file) {
         //上传文件成功
         //下载文件
         $rev = Watt_Util_File::httpdownloadfile($file);
         if (!strcmp($rev, file_get_contents($testuploadfilepath))) {
             //返回结果相同
             return true;
         } else {
             //
             return false;
         }
     }
     return false;
 }