Example #1
0
    if (Config::Get('DEBUG_MODE') == true) {
        DB::show_errors();
    } else {
        DB::hide_errors();
    }
    if (!DB::connect(DBASE_USER, DBASE_PASS, DBASE_NAME, DBASE_SERVER)) {
        Debug::showCritical(Lang::gs('database.connection.failed') . ' (' . DB::$errno . ': ' . DB::$error . ')');
        die;
    }
    # Set the charset type to send to mysql
    if (Config::Get('DB_CHARSET_NAME') !== '') {
        DB::query('SET NAMES \'' . Config::Get('DB_CHARSET_NAME') . '\'');
    }
    # Include ORM
    #include_once(VENDORS_PATH.DS.'orm'.DS.'idiorm.php');
    #include_once(VENDORS_PATH.DS.'orm'.DS.'paris.php');
    #ORM::configure('mysql:host='.DBASE_SERVER.';dbname='.DBASE_NAME);
    #ORM::configure('username', DBASE_USER);
    #ORM::configure('password', DBASE_PASS);
}
include CORE_PATH . DS . 'bootstrap.inc.php';
if (function_exists('pre_module_load')) {
    pre_module_load();
}
MainController::loadEngineTasks();
define('ACTIVE_SKIN_PATH', LIB_PATH . DS . 'skins' . DS . CURRENT_SKIN);
Template::setTemplatePath(TEMPLATES_PATH);
Template::setSkinPath(ACTIVE_SKIN_PATH);
if (function_exists('post_module_load')) {
    post_module_load();
}
Example #2
0
    define('CURRENT_UID', $user->getID());
    define('CURRENT_SESSION_KEY', $user->get_facebook_token());
    // were going to call facebook using this users session
    FB::setSessionUser($user);
    // tell wib client who the active user is
    WIB::setSessionUser($user);
} else {
    define('CURRENT_UID', NULL);
    define('CURRENT_SESSION_KEY', NULL);
}
/**
 * the HTTP/HTML Template Handler & Presentation Layer (the view in mvc)
 */
require 'view.php';
// we are serving templates out of this folder
Template::setTemplatePath(CORE_PATH . 'view/');
// we are serving templates out of this folder
Template::setLayoutPath(SITE_ROOT . 'htdoc/layout/');
// the uri to target the controller
$controller = array_val($_REQUEST, 'controller');
// lots of people are going to hate this but i want to enforce denying access to global variables
// if we enforce use of $params, it makes is much easier to write tests, and create code which scales
$params = $_REQUEST;
$_REQUEST = $_GET = $_POST = array();
// the controller to dispatch is determined by the controller $_REQUEST variable
// the parameters to pass in are from the http request
// and we are using the HTTP/HTML View
try {
    //
    dispatch_controller($controller, $params, $user);
} catch (Exception $e) {
Example #3
0
 *
 * @author Nabeel Shahzad
 * @copyright Copyright (c) 2008, Nabeel Shahzad
 * @link http://www.nsslive.net/codon
 * @license BSD License
 * @package codon_core
 */
/**
 * @author Nabeel Shahzad <www.phpvms.net>
 * @desc Handles AJAX calls
 */
define('ADMIN_PANEL', true);
include '../core/codon.config.php';
error_reporting(E_ALL ^ E_NOTICE);
if (!Auth::LoggedIn() && !PilotGroups::group_has_perm(Auth::$usergroups, ACCESS_ADMIN)) {
    Debug::showCritical('Unauthorized access!');
    die;
}
$tplname = Config::Get('ADMIN_SKIN');
if ($tplname == '') {
    $tplname = 'layout';
}
$settings_file = SITE_ROOT . '/admin/lib/' . $tplname . '/' . $tplname . '.php';
if (file_exists($settings_file)) {
    include $settings_file;
}
Template::setTemplatePath(dirname(__FILE__) . '/templates');
Template::setSkinPath(SITE_ROOT . '/admin/lib/' . $tplname);
MainController::runAllActions();
# Force connection close
DB::close();
Example #4
0
define('CORE_PATH', SITE_ROOT . '/core');
define('CLASS_PATH', CORE_PATH . '/classes');
define('INSTALL_ROOT', SITE_ROOT . '/install');
if (!file_exists(CORE_PATH . '/local.config.php') || filesize(CORE_PATH . '/local.config.php') == 0) {
    /* Include just some basic files to get the install going */
    include CLASS_PATH . '/ezdb/ezdb.class.php';
    include CLASS_PATH . '/CodonCache.class.php';
    include CLASS_PATH . '/CodonData.class.php';
    include CLASS_PATH . '/Config.class.php';
    include CLASS_PATH . '/Debug.class.php';
    include CLASS_PATH . '/Template.class.php';
    include CLASS_PATH . '/TemplateSet.class.php';
    include CORE_PATH . '/common/SettingsData.class.php';
} else {
    include CORE_PATH . '/codon.config.php';
}
include CORE_PATH . '/lib/mysqldiff/MySQLDiff.class.php';
include INSTALL_ROOT . '/includes/Installer.class.php';
Template::init();
Template::setTemplatePath(INSTALL_ROOT . '/templates');
# Get the version info from the version file
$revision = file_get_contents(CORE_PATH . '/version');
preg_match('/^[v]?(.*)-([0-9]*)-(.*)/', $revision, $matches);
list($FULL_VERSION_STRING, $full_version, $revision_count, $hash) = $matches;
preg_match('/([0-9]*)\\.([0-9]*)\\.([0-9]*)/', $full_version, $matches);
list($full, $major, $minor, $revision) = $matches;
define('MAJOR_VERSION', $major . '.' . $minor);
define('INSTALLER_FULL_VERSION', $FULL_VERSION_STRING);
define('INSTALLER_VERSION', $full_version);
define('UPDATE_VERSION', $full_version);
define('REVISION', $revision);
Example #5
0
if (!Auth::LoggedIn()) {
    Debug::showCritical('Please login first');
    die;
}
if (!PilotGroups::group_has_perm(Auth::$usergroups, ACCESS_ADMIN)) {
    Debug::showCritical('Unauthorized access');
    die;
}
$BaseTemplate = new TemplateSet();
$tplname = Config::Get('ADMIN_SKIN');
if ($tplname == '') {
    $tplname = 'layout';
}
//load the main skin
$settings_file = SITE_ROOT . '/admin/lib/' . $tplname . '/' . $tplname . '.php';
if (file_exists($settings_file)) {
    include $settings_file;
}
Template::setTemplatePath(SITE_ROOT . '/admin/templates');
Template::setSkinPath(SITE_ROOT . '/admin/lib/' . $tplname);
$BaseTemplate->template_path = SITE_ROOT . '/admin/lib/' . $tplname;
$BaseTemplate->skin_path = SITE_ROOT . '/admin/lib/' . $tplname;
$BaseTemplate->Set('title', SITE_NAME);
Template::Set('MODULE_NAV_INC', $NAVBAR);
Template::Set('MODULE_HEAD_INC', $HTMLHead);
$BaseTemplate->Show('header.tpl');
flush();
MainController::runAllActions();
$BaseTemplate->Show('footer.tpl');
# Force connection close
DB::close();
Example #6
0
if (!Auth::LoggedIn()) {
    Debug::showCritical('Please login first');
    die;
}
if (!PilotGroups::group_has_perm(Auth::$usergroups, ACCESS_ADMIN)) {
    Debug::showCritical('Unauthorized access');
    die;
}
$BaseTemplate = new TemplateSet();
$tplname = Config::Get('ADMIN_SKIN');
if ($tplname == '') {
    $tplname = 'layout';
}
//load the main skin
$settings_file = SITE_ROOT . 'admin' . DS . 'lib' . DS . $tplname . DS . $tplname . '.php';
if (file_exists($settings_file)) {
    include $settings_file;
}
Template::setTemplatePath(SITE_ROOT . 'admin' . DS . 'templates');
Template::setSkinPath(SITE_ROOT . 'admin' . DS . 'lib' . DS . $tplname);
$BaseTemplate->template_path = SITE_ROOT . 'admin' . DS . 'lib' . DS . $tplname;
$BaseTemplate->skin_path = SITE_ROOT . 'admin' . DS . 'lib' . DS . $tplname;
$BaseTemplate->Set('title', SITE_NAME);
Template::Set('MODULE_NAV_INC', $NAVBAR);
Template::Set('MODULE_HEAD_INC', $HTMLHead);
$BaseTemplate->Show('header.php');
flush();
MainController::runAllActions();
$BaseTemplate->Show('footer.php');
# Force connection close
DB::close();
Example #7
0
 /**
  * PilotAdmin::RejectPilot()
  * 
  * @return
  */
 protected function RejectPilot()
 {
     $pilot = PilotData::GetPilotData($this->post->id);
     # Send pilot notification
     $subject = Lang::gs('email.register.rejected.subject');
     $this->set('pilot', $pilot);
     $oldPath = Template::setTemplatePath(TEMPLATES_PATH);
     $oldSkinPath = Template::setSkinPath(ACTIVE_SKIN_PATH);
     $message = Template::Get('email_registrationdenied.tpl', true, true, true);
     Template::setTemplatePath($oldPath);
     Template::setSkinPath($oldSkinPath);
     Util::SendEmail($pilot->email, $subject, $message);
     # Reject in the end, since it's delted
     PilotData::RejectPilot($this->post->id);
     CodonEvent::Dispatch('pilot_rejected', 'PilotAdmin', $pilot);
     LogData::addLog(Auth::$userinfo->pilotid, 'Approved ' . PilotData::getPilotCode($pilot->code, $pilot->pilotid) . ' - ' . $pilot->firstname . ' ' . $pilot->lastname);
 }
 /**
  * RegistrationData::SendEmailConfirm()
  * 
  * @param mixed $email
  * @param mixed $firstname
  * @param mixed $lastname
  * @param string $newpw
  * @return void
  */
 public static function SendEmailConfirm($email, $firstname, $lastname, $newpw = '')
 {
     $confid = self::$salt;
     $subject = SITE_NAME . ' Registration';
     Template::Set('firstname', $firstname);
     Template::Set('lastname', $lastname);
     Template::Set('confid', $confid);
     $oldPath = Template::setTemplatePath(TEMPLATES_PATH);
     $oldSkinPath = Template::setSkinPath(ACTIVE_SKIN_PATH);
     $message = Template::getTemplate('email_registered.tpl', true, true, true);
     Template::setTemplatePath($oldPath);
     Template::setSkinPath($oldSkinPath);
     //email them the confirmation
     Util::sendEmail($email, $subject, $message);
 }