PDA

View Full Version : Fatal errors in ACP


Dinocanid
09-24-2017, 10:08 PM
I have a strange problem where I'll get the following errors, but only in the ACP and nowhere else:
Warning: require(inc/smarty/Smarty.class.php): failed to open stream: No such file or directory in /home/foodbabs/public_html/classes/class_mysidia.php on line 326

Warning: require(inc/smarty/Smarty.class.php): failed to open stream: No such file or directory in /home/foodbabs/public_html/classes/class_mysidia.php on line 326

Fatal error: require(): Failed opening required 'inc/smarty/Smarty.class.php' (include_path='.:/opt/alt/php55/usr/share/pear:/opt/alt/php55/usr/share/php') in /home/foodbabs/public_html/classes/class_mysidia.php on line 326

I'm using x10 and I already applied the class_path fix, so that's not the issue. It used to work fine before, and I haven't made any changes to it, so I'm unsure where the problem is. It used to work just fine too.

Silver_Brick
09-25-2017, 11:16 AM
as much as i know it is problem related to template of admin panel if you don't mind can i have a look at your files that you changed :pleased:

Dinocanid
09-25-2017, 07:42 PM
It's not the ACP template file, since I replaced it with a fresh, unedited one to see if that was the problem. It didn't fix a thing :/
<?php

/**
* The Path Class, it is one of Mysidia system core classes.
* It acts as an initializer and wrapper for Mysidia-specific paths.
* It implements PHP basic path functions, and adds enhanced features upon them.
* An instance of Path class is generated upon Mysidia system object's creation.
* This specific instance is available from Registry, just like any other Mysidia core objects.
* @category Resource
* @package Core
* @author Hall of Famer
* @copyright Mysidia Adoptables Script
* @link http://www.mysidiaadoptables.com
* @since 1.3.2
* @todo Improvement over include_path methods to enable better auto-loading.
*/

class Path extends Core implements Initializable{

/**
* The absolute property, which stores the absolute path of the main site.
* @access private
* @var String
*/
private $absolute;

/**
* The root property, which defines the current file root directory.
* @access private
* @var String
*/
private $root;

/**
* The tempRoot property, which defines the root directory used in template files.
* @access private
* @var String
*/
private $tempRoot;

/**
* The dir property, which stores the current file sub directory.
* @access private
* @var String
*/
private $dir;

/**
* The path property, it specifies important file paths to be included.
* @access private
* @var ArrayObject
*/
private $path;

/**
* Constructor of Path Class, it initializes basic path properties.
* @access public
* @return Void
*/
public function __construct(){
$this->absolute = "http://".DOMAIN.SCRIPTPATH."/";
$this->root = "/home/foodbabs/public_html/";
$this->tempRoot = SCRIPTPATH."/";
$this->path = new ArrayObject(array("{$this->root}classes/core", "{$this->root}classes/exception", "{$this->root}classes/user", "{$this->root}classes/message", "{$this->root}classes/item", "{$this->root}classes/shop"));
// MVC structure has yet been established, for now comment out the include path setup.
//$this->initialize();
}

/**
* The initialize method, which handles basic include path operations.
* @access public
* @return Void
*/
public function initialize(){
if(empty($this->dir) or empty($this->path)) throw new Exception('Cannot set basic include paths.');
foreach($this->path as $path){
$this->setIncludePath($path);
}
}

/**
* The getAbsolute method, which retrieves private property absolute.
* @access public
* @return String
*/
public function getAbsolute(){
return $this->absolute;

}

/**
* The getRoot method, which retrieves private property root.
* @access public
* @return String
*/
public function getRoot(){
return $this->root;

}

/**
* The getScriptRoot method, which retrieves private property scriptRoot.
* This can be used for css stylesheet and javascript loading in header template file.
* @access public
* @return String
*/
public function getTempRoot(){
return $this->tempRoot;

}


/**
* The getDirectory method, which obtains the current directory.
* By default this value is null, it must be assigned first in front controller.
* @access public
* @return String
*/
public function getDirectory(){
return $this->dir;
}

/**
* The setDirectory method, set the private property dir.
* @access public
* @return Void
*/
public function setDirectory($dir){
$this->dir = $dir;
}

/**
* The includes method, simulates the include and include_once function in OO way.
* @access public
* @return Void
*/
public function includes($file, $mode = NULL){
if($mode = "once") include_once $file;
else include $file;
}

/**
* The requires method, simulates the require and require_once function in OO way.
* @access public
* @return Void
*/
public function requires($file){
if($mode = "once") require_once $file;
else require $file;
}

/**
* The getIncludePath method, similar to get_include_path() function in PHP.
* Its functionality will expand in future releases.
* @access public
* @return String
*/
public function getIncludePath(){
return get_include_path();
}

/**
* The setIncludePath method, similar to set_include_path() function in PHP.
* This method significantly simplifies multiple include path operations.
* @access public
* @return Void
*/
public function setIncludePath($path){
set_include_path($this->getIncludePath().PATH_SEPARATOR.$path);
}

/**
* The restoreIncludePath method, similar to restore_include_path() function in PHP.
* Its functionality will expand in future releases.
* @access public
* @return Void
*/
public function restoreIncludePath(){
restore_include_path();
}
}
?>
This is my class_path, in case i missed something.

Kesstryl
09-25-2017, 08:07 PM
Did you recently upgrade your Wamp server or whatever development server you are using? Unless it's the one hosted here, maybe something was updated on the Mysidia server and it's breaking the code. Any upgrades in php or database server can cause issues like this. I recently installed Wamp on a new laptop, and the newest version of mysql that it uses now defaults to strict mode which broke some of my code.

Dinocanid
09-25-2017, 08:35 PM
It's not on WAMPP (or XAMPP, since I have both), I have it on x10 host. I haven't upgraded anything, unless x10 does automatic upgrades for all servers.

Dinocanid
10-14-2017, 03:17 PM
It took my a while to fix this, but i managed to figure it out. I had to go into class_mysidia and class_language and add "$this-root", since the x10 path fix had messed up some relative pathing.
I needed to do this in class_language for example: $this->root = "/home/foodbabs/public_html/";
$globallangfile = "{$this->root}lang/lang_global.php";

AriaAmberkinz
01-25-2018, 05:05 PM
Could you post a more detailed version of what you did, Dinocanid? I seem to be having the same issue.

Dinocanid
01-25-2018, 07:52 PM
Could you post a more detailed version of what you did, Dinocanid? I seem to be having the same issue.

On a fresh install, there's this code under "public function initialize" in class_language.php:

public function initialize(){
$globallangfile = "{$this->dir}lang/lang_global.php";
require $globallangfile;
$this->global = new ArrayObject($lang, ArrayObject::ARRAY_AS_PROPS);
}

I changed it so I defined the path myself, like this:

public function initialize(){
$this->root = "/home/foodbabs/public_html/";
$globallangfile = "{$this->root}lang/lang_global.php";
require $globallangfile;
$this->global = new ArrayObject($lang, ArrayObject::ARRAY_AS_PROPS);
}


In class_mysidia.php, I replaced "public function getTemplate()" with this:
public function getTemplate(){
$this->root = "/home/foodbabs/public_html/";
$templateClass = "{$this->root}inc/smarty/Smarty.class.php";
require $templateClass;

$this->template = new Template($this->path);
Registry::set(new String("template"), $this->template, TRUE, TRUE);
return $this->template;
}

So I added my own path based on the home directory, that way it doesn't forget where things are for some reason.

AriaAmberkinz
01-25-2018, 10:38 PM
Thanks! That seems to have fixed that particular problem. Unfortunately, now I'm getting
Fatal error: Class Language contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Initializable::initialize) in /home/noppitsp/public_html/Mysidia Adoptables v1.3.4/classes/class_language.php on line 132
I checked class_language.php and there's just a bracket on that line. :ohnoes:

Dinocanid
01-26-2018, 08:35 AM
Maybe try moving it out of a subfolder and into the root/public_html folder? (The whole script, not just that file)
I've never installed mysidia in a subfolder, so idk if that could be related or not.

AriaAmberkinz
01-26-2018, 01:21 PM
Thank you! I actually noticed that the initializer was missing. :el: I'm not sure what happened there, but I got it working!