public function __construct() { Vendor('Form.Form2'); $this->form = new Form('__APP__/Friend_links/Friend_links_addok', 'friend_links'); $this->form->_addBaseElement('friend_links'); parent::__construct(); }
public function __construct() { Vendor('Form.Form2'); $this->form = new Form('__APP__/Others/Others_addok', 'others'); $this->form->_addBaseElement('others'); parent::__construct(); }
public function __construct() { Vendor('Form.Form2'); $this->form = new Form('__APP__/Catalog/Catalog_addok', 'catalog'); $this->form->_addBaseElement('catalog'); parent::__construct(); }
function kxw_sendMail($content, $to) { Vendor('PHPMailer.PHPMailerAutoload'); $mail = new PHPMailer(); //实例化 $mail->IsSMTP(); // 启用SMTP $mail->Host = C('MAIL_HOST'); //smtp服务器的名称(这里以126邮箱为例) $mail->SMTPAuth = C('MAIL_SMTPAUTH'); //启用smtp认证 $mail->Username = C('MAIL_USERNAME'); //你的邮箱名 $mail->Password = C('MAIL_PASSWORD'); //邮箱密码 $mail->From = C('MAIL_FROM'); //发件人地址(也就是你的邮箱地址) $mail->FromName = C('MAIL_FROMNAME'); //发件人姓名 $mail->AddAddress('*****@*****.**', "name"); $mail->WordWrap = 50; //设置每行字符长度 $mail->IsHTML(C('MAIL_ISHTML')); // 是否HTML格式邮件 $mail->CharSet = C('MAIL_CHARSET'); //设置邮件编码 $mail->Subject = 'Complaint'; //主题 $mail->Body = $content . '</br>' . "telphone:" . $to; //内容 $mail->AltBody = "This is the body in plain text for non-HTML mail clients"; //正文不支持HTML的备用显示 return $mail->Send(); }
/** * * @param unknown $address * @param unknown $title * @param unknown $message * @return Ambigous <boolean, string> * */ function SendMail($address, $title, $message) { Vendor('PHPMailer.PHPMailerAutoload'); $mail = new PHPMailer(); // 设置PHPMailer使用SMTP服务器发送Email $mail->IsSMTP(); // 设置邮件的字符编码,若不指定,则为'UTF-8' $mail->CharSet = 'UTF-8'; // 添加收件人地址,可以多次使用来添加多个收件人 $mail->AddAddress($address); // 设置邮件正文 $mail->Body = $message; // 设置邮件头的From字段。 $mail->From = C('MAIL_ADDRESS'); // 设置发件人名字 $mail->FromName = 'Hello World'; // 设置邮件标题 $mail->Subject = $title; // 设置SMTP服务器。 $mail->Host = C('MAIL_SMTP'); // 设置为"需要验证" ThinkPHP 的C方法读取配置文件 $mail->SMTPAuth = true; // 设置用户名和密码。 $mail->Username = C('MAIL_LOGINNAME'); $mail->Password = C('MAIL_PASSWORD'); // 发送邮件。 return $mail->Send() ? true : $mail->ErrorInfo; }
/** * */ function sendMail($to, $title, $content) { Vendor('PHPMailer.PHPMailerAutoload'); $mail = new PHPMailer(); //实例化 $mail->IsSMTP(); // 启用SMTP $mail->Host = C('MAIL_HOST'); //smtp服务器的名称(这里以QQ邮箱为例) $mail->SMTPAuth = C('MAIL_SMTPAUTH'); //启用smtp认证 $mail->Username = C('MAIL_USERNAME'); //你的邮箱名 $mail->Password = C('MAIL_PASSWORD'); //邮箱密码 $mail->From = C('MAIL_FROM'); //发件人地址(也就是你的邮箱地址) $mail->FromName = C('MAIL_FROMNAME'); //发件人姓名 $mail->AddAddress($to, "尊敬的客户"); $mail->WordWrap = 50; //设置每行字符长度 $mail->IsHTML(C('MAIL_ISHTML')); // 是否HTML格式邮件 $mail->CharSet = C('MAIL_CHARSET'); //设置邮件编码 $mail->Subject = $title; //邮件主题 $mail->Body = $content; //邮件内容 $mail->AltBody = "这是一个纯文本的身体在非营利的HTML电子邮件客户端"; //邮件正文不支持HTML的备用显示 return $mail->Send(); }
public function __construct() { Vendor('Form.Form2'); $this->form = new Form('__APP__/Website/Website_addok', 'website'); $this->form->_addBaseElement('website'); parent::__construct(); }
public function remove() { //删除指定记录 $result = array('isErr' => 0, 'content' => ''); $id = $_REQUEST['id']; if (!empty($id)) { Vendor('common'); $model = D("EventShare"); $condition = array("share_id" => array('in', explode(',', $id))); $list = $model->where($condition)->findAll(); if (false !== $model->where($condition)->delete()) { foreach ($list as $k => $v) { M("Event")->setDec('thread_count', 'id=' . $v['event_id']); // 减1 } D("Share")->removeHandler($id); $this->saveLog(1, $id); } else { $result['isErr'] = 1; $result['content'] = L('REMOVE_ERROR'); } } else { $result['isErr'] = 1; $result['content'] = L('ACCESS_DENIED'); } die(json_encode($result)); }
public function logo() { Vendor("phpqrcode.phpqrcode"); $QRcode = new \QRcode(); $path = "data/rq/"; $value = 'http://' . $_SERVER['HTTP_HOST'] . '/index.php?token=' . session('token'); $fileName = $path . session('token') . '_emall.png'; $QR_Logo = $path . session('token') . '_emall_Logo.png'; $errorCorrectionLevel = 'H'; $matrixPointSize = 10; $QRcode->png($value, $fileName, $errorCorrectionLevel, $matrixPointSize, 2); $logo = $path . 'weixinlogo.jpg'; $QR = $fileName; if ($logo !== FALSE) { $QR = imagecreatefromstring(file_get_contents($QR)); $logo = imagecreatefromstring(file_get_contents($logo)); $QR_width = imagesx($QR); $QR_height = imagesy($QR); $logo_width = imagesx($logo); $logo_height = imagesy($logo); $logo_qr_width = $QR_width / 5; $scale = $logo_width / $logo_qr_width; $logo_qr_height = $logo_height / $scale; $from_width = ($QR_width - $logo_qr_width) / 2; imagecopyresampled($QR, $logo, $from_width, $from_width, 0, 0, $logo_qr_width, $logo_qr_height, $logo_width, $logo_height); } imagepng($QR, $QR_Logo); $this->assign('QR_Logo', $QR_Logo); $this->display(); if (IS_AJAX) { $response = $this->fetch(); $this->ajaxReturn(1, '', $response); } }
public function __construct() { Vendor('Form.Form2'); $this->form = new Form('__APP__/Product/Product_addok', 'product'); $this->form->_addBaseElement('product'); parent::__construct(); }
public function __construct() { Vendor('Form.Form2'); $this->form = new Form('__APP__/Demo/Demo_addok', 'demo'); $this->form->_addBaseElement('demo'); parent::__construct(); }
public function remove() { //删除指定记录 $result = array('isErr' => 0, 'content' => ''); $id = $_REQUEST['id']; if (!empty($id)) { Vendor('common'); $model = D("Event"); $pk = $model->getPk(); $condition = array($pk => array('in', explode(',', $id))); $list = $model->where($condition)->findAll(); if (false !== $model->where($condition)->delete()) { foreach ($list as $k => $v) { D("Share")->removeHandler($v['share_id']); $post_share_ids = D("EventShare")->where("event_id=" . $v['id'])->field("share_id")->findAll(); foreach ($post_share_ids as $k => $share_ids) { D("Share")->removeHandler($share_ids['share_id']); } $model->where("event_id=" . $v['id'])->delete(); } $this->saveLog(1, $id); } else { $result['isErr'] = 1; $result['content'] = L('REMOVE_ERROR'); } } else { $result['isErr'] = 1; $result['content'] = L('ACCESS_DENIED'); } die(json_encode($result)); }
public function phpRPCAct() { Vendor('phpRPC.phprpc_client'); $client = new \PHPRPC_Client('http://localhost:8500/Api/RpcTest'); $result = $client->test(); dump($result); }
/** * 过滤数据 重组 * @param array $data * @param array $modelfield */ public function filterData($data = array(), $modelfield = array()) { $newmodelfield = $this->parseModelField($modelfield); $newdata = $data; foreach ($data as $k => $d) { if (key_exists($k, $newmodelfield)) { switch ($newmodelfield[$k]['type']) { case 'editor': //编辑器过滤XSS Vendor('Htmlpurifier.library.HTMLPurifier#auto'); $config = \HTMLPurifier_Config::createDefault(); $purifier = new \HTMLPurifier($config); $newdata[$k] = $purifier->purify(htmlspecialchars_decode($d)); break; case 'position': //推荐位 $newdata[$k] = implode(',', $d); break; case 'checkbox': $newdata[$k] = implode(',', $d); break; } } } return $newdata; }
public function index() { function bar($x) { if ($x > 0) { bar($x - 1); } } function foo() { for ($idx = 0; $idx < 5; $idx++) { bar($idx); $x = strlen("abc"); } } //开启调试 xhprof_enable(); // cpu:XHPROF_FLAGS_CPU 内存:XHPROF_FLAGS_MEMORY // 如果两个一起:XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY); //要测试的php代码 foo(); //停止监测 $xhprof_data = xhprof_disable(); // display raw xhprof data for the profiler run print_r($xhprof_data); //包含工具类,在下载的 tgz 包中可以找到 //$XHPROF_ROOT = realpath(dirname(__FILE__) .'/..'); Vendor('Xhprof.autoload'); //Vendor('Xhprof.xhprof_runs'); //include_once $XHPROF_ROOT . "/xhprof_lib/utils/xhprof_lib.php"; //include_once $XHPROF_ROOT . "/xhprof_lib/utils/xhprof_runs.php"; // save raw data for this profiler run using default // implementation of iXHProfRuns. }
/** +---------------------------------------------------------- * 应用程序初始化 +---------------------------------------------------------- * @access public +---------------------------------------------------------- * @return void +---------------------------------------------------------- */ public static function run() { // 设定错误和异常处理 set_error_handler(array('App', "appError")); set_exception_handler(array('App', "appException")); //[RUNTIME] // 检查项目是否编译过 // 在部署模式下会自动在第一次执行的时候编译项目 if (defined('RUNTIME_MODEL')) { // 运行模式无需载入项目编译缓存 } elseif (is_file(RUNTIME_PATH . '~app.php') && (!is_file(CONFIG_PATH . 'config.php') || filemtime(RUNTIME_PATH . '~app.php') > filemtime(CONFIG_PATH . 'config.php'))) { // 直接读取编译后的项目文件 C(include RUNTIME_PATH . '~app.php'); } else { // 预编译项目 App::build(); } //[/RUNTIME] //导入类库 Vendor('Zend.Amf.Server'); //实例化AMF $server = new Zend_Amf_Server(); $actions = explode(',', C('APP_AMF_ACTIONS')); foreach ($actions as $action) { $server->setClass($action . 'Action'); } echo $server->handle(); // 保存日志记录 if (C('LOG_RECORD')) { Log::save(); } return; }
/** * 发送邮件函数 * @param $email 邮件接收邮箱 * @param $name 接收人NAME * @param $string 邮件标题 * @param $content 接收内容 */ function sendMail($email, $name, $title, $content) { Vendor('PHPMailer.PHPMailerAutoload'); $mail = new PHPMailer(); //建立邮件发送类 $mail->IsSMTP(); // 使用SMTP方式发送 $mail->Host = C('MAIL_HOST'); // 您的企业邮局域名 $mail->SMTPAuth = C('MAIL_SMTPAUTH'); // 启用SMTP验证功能 $mail->SMTPSecure = 'ssl'; $mail->Username = C('MAIL_USERNAME'); // 邮局用户名(请填写完整的email地址) $mail->Password = C('MAIL_PASSWORD'); // 邮局密码 $mail->Port = 465; $mail->From = C('MAIL_FROM'); //邮件发送者email地址 $mail->FromName = C('MAIL_FROMNAME'); //发件人姓名 $mail->CharSet = "utf-8"; $mail->Encoding = "base64"; $mail->AddAddress("{$email}", "{$name}"); //收件人email","收件人姓名 $mail->Subject = "{$title}"; //邮件标题 $mail->IsHTML(TRUE); $mail->Body = "{$content}"; //邮件内容 return $mail->Send(); }
function sentEmail($data) { //加载第三方类swift,实现发送邮件功能 Vendor('swift.lib.swift_required'); //发送邮件,以QQ邮箱为例 //配置邮箱服务器,得到传输对象 $transport = \Swift_SmtpTransport::newInstance(C('EM_SERVER'), C('EM_PORT')); //设置登录帐号和密码 $transport->setUsername(C('EM_USERNAME')); $transport->setPassword(C('EM_PASSWORD')); //得到发送邮件对象Swift_Mailer对象 $mailer = \Swift_Mailer::newInstance($transport); //得到邮件信息对象 $message = \Swift_Message::newInstance(); //设置管理员信息 $message->setFrom(array(C('EM_USERNAME') => C('EM_ADMIN'))); //设置接收邮件用户信息 $message->setTo($data['email']); //设置邮件主题 $message->setSubject($data['sub']); //设置邮件正文 $message->setBody("{$data['str']}", 'text/html', 'utf-8'); //发送邮件 try { if ($mailer->send($message)) { return true; } else { return false; } } catch (Swift_ConnectionExcption $e) { echo '邮件发送失败'; return false; } }
public function download($bid = -1) { //准备试卷基本信息 $Bank = D('Bankview'); $bank = $Bank->find($bid); $Exam = D('Examview'); $exam = $Exam->where('cid=' . "'" . $bank['cid'] . "'")->find(); $path = './Uploads/' . $bank['cid'] . '/' . $bank['tid'] . '/' . $bank['savename']; $filename = $bank['id'] . '_' . $exam['coursename'] . '_' . $bank['teachername'] . '.pdf'; $Course = D('Course'); $course = $Course->find($bank['cid']); //判断考试班级是否修改过 $classname = ''; if ($course['classlist'] != '') { $classname = $course['classlist']; } else { $classname = $exam['classname']; } $school = get_info('INFO_SCHOOL'); $year = get_info('INFO_YEAR'); $term = get_info('INFO_TERM'); $type = get_info('INFO_TYPE'); //修改试卷 Vendor('Classes.TCPDF.PDF'); $pdf = new PDF(); $pdf->edit($path, $filename, $school, $bank['teachername'], '', $exam['systemname'], $year, $term, $type, $exam['coursename'], $classname, $course['type']); }
function SendMail($to, $title, $company, $contact, $phone, $email, $address, $content, $cname, $cqq) { header("Content-type: text/html; charset=utf-8"); Vendor('PHPMailer.PHPMailerAutoload'); $mail = new PHPMailer(); //实例化 $mail->IsSMTP(); // 启用SMTP $mail->Host = C('MAIL_HOST'); //smtp服务器的名称(这里以QQ邮箱为例) $mail->SMTPAuth = C('MAIL_SMTPAUTH'); //启用smtp认证 $mail->Username = C('MAIL_USERNAME'); //你的邮箱名 $mail->Password = C('MAIL_PASSWORD'); //邮箱密码 $mail->From = C('MAIL_FROM'); //发件人地址(也就是你的邮箱地址) $mail->FromName = C('MAIL_FROMNAME'); //发件人姓名 $mail->AddAddress($to, "尊敬的客户"); $mail->WordWrap = 50; //设置每行字符长度 $mail->IsHTML(C('MAIL_ISHTML')); // 是否HTML格式邮件 $mail->CharSet = C('MAIL_CHARSET'); //设置邮件编码 $mail->Subject = $title; //邮件主题 $mail->Body = '姓名:' . $cname . '<br/>公司:' . $company . '<br/>Content:' . $contact . '<br/>手机:' . $phone . '<br/>电子邮箱:' . $email . '<br/>地址:' . $address . '<br/>Content:' . $content . '<br/>QQ:' . $cqq; //邮件内容 $mail->AltBody = "这是一个纯文本的身体在非营利的HTML电子邮件客户端"; //邮件正文不支持HTML的备用显示 return $mail->Send(); }
public function __construct() { Vendor('Form.Form2'); $this->form = new Form('__APP__/Advertise/Advertise_addok', 'advertise'); $this->form->_addBaseElement('advertise'); parent::__construct(); }
public function caijiApi() { $p = $_GET; $count = 0; Vendor('tbk.TopSdk'); $c = new TopClient(); $c->appkey = $this->setting['tb_api_key']; $c->secretKey = $this->setting['tb_api_secret']; $req = new TbkItemGetRequest(); $req->setFields("num_iid,title,pict_url,small_images,reserve_price,zk_final_price,user_type,provcity,item_url"); $p['keyword'] && $req->setQ($p['keyword']); $p['cid'] && $req->setCat($p['cid']); $p['start_price'] > 0 && $req->setStartPrice($p['start_price']); $p['end_price'] > 0 && $req->setEndPrice($p['end_price']); $p['sort'] && $req->setSort($p['sort']); $p['start_commissionRate'] > 0 && $req->setStartTkRate($p['start_commissionRate']); $p['end_commissionRate'] > 0 && $req->setEndTkRate($p['end_commissionRate']); $p['mall_item'] && $req->setIsTmall("true"); $req->setPageSize(100); $resp = $c->execute($req); $a = $resp->results->n_tbk_item; foreach ($a as $val) { if ($count >= $p['num']) { break; } $goods = array('title' => $val->title, 'num_iid' => $val->num_iid, 'item_url' => $val->item_url, 'price' => $val->reserve_price, 'discount_price' => $val->zk_final_price, 'goods_type' => $val->user_type ? 'tmall' : 'taobao', 'pic_url' => $val->pict_url, 'provcity' => $val->provcity, 'add_uid' => $this->my['uid'], 'add_uname' => $this->my['uname'], 'ctime' => TIME, 'sort_id' => $p['sort_id'], 'state' => $p['state'] ? 1 : 0); $count++; $goods_list[] = $goods; } echo json_encode(array('data' => $goods_list, 'count' => $count)); }
/** +---------------------------------------------------------- * 应用程序初始化 +---------------------------------------------------------- * @access public +---------------------------------------------------------- * @return void +---------------------------------------------------------- */ public static function run() { //导入类库 Vendor('phpRPC.phprpc_server'); //实例化phprpc $server = new PHPRPC_Server(); $actions = explode(',', C('APP_PHPRPC_ACTIONS')); foreach ($actions as $action) { //$server -> setClass($action.'Action'); $temp = $action . 'Action'; $methods = get_class_methods($temp); $server->add($methods, new $temp()); } if (APP_DEBUG) { $server->setDebugMode(true); } $server->setEnableGZIP(true); $server->start(); //C('PHPRPC_COMMENT',$server->comment()); echo $server->comment(); // 保存日志记录 if (C('LOG_RECORD')) { Log::save(); } return; }
public function _initialize() { parent::_initialize(); //RBAC 验证接口初始化 Vendor('Common.Tree'); //导入通用树型类 }
/** * 架构函数 * @access public */ public function __construct() { //控制器初始化 if (method_exists($this, '_initialize')) { $this->_initialize(); } //导入类库 Vendor('Hprose.HproseHttpServer'); //实例化HproseHttpServer $server = new \HproseHttpServer(); if ($this->allowMethodList) { $methods = $this->allowMethodList; } else { $methods = get_class_methods($this); $methods = array_diff($methods, array('__construct', '__call', '_initialize')); } $server->addMethods($methods, $this); if (APP_DEBUG || $this->debug) { $server->setDebugEnabled(true); } // Hprose设置 $server->setCrossDomainEnabled($this->crossDomain); $server->setP3PEnabled($this->P3P); $server->setGetEnabled($this->get); // 启动server $server->start(); }
public function __construct() { Vendor('Form.Form2'); $this->form = new Form('__APP__/Art_position/Art_position_addok', 'art_position'); $this->form->_addBaseElement('art_position'); parent::__construct(); }
public function file() { $upload = new \Think\Upload(); // 实例化上传类 $upload->maxSize = 1048576; // 设置附件上传大小 $upload->exts = array('jpg', 'gif', 'png', 'jpeg'); // 设置附件上传类型 $upload->rootPath = './Public/uploads/'; // 设置附件上传根目录 $upload->autoSub = false; $info = $upload->upload(); // 上传文件 if (!$info) { // 上传错误提示错误信息 $req['code'] = -1; $this->ajaxReturn($req); } else { // 上传成功 $width = I('post.width'); $height = I('post.height'); $oldFile = I('post.oldFile'); //将文件上传到OSS Vendor('Aliyun.Oss'); $oss = new \Oss("wx-img"); $client = $oss->createClient(); $req = $oss->uploadFile($client, $info['Filedata'], $oldFile); unlink('./Public/uploads/' . $info['Filedata']['savename']); $this->ajaxReturn($req); } }
public function __construct() { Vendor('Alipay.Corefunction'); Vendor('Alipay.Md5function'); Vendor('Alipay.Notify'); Vendor('Alipay.Submit'); }
public function topup() { $orderInfo = session('orderInfo'); Vendor('WxPayApi.unit.log'); Vendor('WxPayApi.lib.WxPayApi'); Vendor('WxPayApi.unit.WxPayNativePay'); //模式一 $notify = new \NativePay(); $input = new \WxPayUnifiedOrder(); $input->SetBody("会员充值"); $input->SetAttach("topup"); $input->SetOut_trade_no($orderInfo['orderNo']); $input->SetTotal_fee("1"); $input->SetTime_start(date("YmdHis")); $input->SetTime_expire(date("YmdHis", time() + 600)); $input->SetNotify_url("http://www.tyrolland.cn/Weixin/Pay/notify"); $input->SetTrade_type("NATIVE"); $input->SetProduct_id('TOPUP_' . $orderInfo['price']); $result = $notify->GetPayUrl($input); $url2 = $result["code_url"]; $userInfo = session('userInfo'); $this->assign('orderInfo', $orderInfo); $this->assign('userInfo', $userInfo); $this->assign('url', urlencode($url2)); $this->display(); }
public function qrcode() { $url = I('get.data'); Vendor('phpQrcode.phpqrcode'); $errorCorrectionLevel = "L"; $matrixPointSize = "4"; \QRcode::png($url, false, $errorCorrectionLevel, $matrixPointSize); }