Beispiel #1
0
 function widget($args, $options)
 {
     if (!empty($args)) {
         extract($args);
     }
     $loggedin = ShoppCustomer()->loggedin();
     // Hide login form on account page when not logged in to prevent duplicate forms
     if (is_account_page() && !$loggedin) {
         return '';
     }
     $defaults = array('title' => $loggedin ? __('Your Account', 'Shopp') : __('Login', 'Shopp'));
     $options = array_merge($defaults, $options);
     extract($options);
     $title = $before_title . $title . $after_title;
     remove_filter('shopp_show_account_errors', array($this, 'showerrors'));
     $Page = new ShoppAccountPage();
     $menu = $Page->content('', 'widget');
     echo $before_widget . $title . $menu . $after_widget;
 }
 /**
  * Setup and process account dashboard page requests
  *
  * @author Jonathan Davis
  * @since 1.2
  *
  * @return void
  **/
 public function dashboard()
 {
     $Order = ShoppOrder();
     $this->add_dashboard('logout', __('Logout', 'Shopp'));
     $this->add_dashboard('orders', __('Your Orders', 'Shopp'), true, array(ShoppCustomer(), 'load_orders'));
     $this->add_dashboard('downloads', __('Downloads', 'Shopp'), true, array(ShoppCustomer(), 'load_downloads'));
     $this->add_dashboard('profile', __('My Account', 'Shopp'), true);
     // Pages not in menu navigation
     $this->add_dashboard('login', __('Login to your Account'), false);
     $this->add_dashboard('recover', __('Password Recovery'), false);
     $this->add_dashboard('rp', __('Password Recovery'), false);
     $this->add_dashboard('menu', __('Dashboard', 'Shopp'), false);
     do_action('shopp_account_menu');
     // Always handle customer profile updates
     add_action('shopp_account_management', array(ShoppCustomer(), 'profile'));
     // Add dashboard page specific handlers
     add_action('shopp_account_management', array($this, 'dashboard_handler'));
     $query = $_SERVER['QUERY_STRING'];
     $query = html_entity_decode($query);
     $query = explode('&', $query);
     $request = 'menu';
     $id = false;
     foreach ($query as $queryvar) {
         $value = false;
         if (false !== strpos($queryvar, '=')) {
             list($key, $value) = explode('=', $queryvar);
         } else {
             $key = $queryvar;
         }
         if (in_array($key, array_keys($this->dashboard))) {
             $request = $key;
             $id = $value;
         }
     }
     $this->account = compact('request', 'id');
     $download_request = get_query_var('s_dl');
     if (!ShoppCustomer()->loggedin()) {
         $screens = array('login', 'recover', 'rp');
         if (!in_array($this->account['request'], $screens)) {
             $this->account = array('request' => 'login', 'id' => false);
         }
     }
     do_action('shopp_account_management');
     if ('rp' == $request) {
         ShoppAccountPage::resetpassword($_GET['rp']);
     }
     if (isset($_POST['recover-login'])) {
         ShoppAccountPage::recovery();
     }
 }