本文整理汇总了PHP中JO_Session::clear方法的典型用法代码示例。如果您正苦于以下问题:PHP JO_Session::clear方法的具体用法?PHP JO_Session::clear怎么用?PHP JO_Session::clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JO_Session
的用法示例。
在下文中一共展示了JO_Session::clear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: steponeAction
public function steponeAction($error = null)
{
$this->noLayout(true);
$request = $this->getRequest();
$this->view->form_action = WM_Router::create($request->getBaseUrl() . '?controller=addpin_gallery&action=steptwo');
$this->view->upload_action = WM_Router::create($request->getBaseUrl() . '?controller=addpin_gallery&action=upload_images');
$this->view->js_i18n = WM_Router::create($request->getBaseUrl() . '?controller=addpin_gallery&action=i18n');
$this->view->steptwo = WM_Router::create($request->getBaseUrl() . '?controller=addpin_gallery&action=steptwo');
$this->view->files_limit = (int) Helper_Config::get('config_gallery_limit');
if (JO_Session::get('user[user_id]')) {
$files = JO_Session::get('gallery_upload_images');
if ($files) {
$imageObject = new Helper_Images();
foreach ($files as $file) {
$imageObject->deleteImages('/../' . $file['path'] . $file['tmp_name']);
}
JO_Session::clear('gallery_upload_images');
}
if ($error) {
$this->view->error_upload_image = $error;
}
} else {
$this->view->redirect = WM_Router::create($request->getBaseUrl() . '?controller=users&action=login');
}
}
示例2: forwardAction
public function forwardAction()
{
$request = $this->getRequest();
JO_Session::clear('instagram_user_data');
JO_Session::clear('instagram_fnc');
JO_Session::clear('instagram_next');
/**
* @var Helper_Modules_Instagram
*/
$instagramoauth = null;
$this->initInstagram($instagramoauth);
if ($request->issetQuery('next')) {
JO_Session::set('instagram_next', urlencode(html_entity_decode($request->getQuery('next'))));
}
if ($request->getQuery('instagram_fnc')) {
JO_Session::set('instagram_fnc', $request->getQuery('instagram_fnc'));
}
if (!$this->user_data) {
$instagramoauth->openAuthorizationUrl();
} else {
if (JO_Session::get('instagram_fnc')) {
$this->redirect(urldecode(JO_Session::get('instagram_next')));
} else {
$this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=modules_instagram_login'));
}
}
$this->setViewChange('no_account');
$page_login_trouble = Model_Pages::getPage(Helper_Config::get('page_login_trouble'));
if ($page_login_trouble) {
$this->view->page_login_trouble = array('title' => $page_login_trouble['title'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=pages&action=read&page_id=' . $page_login_trouble['page_id']));
}
}
示例3: indexAction
public function indexAction()
{
$this->getLayout()->meta_title = $this->translate('Contacts');
$this->getLayout()->meta_description = $this->translate('Contacts');
$request = $this->getRequest();
if (JO_Session::issetKey('msg_success')) {
$this->view->is_send = JO_Session::get('msg_success');
JO_Session::clear('msg_success');
} elseif (JO_Session::issetKey('msg_error')) {
$this->view->error = JO_Session::get('msg_error');
$this->view->user = JO_Session::get('data');
JO_Session::clear('msg_error');
JO_Session::clear('data');
}
$this->view->categories = array();
$categories = Model_Contactscategories::getCategories();
if ($categories) {
foreach ($categories as $category) {
$this->view->categories[$category['id']] = array('id' => $category['id'], 'name' => $category['name'], 'text' => html_entity_decode($category['text'], ENT_QUOTES, 'utf-8'));
}
}
if (empty($this->view->user['username'])) {
$this->view->user['username'] = JO_Session::get('username');
}
if (empty($this->view->user['email'])) {
$this->view->user['email'] = JO_Session::get('email');
}
$this->view->contact_link = WM_Router::create($request->getBaseUrl() . '?controller=contacts&action=send_mail');
$this->view->children = array();
$this->view->children['header_part'] = 'layout/header_part';
$this->view->children['footer_part'] = 'layout/footer_part';
}
示例4: upload_imagesAction
public function upload_imagesAction()
{
$request = $this->getRequest();
if (JO_Session::get('user[user_id]')) {
if (JO_Session::get('upload_from_file')) {
@unlink(BASE_PATH . JO_Session::get('upload_from_file'));
JO_Session::clear('upload_from_file');
JO_Session::clear('upload_from_file_name');
}
$image = $request->getFile('file');
if (!$image) {
$this->view->error = $this->translate('There is no file selected');
} else {
$temporary = '/cache/review/';
$upload_folder = BASE_PATH . $temporary;
$upload = new Helper_Upload();
$files_delete = glob($upload_folder . '*.*');
if ($files_delete) {
for ($i = 0; $i < min(count($files_delete), 250); $i++) {
if (filemtime($files_delete[$i]) + 86400 < time()) {
@unlink($files_delete[$i]);
}
}
}
$upload->setFile($image)->setExtension(array('.jpg', '.jpeg', '.png', '.gif'))->setUploadDir($upload_folder);
$new_name = md5(time() . serialize($image));
if ($upload->upload($new_name)) {
$info = $upload->getFileInfo();
if ($info) {
$config_image_minimum_size = (int) Helper_Config::get('config_image_minimum_size');
if (!$config_image_minimum_size) {
$config_image_minimum_size = 80;
}
if (isset($info['image_dimension']['x']) && $info['image_dimension']['x'] >= $config_image_minimum_size && $info['image_dimension']['y'] >= $config_image_minimum_size) {
$this->view->from_url = WM_Router::create($request->getBaseUrl() . '?controller=addpin_fromfile&action=stepone');
$this->view->success = 1;
JO_Session::set('upload_from_file', $temporary . $info['name']);
JO_Session::set('upload_from_file_name', $image['name']);
} else {
@unlink($upload_folder . $info['name']);
$this->view->error = sprintf($this->translate('Photo size must be larger width and height of %s px'), $config_image_minimum_size);
}
} else {
$this->view->error = $this->translate('An unknown error');
}
} else {
$this->view->error = $upload->getError();
}
}
} else {
$this->view->location = WM_Router::create($request->getBaseUrl() . '?controller=users&action=login');
}
echo $this->renderScript('json');
}
示例5: indexAction
public function indexAction()
{
$request = $this->getRequest();
if (!JO_Session::get('user_id')) {
$this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=login'));
}
if (JO_Session::get('msg_success')) {
$this->view->msg_error = JO_Session::get('msg_success');
JO_Session::clear('msg_success');
}
if (JO_Session::get('msg_error')) {
$this->view->msg_error = JO_Session::get('msg_error');
JO_Session::clear('msg_error');
}
$this->view->questions = $questions = Model_Quiz::getAllQuestions(0, 0, '', 'RAND()');
$this->view->answers = $answers = Model_Quiz::getAllAnswers(0, 0, '', true);
if ($request->isPost()) {
$rightAnswers = 0;
$user_answers = $request->getPost('answers');
if (is_array($user_answers)) {
foreach ($user_answers as $question => $answer) {
if (isset($answers[$question][$answer]) && $answers[$question][$answer]['right'] == 'true') {
$rightAnswers++;
}
}
}
if ($rightAnswers > 0 && count($questions) == $rightAnswers) {
$_SESSION['user']['quiz'] = 'true';
JO_Session::set('quiz', 'true');
Model_Users::updateQuiz(JO_Session::get('user_id'), 'true');
JO_Session::set('msg_success', 'You have successfully completed the quiz');
$this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=upload'));
} else {
JO_Session::set('msg_error', 'You have to answer all questions correctly. You have ' . $rightAnswers . ' right answers from ' . $question . ' questions');
$this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=quiz'));
}
}
$this->view->usersCount = Model_Users::countUsers();
$this->view->itemsCount = Model_Items::countItems();
$this->getLayout()->meta_title = $this->translate('Quiz');
$this->getLayout()->meta_description = $this->translate('Quiz');
$this->view->page_name = $this->translate('Quiz');
/* CRUMBS */
$this->view->crumbs = array();
$this->view->crumbs[] = array('name' => $this->view->translate('Home'), 'href' => $request->getBaseUrl());
$this->view->children = array();
$this->view->children['header_part'] = 'layout/header_part';
$this->view->children['footer_part'] = 'layout/footer_part';
}
示例6: indexAction
public function indexAction()
{
if (!WM_Users::allow('edit', 'modules')) {
JO_Session::set('error_permision', $this->translate('You do not have permission to this action'));
$this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/modules_oauth/');
}
$request = $this->getRequest();
if (JO_Session::get('successfu_edite')) {
$this->view->successfu_edite = true;
JO_Session::clear('successfu_edite');
}
if ($request->isPost()) {
//validate app id
$validate = new Helper_Modules_Facebook($request->getPost('facebook[facebook_oauth_key]'), $request->getPost('facebook[facebook_oauth_secret]'));
if ($validate->checkValidAppId()) {
Model_Settings::updateAll(array('facebook' => $request->getPost('facebook')));
JO_Session::set('successfu_edite', true);
$this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/modules_oauth_facebook/');
} else {
$this->view->error = $this->translate('Invalid appID');
}
}
$this->view->modules_url = $this->getRequest()->getModule() . '/modules';
$this->view->modules_oauth_url = $this->getRequest()->getModule() . '/modules_oauth';
$methods = $this->getClassResources();
$this->view->methods = array();
$ignore = array('index', 'error404', 'install', 'uninstall');
foreach ($methods as $type => $mods) {
foreach ($mods as $key => $value) {
if (in_array($value, $ignore)) {
continue;
}
if ($type == 'actions') {
$this->view->methods[$type][] = array('title' => $this->translate($value), 'edit' => $this->getRequest()->getModule() . '/modules_oauth_facebook/' . strtolower($value));
} elseif ($type == 'radio') {
$this->view->methods[$type][] = array('title' => $this->translate(str_replace('_', ' ', $value)), 'key' => 'facebook_' . strtolower($value));
}
}
}
$store_config = Model_Settings::getSettingsPairs(array('filter_group' => 'facebook'));
foreach ($store_config as $key => $data) {
if ($request->issetPost('facebook[' . $key . ']')) {
$this->view->{$key} = $request->getPost('facebook[' . $key . ']');
} else {
$this->view->{$key} = $data;
}
}
}
示例7: indexAction
public function indexAction()
{
$request = $this->getRequest();
if (JO_Session::get('user[user_id]')) {
$this->redirect(WM_Router::create($this->getRequest()->getBaseUrl()));
}
if (Helper_Config::get('enable_free_registration')) {
$this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=register'));
}
$this->view->login = WM_Router::create($request->getBaseUrl() . '?controller=users&action=login');
if (JO_Session::get('successfu_edite')) {
$this->view->successfu_edite = true;
JO_Session::clear('successfu_edite');
}
if ($request->isPost()) {
$validate = new Helper_Validate();
$validate->_set_rules($request->getPost('email'), $this->translate('Email'), 'not_empty;min_length[5];max_length[100];email');
if ($validate->_valid_form()) {
$shared_contentObject = new Model_Users_Invate();
$shared_content = $shared_contentObject->isInvatedByEmail($request->getPost('email'));
if ($shared_content == 1) {
$this->view->error = $this->translate('This e-mail address is already registered');
} else {
if ($shared_content == 2) {
$this->view->error = $this->translate('This e-mail address is already registered');
} else {
if (($key = Model_Users::addSharedContent($request->getPost('email'))) !== false) {
JO_Session::set('successfu_edite', true);
if (Helper_Config::get('not_ri')) {
Model_Email::send(Helper_Config::get('report_mail'), Helper_Config::get('noreply_mail'), $this->translate('New invitation request'), $this->translate('Hello, there is new invitation request in ') . ' ' . Helper_Config::get('site_name'));
}
$this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=landing'));
} else {
$this->view->error = $this->translate('There was an error. Please try again later!');
}
}
}
} else {
$this->view->error = $validate->_get_error_messages();
}
}
$this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
}
示例8: sendWelcomeAction
public function sendWelcomeAction()
{
if (JO_Session::get('user[user_id]')) {
new Model_Users_Edit(JO_Session::get('user[user_id]'), array('first_login' => '0'));
JO_Session::clear('category_id');
$this->view->user_info = JO_Session::get('user');
$this->view->user_info['first_login'] = 0;
JO_Session::set('user', $this->view->user_info);
$template = Model_Notification::getTemplate('welcome');
if ($template) {
$template_data = array('user_id' => JO_Session::get('user[user_id]'), 'user_firstname' => JO_Session::get('user[firstname]'), 'user_lastname' => JO_Session::get('user[lastname]'), 'user_fullname' => JO_Session::get('user[fullname]'), 'user_username' => JO_Session::get('user[username]'), 'site_url' => $this->getRequest()->getBaseUrl(), 'site_name' => Helper_Config::get('site_name'), 'mail_footer' => html_entity_decode(Helper_Config::get('mail_footer'), ENT_QUOTES, 'utf-8'));
if (!$template['title']) {
$template['title'] = $this->translate('Welcome to ${site_name}!');
}
$title = Model_Notification::parseTemplate(html_entity_decode($template['title'], ENT_QUOTES, 'utf-8'), $template_data);
$body = Model_Notification::parseTemplate(html_entity_decode($template['template'], ENT_QUOTES, 'utf-8'), $template_data);
Model_Email::send(JO_Session::get('user[email]'), Helper_Config::get('noreply_mail'), $title, $body);
}
}
$this->noViewRenderer(true);
}
示例9: indexAction
public function indexAction()
{
if (JO_Session::get('successfu_edite')) {
$this->view->successfu_edite = JO_Session::get('successfu_edite');
JO_Session::clear('successfu_edite');
}
if (JO_Session::get('error_permision')) {
$this->view->error_permision = JO_Session::get('error_permision');
JO_Session::clear('error_permision');
}
$files = glob(dirname(__FILE__) . '/Modules/*.php');
$this->view->modules = array();
if ($files) {
foreach ($files as $file) {
if (preg_match('/^([\\w]{1,})Controller$/i', basename($file, '.php'), $match)) {
$key = mb_strtolower($match[1], 'utf-8');
$this->view->modules[] = array('key' => $key, 'edit' => $this->getRequest()->getModule() . '/modules_' . $key, 'name' => $this->translate($match[1]), 'is_installed' => Model_Extensions_Install::isInstalled($key), 'install' => $this->getRequest()->getModule() . '/modules_' . $key . '/install', 'uninstall' => $this->getRequest()->getModule() . '/modules_' . $key . '/uninstall');
}
}
}
}
示例10: indexAction
public function indexAction($next = null)
{
$this->noLayout(true);
JO_Session::clear('facebook_user_data_register');
$settings = Model_Extensions::getSettingsPairs('facebook');
if (isset($settings['facebook_module_status_enable']) && $settings['facebook_module_status_enable']) {
if (Helper_Config::get('enable_free_registration') && isset($settings['facebook_register_with_facebook']) && $settings['facebook_register_with_facebook']) {
$request = $this->getRequest();
$facebook = new Helper_Modules_Facebook();
if ($facebook->checkValidAppId()) {
$this->view->login_url = $facebook->getLoginUrl($next, 'modules_facebook_register');
} else {
$this->noViewRenderer(true);
}
} else {
$this->noViewRenderer(true);
}
} else {
$this->noViewRenderer(true);
}
}
示例11: indexAction
public function indexAction()
{
if (!WM_Users::allow('create', $this->getRequest()->getController())) {
$this->forward('error', 'noPermission');
}
$request = $this->getRequest();
$this->view->user = $request->getPost('user');
$this->view->title = $request->getPost('title');
$this->view->description = $request->getPost('description');
$this->view->users = Model_Users::getUsers(array('filter_email' => '@'));
if (JO_Session::get('successfu_edite')) {
$this->view->successfu_edite = true;
JO_Session::clear('successfu_edite');
}
$this->view->errors = array();
if ($request->isPost()) {
if ($this->getRequest()->issetPost('user')) {
$result = '';
if ($this->getRequest()->getPost('user') == 'all') {
$email_list = Model_Users::getUsers(array('filter_email' => '@'));
foreach ($email_list as $email) {
if (JO_Validate::validateEmail($email["email"])) {
$result = Model_Email::send($email["email"], Helper_Config::get('noreply_mail'), $this->getRequest()->getPost('title'), html_entity_decode($this->getRequest()->getPost('description'), ENT_QUOTES, 'utf-8'));
}
}
} elseif (JO_Validate::validateEmail($this->getRequest()->getPost('user'))) {
$result = Model_Email::send($this->getRequest()->getPost('user'), Helper_Config::get('noreply_mail'), $this->getRequest()->getPost('title'), html_entity_decode($this->getRequest()->getPost('description'), ENT_QUOTES, 'utf-8'));
}
if ($result) {
JO_Session::set('successfu_edite', true);
$this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/massmail/');
} else {
$this->view->errors['no_emails'] = $this->translate('There was an error with sending the mail!');
}
}
}
}
示例12: createPage
public static function createPage($data)
{
$db = JO_Db::getDefaultAdapter();
$db->insert('pages', array('date_added' => new JO_Db_Expr('NOW()'), 'date_modified' => new JO_Db_Expr('NOW()'), 'parent_id' => (int) (isset($data['parent_id']) ? $data['parent_id'] : 0), 'status' => (int) $data['status'], 'in_footer' => (int) $data['in_footer'], 'title' => $data['title'], 'description' => $data['description'], 'meta_title' => $data['meta_title'], 'meta_description' => $data['meta_description'], 'meta_keywords' => $data['meta_keywords']));
$page_id = $db->lastInsertId();
if (isset($data['keyword']) && $data['keyword']) {
self::generatePage($page_id, $data['keyword']);
} else {
self::generatePage($page_id);
}
$temporary_images = JO_Session::get('temporary_images');
if ($temporary_images && is_array($temporary_images)) {
$page_info = self::getPage($page_id);
if ($page_info) {
$gallery_path = '/gallery/' . date("Y/m/", strtotime($page_info['date_added']));
$upload_folder = realpath(BASE_PATH . '/uploads');
$upload_folder .= $gallery_path;
foreach ($temporary_images as $image) {
$image_name = basename($image['image']);
if (!file_exists($upload_folder) || !is_dir($upload_folder)) {
mkdir($upload_folder, 0777, true);
}
if (copy(BASE_PATH . '/uploads/' . $image['image'], $upload_folder . $image_name)) {
$image_id = Model_Gallery::createImage(array('gallery_id' => $page_id, 'controller' => 'pages', 'image' => $gallery_path . $image_name));
if ($image_id && isset($image['title'])) {
Model_Gallery::updateImageInfo($image_id, $image['title']);
}
}
$mi = new Helper_Images();
$mi->deleteImages($image['image']);
}
}
JO_Session::clear('temporary_images');
}
return $page_id;
}
示例13: createAction
public function createAction()
{
if (!WM_Users::allow('create', $this->getRequest()->getController())) {
$this->forward('error', 'noPermission');
}
$this->setViewChange('form_pages');
if ($this->getRequest()->isPost()) {
Model_Pages::createPage($this->getRequest()->getParams());
$this->session->set('successfu_edite', true);
$this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/pages/' . ($this->getRequest()->getQuery('parent_id') ? '?parent_id=' . $this->getRequest()->getQuery('parent_id') : ''));
}
if (JO_Session::get('come_from_index') === true) {
$temporary_images = JO_Session::get('temporary_images');
if ($temporary_images) {
foreach ($temporary_images as $key => $image) {
$mi = new Helper_Images();
$mi->deleteImages($image['image']);
}
}
JO_Session::clear('come_from_index');
JO_Session::clear('temporary_images');
}
$this->getPageForm();
}
示例14: threads_for_userAction
public function threads_for_userAction()
{
$request = $this->getRequest();
$this->setViewChange('index');
$username = $request->getRequest('threads_for_user');
$username = trim(mb_strtolower(urldecode($username), 'UTF-8'));
$this->view->crumbs = array(array('name' => $this->translate('Home'), 'href' => $request->getBaseUrl()), array('name' => $this->translate('Forum'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=forum')), array('name' => $username));
$this->view->mainCategories = array();
$this->view->mainCategories = Model_Forum::getAll();
foreach ($this->view->mainCategories as $k => $v) {
$this->view->mainCategories[$k]['href'] = WM_Router::create($request->getBaseUrl() . '?controller=forum&action=thread/' . $this->view->mainCategories[$k]['id'] . '/' . WM_Router::clearName($this->view->mainCategories[$k]['name']));
}
$this->view->mainCategories = array_merge(array(0 => array('name' => $this->translate('All Topics'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=forum'))), $this->view->mainCategories);
$this->view->headline = $this->translate('All Topics');
$this->view->sel_thread = -1;
$this->view->headline = $this->translate('Threads') . ': ' . $username;
$threads = Model_Forum::getThreadsByUser($username);
$total_records = count($threads);
if ($threads) {
$model_images = new Model_Images();
$page = (int) $request->getRequest('page', 1);
if ($page < 1) {
$page = 1;
}
$limit = JO_Registry::get('front_limit');
if (JO_Session::get('msg_success')) {
$this->view->msg_success = JO_Session::get('msg_success');
JO_Session::clear('msg_success');
}
if (JO_Session::get('msg_error')) {
$this->view->error = JO_Session::get('msg_error');
$this->view->data = JO_Session::get('data');
JO_Session::clear('msg_error');
JO_Session::clear('data');
}
$total_records = count($threads);
$start = $page * $limit - $limit;
if ($start > $total_records) {
$page = max(ceil($total_records / $limit), 1);
$start = $page * $limit - $limit;
} elseif ($start < 0) {
$start = 0;
}
$threads = array_slice($threads, $start, $limit);
foreach ($threads as $thread) {
if ($thread['avatar']) {
$thread['avatar'] = $model_images->resize($thread['avatar'], JO_Registry::forceGet('user_avatar_width'), JO_Registry::forceGet('user_avatar_height'), true);
} else {
$thread['avatar'] = 'data/themes/images/noavatar.png';
}
$thread['userhref'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=index&username=' . WM_Router::clearName($thread['owner']));
$thread_link = WM_Router::create($request->getBaseUrl() . '?controller=forum&action=topic/' . $thread['id'] . '/' . WM_Router::clearName($thread['name']));
$thread['threadhref'] = $thread_link;
$thread['reporthref'] = WM_Router::create($request->getBaseUrl() . '?controller=forum&action=report/' . $thread['id']);
$thread['badges'] = Helper_Author::userBadges($thread['badges']);
$thread['first_date'] = WM_Date::format($thread['datetime'], 'dd M yy H:i');
$last_page = ceil($thread['cnt'] / $limit);
if (!empty($thread['lusername'])) {
if ($thread['lavatar']) {
$thread['lavatar'] = $model_images->resize($thread['lavatar'], 50, 50, true);
} else {
$thread['lavatar'] = 'data/themes/images/small_noavatar.png';
}
$thread['lasthref'] = $thread_link . ($last_page > 1 ? '/page/' . $last_page : '');
$thread['lhref'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=index&username=' . WM_Router::clearName($thread['lusername']));
$thread['last_date'] = WM_Date::format($thread['last_post'], 'dd M yy H:i');
}
$this->view->threads[] = $thread;
}
$pagination = new Model_Pagination();
$pagination->setLimit($limit);
$pagination->setPage($page);
$pagination->setText(array('text_prev' => $this->view->translate('Prev'), 'text_next' => $this->view->translate('Next')));
$pagination->setTotal($total_records);
$pagination->setUrl(WM_Router::create($request->getBaseUrl() . '?controller=forum&action=index&page={page}'));
$this->view->pagination = $pagination->render();
if (!empty($this->view->pagination)) {
$this->view->pagination = str_replace('{of}', $this->view->translate('OF'), $this->view->pagination);
}
}
$this->view->children = array();
$this->view->children['rightside'] = 'forum/rightside';
$this->view->children['header_part'] = 'layout/header_part';
$this->view->children['footer_part'] = 'layout/footer_part';
}
示例15: indexAction
public function indexAction()
{
$request = $this->getRequest();
if (!JO_Session::get('user[user_id]')) {
$this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=login&popup=true&next=' . urlencode($request->getFullUrl())));
}
$this->view->createBoard = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=create');
$boards = Model_Boards::getBoards(array('filter_user_id' => JO_Session::get('user[user_id]'), 'order' => 'boards.sort_order', 'sort' => 'ASC', 'friendly' => JO_Session::get('user[user_id]')));
$this->view->boards = array();
if ($boards) {
foreach ($boards as $board) {
$this->view->boards[] = array('board_id' => $board['board_id'], 'title' => $board['title']);
}
}
//////////// Categories ////////////
$this->view->categories = array();
$categories = Model_Categories::getCategories(array('filter_status' => 1));
foreach ($categories as $category) {
$category['subcategories'] = Model_Categories::getSubcategories($category['category_id']);
$this->view->categories[] = $category;
}
$this->view->title = JO_Utf8::convertToUtf8($request->getQuery('title'));
$this->view->url = JO_Utf8::convertToUtf8(urldecode($request->getQuery('url')));
$this->view->media = JO_Utf8::convertToUtf8($request->getQuery('media'));
$this->view->is_video = JO_Utf8::convertToUtf8($request->getQuery('is_video'));
$this->view->description = JO_Utf8::convertToUtf8($request->getQuery('description'));
$this->view->charset = JO_Utf8::convertToUtf8($request->getQuery('charset'));
if (!trim($this->view->description)) {
$this->view->description = $this->view->title;
}
if (JO_Session::get('success_added')) {
$this->view->pin_url = WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . JO_Session::get('success_added'));
$this->setViewChange('success');
JO_Session::clear('success_added');
} else {
if ($request->isPost()) {
$result = Model_Pins::create(array('title' => $this->view->title, 'from' => $this->view->url, 'image' => $this->view->media, 'is_video' => $this->view->is_video, 'description' => $request->getPost('message'), 'price' => $request->getPost('price'), 'board_id' => $request->getPost('board_id'), 'pinmarklet' => 1));
if ($result) {
Model_History::addHistory(0, Model_History::ADDPIN, $result);
$session_user = JO_Session::get('user[user_id]');
$group = Model_Boards::isGroupBoard($request->getPost('board_id'));
if ($group) {
$users = explode(',', $group);
foreach ($users as $user_id) {
if ($user_id != $session_user) {
$user_data = Model_Users::getUser($user_id);
if ($user_data && $user_data['email_interval'] == 1 && $user_data['groups_pin_email']) {
$this->view->user_info = $user_data;
$this->view->profile_href = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . JO_Session::get('user[user_id]'));
$this->view->full_name = JO_Session::get('user[firstname]') . ' ' . JO_Session::get('user[lastname]');
$this->view->pin_href = WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $result);
$board_info = Model_Boards::getBoard($request->getPost('board_id'));
if ($board_info) {
$this->view->board_title = $board_info['title'];
$this->view->board_href = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $board_info['user_id'] . '&board_id=' . $board_info['board_id']);
}
Model_Email::send($user_data['email'], JO_Registry::get('noreply_mail'), JO_Session::get('user[firstname]') . ' ' . JO_Session::get('user[lastname]') . ' ' . $this->translate('added new pin to a group board'), $this->view->render('group_board', 'mail'));
}
}
}
}
JO_Session::set('success_added', $result);
$this->redirect($request->getBaseUrl() . '?controller=bookmarklet');
}
}
}
}