Ejemplo n.º 1
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');
 }
Ejemplo n.º 2
0
 public function __construct()
 {
     parent::__construct();
     if (!users_helper::isLoggedin() || !session::permission('site_access_cp', 'system')) {
         router::redirect('cp/users/login');
     }
 }
Ejemplo n.º 3
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;
 }
Ejemplo n.º 4
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;
 }
Ejemplo n.º 5
0
 public function logout()
 {
     if (users_helper::isLoggedin()) {
         $this->users_model->logout();
     }
     router::redirect('cp/users/login');
 }
Ejemplo n.º 6
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');
 }
Ejemplo n.º 7
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');
 }
Ejemplo n.º 8
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');
 }
Ejemplo n.º 9
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;
 }
Ejemplo n.º 10
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);
 }
Ejemplo n.º 11
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');
 }
Ejemplo n.º 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'));
     }
 }
Ejemplo n.º 13
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');
 }
Ejemplo n.º 14
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);
 }
Ejemplo n.º 15
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');
 }
Ejemplo n.º 16
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');
 }
Ejemplo n.º 17
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');
 }
Ejemplo n.º 18
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;
 }
Ejemplo n.º 19
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;
 }
Ejemplo n.º 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');
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 22
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');
 }
Ejemplo n.º 23
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>
Ejemplo n.º 24
0
 public function delete()
 {
     // Is user loggedin ?
     if (!users_helper::isLoggedin()) {
         router::redirect('users/login');
     }
     // Get URI vars
     $slugID = urldecode(utf8::trim(uri::segment(4)));
     // Do we have a slug ID?
     if ($slugID == '') {
         error::show404();
     }
     // Get user
     if (!($user = $this->users_model->getUser($slugID)) || !$user['active'] || !$user['verified']) {
         error::show404();
     } elseif ($user['user_id'] == session::item('user_id')) {
         router::redirect($user['slug']);
     }
     // Does friend exist?
     if (!($friend = $this->users_friends_model->getFriend($user['user_id'], false))) {
         view::setError(__('no_friend', 'users_friends'));
         router::redirect($user['slug']);
     }
     // Delete friend
     $this->users_friends_model->deleteFriend($friend['user_id'], $friend['friend_id'], $friend['active']);
     // Success
     view::setInfo(__($friend['active'] ? 'friend_deleted' : 'friend_canceled', 'users_friends'));
     router::redirect(input::get('page') ? 'users/friends/requests' : $user['slug']);
 }
Ejemplo n.º 25
0
?>
 <span class="required">*</span>
				</label>

				<div class="field">

					<?php 
view::load('system/elements/field/edit', array('prefix' => 'feedback_edit', 'field' => array('keyword' => 'message', 'type' => 'textarea', 'class' => 'input-wide input-large-y'), 'value' => ''));
?>

				</div>

			</div>

			<?php 
if (config::item('feedback_captcha', 'feedback') == 1 || config::item('feedback_captcha', 'feedback') == 2 && !users_helper::isLoggedin()) {
    ?>

				<div class="row <?php 
    echo text_helper::alternate('odd', 'even');
    ?>
" id="input_row_feedback_edit_captcha">

					<label for="input_edit_feedback_edit_captcha">
						<?php 
    echo __('captcha', 'system');
    ?>
 <span class="required">*</span>
					</label>

					<div class="field">
Ejemplo n.º 26
0
    }
    ?>
		<section id="container" <?php 
    echo uri::getURI() == '' && (users_helper::isLoggedin() && config::item('homepage_user', 'users') == 'default' || !users_helper::isLoggedin() && config::item('homepage_public', 'users') == 'default') ? 'class="one"' : '';
    ?>
>
			<div class="inner clearfix">

				<?php 
    if (uri::getURI() != '' || users_helper::isLoggedin() && config::item('homepage_user', 'users') != 'default' || !users_helper::isLoggedin() && config::item('homepage_public', 'users') != 'default') {
        ?>

					<aside id="sidebar">

						<?php 
        if (!users_helper::isLoggedin()) {
            ?>

							<div class="login">

								<?php 
            if (config::item('auth_methods', 'users', 'default')) {
                ?>

									<?php 
                echo form_helper::openForm('users/login');
                ?>

										<fieldset class="form <?php 
                echo text_helper::alternate();
                ?>
Ejemplo n.º 27
0
    ?>
			<div class="header">
				<?php 
    /*<span><?=html_helper::anchor('timeline/user/'.$user['slug_id'], __('timeline_recent', 'system_navigation'))?></span> */
    ?>
				<span><?php 
    echo __('timeline_recent', 'system_navigation');
    ?>
</span>
			</div>
		<?php 
}
?>

		<?php 
if (users_helper::isLoggedin() && $post) {
    ?>

			<div class="post">

				<?php 
    view::load('timeline/post', array('user' => $user));
    ?>

			</div>

		<?php 
}
?>

		<ul class="unstyled content-list <?php 
Ejemplo n.º 28
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']);
 }
Ejemplo n.º 29
0
 public function delete()
 {
     // Is user logged in?
     if (!users_helper::isLoggedin()) {
         router::redirect('users/login');
     } elseif (!session::permission('blogs_post', 'blogs')) {
         view::noAccess(session::item('slug'));
     }
     // Get URI vars
     $blogID = (int) uri::segment(3);
     // Get blog
     if (!$blogID || !($blog = $this->blogs_model->getBlog($blogID)) || $blog['user_id'] != session::item('user_id')) {
         view::setError(__('no_blog', 'blogs'));
         router::redirect('blogs/manage');
     }
     // Delete blog
     $this->blogs_model->deleteBlog($blogID, session::item('user_id'), $blog);
     // Process query string
     $qstring = $this->parseQuerystring(config::item('user_blogs_per_page', 'blogs'));
     // Success
     view::setInfo(__('blog_deleted', 'blogs'));
     router::redirect('blogs/manage?' . $qstring['url'] . 'page=' . $qstring['page']);
 }
Ejemplo n.º 30
0
            ?>
							</ul>
						</div>
					</div>
				</nav>
			<?php 
        }
        ?>
		<?php 
    }
    ?>
		<section id="container">
			<div class="row-container">
				<div class="row">
					<?php 
    if (users_helper::isLoggedin(1) && view::getTrail()) {
        ?>
						<nav id="trail">
							<ul class="unstyled clearfix">
								<?php 
        foreach (view::getTrail() as $index => $item) {
            ?>

									<?php 
            if ($index) {
                ?>
										<li>&#187;</li>
									<?php 
            }
            ?>
									<li><?php