Example #1
1
 /**
  * send
  * 必有方法,发送时调用.
  *
  * config参数为getOptions取得的所有项的配置结果
  *
  * @param mixed $target ['email']
  * @param mixed $title
  * @param mixed $config
  */
 public function send($target, $title, $content, $config)
 {
     logger::debug(__CLASS__ . var_export(func_get_args(), 1));
     $new_msg = array('member_id' => $target['member_id'], 'target' => $target['email'], 'subject' => $title, 'content' => $content, 'createtime' => time(), 'msg_type' => 'email', 'status' => 'sent');
     app::get('b2c')->model('member_msg')->save($new_msg);
     if (!($email_to = $target['email'])) {
         return false;
     }
     if ($config['sendway'] == 'mail') {
         $this->email = vmc::singleton('desktop_email_email');
     }
     $this->email->Sender = $this->Sender = $config['usermail'];
     $this->email->Subject = $this->Subject = $this->email->inlineCode($title);
     $From = $this->email->inlineCode(app::get('site')->getConf('site_name')) . '<' . $config['usermail'] . '>';
     $header = array('Return-path' => '<' . $config['usermail'] . '>', 'Date' => date('r'), 'From' => $From, 'MIME-Version' => '1.0', 'Subject' => $this->Subject, 'To' => $email_to, 'Content-Type' => 'text/html; charset=UTF-8; format=flowed', 'Content-Transfer-Encoding' => 'base64');
     $body = chunk_split(base64_encode($content));
     $header = $this->email->buildHeader($header);
     $config['sendway'] = $config['sendway'] ? $config['sendway'] : 'smtp';
     switch ($config['sendway']) {
         case 'sendmail':
             $result = $this->email->SendmailSend($email_to, $header, $body);
             break;
         case 'mail':
             $result = $this->email->MailSend($email_to, $header, $body);
             break;
         case 'smtp':
             $result = $this->email->SmtpSend($email_to, $header, $body, $config);
             break;
         default:
             $result = false;
             break;
     }
     return $result;
 }
Example #2
0
function tujuanDes($destkota, $stat = 'provinsi', $tambah)
{
    global $app;
    $dbu = new db();
    $appx = new app();
    $urlx = new url();
    if ($stat == "destinasi") {
        while ($desty = $dbu->fetch($destkota)) {
            $destinasi = $desty[nama];
            $desty[thumb] = $appx->cekFile("/destinasi/thumb/", $desty[thumb], 'default.jpg');
            $desty[thumb] = $app[data_www] . "/destinasi/thumb/" . $desty[thumb];
            $outnya .= '<li>
							<div class="img_box">
								<img src="' . $desty[thumb] . '">
							</div>
							<div class="text">
								<h1>' . $destinasi . '</h1>
								<p>' . $dbu->lookup('deskripsi', $app[table][destinasi_bahasa], "id_reff ='" . $desty[id_reff] . "' AND id_bahasa='" . $_SESSION[bhs] . "'") . '</p>									
							</div>
							<a href="' . $app[www] . "/" . $dbu->lookup('nama', 'action', "action='21' and id_bahasa='" . $_SESSION[bhs] . "'") . "/" . $urlx->shortLink($destinasi) . "/" . '"><div class="explore">EXPLORE MORE</div></a>
						</li>';
        }
    } elseif ($stat == "provinsi") {
        while ($desty = $dbu->fetch($destkota)) {
            $destinasi = $desty[nama];
            $desty[thumb] = $appx->cekFile("/destinasi/thumb/", $desty[thumb], 'default.jpg');
            $desty[thumb] = $app[data_www] . "/destinasi/thumb/" . $desty[thumb];
            $outnya .= '<li>
							<div class="img_box">

								<img src="' . $desty[thumb] . '">
							</div>
							<div class="text">
								<h1>' . $destinasi . '</h1>
								<p>' . $dbu->lookup('deskripsi', $app[table][destinasi_bahasa], "id_reff ='" . $desty[id_reff] . "' AND id_bahasa='" . $_SESSION[bhs] . "'") . '</p>									
							</div>
							<a href="' . $app[www] . "/" . $dbu->lookup('nama', 'action', "action='21' and id_bahasa='" . $_SESSION[bhs] . "'") . "/" . $urlx->shortLink($destinasi) . "/" . '"><div class="explore">EXPLORE MORE</div></a>
						</li>';
        }
    } else {
        //echo "sedel";exit;
        while ($dkota = $dbu->fetch($destkota)) {
            $dkota[thumb] = $appx->cekFile("/kota/thumb/", $dkota[thumb], 'default.jpg');
            $dkota[thumb] = $app[data_www] . "/kota/thumb/" . $dkota[thumb];
            //echo "asdasdas".$dkota[thumb];
            $outnya .= '<li>
							<div class="img_box">
								<img src="' . $dkota[thumb] . '">
							</div>
							<div class="text">
								<h1>' . $dkota[nama] . '</h1>
								<p>' . $dbu->lookup('deskripsi', $app[table][kota_bahasa], "id_kota ='" . $dkota[id] . "' AND id_bahasa='" . $_SESSION[bhs] . "'") . '</p>									
							</div>
							<a href="' . $app[www] . "/" . $dbu->lookup('nama', 'action', "action='2' and id_bahasa='" . $_SESSION[bhs] . "'") . "/id_" . $urlx->shortLink($dkota[nama]) . "_" . $urlx->shortLink($tambah) . "/" . '"><div class="explore">EXPLORE MORE</div></a>
						</li>';
        }
    }
    return $outnya;
}
Example #3
0
 /**
  * Return Model by each class
  *
  * @return Model
  */
 private function makeModel()
 {
     $this->model = $this->app->make($this->model());
     if (!$this->model instanceof Model) {
         throw new Exception("Class " . $this->model . " must be an instance of Illuminate\\Database\\Eloquent\\Model");
     }
     return $this->model;
 }
Example #4
0
    function feedCheckIn($dfeed, $sBahasa, $member)
    {
        global $app;
        $appx = new app();
        $dbu = new db();
        $urlx = new url();
        $fcek_in = "";
        $icon = $app[css_www] . "/images/ic_cat_2.png";
        $avatar = $appx->cekFile('/pengguna/avatar/', $member[avatar], 'default.jpg');
        $avatar = $app[data_www] . '/pengguna/avatar/' . $avatar;
        $linkAva = $app["www"] . "/" . $dbu->lookup('nama', 'action', "action='8' and id_bahasa ='" . $sBahasa . "'") . "/" . $urlx->shortLink($member[username]) . "/";
        $fcek_in = '<div class="con_newsfeed add_fix">
					<div class="line_newsfeed">
						<div class="circle_pict circle_pict_nf"><a href="' . $linkAva . '"><img src="' . $avatar . '"></a></div>
						<div class="bar"></div>
						<div class="ic_cat"><a href="#"><img src="' . $icon . '"></a></div>
					</div>';
        $dipost = $appx->time_delta('now', $dfeed[tgl_post], 0, 2, true);
        if ($_SESSION[member][id] != "") {
            $bolehKomen = '<li>
							<div class="circle_pict circle_pict_nf"><a href="' . $linkAva . '"><img src="' . $avatar . '"></a></div>
							<textarea id="cekin" placeholder="Write your comment..."></textarea>
						</li>';
        }
        $sql = "SELECT a.nama , b.nama as kota , c.nama as provinsi, d.nama as negara FROM " . $app[table][destinasi_bahasa] . " as a LEFT JOIN " . $app[table][destinasi] . " as e ON (a.id_reff = e.id_reff)  LEFT JOIN " . $app[table][kota] . " as b ON(e.id_kota = b.id) LEFT JOIN " . $app[table][provinsi] . " as c ON(b.id_provinsi = c.id) LEFT JOIN " . $app[table][negara] . " as d ON(c.id_negara = d.id) LEFT JOIN " . $app[table][cekin] . " as f ON(e.id = f.id_destinasi ) LEFT JOIN " . $app[table][pengguna_feed] . " as g ON(f.id = g.id_tabel) WHERE g.id ='" . $dfeed[id] . "' AND a.id_bahasa ='" . $sBahasa . "'";
        $lokasi = $dbu->get_recordmix($sql);
        $cekin_di = '<span>Check in at <a href="#"><i>' . $lokasi[nama] . '(' . $lokasi[kota] . '), ' . $lokasi[provinsi] . ', ' . $lokasi[negara] . '</i></a></span>';
        $fcek_in .= '<div class="box_con_newsfeed">
						<h1>' . $member[nama] . '</h1>
						<span>' . $dipost . '</span>
						<div class="frame_post">
							' . $cekin_di . '
							<div class="box_comment">
								<ul class="add_fix" id="list_cekin" rel="cekin_' . $dfeed[id_tabel] . '">
									' . $bolehKomen;
        #komen cekin---------------------------
        $sql = "SELECT a.nama , a.avatar, a.username, b.id, b.komen, b.tgl_post as tgl_komen FROM " . $app[table][pengguna] . " as a LEFT JOIN " . $app[table][cekin_komen] . " as b ON(b.id_user = a.id) WHERE b.id_cekin = '" . $dfeed[id_tabel] . "'";
        $dbu->query($sql, $rkomen, $nkomen);
        if ($nkomen > 0) {
            while ($dkomen = $dbu->fetch($rkomen)) {
                $dkomen[avatar] = $appx->cekFile("/pengguna/avatar/", $dkomen[avatar]);
                $other_avatar = $app[data_www] . '/pengguna/avatar/' . $dkomen[avatar];
                $other_linkAva = $app["www"] . "/" . $dbu->lookup('nama', 'action', "action='8' and id_bahasa ='" . $sBahasa . "'") . "/" . $urlx->shortLink($dkomen[username]) . "/";
                $fcek_in .= '<li>		
							<div class="circle_pict circle_pict_nf"><a href="' . $other_linkAva . '"><img src="' . $other_avatar . '"></a></div>
							<div class="text_box_c">
								<h1>' . $dkomen[nama] . '</h1>
								<p>' . $dkomen[komen] . '</p>
							</div>					
						</li>';
            }
        }
        $fcek_in .= '</ul></div></div></div></div>';
        return $fcek_in;
    }
function setupAppFramework()
{
    /* initialize the SMT Facebook appliation class, NO Facebook library */
    require_once PATH_FACEBOOK . "/classes/app.class.php";
    global $app, $db, $session;
    $app = new app(NULL, true);
    $app->loadFacebookLibrary();
    // caution: do not assign globals by reference
    $db = $app->db;
    $session = $app->session;
    return $app;
}
Example #6
0
 public function run()
 {
     $ev = $this->make('ev');
     include '../lib/config.inc.php';
     header('P3P: CP=CAO PSA OUR');
     header('Content-Type: text/html; charset=' . HE);
     ini_set('date.timezone', 'Asia/Shanghai');
     date_default_timezone_set("Etc/GMT-8");
     error_reporting(0);
     $app = new app($this);
     $app->run();
 }
 public function deliver_featured()
 {
     // send feature notifications
     global $init;
     require_once PATH_FACEBOOK . "/classes/app.class.php";
     $app = new app(NULL, true);
     $facebook =& $app->loadFacebookLibrary();
     require_once PATH_CORE . '/classes/subscriptions.class.php';
     $subObj = new SubscriptionsManager($db);
     $subObj->loadFacebook($facebook);
     $subObj->deliverFeatures();
     set_flash(array('notice' => "Feature notifications sent."));
     redirect(url_for($this->name, 'index'));
 }
Example #8
0
function AppCentre_GetCheckQueryString(){
	global $zbp;
	$check= '';
	$app=new app;			
	if($app->LoadInfoByXml('theme', $zbp->theme)==true){
		$check.=$app->id . ':' .$app->modified . ';';
	}
	foreach (explode('|',$zbp->option['ZC_USING_PLUGIN_LIST']) as  $id) {
		$app=new app;
		if($app->LoadInfoByXml('plugin', $id)==true){
			$check.=$app->id . ':' .$app->modified . ';';
		}
	}
	return $check;
}
Example #9
0
 public function column_tag(&$colList, $list)
 {
     //todo  如果list为空则 retunn
     if (!$list) {
         return;
     }
     $idColumnKey = $list[0]['idColumn'];
     $appId = $list[0]['app_id'];
     $tagType = $list[0]['tag_type'];
     $list = utils::array_change_key($list, $idColumnKey);
     // 获取所有当前finder主键列表
     $relatedIds = array_keys(utils::array_change_key($list, $idColumnKey));
     $filter = array('rel_id' => $relatedIds, 'tag_type' => $tagType, 'app_id' => $appId);
     // 获取tag列表
     $tagRows = app::get('desktop')->model('tag_rel')->getList('tag_id, rel_id', $filter);
     /*-----start------>*/
     $tagIds = array_keys(utils::array_change_key($tagRows, 'tag_id'));
     if ($tagIds) {
         $tagList = app::get('desktop')->model('tag')->getList('*', array('tag_id' => $tagIds));
         $tagList = utils::array_change_key($tagList, 'tag_id');
     }
     /*<----end-------->*/
     foreach ($tagRows as $row) {
         $relatedRows[$row['rel_id']][] = $tagList[$row['tag_id']];
     }
     $i = 0;
     foreach ($relatedIds as $id) {
         $colList[$i] = $this->getColumnTagHtml($relatedRows[$id]);
         $i++;
     }
 }
Example #10
0
 /**
  * 结算明细
  * @return
  */
 public function detail()
 {
     $this->contentHeaderTitle = app::get('topshop')->_('企业结算明细');
     $filter['shop_id'] = $this->shopId;
     $postSend = input::get();
     if ($postSend['timearea']) {
         $pagedata['timearea'] = $postSend['timearea'];
         $timeArray = explode('-', $postSend['timearea']);
         $filter['settlement_time|than'] = strtotime($timeArray[0]);
         $filter['settlement_time|lthan'] = strtotime($timeArray[1]);
     } else {
         $filter['settlement_time|than'] = time() - 3600 * 24 * 7;
         $filter['settlement_time|lthan'] = time();
         $pagedata['timearea'] = date('Y/m/d', time() - 3600 * 24 * 7) . '-' . date('Y/m/d', time());
     }
     if ($postSend['settlement_type']) {
         $filter['settlement_type'] = $postSend['settlement_type'];
         $pagedata['settlement_type'] = $postSend['settlement_type'];
     }
     //处理翻页数据
     $pagedata['page'] = $page = $postSend['page'] ? $postSend['page'] : 1;
     $pagedata['limits'] = $pageLimit = 10;
     $objMdlSettleDetail = app::get('sysclearing')->model('settlement_detail');
     $pagedata['settlement_detail_list'] = $objMdlSettleDetail->getList('*', $filter, ($page - 1) * $pageLimit, $pageLimit, 'settlement_time desc');
     $count = $objMdlSettleDetail->count($filter);
     $postSend['token'] = time();
     if ($count > 0) {
         $total = ceil($count / $pageLimit);
     }
     $pagedata['pagers'] = array('link' => url::action('topshop_ctl_clearing_settlement@detail', $postSend), 'current' => $page, 'total' => $total, 'token' => $postSend['token']);
     return $this->page('topshop/clearing/settlement_detail.html', $pagedata);
 }
Example #11
0
 public function getPaymentId($filter)
 {
     $tids = $filter['tid'];
     if ($filter['tid'] && is_array($filter['tid'])) {
         $tids = implode(',', $filter['tid']);
     }
     $tradeParams = array('user_id' => $filter['user_id'], 'tid' => $tids, 'fields' => 'tid,payment,user_id,status');
     //获取需要支付的订单并检测其有效性
     $tradeList = app::get('topc')->rpcCall('trade.get.list', $tradeParams);
     $count = $tradeList['count'];
     $tradeList = $tradeList['list'];
     $countid = count($filter['tid']);
     if ($countid != $count) {
         throw new \LogicException(app::get('topc')->_("支付失败,提交的订单数据有误"));
         return false;
     }
     foreach ($tradeList as $key => $value) {
         if ($value['status'] != "WAIT_BUYER_PAY") {
             throw new \LogicException(app::get('topc')->_($value['tid'] . " 订单已被支付,请重新选择要支付订单"));
             return false;
         }
         $payment['money'] += $value['payment'];
         $payment['user_id'] = $value['user_id'];
     }
     $payment['tids'] = $tids;
     try {
         $paymentId = app::get('topc')->rpcCall('payment.bill.create', $payment);
     } catch (Exception $e) {
         throw $e;
     }
     return $paymentId;
 }
Example #12
0
 function clear_by_app($app_id)
 {
     if (!$app_id) {
         return false;
     }
     app::get('desktop')->model('menus')->delete(array('app_id' => $app_id, 'menu_type' => $this->content_typename()));
 }
Example #13
0
 /**
  * 获取加密类型后的密文
  * @param string $source_str 加密明文
  * @return string 返回加密密文
  */
 public function get_encrypted($source_str, $account_type, $userdata = null)
 {
     if (!$userdata) {
         return md5($source_str);
     }
     if ($userdata['createtime']) {
         return $this->extends_md5($source_str, $userdata['login_name'], $userdata['createtime']);
     } else {
         if ($account_type == 'member') {
             $pam_members_model = app::get('pam')->model('members');
             $pam_filter = array('login_account' => $userdata['login_name']);
             $rows = $pam_members_model->getList('*', $pam_filter, 0, 1);
             // 商家 2015/8/31
         } else {
             if ($account_type == 'seller') {
                 $pam_model = app::get('pam')->model('seller');
                 $pam_filter = array('login_account' => $userdata['login_name']);
                 $rows = $pam_model->getList('*', $pam_filter, 0, 1);
             } else {
                 $pam_account_model = app::get('pam')->model('account');
                 $pam_filter = array('login_name' => $userdata['login_name'], 'account_type' => $account_type, 'disabled' => 'false');
                 $rows = $pam_account_model->getList('*', $pam_filter, 0, 1);
             }
         }
         if ($rows[0]) {
             if (substr($rows[0]['login_password'], 0, 1) !== 's') {
                 return md5($source_str);
             } else {
                 return $this->extends_md5($source_str, $userdata['login_name'], $rows[0]['createtime']);
             }
         } else {
             return false;
         }
     }
 }
Example #14
0
 public function update($params)
 {
     $db = app::get('sysaftersales')->database();
     $db->beginTransaction();
     try {
         $data['money'] = $params['money'];
         $data['cur_money'] = $params['cur_money'];
         $filter['payment_id'] = $params['payment_id'];
         $objMdlPayment = app::get('ectools')->model('payments');
         $objMdlPayBill = app::get('ectools')->model('trade_paybill');
         $result = $objMdlPayment->update($data, $filter);
         if (!$result) {
             throw new Exception('更新支付单失败');
         }
         $trade_own_money = json_decode($params['trade_own_money'], true);
         foreach ($trade_own_money as $key => $val) {
             $billdata['payment'] = $val;
             $billdata['modified_time'] = time();
             $billfilter['tid'] = $key;
             $billfilter['payment_id'] = $params['payment_id'];
             $result = $objMdlPayBill->update($billdata, $billfilter);
             if (!$result) {
                 throw new Exception('更新支付单失败');
             }
         }
         $db->commit();
     } catch (Exception $e) {
         $db->rollback();
         throw $e;
     }
     return true;
 }
/**
 * ShopEx licence
 *
 * @copyright  Copyright (c) 2005-2010 ShopEx Technologies Inc. (http://www.shopex.cn)
 * @license  http://ecos.shopex.cn/ ShopEx License
 */

function theme_widget_main_slide(&$setting,&$render){
    $setting['allimg']="";
    $setting['allurl']="";
    if($system->theme){
        $theme_dir = kernel::get_themes_host_url().'/'.$smarty->theme;
    }else{
        $theme_dir = kernel::get_themes_host_url().'/'.app::get('site')->getConf('current_theme');
    }
    if(!$setting['pic']){
        foreach($setting['img'] as $value){
            $setting['allimg'].=$rvalue."|";
            $setting['allurl'].=urlencode($value["url"])."|";
        }
    }else{
        foreach($setting['pic'] as $key=>$value){
            if($value['link']){
                if($value["url"]){
                    $value["linktarget"]=$value["url"];
                }
                $setting['allimg'].=$rvalue."|";
                $setting['allurl'].=urlencode($value["linktarget"])."|";
                $setting['pic'][$key]['link'] = str_replace('%THEME%',$theme_dir,$value['link']);
            }
        }
    }
    return $setting;
}
Example #16
0
 public function getList($params)
 {
     $catIds = explode(',', $params['cat_id']);
     $row = "cat_id,parent_id,cat_path,level,cat_name,child_count";
     if ($params['fields']) {
         $row = $params['fields'];
         $row = str_append($row, 'level,parent_id');
     }
     $db = app::get('syscategory')->database();
     $data = array();
     foreach ($catIds as $catId) {
         $cat = $db->executeQuery('SELECT ' . $row . ' FROM syscategory_cat WHERE cat_id=' . $catId . ' or cat_path LIKE "%,' . $catId . ',%"');
         foreach ($cat as $value) {
             if ($value['level'] == '1') {
                 $data[$value['cat_id']] = $value;
             } elseif ($value['level'] == '2') {
                 $lv2[$value['parent_id']][$value['cat_id']] = $value;
             } elseif ($value['level'] == '3') {
                 $lv3[$value['parent_id']][$value['cat_id']] = $value;
             }
         }
     }
     if (!$data) {
         throw new \LogicException('参数cat_id必须为一级类目id');
     }
     foreach ($data as $catId => $val) {
         foreach ($lv2[$catId] as $k => $v) {
             $lv2[$catId][$k]['lv3'] = $lv3[$k];
         }
         $data[$catId]['lv2'] = $lv2[$catId];
     }
     return $data;
 }
Example #17
0
 public function getCouponCode($coupon_id, $user_id)
 {
     $objMdlUserCoupon = app::get('sysuser')->model('user_coupon');
     $couponNum = $objMdlUserCoupon->count(array('coupon_id' => $coupon_id, 'user_id' => $user_id));
     $oldQuantity = $couponNum ? $couponNum : 0;
     $userInfo = kernel::single('sysuser_passport')->memInfo($user_id);
     $apiData = array('gen_quantity' => 1, 'old_quantity' => $oldQuantity, 'coupon_id' => $coupon_id, 'grade_id' => $userInfo['grade_id']);
     $db = app::get('sysuser')->database();
     $transaction_status = $db->beginTransaction();
     try {
         if ($couponInfo = app::get('sysuser')->rpcCall('promotion.coupon.gencode', $apiData)) {
             $userCoupon['coupon_id'] = $coupon_id;
             $userCoupon['coupon_code'] = $couponInfo['coupon_code'];
             $userCoupon['user_id'] = $user_id;
             $userCoupon['obtain_desc'] = '免费领取';
             $userCoupon['shop_id'] = $couponInfo['shop_id'];
             $userCoupon['obtain_time'] = time();
             $userCoupon['used_platform'] = $couponInfo['used_platform'];
             if (!app::get('sysuser')->model('user_coupon')->save($userCoupon)) {
                 throw new \LogicException('优惠券保存失败');
             }
             $db->commit($transaction_status);
             return $couponInfo;
         } else {
             throw new \LogicException('生成优惠券号码失败');
         }
     } catch (Exception $e) {
         $db->rollback();
         throw $e;
     }
     return true;
 }
Example #18
0
 private function __run($shopItemData, $shopId, $itemId)
 {
     pamAccount::setAuthType('sysshop');
     pamAccount::setSession($shopId, 'test');
     $objMdlItemDesc = app::get('sysitem')->model('item_desc');
     $itemInfoDesc = $objMdlItemDesc->getRow("*", array('item_id' => $itemId));
     $update = [];
     if ($itemInfoDesc['pc_desc']) {
         $pcDesc = $this->__replaceHost($itemInfoDesc['pc_desc']);
         //$pcDesc = $this->__replaceHref($this->__replaceImage($itemInfoDesc['pc_desc']));
         if ($pcDesc != stripslashes($itemInfoDesc['pc_desc'])) {
             $update['pc_desc'] = $pcDesc;
         }
     }
     if ($itemInfoDesc['wap_desc']) {
         $wapDesc = $this->__replaceHost($itemInfoDesc['wap_desc']);
         //$wapDesc = $this->__replaceHref($this->__replaceImage($itemInfoDesc['wap_desc']));
         if ($wapDesc != stripslashes($itemInfoDesc['wap_desc'])) {
             $update['wap_desc'] = $wapDesc;
         }
     }
     if ($update) {
         $objMdlItemDesc->update($update, array('item_id' => $itemId));
     }
     return true;
 }
Example #19
0
 public function command_sync_user()
 {
     //kernel::console_output = false;
     $http = kernel::single('base_httpclient');
     $response = $http->get(app::get('suitclient')->getConf('syncuser'));
     if ($response) {
         $server_users = json_decode($response);
         $model = app::get('pam')->model('account');
         $result = $model->getList('login_name', array('account_type' => 'shopadmin'));
         $client_user = array();
         foreach ($result as $value) {
             $client_user[] = $value['login_name'];
         }
         $model2 = app::get('desktop')->model('users');
         foreach ($server_users as $server_user) {
             if (!in_array($server_user, $client_user)) {
                 $user = array('name' => $server_user, 'status' => 1, 'super' => 0, 'disabled' => false, 'pam_account' => array('login_name' => $server_user, 'login_password' => md5(time() . rand()), 'account_type' => 'shopadmin'), 'roles' => array(array('role_id' => 1)));
                 $model2->save($user);
             }
         }
         kernel::log('同步成功');
         kernel::log('ok.');
         //不加 "ok."则会弹提示信息并不能自动关闭@lujy
     } else {
         kernel::log('同步失败或套件里没有用户');
         kernel::log('ok.');
     }
     exit;
 }
Example #20
0
 /**
  * 资讯保存
  **/
 public function saveInfo()
 {
     $userId = userAuth::id();
     //$postData =utils::_filter_input(input::get());
     $postData = input::get();
     $postData['user_id'] = $userId;
     $postData['modified'] = time();
     $postData['pubtime'] = time();
     $postData['ifpub'] = 0;
     $postData["platform"] = 'pc';
     $userName = app::get('sysuser')->model('account');
     $infoName = $userName->getList(login_account, array('user_id' => $userId));
     $postData['source'] = $infoName[0]['login_account'];
     $postData["article_logo"] = $postData["article_logo"][0];
     try {
         $userMdlAddr = app::get('sysinfo')->model('article');
         $userMdlAddr->save($postData);
     } catch (Exception $e) {
         $msg = $e->getMessage();
         return $this->splash('error', null, $msg);
     } catch (\LogicException $e) {
         $msg = $e->getMessage();
         return $this->splash('error', null, $msg);
     }
     $url = url::action('topc_ctl_member_info@publishInfo');
     $msg = app::get('topc')->_('添加成功');
     return $this->splash('success', $url, $msg);
 }
Example #21
0
    public function create($aData, $object = '')
    {
        // todo 2010-04-13 14:35 wubin
        // 通过$aStandard['default'] $aStandard['attribute'] 取出存在值
        // 要和dialog返回来的值做好对接 返回的数据加在原有数据后面
        // 过滤掉已存在的数....
        //$url = app::get('desktop')->router()->gen_url(array('app'=>'b2c', 'ctl'=>'admin_sales_goods', 'act'=>'goods_dialog', 'arg0'=>urlencode(serialize($table_info))));
        /**
                ob_start();
                app::get('b2c')->controller('admin_sales_goods')->get_defaine_dialog($aData, $table_info);
                $html = ob_get_contents();
                ob_end_clean();
        //*/
        /**/
        print_r($table_info);
        ob_start();
        app::get('b2c')->controller('admin_sales_goods')->pagedata['object'] = $object;
        app::get('b2c')->controller('admin_sales_goods')->pagedata['value'] = $aData['default'];
        app::get('b2c')->controller('admin_sales_goods')->pagedata['name'] = $aData['name'];
        app::get('b2c')->controller('admin_sales_goods')->display("admin/sales/dialog/index.html");
        $html = ob_get_clean();
        return $html;
        //*/
        return <<<EOF
            <a href="{$url}" onclick="return doTemplate(this, '{$aData['name']}[]');" >筛选</a>
            <div class="gridlist rows-body" id="div-dialog-data" >{$html}</div>
EOF;
    }
Example #22
0
 /**
  * 需要同步的数据
  */
 public function sync($request, $rpcService)
 {
     // $cnt    = kernel::single('b2c_shop')->getShopBindStatus();
     // if ( $cnt > 0 ) {
     if ($request['region_id']) {
         $obj_regions_op = kernel::service('ectools_regions_apps', array('content_path' => 'ectools_regions_operation'));
         if ($request['sync_type'] == 'del') {
             if ($request['region_id']) {
                 $obj_regions_op->toRemoveArea($request['region_id']);
             }
         } else {
             $ordernum = isset($request['ordernum']) ? $request['ordernum'] : 50;
             $package = $request['package'] ? $request['package'] : 'mainland';
             $data = array('region_id' => $request['region_id'], 'local_name' => $request['local_name'], 'ordernum' => $ordernum, 'package' => $package);
             if ($request['p_region_id']) {
                 $data['p_region_id'] = $request['p_region_id'];
             }
             $obj_regions_op->replaceDlArea($data, $msg);
         }
         $ret = array('code' => 1, 'msg' => app::get('ectools')->_('同步成功'));
     } else {
         $ret = array('code' => -1, 'msg' => app::get('ectools')->_('请确保地区ID'));
     }
     // } else {
     //     $ret    = array (
     //             'code'  => -2,
     //             'msg'   => app::get('ectools')->_('店铺未绑定无需同步'),
     //             );
     // }
     if ($ret['code'] < 0) {
         $rpcService->send_user_error($ret['code'], $ret['msg']);
     }
     return $ret;
 }
Example #23
0
 public function getInfo($params)
 {
     $filter = array();
     $paymenList = array();
     $objPayment = kernel::single('ectools_data_payment');
     $row = $params['fields'];
     if ($params['payment_id']) {
         $filterBill['payment_id'] = $filter['payment_id'] = $params['payment_id'];
     }
     if ($params['tids']) {
         $filterBill['tid'] = explode(',', $params['tids']);
     }
     if ($params['status']) {
         $filter['status|in'] = explode(',', $params['status']);
     }
     if ($filter) {
         $objMdlPayment = app::get('ectools')->model('payments');
         $paymentBill = $objMdlPayment->getRow($row, $filter);
     }
     if ($filterBill) {
         $objMdlTradePaybill = app::get('ectools')->model('trade_paybill');
         $billList = $objMdlTradePaybill->getList('payment_id,tid,payment,status', $filterBill);
     }
     if ($paymentBill && $billList) {
         foreach ($billList as $val) {
             $paymentBill['trade'][$val['tid']] = $val;
         }
     }
     return $paymentBill;
 }
Example #24
0
 function show($gid, $item = 'ask', $limit)
 {
     $objComment = kernel::single('b2c_message_disask');
     $aComment = $objComment->good_all_disask($gid, $item, 1, null, $limit);
     $memberInfo = kernel::single('b2c_frontpage')->get_current_member();
     $params['member_id'] = $memberInfo['member_id'];
     if (!$params['member_id']) {
         $aComment['setting']['login'] = '******';
     }
     $validate_type = $item == 'discuss' ? 'discussReply' : $item;
     // 评论回复/咨询/咨询回复的权限
     $aComment['setting']['power_status'] = kernel::single('b2c_message_disask')->toValidate($validate_type, $params, $message);
     $aComment['setting']['power_message'] = $message;
     if ($item == 'ask') {
         $aComment['gask_type'] = $objComment->gask_type($gid);
     } else {
         $point_status = app::get('b2c')->getConf('goods.point.status') ? app::get('b2c')->getConf('goods.point.status') : 'on';
         if ($point_status == 'on') {
             $objPoint = $this->app->model('comment_goods_point');
             $aComment['goods_point'] = $objPoint->get_single_point($gid);
             $aComment['total_point_nums'] = $objPoint->get_point_nums($gid);
             $aComment['_all_point'] = $objPoint->get_goods_point($gid);
         }
         $aComment['point_status'] = $point_status;
     }
     return $aComment;
 }
Example #25
0
 public function index()
 {
     $desktop_user = vmc::singleton('desktop_user');
     $menus = $desktop_user->get_work_menu();
     $user_id = $this->user->get_id();
     foreach ((array) $menus['workground'] as $key => $value) {
         //if($i++>$workground_count) break;
         $fav_menus[] = $key;
     }
     $this->pagedata['title'] = $title;
     $this->pagedata['title_desc'] = $title_desc;
     $this->pagedata['session_id'] = vmc::singleton('base_session')->sess_id();
     $this->pagedata['uname'] = $this->user->get_login_name();
     $this->pagedata['avatar'] = $this->user->get_avatar();
     $this->pagedata['is_super'] = $this->user->is_super();
     $this->pagedata['param_id'] = $user_id;
     $this->pagedata['menus'] = $menus;
     $this->pagedata['fav_menus'] = (array) $fav_menus;
     $this->pagedata['shop_base'] = vmc::base_url(1);
     $this->pagedata['shopadmin_dir'] = $_SERVER['REQUEST_URI'];
     // 桌面内容替换埋点
     foreach (vmc::servicelist('desktop_content') as $services) {
         if (is_object($services)) {
             if (method_exists($services, 'changeContent')) {
                 $services->changeContent(app::get('desktop'));
                 $services->changeContent($desktop_menu);
             }
         }
     }
     $this->display('index.html');
 }
Example #26
0
 public function add($id = '/')
 {
     $page = $this->page($id);
     $blueprint = blueprint::find($page);
     $templates = $blueprint->pages()->template();
     $options = array();
     $back = array('subpages' => purl('subpages/index/' . $page->id()), 'page' => purl($page, 'show'));
     $form = app::form('pages.add');
     $form->save = l('add');
     $form->back = a::get($back, get('to'));
     foreach ($templates as $template) {
         $options[$template->name()] = $template->title();
     }
     $select = form::field('select', array('name' => 'template', 'label' => l('pages.add.template.label'), 'options' => $options, 'required' => true));
     if ($templates->count() == 1) {
         $select->readonly = true;
         $select->value = $templates->first()->name();
     }
     $form->fields()->append('template', $select);
     if (api::maxPages($page, $blueprint->pages()->max())) {
         $form->fields = array('info' => form::field('info', array('label' => 'pages.add.error.max.headline', 'text' => 'pages.add.error.max.text')));
         $form->save = false;
         $form->centered = true;
     }
     return view('pages/add', array('page' => $page, 'form' => $form));
 }
Example #27
0
 public function executeIndex(sfWebRequest $request)
 {
     app::setPageTitle('Gantt Chart', $this->getResponse());
     if ($request->hasParameter('projects_id')) {
         $this->forward404Unless($this->projects = Doctrine_Core::getTable('Projects')->createQuery()->addWhere('id=?', $request->getParameter('projects_id'))->fetchOne(), sprintf('Object projects does not exist (%s).', $request->getParameter('projects_id')));
         $this->checkProjectsAccess($this->projects);
         $this->checkTasksAccess('view', false, $this->projects);
     } else {
         $this->checkTasksAccess('view');
     }
     if (!$this->getUser()->hasAttribute('gantt_filter' . $this->get_pid($request))) {
         $this->getUser()->setAttribute('gantt_filter' . $this->get_pid($request), Tasks::getDefaultFilter($request, $this->getUser(), 'ganttChart'));
     }
     $this->filter_by = $this->getUser()->getAttribute('gantt_filter' . $this->get_pid($request));
     if ($fb = $request->getParameter('filter_by')) {
         $this->filter_by[key($fb)] = current($fb);
         $this->getUser()->setAttribute('gantt_filter' . $this->get_pid($request), $this->filter_by);
         $this->redirect('ganttChart/index' . $this->add_pid($request));
     }
     if ($request->hasParameter('remove_filter')) {
         unset($this->filter_by[$request->getParameter('remove_filter')]);
         $this->getUser()->setAttribute('gantt_filter' . $this->get_pid($request), $this->filter_by);
         $this->redirect('ganttChart/index' . $this->add_pid($request));
     }
     $this->tasks_tree = array();
     $this->tasks_list = $this->getTasks($request, $this->tasks_tree);
 }
Example #28
0
 public function save()
 {
     $this->begin();
     if (empty($_POST['content'])) {
         $this->end(false, app::get('weixin')->_('操作失败!内容不能为空'));
     }
     if (empty($_POST['name'])) {
         $this->end(false, app::get('weixin')->_('操作失败!消息名称不能为空'));
     }
     $_POST['content'] = trim($_POST['content']);
     if (strlen($_POST['content']) > 1200) {
         $this->end(false, app::get('weixin')->_('操作失败!内容不能超出1200字符'));
     }
     if ($row = app::get('weixin')->model('message_text')->getList('id', array('name' => $_POST['name']))) {
         if (!$_POST['id'] || $row[0]['id'] != intval($_POST['id'])) {
             $this->end(false, app::get('weixin')->_('操作失败!消息名称已存在'));
         }
     }
     $data = array('content' => trim(str_replace('&nbsp;', ' ', $_POST['content'])), 'name' => trim($_POST['name']), 'is_check_bind' => $_POST['is_check_bind']);
     if (isset($_POST['id']) && intval($_POST['id'])) {
         $data['id'] = intval($_POST['id']);
     }
     if (app::get('weixin')->model('message_text')->save($data)) {
         $this->end(true, app::get('weixin')->_('添加成功!'));
     } else {
         $this->end(true, app::get('weixin')->_('添加失败!'));
     }
 }
Example #29
0
 static function getInstance()
 {
     if (self::$instance === null) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Example #30
0
 public function login($userData, $vcode = false, &$msg)
 {
     $userData = utils::_filter_input($userData);
     //过滤xss攻击
     if ($vcode && !$this->vcode_verify($vcode)) {
         $msg = app::get('pam')->_('验证码错误');
         return false;
     }
     //如果指定了登录类型,则不再进行获取(邮箱登录,手机号登录,用户名登录)
     if (!$userData['login_type']) {
         $userPassport = kernel::single('b2c_user_passport');
         $userData['login_type'] = $userPassport->get_login_account_type($userData['login_account']);
     }
     $filter = array('login_type' => $userData['login_type'], 'login_account' => $userData['login_account']);
     $account = app::get('pam')->model('members')->getList('member_id,password_account,login_password,createtime', $filter);
     if (!$account) {
         $msg = app::get('pam')->_('用户名或密码错误');
         return false;
     }
     $login_password = pam_encrypt::get_encrypted_password($userData['login_password'], 'member', array('createtime' => $account[0]['createtime'], 'login_name' => $account[0]['password_account']));
     if ($account[0]['login_password'] != $login_password) {
         $msg = app::get('pam')->_('用户名或密码错误');
         return false;
     }
     return $account[0]['member_id'];
 }