function Admin_Controller() { parent::Site_Controller(); // Set base crumb $this->bep_site->set_crumb($this->lang->line('backendpro_control_panel'), 'admin'); // Set container variable $this->_container = $this->config->item('backendpro_template_admin') . "container.php"; // Set Pop container variable $this->_popup_container = $this->config->item('backendpro_template_admin') . "popup.php"; // Make sure user is logged in check('Control Panel'); // Check to see if the install path still exists if (is_dir('install')) { flashMsg('warning', $this->lang->line('backendpro_remove_install')); } // Set private meta tags //$this->bep_site->set_metatag('name','content',TRUE/FALSE); $this->bep_site->set_metatag('robots', 'nofollow, noindex'); $this->bep_site->set_metatag('pragma', 'nocache', TRUE); // Load the ADMIN asset group $this->bep_assets->load_asset_group('ADMIN'); // Loading language file here rather than Shop_admin_controller.php. // Otherwise menu items will not be displayed $this->lang->load('shop'); $this->load->module_language('kaimonokago', 'kaimonokagoadmin'); $this->load->module_language('welcome', 'webshop'); log_message('debug', 'BackendPro : Admin_Controller class loaded'); }
public function __construct() { parent::__construct(); $this->load->model('a_article_model'); $this->load->model('a_caifu_model'); $this->load->model('a_com_model'); }
public function __construct() { parent::__construct(); $this->load->model('a_com_model'); $this->load->model('a_caifu_model'); $this->load->model('consult_buy'); }
/** * The 404 action for the application. * * @access public * @return Response */ public function action_404() { if (IS_API) { $response_body = Site_Controller::supply_response_body($this->response_body, 404); return $this->response($response_body, 404); } $this->set_title_and_breadcrumbs('404 Not Found', null, null, null, null, true); $this->template->content = View::forge('error/404'); $this->response_status = 404; }
function Public_Controller() { parent::Site_Controller(); // Set container variable $this->_container = $this->config->item('backendpro_template_public') . "container.php"; // Set public meta tags //$this->bep_site->set_metatag('name','content',TRUE/FALSE); // Load the PUBLIC asset group $this->bep_assets->load_asset_group('PUBLIC'); log_message('debug', 'BackendPro : Public_Controller class loaded'); }
public function action_change_password() { Util_security::check_method('POST'); Util_security::check_csrf(); $form = $this->form_setting_password(); $val = $form->validation(); if (!$val->run()) { Session::set_flash('error', $val->show_errors()); $this->action_password(); return; } $post = $val->validated(); $error_message = ''; $is_transaction_rollback = false; try { DB::start_transaction(); $this->change_password($post['old_password'], $post['password']); DB::commit_transaction(); $mail = new Site_Mail('memberSettingPassword'); $mail->send($this->u->member_auth->email, array('to_name' => $this->u->name)); Session::set_flash('message', term('site.password') . 'を変更しました。'); Response::redirect('member/setting'); } catch (EmailValidationFailedException $e) { Util_Toolkit::log_error('send mail error: ' . __METHOD__ . ' validation error'); $error_message = 'メール送信エラー'; } catch (EmailSendingFailedException $e) { Util_Toolkit::log_error('send mail error: ' . __METHOD__ . ' sending error'); $error_message = 'メール送信エラー'; } catch (WrongPasswordException $e) { $is_transaction_rollback = true; $error_message = sprintf('現在の%sが正しくありません。', term('site.password')); } catch (\Auth\SimpleUserUpdateException $e) { $is_transaction_rollback = true; $error_message = term('site.password') . 'の変更に失敗しました。'; } catch (Database_Exception $e) { $is_transaction_rollback = true; $error_message = Site_Controller::get_error_message($e, true); } catch (FuelException $e) { $is_transaction_rollback = true; $error_message = $e->getMessage(); } if ($error_message) { if ($is_transaction_rollback && DB::in_transaction()) { DB::rollback_transaction(); } Session::set_flash('error', $error_message); } $this->action_password(); }
/** * Mmeber leave * * @access public * @return Response */ public function action_index() { $val = self::get_validation_object(); if (\Input::method() == 'POST') { \Util_security::check_csrf(); $success_message = sprintf('%sを%sしました。', term('form.invite', 'site.mail'), term('form.post')); $error_message = ''; $is_transaction_rollback = false; try { if (!$val->run()) { throw new ValidationFailedException($val->show_errors()); } $post = $val->validated(); if (Model_MemberPre::get_one4invite_member_id_and_email($this->u->id, $post['email'])) { throw new ValidationFailedException(sprintf('その%sは既に%sです。', term('site.email'), term('form.invited'))); } DB::start_transaction(); $token = Model_MemberPre::save_with_token($post['email'], null, $this->u->id); DB::commit_transaction(); $mail = new Site_Mail('memberInvite'); $mail->send($post['email'], array('register_url' => sprintf('%s?token=%s', Uri::create('member/register'), $token), 'invite_member_name' => $this->u->name, 'invite_message' => $post['message'])); Session::set_flash('message', $success_message); Response::redirect('member/invite'); } catch (ValidationFailedException $e) { $error_message = Site_Controller::get_error_message($e); } catch (EmailValidationFailedException $e) { Util_Toolkit::log_error('send mail error: ' . __METHOD__ . ' validation error'); $error_message = 'メール送信エラー'; } catch (EmailSendingFailedException $e) { Util_Toolkit::log_error('send mail error: ' . __METHOD__ . ' sending error'); $error_message = 'メール送信エラー'; } catch (\Database_Exception $e) { $is_transaction_rollback = true; $error_message = Site_Controller::get_error_message($e, true); } catch (FuelException $e) { $is_transaction_rollback = true; $error_message = Site_Controller::get_error_message($e); } if ($is_transaction_rollback && DB::in_transaction()) { DB::rollback_transaction(); } if ($error_message) { Session::set_flash('error', $error_message); } } $this->set_title_and_breadcrumbs(term('form.invite_friend'), null, $this->u); $this->template->content = \View::forge('member/invite', array('val' => $val, 'member_pres' => Model_MemberPre::get4invite_member_id($this->u->id))); }
public function __construct() { parent::__construct(); // Load library template $this->load->library('template'); // Set template $this->template->set_template('site'); // Add CSS and JS $this->template->add_css('public/site/css/font-awesome.min.css'); $this->template->add_css('public/site/css/style_userpage.css'); $this->template->add_js('public/site/js/jquery.ad-gallery.js'); date_default_timezone_set('Asia/Ho_Chi_Minh'); $sess = $this->session->userdata("user_email"); if ($sess == '') { redirect("dang-nhap"); } $this->user = $this->db->query("select * from site_user where Email='{$sess}'")->row(); $this->shop = $this->db->query("select b.* from site_user c,site_user_shop a,gianhang_shop b where c.Email='{$sess}' and a.UserID=c.ID and a.ShopID=b.ID")->row(); }
public function __construct() { parent::__construct(); //加载模型 $this->load->model('a_cart_model'); $this->load->model('a_com_model'); $this->load->library('session'); $this->user_id = isset($this->session->userdata['member_user_id']) ? $this->session->userdata['member_user_id'] : 0; /********相关数据表*********/ $this->tb_goods = 'goods'; $this->tb_price = 'goods_price_library'; $this->tb_user = '******'; $this->tb_group = 'user_group'; $this->tb_discount = 'user_group_discount'; $this->tb_cart = 'cart'; $this->tb_order = 'order'; $this->tb_order_goods = 'order_goods'; // $this->tb_order_address='order_address'; $this->tb_order_log = 'order_log'; }
public static function _index() { if ($_POST) { # beta code if ('DOTHEDEW' != $_POST['beta']) { return self::display_create('The beta code is not valid', $_POST); } $site_name = trim($_POST['site_name']); $email = trim($_POST['email']); if (empty($site_name) or empty($email)) { return self::display_create('The beta code is not valid', $_POST); } $theme = empty($_POST['theme']) ? 'base' : $_POST['theme']; # will redirect on success, else show error. $show_error = Site_Controller::_create_website($site_name, $theme, null, $email); return self::display_create($show_error, $_POST); } else { return self::display_create(); } }
/** * News delete * * @access public * @params integer * @return Response */ public function action_delete($id = null) { $id = (int) $id; \Util_security::check_method('POST'); \Util_security::check_csrf(); $error_message = ''; $is_transaction_rollback = false; try { $member = \Model_Member::check_authority($id); $message = \Site_Member::remove($member); \Session::set_flash('message', $message); } catch (\EmailValidationFailedException $e) { \Util_Toolkit::log_error('send mail error: ' . __METHOD__ . ' validation error'); $error_message = 'メール送信エラー'; } catch (\EmailSendingFailedException $e) { \Util_Toolkit::log_error('send mail error: ' . __METHOD__ . ' sending error'); $error_message = 'メール送信エラー'; } catch (\Auth\SimpleUserUpdateException $e) { $is_transaction_rollback = true; $error_message = term('member.view') . 'が存在しません。'; } catch (\Database_Exception $e) { $is_transaction_rollback = true; $error_message = \Site_Controller::get_error_message($e, true); } catch (\FuelException $e) { $is_transaction_rollback = true; if (!($error_message = $e->getMessage())) { $error_message = term('site.left') . 'に失敗しました。'; } } if ($error_message) { if ($is_transaction_rollback && \DB::in_transaction()) { \DB::rollback_transaction(); } \Session::set_flash('error', $error_message); } \Response::redirect(\Site_Util::get_redirect_uri('admin/member')); }
/** * Action image delete * * @access public * @params integer * @return Response */ public function action_delete($id = null) { \Util_security::check_csrf(); $site_image = \Model_SiteImage::check_authority($id); try { \DB::start_transaction(); $site_image->delete(); \DB::commit_transaction(); \Session::set_flash('message', term('site.image') . 'を削除しました。'); \Response::redirect('admin/content/image'); } catch (\Database_Exception $e) { $error_message = \Site_Controller::get_error_message($e, true); } catch (Exception $e) { $error_message = $e->getMessage(); } if (\DB::in_transaction()) { \DB::rollback_transaction(); } \Session::set_flash('error', $error_message); \Response::redirect('admin/content/image/' . $id); }
public function __construct() { parent::__construct('pwreset'); }
public function __construct() { parent::__construct('contact'); }
public static function output() { ob_start("sanitize_output"); Site_Controller::display(); }
function __construct() { parent::__construct(); $this->load->model('parks/park_model'); $this->load->library('form_validation'); }
/** * Execute confirm signup * * @access public * @return Response */ public function action_confirm_signup() { Util_security::check_method('POST'); Util_security::check_csrf(); if (!($form = Fieldset::instance('confirm_signup'))) { $form = $this->get_form_signup_confirm(); } $val = $form->validation(); $val->fieldset()->field('email')->delete_rule('unique'); $redirect_uri = conf('login_uri.site'); $success_message = '仮登録が完了しました。受信したメール内に記載された URL より本登録を完了してください。'; $error_message = ''; $is_transaction_rollback = false; try { if (!$val->run()) { throw new \FuelException($val->show_errors()); } $post = $val->validated(); if (Model_MemberAuth::get4email($post['email'])) { if (conf('member.register.email.hideUniqueCheck')) { Session::set_flash('message', $success_message); Response::redirect($redirect_uri); } throw new FuelException('その' . term('site.email') . 'は登録できません。'); } DB::start_transaction(); $token = Model_MemberPre::save_with_token($post['email'], $post['password']); DB::commit_transaction(); $mail = new Site_Mail('memberSignup'); $mail->send($post['email'], array('register_url' => sprintf('%s?token=%s', Uri::create('member/register'), $token))); Session::set_flash('message', $success_message); Response::redirect($redirect_uri); } catch (EmailValidationFailedException $e) { Util_Toolkit::log_error('send mail error: ' . __METHOD__ . ' validation error'); $error_message = 'メール送信エラー'; } catch (EmailSendingFailedException $e) { Util_Toolkit::log_error('send mail error: ' . __METHOD__ . ' sending error'); $error_message = 'メール送信エラー'; } catch (\Database_Exception $e) { $is_transaction_rollback = true; $error_message = \Site_Controller::get_error_message($e, true); } catch (FuelException $e) { $is_transaction_rollback = true; $error_message = $e->getMessage(); } if ($is_transaction_rollback && DB::in_transaction()) { DB::rollback_transaction(); } Session::set_flash('error', $error_message); $this->action_signup(); }
public function __construct() { parent::__construct(); $this->load->library(array('form_validation')); $this->load->model('register_model'); }
function __construct() { parent::__construct(); if (!$this->uri->segment(2) || config_item('users_profile') != 'TRUE') { redirect(base_url()); } $timeline_view = null; $this->user = $this->social_auth->get_user('username', $this->uri->segment(2)); if ($this->user) { $this->user_meta = $this->social_auth->get_user_meta($this->user->user_id); // User Data $this->data['user_id'] = $this->user->user_id; $this->data['username'] = $this->user->username; $this->data['gravatar'] = $this->user->gravatar; $this->data['name'] = $this->user->name; $this->data['image'] = $this->user->image; $this->data['created_on'] = $this->user->created_on; // Meta Tags $this->data['site_image'] = base_url() . config_item('users_images_folder') . $this->user->user_id . '/large_' . $this->user->image; // User Meta $this->data['company'] = $this->social_auth->find_user_meta_value('company', $this->user_meta); $this->data['location'] = $this->social_auth->find_user_meta_value('location', $this->user_meta); $this->data['url'] = $this->social_auth->find_user_meta_value('url', $this->user_meta); $this->data['bio'] = $this->social_auth->find_user_meta_value('bio', $this->user_meta); // Social Connections $this->data['connections'] = $this->social_auth->get_connections_user($this->user->user_id); // Relationships $this->data['followers'] = $this->social_tools->get_relationships_user($this->user->user_id, 'users', 'follow'); $this->data['follows'] = $this->social_tools->get_relationships_owner($this->user->user_id, 'users', 'follow'); $this->data['follow_word'] = 'follow'; // Links if ($this->social_auth->logged_in()) { if ($follow_check = $this->social_tools->check_relationship_exists(array('site_id' => config_item('site_id'), 'owner_id' => $this->session->userdata('user_id'), 'user_id' => $this->user->user_id, 'module' => 'users', 'type' => 'follow', 'status' => 'Y'))) { $this->data['follow_word'] = 'unfollow'; } else { $this->data['follow_word'] = 'follow'; } } $this->data['message_url'] = base_url() . 'api/message/send/id/' . $this->user->user_id; // Sidebar $this->data['sidebar_profile'] = $this->load->view(config_item('site_theme') . '/partials/sidebar_profile.php', $this->data, true); // Timeline $timeline = $this->social_igniter->get_timeline_user($this->user->user_id, 8); $timeline_view = NULL; $timeline_count = 1; $this->data['activities'] = array(); $this->data['social_igniter'] = $this->social_igniter; if (!empty($timeline)) { foreach ($timeline as $activity) { $timeline_count++; // Item array_push($this->data['activities'], $activity); $this->data['item_id'] = $activity->activity_id; $this->data['item_type'] = item_type_class($activity->type); // Contributor $this->data['item_user_id'] = $activity->user_id; $this->data['item_avatar'] = $this->social_igniter->profile_image($activity->user_id, $activity->image, $activity->gravatar); $this->data['item_contributor'] = $activity->name; $this->data['item_profile'] = base_url() . 'profile/' . $activity->username; // Activity $this->data['item_content'] = $this->social_igniter->render_item($activity); $this->data['item_content_id'] = $activity->content_id; $this->data['item_date'] = format_datetime(config_item('home_date_style'), $activity->created_at); // Actions $this->data['item_comment'] = base_url() . 'comment/item/' . $activity->activity_id; $this->data['item_comment_avatar'] = $this->data['logged_image']; $this->data['item_can_modify'] = $this->social_auth->has_access_to_modify('activity', $activity, $this->session->userdata('user_id'), $this->session->userdata('user_level_id')); $this->data['item_edit'] = base_url() . 'home/' . $activity->module . '/manage/' . $activity->content_id; $this->data['item_delete'] = base_url() . 'status/delete/' . $activity->activity_id; // View $timeline_view .= $this->load->view(config_item('site_theme') . '/partials/user_timeline.php', $this->data, true); } } else { $timeline_view = '<li>Nothing to show from anyone!</li>'; } } else { redirect(404); } $this->data['timeline_view'] = $timeline_view; $this->data['timeline_count'] = $timeline_count; }
public function new_website($page_name) { if (ROOTACCOUNT != $this->site_name) { die('return a 404 not found'); } if (!$_POST) { return $this->plusjade_dashboard($page_name, 'Nothing Sent.'); } $site_name = valid::filter_php_url(trim($_POST['site_name'])); $site = ORM::factory('site'); if ($site->subdomain_exists($site_name)) { return $this->plusjade_dashboard($page_name, 'site name already exists'); } # attempt to create the website $status = Site_Controller::_create_website($site_name, 'base', $this->account_user->get_user()->id); return $this->plusjade_dashboard($page_name, $status); }
public function __construct() { parent::__construct(); $this->load->model('a_com_model'); $this->load->model('areas'); }
/** * Execute reset password. * * @access public * @return Response */ public function action_reset_password() { // Already logged in Auth::check() and Response::redirect('member'); $member_password_pre = Model_MemberPasswordPre::get4token(Input::param('token')); if (!$member_password_pre || !Site_Util::check_token_lifetime($member_password_pre->updated_at, conf('member.recover.password.token_lifetime'))) { Session::set_flash('error', sprintf('URLが%sです。', term('form.disabled'))); throw new HttpNotFoundException(); } $form = $this->form_reset_password(); $val = $form->validation(); if (Input::method() == 'POST') { Util_security::check_csrf(); $auth = Auth::instance(); $error_message = ''; $is_transaction_rollback = false; try { if (!$val->run()) { throw new FuelException($val->show_errors() ?: term('site.password') . 'が正しくありません'); } $post = $val->validated(); $to_email = $member_password_pre->email; $to_name = $member_password_pre->member->name; DB::start_transaction(); $auth->change_password_simple($member_password_pre->member_id, $post['password']); $member_password_pre->delete(); // 仮登録情報の削除 DB::commit_transaction(); $mail = new Site_Mail('memberResetPassword'); $mail->send($to_email, array('to_name' => $to_name)); $auth->login($to_email, $post['password']); Session::set_flash('message', term('site.password') . 'を登録しました。'); Response::redirect('member'); } catch (EmailValidationFailedException $e) { Util_Toolkit::log_error('send mail error: ' . __METHOD__ . ' validation error'); $error_message = 'メール送信エラー'; } catch (EmailSendingFailedException $e) { Util_Toolkit::log_error('send mail error: ' . __METHOD__ . ' sending error'); $error_message = 'メール送信エラー'; } catch (Auth\SimpleUserUpdateException $e) { $is_transaction_rollback = true; $error_message = term('site.password') . 'の登録に失敗しました。'; } catch (\Database_Exception $e) { $is_transaction_rollback = true; $error_message = \Site_Controller::get_error_message($e, true); } catch (FuelException $e) { $is_transaction_rollback = true; $error_message = $e->getMessage(); } if ($error_message) { if ($is_transaction_rollback && DB::in_transaction()) { DB::rollback_transaction(); } Session::set_flash('error', $error_message); } } $this->set_title_and_breadcrumbs(term('site.password') . 'の再登録'); $data = array('val' => $val, 'member_password_pre' => $member_password_pre); $this->template->content = View::forge('member/recover/reset_password', $data); $this->template->content->set_safe('html_form', $form->build('member/recover/reset_password')); // form の action に入る }
public function action_delete() { Util_security::check_method('POST'); Util_security::check_csrf(); $form = $this->form_leave(); $val = $form->validation(); if (!$val->run()) { Session::set_flash('error', $val->show_errors()); $this->action_index(); return; } if (!$this->u->check_registered_oauth(true) && !$this->auth_instance->check_password()) { Session::set_flash('error', term('site.password') . 'が正しくありません'); $this->action_index(); return; } $error_message = ''; $is_transaction_rollback = false; try { $message = Site_Member::remove($this->u); $this->auth_instance->logout(); Session::set_flash('message', $message); Response::redirect(conf('login_uri.site')); } catch (EmailValidationFailedException $e) { Util_Toolkit::log_error('send mail error: ' . __METHOD__ . ' validation error'); $error_message = 'メール送信エラー'; } catch (EmailSendingFailedException $e) { Util_Toolkit::log_error('send mail error: ' . __METHOD__ . ' sending error'); $error_message = 'メール送信エラー'; } catch (SimpleUserUpdateException $e) { $is_transaction_rollback = true; $error_message = term('member.view') . 'が存在しません。'; } catch (Database_Exception $e) { $is_transaction_rollback = true; $error_message = Site_Controller::get_error_message($e, true); } catch (FuelException $e) { $is_transaction_rollback = true; if (!($error_message = $e->getMessage())) { $error_message = term('site.left') . 'に失敗しました。'; } } if ($error_message) { if ($is_transaction_rollback && DB::in_transaction()) { DB::rollback_transaction(); } Session::set_flash('error', $error_message); } $this->action_index(); }
protected function set_title_and_breadcrumbs($title = array(), $middle_breadcrumbs = array(), $member_obj = null, $module = null, $info = array(), $is_no_breadcrumbs = false, $is_no_title = false, $ogp_data = array()) { $common = array('title' => FBD_SITE_NAME, 'description' => FBD_SITE_DESCRIPTION); $title_name = ''; $this->template->title = ''; if ($title) { list($title_name, $title_label) = Site_Controller::get_title_parts($title); } if (!$is_no_title && $title_name) { $this->template->title = View::forge('_parts/page_title', array('name' => $title_name, 'label' => $title_label)); $common['title'] = $title_name; } $this->template->header_title = site_title($title_name); if ($info) { $this->template->header_info = View::forge('_parts/information', $info); } $this->template->breadcrumbs = $is_no_breadcrumbs ? array() : static::get_breadcrumbs($title_name, $middle_breadcrumbs, $member_obj, $member_obj ? $this->check_is_mypage($member_obj->id) : false, $module); if (!empty($ogp_data['title'])) { $common['title'] = $ogp_data['title']; } if (!empty($ogp_data['description'])) { $common['description'] = $ogp_data['description']; } if (!empty($ogp_data['image'])) { $common['image'] = $ogp_data['image']; } View::set_global('common', $common); }
function Shop_Controller() { parent::Site_Controller(); // Loading config $this->load->config('kaimonokago'); // Set container variable $this->_container = $this->config->item('backendpro_template_shop') . "container.php"; // Set public meta tags //$this->bep_site->set_metatag('name','content',TRUE/FALSE); // Load shop assets $this->load->module_library('site', 'kk_assets'); // Load the PUBLIC asset group in bep_assets.php $this->bep_assets->load_asset_group('SHOP'); log_message('debug', 'BackendPro : Shop_Controller class loaded'); // Loading language helper $this->load->helper('language'); // $this->lang->load('webshop'); // From CI shopping cart // Still using PHP session here. session_start(); // loading Norwegian language files // $this->config->set_item('language', 'norwegian'); // $this->lang->load('norwegian_general', 'norwegian'); // Loading all the module models here instead of autoload.php $this->load->module_model('category', 'MCats'); $this->load->module_model('menus', 'MMenus'); $this->load->module_model('customer', 'MCustomers'); $this->load->module_model('orders', 'MOrders'); $this->load->module_model('pages', 'MPages'); $this->load->module_model('products', 'MProducts'); $this->load->module_model('subscribers', 'MSubscribers'); $this->load->module_model('languages', 'MLangs'); $this->load->module_model('slideshow', 'MSlideshow'); // Loading libraries instead of autoload $this->load->library('form_validation'); $this->load->library('validation'); // for BEP 0.6 // Loading helpers $this->load->helper(array('security', 'form', 'mytools')); $this->mainmodule = $this->preference->item('main_module_name'); $this->data['mainmodule'] = $this->mainmodule; // Total price will be displayed // handlekurv means shopping cart in Norwegian // sorry for this. I will use English in future. // It's too late and too much work to replace now. if (isset($_SESSION['totalprice'])) { $this->data['handlekurv'] = $_SESSION['totalprice']; } else { $this->data['handlekurv'] = 0; } // main nav // webshop config main_nav_parent_id $tree = array(); // this will store value like english, norwegian etc. not an array //$this->language=$this->session->userdata('lang'); $multilang = $this->preference->item('multi_language'); // this will return 1 or 0 // if preference is not set then use the $this->config->item('language'); from config.php $mylanguage = strtolower($this->preference->item('website_language')); // this will return norwegian etc if (!$mylanguage) { // this means it is not set in preference use config item $mylanguage = $this->config->item('language'); // generally english } //Should we check if it exist in omc_languages? if (!$multilang) { // this means it is a single lang // use the $mylanguage as default $this->language = $mylanguage; } $this->data['multilang'] = $multilang; $this->data['mylanguage'] = $mylanguage; $sessionlang = $this->session->userdata('lang'); $this->data['sessionlang'] = $sessionlang; if (empty($sessionlang)) { // first load, it needs to set it as english $this->language = 'english'; } else { // otherwise get it from session $this->language = $this->session->userdata('lang'); } $this->data['language'] = $this->language; // find lang id $this->lang_id = $this->MLangs->getId($this->language); $this->data['mylanguage1'] = $this->lang_id; if (!$this->lang_id == 0) { $this->lang_id = $this->lang_id['id']; } else { $this->lang_id = 0; } // load language depends on lang $this->load->module_language('welcome', 'webshop', $this->language); // This part is used in all the pages so load it here // For customer login status if (isset($_SESSION['customer_first_name'])) { $this->data['customer_status'] = 1; $myemail = $_SESSION['email']; $size = 40; $mygravatar = gravatar($myemail, $size); $this->data['loginstatus'] = $mygravatar . lang('general_hello') . $_SESSION['customer_first_name'] . ". " . lang('general_logged_in') . "<br />\r\n <a href=\"index.php/" . $this->data['mainmodule'] . "/logout \">Log out</a>"; } else { $this->data['customer_status'] = 0; $this->data['loginstatus'] = "" . $this->lang->line('general_not_logged_in') . "<br /><a href=\"index.php/" . $this->data['mainmodule'] . "/login \">" . lang('general_login') . "</a>\r\n <br /><a href=\"index.php/" . $this->data['mainmodule'] . "/registration \">" . lang('general_register') . "</a>"; } // $parentid is depends on lang_id // find parentid from menu.id where lang_id=$lang_id and where menu.parentid=0 $parentid = $this->MMenus->getrootMenusByLang($this->lang_id); if ($parentid) { $parentid = $parentid; } else { $parentid = 0; } $this->data['lang_id'] = $this->lang_id; $this->MMenus->generateTreewithLang($tree, $parentid, $this->lang_id); // $this->MMenus->generateTree($tree,$parentid); $this->data['mainnav'] = $tree; // left category menu // webshop config categories_parent_id // it used to be like this $parentid=1; // need to find parentid by lang_id where lang_id is 0,1,2,3.. where cat_id is 1 or true $main_cat_id = $this->preference->item('categories_parent_id'); $cat_parent = $this->MCats->getParentidbyLang($main_cat_id, $this->lang_id); $this->data['cat_parent'] = $cat_parent; // delete me later if ($cat_parent) { // in order to prevent an error after installtion $cat_parentid = array_keys($cat_parent); $cat_parentid = $cat_parentid[0]; } $this->data['parent'] = $cat_parentid; //$parentid = $this->preference->item('categories_parent_id'); $order = 'order'; $this->data['navlist'] = $this->MCats->getCatNavbyLang($cat_parentid, $order, $this->lang_id); // $this->data['navlisttest'] = $this->MCats->getCatNavbyLangtest($parentid,$this->lang_id); $mostsold = "most sold"; //$mostsold = $this->MProducts ->getFeaturedProducts($mostsold); $mostsold = $this->MProducts->getFeaturedProductsbyLang($mostsold, $this->lang_id); $this->data['mostsold'] = $mostsold; $newproduct = "new product"; $newproduct = $this->MProducts->getFeaturedProducts($newproduct); $this->data['newproduct'] = $newproduct; // load modules/languages/model/mlangs $this->load->module_model('languages', 'MLangs'); // get all the languages $this->data['langs'] = $this->MLangs->getLangDropDown(); // get the main module, this must be the same as $route['default_controller'] = "welcome"; in config/routes.php }
/** * News delete * * @access public * @params integer * @return Response */ public function action_delete($id = null) { \Util_security::check_method('POST'); \Util_security::check_csrf(); $content_page = \Content\Model_ContentPage::check_authority($id); $error_message = ''; try { \DB::start_transaction(); $content_page->delete(); \DB::commit_transaction(); \Session::set_flash('message', term('content.page') . 'を削除しました。'); } catch (\Database_Exception $e) { $error_message = \Site_Controller::get_error_message($e, true); } catch (\FuelException $e) { $error_message = $e->getMessage(); } if ($error_message) { if (\DB::in_transaction()) { \DB::rollback_transaction(); } \Session::set_flash('error', $error_message); } \Response::redirect(\Site_Util::get_redirect_uri('admin/content/page')); }
function __construct() { parent::__construct(); }
function Admin_Controller() { parent::Site_Controller(); // Set base crumb $this->page->set_crumb($this->lang->line('backendpro_control_panel'), 'admin'); // Set container variable $this->_container = $this->config->item('backendpro_template_admin') . "container.php"; // Set Pop container variable $this->_popup_container = $this->config->item('backendpro_template_admin') . "popup.php"; // Make sure user is logged in check('Control Panel'); // Check to see if the install path still exists if (is_dir('install')) { flashMsg('warning', $this->lang->line('backendpro_remove_install')); } // If the system is down display warning if ($this->preference->item('maintenance_mode')) { flashMsg('warning', $this->lang->line('backendpro_site_off')); } // Set private meta tags //$this->page->set_metatag('name','content',TRUE/FALSE); $this->page->set_metatag('robots', 'nofollow, noindex'); $this->page->set_metatag('pragma', 'nocache', TRUE); log_message('debug', 'BackendPro : Admin_Controller class loaded'); }
public function __construct() { parent::__construct(); $this->load->library(array('form_validation', 'facebook_manager')); $this->load->helper('facebook_helper'); }
/** * News edit * * @access public * @params integer * @return Response */ public function action_edit($id = null) { $news = \News\Model_News::check_authority($id); $val = self::get_validation_object($news); $news_images = array(); $news_files = array(); $images = array(); $files = array(); $is_enabled_image = conf('image.isEnabled', 'news'); $is_insert_body_image = conf('image.isInsertBody', 'news'); $is_modal_upload_image = conf('image.isModalUpload', 'news'); if ($is_enabled_image && !$is_modal_upload_image) { $news_images = \News\Model_NewsImage::get4news_id($news->id); $images = \Site_Upload::get_file_objects($news_images, $news->id, true, null, 'img', $is_insert_body_image); } if ($is_enabled_file = \Config::get('news.file.isEnabled')) { $news_files = \News\Model_NewsFile::get4news_id($news->id); $files = \Site_Upload::get_file_objects($news_files, $news->id, true, null, 'file'); } $posted_links = array(); $saved_links = array(); if ($is_enabled_link = \Config::get('news.link.isEnabled')) { $saved_links = $this->get_saved_links($news->id); } $tags = \Config::get('news.tags.isEnabled') ? \News\Model_NewsTag::get_names4news_id($news->id) : array(); $image_tmps = array(); $file_tmps = array(); if (\Input::method() == 'POST') { \Util_security::check_csrf(); if ($is_enabled_link) { $posted_links = $this->get_posted_links(); $val = $this->add_validation_object_posted_links($val, $saved_links, true); $val = $this->add_validation_object_posted_links($val, $posted_links); } $moved_images = array(); $moved_files = array(); $news_image_ids = array(); $news_file_ids = array(); $error_message = ''; try { if ($is_enabled_image) { $image_tmps = \Site_FileTmp::get_file_tmps_and_check_filesize(); } if ($is_enabled_file) { $file_tmps = \Site_FileTmp::get_file_tmps_and_check_filesize(null, null, 'file'); } // 識別名の変更がない場合は unique を確認しない if (trim(\Input::post('slug')) == $news->slug) { $val->fieldset()->field('slug')->delete_rule('unique'); } if (!$val->run()) { throw new \FuelException($val->show_errors()); } $post = $val->validated(); if ($post['format'] == 2) { $post['body'] = preg_replace('/^\\>/um', '>', $post['body']); } $news->set_values($post); $message = sprintf('%sを%sしました。', term('news.view'), term('form.edit')); if ($is_published = !$news->is_published && empty($post['is_draft'])) { $news->is_published = 1; $message = sprintf('%sを%sしました。', term('news.view'), term('form.publish')); } if ($post['published_at_time'] && !\Util_Date::check_is_same_minute($post['published_at_time'], $news->published_at)) { $news->published_at = $post['published_at_time'] . ':00'; } elseif ($is_published) { $news->published_at = date('Y-m-d H:i:s'); } \DB::start_transaction(); $news->save(); if ($is_enabled_image) { list($moved_images, $news_image_ids) = \Site_FileTmp::save_images($image_tmps, $news->id, 'news_id', 'news_image'); \Site_Upload::update_image_objs4file_objects($news_images, $images); } if ($is_enabled_file) { list($moved_files, $news_file_ids) = \Site_FileTmp::save_images($file_tmps, $news->id, 'news_id', 'news_file', null, 'file'); \Site_Upload::update_image_objs4file_objects($news_files, $files); } if ($is_enabled_link) { $this->save_posted_links($saved_links, $news->id, true); $this->save_posted_links($posted_links, $news->id); } if (\Config::get('news.tags.isEnabled')) { \News\Model_NewsTag::save_tags($post['tags'], $news->id); } //// timeline 投稿 //if (is_enabled('timeline')) //{ // if ($is_published) // { // \Timeline\Site_Model::save_timeline($this->u->id, $note->public_flag, 'note', $note->id); // } // elseif ($is_update_public_flag) // { // // timeline の public_flag の更新 // \Timeline\Model_Timeline::update_public_flag4foreign_table_and_foreign_id($note->public_flag, 'note', $note->id, \Config::get('timeline.types.note')); // } //} \DB::commit_transaction(); // thumbnail 作成 & tmp_file thumbnail 削除 \Site_FileTmp::make_and_remove_thumbnails($moved_images); \Session::set_flash('message', $message); \Response::redirect('admin/news/detail/' . $news->id); } catch (\Database_Exception $e) { $error_message = \Site_Controller::get_error_message($e, true); } catch (\FuelException $e) { $error_message = $e->getMessage(); } if ($error_message) { if (\DB::in_transaction()) { \DB::rollback_transaction(); } if ($moved_images) { \Site_FileTmp::move_files_to_tmp_dir($moved_images); } if ($moved_files) { \Site_FileTmp::move_files_to_tmp_dir($moved_files); } $image_tmps = \Site_FileTmp::get_file_objects($image_tmps, $this->u->id, true, 'img'); $file_tmps = \Site_FileTmp::get_file_objects($file_tmps, $this->u->id, true, 'file'); \Session::set_flash('error', $error_message); } } $images = array_merge($images, $image_tmps); $files = array_merge($files, $file_tmps); $this->set_title_and_breadcrumbs(term('form.edit'), array('admin/news' => term('news.view', 'admin.view'), 'admin/news/' . $news->id => $news->title)); $this->template->post_header = \View::forge('news/_parts/form_header'); $this->template->post_footer = \View::forge('news/_parts/form_footer', array('news' => $news)); $this->template->content = \View::forge('news/_parts/form', array('val' => $val, 'saved_links' => $saved_links, 'posted_links' => $posted_links, 'news' => $news, 'is_edit' => true, 'images' => $images, 'files' => $files, 'tags' => $tags)); }