示例#1
0
文件: Mail.php 项目: uwitec/outbuying
 /**
  * 邮件模板函数
  *
  * @param unknown_type $model      模板名称
  * @param unknown_type $varname    替换数据
  */
 public static function formatMailBody($model, $searchname, $replcename)
 {
     $_searchname = array();
     $path = Pft_Config::getConfigPath() . "public/emailtemplates/" . $model;
     $str = file_get_contents($path);
     if (count($searchname) > 0) {
         foreach ($searchname as $val) {
             $_searchname[] = "<?\$" . $val . "?>";
         }
     }
     //return $str;
     $search = str_replace($_searchname, $replcename, $str);
     return $search;
 }
示例#2
0
文件: Dbx.php 项目: uwitec/outbuying
 public static function getAdodb($con_name = "propel")
 {
     /**
      * 数据库连结类:ADODB
      */
     $configuration = (include Pft_Config::getConfigPath() . "propel.conf.php");
     if (!isset($configuration['datasources'][$con_name])) {
         $con_name = $configuration['datasources']["default"];
     }
     $cfg = $configuration['datasources'][$con_name]['connection'];
     include_once Pft_Config::getLibPath(1) . "adodb/adodb.inc.php";
     $db_a = ADONewConnection("mysql");
     $ADODB_CACHE_DIR = Pft_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;
 }
示例#3
0
文件: Db.php 项目: uwitec/outbuying
 public function reconnect($con_name, $forceReconnect = false)
 {
     if ($forceReconnect || $con_name != $this->getConnName()) {
         if (is_array($con_name)) {
             $cfg = $con_name;
         } else {
             if (!$this->_connCfg) {
                 $configuration = (include Pft_Config::getConfigPath() . "db.conf.php");
                 $this->_connCfg = $configuration;
             } else {
                 $configuration = $this->_connCfg;
             }
             $cfg = @$configuration['datasources'][$con_name]['connection'];
         }
         if (is_array($cfg)) {
             $this->_conn = mysql_connect($cfg["hostspec"] . ($cfg["port"] ? ":" . $cfg["port"] : ""), $cfg["username"], $cfg["password"]);
             $this->_dsn = $cfg;
             mysql_select_db($cfg["database"], $this->_conn);
             mysql_query("set names 'utf8'");
             $this->setConnName($con_name);
             if (defined("DEBUG") && DEBUG) {
                 Pft_Debug::addInfoToDefault("Pft", "After connect [{$con_name}] use Pft_Db.");
             }
         } else {
             Pft_Debug::addInfoToDefault("Pft", "Connot connect [{$con_name}], use default Db.");
         }
     }
 }