Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Help solving errors needed


Recommended Posts

My shop generates few errors, please help me solve them (version 2.3.4.1 CE):

Can I pass the page safely or is it better to leave "mysite" ?


 

Warning: Use of undefined constant DIR_WS_INCLUDES - assumed 'DIR_WS_INCLUDES' (this will throw an Error in a future version of PHP) in /home/mysite/ftp/sklep4/includes/configure.php on line 11

Warning: session_set_save_handler(): Cannot change save handler when headers already sent in /home/mysite/ftp/sklep4/includes/functions/sessions.php on line 62

Warning: session_name(): Cannot change session name when headers already sent in /home/mysite/ftp/sklep4/includes/functions/sessions.php on line 148

Warning: session_save_path(): Cannot change save path when headers already sent in /home/mysite/ftp/sklep4/includes/functions/sessions.php on line 175

Warning: session_set_cookie_params(): Cannot change session cookie parameters when headers already sent in /home/mysite/ftp/sklep4/includes/application_top.php on line 155

Warning: session_start(): Cannot start session when headers already sent in /home/mysite/ftp/sklep4/includes/functions/sessions.php on line 101

Warning: extract() expects parameter 1 to be array, null given in /home/mysite/ftp/sklep4/includes/application_top.php on line 210

Warning: Cannot modify header information - headers already sent by (output started at /home/mysite/ftp/sklep4/includes/configure.php:11) in /home/mysite/ftp/sklep4/includes/functions/general.php on line 49

 

 

Link to comment
Share on other sites

Some, if not all, of the warnings after the first one is caused by that first one. The copy of your version I have here doesn't have the DIR_WS_INCLUDES in the configure file but I may have a variation of it. Things were changing quite a bit around the time of those versions.  Is this a new installation or did you update an existing one?

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

This version of the store has been around for about 3 years. I have an entry in configure: define ('DIR_WS_INCLUDES', 'includes /') ;, I also changed to define ('DIR_WS_INCLUDES', '/ home /mystore / ftp / sklep4 / includes /'); but it didn't do anything. For a long time, I have had a problem with cookies, which means that every few days the store stops (customers when trying to log in or go from the cart further receive a warning in the form of cookie_usage.php). Only clearing the server cache improves performance for 3-4 days and the problem returns. The PHP version is 7.2 and I can't go any further and I have the impression that the problem appeared when the version was changed from 7.1 to 7.2 and additionally only CDN servers were introduced. I have put hundreds of hours into this shop and I can't save it :( .. I don't know anyone but you who would be able to help me.

Link to comment
Share on other sites

I want to find fromabove errors you can see - just don't understand where is the error (ex Use of undefined constant DIR_WS_INCLUDES - assumed 'DIR_WS_INCLUDES' ) in configure.php everything is ok. How to find out which file is sowing error?

 

Link to comment
Share on other sites

6 hours ago, driven22 said:

define ('DIR_WS_INCLUDES', '/ home /mystore / ftp / sklep4 / includes /');

The above is incorrect. I suggest you post you complete configure file here except for the lines that contain the database details. Also, if you have cache enabled in the settings, try turning it off to see if helps with the refresh problem.

@DemitryHuh???

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

@driven22

9 hours ago, driven22 said:

I also changed to define ('DIR_WS_INCLUDES', '/ home /mystore / ftp / sklep4 / includes /'); but it didn't do anything.

While I hope that you formatted this for readability here, do you really have all of those spaces in your actual code?

M

Link to comment
Share on other sites

<?php
  define('HTTP_SERVER', 'https://www.mystore.com.pl');
  define('HTTPS_SERVER', 'https://www.mystore.com.pl');
  define('ENABLE_SSL', true);
  define('HTTP_COOKIE_DOMAIN', '');
  define('HTTPS_COOKIE_DOMAIN', '');
  define('HTTP_COOKIE_PATH', '/');
  define('HTTPS_COOKIE_PATH', '/');
  define('DIR_WS_HTTP_CATALOG', '/');
  define('DIR_WS_HTTPS_CATALOG', '/');
  define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');
  define('DIR_FS_CATALOG', '/home/mystore/ftp/sklep4/');
  define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');
  define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');
  define('DIR_WS_IMAGES', 'images/');
  define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');
 # define('DIR_WS_INCLUDES', 'includes/');
  define('DIR_WS_INCLUDES', '/home/mystore/ftp/sklep4/includes/');
  define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');
  define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');
  define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');
  define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/')

Line 11:
 

define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');

In Admin settings:
-Use Cache -false


Session Directory
	/home/mystore/ftp/sklep4/includes/work/
Force Cookie Use	False
Check SSL Session ID	False
Check User Agent	False
Check IP Address	False
Prevent Spider Sessions	True
Recreate Session	True

 

   
     
     
     
     
     
   
Link to comment
Share on other sites

Put this line

define('DIR_WS_INCLUDES', 'includes/');

 before

 define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');

and delete this line

define('DIR_WS_INCLUDES', '/home/mystore/ftp/sklep4/includes/');

 

with OsC 2.2 since 2006 ...

Link to comment
Share on other sites

@bonbec 

That's mostly correct. However, the definition of DIR_WS_INCLUDES must precede the definition of DIR_WS_FUNCTIONS, because it includes the DIR_WS_INCLUDES constant.

Personally, I think the error is because DIR_WS_CLASSES is defined twice and, DIR_WS_INCLUDES is an undefined constant via the first definition of DIR_WS_CLASSES. So, that first duplicate definition should be removed.

 

 

osCommerce: made for programmers, ...because store owners do not want to be programmers.

https://trends.google.com/trends/explore?date=all&amp;geo=US&amp;q=oscommerce

Link to comment
Share on other sites

Demitry, Bonbec you guys are amazing :) .  I have looked at this file so many times and i have not seen a duplicate classes. One warning left:

Warning: count(): Parameter must be an array or an object that implements Countable in /home/mystore/ftp/sklep4/includes/apps/surfcms/surfcms.class.php on line 208

 

and the various bugs he mentioned Dimitry.  Thanks for help :)

Link to comment
Share on other sites

@driven22

 

That apps file is not part of core osC.

/includes/apps/surfcms/surfcms.class.php

So, either check the related add-on for a more updated version to see if this code is brought up to date with PHP7.3 ..or, post that code block here. It should be an easy fix. 

 

 

osCommerce: made for programmers, ...because store owners do not want to be programmers.

https://trends.google.com/trends/explore?date=all&amp;geo=US&amp;q=oscommerce

Link to comment
Share on other sites

try to modify this line

if (count($return['2']))

by

if (count(array($return['2'])))

And do the same thing every where you find the same error

with OsC 2.2 since 2006 ...

Link to comment
Share on other sites

when I change to

if (count(array($return['2'])))

than it displays two warnings:

Warning: ksort() expects parameter 1 to be array, null given in /home/mystore/ftp/sklep4/includes/apps/surfcms/surfcms.class.php on line 210

Warning: Invalid argument supplied for foreach() in /home/mystore/ftp/sklep4/includes/modules/content/navigation/cm_surfcms_navbar.php on line 63

 

Link to comment
Share on other sites

5 hours ago, driven22 said:

when I change to


if (count(array($return['2'])))

than it displays two warnings:


Warning: ksort() expects parameter 1 to be array, null given in /home/mystore/ftp/sklep4/includes/apps/surfcms/surfcms.class.php on line 210

Warning: Invalid argument supplied for foreach() in /home/mystore/ftp/sklep4/includes/modules/content/navigation/cm_surfcms_navbar.php on line 63

 

This is all code:
 

<?php
/*
  $Id$

  Designed for: osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Surfalot CMS
  Copyright (c) 2017 Todd Holforty - mtholforty (at) surfalot (at) com

  Released under the GNU General Public License
*/

  /* surfcms_page abstract class */
  require_once DIR_FS_CATALOG . 'includes/apps/surfcms/core/surfcms_page.abstract.php';

  /* surfcms_app_setup singleton class */
  require_once DIR_FS_CATALOG . 'includes/apps/surfcms/core/surfcms_app_setup.class.php';


  // /////////////////////////////////////////////////////
  // SurfCMS Main Class
  //
  class surfcms extends surfcms_page {
      
    protected $_code = 'surfcms';
    protected $_title = 'Surfalot CMS App';

    protected $_config_id;
	protected $_admins;
	protected $_restricted_admins;
	protected $_restricted_utilities;
	protected $_restricted_lists;


    // /////////////////////////////////////////////////////
    // Construct / Destruct
    //
    public function __construct($group_name = null, $page_id = null, $languages_id = null, $defs = null) {

      $this->setLanguage();
      $this->loadLanguageFile('surfcms.class.php');
      $this->getVersion();
      $this->checkVersion();
      
      if ( isset($group_name) ) {
        $this->getPageGroup($group_name, $languages_id, $defs);
      } elseif ( isset($page_id) ) {
        $this->getPageGroup($this->getGroupName($page_id), $languages_id, $defs);
      }
      
      $this->_title .= ' v' . $this->getVersion() . ' ' . $this->getDef('text_content_app_subver');

    }

    public function __destruct() {}
    

    // /////////////////////////////////////////////////////
    // no serialize
    //
    private function __clone() {} 
    private function __sleep() {}
    private function __wakeup() {} 


    // /////////////////////////////////////////////////////
    // Gets
    //
    public function getGroupName($id) {
        
      $return = false;
      if ( isset($id) ) {
        $item_query = tep_db_query("select surfcms_content_group from surfcms_content where surfcms_content_id = '" . (int)$id . "' limit 1");
        if ( $item_row = tep_db_fetch_array($item_query) ) {
          $return = $item_row['surfcms_content_group'];
        }
      }
      
      return $return;
    }

    public function getItemType($id) {
        
      $return = false;
      if ( isset($id) ) {
        $item_query = tep_db_query("select oc.surfcms_content_type from surfcms_content oc, surfcms_content_description ocd where oc.surfcms_content_id = ocd.surfcms_content_id and oc.surfcms_content_id = '" . (int)$id . "' limit 1");
        if ( $item_row = tep_db_fetch_array($item_query) ) {
          $return = $item_row['surfcms_content_type'];
        }
      }
      
      return $return;
    }

    public function getItemTitle($id) {
        
      $return = false;
      if ( isset($id) ) {
        $item_query = tep_db_query("select ocd.surfcms_content_menu_text from surfcms_content oc, surfcms_content_description ocd where oc.surfcms_content_id = ocd.surfcms_content_id and oc.surfcms_content_id = '" . (int)$id . "' limit 1");
        if ( $item_row = tep_db_fetch_array($item_query) ) {
          $return = $item_row['surfcms_content_menu_text'];
        }
      }
      
      return $return;
    }

    public function itemExists($item_name, $types = null) {

      $return = false;
      if (tep_not_null($item_name)) {

        if ( is_array($item_name) ) {
          $where_group = " (surfcms_content_group like '" . implode("' or surfcms_content_group like '", tep_db_prepare_input($item_name)) . "')";
        } else {
          $where_group = " surfcms_content_group like '" . tep_db_prepare_input($item_name) . "'";
        }
        
        $where_type = '';
        if ( is_array($types) ) {
          $where_types = " and surfcms_content_type in ('" . implode("','", tep_db_prepare_input($types)) . "')";
        } elseif ( tep_not_null($types) ) {
          $where_types = " and surfcms_content_type = '" . (int)$types . "'";
        }
        
        $item_query = tep_db_query("select count(surfcms_content_id) as count from surfcms_content where" . $where_group . $where_types);
        if ($item = tep_db_fetch_array($item_query)) {
          $return = $item['count'];
        }

      }

      return $return;
    }

    public function getBlockItems($items = null, $languages_id = null) {
        
      return $this->getItems($items, '2', $languages_id);
      
    }

    public function getContentItems($items = null, $languages_id = null) {
        
      return $this->getItems($items, '1', $languages_id);
      
    }
    
    public function getItems($items = null, $types = null, $languages_id = null) {
        
      $return = false;
      if ( !isset($languages_id) ) { $languages_id = $this->languages_id; }
      
      $where_group = (is_array($items) ? " and oc.surfcms_content_group in ('" . implode("','",$items) . "')" : (tep_not_null($items) ? " and oc.surfcms_content_group like '" . $items . "'" : ''));
      $where_type = (is_array($types) ? " and oc.surfcms_content_type in ('" . implode("','",$types) . "')" : (tep_not_null($types) ? " and oc.surfcms_content_type = '" . $types . "'" : ''));

      $item_query = tep_db_query("select oc.surfcms_content_id, oc.surfcms_content_group, oc.surfcms_content_type, oc.surfcms_content_width, oc.surfcms_content_sort_order, oc.surfcms_content_administrators, ocd.surfcms_content_menu_text, ocd.surfcms_content_body from surfcms_content oc, surfcms_content_description ocd where oc.surfcms_content_id = ocd.surfcms_content_id" . $where_group . " and oc.surfcms_content_status = '1'" . $where_type . " and ocd.language_id = '" . (int)$languages_id . "' order by oc.surfcms_content_sort_order");
      if ( tep_db_num_rows($item_query) ) {
        $return = array();
        while ( $item_row = tep_db_fetch_array($item_query) ) {
          $return[] = array( 'id' => $item_row['surfcms_content_id'], 'group' =>  $item_row['surfcms_content_group'], 'type' =>  $item_row['surfcms_content_type'], 'width' =>  $item_row['surfcms_content_width'], 'sort_order' =>  $item_row['surfcms_content_sort_order'], 'admins' =>  $item_row['surfcms_content_administrators'], 'menu_text' =>  $item_row['surfcms_content_menu_text'], 'body' =>  $item_row['surfcms_content_body']);
        }
      }

      return $return;
    }

    public function getNavigation($nav = 'navbar', $languages_id = null) {

      $return = false;
      $navigation = array();
      if ( !isset($languages_id) ) { $languages_id = $this->languages_id; }

      $where = ($nav == 'navbar' ? " and oc.surfcms_content_show_in_nav != '0'" : " and oc.surfcms_content_show_in_box = '1'");
      $order = ($nav == 'navbar' ? " order by oc.surfcms_content_show_in_nav, oc.surfcms_content_sort_order" : " order by oc.surfcms_content_sort_order");
      $item_query = tep_db_query("select oc.surfcms_content_id as id, oc.surfcms_content_group as `group`, oc.surfcms_content_type as type, oc.surfcms_content_show_in_nav as nav, oc.surfcms_content_url as url, oc.surfcms_content_menu_parent as parent, oc.surfcms_content_menu_icon as icon, oc.surfcms_content_sort_order as sort_order, oc.surfcms_content_administrators as admins, ocd.surfcms_content_menu_text as menu_text, ocd.surfcms_content_meta_title as meta_title, ocd.surfcms_content_body as body from surfcms_content oc, surfcms_content_description ocd where oc.surfcms_content_id = ocd.surfcms_content_id and oc.surfcms_content_status = '1'" . $where . " and ocd.language_id = '" . (int)$languages_id . "'" . $order);

      // assemble nodes per ID
	  while ( $item_row = tep_db_fetch_array($item_query) ) {
        
        $item_row['link'] = $this->getLink($item_row['id'], $item_row['type'], $item_row['group'], $item_row['url']);
          
        // compile sets with sub-menu items below parents with IDs as keys
        if ( (int)$item_row['parent'] == 0 || $nav == 'box' ) {
          if ( isset($navigation[$item_row['id']]) && is_array( $navigation[$item_row['id']]['sub'] ) ) {
            $item_row['sub'] = $navigation[$item_row['id']]['sub']; } // add existing [sub] to $item_row
          $navigation[$item_row['id']] = $item_row; 
        } else {
          $navigation[$item_row['parent']]['sub'][$item_row['id']] = $item_row;
        }
        
      }
      
      // rearrange with sort_order as keys
      if ( count($navigation) ) {

        $return = array();
        if ($nav == 'navbar') {
            
          // separate and sort nav items
          foreach ( $navigation as $data ) {
            if ( isset($data['type']) ) { // skip disabled top menu items
              for ($i=0; isset($return[$data['nav']][((int)$data['sort_order']+$i)]); $i++) {}
              $return[$data['nav']][((int)$data['sort_order']+$i)] = $data;
            }
          }
          // sort left and right nav groups. home should only contain one
          if (count($return['2']))
              ksort($return['2']);
          if (count($return['3']))
              ksort($return['3']);
              
        } elseif ($nav == 'box') {
            
          foreach ( $navigation as $data ) {
            for ($i=0; isset($return[((int)$data['sort_order']+$i)]); $i++) {}
            $return[((int)$data['sort_order']+$i)] = $data;
          }
          if (count($return))
              ksort($return);
              
        }
        
      }
      
      return $return;
    }

    // /////////////////////////////////////////////////////
    // Get Link
    //
    public function getLink($id, $type = null, $group = null, $url = null) {
        
      $return = false;
      if (function_exists('tep_catalog_href_link')) { $funct = 'tep_catalog_href_link'; } else { $funct = 'tep_href_link'; }
      
      if ( !isset($type) || !isset($group) ) {
        $item_query = tep_db_query("select oc.surfcms_content_group, oc.surfcms_content_type, oc.surfcms_content_url from surfcms_content oc where oc.surfcms_content_id = '" . $id . "' limit 1");
        if ( $item_row = tep_db_fetch_array($item_query) ) {
          $group = $item_row['surfcms_content_group'];
          $type = $item_row['surfcms_content_type'];
          $url = $item_row['surfcms_content_url'];
        }
      }
      
      if ( tep_not_null($type) && $type == '4' ) {
		$return = $url;
      } elseif ( tep_not_null($type) && $type == '3' ) {
        $return = '#';
      } elseif (tep_not_null($group) && file_exists(DIR_FS_CATALOG . $group . '.php')) {
        $return = $funct($group . '.php', (tep_not_null($url) ? ltrim($url,'?') : ''));
      } else {
        $return = $funct('surfcms.php', 'pg=' . $id);
      }
      
      return $return;
    }
    
    // /////////////////////////////////////////////////////
    // Type Conversion
    //
    public function navGroup($enum) {
        
      switch ($enum) { 
        case '1': $return = 'navbar_modules_home'; break; 
        case '2': $return = 'navbar_modules_left'; break; 
        case '3': $return = 'navbar_modules_right'; break; 
      }
        
      return $return;
    }

    public function typeValue($type) {
        
      switch ($type) { 
        case $this->getDef('text_content_type_page'): $return = '0'; break; 
        case $this->getDef('text_content_type_content'): $return = '1'; break; 
        case $this->getDef('text_content_type_block'): $return = '2'; break; 
        case $this->getDef('text_content_type_sub_menu'): $return = '3'; break; 
        case $this->getDef('text_content_type_menu_link'): $return = '4'; break; 
      }
        
      return $return;
    }

    public function typeName($type) {
      
      switch ((string)$type) { 
        case '0': $return = $this->getDef('text_content_type_page'); break; 
        case '1': $return = $this->getDef('text_content_type_content'); break; 
        case '2': $return = $this->getDef('text_content_type_block'); break; 
        case '3': $return = $this->getDef('text_content_type_sub_menu'); break; 
        case '4': $return = $this->getDef('text_content_type_menu_link'); break; 
      }
      
      return $return;
    }

    // /////////////////////////////////////////////////////
    // Nav Templates
    //
    public function navNode($node) {

      ob_start();
      include(DIR_FS_CATALOG . 'includes/apps/surfcms/core/templates/nav_node.php');
      $data = ob_get_clean();

      return $data;
    }

    public function navSubmenuNode($node) {

      ob_start();
      include(DIR_FS_CATALOG . 'includes/apps/surfcms/core/templates/nav_sub_menu_node.php');
      $data = ob_get_clean();

      return $data;
    }

    // /////////////////////////////////////////////////////
    // Admin Access Restrictions
    //

    // returns array of restricted admins
    public function access_installed() {

      return file_exists(DIR_FS_CATALOG . 'includes/apps/surfcms/admin/utilities_modules/access_administrator.php');
    }

    // returns array of restricted admins
    public function restricted_admins() {

      if ( !isset($this->_restricted_admins) ) {
        if ( $this->access_installed() ) {
		  $admins_config = tep_db_fetch_array(tep_db_query("SELECT configuration_value as users FROM configuration WHERE configuration_key LIKE 'SURFCMS_MODULE_CONTENT_ADMIN_GROUP'"));
          if ( !empty($admins_config['users']) )
		    $this->_restricted_admins = explode(',', $admins_config['users']);
		}
		if ( !isset($this->_restricted_admins) )
		  $this->_restricted_admins = array();
	  }

      return $this->_restricted_admins;
    }

    // returns array of restricted utilities
	public function restricted_utilities() {

      if ( !isset($this->_restricted_utilities) ) {
        if ( $this->access_installed() ) {
          $utilities_config = tep_db_fetch_array(tep_db_query("SELECT configuration_value as utilities FROM configuration WHERE configuration_key LIKE 'SURFCMS_MODULE_CONTENT_UTILITY_GROUP'"));
          if ( !empty($utilities_config['utilities']) )
            $this->_restricted_utilities = explode(',', $utilities_config['utilities']);
		}
		if ( !isset($this->_restricted_utilities) )
		  $this->_restricted_utilities = array();
	  }

      return $this->_restricted_utilities;
    }

    // returns array of restricted list boxes
	public function restricted_lists() {

      if ( !isset($this->_restricted_lists) ) {
        if ( $this->access_installed() ) {
          $lists_config = tep_db_fetch_array(tep_db_query("SELECT configuration_value as lists FROM configuration WHERE configuration_key LIKE 'SURFCMS_MODULE_CONTENT_LIST_GROUP'"));
          if ( !empty($lists_config['lists']) )
            $this->_restricted_lists = explode(',', $lists_config['lists']);
		}
		if ( !isset($this->_restricted_lists) )
		  $this->_restricted_lists = array();
	  }

      return $this->_restricted_lists;
    }

    // returns array of all admins
	// if $id is passed, method returns associated name
	// if $id is array, return array of admin names
	public function admins($id = null) {

      if ( !isset($this->_admins) ) {
        if ( $this->access_installed() ) {
          $this->_admins = array();
          $admin_query = tep_db_query("SELECT id, user_name FROM administrators");
          while ( $item_row = tep_db_fetch_array($admin_query) ) {
            $this->_admins[$item_row['id']] = $item_row['user_name'];
          }
		} else {
		  $this->_admins = array();
		}
	  }

      if ($id != null && is_array($id))
	    return array_uintersect_uassoc($this->_admins, $id, function($a, $b) { return 0; }, function($a, $b) { if ($a == $b) return 0; else return -1; } );
	  elseif ($id != null) 
	    return $this->_admins[$id];
	  else
	    return $this->_admins;
    }

    // Returns true if $admin is in restricted list AND $item is NULL
    // Returns true if $admin is in restricted list AND $item is in its restricted list
    public function isRestricted($admin_id = null, $item = null) {

      return ( in_array($admin_id, $this->restricted_admins())
	             && ( (($item == null) || (($item != null) && in_array($item, $this->restricted_utilities())))
	                  || (($item == null) || (($item != null) && in_array($item, $this->restricted_lists()))) )
			  );

    }


    // /////////////////////////////////////////////////////
    // Configuration Group ID
    //
    public function getConfigID() {

      if (!isset($this->_config_id)) {
	    $config = tep_db_fetch_array(tep_db_query("SELECT `configuration_value` as id FROM `configuration` WHERE `configuration_key` LIKE 'SURFCMS_CONFIGURATION_GROUP' LIMIT 1"));
	    $this->_config_id = $config['id'];
	  }

      return $this->_config_id;
    }


    // /////////////////////////////////////////////////////
    // Version Control
    //
    public function checkVersion() {

      if ( isset($this->_version) ) {

        // get Data version
        $surfcms_config_query = tep_db_query("SELECT `configuration_value` as vers FROM `configuration` WHERE `configuration_key` = 'SURFCMS_VERSION_INSTALLED'");
        if ($surfcms_config = tep_db_fetch_array($surfcms_config_query)) {
          $db_version = $surfcms_config['vers'];
        } else {
          trigger_error($this->getAppTitle() . $this->getDef('db_version_error'));
        }
        
        // check for install/update
        if ( isset($db_version) ) {
          if ( $this->_version != $db_version ) {
            trigger_error($this->getAppTitle() . sprintf($this->getDef('db_update_warning'),$db_version,$this->_version));
            $this->updateApp();
          }
        } else {
          trigger_error($this->getAppTitle() . sprintf($this->getDef('db_installation_warning'),$this->_version));
          $this->installApp();
        }
        
      }
      
      return $this->_version;
    }
    
    public function installApp() {
        
      surfcms_app_setup::i()->installDatabase($this->getVersion());
        
      return true;
    }
    
    public function updateApp() {
        
      surfcms_app_setup::i()->updateDatabase($this->getVersion());
        
      return true;
    }
    

    
  } // class surfcms
?>

 

Link to comment
Share on other sites

@driven22

That solution for count() is incorrect because,.. if the variable $return is already assigned an array value, then this will make count(array(of an array)) = 1

And, that $return variable actually is set as an array on line 197. So, let's try this solution. And you have to test it afterwords by sorting the left and right navigation groups.

 

FIND THIS CODE:

        if ($nav == 'navbar') {
            
          // separate and sort nav items
          foreach ( $navigation as $data ) {
            if ( isset($data['type']) ) { // skip disabled top menu items
              for ($i=0; isset($return[$data['nav']][((int)$data['sort_order']+$i)]); $i++) {}
              $return[$data['nav']][((int)$data['sort_order']+$i)] = $data;
            }
          }
          // sort left and right nav groups. home should only contain one
          if (count($return['2']))
              ksort($return['2']);
          if (count($return['3']))
              ksort($return['3']);
              
        } elseif ($nav == 'box') {
            
          foreach ( $navigation as $data ) {
            for ($i=0; isset($return[((int)$data['sort_order']+$i)]); $i++) {}
            $return[((int)$data['sort_order']+$i)] = $data;
          }
          if (count($return))
              ksort($return);
              
        }

 

REPLACE IT WITH THIS:

        /*if ($nav == 'navbar') {
            
          // separate and sort nav items
          foreach ( $navigation as $data ) {
            if ( isset($data['type']) ) { // skip disabled top menu items
              for ($i=0; isset($return[$data['nav']][((int)$data['sort_order']+$i)]); $i++) {}
              $return[$data['nav']][((int)$data['sort_order']+$i)] = $data;
            }
          }
          // sort left and right nav groups. home should only contain one
          if (count($return['2']))
              ksort($return['2']);
          if (count($return['3']))
              ksort($return['3']);
              
        } elseif ($nav == 'box') {
            
          foreach ( $navigation as $data ) {
            for ($i=0; isset($return[((int)$data['sort_order']+$i)]); $i++) {}
            $return[((int)$data['sort_order']+$i)] = $data;
          }
          if (count($return))
              ksort($return);
              
        }*/

        if ($nav == 'navbar') {
            
          // separate and sort nav items
          foreach ( $navigation as $data ) {
            if ( isset($data['type']) ) { // skip disabled top menu items
              for ($i=0; isset($return[$data['nav']][((int)$data['sort_order']+$i)]); $i++) {}
              $return[$data['nav']][((int)$data['sort_order']+$i)] = $data;
            }
          }
          // sort left and right nav groups. home should only contain one
          if (tep_not_null($return['2']) && count($return['2']))
              ksort($return['2']);
          if (tep_not_null($return['3']) && count($return['3']))
              ksort($return['3']);
              
        } elseif ($nav == 'box') {
            
          foreach ( $navigation as $data ) {
            for ($i=0; isset($return[((int)$data['sort_order']+$i)]); $i++) {}
            $return[((int)$data['sort_order']+$i)] = $data;
          }
          if (tep_not_null($return) && count($return))
              ksort($return);
              
        }

 

Unfortunately, I cannot test it on my end, but this should work.

 

 

osCommerce: made for programmers, ...because store owners do not want to be programmers.

https://trends.google.com/trends/explore?date=all&amp;geo=US&amp;q=oscommerce

Link to comment
Share on other sites

@driven22

Ok, then I'll post another solution in a bit. Without being able to test this locally, it's a more challenging trial and error process.

 

 

osCommerce: made for programmers, ...because store owners do not want to be programmers.

https://trends.google.com/trends/explore?date=all&amp;geo=US&amp;q=oscommerce

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...