Example #1
0
 /**
  * Verify an existing session ID and create or resume the session if the existing session ID is valid
  *
  * @access public
  * @return boolean
  */
 public function start()
 {
     if ($this->_life_time > 0) {
         ini_set('session.gc_maxlifetime', $this->_life_time);
     } else {
         $this->_life_time = ini_get('session.gc_maxlifetime');
     }
     session_set_cookie_params(0, OSCOM::getRequestType() == 'NONSSL' ? HTTP_COOKIE_PATH : HTTPS_COOKIE_PATH, OSCOM::getRequestType() == 'NONSSL' ? HTTP_COOKIE_DOMAIN : HTTPS_COOKIE_DOMAIN);
     $sane_session_id = true;
     if (isset($_GET[$this->_name]) && (empty($_GET[$this->_name]) || !ctype_alnum($_GET[$this->_name]))) {
         $sane_session_id = false;
     } elseif (isset($_POST[$this->_name]) && (empty($_POST[$this->_name]) || !ctype_alnum($_POST[$this->_name]))) {
         $sane_session_id = false;
     } elseif (isset($_COOKIE[$this->_name]) && (empty($_COOKIE[$this->_name]) || !ctype_alnum($_COOKIE[$this->_name]))) {
         $sane_session_id = false;
         setcookie($this->_name, '', time() - 42000, $this->getCookieParameters('path'), $this->getCookieParameters('domain'));
     }
     if ($sane_session_id === false) {
         osc_redirect(OSCOM::getLink(null, OSCOM::getDefaultSiteApplication(), null, 'NONSSL', false));
     } else {
         if (session_start()) {
             register_shutdown_function(array($this, 'close'));
             $this->_is_started = true;
             $this->_id = session_id();
             return true;
         }
     }
     return false;
 }
Example #2
0
 function getBatchNextPageLink($batch_keyword = 'page', $parameters = '')
 {
     $number_of_pages = ceil($this->batch_size / $this->batch_rows);
     $get_parameter = '';
     if (!empty($parameters)) {
         $parameters = explode('&', $parameters);
         foreach ($parameters as $parameter) {
             $keys = explode('=', $parameter, 2);
             if ($keys[0] != $batch_keyword) {
                 $get_parameter .= $keys[0] . (isset($keys[1]) ? '=' . $keys[1] : '') . '&';
             }
         }
     }
     if (defined('OSC_IN_ADMIN') && OSC_IN_ADMIN === true) {
         $forward_string = osc_icon('nav_forward.png');
         $forward_grey_string = osc_icon('nav_forward_grey.png');
     } else {
         $forward_string = OSCOM::getDef('result_set_next_page');
         $forward_grey_string = OSCOM::getDef('result_set_next_page');
     }
     $string = ' ';
     if ($this->batch_number < $number_of_pages && $number_of_pages != 1) {
         $string .= osc_link_object(OSCOM::getLink(null, null, $get_parameter . $batch_keyword . '=' . ($this->batch_number + 1)), $forward_string);
     } else {
         $string .= $forward_grey_string;
     }
     return $string;
 }
Example #3
0
 /**
  * Display a banner. If no ID is passed, the value defined in $_exists_id is
  * used.
  *
  * @param int $id The ID of the banner to show
  * @access public
  * @return string
  */
 public function display($id = null)
 {
     $OSCOM_PDO = Registry::get('PDO');
     $banner_string = '';
     if (empty($id) && isset($this->_exists_id) && is_numeric($this->_exists_id)) {
         $id = $this->_exists_id;
         unset($this->_exists_id);
     }
     $Qbanner = $OSCOM_PDO->prepare('select * from :table_banners where banners_id = :banners_id and status = 1');
     $Qbanner->bindInt(':banners_id', $id);
     $Qbanner->execute();
     $result = $Qbanner->fetch();
     if ($result !== false) {
         if (!empty($result['banners_html_text'])) {
             $banner_string = $result['banners_html_text'];
         } else {
             // HPDL create Redirect action; fix banner image location
             $banner_string = HTML::link(OSCOM::getLink('Shop', 'Index', 'Redirect&action=banner&goto=' . (int) $result['banners_id']), HTML::image('public/' . $Qbanner->value('banners_image'), $Qbanner->value('banners_title')), 'target="_blank"');
         }
         $this->_updateDisplayCount($result['banners_id']);
         if ($this->_show_duplicates_in_group === false) {
             $this->_shown_ids[] = $result['banners_id'];
         }
     }
     return $banner_string;
 }