diff --git a/system/cron.php b/system/cron.php index 9364e332..da89c13e 100644 --- a/system/cron.php +++ b/system/cron.php @@ -28,10 +28,10 @@ function _autoloader($class) } spl_autoload_register('_autoloader'); -require_once __DIR__.File::pathFixer('/../config.php'); +require_once '../config.php'; require_once 'orm.php'; -require_once __DIR__.File::pathFixer('/autoload/PEAR2/Autoload.php'); -include __DIR__.File::pathFixer("/autoload/Hookers.php"); +require_once 'autoload/PEAR2/Autoload.php'; +include "autoload/Hookers.php"; ORM::configure("mysql:host=$db_host;dbname=$db_name"); ORM::configure('username', $db_user); @@ -41,10 +41,10 @@ ORM::configure('logging', true); // notification message -if (file_exists(__DIR__.File::pathFixer("uploads/notifications.json"))) { - $_notifmsg = json_decode(file_get_contents(__DIR__.File::pathFixer('uploads/notifications.json')), true); +if (file_exists("uploads/notifications.json")) { + $_notifmsg = json_decode(file_get_contents('uploads/notifications.json'), true); } -$_notifmsg_default = json_decode(file_get_contents(__DIR__.File::pathFixer('uploads/notifications.default.json')), true); +$_notifmsg_default = json_decode(file_get_contents('uploads/notifications.default.json'), true); //register all plugin foreach (glob(File::pathFixer("plugin/*.php")) as $filename) { diff --git a/system/cron_reminder.php b/system/cron_reminder.php index 7813dcca..e06e6aa4 100644 --- a/system/cron_reminder.php +++ b/system/cron_reminder.php @@ -7,13 +7,12 @@ * 0 7 * * * /usr/bin/php /var/www/system/cron_reminder.php **/ - // on some server, it getting error because of slash is backwards function _autoloader($class) { if (strpos($class, '_') !== false) { $class = str_replace('_', DIRECTORY_SEPARATOR, $class); - if (file_exists('autoload' . DIRECTORY_SEPARATOR . $class . '.php')) { + if (file_exists(__DIR__.DIRECTORY_SEPARATOR.'autoload' . DIRECTORY_SEPARATOR . $class . '.php')) { include __DIR__.DIRECTORY_SEPARATOR.'autoload' . DIRECTORY_SEPARATOR . $class . '.php'; } else { $class = str_replace("\\", DIRECTORY_SEPARATOR, $class); @@ -21,7 +20,7 @@ function _autoloader($class) include __DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php'; } } else { - if (file_exists('autoload' . DIRECTORY_SEPARATOR . $class . '.php')) { + if (file_exists(__DIR__.DIRECTORY_SEPARATOR.'autoload' . DIRECTORY_SEPARATOR . $class . '.php')) { include __DIR__.DIRECTORY_SEPARATOR.'autoload' . DIRECTORY_SEPARATOR . $class . '.php'; } else { $class = str_replace("\\", DIRECTORY_SEPARATOR, $class); @@ -30,13 +29,12 @@ function _autoloader($class) } } } - spl_autoload_register('_autoloader'); - require_once __DIR__.File::pathFixer('/../config.php'); - require_once __DIR__.File::pathFixer('orm.php'); - require_once __DIR__.File::pathFixer('/autoload/PEAR2/Autoload.php'); - include __DIR__.File::pathFixer("/autoload/Hookers.php"); + require_once '../config.php'; + require_once 'orm.php'; + require_once 'autoload/PEAR2/Autoload.php'; + include "autoload/Hookers.php"; ORM::configure("mysql:host=$db_host;dbname=$db_name"); ORM::configure('username', $db_user); @@ -44,13 +42,11 @@ ORM::configure('password', $db_password); ORM::configure('return_result_sets', true); ORM::configure('logging', true); - // notification message -if (file_exists(__DIR__.File::pathFixer("uploads/notifications.json"))) { - $_notifmsg = json_decode(file_get_contents(__DIR__.File::pathFixer('uploads/notifications.json')), true); +if (file_exists("uploads/notifications.json")) { + $_notifmsg = json_decode(file_get_contents('uploads/notifications.json'), true); } -$_notifmsg_default = json_decode(file_get_contents(__DIR__.File::pathFixer('uploads/notifications.default.json')), true); - +$_notifmsg_default = json_decode(file_get_contents('uploads/notifications.default.json'), true); //register all plugin foreach (glob(File::pathFixer("plugin/*.php")) as $filename) {