Exemple #1
0
 public function getMultiLikes($data)
 {
     // Default like array
     $likes = array();
     // Do we have data and are we logged in?
     if (!$data || !users_helper::isLoggedin()) {
         return $likes;
     }
     // Create columns
     $columns = array();
     foreach ($data as $resource => $items) {
         if ($items && ($resourceID = config::item('resources', 'core', $resource, 'resource_id'))) {
             $columns[] = "`resource_id`=" . (int) $resourceID . " AND `item_id` IN (" . implode(",", $items) . ")";
         }
     }
     // Any columns?
     if (!$columns) {
         return $likes;
     }
     $items = $this->db->query("SELECT `resource_id`, `post_date`, `item_id`\n\t\t\tFROM `:prefix:core_likes`\n\t\t\tWHERE (" . implode(" OR ", $columns) . ") AND `user_id`=?", array(session::item('user_id')))->result();
     foreach ($items as $item) {
         $likes[$item['resource_id']][$item['item_id']]['post_date'] = $item['post_date'];
     }
     return $likes;
 }
Exemple #2
0
 public function index()
 {
     // Do we have permission to access advanced search?
     if (input::get('a') && !session::permission('users_search_access_advanced', 'users')) {
         router::redirect('users');
     }
     // Parameters
     $params = array('join_columns' => array('`u`.`verified`=1', '`u`.`active`=1', '`u`.`group_id` IN (' . implode(',', session::permission('users_groups_browse', 'users')) . ')', '`u`.`type_id` IN (' . implode(',', session::permission('users_types_browse', 'users')) . ')'), 'join_items' => array());
     // Process filters
     $params = $this->parseCounters($params);
     // Set meta tags
     $this->metatags_model->set('users', 'users_search');
     // Set title
     view::setTitle(__('search', 'system'), false);
     // Assign tabs
     view::setTab('users', __('search', 'system'), array('class' => (input::get('a') ? '' : 'active') . ' icon-text icon-users-search'));
     if (session::permission('users_search_access_advanced', 'users')) {
         view::setTab('users?a=1', __('search_advanced', 'system'), array('class' => (input::get('a') ? 'active' : '') . ' icon-text icon-users-search-advanced'));
     }
     if (users_helper::isLoggedin()) {
         //view::setTab('users/saved', __('saved_searches', 'users'));
     }
     // Load view
     view::load('users/search');
 }
Exemple #3
0
 public function getBlogs($fields = false, $columns = array(), $items = array(), $order = false, $limit = 15, $params = array())
 {
     // Do we need to validate privacy settings?
     if (isset($params['privacy']) && $params['privacy']) {
         $friend = $this->users_friends_model->getFriend($params['privacy']);
         // Are users friends?
         if ($friend) {
             $columns[] = '`b`.`privacy`<=3';
         } elseif (users_helper::isLoggedin()) {
             $columns[] = '`b`.`privacy`<=2';
         } else {
             $columns[] = '`b`.`privacy`=1';
         }
     }
     // Set resource ID?
     $columns[] = '`b`.`resource_id`=' . (isset($params['resource_id']) ? $params['resource_id'] : 1);
     // Set custom ID?
     $columns[] = '`b`.`custom_id`=' . (isset($params['custom_id']) ? $params['custom_id'] : 0);
     // Do we need to count blogs?
     if (isset($params['count']) && $params['count']) {
         $total = $this->fields_model->countRows('blog', !isset($params['select_users']) || $params['select_users'] ? true : false, $columns, $items, $params);
         return $total;
     }
     // Get blogs
     $blogs = $this->fields_model->getRows('blog', !isset($params['select_users']) || $params['select_users'] ? true : false, $fields, $columns, $items, $order, $limit, $params);
     return $blogs;
 }
Exemple #4
0
 public function usersProfileViewSidebarFriends($user)
 {
     if (!$user['total_friends']) {
         return '';
     }
     echo users_helper::getFriends(array('user' => $user, 'limit' => 6));
 }
Exemple #5
0
 public function __construct()
 {
     parent::__construct();
     if (!users_helper::isLoggedin() || !session::permission('site_access_cp', 'system')) {
         router::redirect('cp/users/login');
     }
 }
Exemple #6
0
 public function browse()
 {
     // Parameters
     $params = array('join_columns' => array(), 'join_items' => array());
     // Process filters
     $params = $this->parseCounters($params);
     // Process query string
     $qstring = $this->parseQuerystring($params['total']);
     // Actions
     $actions = array(0 => __('select', 'system'), 'approve' => __('approve', 'system'), 'decline' => __('decline', 'system'), 'delete' => __('delete', 'system'));
     // Check form action
     if (input::post('do_action')) {
         // Delete selected blogs
         if (input::post('action') && isset($actions[input::post('action')]) && input::post('blog_id') && is_array(input::post('blog_id'))) {
             foreach (input::post('blog_id') as $blogID) {
                 $blogID = (int) $blogID;
                 if ($blogID && $blogID > 0) {
                     $this->action(input::post('action'), $blogID);
                 }
             }
         }
         // Success
         view::setInfo(__('action_applied', 'system'));
         router::redirect('cp/plugins/blogs?' . $qstring['url'] . 'page=' . $qstring['page']);
     }
     // Get blogs
     $blogs = array();
     if ($params['total']) {
         $blogs = $this->blogs_model->getBlogs('in_list', $params['join_columns'], $params['join_items'], $qstring['order'], $qstring['limit']);
     }
     // Create table grid
     $grid = array('uri' => 'cp/plugins/blogs', 'keyword' => 'blogs', 'header' => array('check' => array('html' => 'blog_id', 'class' => 'check'), 'data_title' => array('html' => __('name', 'system'), 'class' => 'name', 'sortable' => true), 'user' => array('html' => __('user', 'system'), 'class' => 'user'), 'post_date' => array('html' => __('post_date', 'system'), 'class' => 'date', 'sortable' => true), 'status' => array('html' => __('status', 'system'), 'class' => 'status'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array());
     // Create grid content
     foreach ($blogs as $blog) {
         if ($blog['active'] == 1) {
             $status = html_helper::anchor('cp/plugins/blogs/decline/' . $blog['blog_id'] . '?' . $qstring['url'] . 'page=' . $qstring['page'], __('active', 'system'), array('class' => 'label small success'));
         } else {
             $status = html_helper::anchor('cp/plugins/blogs/approve/' . $blog['blog_id'] . '?' . $qstring['url'] . 'page=' . $qstring['page'], $blog['active'] ? __('pending', 'system') : __('inactive', 'system'), array('class' => 'label small ' . ($blog['active'] ? 'info' : 'important')));
         }
         $grid['content'][] = array('check' => array('html' => $blog['blog_id']), 'data_title' => array('html' => html_helper::anchor('cp/plugins/blogs/edit/' . $blog['blog_id'], text_helper::truncate($blog['data_title'], 64))), 'user' => array('html' => users_helper::anchor($blog['user'])), 'post_date' => array('html' => date_helper::formatDate($blog['post_date'])), 'status' => array('html' => $status), 'actions' => array('html' => array('edit' => html_helper::anchor('cp/plugins/blogs/edit/' . $blog['blog_id'], __('edit', 'system'), array('class' => 'edit')), 'delete' => html_helper::anchor('cp/plugins/blogs/delete/' . $blog['blog_id'] . '?' . $qstring['url'] . 'page=' . $qstring['page'], __('delete', 'system'), array('data-html' => __('blog_delete?', 'blogs'), 'data-role' => 'confirm', 'class' => 'delete')))));
     }
     // Set pagination
     $config = array('base_url' => config::siteURL('cp/plugins/blogs?' . $qstring['url']), 'total_items' => $params['total'], 'items_per_page' => $this->blogsPerPage, 'current_page' => $qstring['page'], 'uri_segment' => 'page');
     $pagination = loader::library('pagination', $config, null);
     // Filter hooks
     hook::filter('cp/plugins/blogs/browse/grid', $grid);
     hook::filter('cp/plugins/blogs/browse/actions', $actions);
     // Assign vars
     view::assign(array('grid' => $grid, 'actions' => $actions, 'pagination' => $pagination));
     // Set title
     view::setTitle(__('blogs_manage', 'system_navigation'));
     // Set trail
     if ($qstring['search_id']) {
         view::setTrail('cp/plugins/blogs?' . $qstring['url'] . 'page=' . $qstring['page'], __('search_results', 'system'));
     }
     // Assign actions
     view::setAction('#', __('search', 'system'), array('class' => 'icon-text icon-system-search', 'onclick' => '$(\'#blogs-search\').toggle();return false;'));
     // Load view
     view::load('cp/plugins/blogs/browse');
 }
Exemple #7
0
 public function __construct($tabs = true, $loggedin = true)
 {
     parent::__construct();
     // Is user loggedin ?
     if ($loggedin && !users_helper::isLoggedin()) {
         router::redirect('users/login');
     }
     // Set trail
     view::setTrail(session::item('slug'), __('my_profile', 'system_navigation'));
     view::setTrail('users/settings', __('settings', 'users'));
     // Set tabs
     if ($tabs) {
         view::setTab('users/settings', __('settings', 'users'), array('class' => (uri::segment(1) == 'users' && uri::segment(2) == 'settings' && (!uri::segment(3) || in_array(uri::segment(3), array('email', 'password', 'username', 'cancel'))) || uri::segment(1) == 'billing' && uri::segment(2) != 'invoices' ? 'active' : '') . ' icon-users-settings'));
         if (config::item('privacy_edit', 'users')) {
             view::setTab('users/settings/privacy', __('privacy', 'users'), array('class' => (uri::segment(1) == 'users' && uri::segment(3) == 'privacy' ? 'active' : '') . ' icon-users-privacy'));
         }
         if (config::item('notifications_edit', 'users')) {
             view::setTab('users/settings/notifications', __('notifications', 'users'), array('class' => (uri::segment(1) == 'users' && uri::segment(3) == 'notifications' ? 'active' : '') . ' icon-users-notifications'));
         }
         if (config::item('blacklist_active', 'users')) {
             view::setTab('users/blocked', __('blacklist', 'users'), array('class' => (uri::segment(1) == 'users' && uri::segment(2) == 'blocked' ? 'active' : '') . ' icon-users-blacklist'));
         }
     }
     // Filter hook
     hook::action('users/settings/tabs');
 }
Exemple #8
0
 public function getAlbums($fields = false, $columns = array(), $items = array(), $order = false, $limit = 15, $params = array())
 {
     // Do we need to validate privacy settings?
     if (isset($params['privacy']) && $params['privacy']) {
         $friend = $this->users_friends_model->getFriend($params['privacy']);
         // Are users friends?
         if ($friend) {
             $columns[] = '`a`.`privacy`<=3';
         } elseif (users_helper::isLoggedin()) {
             $columns[] = '`a`.`privacy`<=2';
         } else {
             $columns[] = '`a`.`privacy`=1';
         }
     }
     // Set resource ID?
     $columns[] = '`a`.`resource_id`=' . (isset($params['resource_id']) ? $params['resource_id'] : 1);
     // Set custom ID?
     $columns[] = '`a`.`custom_id`=' . (isset($params['custom_id']) ? $params['custom_id'] : 0);
     // Do we need to count albums?
     if (isset($params['count']) && $params['count']) {
         $total = $this->fields_model->countRows('picture_album', !isset($params['select_users']) || $params['select_users'] ? true : false, $columns, $items, $params);
         return $total;
     }
     $params['select_columns'] = "`p`.`active` AS `picture_active`, `p`.`file_id`, `f`.`service_id` AS `file_service_id`, `f`.`path` AS `file_path`, `f`.`name` AS `file_name`, `f`.`extension` AS `file_ext`,\n\t\t\t`f`.`size` AS `file_size`, `f`.`post_date` AS `file_post_date`, `f`.`modify_date` AS `file_modify_date`";
     $params['join_tables'] = "LEFT JOIN `:prefix:pictures_data` AS `p` ON `a`.`picture_id`=`p`.`picture_id` LEFT JOIN `:prefix:storage_files` AS `f` ON `p`.`file_id`=`f`.`file_id`";
     $params['type_id'] = 1;
     // fetch album fields
     // Get albums
     $albums = $this->fields_model->getRows('picture_album', !isset($params['select_users']) || $params['select_users'] ? true : false, $fields, $columns, $items, $order, $limit, $params);
     return $albums;
 }
Exemple #9
0
 protected function _sendFeedback()
 {
     // Check if demo mode is enabled
     if (input::demo()) {
         return false;
     }
     // Extra rules
     $rules = array('name' => array('rules' => array('required', 'is_string', 'trim', 'min_length' => 2, 'max_length' => 255)), 'email' => array('rules' => array('required', 'is_string', 'trim', 'valid_email', 'min_length' => 4, 'max_length' => 255)), 'subject' => array('rules' => array('required', 'is_string', 'trim', 'min_length' => 5, 'max_length' => 255)), 'message' => array('rules' => array('required', 'is_string', 'trim', 'min_length' => 10, 'max_length' => 10000)));
     if (config::item('feedback_captcha', 'feedback') == 1 || config::item('feedback_captcha', 'feedback') == 2 && !users_helper::isLoggedin()) {
         $rules['captcha'] = array('rules' => array('is_captcha'));
     }
     validate::setRules($rules);
     // Validate form values
     if (!validate::run($rules)) {
         return false;
     }
     // Get values
     $email = input::post('email');
     $subject = input::post('subject');
     $message = input::post('message') . "\n\n--\n" . input::post('name') . ' <' . input::post('email') . '>' . "\n" . input::ipaddress();
     // Send feedback
     if (!$this->feedback_model->sendFeedback($email, $subject, $message)) {
         if (!validate::getTotalErrors()) {
             view::setError(__('send_error', 'system'));
         }
         return false;
     }
     // Success
     view::setInfo(__('message_sent', 'feedback'));
     router::redirect('feedback');
 }
Exemple #10
0
 public function home()
 {
     if (users_helper::isLoggedin()) {
         if (config::item('homepage_user', 'users') == 'profile') {
             loader::controller('users/profile', array(), 'users_profile');
             $this->users_profile->manage();
             return;
         } elseif (config::item('homepage_user', 'users') == 'timeline_public') {
             loader::controller('timeline', array(), 'timeline');
             $this->timeline->browse();
             return;
         } elseif (config::item('homepage_user', 'users') == 'timeline_user') {
             loader::controller('timeline', array(), 'timeline');
             $this->timeline->manage();
             return;
         }
     } elseif (config::item('homepage_public', 'users') == 'timeline_public') {
         loader::controller('timeline', array(), 'timeline');
         $this->timeline->browse();
         return;
     }
     // Set meta tags
     $this->metatags_model->set('system', 'site_index', array(), false);
     view::load('home');
 }
Exemple #11
0
 public static function getTimeline($user = array(), $privacy = 2, $template = 'timeline/helpers/timeline')
 {
     loader::model('timeline/timeline');
     // Get actions
     $actions = codebreeder::instance()->timeline_model->getActions($user ? $user['user_id'] : 0, true, 0, config::item('actions_per_page', 'timeline'));
     $ratings = array();
     // Do we have actions and are we logged in?
     if ($actions && users_helper::isLoggedin()) {
         foreach ($actions as $action) {
             if ($action['rating']) {
                 $ratings[$action['relative_resource']][] = $action['item_id'];
             } else {
                 $ratings['timeline'][] = $action['action_id'];
             }
         }
         // Load votes and like models
         loader::model('comments/votes');
         loader::model('comments/likes');
         // Get likes and votes
         $likes = codebreeder::instance()->likes_model->getMultiLikes($ratings);
         $votes = codebreeder::instance()->votes_model->getMultiVotes($ratings);
         $ratings = $likes + $votes;
     }
     // Can we post messages?
     $post = session::permission('messages_post', 'timeline') && codebreeder::instance()->users_model->getPrivacyAccess($user['user_id'], $privacy, false) ? true : false;
     view::assign(array('actions' => $actions, 'user' => $user, 'post' => $post, 'ratings' => $ratings), '', $template);
     // Update comments pagination
     config::set('comments_per_page', config::item('comments_per_page', 'timeline'), 'comments');
     return view::load($template, array(), 1);
 }
Exemple #12
0
 public function __construct()
 {
     parent::__construct();
     // Is user logged in?
     if (users_helper::isLoggedin() && strtolower(uri::segment(3)) != 'out') {
         router::redirect(session::item('slug'));
     }
 }
Exemple #13
0
 public function __construct()
 {
     parent::__construct();
     if (!config::item('timeline_active', 'timeline') || !users_helper::isLoggedin()) {
         error::show404();
     }
     loader::model('timeline/notices', array(), 'timeline_notices_model');
 }
Exemple #14
0
 public function __construct()
 {
     parent::__construct();
     // Is user logged in?
     if (users_helper::isLoggedin() && strtolower(uri::segment(3)) != 'out') {
         router::redirect(session::item('slug'));
     }
     loader::model('users/authentication', array(), 'users_authentication_model');
 }
Exemple #15
0
 public static function getBlockedUser($userID, $self = false)
 {
     if (!users_helper::isLoggedin()) {
         return false;
     } elseif ($userID == session::item('user_id')) {
         return false;
     }
     return codebreeder::instance()->users_blocked_model->getUser($userID, $self);
 }
Exemple #16
0
 public function browse()
 {
     // Parameters
     $params = array('join_columns' => array());
     // Process filters
     $params = $this->parseCounters($params);
     // Process query string
     $qstring = $this->parseQuerystring($params['total']);
     // Actions
     $actions = array(0 => __('select', 'system'), 'delete' => __('delete', 'system'));
     // Check form action
     if (input::post('do_action')) {
         // Delete selected messages
         if (input::post('action') == 'delete') {
             if (input::post('message_id') && is_array(input::post('message_id'))) {
                 foreach (input::post('message_id') as $messageID) {
                     $messageID = (int) $messageID;
                     if ($messageID && $messageID > 0) {
                         $this->delete($messageID);
                     }
                 }
             }
         }
         // Success
         view::setInfo(__('action_applied', 'system'));
         router::redirect('cp/plugins/messages?' . $qstring['url'] . 'page=' . $qstring['page']);
     }
     // Get messages
     $messages = array();
     if ($params['total']) {
         $messages = $this->messages_model->getMessages($params['join_columns'], $qstring['order'], $qstring['limit']);
     }
     // Create table grid
     $grid = array('uri' => 'cp/plugins/messages', 'keyword' => 'messages', 'header' => array('check' => array('html' => 'message_id', 'class' => 'check'), 'message' => array('html' => __('message', 'messages'), 'class' => 'name'), 'user' => array('html' => __('user', 'system'), 'class' => 'user'), 'post_date' => array('html' => __('post_date', 'system'), 'class' => 'date', 'sortable' => true), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array());
     // Create grid content
     foreach ($messages as $message) {
         $grid['content'][] = array('check' => array('html' => $message['message_id']), 'message' => array('html' => html_helper::anchor('cp/plugins/messages/edit/' . $message['message_id'], text_helper::truncate($message['message'], 64))), 'user' => array('html' => users_helper::anchor($message['user'])), 'post_date' => array('html' => date_helper::formatDate($message['post_date'])), 'actions' => array('html' => array('edit' => html_helper::anchor('cp/plugins/messages/edit/' . $message['message_id'], __('edit', 'system'), array('class' => 'edit')), 'delete' => html_helper::anchor('cp/plugins/messages/delete/' . $message['message_id'] . '?' . $qstring['url'] . 'page=' . $qstring['page'], __('delete', 'system'), array('data-html' => __('message_delete?', 'messages'), 'data-role' => 'confirm', 'class' => 'delete')))));
     }
     // Set pagination
     $config = array('base_url' => config::siteURL('cp/plugins/messages?' . $qstring['url']), 'total_items' => $params['total'], 'items_per_page' => $this->messagesPerPage, 'current_page' => $qstring['page'], 'uri_segment' => 'page');
     $pagination = loader::library('pagination', $config, null);
     // Filter hooks
     hook::filter('cp/plugins/messages/browse/grid', $grid);
     hook::filter('cp/plugins/messages/browse/actions', $actions);
     // Assign vars
     view::assign(array('grid' => $grid, 'actions' => $actions, 'pagination' => $pagination));
     // Set title
     view::setTitle(__('messages_manage', 'system_navigation'));
     // Set trail
     if ($qstring['search_id']) {
         view::setTrail('cp/plugins/messages?' . $qstring['url'] . 'page=' . $qstring['page'], __('search_results', 'system'));
     }
     // Assign actions
     view::setAction('#', __('search', 'system'), array('class' => 'icon-text icon-system-search', 'onclick' => '$(\'#messages-search\').toggle();return false;'));
     // Load view
     view::load('cp/plugins/messages/browse');
 }
Exemple #17
0
 public function __construct()
 {
     parent::__construct();
     // Is user loggedin ?
     if (!users_helper::isLoggedin()) {
         router::redirect('users/login');
     } elseif (!config::item('visitors_active', 'users')) {
         error::show404();
     }
     loader::model('users/visitors', array(), 'users_visitors_model');
 }
Exemple #18
0
 public function __construct()
 {
     parent::__construct();
     // Is user loggedin ?
     if (!users_helper::isLoggedin()) {
         router::redirect('users/login');
     } elseif (!config::item('credits_active', 'billing')) {
         router::redirect('users/settings');
     }
     loader::model('billing/credits');
 }
Exemple #19
0
 public function __construct()
 {
     parent::__construct();
     if (!config::item('reports_active', 'reports')) {
         error::show404();
     } elseif (!users_helper::isLoggedin()) {
         router::redirect('users/login');
     }
     loader::model('reports/reports');
     loader::model('reports/subjects', array(), 'reports_subjects_model');
 }
Exemple #20
0
 public function __construct()
 {
     parent::__construct(true);
     // Is user loggedin ?
     if (!users_helper::isLoggedin()) {
         router::redirect('users/login');
     } elseif (!config::item('invoices_active', 'billing')) {
         router::redirect('users/settings');
     }
     loader::model('billing/gateways');
     loader::model('billing/transactions');
 }
Exemple #21
0
 public function usersProfileViewCounters($counters, $user)
 {
     if (users_helper::isLoggedin() && $user['user_id'] == session::item('user_id')) {
         $counters['total_albums'] = session::item('total_albums');
         return $counters;
     }
     $columns = array('`a`.`user_id`=' . $user['user_id']);
     $params = array('privacy' => 1);
     loader::model('pictures/albums', array(), 'pictures_albums_model');
     $counters['total_albums'] = $this->pictures_albums_model->countAlbums($columns, array(), $params);
     return $counters;
 }
Exemple #22
0
 public function usersProfileViewCounters($counters, $user)
 {
     if (users_helper::isLoggedin() && $user['user_id'] == session::item('user_id')) {
         $counters['total_blogs'] = session::item('total_blogs');
         return $counters;
     }
     $columns = array('`b`.`user_id`=' . $user['user_id'], '`b`.`active`=1');
     $params = array('privacy' => 1);
     loader::model('blogs/blogs');
     $counters['total_blogs'] = $this->blogs_model->countBlogs($columns, array(), $params);
     return $counters;
 }
Exemple #23
0
 public function usersProfileViewCounters($counters, $user)
 {
     if (users_helper::isLoggedin() && $user['user_id'] == session::item('user_id')) {
         $counters['total_classifieds'] = session::item('total_classifieds');
         return $counters;
     }
     $columns = array('`a`.`user_id`=' . $user['user_id'], '`a`.`post_date`>' . (date_helper::now() - config::item('ad_expiration', 'classifieds') * 60 * 60 * 24));
     $params = array();
     loader::model('classifieds/classifieds');
     $counters['total_classifieds'] = $this->classifieds_model->countAds($columns, array(), $params);
     return $counters;
 }
Exemple #24
0
 public function __construct()
 {
     parent::__construct();
     if (!config::item('messages_active', 'messages')) {
         error::show404();
     } elseif (!users_helper::isLoggedin()) {
         router::redirect('users/login');
     } elseif (!session::permission('messages_access', 'messages')) {
         view::noAccess();
     }
     // Set trail
     view::setTrail(session::item('slug'), __('my_profile', 'system_navigation'));
     view::setTrail('messages/manage', __('messages', 'system_navigation'));
     loader::model('messages/messages');
 }
Exemple #25
0
 public function browse()
 {
     // Parameters
     $params = array('join_columns' => array(), 'join_items' => array());
     // Process filters
     $params = $this->parseCounters($params, 0);
     // Process query string
     $qstring = $this->parseQuerystring($params['total']);
     // Actions
     $actions = array(0 => __('select', 'system'), 'approve' => __('approve', 'system'), 'approve_email' => __('approve_email', 'system'), 'decline' => __('decline', 'system'), 'decline_email' => __('decline_email', 'system'), 'verify' => __('status_verify', 'users'), 'unverify' => __('status_unverify', 'users'), 'delete' => __('delete', 'system'));
     // Check form action
     if (input::post('do_action')) {
         // Delete selected users
         if (input::post('action') && isset($actions[input::post('action')]) && input::post('user_id') && is_array(input::post('user_id'))) {
             foreach (input::post('user_id') as $userID) {
                 $userID = (int) $userID;
                 if ($userID && $userID > 0) {
                     $this->action(input::post('action'), $userID);
                 }
             }
         }
         // Success
         view::setInfo(__('action_applied', 'system'));
         router::redirect('cp/users?' . $qstring['url'] . 'page=' . $qstring['page']);
     }
     // Get users
     $users = array();
     if ($params['total']) {
         $users = $this->users_model->getUsers('in_list', isset($params['values']['type_id']) ? $params['values']['type_id'] : 0, $params['join_columns'], $params['join_items'], $qstring['order'], $qstring['limit']);
     }
     // Create table grid
     $grid = array('uri' => 'cp/users', 'keyword' => 'users', 'header' => array('check' => array('html' => 'user_id', 'class' => 'check'), 'name1' => array('html' => __('user', 'system'), 'class' => 'name'), 'group' => array('html' => __('user_group', 'users'), 'class' => 'group'), 'type' => array('html' => __('user_type', 'users'), 'class' => 'type'), 'join_date' => array('html' => __('join_date', 'users'), 'class' => 'date', 'sortable' => true), 'active' => array('html' => __('active', 'system'), 'class' => 'status'), 'verified' => array('html' => __('verified', 'users'), 'class' => 'status'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array());
     // Create grid content
     foreach ($users as $user) {
         if ($user['active']) {
             $status = html_helper::anchor('cp/users/decline/' . $user['user_id'] . '?' . $qstring['url'] . 'page=' . $qstring['page'], __('yes', 'system'), array('class' => 'label small success'));
         } else {
             $status = html_helper::anchor('cp/users/approve/' . $user['user_id'] . '?' . $qstring['url'] . 'page=' . $qstring['page'], __('no', 'system'), array('class' => 'label small important'));
         }
         if ($user['verified']) {
             $verified = html_helper::anchor('cp/users/unverify/' . $user['user_id'] . '?' . $qstring['url'] . 'page=' . $qstring['page'], __('yes', 'system'), array('class' => 'label small success'));
         } else {
             $verified = html_helper::anchor('cp/users/verify/' . $user['user_id'] . '?' . $qstring['url'] . 'page=' . $qstring['page'], __('no', 'system'), array('class' => 'label small important'));
         }
         $grid['content'][] = array('check' => array('html' => $user['user_id']), 'name1' => array('html' => users_helper::anchor($user)), 'group' => array('html' => text_helper::entities(config::item('usergroups', 'core', $user['group_id']))), 'type' => array('html' => text_helper::entities(config::item('usertypes', 'core', 'names', $user['type_id']))), 'join_date' => array('html' => date_helper::formatDate($user['join_date'])), 'status' => array('html' => $status), 'verified' => array('html' => $verified), 'actions' => array('html' => array('edit' => html_helper::anchor('cp/users/edit/' . $user['user_id'], __('edit', 'system'), array('class' => 'edit')), 'delete' => html_helper::anchor('cp/users/delete/' . $user['user_id'], __('delete', 'system'), array('data-html' => __('user_delete?', 'users'), 'data-role' => 'confirm', 'class' => 'delete')))));
     }
     // Set pagination
     $config = array('base_url' => config::siteURL('cp/users?' . $qstring['url']), 'total_items' => $params['total'], 'items_per_page' => $this->usersPerPage, 'current_page' => $qstring['page'], 'uri_segment' => 'page');
     $pagination = loader::library('pagination', $config, null);
     // Filter hooks
     hook::filter('cp/users/browse/grid', $grid);
     hook::filter('cp/users/browse/actions', $actions);
     // Assign vars
     view::assign(array('grid' => $grid, 'actions' => $actions, 'pagination' => $pagination));
     // Set title
     view::setTitle(__('users_manage', 'system_navigation'));
     // Set trail
     if ($qstring['search_id']) {
         view::setTrail('cp/users?' . $qstring['url'] . 'page=' . $qstring['page'], __('search_results', 'system'));
     }
     // Assign actions
     view::setAction('cp/users/edit', __('user_new', 'users'), array('class' => 'icon-text icon-users-new'));
     view::setAction('#', __('search', 'system'), array('class' => 'icon-text icon-system-search', 'onclick' => '$(\'#users-search\').toggle();return false;'));
     // Load view
     view::load('cp/users/browse');
 }
Exemple #26
0
					<?php 
        view::load('users/profile/elements/picture', array_merge($notice['user'], array('picture_file_suffix' => 't')));
        ?>
				</figure>

				<div class="item-article">
					<?php 
        echo $notice['html'];
        ?>
				</div>

				<footer class="item-footer">
					<ul class="unstyled content-meta clearfix">
						<li class="date">
							<?php 
        echo __('author_date', 'system_info', array('%author' => users_helper::anchor($notice['user']), '%date' => date_helper::formatDate($notice['post_date'])));
        ?>
						</li>
					</ul>
				</footer>

			</article>

		</li>

	<?php 
    }
    ?>

	<li class="clearfix loader <?php 
    echo text_helper::alternate('odd', 'even');
Exemple #27
0
 public function delete()
 {
     // Is user logged in?
     if (!users_helper::isLoggedin()) {
         router::redirect('users/login');
     } elseif (!session::permission('albums_post', 'pictures')) {
         view::noAccess(session::item('slug'));
     }
     // Get URI vars
     $albumID = (int) uri::segment(4);
     // Get album
     if (!$albumID || !($album = $this->pictures_albums_model->getAlbum($albumID)) || $album['user_id'] != session::item('user_id')) {
         view::setError(__('no_album', 'pictures'));
         router::redirect('pictures/albums/manage');
     }
     // Delete album
     $this->pictures_albums_model->deleteAlbum($albumID, session::item('user_id'), $album);
     // Process query string
     $qstring = $this->parseQuerystring(config::item('user_albums_per_page', 'pictures'));
     // Success
     view::setInfo(__('album_deleted', 'pictures'));
     router::redirect('pictures/albums/manage?' . $qstring['url'] . 'page=' . $qstring['page']);
 }
Exemple #28
0
view::load('header');
?>

<section class="homepage">

	<?php 
if (config::item('home_users', 'template')) {
    ?>
		<div class="home-box users">
			<h3><?php 
    echo __('users_new', 'system_navigation');
    ?>
</h3>
			<?php 
    echo users_helper::getUsers(array('join_columns' => array('`u`.`picture_id`!=0', '`u`.`picture_active`=1'), 'limit' => 10));
    ?>
		</div>
		<div class="section-break"></div>
	<?php 
}
?>

	<div class="clearfix">
		<?php 
$i = 0;
foreach (array('blogs', 'news', 'pictures', 'videos') as $item) {
    ?>

			<?php 
    if (config::item($item . '_active', $item) && config::item('home_' . $item, 'template')) {
Exemple #29
0
    ?>
							<?php 
    echo html_helper::anchor('classifieds/pictures/rotate/' . $picture['ad_id'] . '/' . $picture['picture_id'] . '/left', __('picture_rotate_left', 'system_files'), array('class' => 'rotate left'));
    ?>
							<?php 
    echo html_helper::anchor('classifieds/pictures/rotate/' . $picture['ad_id'] . '/' . $picture['picture_id'] . '/right', __('picture_rotate_right', 'system_files'), array('class' => 'rotate right'));
    ?>
							<?php 
    echo html_helper::anchor('classifieds/pictures/delete/' . $picture['ad_id'] . '/' . $picture['picture_id'], __('picture_delete', 'classifieds'), array('class' => 'delete', 'data-html' => __('picture_delete?', 'classifieds'), 'data-role' => 'confirm'));
    ?>
						</li>
					<?php 
}
?>
					<?php 
if (config::item('reports_active', 'reports') && users_helper::isLoggedin() && $picture['user_id'] != session::item('user_id') && session::permission('reports_post', 'reports')) {
    ?>
						<li class="report">
							<?php 
    echo html_helper::anchor('report/submit/classified_picture/' . $pictureID, __('report', 'system'), array('data-role' => 'modal', 'data-display' => 'iframe', 'data-title' => __('report', 'system')));
    ?>
						</li>
					<?php 
}
?>
				</ul>

			</footer>

		</article>
Exemple #30
0
<div class="item-article">

	<div class="action-header">
		<?php 
echo __('picture_post', 'timeline', array('[name]' => users_helper::anchor($user), '[params.count]' => $params['count'], '[album]' => html_helper::anchor('pictures/index/' . $album['album_id'] . '/' . text_helper::slug($album['data_title'], 100), $album['data_title'])));
?>
	</div>

	<div class="target-article gallery">
		<ul class="unstyled content-gallery clearfix <?php 
echo text_helper::alternate();
?>
">

			<?php 
foreach ($pictures as $picture) {
    ?>

				<li class="<?php 
    echo text_helper::alternate('odd', 'even');
    ?>
" id="row-picture-<?php 
    echo $picture['picture_id'];
    ?>
">

					<figure class="image pictures-image">
						<div class="image thumbnail" style="background-image:url('<?php 
    echo storage_helper::getFileURL($picture['file_service_id'], $picture['file_path'], $picture['file_name'], $picture['file_ext'], 't', $picture['file_modify_date']);
    ?>
');">