Inheritance: extends Eloquent
 public static function run()
 {
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $webuser = new WebUser($_POST);
         if ($webuser->getErrorCount() == 0) {
             if (!empty(WebUserDB::getUsersBy('hockName', $webuser->getHockName()))) {
                 $webuser->setError('hockName', 'HOCKUSER_NAMECLAIMED');
                 SignupView::show($webuser);
             } else {
                 //create a webuser in db
                 $id = WebUserDB::addUser($webuser);
                 if ($id != 0) {
                     //find the hockuser related to this dude
                     $hockusers = HockUserDB::getUsersBy('name', $webuser->getHockName());
                     ProfileView::show($webuser, $hockusers[0]);
                     //HomeView::show();
                 } else {
                     $webuser->setError('userName', 'DBERROR_ADDWEBUSER');
                     SignupView::show($webuser);
                 }
             }
         } else {
             SignupView::show($webuser);
         }
     } else {
         // Initial link
         SignupView::show(null);
     }
 }
 public static function run()
 {
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $webuser = new WebUser($_POST);
         if ($webuser->getErrorCount() == 0) {
             if (!empty(WebUserDB::getUsersBy('hockName', $webuser->getHockName()))) {
                 $webuser->setError('hockName', 'HOCKUSER_NAMECLAIMED');
                 SignupView::show($webuser);
             } else {
                 //create a webuser in db
                 $id = WebUserDB::addUser($webuser);
                 if ($id != 0) {
                     $base = array_key_exists('base', $_SESSION) ? $_SESSION['base'] : "";
                     //find the hockuser related to this dude
                     //$hockusers = HockUserDB::getUsersBy('name', $webuser->getHockName());
                     header("Location: /" . $base . "/user/show/" . $webuser->getHockName());
                     UserController::show();
                     //ProfileView::show($webuser, $hockusers[0]);//HomeView::show();
                 } else {
                     $webuser->setError('userName', 'DBERROR_ADDWEBUSER');
                     SignupView::show($webuser);
                 }
             }
         } else {
             SignupView::show($webuser);
         }
     } else {
         // Initial link
         SignupView::show(null);
     }
 }
Example #3
0
 /**
  * get instance
  *
  * Falls die einzige Instanz noch nicht existiert, erstelle sie
  * Gebe die einzige Instanz dann zurück
  *
  * @return   Singleton
  */
 public static function getInstance()
 {
     if (null === self::$_instance) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
 protected function beforeAction()
 {
     if (!Yii::app()->user->isGuest && !WebUser::checkHash() && Yii::app()->controller->id != 'login') {
         $this->redirect(Yii::app()->createUrl('login/logout'));
     }
     return true;
 }
Example #5
0
 /**
  * Performs access check for this user.
  * @param string $operation the name of the operation that need access check.
  * @param array $params name-value pairs that would be passed to business rules associated
  * with the tasks and roles assigned to the user.
  * @param boolean $allowCaching whether to allow caching the result of access check.
  * @return boolean whether the operations can be performed by this user.
  */
 public function checkAccess($operation, $params = array(), $allowCaching = true)
 {
     if ($this->getIsAdmin()) {
         return true;
     }
     return parent::checkAccess($operation, $params, $allowCaching);
 }
Example #6
0
 public function authenticate($admin_panel = false)
 {
     $user = User::model()->findByAttributes(array("email" => $this->username));
     if (!$user || $user->password != md5($this->password)) {
         $this->errorCode = self::ERROR_UNKNOWN;
         return;
     }
     switch ($user->status) {
         case User::STATUS_ACTIVE:
             $this->errorCode = self::ERROR_NONE;
             $this->_id = $user->id;
             if ($this->remember_me) {
                 Yii::app()->user->login($this, 3600 * 24 * 7);
             } else {
                 Yii::app()->user->login($this);
             }
             break;
         case User::STATUS_BLOCKED:
             $this->errorCode = self::ERROR_BLOCKED;
             break;
         case User::STATUS_NEW:
             $this->errorCode = self::ERROR_NOT_ACTIVE;
             break;
     }
     if (!$this->errorCode && $admin_panel) {
         WebUser::setRole($user->role);
         if (!RbacModule::isAllow('Admin_Main')) {
             Yii::app()->user->logout();
             $this->errorCode = self::ERROR_UNKNOWN;
             return false;
         }
     }
     return !$this->errorCode;
 }
 public function authenticate()
 {
     $user = UsersAR::model()->find('login=:login', array(':login' => $this->username));
     if ($user == null || $user->count() == 0) {
         $this->errorMessage = "Ошибка авторизации. Указанный Вами e-mail не зарегистриован.";
         $this->errorCode = false;
     } elseif ($user->count() > 1) {
         $this->errorMessage = "Ошибка авторизации. Проверьте правильность e-mail или пароля.";
         $this->errorCode = false;
         //Отправить админу письмо о косяке
     } elseif ($user->count() == 1) {
         if ($user->password == Utils::secretString($this->password . $user->salt)) {
             $code = Utils::secretString(Utils::generateCode());
             $user->hash = $code;
             $user->save();
             WebUser::setUserCookies(array(WebUser::$cookiesIdName => $user->id, WebUser::$cookiesHashName => $user->hash));
             $this->_id = $user->id;
             $this->errorCode = true;
         } else {
             $this->errorMessage = "Ошибка авторизации. Проверьте правильность e-mail или пароля.";
             $this->errorCode = false;
         }
     }
     return $this->errorCode;
 }
Example #8
0
 public function getWhiteLabelId()
 {
     if (ViewsTrack::isDev()) {
         return 3;
     }
     return parent::getWhiteLabelId();
 }
 /**
  * @return Users
  */
 public static function getModel()
 {
     $model = self::$model;
     if (empty($model)) {
         $model = Users::model()->getUserById(Yii::app()->user->id);
         self::$model = $model;
     }
     return self::$model;
 }
Example #10
0
 public function authUser($username, $pwd)
 {
     $record = WebUser::model()->find('(LOWER(u_name)=?) and u_status=?', array(strtolower($username), Constants::USER_APPROVAL));
     if ($record === null) {
         return false;
     } else {
         if ($record->u_password == md5($pwd)) {
             return array('id' => $record->u_id, 'name' => $record->u_name, 'qid' => $record->u_qid, 'group' => $record->u_group);
         } else {
             return false;
         }
     }
 }
Example #11
0
 /**
  * HANDLING THE WHITE LABEL ACCOUNTS
  */
 public function getWhiteLabelId()
 {
     if ($this->isLoggedIn()) {
         // called from siteadmin
         if ($this->isSuperadmin()) {
             // for superadmin get default White Label Id
             return $this->getDefaultWhiteLabelId();
         } else {
             // get account of the logged user
             return $this->model->wlabel_id;
         }
     } else {
         return parent::getWhiteLabelId();
     }
 }
 /**
  * Retrieves a list of models based on the current search/filter conditions.
  *
  * Typical usecase:
  * - Initialize the model fields with values from filter form.
  * - Execute this method to get CActiveDataProvider instance which will filter
  * models according to data in model fields.
  * - Pass data provider to CGridView, CListView or any similar widget.
  *
  * @return CActiveDataProvider the data provider that can return the models
  * based on the search/filter conditions.
  */
 public function search()
 {
     // @todo Please modify the following code to remove attributes that should not be searched.
     $criteria = new CDbCriteria();
     $criteria->compare('id', $this->id, true);
     $criteria->compare('user_id', $this->user_id, true);
     $criteria->compare('name', $this->name, true);
     $criteria->compare('date_create', $this->date_create, true);
     $criteria->compare('ignored', $this->ignored, true);
     if (!WebUser::isAdmin()) {
         $criteria->compare('user_id', WebUser::Id());
     }
     $criteria->order = 'user_id, ignored DESC, name';
     return new CActiveDataProvider($this, array('criteria' => $criteria));
 }
 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     if (!WebUser::isAdmin()) {
         if (WebUser::Id() != $id) {
             throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.');
         }
     }
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Users'])) {
         $model->attributes = $_POST['Users'];
         $model->password = CPasswordHelper::hashPassword(trim($model->password));
         if ($model->save()) {
             $this->setFlashSuccess('User password for <strong>' . $model->username . '</strong> successfully changed');
             $this->redirect(array('admin'));
         }
     }
     $this->render('update', array('model' => $model));
 }
Example #14
0
 /**
  * Get the WebUser
  *
  * @param unknown_type $username
  * @return WebUser
  */
 public function getUser($username = null)
 {
     if ($username === null) {
         return new WebUser($this);
     }
     if (!($userAccount = Core::getUser() instanceof UserAccount ? Core::getUser() : UserAccount::getUserByUsername($username)) instanceof UserAccount) {
         return null;
     }
     $user = new WebUser($this);
     $user->setUserAccount($userAccount);
     $user->setName($userAccount->getUsername());
     $user->setIsGuest(false);
     $user->setRoles($userAccount->getRoles());
     return $user;
 }
 function actionAuthWebUser()
 {
     header('Content-type: application/json');
     if (!IjoyPlusServiceUtils::validateAPPKey()) {
         IjoyPlusServiceUtils::exportServiceError(Constants::APP_KEY_INVALID);
         return;
     }
     if (IjoyPlusServiceUtils::validateUserID()) {
         IjoyPlusServiceUtils::exportServiceError(Constants::USER_ID_INVALID);
         return;
     }
     $name = Yii::app()->request->getParam("name");
     $pwd = Yii::app()->request->getParam("pwd");
     if (!isset($name) || is_null($name)) {
         IjoyPlusServiceUtils::exportServiceError(Constants::PARAM_IS_INVALID);
         return;
     }
     if (!isset($pwd) || is_null($pwd)) {
         IjoyPlusServiceUtils::exportServiceError(Constants::PARAM_IS_INVALID);
         return;
     }
     $webUser = WebUser::model()->authUser($name, $pwd);
     if ($webUser === false) {
         IjoyPlusServiceUtils::exportServiceError(Constants::OBJECT_NOT_FOUND);
         return;
     } else {
         IjoyPlusServiceUtils::exportEntity($webUser);
     }
 }
Example #16
0
 public function getLanguagesUrl($faculty, $lang)
 {
     $WU = new WebUser();
     $model = $WU->getUserModel();
     if (empty($model->syspk) || empty($model->syspk->printIP)) {
         throw new Exception("Необхідно визначити адресу серверу друку документів!");
     }
     $ip = $model->syspk->printIP;
     $_faculty = Facultets::model()->find("idFacultet={$faculty}");
     $_lang = Languages::model()->find("idLanguages={$lang}");
     if (empty($_faculty) || empty($_lang) && $lang != '0') {
         throw new Exception("Помилка вхідних даних!");
     }
     return "http://" . $ip . ":8080/request_report-1.0/language.jsp?faculty={$faculty}&lang={$lang}&iframe=true&width=1024&height=600";
 }
Example #17
0
echo Yii::app()->request->baseUrl;
?>
/js/bootstrap-datepicker.js"></script>
        <script type="text/javascript" src="<?php 
echo Yii::app()->request->baseUrl;
?>
/js/spin.min.js"></script>
        <script type="text/javascript" src="<?php 
echo Yii::app()->request->baseUrl;
?>
/js/blockUI.js"></script>
        
        
        
       
</head>

<body>
    <?php 
$pkname = WebUser::getPkName();
$this->widget('bootstrap.widgets.TbNavbar', array('brand' => 'ЗНУ (Абітурієнт)', 'brandUrl' => array('/site/index'), 'collapse' => true, 'items' => array(array('class' => 'bootstrap.widgets.TbMenu', 'items' => array(array('label' => 'Рейтинги', 'url' => array('/rating'), "icon" => "icon-list"), array('label' => 'Контакти', 'url' => array('/site/contact'), "icon" => "icon-envelope", 'visible' => Yii::app()->user->isGuest), array('label' => 'Довідники', 'visible' => Yii::app()->user->checkAccess('showDirectiries'), 'url' => '#', "icon" => "icon-book", 'items' => Directories::listMenu()), array('label' => 'Звіти', 'visible' => Yii::app()->user->checkAccess('showReports'), 'url' => Yii::app()->createUrl('statistic'), "icon" => "icon-book"), array('label' => 'Відомісті', 'visible' => Yii::app()->user->checkAccess('showStatements'), 'url' => Yii::app()->createUrl('preuniversity/statements'), "icon" => "icon-book"))), array('class' => 'bootstrap.widgets.TbMenu', 'htmlOptions' => array('class' => 'pull-right'), 'items' => array(array('label' => 'Налаштування', 'visible' => Yii::app()->user->checkAccess('showProperties'), 'url' => "#", "icon" => "icon-wrench", 'items' => array(array('label' => 'Користувачі', 'url' => Yii::app()->createUrl("user"), "icon" => " icon-user"), array('label' => 'Групи користувачів', 'url' => Yii::app()->createUrl("srbac"), "icon" => "icon-lock"), array('label' => 'Керування довідниками', 'url' => Yii::app()->createUrl("directories"), "icon" => "icon-pencil"))), array('label' => 'Авторизуватися', 'url' => array('/site/login'), 'visible' => Yii::app()->user->isGuest, 'icon' => "icon-user"), array('label' => 'Вийти з системи (' . Yii::app()->user->name . (empty($pkname) ? "" : "/" . $pkname) . ')', 'url' => array('/site/logout'), 'visible' => !Yii::app()->user->isGuest, 'icon' => "icon-user"))))));
?>
       <div style="margin: 0 auto; padding: 50px; width: 90%;">
        <?php 
echo $content;
?>
       </div><!-- page -->

</body>
</html>
Example #18
0
 public static function updateUser()
 {
     // Process updating of user information
     $authenticatedUser = array_key_exists('authenticatedUser', $_SESSION) ? $_SESSION['authenticatedUser'] : null;
     $users = WebUserDB::getUsersBy('hockName', $_SESSION['arguments']);
     if (empty($users)) {
         UserController::showHome();
     } elseif ($_SERVER["REQUEST_METHOD"] == "GET") {
         $_SESSION['webuser'] = $users[0];
         $user = $users[0];
         if (!is_null($authenticatedUser)) {
             if (strcmp($user->getUserName(), $authenticatedUser->getUserName()) == 0) {
                 UserView::showUpdate();
             } else {
                 UserController::showHome();
             }
         } else {
             UserController::showHome();
         }
     } else {
         $user = $_SESSION['webuser'];
         if (!is_null($authenticatedUser)) {
             if (strcmp($user->getUserName(), $authenticatedUser->getUserName()) == 0) {
                 //$oldpw = (array_key_exists('oldPassword', $_POST))?$_POST['oldPassword']:null;
                 $parms = $users[0]->getParameters();
                 //if(is_null($oldpw) || strcmp($oldpw, $parms['password'])
                 //This is set up so that any empty parameters in update will be ignored.
                 //Only things entered will actually be updated
                 //username
                 $parms['userName'] = array_key_exists('userName', $_POST) ? empty($_POST['userName']) ? $authenticatedUser->getUserName() : $_POST['userName'] : $authenticatedUser->getUserName();
                 //password
                 $parms['password'] = array_key_exists('password', $_POST) ? empty($_POST['password']) ? $authenticatedUser->getPassword() : $_POST['password'] : $authenticatedUser->getPassword();
                 //confirmedpw
                 $parms['confirmedpw'] = array_key_exists('confirmedpw', $_POST) ? empty($_POST['confirmedpw']) ? $authenticatedUser->getConfirmedPW() : $_POST['confirmedpw'] : $authenticatedUser->getConfirmedPW();
                 //email
                 $parms['email'] = array_key_exists('email', $_POST) ? empty($_POST['email']) ? $authenticatedUser->getEmail() : $_POST['email'] : $authenticatedUser->getEmail();
                 //url
                 $parms['url'] = array_key_exists('url', $_POST) ? empty($_POST['url']) ? $authenticatedUser->getURL() : $_POST['url'] : $authenticatedUser->getURL();
                 $user = new WebUser($parms);
                 $user->setUserId($users[0]->getUserId());
                 $user = WebUserDB::updateUser($user);
                 if ($user->getErrorCount() != 0) {
                     $_SESSION['webuser'] = $user;
                     UserView::showUpdate();
                 } else {
                     $_SESSION['authenticatedUser'] = $user;
                     UserController::showHome();
                 }
             } else {
                 UserController::showHome();
             }
         } else {
             UserController::showHome();
         }
     }
 }
Example #19
0
$model->only_new = WebUser::isGuest() ? 0 : $model->only_new;
$chb_only_new = CHtml::activeCheckBox($model, 'only_new', array('id' => 'checkbox-only-new'));
$text = Yii::t('sniper_ebay', 'Only new results');
echo CHtml::label($text . ' ' . $chb_only_new, 'checkbox-only-new');
?>
                    </td>
                </tr>
                <tr class="<?php 
echo WebUser::isGuest() ? 'hidden' : '';
?>
">
                    <td>
                        <?php 
$chb_ignored_list = CHtml::activeCheckBox($model, 'ignore_list', array('id' => 'checkbox-ignored-list'));
$text = Yii::t('sniper_ebay', 'Use ignore list');
$ignore_list = ListingNames::model()->getUserIgnoreList(WebUser::Id());
echo CHtml::label($text . ' ' . $chb_ignored_list, 'checkbox-ignored-list');
echo CHtml::link('Browse', array('/listing/index', 'id' => $ignore_list->id), array('target' => '_blank'));
?>
                    </td>
                </tr>
                <tr>
                    <td>
                        <?php 
echo CHtml::submitButton(Yii::t('sniper_ebay', 'Start Search'), array('class' => 'btn btn-primary'));
?>
                    </td>
                </tr>
            </table>
        </form>
    </div>
 public function actionListing($id)
 {
     //array $request = array()
     $request = $this->loadModel($id);
     if ($request->user_id != WebUser::Id(true)) {
         throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.');
     }
     $atributes = $request->attributes;
     $atributes['auction_type'] = SearchRequests::model()->getAuctionType($request->auction_type_id);
     $searchApi = new FindItemsAdvancedClass($atributes);
     $items_ignored = array();
     if ($request->only_new) {
         $items_ignored = $request->items;
     } elseif ($request->ignore_list) {
         $list = ListingNames::model()->getUserIgnoreList(WebUser::Id());
         $items_ignored = $list->items;
     }
     if (!empty($items_ignored)) {
         $ignore_ids = CHtml::listData($items_ignored, 'id', 'ebay_id');
         $searchApi->setIgnoreIds($ignore_ids);
     }
     try {
         $items = $searchApi->makeAPICall();
         $ebay_ids = array();
         $items_attrs = array();
         $date = time();
         foreach ($items as $_item) {
             $items_attrs[] = array('ebay_id' => $_item->itemId, 'title' => $_item->title, 'url_picture' => $_item->pictureUrl, 'url_item' => $_item->itemUrl, 'buy_it_now' => intval($_item->buyItNow > 0), 'date_of_added' => $date);
             $ebay_ids[] = $_item->itemId;
         }
         SearchItems::model()->saveMultipleIgnore($items_attrs);
         SearchRequests::model()->addItemsToRequest($id, $ebay_ids);
     } catch (Exception $ex) {
         $this->setFlashWarning($ex->getMessage());
         $items = $searchApi->getItems();
     }
     if (empty($items)) {
         $this->setFlashError($searchApi->getError());
     }
     $data = array('items' => $items, 'request' => $request);
     $this->enableAddToListBtn();
     $this->render('listing', $data);
 }
Example #21
0
 public function login($identity, $duration = 0)
 {
     $this->_identity = $identity;
     return parent::login($identity, $duration);
 }
 private function initMenu()
 {
     $this->main_menu = array(array('label' => 'Home', 'url' => array('/site/index')), array('label' => 'Search', 'url' => array('/search/index')), array('label' => 'Lists', 'url' => array('/listing/index'), 'visible' => !WebUser::isGuest()), array('label' => '|', 'url' => '#', 'visible' => !WebUser::isGuest()), array('label' => 'Users', 'url' => array('/users/admin'), 'visible' => WebUser::isAdmin()), array('label' => 'Profile', 'url' => array('/users/update', 'id' => WebUser::Id()), 'visible' => !WebUser::isGuest()), array('label' => '|', 'url' => '#', 'visible' => !WebUser::isGuest()), array('label' => 'Login', 'url' => array('/site/login'), 'visible' => WebUser::isGuest()), array('label' => 'Register', 'url' => array('/site/register'), 'visible' => WebUser::isGuest()), array('label' => 'Logout (' . Yii::app()->user->name . ')', 'url' => array('/site/logout'), 'visible' => !WebUser::isGuest()));
 }
Example #23
0
 /**
  * 图片管理列表 SKU版
  **/
 function manageSKU()
 {
     $ret = array('status' => 0, 'msg' => '', 'Website_template' => $this->Website_template);
     try {
         $page = Yii::app()->request->getParam("page");
         $sort = Yii::app()->request->getParam("sort");
         $Auditing = Yii::app()->request->getParam("Auditing");
         //审核状态
         $category = Yii::app()->request->getParam("category");
         //分类
         $order_date = Yii::app()->request->getParam("order_date");
         //订单时间
         $search_type = Yii::app()->request->getParam("search_type");
         //搜索类别
         $search_val = Yii::app()->request->getParam("search_val");
         //搜索内容
         $patform_val = Yii::app()->request->getParam("patform_val");
         //平台
         if (empty($page)) {
             $page = 1;
         }
         if (empty($sort)) {
             $sort = 'down';
         }
         $ret['sort'] = $sort;
         $ret['search_val'] = $search_val;
         //搜索内容
         $ret['search_type'] = $search_type;
         //搜索类别
         $ret['Auditing'] = $Auditing;
         //审核状态
         $ret['category'] = $category;
         //分类
         $ret['order_date'] = $order_date;
         //订单时间
         $ret['patform_val'] = $patform_val;
         //平台筛选
         $limit = 20;
         //获取用户信息
         $user_ret = WebUser::getusersall('beu_users.id=' . $_SESSION['user_id']);
         if ($user_ret['status'] == 0) {
             throw new Exception($user_ret['msg']);
         }
         unset($user_ret['data'][0]['pwd']);
         $ret['user'] = $user_ret['data'][0];
         //获取品牌名
         $brand_ret = Brand::brandSelectById($_SESSION['brandid']);
         if (count($brand_ret) == 0) {
             throw new Exception('');
         }
         $ret['user']['brandname'] = $brand_ret[0]['name'];
         //获取平台ID
         $patform = new patformclass();
         $patform_ret = $patform->select_erp_patform();
         //获取所有平台
         $cut_detaile = new cut_detaileclass();
         $cut_ret = $cut_detaile->select_erp_cut_detaile($_SESSION['brandid']);
         //获取品牌所有的裁剪模版
         $patform_to_cut = array();
         foreach ($cut_ret as $value) {
             foreach ($patform_ret as $p_value) {
                 if ($value['patformid'] == $p_value['id']) {
                     $patform_to_cut[$p_value['name']] = $p_value['Englishname'] . '_' . $value['id'];
                 }
             }
         }
         $ret['patform'] = $patform_to_cut;
         $clothes_where_arr = array();
         //衣服列表查询条件
         if (!empty($order_date)) {
             $clothes_where_arr['startime'] = $order_date;
             $clothes_where_arr['endtime'] = $order_date;
         }
         if (!empty($category)) {
             $clothes_where_arr['brandcategoryid'] = $category;
         }
         if (!empty($Auditing)) {
             $clothes_where_arr['imagestatus'] = $Auditing;
         }
         if (!empty($search_val)) {
             if (empty($search_type)) {
                 $clothes_where_arr['search'] = array('sku' => 'like_%' . $search_val . '%', 'erp_order.ordername' => 'like_%' . $search_val . '%');
             } else {
                 if ($search_type == 'brandnumber') {
                     $clothes_where_arr['sku'] = 'like_%' . $search_val . '%';
                 } else {
                     $clothes_where_arr['erp_order.ordername'] = 'like_%' . $search_val . '%';
                 }
             }
         }
         if (!empty($ret['patform_val'])) {
             //平台筛选不为空 需要筛选
             $patform_val_arr = explode('_', $ret['patform_val']);
             $pushDetaile = new pushDetaileclass();
             $pushDetaile_ret = $pushDetaile->select_all_push($_SESSION['brandid'], array('cutid' => $patform_val_arr[1], 'distinct' => 'sku'));
             foreach ($pushDetaile_ret['data'] as $value) {
                 $sk_array[] = $value['count_sku'];
             }
             if (count($sk_array) > 0) {
                 $clothes_where_arr['sku' . ($patform_val_arr[2] == 0 ? '_not' : '')] = $sk_array;
             } elseif ($patform_val_arr[2] == 1) {
                 $clothes_where_arr['id'] = 0;
             }
         }
         $clothesorder = new clothesorderclass();
         $c_ret = $clothesorder->select_all_clothes($_SESSION['brandid'], 0, $clothes_where_arr, $limit, $limit * ($page - 1), $sort == 'down' ? 'erp_order.addtime desc' : 'erp_order.addtime asc', 'SKU');
         $SKU_array = array();
         //分页查询后的SKU数组
         $c_order_name = array();
         //订单序号
         //查询单品的图片
         $c_img_data = array();
         $SKU_key_arr = array();
         $SKU_date_arr = array();
         //用于二次排序
         foreach ($c_ret['data'] as $key => $value) {
             $c_img_data[$value['id']] = $value['sku'];
             $SKU_array[] = $value['sku'];
             $clothes_where_arr['sku'] = $SKU_array;
             $SKU_key_arr[$value['sku']] = array('key' => $key, 'o_addtime' => $value['o_addtime']);
             $SKU_date_arr[$key] = $value['o_addtime'];
         }
         //获取SKU对应的所有的SKC数据
         $c_skc_ret = $clothesorder->select_all_clothes($_SESSION['brandid'], 0, $clothes_where_arr, -1, -1);
         $Skc_img_data = array();
         $SKC_to_SKU = array();
         $Skc_img_num_data = array();
         //图片数量
         $SKU_order_data = array();
         //SKU对应的订单
         $SKU_order_date_data = array();
         //SKU对应的订单时间
         foreach ($c_skc_ret['data'] as $value) {
             $Skc_img_data[$value['id']] = array('url' => '', 'pcount' => 0, 'mcount' => 0, 'dcount' => 0, 'img_type' => -1, 'img_data' => '2035-12-31 00:00:00');
             $SKC_to_SKU[$value['sku']][] = $value['id'];
             $Skc_img_num_data[$value['id']] = array('pcount' => 0, 'mcount' => 0, 'dcount' => 0);
             $c_order_name[$value['orderid']] = $value['orderid'];
             if (!in_array($value['orderid'], $SKU_order_data[$value['sku']])) {
                 $SKU_order_data[$value['sku']][] = $value['orderid'];
                 $SKU_order_date_data[$value['sku']][] = $value['o_addtime'];
             }
         }
         //获取款号下所有图片
         $clothesimage = new clothesimageclass();
         $img_ret = $clothesimage->select_all_image(array_keys($Skc_img_data), -1, array('isshow' => 0), '', 'id asc');
         $img_ret_data = array();
         //将款号的图片统计到一起
         foreach ($img_ret as $value) {
             switch ($value->type) {
                 case 0:
                     $Skc_img_num_data[$value->clothes_order_id]['pcount']++;
                     $value->status == 0 ? $Skc_img_data[$value->clothes_order_id]['pcount']++ : '';
                     //灰模图
                     if (!empty($value->url) && !in_array($Skc_img_data[$value->clothes_order_id]['img_type'], array(0, 1)) && strtotime($Skc_img_data[$value->clothes_order_id]['img_data']) > strtotime($value->addtime)) {
                         $Skc_img_data[$value->clothes_order_id]['img_type'] = $value->type;
                         $Skc_img_data[$value->clothes_order_id]['url'] = $value->url;
                         $Skc_img_data[$value->clothes_order_id]['img_data'] = $value->addtime;
                     }
                     break;
                 case 1:
                     $Skc_img_num_data[$value->clothes_order_id]['pcount']++;
                     $value->status == 0 ? $Skc_img_data[$value->clothes_order_id]['pcount']++ : '';
                     //立体图
                     if (!empty($value->url) && !in_array($Skc_img_data[$value->clothes_order_id]['img_type'], array(1)) && strtotime($Skc_img_data[$value->clothes_order_id]['img_data']) > strtotime($value->addtime)) {
                         $Skc_img_data[$value->clothes_order_id]['img_type'] = $value->type;
                         $Skc_img_data[$value->clothes_order_id]['url'] = $value->url;
                         $Skc_img_data[$value->clothes_order_id]['img_data'] = $value->addtime;
                     }
                     break;
                 case 2:
                     $Skc_img_num_data[$value->clothes_order_id]['pcount']++;
                     $value->status == 0 ? $Skc_img_data[$value->clothes_order_id]['pcount']++ : '';
                     //静态图
                     if (!empty($value->url) && !in_array($Skc_img_data[$value->clothes_order_id]['img_type'], array(0, 1, 2)) && strtotime($Skc_img_data[$value->clothes_order_id]['img_data']) > strtotime($value->addtime)) {
                         $Skc_img_data[$value->clothes_order_id]['img_type'] = $value->type;
                         $Skc_img_data[$value->clothes_order_id]['url'] = $value->url;
                         $Skc_img_data[$value->clothes_order_id]['img_data'] = $value->addtime;
                     }
                     break;
                 case 3:
                     $Skc_img_num_data[$value->clothes_order_id]['mcount']++;
                     $value->status == 0 ? $Skc_img_data[$value->clothes_order_id]['mcount']++ : '';
                     //模特图
                     if (!empty($value->url) && !in_array($Skc_img_data[$value->clothes_order_id]['img_type'], array(0, 1, 2, 3)) && strtotime($Skc_img_data[$value->clothes_order_id]['img_data']) > strtotime($value->addtime)) {
                         $Skc_img_data[$value->clothes_order_id]['img_type'] = $value->type;
                         $Skc_img_data[$value->clothes_order_id]['url'] = $value->url;
                         $Skc_img_data[$value->clothes_order_id]['img_data'] = $value->addtime;
                     }
                     break;
                 case 4:
                     $Skc_img_num_data[$value->clothes_order_id]['dcount']++;
                     $value->status == 0 ? $Skc_img_data[$value->clothes_order_id]['dcount']++ : '';
                     //细节图
                     if (!empty($value->url) && !in_array($Skc_img_data[$value->clothes_order_id]['img_type'], array(0, 1, 2, 4)) && strtotime($Skc_img_data[$value->clothes_order_id]['img_data']) > strtotime($value->addtime)) {
                         $Skc_img_data[$value->clothes_order_id]['img_type'] = $value->type;
                         $Skc_img_data[$value->clothes_order_id]['url'] = $value->url;
                         $Skc_img_data[$value->clothes_order_id]['img_data'] = $value->addtime;
                     }
                     break;
             }
         }
         //统计SKU下未审核的图片数量
         foreach ($c_img_data as $key => $value) {
             $SKU_data = array('url' => '', 'pcount' => 0, 'mcount' => 0, 'dcount' => 0, 'img_type' => -1);
             foreach ($SKC_to_SKU[$value] as $SKC_key => $SKC_value) {
                 if (!empty($Skc_img_data[$SKC_value]['url'])) {
                     if ($Skc_img_data[$SKC_value]['img_type'] == 0 && !in_array($SKU_data['img_type'], array(0, 1)) || $Skc_img_data[$SKC_value]['img_type'] == 1 && !in_array($SKU_data['img_type'], array(1)) || $Skc_img_data[$SKC_value]['img_type'] == 2 && !in_array($SKU_data['img_type'], array(0, 1, 2)) || $Skc_img_data[$SKC_value]['img_type'] == 3 && !in_array($SKU_data['img_type'], array(0, 1, 2, 3)) || $Skc_img_data[$SKC_value]['img_type'] == 4 && !in_array($SKU_data['img_type'], array(0, 1, 2, 4))) {
                         $SKU_data['img_type'] = $Skc_img_data[$SKC_value]['img_type'];
                         $SKU_data['url'] = $Skc_img_data[$SKC_value]['url'];
                     }
                 }
                 $SKU_data['pcount'] += $Skc_img_data[$SKC_value]['pcount'];
                 $SKU_data['mcount'] += $Skc_img_data[$SKC_value]['mcount'];
                 $SKU_data['dcount'] += $Skc_img_data[$SKC_value]['dcount'];
             }
             $c_img_data[$key] = $SKU_data;
         }
         //统计SKU下图片数量
         foreach ($c_ret['data'] as $key => $value) {
             $c_ret['data'][$key]['pcount'] = 0;
             $c_ret['data'][$key]['mcount'] = 0;
             $c_ret['data'][$key]['dcount'] = 0;
             foreach ($SKC_to_SKU[$value['sku']] as $SKC_key => $SKC_value) {
                 $c_ret['data'][$key]['pcount'] += $Skc_img_num_data[$SKC_value]['pcount'];
                 $c_ret['data'][$key]['mcount'] += $Skc_img_num_data[$SKC_value]['mcount'];
                 $c_ret['data'][$key]['dcount'] += $Skc_img_num_data[$SKC_value]['dcount'];
             }
             $c_ret['data'][$key]['orderid'] = $SKU_order_data[$value['sku']];
             $c_ret['data'][$key]['o_addtime'] = $SKU_order_date_data[$value['sku']];
         }
         //获取分类
         $brandcategory = new brandcategoryclass();
         $b_ret = $brandcategory->select_category($_SESSION['brandid']);
         $b_data = array();
         if (count($b_ret) > 0) {
             foreach ($b_ret as $b_value) {
                 $b_data[$b_value->id] = $b_value->name;
             }
         }
         //分页
         $criteria = new CDbCriteria();
         $pages = new CPagination($c_ret['page_sum']);
         $pages->pageSize = $limit;
         $pages->applyLimit($criteria);
         //获取订单时间列表
         $order_date_list = orderclass::select_order_date($_SESSION['brandid']);
         //获取订单名
         $C_oreder_ret = orderclass::selectOrderNameByOrderID($_SESSION['brandid'], $c_order_name);
         foreach ($C_oreder_ret as $value) {
             $c_order_name[$value['id']] = $value['ordername'];
         }
         $qiniu = new erp_qiniu();
         //七牛的接口类
         $brand_qiniu_account = $qiniu->getAccountByBrand($_SESSION['brandid']);
         //获取品牌的七牛子账号信息
         if (count($brand_qiniu_account) == 0) {
             throw new Exception('品牌暂未绑定七牛帐号');
         }
         $ret['domain'] = $brand_qiniu_account[0]['domain'];
         $ret['order_date_list'] = $order_date_list;
         $ret['img_data'] = $c_img_data;
         $ret['category_data'] = $b_data;
         $ret['data'] = $c_ret['data'];
         $ret['order_name'] = $c_order_name;
         $ret['pages'] = $pages;
         if (count($c_ret['data']) == 0) {
             throw new Exception('查询无果');
         }
         $ret['status'] = 1;
     } catch (Exception $e) {
         $ret['mag'] = $e->getMessage();
     }
     $this->render('manage', $ret);
 }
Example #24
0
 /**
  * Indique si l'utilisateur est un administrateur du site ou pas.
  * Par défaut, il faut avoir l'attribut $superuser à true pour cela
  * @return bool
  * @internal Ne pas oublier de surcharger cette méthode dans myWebUser si on utilise un contrôle d'accès
  *           => on marque la méthode deprecated dans cette classe pour faire un rappel visuel dans PHPStorm
  * @deprecated
  */
 public function isAdmin()
 {
     if (self::$isAdmin !== null) {
         return self::$isAdmin;
     }
     $user = $this->getUser();
     if (!$user) {
         self::$isAdmin = false;
     } else {
         self::$isAdmin = $user->superuser === true;
     }
     return self::$isAdmin;
 }
Example #25
0
 private function get_user()
 {
     $this->user = WebUser::getInstance();
     $this->user->load($this);
 }
Example #26
0
 public function showpost($id, $name)
 {
     $id_len = strlen($id);
     $forum_id = substr($id, 0, 1);
     $thread_id = substr($id, 1, $id_len - 1);
     $thread = Thread::find($thread_id);
     $thread->view = $thread->view + 1.25;
     $thread->save();
     $view = ForumViewCount::find($forum_id);
     $view->view = $view->view + 1.25;
     $view->save();
     $seo['page'] = $thread->title;
     $seo['title'] = $thread->title;
     $seo['discription'] = 'discription of this page';
     $seo['forum'] = $forum_id;
     $posts = Post::where('thread_id', $thread_id)->orderBy('status', 'desc')->where('status', '>', 0)->orderBy('created_at', 'asc')->paginate(10);
     $user_id = Session::get('WebUserId');
     $data = array('webuser' => WebUser::find($user_id), 'seo' => $seo, 'thread' => $thread, 'forums' => HelperFunctions::forum_list(), 'posts' => $posts, 'page' => "Forum", 'id' => Session::get('idCok'), 'coin' => Session::get('coinCok'));
     return View::make('template.neon.post')->with($data);
 }
Example #27
0
 public static function setRole($role)
 {
     self::$_role = $role;
 }
Example #28
0
<div class="tools">
    <h5>Стройплощадка</h5>
	<p>Этот блог доступен:</p>
	<?php 
foreach (WebUser::getRoles("betatest") as $i => $login) {
    if ($i) {
        echo ", ";
    }
    echo "<a href='/users/go?login={$login}'>{$login}</a>";
}
?>
</div>
Example #29
0
<?php

/* @var $this SearchController */
/* @var $items EbayItem[] */
/* @var $request SearchRequests */
$this->actions_menu = array(array('label' => 'Create request', 'url' => array('/search/index')), array('label' => 'Update request', 'url' => array('/search/index', 'id' => $request->id)));
$listings = ListingNames::model()->getUserLists(WebUser::Id());
?>

<div class="row-fluid">
    <div class="span3 pull-right">
        <?php 
$data = array('', 'id' => 'Sort by id', 'id_desc' => 'Sort by id DESC', 'price' => 'Sort by price', 'price_desc' => 'Sort by price DESC', 'bin' => 'Sort by BuyItNow', 'bin_desc' => 'Sort by BuyItNow DESC', 'date_start' => 'Sort by start date', 'date_start_desc' => 'Sort by start date DESC', 'date_end' => 'Sort by end date', 'date_end_desc' => 'Sort by end date DESC');
echo CHtml::label('Sort', 'sort-order');
echo CHtml::dropDownList('sortOrder', 0, $data, array('id' => 'sort-order-list'));
?>
    </div>
</div>

<?php 
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'search-results-grid', 'dataProvider' => new CArrayDataProvider($items, array('pagination' => false)), 'template' => '{summary} {pager} {items} {pager}', 'afterAjaxUpdate' => 'setHandlers', 'pager' => array('class' => 'booster.widgets.TbPager', 'displayFirstAndLast' => true), 'htmlOptions' => array('class' => 'table-hover'), 'rowHtmlOptionsExpression' => 'array("data-item-id" => $data->itemId, "data-date-end" => $data->dateOfEnded, "data-date-start" => $data->dateOfAdded, "data-price" => $data->price, "data-bin" => $data->buyItNow)', 'columns' => array(array('header' => '<input type="checkbox" class="checkbox-all">', 'type' => 'raw', 'value' => function ($data) {
    /* @var $data EbayItem */
    $details = array('ebay_id' => $data->itemId, 'title' => $data->title, 'url_picture' => $data->pictureUrl, 'url_item' => $data->itemUrl, 'buy_it_now' => intval($data->buyItNow != -1), 'date_start' => $data->dateOfAdded, 'date_end' => $data->dateOfEnded, 'currency' => $data->currency);
    return CHtml::checkBox("EbayItems[id][]", false, array("data-id" => $data->itemId, 'class' => 'checkbox', 'value' => $data->itemId, 'data-details' => json_encode($details)));
}, 'footer' => '<input type="checkbox" class="checkbox-all">'), array('type' => 'raw', 'value' => function ($data) {
    /* @var $data EbayItem */
    $img = CHtml::image($data->pictureUrl, $data->title, array('class' => 'item-image'));
    return CHtml::link($img, $data->itemUrl, array('target' => '_blank'));
}, 'htmlOptions' => array('class' => 'item-image')), array('type' => 'raw', 'value' => function ($data) {
    /* @var $data EbayItem */
    $out = 'Item title: <span class="text-error">' . $data->title . '</span><br/>';
Example #30
0
 public function lastuser()
 {
     $user = WebUser::find($this->lastuser_id);
     return $user->username;
 }