예제 #1
0
파일: blogs.php 프로젝트: soremi/tutornavi
 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');
 }
예제 #2
0
 public function setSettings()
 {
     config::set('site_url', config::siteURL('/'), 'config');
     foreach ($this->data['settings'] as $plugin => $settings) {
         config::set($settings, '', $plugin);
     }
 }
예제 #3
0
파일: news.php 프로젝트: soremi/tutornavi
 public function index()
 {
     // Parameters
     $params = array('join_columns' => array('`n`.`active`=1'), 'join_items' => array());
     // Process filters
     $params = $this->parseCounters($params);
     // Process query string
     $qstring = $this->parseQuerystring(config::item('news_per_page', 'news'), $params['max']);
     // Get news
     $news = array();
     if ($params['total']) {
         $news = $this->news_model->getEntries('in_list', $params['join_columns'], $params['join_items'], $qstring['order'], $qstring['limit']);
     }
     // Set pagination
     $config = array('base_url' => config::siteURL('news?' . $qstring['url']), 'total_items' => $params['total'], 'max_items' => $params['max'], 'items_per_page' => config::item('news_per_page', 'news'), 'current_page' => $qstring['page'], 'uri_segment' => 'page');
     $pagination = loader::library('pagination', $config, null);
     // Assign vars
     view::assign(array('news' => $news, 'pagination' => $pagination));
     // Set meta tags
     $this->metatags_model->set('news', 'news_index');
     // Set title
     view::setTitle(__(config::item('news_blog', 'news') ? 'blog' : 'news', 'system_navigation'), false);
     // Assign actions
     if (session::permission('news_search', 'news') && ($params['total'] || input::post_get('do_search'))) {
         view::setAction('#', __('search', 'system'), array('class' => 'icon-text icon-system-search', 'onclick' => '$(\'#news-search\').toggle();return false;'));
     }
     // Load view
     view::load('news/index');
 }
예제 #4
0
 public function manage()
 {
     // Assign user from session to variable
     $user = session::section('session');
     // Get fields
     $fields = array();
     foreach (config::item('usertypes', 'core', 'keywords') as $categoryID => $keyword) {
         $fields[$categoryID] = $this->fields_model->getFields('users', $categoryID, 'view', 'in_list');
     }
     // Parameters
     $params = array('total' => $user['total_blocked'], 'profiles' => true);
     // Process query string
     $qstring = $this->parseQuerystring($params['total']);
     // Get blocked users
     $users = array();
     if ($params['total']) {
         $users = $this->users_blocked_model->getUsers(session::item('user_id'), $qstring['order'], $qstring['limit'], $params);
     } else {
         view::setInfo(__('no_blocked_users', 'users_blocked'));
     }
     // Set pagination
     $config = array('base_url' => config::siteURL('users/blocked/manage?' . $qstring['url']), 'total_items' => $params['total'], 'items_per_page' => config::item('blocked_per_page', 'users'), 'current_page' => $qstring['page'], 'uri_segment' => 'page');
     $pagination = loader::library('pagination', $config, null);
     // Assign vars
     view::assign(array('user' => $user, 'users' => $users, 'fields' => $fields, 'pagination' => $pagination));
     // Set title
     view::setTitle(__('blacklist', 'users'));
     // Load view
     view::load('users/blocked/manage');
 }
예제 #5
0
 public function invoices()
 {
     // Get page
     $page = is_numeric(input::get('page')) && input::get('page') > 0 ? input::get('page') : 1;
     // Parameters
     $params = array('join_columns' => array('`t`.`user_id`=' . session::item('user_id')));
     // Process query string
     $qstring = $this->parseQuerystring(config::item('invoices_per_page', 'billing'), session::item('total_transactions'));
     // Get invoices
     $invoices = array();
     if (session::item('total_transactions')) {
         $invoices = $this->transactions_model->getTransactions($params['join_columns'], '', $qstring['limit']);
     } else {
         view::setInfo(__('no_invoices_user', 'billing_transactions'));
     }
     // Set pagination
     $config = array('base_url' => config::siteURL('billing/invoices?'), 'total_items' => session::item('total_transactions'), 'items_per_page' => config::item('invoices_per_page', 'billing'), 'current_page' => $page, 'uri_segment' => 'page');
     $pagination = loader::library('pagination', $config, null);
     // Assign vars
     view::assign(array('invoices' => $invoices, 'pagination' => $pagination));
     // Set title
     view::setTitle(__('invoices', 'billing_transactions'));
     // Load view
     view::load('billing/invoices');
 }
예제 #6
0
파일: users.php 프로젝트: soremi/tutornavi
 public function results()
 {
     if (!input::get('search_id')) {
         $this->index();
         return;
     }
     // 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);
     // Process query string
     $qstring = $this->parseQuerystring($params['max']);
     // 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']);
     }
     // Get fields
     $fields = $this->fields_model->getFields('users', isset($params['values']['type_id']) ? $params['values']['type_id'] : 0, 'view', 'in_list');
     // Set pagination
     $config = array('base_url' => config::siteURL('users/results?' . $qstring['url']), 'total_items' => $params['total'], 'max_items' => config::item('max_search_results', 'system'), 'items_per_page' => config::item('users_per_page', 'users'), 'current_page' => $qstring['page'], 'uri_segment' => 'page');
     $pagination = loader::library('pagination', $config, null);
     // Assign vars
     view::assign(array('users' => $users, 'fields' => $fields, 'pagination' => $pagination));
     // Set meta tags
     $this->metatags_model->set('users', 'users_search_results');
     // Set title
     view::setTitle(__('search_results', 'system'), false);
     // Assign actions
     view::setAction('users?' . substr($qstring['url'], 0, -1), __('search_modify', 'system'), array('class' => 'icon-text icon-users-search-edit'));
     // Load view
     view::load('users/index');
 }
예제 #7
0
파일: news.php 프로젝트: soremi/tutornavi
 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'), 'delete' => __('delete', 'system'));
     // Check form action
     if (input::post('do_action')) {
         // Delete selected news
         if (input::post('action') == 'delete') {
             if (input::post('news_id') && is_array(input::post('news_id'))) {
                 foreach (input::post('news_id') as $newsID) {
                     $newsID = (int) $newsID;
                     if ($newsID && $newsID > 0) {
                         $this->delete($newsID);
                     }
                 }
             }
         }
         // Success
         view::setInfo(__('action_applied', 'system'));
         router::redirect('cp/content/news?' . $qstring['url'] . 'page=' . $qstring['page']);
     }
     // Get news
     $news = array();
     if ($params['total']) {
         $news = $this->news_model->getEntries('in_list', $params['join_columns'], $params['join_items'], $qstring['order'], $qstring['limit']);
     }
     // Create table grid
     $grid = array('uri' => 'cp/content/news', 'keyword' => 'news', 'header' => array('check' => array('html' => 'news_id', 'class' => 'check'), 'data_title_' . session::item('language') => array('html' => __('name', 'system'), 'class' => 'name', 'sortable' => true), '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 ($news as $entry) {
         $grid['content'][] = array('check' => array('html' => $entry['news_id']), 'data_title_' . session::item('language') => array('html' => html_helper::anchor('cp/content/news/edit/' . $entry['news_id'], text_helper::truncate($entry['data_title'], 64))), 'post_date' => array('html' => date_helper::formatDate($entry['post_date'])), 'status' => array('html' => $entry['active'] ? '<span class="label success small">' . __('yes', 'system') . '</span>' : '<span class="label important small">' . __('no', 'system') . '</span>'), 'actions' => array('html' => array('edit' => html_helper::anchor('cp/content/news/edit/' . $entry['news_id'], __('edit', 'system'), array('class' => 'edit')), 'delete' => html_helper::anchor('cp/content/news/delete/' . $entry['news_id'] . '?' . $qstring['url'] . 'page=' . $qstring['page'], __('delete', 'system'), array('data-html' => __('entry_delete?', 'news'), 'data-role' => 'confirm', 'class' => 'delete')))));
     }
     // Set pagination
     $config = array('base_url' => config::siteURL('cp/content/news?' . $qstring['url']), 'total_items' => $params['total'], 'items_per_page' => $this->newsPerPage, 'current_page' => $qstring['page'], 'uri_segment' => 'page');
     $pagination = loader::library('pagination', $config, null);
     // Filter hooks
     hook::filter('cp/content/news/browse/grid', $grid);
     hook::filter('cp/content/news/browse/actions', $actions);
     // Assign vars
     view::assign(array('grid' => $grid, 'actions' => $actions, 'pagination' => $pagination));
     // Set title
     view::setTitle(__('news_manage', 'system_navigation'));
     // Set trail
     if ($qstring['search_id']) {
         view::setTrail('cp/content/news?' . $qstring['url'] . 'page=' . $qstring['page'], __('search_results', 'system'));
     }
     // Assign actions
     view::setAction('cp/content/news/edit/', __('entry_new', 'news'), array('class' => 'icon-text icon-news-new'));
     view::setAction('#', __('search', 'system'), array('class' => 'icon-text icon-system-search', 'onclick' => '$(\'#news-search\').toggle();return false;'));
     // Load view
     view::load('cp/content/news/browse');
 }
예제 #8
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');
 }
예제 #9
0
 public function authorize($action = '')
 {
     $this->initialize();
     $request = $this->twitter->getRequestToken(config::siteURL('users/connect/confirm/twitter/' . $action));
     if ($request && $this->twitter->http_code == 200) {
         $data = array('twitter' => array('token' => $request['oauth_token'], 'secret' => $request['oauth_token_secret']));
         session::set($data, '', 'remote_connect');
         $url = $this->twitter->getAuthorizeURL($request['oauth_token']);
         router::redirect($url);
     }
 }
예제 #10
0
 public function browse()
 {
     // Parameters
     $params = array('join_columns' => array("`u`.`picture_id`!=0"), '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'), 'decline' => __('decline', 'system'), 'delete' => __('delete', 'system'));
     // Check form action
     if (input::post('do_action')) {
         // Delete selected albums
         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/pictures/browse?' . $qstring['url'] . 'page=' . $qstring['page']);
     }
     // Get pictures
     $users = array();
     if ($params['total']) {
         $users = $this->users_model->getUsers('in_list', isset($params['values']['type']) ? $params['values']['type'] : 0, $params['join_columns'], $params['join_items'], $qstring['order'], $qstring['limit']);
     }
     // Set pagination
     $config = array('base_url' => config::siteURL('cp/users/pictures/browse?' . $qstring['url']), 'total_items' => $params['total'], 'items_per_page' => $this->picturesPerPage, 'current_page' => $qstring['page'], 'uri_segment' => 'page');
     $pagination = loader::library('pagination', $config, null);
     // Assign vars
     view::assign(array('users' => $users, 'pagination' => $pagination, 'actions' => $actions));
     // Set title
     view::setTitle(__('users_pictures_manage', 'system_navigation'));
     // Set trail
     if ($qstring['search_id']) {
         view::setTrail('cp/users/pictures/browse?' . $qstring['url'] . 'page=' . $qstring['page'], __('search_results', 'system'));
     }
     // Assign actions
     view::setAction('#', __('search', 'system'), array('class' => 'icon-text icon-system-search', 'onclick' => '$(\'#pictures-search\').toggle();return false;'));
     // Load view
     view::load('cp/users/pictures/browse');
 }
예제 #11
0
 public function manage()
 {
     // Does user have permission to view visitors?
     if (!session::permission('users_visitors_browse', 'users')) {
         view::noAccess();
     }
     // Assign user from session to variable
     $user = session::section('session');
     // Get fields
     $fields = array();
     foreach (config::item('usertypes', 'core', 'keywords') as $categoryID => $keyword) {
         $fields[$categoryID] = $this->fields_model->getFields('users', $categoryID, 'view', 'in_list');
     }
     // Parameters
     $params = array('total' => session::permission('users_visitors_limit', 'users') && session::permission('users_visitors_limit', 'users') < $user['total_visitors'] ? session::permission('users_visitors_limit', 'users') : $user['total_visitors'], 'profiles' => true);
     // Process query string
     $qstring = $this->parseQuerystring($params['total']);
     // Get visitors
     $visitors = array();
     if ($params['total']) {
         $visitors = $this->users_visitors_model->getVisitors(session::item('user_id'), $qstring['order'], $qstring['limit'], $params);
     } else {
         view::setInfo(__('no_visitors', 'users_visitors'));
     }
     // Set pagination
     $config = array('base_url' => config::siteURL('users/visitors/manage?' . $qstring['url']), 'total_items' => $params['total'], 'items_per_page' => config::item('visitors_per_page', 'users'), 'current_page' => $qstring['page'], 'uri_segment' => 'page');
     $pagination = loader::library('pagination', $config, null);
     // Assign vars
     view::assign(array('user' => $user, 'visitors' => $visitors, 'fields' => $fields, 'pagination' => $pagination));
     // Dow we have new visitors?
     if (session::item('total_visitors_new')) {
         // Reset new visitors counter
         $this->users_visitors_model->resetCounter();
     }
     // Set title
     view::setTitle(__('my_visitors', 'system_navigation'));
     // Set trail
     view::setTrail(session::item('slug'), __('my_profile', 'system_navigation'));
     view::setTrail('users/visitors/manage', __('users_visitors', 'system_navigation'));
     // Load view
     view::load('users/visitors/manage');
 }
예제 #12
0
파일: index.php 프로젝트: soremi/tutornavi
    echo form_helper::openForm();
    ?>

				<fieldset class="form">
					<div class="row">
						<div class="field">

							<?php 
    view::load('system/elements/field/edit', array('prefix' => $resource . '_' . $itemID, 'field' => array('keyword' => 'comment', 'type' => 'textarea', 'class' => 'input-wide input-small')));
    ?>

						</div>
					</div>
					<div class="row actions clearfix">
						<?php 
    view::load('system/elements/button', array('onclick' => "postComment('" . config::siteURL('comments/browse') . "',{'do_save_comment':1,'resource':'" . $resource . "','item_id':" . $itemID . ",'split':" . $split . ",'post':" . ($post ? 1 : 0) . ",'info':" . ($info ? 1 : 0) . "});return false;", 'class' => 'small'));
    ?>
						<span class="icon icon-system-ajax ajax" style="display:none" id="ajax-comments-<?php 
    echo $resource;
    ?>
-<?php 
    echo $itemID;
    ?>
"></span>
					</div>
				</fieldset>

			<?php 
    echo form_helper::closeForm(array('do_save_comment' => 1));
    ?>
예제 #13
0
파일: system.php 프로젝트: soremi/tutornavi
 protected function _set_url($setting)
 {
     $setting['value'] = config::siteURL($setting['value']);
     return $setting;
 }
예제 #14
0
 public function authorize($action = '')
 {
     $this->initialize();
     $url = $this->facebook->getLoginUrl(array('redirect_uri' => config::siteURL(config::siteURL('users/connect/confirm/facebook/' . $action)), 'scope' => join(',', array('email', 'user_birthday', 'user_status', 'publish_stream', 'offline_access'))));
     router::redirect($url);
 }
예제 #15
0
파일: login.php 프로젝트: soremi/tutornavi
 protected function _resendHash()
 {
     // Create rules
     $rules = array('email' => array('label' => 'email', 'rules' => array('trim', 'required', 'max_length' => 255, 'valid_email')));
     // Assign rules
     validate::setRules($rules);
     // Validate fields
     if (!validate::run()) {
         return false;
     }
     // Does user exist?
     if (!($user = $this->users_model->getUser(input::post('email')))) {
         validate::setFieldError('email', __('email_invalid', 'users_signup'));
         return false;
     }
     // Is user's email already verified?
     if ($user['verified']) {
         view::setError(__('user_already_verified', 'users_signup'));
         return false;
     }
     // Loader
     loader::library('email');
     loader::model('system/requests');
     // Is this a recent request?
     if ($this->requests_model->isRecentRequest('signup', $user['user_id'], 0, 5)) {
         // Success
         view::setError(__('request_recent_sendhash', 'users_signup'));
         return false;
     }
     // Save resend hash request
     $hash = $this->requests_model->saveRequest('signup', $user['user_id']);
     $user['security_hash'] = $hash;
     $user['activation_link'] = config::siteURL('users/signup/confirm/' . $user['user_id'] . '/' . $hash);
     // Send activation email
     $this->email->sendTemplate('users_account_confirm', $user['email'], $user, $user['language_id']);
     // Success
     view::setInfo(__('confirm_email', 'users_signup'));
     router::redirect('users/login/index/verify');
 }
예제 #16
0
 protected function _saveMessage($conversationID, $conversation)
 {
     // Are we allowed to reply?
     if ($conversation['user_id'] == session::item('user_id') && !session::permission('messages_reply', 'messages') || !in_array($conversation['users'][$conversation['user_id']]['group_id'], session::permission('messages_reply', 'messages'))) {
         view::setError(__('no_action', 'system'));
         return false;
     } elseif (config::item('credits_active', 'billing') && session::permission('messages_credits', 'messages') && session::permission('messages_credits', 'messages') > session::item('total_credits')) {
         view::setError(__('no_credits', 'system', array(), array('%' => html_helper::anchor('billing/credits', '\\1'))));
         return false;
     }
     // Create rules
     $rules = array('message' => array('label' => __('message', 'messages'), 'rules' => array('trim', 'required', 'callback__is_messages_delay')));
     // Do we have character limit?
     if (session::permission('messages_characters_limit', 'messages')) {
         $rules['message']['rules']['max_length'] = session::permission('messages_characters_limit', 'messages');
     }
     // Assign rules
     validate::setRules($rules);
     // Validate fields
     if (!validate::run()) {
         return false;
     }
     // Get input data
     $message = input::post('message');
     // Save message
     if (!($messageID = $this->messages_model->saveMessage(0, $conversationID, $message, $conversation['recipients']))) {
         if (!validate::getTotalErrors()) {
             view::setError(__('save_error', 'system'));
         }
         return false;
     }
     // Create email replacement tags
     $tags = array();
     foreach (session::section('session') as $key => $value) {
         $tags['from.' . $key] = $value;
     }
     $tags['conversation_link'] = config::siteURL('messages/view/' . $conversationID);
     // Send new private message email
     loader::library('email');
     foreach ($conversation['users'] as $user) {
         if ($user['user_id'] != session::item('user_id') && (!isset($user['config']['notify_messages']) || $user['config']['notify_messages'])) {
             $this->email->sendTemplate('messages_new', $user['email'], array_merge($tags, $user), $user['language_id']);
         }
     }
     // Success
     view::setInfo(__('message_sent', 'messages'));
     router::redirect('messages/view/' . $conversationID);
 }
예제 #17
0
 public function index()
 {
     // Get URI vars
     $adID = (int) uri::segment(4);
     // Get albadum
     if (!$adID || !($ad = $this->classifieds_model->getAd($adID, 'in_view'))) {
         view::setError(__('no_ad', 'classifieds'));
         router::redirect('classifieds');
     }
     // Is this our own album?
     if ($ad['user_id'] == session::item('user_id')) {
         // Assign user from session to variable
         $user = session::section('session');
     } else {
         // Get user
         if (!($user = $this->users_model->getUser($ad['user_id'])) || !$user['active'] || !$user['verified']) {
             error::show404();
         }
         // Does user have permission to view this user group/type and browse pictures?
         if (!in_array($user['group_id'], session::permission('users_groups_browse', 'users')) || !in_array($user['type_id'], session::permission('users_types_browse', 'users')) || !session::permission('ads_view', 'classifieds')) {
             view::noAccess();
         }
     }
     // Parameters
     $params = array('select_users' => false, 'join_columns' => array('`a`.`ad_id`=' . $adID), 'join_items' => array(), 'total' => $user['user_id'] != session::item('user_id') ? $ad['total_pictures'] : $ad['total_pictures'] + $ad['total_pictures_i']);
     if ($user['user_id'] != session::item('user_id')) {
         $params['join_columns'][] = '`a`.`active`=1';
         $params['join_columns'][] = '`p`.`active`=1';
     }
     // Process filters
     $params = $this->parseCounters($params, 'manage');
     // Process query string
     $qstring = $this->parseQuerystring(config::item('pictures_per_page', 'classifieds'), $params['max']);
     // Get pictures
     $pictures = array();
     if ($params['total']) {
         $pictures = $this->classifieds_pictures_model->getPictures('in_list', $params['join_columns'], $params['join_items'], $qstring['order'], $qstring['limit'], $params);
     }
     // Set pagination
     $config = array('base_url' => config::siteURL('classifieds/pictures/index/' . $adID . '/' . text_helper::slug($ad['data_title'], 100) . '/?' . $qstring['url']), 'total_items' => $params['total'], 'max_items' => $params['max'], 'items_per_page' => config::item('pictures_per_page', 'classifieds'), 'current_page' => $qstring['page'], 'uri_segment' => 'page');
     $pagination = loader::library('pagination', $config, null);
     // Load ratings
     if (config::item('ad_rating', 'classifieds') == 'stars') {
         // Load votes model
         loader::model('comments/votes');
         // Get votes
         $ad['user_vote'] = $this->votes_model->getVote('classified_ad', $adID);
     } elseif (config::item('ad_rating', 'classifieds') == 'likes') {
         // Load likes model
         loader::model('comments/likes');
         // Get likes
         $ad['user_vote'] = $this->likes_model->getLike('classified_ad', $adID);
     }
     // Assign vars
     view::assign(array('adID' => $adID, 'ad' => $ad, 'user' => $user, 'pictures' => $pictures, 'pagination' => $pagination));
     // Set meta tags
     $this->metatags_model->set('classifieds', 'classifieds_view', array('user' => $user, 'ad' => $ad));
     // Set title
     view::setTitle($ad['data_title'], false);
     // Set trail
     if ($user['user_id'] == session::item('user_id')) {
         view::setTrail(session::item('slug'), __('my_profile', 'system_navigation'));
         view::setTrail('classifieds/manage', __('classifieds', 'system_navigation'));
     } else {
         view::setTrail($user['slug'], $user['name']);
         view::setTrail('classifieds/user/' . $user['slug_id'], __('classifieds', 'system_navigation'));
     }
     view::setTrail('classifieds/view/' . $ad['ad_id'] . '/' . text_helper::slug($ad['data_title'], 100), __('ad_view', 'classifieds'), array('side' => true));
     // Assign actions
     if ($user['user_id'] == session::item('user_id')) {
         view::setAction('classifieds/pictures/upload/' . $adID, __('pictures_new', 'classifieds'), array('class' => 'icon-text icon-classifieds-pictures-new', 'data-role' => 'modal', 'data-title' => __('pictures_new', 'classifieds')));
         if ($ad['total_pictures'] + $ad['total_pictures_i'] > 0) {
             view::setAction('classifieds/pictures/manage/' . $adID, __('pictures_organize', 'classifieds'), array('class' => 'icon-text icon-classifieds-pictures-edit'));
         }
     }
     // Load view
     view::load('classifieds/pictures/index');
 }
예제 #18
0
 protected function _saveEmail()
 {
     // Creat rules
     $rules = array('email' => array('label' => __('email_new', 'users'), 'rules' => array('trim', 'required', 'max_length' => 255, 'valid_email', 'callback__is_unique_email')), 'password' => array('label' => __('password_current', 'users'), 'rules' => array('trim', 'required', 'min_length' => 4, 'max_length' => 128, 'callback__is_valid_password')));
     // Assign rules
     validate::setRules($rules);
     // Validate fields
     if (!validate::run()) {
         return false;
     }
     // Do we need to verify email address?
     if (config::item('signup_email_verify', 'users')) {
         // Load requests model
         loader::model('system/requests');
         // Is this a recent request?
         if (config::item('signup_delay', 'users') != -1 && $this->requests_model->isRecentRequest('newemail', session::item('user_id'), 0, config::item('signup_delay', 'users'))) {
             // Success
             view::setError(__('email_change_recent', 'users'));
             return false;
         }
         // Load email library
         loader::library('email');
         // Save signup request
         $hash = $this->requests_model->saveRequest('newemail', session::item('user_id'), 0, input::post('email'));
         $tags = session::section('session');
         $tags['security_hash'] = $hash;
         $tags['activation_link'] = config::siteURL('users/settings/newemail/' . $hash);
         // Send activation email
         $this->email->sendTemplate('users_account_confirm', input::post('email'), $tags, session::item('language_id'));
         // Success
         view::setInfo(__('email_confirm', 'users'));
     } else {
         // Save user
         if (!$this->users_model->saveEmail(session::item('user_id'), input::post('email'))) {
             view::setError(__('save_error', 'system'));
             return false;
         }
         // Success
         view::setInfo(__('email_saved', 'users'));
     }
     router::redirect('users/settings');
 }
예제 #19
0
파일: albums.php 프로젝트: soremi/tutornavi
 public function manage()
 {
     // Is user loggedin ?
     if (!users_helper::isLoggedin()) {
         router::redirect('users/login');
     } elseif (!session::permission('albums_post', 'pictures')) {
         view::noAccess(session::item('slug'));
     }
     // Assign user from session to variable
     $user = session::section('session');
     // Parameters
     $params = array('select_users' => false, 'join_columns' => array('`a`.`user_id`=' . session::item('user_id')), 'join_items' => array(), 'total' => $user['total_albums']);
     // Process filters
     $params = $this->parseCounters($params, 'manage');
     // Process query string
     $qstring = $this->parseQuerystring(config::item('user_albums_per_page', 'pictures'), $params['max']);
     // Get albums
     $albums = array();
     if ($params['total']) {
         $albums = $this->pictures_albums_model->getAlbums('in_list', $params['join_columns'], $params['join_items'], $qstring['order'], $qstring['limit'], $params);
     }
     // Set pagination
     $config = array('base_url' => config::siteURL('pictures/albums/manage?' . $qstring['url']), 'total_items' => $params['total'], 'max_items' => $params['max'], 'items_per_page' => config::item('user_albums_per_page', 'pictures'), 'current_page' => $qstring['page'], 'uri_segment' => 'page');
     $pagination = loader::library('pagination', $config, null);
     // Assign vars
     view::assign(array('user' => $user, 'albums' => $albums, 'pagination' => $pagination));
     // Set title
     view::setTitle(__('my_albums', 'system_navigation'));
     // Set trail
     view::setTrail(session::item('slug'), __('my_profile', 'system_navigation'));
     view::setTrail('pictures/manage', __('pictures_albums', 'system_navigation'));
     // Assign actions
     view::setAction('pictures/albums/edit', __('album_new', 'pictures'), array('class' => 'icon-text icon-pictures-albums-new'));
     if (session::permission('albums_search', 'pictures') && ($params['total'] || input::post_get('do_search'))) {
         view::setAction('#', __('search', 'system'), array('class' => 'icon-text icon-system-search', 'onclick' => '$(\'#albums-search\').toggle();return false;'));
     }
     // Load view
     view::load('pictures/albums/manage');
 }
예제 #20
0
 public function browse()
 {
     // Get gateways
     $gateways = array();
     foreach ($this->gateways_model->getGateways(false, false) as $gateway) {
         $gateways[$gateway['gateway_id']] = $gateway['name'];
     }
     // Parameters
     $params = array('join_columns' => array());
     // Process filters
     $params = $this->parseCounters($params, $gateways);
     // Process query string
     $qstring = $this->parseQuerystring($params['total']);
     // Create actions
     $actions = array(0 => __('select', 'system'), 'delete' => __('delete', 'system'));
     // Check form action
     if (input::post('do_action')) {
         // Delete selected transactions
         if (input::post('action') == 'delete') {
             if (input::post('transaction_id') && is_array(input::post('transaction_id'))) {
                 foreach (input::post('transaction_id') as $transactionID) {
                     $transactionID = (int) $transactionID;
                     if ($transactionID && $transactionID > 0) {
                         $this->delete($transactionID);
                     }
                 }
             }
         }
         // Success
         view::setInfo(__('action_applied', 'system'));
         router::redirect('cp/billing/transactions?' . $qstring['url'] . 'page=' . $qstring['page']);
     }
     // Get transaction
     $transactions = array();
     if ($params['total']) {
         $transactions = $this->transactions_model->getTransactions($params['join_columns'], $qstring['order'], $qstring['limit']);
     }
     // Create table grid
     $grid = array('uri' => 'cp/billing/transactions', 'keyword' => 'billing_transactions', 'header' => array('check' => array('html' => 'transaction_id', 'class' => 'check'), 'product' => array('html' => __('product', 'billing'), 'class' => 'product'), 'user' => array('html' => __('user', 'system'), 'class' => 'user'), 'gateway' => array('html' => __('payment_gateway', 'billing'), 'class' => 'gateway'), 'amount' => array('html' => __('price', 'billing'), 'class' => 'price', 'sortable' => true), 'post_date' => array('html' => __('payment_date', 'billing'), 'class' => 'date', 'sortable' => true), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array());
     // Create grid content
     foreach ($transactions as $transaction) {
         $grid['content'][] = array('check' => array('html' => $transaction['transaction_id']), 'product' => array('html' => html_helper::anchor('cp/billing/transactions/view/' . $transaction['transaction_id'], $transaction['name'])), 'user' => array('html' => users_helper::anchor($transaction['user'])), 'gateway' => array('html' => $gateways[$transaction['gateway_id']]), 'amount' => array('html' => money_helper::symbol(config::item('currency', 'billing')) . $transaction['amount']), 'post_date' => array('html' => date_helper::formatDate($transaction['post_date'])), 'actions' => array('html' => array('edit' => html_helper::anchor('cp/billing/transactions/view/' . $transaction['transaction_id'], __('details', 'system'), array('class' => 'details')), 'delete' => html_helper::anchor('cp/billing/transactions/delete/' . $transaction['transaction_id'] . '?' . $qstring['url'] . 'page=' . $qstring['page'], __('delete', 'system'), array('data-html' => __('transaction_delete?', 'billing_transactions'), 'data-role' => 'confirm', 'class' => 'delete')))));
     }
     // Set pagination
     $config = array('base_url' => config::siteURL('cp/billing/transactions?' . $qstring['url']), 'total_items' => $params['total'], 'items_per_page' => $this->transactionPerPage, 'current_page' => $qstring['page'], 'uri_segment' => 'page');
     $pagination = loader::library('pagination', $config, null);
     // Filter hooks
     hook::filter('cp/billing/transactions/browse/grid', $grid);
     hook::filter('cp/billing/transactions/browse/actions', $actions);
     // Assign vars
     view::assign(array('grid' => $grid, 'actions' => $actions, 'pagination' => $pagination));
     // Set title
     view::setTitle(__('billing_transactions_manage', 'system_navigation'));
     // Set trail
     if ($qstring['search_id']) {
         view::setTrail('cp/billing/transactions?' . $qstring['url'] . 'page=' . $qstring['page'], __('search_results', 'system'));
     }
     // Assign actions
     view::setAction('#', __('search', 'system'), array('class' => 'icon-text icon-system-search', 'onclick' => '$(\'#transactions-search\').toggle();return false;'));
     // Load view
     view::load('cp/billing/transactions/browse');
 }
예제 #21
0
파일: post.php 프로젝트: soremi/tutornavi
<?php

echo form_helper::openForm();
?>

	<fieldset class="form">
		<div class="row">
			<div class="field">

				<?php 
view::load('system/elements/field/edit', array('prefix' => 'timeline', 'field' => array('keyword' => 'message', 'type' => 'textarea', 'class' => 'input-wide input-small preview', 'placeholder' => __('message_placeholder', 'timeline'))));
?>

			</div>
		</div>
		<div class="row actions clearfix" style="display:none">
			<?php 
view::load('system/elements/button', array('onclick' => "timelinePost('" . config::siteURL('timeline') . "',{'post':1,'user_id':" . ($user ? $user['user_id'] : 0) . "});return false;", 'class' => 'small'));
?>
			<span class="icon icon-system-ajax ajax" style="display:none" id="ajax-timeline-post"></span>
		</div>
	</fieldset>

<?php 
echo form_helper::closeForm(array('do_save_message' => 1));
예제 #22
0
 public function add()
 {
     // 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 user have permission to view this user group/type?
     if (!in_array($user['group_id'], session::permission('users_groups_browse', 'users')) || !in_array($user['type_id'], session::permission('users_types_browse', 'users'))) {
         view::noAccess();
     }
     // Did we block this user or did they block us?
     if (config::item('blacklist_active', 'users') && ($blocked = $this->users_blocked_model->getUser($user['user_id']))) {
         if ($blocked['user_id'] == session::item('user_id')) {
             view::setError(__('user_blocked', 'users'));
         } else {
             view::setError(__('user_blocked_self', 'users'));
         }
         // Load view
         router::redirect($user['slug']);
     }
     // Does friend exist?
     if ($friend = $this->users_friends_model->getFriend($user['user_id'], false)) {
         // Is request already approved?
         if ($friend['active']) {
             view::setInfo(__('friend_active', 'users_friends'));
         } elseif ($friend['user_id'] == session::item('user_id')) {
             view::setError(__('friend_duplicate', 'users_friends'));
         } else {
             view::setError(__('friend_duplicate_self', 'users_friends'));
         }
         router::redirect($user['slug']);
     }
     // Add friend request
     $this->users_friends_model->addFriend($user['user_id']);
     // Send friend request email
     if (!isset($user['config']['notify_friends_request']) || $user['config']['notify_friends_request']) {
         // Create email replacement tags
         $tags = array();
         foreach (session::section('session') as $key => $value) {
             $tags['from.' . $key] = $value;
         }
         $tags = array_merge($tags, $user);
         $tags['friends_link'] = config::siteURL('users/friends/confirm/' . session::item('slug_id'));
         loader::library('email');
         $this->email->sendTemplate('users_friend_request', $user['email'], $tags, $user['language_id']);
     }
     // Success
     view::setInfo(__('friend_requested', 'users_friends'));
     router::redirect($user['slug']);
 }
예제 #23
0
 public function browse()
 {
     // Get URI vars
     $adID = (int) uri::segment(6);
     // Get ad
     if ($adID && !($ad = $this->classifieds_model->getAd($adID, 'in_view'))) {
         view::setError(__('no_ad', 'classifieds'));
         router::redirect('cp/plugins/classifieds');
     }
     // Get user
     if ($adID && !($user = $this->users_model->getUser($ad['user_id']))) {
         view::setError(__('no_user', 'users'));
         router::redirect('cp/plugins/classifieds');
     }
     // Parameters
     $params = array('join_columns' => $adID ? array('`p`.`ad_id`=' . $adID) : array(), 'join_items' => array());
     // Process filters
     $params = $this->parseCounters($adID, $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 ads
         if (input::post('action') && isset($actions[input::post('action')]) && input::post('picture_id') && is_array(input::post('picture_id'))) {
             foreach (input::post('picture_id') as $pictureID) {
                 $pictureID = (int) $pictureID;
                 if ($pictureID && $pictureID > 0) {
                     $this->action(input::post('action'), $pictureID);
                 }
             }
         }
         // Success
         view::setInfo(__('action_applied', 'system'));
         router::redirect('cp/plugins/classifieds/pictures/browse/' . $adID . '?' . $qstring['url'] . 'page=' . $qstring['page']);
     }
     // Get pictures
     $pictures = array();
     if ($params['total']) {
         $pictures = $this->classifieds_pictures_model->getPictures('in_list', $params['join_columns'], $params['join_items'], $qstring['order'], $qstring['limit']);
     }
     // Set pagination
     $config = array('base_url' => config::siteURL('cp/plugins/classifieds/pictures/browse/' . $adID . '?' . $qstring['url']), 'total_items' => $params['total'], 'items_per_page' => $this->picturesPerPage, 'current_page' => $qstring['page'], 'uri_segment' => 'page');
     $pagination = loader::library('pagination', $config, null);
     // Assign vars
     view::assign(array('adID' => $adID, 'ad' => $adID ? $ad : array(), 'user' => $adID ? $user : array(), 'pictures' => $pictures, 'pagination' => $pagination, 'actions' => $actions));
     // Set title
     view::setTitle(__('pictures', 'classifieds'));
     // Set trail
     if ($adID) {
         view::setTrail('cp/plugins/classifieds/edit/' . $adID, __('ad_edit', 'classifieds') . ' - ' . $ad['data_title']);
     }
     view::setTrail('cp/plugins/classifieds/pictures/browse/' . $adID, __('pictures', 'classifieds'));
     if ($qstring['search_id']) {
         view::setTrail('cp/plugins/classifieds/pictures/browse/' . $adID . '?' . $qstring['url'] . 'page=' . $qstring['page'], __('search_results', 'system'));
     }
     // Assign actions
     view::setAction('#', __('search', 'system'), array('class' => 'icon-text icon-system-search', 'onclick' => '$(\'#pictures-search\').toggle();return false;'));
     // Load view
     view::load('cp/plugins/classifieds/pictures/browse');
 }
예제 #24
0
 public function browse()
 {
     // Parameters
     $params = array('join_columns' => array());
     // Process filters
     $params = $this->parseCounters($params);
     // Process query string
     $qstring = $this->parseQuerystring($params['total']);
     // Create actions
     $actions = array(0 => __('select', 'system'), 'dismiss' => __('report_dismiss', 'reports'));
     // Check form action
     if (input::post('do_action')) {
         // Delete selected reports
         if (input::post('action') == 'dismiss') {
             if (input::post('report_id') && is_array(input::post('report_id'))) {
                 foreach (input::post('report_id') as $reportID) {
                     $reportID = (int) $reportID;
                     if ($reportID && $reportID > 0) {
                         $this->dismiss($reportID);
                     }
                 }
             }
         }
         // Success
         view::setInfo(__('action_applied', 'system'));
         router::redirect('cp/content/reports?' . $qstring['url'] . 'page=' . $qstring['page']);
     }
     // Get reports
     $reports = array();
     if ($params['total']) {
         $reports = $this->reports_model->getReports('', $params['join_columns'], $qstring['order'], $qstring['limit']);
     }
     // Load subjects model
     loader::model('reports/subjects', array(), 'reports_subjects_model');
     // Get subjects
     $subjects = array();
     $data = $this->reports_subjects_model->getSubjects();
     foreach ($data as $subject) {
         $subjects[$subject['subject_id']] = $subject['name'];
     }
     // Create table grid
     $grid = array('uri' => 'cp/content/reports', 'keyword' => 'reports', 'header' => array('check' => array('html' => 'report_id', 'class' => 'check'), 'subject' => array('html' => __('report_subject', 'reports'), 'class' => 'subject'), 'message' => array('html' => __('report_message', 'reports'), 'class' => 'comment'), 'item' => array('html' => __('report_item', 'reports'), 'class' => 'item'), 'user' => array('html' => __('reporter', 'reports'), '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 ($reports as $report) {
         $grid['content'][] = array('check' => array('html' => $report['report_id']), 'subject' => array('html' => isset($subjects[$report['subject_id']]) ? $subjects[$report['subject_id']] : ''), 'message' => array('html' => text_helper::truncate($report['message'], 56) . (utf8::strlen($report['message']) > 56 ? ' ' . html_helper::anchor('', __('view', 'system'), array('data-title' => __('message', 'reports'), 'data-role' => 'modal', 'data-display' => 'html', 'data-html' => text_helper::entities($report['message']))) : '')), 'item' => array('html' => __(config::item('resources', 'core', $report['resource_id']), config::item('resources', 'core', config::item('resources', 'core', $report['resource_id']), 'plugin'))), 'user' => array('html' => users_helper::anchor($report['user'])), 'post_date' => array('html' => date_helper::formatDate($report['post_date'])), 'actions' => array('html' => array('actions' => html_helper::anchor('cp/content/reports/actions/' . $report['report_id'], __('report_actions', 'reports'), array('class' => 'action', 'data-role' => 'modal', 'data-display' => 'iframe', 'data-title' => __('report_action_select', 'reports'))), 'view' => html_helper::anchor('cp/content/reports/view/' . $report['report_id'], __('report_view', 'reports'), array('class' => 'view')), 'dismiss' => html_helper::anchor('cp/content/reports/dismiss/' . $report['report_id'] . '?' . $qstring['url'] . 'page=' . $qstring['page'], __('report_dismiss', 'reports'), array('data-html' => __('report_dismiss?', 'reports'), 'data-role' => 'confirm', 'class' => 'delete')))));
     }
     // Set pagination
     $config = array('base_url' => config::siteURL('cp/content/reports?' . $qstring['url']), 'total_items' => $params['total'], 'items_per_page' => $this->reportsPerPage, 'current_page' => $qstring['page'], 'uri_segment' => 'page');
     $pagination = loader::library('pagination', $config, null);
     // Filter hooks
     hook::filter('cp/content/reports/browse/grid', $grid);
     hook::filter('cp/content/reports/browse/actions', $actions);
     // Assign vars
     view::assign(array('grid' => $grid, 'actions' => $actions, 'pagination' => $pagination));
     // Set title
     view::setTitle(__('reports_manage', 'system_navigation'));
     // Set trail
     if ($qstring['search_id']) {
         view::setTrail('cp/content/reports?' . $qstring['url'] . 'page=' . $qstring['page'], __('search_results', 'system'));
     }
     // Assign actions
     view::setAction('#', __('search', 'system'), array('class' => 'icon-text icon-system-search', 'onclick' => '$(\'#reports-search\').toggle();return false;'));
     // Load view
     view::load('cp/content/reports/browse');
 }
예제 #25
0
파일: users.php 프로젝트: soremi/tutornavi
 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');
 }
예제 #26
0
파일: signup.php 프로젝트: soremi/tutornavi
 protected function _createUser()
 {
     // Verify email and username one more time
     if (!$this->_is_unique_email(session::item('account', 'signup', 'email'))) {
         view::setError(__('email_duplicate', 'users_signup'));
         router::redirect('users/signup');
     } elseif (config::item('user_username', 'users') && !$this->_is_valid_username(session::item('account', 'signup', 'username'))) {
         view::setError(__('duplicate_username', 'users_signup'));
         router::redirect('users/signup');
     }
     // Get user data
     $user = array('email' => session::item('account', 'signup', 'email'), 'password' => session::item('account', 'signup', 'password') ? session::item('account', 'signup', 'password') : '', 'username' => session::item('account', 'signup', 'username'), 'type_id' => count(config::item('usertypes', 'core', 'names')) > 1 ? session::item('account', 'signup', 'type_id') : config::item('type_default_id', 'users'), 'group_id' => config::item('group_default_id', 'users'), 'verified' => config::item('signup_email_verify', 'users') && !session::item('connection', 'remote_connect') ? 0 : 1, 'active' => config::item('signup_admin_verify', 'users') ? 0 : 1, 'picture_id' => session::item('picture', 'signup', 'file_id') ? session::item('picture', 'signup', 'file_id') : 0, 'picture_active' => session::item('picture', 'signup', 'file_id') ? config::item('signup_picture_verify', 'users') ? 9 : 1 : 0, 'picture_date' => date_helper::now());
     // Set names
     $user['name1'] = session::item('profile', 'signup', 'data_' . config::item('usertypes', 'core', 'fields', $user['type_id'], 1));
     $user['name2'] = session::item('profile', 'signup', 'data_' . config::item('usertypes', 'core', 'fields', $user['type_id'], 2));
     $user['name1'] = $user['name1'] ? $user['name1'] : '';
     $user['name2'] = $user['name2'] ? $user['name2'] : '';
     // Get fields
     $fields = $this->fields_model->getFields('users', $user['type_id'], 'edit', 'in_signup');
     // Save user
     $userID = $this->users_model->saveUser(0, $user);
     // Save profile
     if (session::item('profile', 'signup')) {
         $this->users_model->saveProfile($userID, $user['type_id'], session::item('profile', 'signup'), $fields, array(), true);
     }
     // Did user upload a picture?
     if (session::item('picture', 'signup', 'file_id')) {
         // Update file's user ID
         $this->storage_model->updateUserID(session::item('picture', 'signup', 'file_id'), $userID, 5);
     }
     // Are we signing up using a third party site?
     $remoteconn = false;
     if (session::item('connection', 'remote_connect')) {
         $remoteconn = true;
         loader::library('authentication/' . session::item('connection', 'remote_connect', 'name'));
         $this->{session::item('connection', 'remote_connect', 'name')}->saveToken($userID);
         // Remove temporary session values
         session::delete('', 'remote_connect');
     }
     // Remove temporary session values
     session::delete('', 'signup');
     // Do we need to verify email address?
     if (config::item('signup_email_verify', 'users') && !$remoteconn) {
         // Get user data
         if (!($user = $this->users_model->getUser($userID))) {
             validate::setFieldError('email', __('email_invalid', 'users_signup'));
             return false;
         }
         // Save signup request
         $hash = $this->requests_model->saveRequest('signup', $userID);
         $user['security_hash'] = $hash;
         $user['activation_link'] = config::siteURL('users/signup/confirm/' . $userID . '/' . $hash);
         // Send activation email
         $this->email->sendTemplate('users_account_confirm', $user['email'], $user, $user['language_id']);
         // Success
         view::setInfo(__('confirm_email', 'users_signup'));
         router::redirect('users/login/index/verify');
     } elseif (config::item('signup_admin_verify', 'users')) {
         // Success
         view::setInfo(__('confirm_user', 'users_signup'));
         router::redirect('users/login/index/approve');
     } else {
         // Do we need to send welcome email?
         if (config::item('signup_email_welcome', 'users')) {
             // Get user data
             if (!($user = $this->users_model->getUser($userID))) {
                 validate::setFieldError('email', __('email_invalid', 'users_signup'));
                 return false;
             }
             // Send welcome email
             $this->email->sendTemplate('users_account_welcome', $user['email'], $user, $user['language_id']);
         }
         // Login user
         // $this->users_model->login($userID);
         // Success
         view::setInfo(__('user_registered', 'users_signup'));
         view::load('users/signup/registration_finish');
         // router::redirect(session::item('slug'));
     }
 }