当前位置: 首页>>代码示例>>PHP>>正文


PHP Model_Users::getUser方法代码示例

本文整理汇总了PHP中Model_Users::getUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_Users::getUser方法的具体用法?PHP Model_Users::getUser怎么用?PHP Model_Users::getUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Model_Users的用法示例。


在下文中一共展示了Model_Users::getUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get

 public function get()
 {
     if ($id = $this->getRequest()->getId()) {
         $this->getResponse()->setBody($this->users->getUser($id));
         return;
     }
     $fields = $this->getRequest()->getParam('fields', false);
     $where = $this->getRequest()->getParam('where', false);
     $order = $this->getRequest()->getParam('order', false);
     $count = $this->getRequest()->getParam('count', false);
     $onlyOnline = $this->getRequest()->getParam('online', false);
     $this->getResponse()->setBody($this->users->getUsers($fields, urldecode($where), $order, $count, $onlyOnline));
 }
开发者ID:AlphaStaxLLC,项目名称:opensimulatorapi,代码行数:13,代码来源:Users.php

示例2: getPercentRow

 public static function getPercentRow($user_id)
 {
     $user_data = Model_Users::getUser($user_id);
     if ($user_data && round($user_data['commission_percent']) > 0) {
         return array('percent' => floatval($user_data['commission_percent']), 'to' => 0);
     }
     $no_exclusive_author_percent = 30;
     if (JO_Registry::get('no_exclusive_author_percent')) {
         $no_exclusive_author_percent = (int) JO_Registry::get('no_exclusive_author_percent');
     }
     $exclusive_author_percent = 40;
     if (JO_Registry::get('exclusive_author_percent')) {
         $exclusive_author_percent = (int) JO_Registry::get('exclusive_author_percent');
     }
     if ($user_data['exclusive_author'] == 'false') {
         $percent = array('percent' => $no_exclusive_author_percent, 'to' => 0);
     } else {
         $db = JO_Db::getDefaultAdapter();
         $query = $db->select()->from(Model_Users::getPrefixDB() . 'percents')->where("`from` <= ? AND (`to` > ? OR `to` = 0)", $user_data['sold']);
         $results = $db->fetchRow($query);
         if (!$results) {
             $percent = array('percent' => $exclusive_author_percent, 'to' => 0);
         } else {
             $percent = $results;
         }
     }
     return $percent;
 }
开发者ID:noikiy,项目名称:PD,代码行数:28,代码来源:Percents.php

示例3: index

 function index()
 {
     $model = new Model_Users();
     $userInfo = $model->getUser(2);
     $this->template->vars('userInfo', $userInfo);
     $this->template->view('index');
 }
开发者ID:andxbes,项目名称:ArchetypePHPMVC,代码行数:7,代码来源:Index.php

示例4: createUser

 public static function createUser($data)
 {
     $db = JO_Db::getDefaultAdapter();
     if (!$data['username'] || Model_Users::getByUsername($data['username'])) {
         return false;
     }
     if (!$data['email'] || Model_Users::getByEmail($data['email'])) {
         return false;
     }
     $db->insert(Model_Users::getPrefixDB() . 'users', array('username' => $data['username'], 'password' => $data['password'], 'email' => $data['email'], 'firstname' => $data['firstname'], 'lastname' => $data['lastname'], 'firmname' => $data['firmname'], 'profile_title' => $data['profile_title'], 'profile_desc' => $data['profile_desc'], 'register_datetime' => $data['register_datetime'], 'status' => 'activate'));
     $user_id = $db->lastInsertId();
     if ($user_id) {
         $upload_path = BASE_PATH . '/uploads';
         $user_path = '/users/' . JO_Date::getInstance($data['register_datetime'], 'yy/mm/')->toString() . $user_id . '/';
         $upload_path .= $user_path;
         if ($data['avatar'] && @getimagesize($data['avatar'])) {
             $name = basename($data['avatar']);
             if (copy($data['avatar'], $upload_path . $name)) {
                 $db->update('users', array('avatar' => $user_path . $name), array('user_id' => $user_id));
             }
         }
         if ($data['homeimage'] && @getimagesize($data['homeimage'])) {
             $name = basename($data['homeimage']);
             if (copy($data['homeimage'], $upload_path . $name)) {
                 $db->update('users', array('homeimage' => $user_path . $name), array('user_id' => $user_id));
             }
         }
         return Model_Users::getUser($user_id);
     }
 }
开发者ID:noikiy,项目名称:PD,代码行数:30,代码来源:Singlesignon.php

示例5: indexAction

 public function indexAction()
 {
     $request = $this->getRequest();
     $rows = array('groups_pin_email', 'comments_email', 'likes_email', 'repins_email', 'follows_email', 'email_interval', 'digest_email', 'news_email');
     $user_data = Model_Users::getUser(JO_Session::get('user[user_id]'));
     if ($request->isPost()) {
         $update = array();
         foreach ($rows as $row) {
             $update[$row] = (int) $request->getRequest($row);
         }
         //			var_dump($update);exit;
         Model_Users::edit(JO_Session::get('user[user_id]'), $update);
         JO_Session::set('successfu_edite', true);
         $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=settings'));
     }
     $this->view->user_data = $user_data;
     $this->view->settings_href = WM_Router::create($request->getBaseUrl() . '?controller=settings');
     $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:19,代码来源:PrefsController.php

示例6: report

    public static function report($id)
    {
        if (!JO_Session::get('user_id')) {
            return false;
        }
        $info = self::get($id);
        if (!$info) {
            return;
        }
        $user = Model_Users::getUser($info['user_id']);
        if (!$user) {
            $user = array('username' => '');
        }
        $db = JO_Db::getDefaultAdapter();
        $db->update('items_comments', array('report_by' => JO_Session::get('user_id')), array('id = ?' => (int) $id));
        $request = JO_Request::getInstance();
        $domain = $request->getDomain();
        $translate = JO_Translate::getInstance();
        $mail = new JO_Mail();
        if (JO_Registry::get('mail_smtp')) {
            $mail->setSMTPParams(JO_Registry::forceGet('mail_smtp_host'), JO_Registry::forceGet('mail_smtp_port'), JO_Registry::forceGet('mail_smtp_user'), JO_Registry::forceGet('mail_smtp_password'));
        }
        $mail->setFrom('no-reply@' . $domain);
        $not_template = Model_Notification::getNotification('comment_report');
        $href = '<a href="' . WM_Router::create($request->getBaseUrl() . '?controller=items&action=comments&item_id=' . $info['item_id'] . '&filter=' . ($info['reply_to'] ? $info['reply_to'] : $info['id'])) . '">' . $info['item_name'] . '</a>';
        if ($not_template) {
            $title = $not_template['title'];
            $html = html_entity_decode($not_template['template'], ENT_QUOTES, 'utf-8');
            $html = str_replace('{USERNAME}', $user['username'], $html);
            $html = str_replace('{REPORT}', JO_Session::get('username'), $html);
            $html = str_replace('{URL}', $href, $html);
        } else {
            $title = "[" . $domain . "] " . $translate->translate('Have new reported comment');
            $html = nl2br(JO_Session::get('username') . '
					
			 =======================================
			' . $translate->translate('Report about irregularity in comment.'));
        }
        $mail->setSubject($title);
        $mail->setHTML($html);
        $mail->send(array(JO_Registry::get('report_mail')), JO_Registry::get('mail_smtp') ? 'smtp' : 'mail');
        return true;
    }
开发者ID:noikiy,项目名称:PD,代码行数:43,代码来源:Comments.php

示例7: getComments

 public static function getComments($data)
 {
     $db = JO_Db::getDefaultAdapter();
     $query = $db->select()->from('pins_comments');
     if (isset($data['filter_pin_id'])) {
         $query->where('pins_comments.pin_id = ?', (string) $data['filter_pin_id']);
     }
     if (isset($data['start']) && isset($data['limit'])) {
         if ($data['start'] < 0) {
             $data['start'] = 0;
         }
         $query->limit($data['limit'], $data['start']);
     }
     if (isset($data['sort']) && strtolower($data['sort']) == 'desc') {
         $sort = ' DESC';
     } else {
         $sort = ' ASC';
     }
     $allow_sort = array('pins_comments.comment_id');
     if (isset($data['order']) && in_array($data['order'], $allow_sort)) {
         $query->order($data['order'] . $sort);
     } else {
         $query->order('pins_comments.comment_id' . $sort);
     }
     $results = $db->fetchAll($query);
     $response = array();
     if ($results) {
         foreach ($results as $result) {
             $userdata = Model_Users::getUser($result['user_id'], false, Model_Users::$allowed_fields);
             if (!$userdata) {
                 $userdata = array('fullname' => '', 'avatar' => '', 'store' => 'local');
             }
             $result['user'] = $userdata;
             $response[] = $result;
         }
     }
     return $response;
 }
开发者ID:noikiy,项目名称:amatteur,代码行数:38,代码来源:Comments.php

示例8: statementAction

 public function statementAction()
 {
     $request = $this->getRequest();
     if (!JO_Session::get('user_id')) {
         JO_Session::set('msg_error', $this->translate('You must be logged to access that page!'));
         $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=login'));
     }
     $this->getLayout()->meta_title = $this->translate('Statement');
     $this->getLayout()->meta_description = $this->translate('Statement');
     $user = $this->view->users = Model_Users::getUser(JO_Session::get('user_id'));
     if (!$user) {
         return $this->forward('error', 'error404');
     }
     $this->view->crumbs = array(array('name' => $this->translate('Home'), 'href' => $request->getBaseUrl()), array('name' => $this->translate('Profile'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&username=' . $user['username'])), array('name' => $this->translate('Statement')));
     $user['total'] = WM_Currency::format($user['total']);
     $this->view->author_header = Helper_Author::authorHeader($user);
     $statements = Model_Orders::getStatement(JO_Session::get('user_id'));
     if ($statements) {
         $month = $statements[0]['month'];
         $cnt = count($statements);
         for ($i = 0; $i < $cnt; $i++) {
             if ($statements[$i]['type'] == 'deposit') {
                 $statements[$i]['price'] = WM_Currency::format($statements[$i]['price']);
                 $statements[$i]['details'] = $this->translate('Deposit money');
             } elseif ($statements[$i]['type'] == 'withdraw') {
                 $statements[$i]['price'] = WM_Currency::format(-$statements[$i]['price']);
                 $statements[$i]['details'] = $this->translate('Earning money');
             } elseif ($statements[$i]['type'] == 'order') {
                 if ($statements[$i]['user_id'] == JO_Session::get('user_id')) {
                     $statements[$i]['type'] = $this->translate('buy');
                     $statements[$i]['price'] = WM_Currency::format($statements[$i]['price']);
                 } else {
                     $statements[$i]['type'] = $this->translate('sale');
                     $statements[$i]['price'] = WM_Currency::format($statements[$i]['receive']);
                 }
                 $statements[$i]['details'] = $statements[$i]['item_name'];
             } elseif ($statements[$i]['type'] == 'referrals') {
                 if ($statements[$i]['item_name'] == 1) {
                     $statements[$i]['details'] = $this->translate('Referral / deposit');
                 } else {
                     $statements[$i]['details'] = $this->translate('Referral / sale');
                 }
                 $statements[$i]['price'] = WM_Currency::format($statements[$i]['price']);
             } elseif ($statements[$i]['type'] == 'membership') {
                 $statements[$i]['price'] = WM_Currency::format($statements[$i]['price']);
                 $statements[$i]['details'] = $this->translate('Membership money');
             }
             $this->view->statements[] = $statements[$i];
             if (isset($statements[$i + 1]['month']) && $month != $statements[$i + 1]['month']) {
                 $this->view->statements[] = array('month' => $statements[$i]['month'], 'total_earnings' => true);
                 $month = $statements[$i + 1]['month'];
             } elseif ($i == $cnt - 1) {
                 $this->view->statements[] = array('month' => $statements[$i]['month'], 'total_earnings' => true);
             }
         }
     }
     $this->view->statements = array_reverse($this->view->statements);
     $this->view->withdrawal_link = WM_Router::create($request->getBaseUrl() . '?controller=users&action=withdrawal');
     $this->view->settings_link = WM_Router::create($request->getBaseUrl() . '?controller=users&action=edit');
     $this->view->history_link = WM_Router::create($request->getBaseUrl() . '?controller=users&action=statement');
     $this->view->total_balance = $user['total'];
     $this->view->total_sales_cnt = JO_Session::get('sales');
     $this->view->percent = Model_Percentes::getPercentRow($user);
     $this->view->csv_link = WM_Router::create($request->getBaseUrl() . '?controller=users&action=csv_statement');
     $this->view->children = array();
     $this->view->children['header_part'] = 'layout/header_part';
     $this->view->children['footer_part'] = 'layout/footer_part';
 }
开发者ID:noikiy,项目名称:PD,代码行数:68,代码来源:UsersController.php

示例9: editAction

 public function editAction()
 {
     $request = $this->getRequest();
     if (JO_Session::get('user[user_id]')) {
         $board_id = $request->getRequest('board_id');
         $board_info = new Model_Boards_Board($board_id);
         if (!$board_info->count()) {
             $this->forward('error', 'error404');
         }
         if ($board_info['board_user_id'] != JO_Session::get('user[user_id]')) {
             $this->forward('error', 'error404');
         }
         $this->view->is_edit = true;
         if ($request->isPost()) {
             $validate = new Helper_Validate();
             $validate->_set_rules($request->getPost('newboard'), $this->translate('Board Name'), 'not_empty;min_length[3];max_length[100]');
             $validate->_set_rules($request->getPost('category_id'), $this->translate('Board Category'), 'not_empty');
             if ($validate->_valid_form()) {
                 $postData = array_merge($request->getPost(), array('title' => $request->getPost('newboard')));
                 if (Helper_Config::get('config_private_boards')) {
                     $postData['public'] = (int) (!$request->issetPost('public'));
                 }
                 $result = new Model_Boards_Edit($board_id, $postData);
                 if ($result->affected_rows) {
                     $this->view->redirect = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $board_info['board_user_id'] . '&board_id=' . $board_info['board_board_id']);
                 } else {
                     $this->view->error = $this->translate('There was a problem with the record. Please try again!');
                 }
             } else {
                 $this->view->error = $validate->_get_error_messages();
             }
             echo $this->renderScript('json');
         } else {
             $this->view->title = $board_info['board_title'];
             $this->view->category_id = $board_info['board_category_id'];
             $this->view->board_description = $board_info['board_description'];
             $this->view->another_users = array();
             $this->view->private = $board_info['board_public'];
             $this->view->board_id = $board_id;
             $b_users = $board_info['board_users_all'] ? explode(',', $board_info['board_users_all']) : array();
             if ($b_users) {
                 $board_users = new Model_Users_UsersInId($b_users);
                 if ($board_users->count()) {
                     foreach ($board_users as $user) {
                         $this->view->another_users[] = array('user_id' => $user['user_id'], 'avatars' => Helper_Uploadimages::userAvatars($user), 'fullname' => $user['fullname'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $user['user_id']));
                     }
                 }
             }
             $self = array();
             foreach ($board_info as $key => $data) {
                 if (strpos($key, 'user_') === 0) {
                     $self[substr($key, 5)] = $data;
                 }
             }
             $uin = Model_Users::getUser($board_info['user_id']);
             $this->view->avatars = Helper_Uploadimages::userAvatars($self);
             $this->view->fullname = $self['fullname'];
             $this->view->userhref = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $board_info['user_user_id']);
             $this->view->friends_href = WM_Router::create($request->getBaseUrl() . '?controller=users&action=friends');
             $this->view->form_action = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=edit&user_id=' . $board_info['user_user_id'] . '&board_id=' . $board_info['board_board_id']);
             $this->view->board_href = WM_Router::create($request->getBaseUrl() . '?controller=boards&user_id=' . $board_info['user_user_id'] . '&board_id=' . $board_info['board_board_id']);
             $this->view->board_delete = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=delete&user_id=' . $board_info['user_user_id'] . '&board_id=' . $board_info['board_board_id']);
             /////private boards
             $this->view->enable_private_boards = Helper_Config::get('config_private_boards');
             $private_boards = Model_Pages::getPage(Helper_Config::get('page_private_boards'));
             if ($private_boards) {
                 $this->view->text_private_boards = WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=pages&action=read&page_id=' . Helper_Config::get('page_private_boards'));
             }
             //////////// Categories ////////////
             $this->view->categories = Model_Categories::getCategories(array('filter_status' => 1));
             $this->view->config_board_description_enable = Helper_Config::get('config_board_description_enable');
             $this->view->popup_main_box = $this->view->render('popup_form', 'boards');
             $this->setViewChange('form');
             if ($request->isXmlHttpRequest()) {
                 $this->view->popup = true;
                 echo $this->view->popup_main_box;
                 $this->noViewRenderer(true);
             } else {
                 $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
             }
         }
     } else {
         if ($request->isXmlHttpRequest()) {
             $this->view->redirect = WM_Router::create($request->getBaseUrl() . '?controller=users&action=login');
             echo $this->renderScript('json');
         } else {
             $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=login'));
         }
     }
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:90,代码来源:BoardsController.php

示例10: getOriginallyPinned

 public static function getOriginallyPinned($user_id)
 {
     static $result = array(), $model_images = null, $request = null;
     if (isset($result[$user_id])) {
         return $result[$user_id];
     }
     if ($model_images === null) {
         $model_images = new Helper_Images();
     }
     if ($request === null) {
         $request = JO_Request::getInstance();
     }
     $pins = Model_Pins::getPins(array('filter_user_id' => $user_id, 'start' => 0, 'limit' => 6));
     $data = array();
     if ($pins) {
         foreach ($pins as $pin) {
             $image = Helper_Uploadimages::pin($pin, '_A');
             if ($image) {
                 $data[] = array('user' => Model_Users::getUser($user_id), 'thumb' => $image['image'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $pin['user_id']));
             }
         }
     }
     $result[$user_id] = $data;
     return $data;
 }
开发者ID:noikiy,项目名称:amatteur,代码行数:25,代码来源:Pin.php

示例11: uploadUserAvatar

 public static function uploadUserAvatar($avatar, $user_id = 0)
 {
     //try {
     if (($imageinfo = getimagesize($avatar)) !== false) {
         if (!file_exists(BASE_PATH . '/uploads/cache_avatars/' . $user_id) || !is_dir(BASE_PATH . '/uploads/cache_avatars/' . $user_id)) {
             @mkdir(BASE_PATH . '/uploads/cache_avatars/' . $user_id, 0777, true);
         }
         $ext = strtolower(strrchr($avatar, "."));
         if (!$ext) {
             $mime_ext = explode('/', $imageinfo['mime']);
             if (isset($mime_ext[1])) {
                 $ext = '.' . $mime_ext[1];
             }
         }
         $name = md5(time() . mt_rand()) . '_' . $user_id . $ext;
         if (@copy($avatar, BASE_PATH . '/uploads/cache_avatars/' . $user_id . '/' . $name)) {
             $added_date = time();
             if (is_array($user_info = Model_Users::getUser($user_id))) {
                 $added_date = $user_info['date_added'];
                 self::deleteUserImage($user_info);
             }
             $user_agent = ini_get('user_agent');
             ini_set('user_agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9');
             $container = 'amatteur_users';
             $auth = new JO_Api_Rackspace_Authentication(JO_Registry::get('rsUsername'), JO_Registry::get('rsApiKey'));
             if ($auth->authenticate()) {
                 $conn = new JO_Api_Rackspace_Connection($auth);
                 $contaners = $conn->list_public_containers();
                 if (!in_array($container, $contaners)) {
                     $conn->create_container($container);
                     $contaners[] = $container;
                 }
                 if ($contaners && in_array($container, $contaners)) {
                     $images = $conn->get_container($container);
                     $images->make_public(86400 * 365);
                     $images = $conn->get_container($container);
                     if (!$images->cdn_uri) {
                         return false;
                     }
                     $object = $images->create_object($name);
                     $object->load_from_filename(BASE_PATH . '/uploads/cache_avatars/' . $user_id . '/' . $name);
                     $image_info = $images->get_object($name);
                     if (!$image_info->name) {
                         return false;
                     }
                     $model_images = new Helper_Images();
                     $temp_width = 0;
                     $temp_height = 0;
                     $sizes = self::userThumbSizes();
                     if ($sizes) {
                         foreach ($sizes as $size => $prefix) {
                             $sizes = explode('x', $size);
                             $width = (int) isset($sizes[0]) ? $sizes[0] : 0;
                             $height = (int) isset($sizes[1]) ? $sizes[1] : 0;
                             $name_pref = basename($name, $ext) . $prefix . $ext;
                             if ($width && $height) {
                                 $thumb_a = $model_images->resize('/cache_avatars/' . $user_id . '/' . $name, $width, $height, true);
                             } else {
                                 if ($width && !$height) {
                                     $thumb_a = $model_images->resizeWidth('/cache_avatars/' . $user_id . '/' . $name, $width);
                                 } else {
                                     if ($height && !$width) {
                                         $thumb_a = $model_images->resizeHeight('/cache_avatars/' . $user_id . '/' . $name, $height);
                                     }
                                 }
                             }
                             if ($prefix == '_B') {
                                 $temp_width = $model_images->getSizes('width');
                                 $temp_height = $model_images->getSizes('height');
                             }
                             $thumb_a1 = explode('/uploads/', $thumb_a);
                             if ($thumb_a1 && isset($thumb_a1[1])) {
                                 $object = $images->create_object($name_pref);
                                 $object->load_from_filename(BASE_PATH . '/uploads/' . $thumb_a1[1]);
                             }
                         }
                     }
                     self::recursiveDelete(BASE_PATH . '/uploads/cache_avatars/' . $user_id . '/');
                     self::recursiveDelete(BASE_PATH . '/uploads/cache/cache_avatars/' . $user_id . '/');
                     if ($temp_width) {
                         return array('store' => 'rackspace', 'image' => $images->cdn_uri . '/' . $image_info->name, 'width' => $temp_width, 'height' => $temp_height);
                     }
                 }
             }
         }
     }
     return false;
     /*} catch (JO_Exception $e) {
     			return false;
     		}*/
     return false;
 }
开发者ID:noikiy,项目名称:amatteur,代码行数:92,代码来源:Rackspace.php

示例12: getBoard

 public static function getBoard($board_id, $allow = false)
 {
     static $result = array();
     if (isset($result[$board_id])) {
         return $result[$board_id];
     }
     $db = JO_Db::getDefaultAdapter();
     $query = $db->select()->from('boards')->where('boards.board_id = ?', (int) $board_id)->limit(1);
     $data = $db->fetchRow($query);
     if (!$data) {
         return false;
     }
     $data['pins_array'] = array();
     if (trim($data['latest_pins'])) {
         $data['pins_array'] = $db->fetchAll($db->select()->from('pins')->where("pin_id IN ('?')", new JO_Db_Expr(implode("','", explode(',', $data['latest_pins']))))->order($data['cover'] ? 'FIELD(pin_id, "' . $data['cover'] . '") DESC, pin_id DESC' : 'pin_id DESC')->limit(15));
     }
     $data['board_users'] = array();
     $boards_users = $db->fetchAll($db->select()->from('users_boards')->where("board_id = ?", (string) $board_id)->where('user_id != ?', $data['user_id'])->where($allow ? 'allow = 1' : '1=1'));
     if ($boards_users) {
         foreach ($boards_users as $u) {
             $ud = Model_Users::getUser($u['user_id'], true);
             if ($ud) {
                 $data['board_users'][] = $ud;
             }
         }
     }
     $result[$board_id] = $data;
     return $result[$board_id];
 }
开发者ID:noikiy,项目名称:amatteur,代码行数:29,代码来源:Boards.php

示例13: indexActivateAction

 public function indexActivateAction()
 {
     $request = $this->getRequest();
     $this->view->register_url = WM_Router::create($request->getBaseUrl() . '?controller=users&action=register');
     $this->view->activate_url = WM_Router::create($request->getBaseUrl() . '?controller=users&action=activate');
     $this->view->search_services = WM_Router::create($request->getBaseUrl() . '?controller=search&action=advanced?id=services');
     $this->view->search_activate = WM_Router::create($request->getBaseUrl() . '?controller=search&action=advanced?id=activate');
     $user_data = Model_Users::getUser(JO_Session::get('user[user_id]'));
     if ($user_data['type_user']) {
         $this->view->userCanActivate = Model_Users::getUserTypeNotOthers($user_data['type_user']);
     }
     $upload = new JO_Upload_SessionStore();
     $upload->setName('upload_avatar');
     $info = $upload->getFileInfo();
     if (JO_Session::get('successfu_edite')) {
         $this->view->successfu_edite = true;
         JO_Session::clear('successfu_edite');
     }
     $this->view->user_data = $user_data;
     $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
 }
开发者ID:noikiy,项目名称:amatteur,代码行数:21,代码来源:IndexController.php

示例14: getForm

 private function getForm()
 {
     $request = $this->getRequest();
     $user_id = $request->getQuery('id');
     $url = '';
     if ($request->getQuery('sort')) {
         $url .= '&sort=' . $request->getQuery('sort');
     }
     if ($request->getQuery('order')) {
         $url .= '&order=' . $request->getQuery('order');
     }
     if ($request->getQuery('page')) {
         $url .= '&page=' . $request->getQuery('page');
     }
     if ($request->getQuery('filter_id')) {
         $url .= '&filter_id=' . $request->getQuery('filter_id');
     }
     if ($request->getQuery('filter_username')) {
         $url .= '&filter_username=' . $request->getQuery('filter_username');
     }
     if ($request->getQuery('filter_items')) {
         $url .= '&filter_items=' . $request->getQuery('filter_items');
     }
     $this->view->cancel_url = $this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/users/?' . $url;
     $model_users = new Model_Users();
     $user_info = $model_users->getUser($user_id);
     $this->view->utypes = array('user' => $this->translate('User'), 'agency' => $this->translate('Agency'), 'employer' => $this->translate('Employer'));
     if ($user_info) {
         $this->view->user_id = $user_id;
         //$this->view->title = $user_info['title'];
         /*$this->view->type = $user_info['type'];*/
         /*$this->view->username = $user_info['username'];*/
         $this->view->names = $user_info['firstname'] . ' ' . $user_info['lastname'];
         /*$this->view->email = $user_info['email'];*/
         $this->view->status = $user_info['status'];
         $this->view->profile_url = WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=users&action=profile&user_id=' . $user_id);
     }
     if ($request->getPost('username')) {
         $this->view->username = $request->getPost('username');
     } elseif (isset($user_info)) {
         $this->view->username = $user_info['username'];
     } else {
         $this->view->username = '';
     }
     if ($request->getPost('email')) {
         $this->view->email = $request->getPost('email');
     } elseif (isset($user_info)) {
         $this->view->email = $user_info['email'];
     } else {
         $this->view->email = '';
     }
     if ($request->getPost('is_admin')) {
         $this->view->is_admin = $request->getPost('is_admin');
     } elseif (isset($user_info)) {
         $this->view->is_admin = $user_info['is_admin'];
     } else {
         $this->view->is_admin = '';
     }
     if ($request->getPost('is_developer')) {
         $this->view->is_developer = $request->getPost('is_developer');
     } elseif (isset($user_info)) {
         $this->view->is_developer = $user_info['is_developer'];
     } else {
         $this->view->is_developer = '';
     }
     if ($request->getPost('firstname')) {
         $this->view->firstname = $request->getPost('firstname');
     } elseif (isset($user_info)) {
         $this->view->firstname = $user_info['firstname'];
     } else {
         $this->view->firstname = '';
     }
     if ($request->getPost('lastname')) {
         $this->view->lastname = $request->getPost('lastname');
     } elseif (isset($user_info)) {
         $this->view->lastname = $user_info['lastname'];
     } else {
         $this->view->lastname = '';
     }
     if ($request->getPost('groups')) {
         $this->view->groups = $request->getPost('groups');
     } elseif (isset($user_info)) {
         $this->view->groups = (array) unserialize($user_info['groups']);
     } else {
         $this->view->groups = array();
     }
     $this->view->groups_list = Model_Usergroups::getGroups();
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:88,代码来源:UsersController.php

示例15: indexAction

 public function indexAction()
 {
     $request = $this->getRequest();
     if (!JO_Session::get('user[user_id]')) {
         $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=login&popup=true&next=' . urlencode($request->getFullUrl())));
     }
     $this->view->createBoard = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=create');
     $boards = Model_Boards::getBoards(array('filter_user_id' => JO_Session::get('user[user_id]'), 'order' => 'boards.sort_order', 'sort' => 'ASC', 'friendly' => JO_Session::get('user[user_id]')));
     $this->view->boards = array();
     if ($boards) {
         foreach ($boards as $board) {
             $this->view->boards[] = array('board_id' => $board['board_id'], 'title' => $board['title']);
         }
     }
     //////////// Categories ////////////
     $this->view->categories = array();
     $categories = Model_Categories::getCategories(array('filter_status' => 1));
     foreach ($categories as $category) {
         $category['subcategories'] = Model_Categories::getSubcategories($category['category_id']);
         $this->view->categories[] = $category;
     }
     $this->view->title = JO_Utf8::convertToUtf8($request->getQuery('title'));
     $this->view->url = JO_Utf8::convertToUtf8(urldecode($request->getQuery('url')));
     $this->view->media = JO_Utf8::convertToUtf8($request->getQuery('media'));
     $this->view->is_video = JO_Utf8::convertToUtf8($request->getQuery('is_video'));
     $this->view->description = JO_Utf8::convertToUtf8($request->getQuery('description'));
     $this->view->charset = JO_Utf8::convertToUtf8($request->getQuery('charset'));
     if (!trim($this->view->description)) {
         $this->view->description = $this->view->title;
     }
     if (JO_Session::get('success_added')) {
         $this->view->pin_url = WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . JO_Session::get('success_added'));
         $this->setViewChange('success');
         JO_Session::clear('success_added');
     } else {
         if ($request->isPost()) {
             $result = Model_Pins::create(array('title' => $this->view->title, 'from' => $this->view->url, 'image' => $this->view->media, 'is_video' => $this->view->is_video, 'description' => $request->getPost('message'), 'price' => $request->getPost('price'), 'board_id' => $request->getPost('board_id'), 'pinmarklet' => 1));
             if ($result) {
                 Model_History::addHistory(0, Model_History::ADDPIN, $result);
                 $session_user = JO_Session::get('user[user_id]');
                 $group = Model_Boards::isGroupBoard($request->getPost('board_id'));
                 if ($group) {
                     $users = explode(',', $group);
                     foreach ($users as $user_id) {
                         if ($user_id != $session_user) {
                             $user_data = Model_Users::getUser($user_id);
                             if ($user_data && $user_data['email_interval'] == 1 && $user_data['groups_pin_email']) {
                                 $this->view->user_info = $user_data;
                                 $this->view->profile_href = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . JO_Session::get('user[user_id]'));
                                 $this->view->full_name = JO_Session::get('user[firstname]') . ' ' . JO_Session::get('user[lastname]');
                                 $this->view->pin_href = WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $result);
                                 $board_info = Model_Boards::getBoard($request->getPost('board_id'));
                                 if ($board_info) {
                                     $this->view->board_title = $board_info['title'];
                                     $this->view->board_href = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $board_info['user_id'] . '&board_id=' . $board_info['board_id']);
                                 }
                                 Model_Email::send($user_data['email'], JO_Registry::get('noreply_mail'), JO_Session::get('user[firstname]') . ' ' . JO_Session::get('user[lastname]') . ' ' . $this->translate('added new pin to a group board'), $this->view->render('group_board', 'mail'));
                             }
                         }
                     }
                 }
                 JO_Session::set('success_added', $result);
                 $this->redirect($request->getBaseUrl() . '?controller=bookmarklet');
             }
         }
     }
 }
开发者ID:noikiy,项目名称:amatteur,代码行数:67,代码来源:BookmarkletController.php


注:本文中的Model_Users::getUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。