Esempio n. 1
0
 /**
  * 发送短消息
  *
  * 前端增加站点代号 = EpollGroupId
  * 前端增加系统代号 = 1 (TPM = 1)
  * 
  * 要求: $from_mobile 是已经由各业务单元增加了业务代码的号码
  * 
  * @param string $to
  * @param string[UTF-8] $msg
  * @param string $from_mobile
  * @param int $msgid
  * @return string[UTF-8]
  */
 public static function sendSms($to, $msg, $from_mobile, $msgid = 0, $tag = '')
 {
     /*
     $to = '13683078625';
     $source	= '00';
     $msg = 'test';
     $string = "&to={$to}&source={$source}&msg={$msg}";
     */
     self::_init();
     $msgid = mt_rand(1, 999);
     $toMsg = iconv('UTF-8', 'GB2312', $msg);
     /**
      * 发送出的短信,将本地号码加.
      * 前端增加站点代号 = EpollGroupId
      * 前端增加系统代号 = 1 (TPM = 1)
      */
     $source = self::addSystemCode($from_mobile);
     //($from_mobile?$from_mobile:'00');
     //$other		=	'&mobile=wattcan&pwd=h2175&action=sendmsg';
     $other = '';
     //action 与 Pft 框架冲突
     $string = "tmobile={$to}&msgid={$msgid}&msg={$toMsg}{$other}&source={$source}&tag={$tag}";
     //发送到短信提供商
     $sms_url = Pft_Config::getCfg('SMS_CENTER');
     $data = Pft_Http_Client::curlPost($sms_url, $string);
     Pft_Log::addLog("Send Sms [{$msg}] From [{$from_mobile}] To [{$to}] Ok ( Source Code[{$source}] URL[ " . $sms_url . $string . " ] REV[{$data}] ).", Pft_Log::LEVEL_INFO, 'MSG_SMS');
     return iconv('GB2312', 'UTF-8', $data);
 }
Esempio n. 2
0
 /**
  * 获得一个 PHPMailer 对象,已经作了基本配置,
  * SMTP
  *
  * @return PHPMailer
  */
 public static function getPhpMailerWithDefaultConfig()
 {
     include_once Pft_Config::getLibPath() . 'Third/phpmailer/class.phpmailer.php';
     $mail = new PHPMailer();
     $mail->IsSMTP();
     // 设置使用 SMTP	 与发件人相同
     $mail->Host = Pft_Config::getCfg("MAIL_SMTP_HOST");
     // 指定的 SMTP 服务器地址
     $mail->Username = Pft_Config::getCfg("MAIL_SMTP_USERNAME");
     // SMTP 发邮件人的用户名
     $mail->Password = Pft_Config::getCfg("MAIL_SMTP_PASSWORD");
     // SMTP 密码
     $mail->SMTPAuth = Pft_Config::getCfg("MAIL_SMTP_AUTH");
     // 设置为安全验证方式
     $mail->From = Pft_Config::getCfg("MAIL_SMTP_ADDR");
     // 发件人地址  //"*****@*****.**"	;
     return $mail;
 }
Esempio n. 3
0
 function uploadfileAction()
 {
     $result = array();
     if (isset($_FILES['Filedata'])) {
         $file = $_FILES['Filedata']['tmp_name'];
         $temp_file = iconv('utf-8', 'gbk', $_FILES['Filedata']['name']);
         $toFileFloder = Pft_Config::getCfg('PATH_ROOT') . "images/caixi/";
         if (!is_dir($toFileFloder)) {
             @mkdir($toFileFloder);
             @chmod($toFileFloder, 0777);
         }
         $toFile = $toFileFloder . $temp_file;
         if (move_uploaded_file($file, $toFile)) {
             //$_SESSION["uploadFile"]="./images/caixi/".$temp_file;
         } else {
             //$_SESSION["uploadFile"]='error';
         }
     }
     exit;
 }
Esempio n. 4
0
        <div id="productRight">
          <div>
          <table width="100%" cellpadding="0" cellspacing="0" border="0" id="buyTable">
          
          <tr>
           <td width="30%"><b>菜品</td>
           <td width="15%"><b>单价</td>
           <td width="20%"><b>数量</td>
           <td width="20%"><b>小计</td>
           <td width="15%"><b>操作</td>
          </tr>
          <tr>
           
          </tr>
          </table>
          </div>
          <div id="pZongji">
          合计:<span id="zTotal"></span>
          <input type="hidden" id="Total" name="Total">
          </div>
       </div>
     </div>
    </td>
  </tr>
</table>
</div>
</center>
</body>
<?php 
include Pft_Config::getCfg('PATH_ROOT') . 'inc/view/footer.inc.php';
Esempio n. 5
0
		<a href="?do=kw_content_mark&ct_id=<?php 
        echo $content['ct_id'];
        ?>
&mk=3">精品</a>
		<a href="?do=kw_content_mark&ct_id=<?php 
        echo $content['ct_id'];
        ?>
&mk=1">有用</a>
		<a href="?do=kw_content_mark&ct_id=<?php 
        echo $content['ct_id'];
        ?>
&mk=-1">没用</a>
		<a href="?do=kw_content_mark&ct_id=<?php 
        echo $content['ct_id'];
        ?>
&mk=-3">垃圾</a>
	</div>
	</div>
		<?php 
    }
} else {
    ?>
	<div class="content">暂时没有内容。</div>
	<?php 
}
?>
</div>
<?php 
include dirname(__FILE__) . '/../content/addForm.inc.php';
include Pft_Config::getCfg('PATH_INC') . 'view/footer.inc.php';
Esempio n. 6
0
 /**
  * 
  * @param $tbname
  * @return string
  * @author yan
  * @date 2010-10-3下午06:25:08
  */
 public static function getTbName($tbname)
 {
     return Pft_Config::getCfg('DB_TB_PREFIX') . $tbname;
 }
Esempio n. 7
0
 /**
  * 循环进行 do 的处理
  * 
  */
 function dispatch()
 {
     /**
      * 因为Tq是用Post传递参数过来的,所以不能用$_GET
      */
     $do = empty($_REQUEST["do"]) ? "index" : trim($_REQUEST["do"]);
     /**
      * 这是为了兼容 do=xxx&action=yyy 的形式
      */
     $a = empty($_REQUEST["action"]) ? "" : trim($_REQUEST["action"]);
     if ($a) {
         $do .= "_" . $a;
     }
     /**
      * 获取view的type
      */
     $v = empty($_REQUEST["v"]) ? "Html" : trim($_REQUEST["v"]);
     //TQ任务LINK
     //http://testtpm.transn.net/index.php?do=if_renwu_detail&sj_id=35c55571-80bb-c18b-6078-465a87c329bd&Username=dGVzdC1wcjE=&Password=MjAyY2I5NjJhYzU5MDc1Yjk2NGIwNzE1MmQyMzRiNzA=&pwdway=md5
     /**
      * 获取用户名和密码进行快速登录
      */
     if (r('pwdway')) {
         if (!Pft_Session::getSession()->getUserId()) {
             //这个判断是为了不让TQ登录后,访问此链接时,冲掉session中[是否TQ]那个设置
             $accounts = iconv('GB2312', 'UTF-8', base64_decode(str_replace(' ', '+', r("Username"))));
             $pwd = iconv('GB2312', 'UTF-8', base64_decode(str_replace(' ', '+', r("Password"))));
         }
     } else {
         if (r('login') == 'ok') {
             /**
              * 这是为了兼容TQ的那个点击“查收我的订单”,导致Web重登录的问题。
              * @author terry
              * @version 0.1.0
              * Thu Sep 06 16:44:53 CST 2007
              */
             $accounts = '';
             $pwd = '';
         } else {
             $accounts = r("user_name");
             $pwd = r("user_pw");
         }
     }
     if ($accounts && $pwd) {
         $login_rev = 0;
         $user = TpmYonghuPeer::checkUserLogin($accounts, $pwd, $login_rev);
         if ($login_rev == TpmYonghuPeer::USER_LOGIN_OK) {
             // 用户登陆成功后如果密码安全强度不够,跳转到修改密码页提示用户设置安全的密码
             $pswdChecker = new Tpm_Passwordchecker($pwd);
             $cfgLevel = Pft_Config::getCfg('PSWD_CHECK_LEVEL');
             if ($cfgLevel == '') {
                 $cfgLevel = '0';
             }
             if ($pswdChecker->getSecurityLevel() < $cfgLevel) {
                 $_SESSION['LOW_PASSWORD'] = true;
                 //					header('Location:?do=ps_yonghu_changepwd&nosecurity=true');
                 //					exit;
             }
             Pft_Log::addLog('Login ok, accounts[' . $accounts . ']', Pft_Log::LEVEL_INFO, 'LOGIN_WEB_DIRECT_LOGIN');
         }
     }
     //如密码强度不够, 强制修改密码
     $superDoList = array('ps_yonghu_changepwd', 'login_logout', '');
     // 数组中的Action不在强制之列
     if (@$_SESSION['LOW_PASSWORD'] && !in_array($do, $superDoList)) {
         header('Location:?do=ps_yonghu_changepwd&nosecurity=true');
         exit;
     }
     $i = $this->_maxToDo;
     while ($do != "" && $i-- > 0) {
         $do = $this->processDo($do, $v);
     }
     //如果是渠道代理商客户,传神客户,客户则记录日志 2007-7-9 john
     if (Pft_Session::getSession()->getRoleShortname() == "QDKH" || Pft_Session::getSession()->getRoleShortname() == "CSKH" || Pft_Session::getSession()->getRoleShortname() == "CR") {
         $accessLoger = new Pft_Log_Db('tpm_rizhi_fangwen');
         $accessLoger->log("", 0, $_REQUEST["do"]);
     }
 }
Esempio n. 8
0
 /**
  * 功能:
  * 提供创建 controller and view 的功能
  * 
  * 输入:
  * 
  * 输出:
  * 
  * $functions
  * $inputForm
  * 
  * @author 
  */
 function buildCandVAction()
 {
     $this->indexAction();
     if ($this->in("op")) {
         //获得输入数据
         $appPath = $this->in("AppPath");
         $om_class_name = $this->in("om_class_name");
         $pkg_ctrl_name = $this->in("pkg_ctrl_name");
         $do = $pkg_ctrl_name;
         try {
             class_exists($om_class_name);
         } catch (Exception $e) {
             echo "Om Class : " . $om_class_name . " is not exist.";
             exit;
         }
         $peerObj = Pft_Om_BaseObject::getPeer($om_class_name);
         $desc = $peerObj->getDescription();
         //$viewPath = $this->in( "ViewPath" );
         //$package_name = trim( $this->in( "package_name" ), "_" );
         //$table_name = $this->in( "table_name" );
         //$CtrlName = $this->in( "CtrlName" );
         $PkName = $desc["pk_name"];
         $pk_name = $desc["pk_name"];
         $pre_fix = Pft_Config::getCfg("DB_TB_PREFIX");
         $table_name = $desc["table_name"];
         $disp = new Pft_Dispatcher();
         $ctrlArr = $disp->analyzeDoToControllerAndAction($do);
         $arrPackageName = explode(DIRECTORY_SEPARATOR, $ctrlArr[0]);
         //对变量进行格式化
         //$arrPackageName = split( "_", $package_name );
         $tmpArr = $arrPackageName;
         unset($tmpArr[1]);
         //去掉ctrl
         $PackageName = implode(array_map("ucfirst", $tmpArr));
         $package_name = implode($tmpArr, "_") . "_";
         $this->_tablePreFix = $pre_fix;
         if (trim($pre_fix) != "") {
             $this->_tableOmPreFix = implode(array_map("ucfirst", split("_", $pre_fix)));
         }
         $arrTableName = split("_", $table_name);
         $TableName = implode(array_map("ucfirst", $arrTableName));
         $var_name = $table_name;
         $VAR_NAME = strtoupper($var_name);
         if (!isset($CtrlName) || trim($CtrlName) == "") {
             $CtrlName = ucfirst($ctrlArr[1]);
         } else {
             $CtrlName = ucfirst($CtrlName);
         }
         $ctrl_name = strtolower($CtrlName);
         if (trim($PkName) == "") {
             $PkName = $TableName . "Id";
         }
         if (trim($pk_name) == "") {
             $pk_name = $table_name . "_id";
         }
         /* 格式化好的变量应该有如下这么多个
         			$table_name		*
         			$TableName
         			$var_name
         			$VAR_NAME
         			$package_name	*
         			$PackageName
         			$CtrlName		可选
         			$ctrl_name
         			$PkName			可选
         			*/
         //检查路径是否存在,如不存在,则进行创建
         $toAppPath = $this->_checkAndMakeAppFolder($arrPackageName);
         $toViewPath = $this->_checkAndMakeViewFolder($arrPackageName, $ctrl_name);
         $editForm = "";
         // editForm 是 输出变量
         $detailTable = "";
         // detailTable 是 输出变量
         $gridCols = "";
         // gridCols 是 输出变量
         $fieldList = "";
         // fieldList 是 输出变量
         if (strlen($table_name) > 0) {
             $fieldNames = $desc["fields"];
             $fieldList = implode(",", $fieldNames);
             //echo "<pre>";
             foreach ($fieldNames as $key => $val) {
                 // 为form输出准备变量
                 //不显示创建时间和更新时间 忽略列表已经存在于 formBuild 中了
                 //if( $key == "create_at" || $key == "updated_at" ) continue;
                 $formDataArr[$val] = $val;
                 // 给 gridCols 增加列
                 //$gridCols .= "\${$var_name}sGrid->addCol(Pft_I18n::trans(\"$val\"),\"$val\");\n";
                 $gridCols .= "\${$var_name}s_grid->addCol(Pft_I18n::trans(\"{$val}\"),\"{$val}\");\n";
             }
             /* 这是使用phpname时的方法
             			$omObj = new $omClassName();
             			$nameMap = $omObj->getPhpNameMap();
             			$fieldList = implode( ",", array_flip( $nameMap ) );
             			//echo "<pre>";
             			foreach ( $nameMap as $key => $val )
             			{
             				// 为form输出准备变量
             				$formDataArr[$key] = $key;
             				// 给 gridCols 增加列
             				$gridCols .= "\${$var_name}sGrid->addCol(Pft_I18n::trans(\"$key\"),\"$key\");\n";
             				
             			}
             			*/
             $editForm = Pft_View_Helper_Form::buildFormForWukong($formDataArr, "", "post", true, false, array(), array($pk_name => $pk_name));
             $detailTable = Pft_View_Helper_Form::buildFormForWukong($formDataArr, "", "post", false, false, array(), array($pk_name => $pk_name));
             //echo $form;
             //echo "</pre>";
         }
         /**
          * 这两行不要放到前面去
          */
         $table_name = $pre_fix . $table_name;
         $TableName = $this->_tableOmPreFix . $TableName;
         //这里仅仅是为了输出
         $this->output = $arrNames = compact("table_name", "var_name", "VAR_NAME", "package_name", "PackageName", "CtrlName", "ctrl_name", "PkName", "editForm", "detailTable", "gridCols", "fieldList", "pk_name", "om_class_name");
         //用变量替换模板中的相关变量
         $info = $this->_buildPhpFile("controller.tpl.php", $toAppPath . strtolower($ctrl_name) . ".php", $arrNames);
         if (strlen($table_name) > 0) {
             //只有对数据表的操作才有 增删改查
             $info .= "\n" . $this->_buildPhpFile("add.html.tpl.php", $toViewPath . "add.html.php", $arrNames);
             $info .= "\n" . $this->_buildPhpFile("detail.html.tpl.php", $toViewPath . "detail.html.php", $arrNames);
             $info .= "\n" . $this->_buildPhpFile("edit.html.tpl.php", $toViewPath . "edit.html.php", $arrNames);
             $info .= "\n" . $this->_buildPhpFile("list.html.tpl.php", $toViewPath . "list.html.php", $arrNames);
             $info .= "\n" . $this->_buildPhpFile("_editform.html.tpl.php", $toViewPath . "_editform.html.php", $arrNames);
             $info .= "\n" . $this->_buildPhpFile("_detailtable.html.tpl.php", $toViewPath . "_detailtable.html.php", $arrNames);
         }
         $info .= "\n<a href=\"?do={$pkg_ctrl_name}_index\">?do={$pkg_ctrl_name}_index</a>";
         //输出本页再次显示的数据
         $inputForm = array("AppPath" => $appPath, "pkg_ctrl_name" => $pkg_ctrl_name, "om_class_name" => $om_class_name);
         //$inputForm["other"] = $tpl;
         //$this->redirectToSelfAction( "index" );
     } else {
         $info = "";
         $inputForm = array("AppPath" => Pft_Config::getAppPath(1), "pkg_ctrl_name" => "", "om_class_name" => "");
     }
     $this->info = $info;
     $this->inputForm = $inputForm;
     $this->inputFormDescc = array("AppPath" => "系统app路径,一般不用修改", "ViewPath" => "系统view路径,一般不用修改", "package_name" => "包名,使用小写字母+下划线的形式,如 ec , ec_sale", "pre_fix" => "表前缀名,如果前缀有下划线,最后请保留下划线,如pft_;如果没有前缀,则留空", "table_name" => "表名,不带表前缀,如 yonghu, yonhu_wanquan", "CtrlName" => "controller名称,如果有表名,此项无须填写。请使用首字母大写的形式,如 YonghuWanquan。", "pk_name" => "表的主关键字名称,如果主关键字是 表名_id 的形式则无须填写。如表名是 yonghu, 如pk是 yonghu_id,则无须填写,如pk是 yh_id,则需要填写。 ", "om_class_name" => "om对象的名称,如Yd_Order。 ", "pkg_ctrl_name" => "包含package名称的controller的名称,即do的去掉action后的内容,如ec_order。 ");
 }
Esempio n. 9
0
define('MULTI_SITE_SESSION_NAME', 'TPM_MULTI_SITE');
//Pft_Config 中用到 $_SESSION[MULTI_SITE_SESSION_NAME]
if (isset($_SESSION[MULTI_SITE_SESSION_NAME])) {
    $site = $_SESSION[MULTI_SITE_SESSION_NAME];
} else {
    $site = @$_REQUEST['site'];
    if (!$site) {
        $site = $_SERVER['HTTP_HOST'];
    }
    if (!is_dir($config_path . $site)) {
        $site = 'default';
    }
    $_SESSION[MULTI_SITE_SESSION_NAME] = $site;
}
require_once $config_path . "/loader.php";
Pft_Config::setCfg('PATH_APP', Pft_Config::getCfg('PATH_APP'), 1);
Pft_Config::setCfg('PATH_APP', dirname(__FILE__) . '/app/');
//========================================
/**
 * 环境准备完毕 程序开始
 */
Pft_Debug::addInfoToDefault('Pre dispatch.');
try {
    /**
     * 分发
     */
    $dispatch = new Pft_Dispatcher();
    $dispatch->dispatch();
} catch (Exception $e) {
    $code = $e->getCode();
    $errorInfo = $e->getMessage() . " at (" . $e->getFile() . " | Line:" . $e->getLine() . ") Code [" . $code . "]";