Exemple #1
0
 /**
  * Create a new cron-task object instance.
  *
  * @param  string	$index_path
  * @param  string	$log_path
  * @return void
  */
 function __construct($index_path, $config_file = "config.ini", $log_file = null)
 {
     $this->_LOG_PATH = $log_file ? $log_file : 'logs/crons.log';
     require_once $index_path . './library/MantellaConfig.php';
     require_once $index_path . './library/MantellaException.php';
     require_once $index_path . './library/MantellaDBManager.php';
     require_once $index_path . './library/MantellaModel.php';
     require_once $index_path . './library/MantellaValidator.php';
     require_once $index_path . './library/MantellaCollection.php';
     require_once $index_path . './library/MantellaLocalization.php';
     require_once $index_path . './library/MantellaView.php';
     @set_include_path(get_include_path() . PATH_SEPARATOR . '../config/');
     CONF::init($config_file, realpath(dirname(__FILE__) . '/../') . '/');
 }
Exemple #2
0
 */
// ========== PREPARE =========
error_reporting(E_ALL);
session_start();
if (version_compare(PHP_VERSION, '5.0.0', '<')) {
    exit("Sorry, MantellaMVC needs PHP version 5+!\n");
}
// ========== ROUTING =========
// MOD_REWRITE please configure via .htaccess or httpd.conf
// ========== SYSTEM INCLUDES ==========
@set_include_path(get_include_path() . PATH_SEPARATOR . "../app/config/");
require_once '../core/MantellaConfig.php';
require_once '../core/MantellaApplication.php';
require_once '../core/MantellaDBManager.php';
// ========== INITIAL CONFIGURATION ==========
CONF::init("../app/config.ini", dirname(__FILE__) . '/../');
// ========== INIT APPLICATION ==========
$app = new MantellaApplication('Index', '_');
try {
    $app->run();
} catch (Exception $e) {
    $e->logException();
    header($e->getHttpHeader());
    MantellaView::template("errors/" . $e->getCode());
    if (MantellaView::is_template_attached()) {
        MantellaView::set('error', $e->getFullError());
        MantellaView::show();
    } else {
        print "<div style=\"margin:100px; padding:30px; border:1px dotted #C0C0C0;\">\n        \t     ERROR " . $e->getCode() . ": " . $e->getHttpCause() . "</b><br /><br />\n            \t <span style=\"font-size:11px; font-family:Arial; color:#777;\">\n                \t  &gt;&gt; Url: " . $_SERVER["SERVER_NAME"] . $_SERVER['REQUEST_URI'] . "<br >\n\t\t   \t   \t\t  &gt;&gt; Ref. Number: " . $e->getRef() . "<br />\n\t\t       \t\t  &gt;&gt; Please inform " . (defined('M_ADMIN_EMAIL') ? "<a style=\"color:#666;\" href=\"mailto: " . M_ADMIN_EMAIL . "\">administrator</a>" : "administrator") . " about this problem, thanks!\n\t\t     \t</span>\n\t\t   \t  </div>\n";
    }
}