Example #1
1
 * @twitter     http://twitter.com/samplugins
 */
require_once "include/init.php";
$id = (int) $_GET['id'];
$oDonation = new modDonations(MySql::Instance());
$is_pop = 1;
if (CommonFunc::isPost()) {
    $is_pop = (int) $_POST['is_pop'];
    $id = (int) $_POST['id'];
    if ($_POST['action'] == 'update_status') {
        $payment_status = $_POST['payment_status'];
        $r = $oDonation->UpdateStatus($payment_status, $id);
        if ($r) {
            CommonFunc::SetFlashMessage("" . CommonFunc::SUCCESS . "|Payment status updated successfully.");
        } else {
            CommonFunc::SetFlashMessage("" . CommonFunc::ERROR . "|Payment status updated successfully.");
        }
    }
}
include "web.parts/header.php";
?>
   <?php 
$request_data = $oDonation->Row($id);
if ($request_data['donation_id'] > 0) {
    ?>
     <?php 
    include "web.parts/donation_details.php";
    ?>
  
    <?php 
} else {
 public function preview()
 {
     if (CommonFunc::isAjax()) {
         $this->SaveDonationData();
         $this->_preview();
     }
 }
Example #3
0
 static function favoriteBoolean($appID, $userID, $isFavorite)
 {
     if (!is_bool($isFavorite)) {
         throw new ErrorException('Argument 3 passed to ' . __CLASS__ . '::' . __FUNCTION__ . '() that must be a boolean');
     }
     $linkKey = 'link_' . $appID;
     $userKey = 'user_' . $userID;
     $datetime = date('Y-m-d H:i:s');
     //哪些人收藏了app
     $appArray = CommonFunc::getRedis($linkKey, 'appFavorite');
     $memberArray = CommonFunc::getRedis($userKey, 'favorite');
     if ($isFavorite) {
         if (isset($memberArray[$appID])) {
             throw new ErrorException('你已经收藏过该App');
         }
         $appArray[$userID] = array('time' => $datetime);
         CommonFunc::setRedis($linkKey, 'appFavorite', $appArray);
         $memberArray[$appID] = array('appID' => $appID, 'time' => $datetime);
         CommonFunc::setRedis($userKey, 'favorite', $memberArray);
     } else {
         if (!isset($memberArray[$appID])) {
             throw new ErrorException('取消收藏失败');
         }
         if (isset($appArray[$userID])) {
             unset($appArray[$userID]);
             CommonFunc::setRedis($linkKey, 'appFavorite', $appArray);
         }
         if (isset($memberArray[$appID])) {
             unset($memberArray[$appID]);
             CommonFunc::setRedis($userKey, 'favorite', $memberArray);
         }
     }
     return true;
 }
Example #4
0
 public function actionIndex()
 {
     if (!CommonFunc::isMobile()) {
         throw new THttpException('', 404);
     }
     $mobile_type = CommonFunc::isAndroid() ? 'android' : 'ios';
     $this->render('share', array('mobile_type' => $mobile_type));
 }
Example #5
0
 public function appComment()
 {
     if (!$this->isNewRecord) {
         return;
     }
     $userKey = 'user_' . $this->AuthorId;
     $userRedisInfo = CommonFunc::getRedis($userKey);
     if (!isset($userRedisInfo['comment'])) {
         $userRedisInfo['comment'] = array();
     }
     if (!isset($userRedisInfo['comment'][$this->AppId])) {
         $userRedisInfo['comment'][$this->AppId] = $this->AppId;
         CommonFunc::setRedis($userKey, 'comment', $userRedisInfo['comment']);
         $deltaT = abs(time() - strtotime($this->appWhichReply->UpdateTime));
         $updateTime = explode(' ', $this->appWhichReply->UpdateTime);
         $dateObj = date_diff(date_create($updateTime[0]), date_create(date('Y-m-d')));
         $intervalDays = $dateObj->days + 1;
         if ($deltaT > 0 && $deltaT <= APP_COMMENT_IN_ONE_DAY) {
             $mostCommentPoint = APP_COMMENT_IN_ONE_DAY_MOSTCOMMENT_POINT;
         } elseif ($deltaT > APP_COMMENT_IN_ONE_DAY && $deltaT <= APP_COMMENT_IN_THREE_DAYS) {
             $mostCommentPoint = APP_COMMENT_IN_THREE_DAYS_MOSTCOMMENT_POINT;
         } elseif ($deltaT > APP_COMMENT_IN_THREE_DAYS && $deltaT <= APP_COMMENT_IN_ONE_WEEK) {
             $mostCommentPoint = APP_COMMENT_IN_ONE_WEEK_MOSTCOMMENT_POINT;
         } elseif ($deltaT > APP_COMMENT_IN_ONE_WEEK) {
             $mostCommentPoint = APP_COMMENT_OVER_ONE_WEEK_MOSTCOMMENT_POINT;
         }
         $this->appWhichReply->MostComment += $mostCommentPoint;
         $this->appWhichReply->FastUp += round($mostCommentPoint * 1.0 / $intervalDays, 2);
         $this->appWhichReply->Sort += APP_COMMENT_SORT_POINT;
         $this->appWhichReply->save();
     }
     $noticeUserArray = array();
     if (empty($this->Pid)) {
         //评论APP
         if ($this->appWhichReply->CommitUserId != $this->AuthorId) {
             $noticeUserArray[] = array('type' => 1, 'userId' => $this->appWhichReply->CommitUserId);
         }
     } else {
         $noticeUserArray[] = array('type' => 2, 'userId' => $this->ToAuthorId);
     }
     preg_match_all("/@(.*?)\\s/i", $this->Content, $matches);
     if (!empty($matches[1])) {
         $atUserArray = array_unique($matches[1]);
         foreach ($atUserArray as $atWho) {
             $user = User::model()->findByAttributes(array('UserName' => htmlspecialchars_decode($atWho)));
             $targetUserID = '';
             if ($user instanceof User) {
                 $targetUserID = $user->ID;
             }
             if ($targetUserID != $this->AuthorId && !empty($targetUserID)) {
                 $noticeUserArray[] = array('type' => 3, 'userId' => $targetUserID);
             }
         }
     }
     foreach ($noticeUserArray as $notice) {
         Notice::createNotice($notice['type'], $notice['userId'], '', $this->appWhichReply->Id, $this->Id);
     }
 }
Example #6
0
 /**
  * Возвращает сумму прописью
  * @author runcore
  * @uses morph(...)
  */
 public static function num2str($num, $txttype = 0)
 {
     $nul = 'ноль';
     $ten = array(array('', 'один', 'два', 'три', 'четыре', 'пять', 'шесть', 'семь', 'восемь', 'девять'), array('', 'одна', 'две', 'три', 'четыре', 'пять', 'шесть', 'семь', 'восемь', 'девять'));
     $a20 = array('десять', 'одиннадцать', 'двенадцать', 'тринадцать', 'четырнадцать', 'пятнадцать', 'шестнадцать', 'семнадцать', 'восемнадцать', 'девятнадцать');
     $tens = array(2 => 'двадцать', 'тридцать', 'сорок', 'пятьдесят', 'шестьдесят', 'семьдесят', 'восемьдесят', 'девяносто');
     $hundred = array('', 'сто', 'двести', 'триста', 'четыреста', 'пятьсот', 'шестьсот', 'семьсот', 'восемьсот', 'девятьсот');
     $unit = array(array('копейка', 'копейки', 'копеек', 1), array('рубль', 'рубля', 'рублей', 0), array('тысяча', 'тысячи', 'тысяч', 1), array('миллион', 'миллиона', 'миллионов', 0), array('миллиард', 'милиарда', 'миллиардов', 0));
     $names = array(array('наименование', 'наименования', 'наимеменований', 0), array('', '', '', 0));
     //
     list($rub, $kop) = explode('.', sprintf("%015.2f", floatval($num)));
     $out = array();
     if (intval($rub) > 0) {
         foreach (str_split($rub, 3) as $uk => $v) {
             // by 3 symbols
             if (!intval($v)) {
                 continue;
             }
             $uk = sizeof($unit) - $uk - 1;
             // unit key
             $gender = $unit[$uk][3];
             list($i1, $i2, $i3) = array_map('intval', str_split($v, 1));
             // mega-logic
             $out[] = $hundred[$i1];
             # 1xx-9xx
             if ($i2 > 1) {
                 $out[] = $tens[$i2] . ' ' . $ten[$gender][$i3];
             } else {
                 $out[] = $i2 > 0 ? $a20[$i3] : $ten[$gender][$i3];
             }
             # 10-19 | 1-9
             // units without rub & kop
             if ($uk > 1) {
                 $out[] = CommonFunc::morph($v, $unit[$uk][0], $unit[$uk][1], $unit[$uk][2]);
             }
         }
         //foreach
     } else {
         $out[] = $nul;
     }
     if ($txttype == 0) {
         $out[] = CommonFunc::morph(intval($rub), $unit[1][0], $unit[1][1], $unit[1][2]);
         // rub
         $out[] = $kop . ' ' . CommonFunc::morph($kop, $unit[0][0], $unit[0][1], $unit[0][2]);
         // kop
     } elseif ($txttype == 1) {
         $out[] = CommonFunc::morph(intval($rub), $names[0][0], $names[0][1], $names[0][2]);
         // rub
     } elseif ($txttype == 2) {
         $out[] = CommonFunc::morph(intval($rub), $names[1][0], $names[1][1], $names[1][2]);
         // rub
     }
     return trim(preg_replace('/ {2,}/', ' ', join(' ', $out)));
 }
Example #7
0
 /**
  * 通过用户传递的信息进行处理
  * @param $obj 微信穿过来的XML数据
  * @return void
  */
 public function doProcess($obj)
 {
     $this->userName = strval($obj->FromUserName);
     $this->accountName = strval($obj->ToUserName);
     $this->openID = strval($obj->FromUserName);
     //检查用户是否已经在这个账户下,如果没有则插入到库里,返回库里的ID
     $this->userID = CommonFunc::checkUser($this->openID);
     //判断用户发过来的信息类型
     //不同的类型放到不同的数据表里
     switch (strtolower($obj->MsgType)) {
         case 'text':
             $this->processResponse($obj->Content, 'text');
             break;
         case 'image':
             break;
         case 'link':
             break;
         case 'voice':
             break;
         case 'location':
             break;
         case 'event':
             $event = strtolower($obj->Event);
             if ($event == 'click' || $event == 'view') {
                 //自定义菜单的事件太多,需要单独存放,以后有了自定义菜单完善这里
                 $model = new MsgReceiveEventMenu();
             } else {
                 //
                 $model = new MsgReceiveEvent();
             }
             $model->type = $event;
             if (isset($obj->EventKey)) {
                 $_a = explode('_', $obj->EventKey);
                 if (count($_a) > 1) {
                     $model->eventKey = intval($_a[1]);
                 } else {
                     $model->eventKey = $obj->EventKey;
                 }
             }
             $model->opt_id = Yii::app()->user->opt_id;
             $model->userID = $this->userID;
             $model->createTime = date('Y-m-d H:i:s', intval($obj->CreateTime));
             $model->save();
             //对用户做响应
             $this->processResponse($model, strtolower($obj->MsgType));
             break;
         default:
             return;
     }
 }
Example #8
0
 public function actionList()
 {
     $order = isset($_POST['order']) ? $_POST['order'] : 1;
     $order = CommonFunc::checkIntParam($order, 4, 1);
     $type = isset($_POST['type']) ? $_POST['type'] : '';
     $type = CommonFunc::checkIntParam($type, 2, '');
     $search = isset($_POST['search']) ? $_POST['search'] : '';
     $category = isset($_POST['category']) ? $_POST['category'] : '';
     $category = CommonFunc::checkIntParam($category, Category::getMaxCategory(), '');
     $maxId = isset($_POST['maxid']) ? $_POST['maxid'] : 0;
     $page = isset($_POST['page']) ? $_POST['page'] : 0;
     if (!$maxId) {
         $maxId = AppInfoList::getMaxId();
     }
     $appsInfo = AppInfoList::getData($order, $type, $search, $category, $_POST['page'] * 25, 25, $maxId);
     echo new ReturnInfo(RET_SUC, array('list' => $appsInfo['data'], 'maxid' => $maxId, 'pageCount' => $appsInfo['pageCount']));
 }
Example #9
0
 public function actionIndex()
 {
     $noticeModel = Notice::model();
     $targetUserid = Yii::app()->user->id;
     $msgs = $noticeModel->findAll(array('condition' => 'targetUserid =:targetUserid AND readFlag = 1', 'order' => 'createTime', 'params' => array(':targetUserid' => $targetUserid)));
     $noticeInfo = array();
     foreach ($msgs as $msg) {
         if ($msg->type == 0) {
             $noticeInfo[] = array('type' => $msg->type, 'msg' => $msg->msg, 'createTime' => $msg->createTime);
         } else {
             $appInfo = AppInfoList::model()->find(array('select' => 'Id, AppName', 'condition' => 'Id = :appId', 'params' => array(':appId' => $msg->appId)));
             $authorId = $msg->reviews->AuthorId;
             $noticeInfo[] = array('type' => $msg->type, 'msg' => $msg->reviews->Content, 'createTime' => $msg->createTime, 'appName' => $appInfo->AppName, 'appID' => $appInfo->Id, 'authorName' => htmlspecialchars(CommonFunc::getRedis('user_' . $authorId, 'userName')), 'authorID' => $authorId);
         }
     }
     $noticeModel->updateAll(array('readFlag' => '0'), 'targetUserid = :targetUserid', array(':targetUserid' => $targetUserid));
     $this->render('msg', array('msg' => $noticeInfo));
 }
Example #10
0
<?php

/**
 * Login Checker
 *
 * @author      Sam Plugins <*****@*****.**>
 * @copyright   Sam Plugins <*****@*****.**>
 * @twitter     http://twitter.com/samplugins
 */
require_once "include/init.php";
if (CommonFunc::isPost()) {
    $Login = new Login(MySql::Instance());
    if ($Login->loginCheck(CommonFunc::safe($_POST['username']), CommonFunc::safe($_POST['password']))) {
        echo "<script>window.location='donations.php'</script>";
    } else {
        $_SESSION['login-flash'] = "" . CommonFunc::ERROR . "|Invalid username and/or password";
        echo "<script>window.location='login.php'</script>";
    }
}
<?php

$oDonation = new modDonations(MySql::Instance());
$donation_data = $oDonation->getPendingDonationData(session_id());
$donation_id = (int) $donation_data['donation_id'];
$q = CommonFunc::security_question();
$style_form = '';
$style_preview_form = ' style="display:none;"';
$preview_applicable = false;
$security_code = '';
if ($donation_id > 0 && isset($_GET['p']) && $_GET['p'] == 1) {
    $style_preview_form = '';
    $style_form = ' style="display:none;"';
    $preview_applicable = true;
    $security_code = $q['a'];
}
?>

    <div id="div_donation_form"<?php 
echo $style_form;
?>
>
        <div id="donate_response_div" class="reponse_div no_display"></div>
        <form method="post" id="donate_form" action="php/preview-process.php" class="WebForm">
            <h2>Your Details</h2>

            <p>
                    <label>First Name <em>*</em> <em id="err_first_name" class="error">required</em></label>
                <span><input type="text" id="first_name" value="<?php 
echo $donation_data['first_name'];
?>
Example #12
0
        ?>
                                    </div>
                                </div>
                            </div>
                            <div class="pull-right col-md-4">
                                <a href="javascript:;" class="phone">
                                    <img src="/img/<?php 
        echo strtolower($app['OS']) . 'Grey';
        ?>
.png" />
                                </a>
                                <a href="/user/myzone?memberid=<?php 
        echo $app['commitUser'];
        ?>
" class="img user-thumbnail" target="_blank" _username="******">
                                    <img src="<?php 
        echo $app['userurl'];
        ?>
" class="img-circle" width="30px;" />
                                </a>
                            </div>
                            <div class="shareDateString">分享于 <?php 
        echo $app['CommitTime'];
        ?>
</div>
                        </div>
                        </div>
                    </dd>
Example #13
0
 * @copyright   Sam Plugins <*****@*****.**>
 * @twitter     http://twitter.com/samplugins
 */
require_once "include/init.php";
if (CommonFunc::isPost()) {
    $oDonation = new modDonations(MySql::Instance());
    $dataset = array();
    if (isset($_POST['export_all_csv']) && $_POST['export_all_csv'] != '') {
        $dataset = $oDonation->CSVDataset();
    } else {
        if (isset($_POST['export_selected']) && $_POST['export_selected'] != '') {
            if (count($_POST['donation_ids']) == 0) {
                CommonFunc::SetFlashMessage('error', "Please select at least one record to export.");
                header("Location: donations.php?" . $_POST['qstr'] . "");
            }
            $dataset = $oDonation->CSVDataset($_POST['donation_ids']);
        } else {
            if (isset($_POST['export_all_visible']) && $_POST['export_all_visible'] != '') {
                if (count($_POST['donation_ids']) == 0) {
                    CommonFunc::SetFlashMessage('error', "No visible records to export.");
                    header("Location: donations.php?" . $_POST['qstr'] . "");
                }
                $dataset = $oDonation->CSVDataset($_POST['visible_donation_ids']);
            }
        }
    }
    $csv = new clsCSV(",", "\n");
    $csv->Export($dataset, "donations-" . CommonFunc::CurrentDateFileName() . ".csv");
} else {
    echo "Invalid request!";
}
Example #14
0
 public function actionFakeShare()
 {
     $this->_log->setLogFile('share.log');
     if ($this->_isFake(self::SHARE_NUM_MIN, self::SHARE_NUM_MAX)) {
         $hasFilteredModel = AppHasFiltered::model()->findAll(array('condition' => 'Status=1', 'order' => new CDbExpression('RAND()'), 'limit' => 1));
         if (!$hasFilteredModel || !$hasFilteredModel[0]) {
             return;
         }
         $userId = $this->_getRandomUserId();
         if (!$userId) {
             return;
         }
         $hasFiltered = $hasFilteredModel[0];
         $date = date('Y-m-d H:i:s');
         $appInfoModel = new AppInfoList();
         $appInfoModel->PushId = $hasFiltered->PushId;
         $appInfoModel->AppId = $hasFiltered->AppId;
         $appInfoModel->SourceId = $hasFiltered->SourceId;
         $appInfoModel->AppName = $hasFiltered->AppName;
         $appInfoModel->MainCategory = $hasFiltered->MainCategory;
         $appInfoModel->CommitUserId = $userId;
         $appInfoModel->IconUrl = $hasFiltered->IconUrl;
         $appInfoModel->AppUrl = $hasFiltered->AppUrl;
         $appInfoModel->ScreenShoot = $hasFiltered->ScreenShoot;
         $appInfoModel->VideoUrl = $hasFiltered->VideoUrl;
         $appInfoModel->UpdateTime = $date;
         $appInfoModel->CommitTime = $date;
         $appInfoModel->OfficialWeb = $hasFiltered->OfficialWeb;
         $appInfoModel->AppInfo = $hasFiltered->AppInfo;
         $appInfoModel->ApkUrl = $hasFiltered->ApkUrl;
         $appInfoModel->Sort = $appInfoModel->model()->getMaxSort() + 1;
         $appInfoModel->ShareType = 1;
         $hasFiltered->Status = 0;
         $transaction = Yii::app()->db->beginTransaction();
         try {
             if (!$appInfoModel->save() || !$hasFiltered->save()) {
                 throw new Exception();
             }
             $this->_log->log('userId#' . $userId . '#于#' . $date . '#分享App PushId#' . $hasFiltered->PushId . '#');
             $transaction->commit();
         } catch (Exception $e) {
             $transaction->rollBack();
         }
         //线上请求baidu sitemap api
         if (CommonFunc::getProjectEnv() == 'online') {
             $this->baiduSiteMap($appInfoModel->Id);
         }
     }
 }
Example #15
0
 */
ob_start();
session_start();
include "php/include/common.php";
include "php/include/init.php";
$oDonation = new modDonations(MySql::Instance());
$donation_id = (int) $_GET['d'];
if ($donation_id == 0 || !isset($_SESSION['did'])) {
    CommonFunc::redirect(DonationConfig::get('site_url'));
}
$donation_data = $oDonation->Row($donation_id);
if ($donation_data['donation_id'] == 0) {
    CommonFunc::redirect(DonationConfig::get('site_url'));
} else {
    if ($donation_data['donation_id'] > 0 && !in_array($donation_data['donation_id'], (array) $_SESSION['did'])) {
        CommonFunc::redirect(DonationConfig::get('site_url'));
    }
}
$messageData = array();
if ($donation_data['status_id'] == clsAbstractStatusCodes::COMPLETED) {
    $messageData = array('heading' => 'Thank you!', 'message' => 'Payment has been processed successfully.');
} else {
    if ($donation_data['status_id'] == clsAbstractStatusCodes::PENDING_REVIEW) {
        $messageData = array('heading' => 'Thank you!', 'message' => 'Payment needs to be reviewed.');
    } else {
        $messageData = array('heading' => 'Thank you for your request.', 'message' => 'Your request has been submitted successfully. Payment Status: <strong>' . ucfirst($donation_data['status_id']) . '</strong>');
    }
}
$msgs = modMessages::Instance()->render();
if ($msgs != '') {
    $messageData['message'] = $msgs;
Example #16
0
 public function actionMyFavorite()
 {
     $userID = Yii::app()->user->id;
     if (!empty($userID)) {
         $userKey = 'user_' . $userID;
         $interactionApp = CommonFunc::getRedis($userKey, 'favorite');
         $interactionAppIds = array_keys($interactionApp);
         $data = AppInfoList::getInteractionApp($userID, $interactionAppIds);
         $this->render('myfavorite', array('data' => $data));
     } else {
         throw new THttpException('请登陆后再查看');
     }
 }
Example #17
0
 function getSQL($data = array())
 {
     $sql = "SELECT d.* FROM donations d ";
     $sql .= " WHERE d.donation_id > 0";
     if (isset($data['donation_id']) && $data['donation_id'] != "") {
         $sql .= " AND d.donation_id = '" . (int) $data['donation_id'] . "'";
     }
     if (isset($data['amount']) && $data['amount'] != "") {
         $sql .= " AND d.amount = '" . CommonFunc::safe($data['amount']) . "'";
     }
     if (isset($data['status_id']) && $data['status_id'] != "") {
         $sql .= " AND d.status_id = '" . CommonFunc::safe($data['status_id']) . "'";
     }
     if (isset($data['first_name']) && $data['first_name'] != "") {
         $sql .= " AND d.first_name like '%" . CommonFunc::safe($data['first_name']) . "%'";
     }
     if (isset($data['last_name']) && $data['last_name'] != "") {
         $sql .= " AND d.last_name like '%" . CommonFunc::safe($data['last_name']) . "%'";
     }
     if (isset($data['email']) && $data['email'] != "") {
         $sql .= " AND d.email = '" . CommonFunc::safe($data['email']) . "'";
     }
     if (isset($data['date_from']) && $data['date_from'] != "") {
         $sql .= " AND  STR_TO_DATE(d.donation_date,'%Y-%m-%d') >= '" . CommonFunc::safe($data['date_from']) . "'";
     }
     if (isset($data['date_to']) && $data['date_to'] != "") {
         $sql .= " AND  STR_TO_DATE(d.donation_date,'%Y-%m-%d') <= '" . CommonFunc::safe($data['date_to']) . "'";
     }
     if (isset($data['order_by']) && $data['order_by'] != '' && $this->isValidOrderField($data['order_by'])) {
         $sql .= " ORDER BY d." . $data['order_by'] . " ";
     } else {
         $sql .= " ORDER BY d.donation_id ";
     }
     if (isset($data['order_direction']) && ($data['order_direction'] == 'asc' || $data['order_direction'] == 'desc')) {
         $sql .= " " . $data['order_direction'] . " ";
     } else {
         $sql .= " DESC ";
     }
     return $sql;
 }
Example #18
0
 static function getLikedPeople(array $arr, $start, $length = 50)
 {
     $likedPeople = array_slice($arr, $start, $length);
     $likedPeopleArray = array();
     foreach ($likedPeople as $key => $value) {
         $upUserRedis = CommonFunc::getRedis('user_' . $value['ID']);
         if (!isset($upUserRedis['userHeadUrl']) || !isset($upUserRedis['userName'])) {
             $userModal = User::model()->findByPk($value['ID']);
         }
         $likedPeopleArray[] = array('userId' => $value['ID'], 'userurl' => !isset($upUserRedis['userHeadUrl']) || $upUserRedis['userHeadUrl'] === '' ? $userModal->Icon : $upUserRedis['userHeadUrl'], 'username' => !isset($upUserRedis['userName']) || $upUserRedis['userName'] === '' ? htmlspecialchars($userModal->UserName) : htmlspecialchars($upUserRedis['userName']));
     }
     return $likedPeopleArray;
 }
Example #19
0
 /**
  * 检测微信用户是否在这个广告主的账户下
  * @param $openID 用户的微信原始ID
  * @return void
  */
 static function checkUser($openID, $aUser = array())
 {
     if (empty($openID)) {
         $openID = $aUser['openid'];
         $_aUser = WeixinApi::getUserInfo($openID);
         $aUser['subscribe'] = $_aUser['subscribe'];
     } else {
         $aUser = WeixinApi::getUserInfo($openID);
     }
     //用 unionid取数据,和微信登录统一用户
     $unionID = $aUser['unionid'];
     $user = User::model()->findByAttributes(array('unionid' => $unionID));
     if ($user) {
         if ($aUser['nickname'] !== '' && $user->NickName == $user->UserName && !User::checkUserName($aUser['nickname'])) {
             $user->UserName = $aUser['nickname'];
         }
         $user->NickName = $aUser['nickname'];
         $user->Icon = $aUser['headimgurl'];
         $user->IsFollow = $aUser['subscribe'];
         //微信登录的用户,这个字段为空
         $user->Openid = $openID;
         if ($user->save()) {
             //更新redis
             CommonFunc::setRedis('user_' . $user->ID, 'userHeadUrl', $aUser['headimgurl']);
             CommonFunc::setRedis('user_' . $user->ID, 'userName', $user->UserName);
             return $user->ID;
         } else {
             Yii::log(__FILE__ . __LINE__ . 'insert fans error', 'error', 'system.api.weixin');
         }
     } else {
         $model_user = new User();
         if ($aUser['nickname'] === '') {
             $aUser['nickname'] = 'name_' . time();
         }
         $model_user->Account = $aUser['nickname'];
         $model_user->NickName = $aUser['nickname'];
         $model_user->UserName = $aUser['nickname'];
         if (User::checkUserName($aUser['nickname'])) {
             $model_user->UserName = $aUser['nickname'] . '_' . time();
         }
         $model_user->Openid = $openID;
         $model_user->Icon = $aUser['headimgurl'];
         $model_user->unionid = $aUser['unionid'];
         $model_user->CreateTime = date('Y-m-d H:i:s');
         $model_user->Status = 0;
         $model_user->LastLoginTime = date('Y-m-d H:i:s');
         $model_user->IsFollow = $aUser['subscribe'];
         if ($model_user->save()) {
             CommonFunc::setRedis('user_' . $model_user->ID, 'userHeadUrl', $aUser['headimgurl']);
             CommonFunc::setRedis('user_' . $model_user->ID, 'userName', $model_user->UserName);
             return $model_user->ID;
         } else {
             Yii::log(__FILE__ . __LINE__ . 'insert fans error', 'error', 'system.api.weixin');
         }
     }
     Yii::app()->end();
 }
Example #20
0
                </div>
                <ul>
                    <?php 
    foreach (array_reverse($reply['children']) as $appc) {
        ?>
                    <li id="comment_<?php 
        echo $appc['Id'];
        ?>
">
                        <div class="comment-line comment-comment">
                            <div class="good-people">
                                <a href="/user/myzone?memberid=<?php 
        echo $appc['AuthorId'];
        ?>
" class="img user-thumbnail" target="_blank" _username="******">
                                    <img src="<?php 
        echo $appc['AuthorIcon'];
        ?>
'" class="img-circle"/>
                                </a>
                            </div>
                            <a href="/user/myzone?memberid=<?php 
        echo $appc['AuthorId'];
        ?>
" class="aTagWrapName" target="_blank" id="aTag" title="<?php 
        echo $appc['AuthorName'];
        ?>
" ><?php 
Example #21
0
 public function getData($order)
 {
     $offset = isset($_GET['offset']) ? $_GET['offset'] : 0;
     $limit = isset($_GET['limit']) ? $_GET['limit'] : 10;
     if (!is_numeric($offset) || !is_numeric($limit)) {
         return new ReturnInfo(RET_ERROR, 'offset or limit parameter error');
     }
     $offset = (int) $offset;
     $limit = (int) $limit;
     if ($offset < 0 || $limit < 0) {
         return new ReturnInfo(RET_ERROR, 'offset or limit parameter error');
     }
     $maxId = isset($_GET['maxid']) ? $_GET['maxid'] : 0;
     if (!is_numeric($maxId)) {
         return new ReturnInfo(RET_ERROR, 'maxid parameter error');
     }
     $maxId = (int) $maxId;
     $type = isset($_GET['type']) ? $_GET['type'] : 0;
     $type = CommonFunc::checkIntParam($type, 2, '');
     $search = isset($_GET['search']) ? $_GET['search'] : '';
     $category = isset($_GET['category']) ? $_GET['category'] : '';
     $category = CommonFunc::checkIntParam($category, Category::getMaxCategory(), '');
     $appsInfo = AppInfoList::getData($order, $type, $search, $category, $offset * $limit, $limit, $maxId);
     return new ReturnInfo(RET_SUC, array('offset' => $offset, 'data' => $appsInfo['data']));
 }
Example #22
0
 public function actionAlertAppInfoListCategory()
 {
     $mainCategory = Yii::app()->request->getParam('main_category');
     $subcategory = Yii::app()->request->getParam('subcategory');
     $mainCategory = CommonFunc::checkIntParam($mainCategory, Category::getMaxCategory(), '');
     $categoryModel = new Category();
     $systemCategory = $categoryModel->category;
     if (!isset($systemCategory[$mainCategory])) {
         throw new THttpException('一级分类有误');
     }
     if (!in_array($subcategory, explode(',', $systemCategory[$mainCategory]['value']))) {
         throw new THttpException('子分类有误');
     }
     $app = AppInfoList::model()->findByPk(Yii::app()->request->getParam('appID'));
     if (!$app instanceof AppInfoList) {
         throw new THttpException('应用ID有误');
     }
     $app->MainCategory = $subcategory;
     if ($app->save()) {
         echo new ReturnInfo(0, 1);
     } else {
         throw new THttpException('修改失败');
     }
 }
Example #23
0
 private function _getLikedRealUser($appId)
 {
     $likedRealUser = array();
     $likedUser = CommonFunc::getRedis('link_' . $appId);
     if ($likedUser) {
         foreach ($likedUser as $key => $value) {
             if (!isset($value['status']) || $value['status'] == 0) {
                 $likedRealUser[] = $key;
             }
         }
     }
     return $likedRealUser;
 }
          <td width="80%"><?php 
echo strtoupper($request_data['payment_method']);
?>
</td>
    </tr> 
    <tr class="datarow_even">
          <td width="20%"><label>Payment Status</label></td>
          <td width="80%"><?php 
echo strtoupper($request_data['status_id']);
?>
 
              <?php 
if ($request_data['status_updated_on'] != '0000-00-00 00:00:00') {
    ?>
                - <small><?php 
    echo CommonFunc::getFormatedDateTime($request_data['status_updated_on']);
    ?>
</small>
              <?php 
}
?>
      </td>
    </tr> 
    <?php 
if ($request_data['donation_transaction_data'] != '') {
    $txn_data = (array) json_decode($request_data['donation_transaction_data']);
    ?>
      <tr class="tbltoprow">
        <td colspan="2"><?php 
    echo strtoupper($request_data['payment_method']);
    ?>
<?php

/**
 * View Request Details
 *
 * @author      Sam Plugins <*****@*****.**>
 * @copyright   Sam Plugins <*****@*****.**>
 * @twitter     http://twitter.com/samplugins
 */
require_once "include/init.php";
if (CommonFunc::isPost() && CommonFunc::isAjax()) {
    include 'include/class.passwordform.handler.php';
    $handler = new clsPasswordFormHandler($config, $_POST);
    $handler->handle();
    exit;
}
$is_pop = 1;
include "web.parts/header.php";
?>

     <?php 
include "web.parts/password.form.php";
?>
  

<?php 
include "web.parts/footer.php";
Example #26
0
 <?php echo Yii::app()->numberFormatter->formatCurrency($resv, ''); ?>
  </td>
  </tr><tr>
  <td style="border:0px;width:670px;" <?php echo ($dis==0 ? "colspan='5'":"colspan='7'"); ?>>
    <div style="font-weight:bold;font-size:10pt;text-align:right;padding-right:5px;">Всего:</div>  
  </td>
  <td style="font-weight:bold;font-size:10pt;text-align:right;border:0px;">
  <?php echo Yii::app()->numberFormatter->formatCurrency($rest, ''); ?>

  </td>

 </tr>
</tbody></table>
 
<div>Всего наименований <?php echo $totcount ?> на сумму <?php echo Yii::app()->numberFormatter->formatCurrency($rest, ''); ?> руб.</div>
<div style="font-weight: bold;font-size: 12pt;"><?php echo CommonFunc::num2str($rest); ?></div>
<div style="font-style: italic ;font-size: 12pt;">С Вашей организацией работает <?php echo $model->account['name']; ?></div>
<div style="position: relative;">
<div style="font-size: 8pt;width:700px;">
    <ol>
   <li>Настоящий договор является офертой договора поставки указанной в счете</li>
<li>Заключение договора (акцепт) производится путем оплаты счета безналичным способом</li>
<li>Срок действия оферты (Срок оплаты настящего счета) 20 (двадцать) дней</li>
<li>Предоплата по данному счету 100%</li>
<li>Срок поставки продукции после получения предоплаты 30 дней</li>
<li> Под поставкой подразумевается самовывоз Покупателем продукции со склада поставщика или дата передачи продукции транспортной компании, указанной в пункте 6.1
    <ol>
 <li>Транспортная компания <?php echo $model->rtransport['name']; ?> </li>   
 <li>Покупатель несет ответственность за правильность предоставленных Поставщику отгрузочных реквизитов. </li>   
    </ol>
 </li>   
Example #27
0
 public function actionGetLikedPeople()
 {
     if (isset($_POST['appID']) && isset($_POST['start'])) {
         $userArray = CommonFunc::getRedis('link_' . $_POST['appID'], 'user');
         if (!empty($userArray)) {
             echo new ReturnInfo(RET_SUC, AppInfoList::getLikedPeople($userArray, $_POST['start']));
             return;
         }
     }
     echo new ReturnInfo(-1, '网络连接超时,请稍后重试!');
     return;
 }
Example #28
0
 public function actionMyFavorite()
 {
     $userID = Yii::app()->getRequest()->getQuery('memberid');
     //$this->apiUser->ID;
     if (!empty($userID)) {
         $userKey = 'user_' . $userID;
         $interactionApp = CommonFunc::getRedis($userKey, 'favorite');
         $interactionAppIds = array_keys($interactionApp);
         $data = AppInfoList::getInteractionApp($userID, $interactionAppIds);
         echo new ReturnInfo(RET_SUC, $data);
     } else {
         echo new ReturnInfo(RET_ERROR, '请登陆后再查看');
     }
 }
Example #29
0
                    <td style="border:2px solid;width:80px;margin-bottom:2px;"></td> 
                </tr>    
                <tr>
                    <td></td> <td style="font-size: 6.5px; text-align: center;">прописью</td> <td></td> 
                </tr>    
            </table>
         </td>
    </tr>            
</tbody></table> 
<table width="100%" class="footer">  
    <tbody><tr>
        <td style="border-right:1px solid;width:50%;">
<div style="display:inline;">Приложение (паспорта, сертификаты и т.п) на</div><div style="display:inline;">  _________________</div> <div style="display:inline;">листах</div>
        <div style="font-size: 6.5pt; padding-left: 270px; background-color: transparent;">прописью</div>
<div style="font-weight:bold;margin-bottom:5px;">Всего отпущено <?php echo CommonFunc::num2str($totnum,1); ?><br>на сумму 
<?php echo CommonFunc::num2str($counts['gtotsumvat']); ?>
</div>
<table style="width:100%;" cellspacing="1">
    <tbody><tr>
        <td style="text-align:left;width:130px;"><div>Отпуск разрешил</div></td>
        <td style="text-align:center;width:150px;"> <?php echo $dep['man_p']; ?></td>
        <td style="text-align:left;width:80px;">&nbsp;</td>
        <td style="text-align:center;"><div style="background-color: transparent;">
               <?php echo $dep['man_n']; ?>
                </div></td>
   </tr>
    <tr>
        <td align="left" style="font-size:6.5pt;">&nbsp;</td>
        <td style="padding:0px;padding-left:3px;padding-right:3px;">
            <div style="border-top:1px solid;font-size:6.5pt;text-align:center;">должность</div></td>
        <td style="padding:0px 3px;">
Example #30
0
        ?>
' class="check_radio" /></td>
            <td align="left"><?php 
        echo $donation['first_name'];
        ?>
</td>
            <td align="left"><?php 
        echo $donation['last_name'];
        ?>
</td>
            <td align="center"><?php 
        echo $donation['email'];
        ?>
</td>  
            <td align="center"><?php 
        echo CommonFunc::getFormatedDateTime($donation['donation_date']);
        ?>
</td>
            <td align="center"><?php 
        echo $donation['amount'];
        ?>
</td>
            <td align="center"><?php 
        echo ucWords($donation['status_id']);
        ?>
</td>
   
            <td align="center">
                <a title="View" onclick="return GB_showFullScreen('Request#<?php 
        echo $donation['donation_id'];
        ?>