Fix cron can move plan

This commit is contained in:
Ibnu Maksum
2023-09-06 10:48:52 +07:00
parent e23abc1377
commit 910be1946b
7 changed files with 119 additions and 111 deletions

View File

@ -7,30 +7,6 @@
* 0 7 * * * /usr/bin/php /var/www/system/cron_reminder.php
**/
require('../config.php');
require('orm.php');
require_once 'autoload/PEAR2/Autoload.php';
ORM::configure("mysql:host=$db_host;dbname=$db_name");
ORM::configure('username', $db_user);
ORM::configure('password', $db_password);
ORM::configure('return_result_sets', true);
ORM::configure('logging', true);
include "autoload/Hookers.php";
// notification message
if(file_exists("uploads/notifications.json")){
$_notifmsg =json_decode(file_get_contents('uploads/notifications.json'), true);
}
$_notifmsg_default = json_decode(file_get_contents('uploads/notifications.default.json'), true);
//register all plugin
foreach (glob("plugin/*.php") as $filename) {
include $filename;
}
// on some server, it getting error because of slash is backwards
function _autoloader($class)
@ -38,7 +14,7 @@ function _autoloader($class)
if (strpos($class, '_') !== false) {
$class = str_replace('_', DIRECTORY_SEPARATOR, $class);
if (file_exists('autoload' . DIRECTORY_SEPARATOR . $class . '.php')) {
include 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
include __DIR__.DIRECTORY_SEPARATOR.'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
} else {
$class = str_replace("\\", DIRECTORY_SEPARATOR, $class);
if (file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php'))
@ -46,7 +22,7 @@ function _autoloader($class)
}
} else {
if (file_exists('autoload' . DIRECTORY_SEPARATOR . $class . '.php')) {
include 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
include __DIR__.DIRECTORY_SEPARATOR.'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
} else {
$class = str_replace("\\", DIRECTORY_SEPARATOR, $class);
if (file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php'))
@ -57,6 +33,30 @@ 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");
ORM::configure("mysql:host=$db_host;dbname=$db_name");
ORM::configure('username', $db_user);
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);
}
$_notifmsg_default = json_decode(file_get_contents(__DIR__.File::pathFixer('uploads/notifications.default.json')), true);
//register all plugin
foreach (glob(File::pathFixer("plugin/*.php")) as $filename) {
include $filename;
}
$result = ORM::for_table('tbl_appconfig')->find_many();
foreach ($result as $value) {
$config[$value['setting']] = $value['value'];