Example #1
0
 function update()
 {
     $timestamp = mktime(0, 0, 0, $this->params['month'], 1);
     $endday = expDateTime::endOfMonthDay($timestamp);
     if ($this->params['day'] > $endday) {
         expValidator::failAndReturnToForm(gt('There are only') . ' ' . $endday . ' ' . gt('days in') . ' ' . $this->motd->months[$this->params['month']], $this->params);
     }
     parent::update();
 }
 public function update()
 {
     global $db;
     //reset others
     if ($this->params['is_default']) {
         $o->is_default = false;
         $db->updateObject($o, 'order_type', 'is_default=1');
     }
     parent::update();
 }
Example #3
0
 function __construct($src = null, $params = array())
 {
     parent::__construct($src, $params);
     $this->o = new order();
     $this->tstart = time() - $this->oneday;
     $this->tend = time();
     $this->prev_month = strftime("%A, %d %B %Y", mktime(0, 0, 0, strftime("%m") - 1, 1, strftime("%Y")));
     $this->now_date = strftime("%A, %d %B %Y");
     $this->now_hour = strftime("%I");
     $this->now_min = strftime("%M");
     $this->now_ampm = strftime("%p");
 }
Example #4
0
 function __construct($src = null, $params = array())
 {
     global $db;
     parent::__construct($src, $params);
     // only set the system help version if it's not already set as a session variable
     if (!expSession::is_set('help-version')) {
         $version = $db->selectValue('help_version', 'version', 'is_current=1');
         if (!empty($params['version'])) {
             $version = isset($params['version']) ? $params['version'] == 'current' ? $version : $params['version'] : $version;
         }
         expSession::set('help-version', $version);
     }
     $this->help_version = expSession::get('help-version');
 }
Example #5
0
 function __construct($src = null, $params = array())
 {
     global $db, $router, $section, $user;
     parent::__construct($src = null, $params);
     // we're setting the config here globably
     $this->grabConfig();
     if (expTheme::inAction() && !empty($router->url_parts[1]) && ($router->url_parts[0] == "store" && $router->url_parts[1] == "showall")) {
         if (isset($router->url_parts[array_search('title', $router->url_parts) + 1]) && is_string($router->url_parts[array_search('title', $router->url_parts) + 1])) {
             $default_id = $db->selectValue('storeCategories', 'id', "sef_url='" . $router->url_parts[array_search('title', $router->url_parts) + 1] . "'");
             $active = $db->selectValue('storeCategories', 'is_active', "sef_url='" . $router->url_parts[array_search('title', $router->url_parts) + 1] . "'");
             if (empty($active) && $user->is_acting_admin != 1) {
                 redirect_to(array("section" => SITE_DEFAULT_SECTION));
             }
             expSession::set('catid', $default_id);
         }
     } elseif (expTheme::inAction() && !empty($router->url_parts[1]) && ($router->url_parts[0] == "store" && ($router->url_parts[1] == "show" || $router->url_parts[1] == "showByTitle"))) {
         if (isset($router->url_parts[array_search('id', $router->url_parts) + 1]) && $router->url_parts[array_search('id', $router->url_parts) + 1] != 0) {
             $default_id = $db->selectValue('product_storeCategories', 'storecategories_id', "product_id='" . $router->url_parts[array_search('id', $router->url_parts) + 1] . "'");
             expSession::set('catid', $default_id);
         } else {
             $prod_id = $db->selectValue('product', 'id', "sef_url='" . $router->url_parts[array_search('title', $router->url_parts) + 1] . "'");
             $default_id = $db->selectValue('product_storeCategories', 'storecategories_id', "product_id='" . $prod_id . "'");
             expSession::set('catid', $default_id);
         }
     } elseif (isset($this->config['show_first_category']) || !expTheme::inAction() && $section == SITE_DEFAULT_SECTION) {
         if (!empty($this->config['show_first_category'])) {
             $default_id = $db->selectValue('storeCategories', 'id', 'lft=1');
         } else {
             $default_id = 0;
         }
         expSession::set('catid', $default_id);
     } elseif (!isset($this->config['show_first_category']) && !expTheme::inAction()) {
         expSession::set('catid', 0);
     } else {
         $default_id = 0;
     }
     // figure out if we need to show all categories and products or default to showing the first category.
     // elseif (!empty($this->config['category'])) {
     //     $default_id = $this->config['category'];
     // } elseif (ecomconfig::getConfig('show_first_category')) {
     //     $default_id = $db->selectValue('storeCategories', 'id', 'lft=1');
     // } else {
     //     $default_id = 0;
     // }
     $this->parent = expSession::get('catid');
     $this->category = new storeCategory($this->parent);
     // we're setting the config here for the category
     $this->grabConfig($this->category);
 }
 public function downloadfile()
 {
     if (empty($this->params['fileid'])) {
         flash('error', gt('There was an error while trying to download your file.  No File Specified.'));
         expHistory::back();
     }
     $fd = new filedownload($this->params['fileid']);
     if (empty($fd->expFile['downloadable'][0]->id)) {
         flash('error', gt('There was an error while trying to download your file.  The file you were looking for could not be found.'));
         expHistory::back();
     }
     $fd->downloads += 1;
     $fd->save();
     // this will set the id to the id of the actual file..makes the download go right.
     $this->params['id'] = $fd->expFile['downloadable'][0]->id;
     parent::downloadfile();
 }
Example #7
0
 function saveconfig()
 {
     // setup and save the config
     $this->loc->mod = "cart";
     $this->loc->src = "@globalcartsettings";
     $this->loc->int = "";
     parent::saveconfig();
 }
 function saveconfig()
 {
     $this->params['minimum_gift_card_purchase'] = substr($this->params['minimum_gift_card_purchase'], 1);
     $this->params['custom_message_product'] = substr($this->params['custom_message_product'], 1);
     parent::saveconfig();
 }
Example #9
0
 public function update()
 {
     //FIXME:  Remove this code once we have the new tag implementation
     if (!empty($this->params['tags'])) {
         global $db;
         if (isset($this->params['id'])) {
             $db->delete('content_expTags', 'content_type="image" AND content_id=' . $this->params['id']);
         }
         $tags = explode(",", $this->params['tags']);
         foreach ($tags as $tag) {
             $tag = strtolower(trim($tag));
             $expTag = new expTag($tag);
             if (empty($expTag->id)) {
                 $expTag->update(array('title' => $tag));
             }
             $this->params['expTag'][] = $expTag->id;
         }
     }
     //populate the alt tag field if the user didn't
     if (empty($this->params['alt'])) {
         $this->params['alt'] = $this->params['title'];
     }
     // call expController update to save the image
     parent::update();
 }
Example #10
0
 public function delete()
 {
     global $user, $db;
     if (!$user->isAdmin()) {
         flash('error', gt('You do not have permission to delete user accounts'));
         expHistory::back();
     }
     if (empty($this->params['id'])) {
         flash('error', gt('No user selected.'));
         expHistory::back();
     }
     // remove group memeberships
     $db->delete('groupmembership', 'member_id=' . $this->params['id']);
     // remove user permissions
     $db->delete('userpermission', 'uid=' . $this->params['id']);
     //remove user profiles
     $active_extensions = $db->selectObjects('profileextension', 'active=1');
     foreach ($active_extensions as $pe) {
         if (is_file(BASE . $pe->classfile)) {
             include_once BASE . $pe->classfile;
             $ext = new $pe->classname();
             $db->delete($ext->table, 'user_id=' . $this->params['id']);
         }
     }
     // remove user address
     $address = new address();
     $db->delete($address->table, 'user_id=' . $this->params['id']);
     parent::delete();
 }
 function __construct($src = null, $params = array())
 {
     global $user;
     parent::__construct($src, $params);
     $this->remove_permissions = $user->isLoggedIn() ? array('update', 'create') : array();
 }
Example #12
0
 public function saveconfig()
 {
     $this->params['defaultbanner_id'] = isset($this->params['expFile'][0]) ? $this->params['expFile'][0] : 0;
     parent::saveconfig();
 }
Example #13
0
 public function delete()
 {
     global $user;
     $count = $this->address->find('count', 'user_id=' . $user->id);
     if ($count > 1) {
         if ($user->isAdmin() || $user->id == $address->user_id) {
             //FIXME $address not set
             $address = new address($this->params['id']);
             if ($address->is_billing) {
                 $billAddress = $this->address->find('first', 'user_id=' . $user->id . " AND id != " . $address->id);
                 $billAddress->is_billing = true;
                 $billAddress->save();
             }
             if ($address->is_shipping) {
                 $shipAddress = $this->address->find('first', 'user_id=' . $user->id . " AND id != " . $address->id);
                 $shipAddress->is_shipping = true;
                 $shipAddress->save();
             }
             parent::delete();
         }
     } else {
         flash("error", gt("You must have at least one address."));
     }
     expHistory::back();
 }
 function __construct($src = null, $params = array())
 {
     parent::__construct($src = null, $params);
 }
Example #15
0
 public function saveConfig()
 {
     if (!empty($this->params['aggregate']) || !empty($this->params['pull_rss'])) {
         if ($this->params['order'] == 'rank ASC') {
             expValidator::failAndReturnToForm(gt('User defined ranking is not allowed when aggregating or pull RSS data feeds.'), $this->params);
         }
     }
     parent::saveConfig();
 }