예제 #1
0
 function run()
 {
     // Make sure that the output is sent to the browser before
     // loading libraries and connecting to the db
     flush();
     $aConf = $GLOBALS['_MAX']['CONF'];
     // Set longer time out, and ignore user abort
     if (!ini_get('safe_mode')) {
         @set_time_limit($aConf['maintenance']['timeLimitScripts']);
         @ignore_user_abort(true);
     }
     if (!defined('OA_VERSION')) {
         // If the code is executed inside delivery, the constants
         // need to be initialized
         require_once MAX_PATH . '/constants.php';
         setupConstants();
     }
     $oLock =& OA_DB_AdvisoryLock::factory();
     if ($oLock->get(OA_DB_ADVISORYLOCK_MAINTENANCE)) {
         OA::debug('Running Automatic Maintenance Task', PEAR_LOG_INFO);
         OA_Preferences::loadAdminAccountPreferences();
         require_once LIB_PATH . '/Maintenance.php';
         $oMaint = new OX_Maintenance();
         $oMaint->run();
         $oLock->release();
         OA::debug('Automatic Maintenance Task Completed', PEAR_LOG_INFO);
     } else {
         OA::debug('Automatic Maintenance Task not run: could not acquire lock', PEAR_LOG_INFO);
     }
 }
예제 #2
0
/**
 * The environment initialisation function for the mAdserve administration interface.
 *
 */
function init()
{
    global $mad_install_active;
    // Set up server variables
    setupServerVariables();
    // Set up the UI constants
    setupConstants();
    // Set up the common configuration variables
    setupConfigVariables();
    // Setup Time Zone
    if (MAD_TIMEZONE_OVERRIDE) {
        $GLOBALS['_DATE_TIMEZONE_DEFAULT'] = MAD_DEFAULT_TIMEZONE;
        date_default_timezone_set(MAD_DEFAULT_TIMEZONE);
    }
    error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING ^ E_DEPRECATED);
    // If not being called from the installation script...
    if (!isset($GLOBALS['_MAX']['CONF']['madserve']['installed']) || !$GLOBALS['_MAX']['CONF']['madserve']['installed']) {
        define('MAD_INSTALLATION_STATUS', MAD_INSTALLATION_STATUS_NOTINSTALLED);
    } else {
        if ($GLOBALS['_MAX']['CONF']['madserve']['installed'] && file_exists(MAD_PATH . '/conf/UPGRADE')) {
            define('MAD_INSTALLATION_STATUS', MAD_INSTALLATION_STATUS_UPGRADING);
        } else {
            if ($GLOBALS['_MAX']['CONF']['madserve']['installed'] && file_exists(MAD_PATH . '/conf/INSTALLED')) {
                define('MAD_INSTALLATION_STATUS', MAD_INSTALLATION_STATUS_INSTALLED);
            }
        }
    }
    // CHECK IF SCRIPT IS INSTALLED; OTHERWISE REDIRECT TO INSTALLER
    if (MAD_INSTALLATION_STATUS != MAD_INSTALLATION_STATUS_INSTALLED && $mad_install_active != 1) {
        require_once MAD_PATH . '/functions/adminredirect.php';
        MAD_Admin_Redirect::redirect(MAD_ADSERVING_PROTOCOL . MAD_getHostName() . substr(dirname(__FILE__), strlen($_SERVER['DOCUMENT_ROOT'])) . '/www/cp/install.php');
        exit;
    }
    // Store the original memory limit before changing it
    $GLOBALS['_OX']['ORIGINAL_MEMORY_LIMIT'] = MAD_getMemoryLimitSizeInBytes();
    // Increase the PHP memory_limit value to the mAdserve minimum required value, if necessary
    MAD_increaseMemoryLimit(MAD_getMinimumRequiredMemory());
    if (MAD_INSTALLATION_STATUS == MAD_INSTALLATION_STATUS_INSTALLED) {
        if ($mad_install_active == 1) {
            echo "mAdserve has already been installed.";
            exit;
        }
        if (!MAD_connect_maindb()) {
            echo "Unable to connect to mAdserve main database. Please check the variables supplied in /conf/main.config.php and verify that MySQL is running.";
            exit;
        }
        if ($GLOBALS['_MAX']['CONF']['reportingdatabase']['useseparatereportingdatabase']) {
            if (!MAD_connect_repdb()) {
                echo "Unable to connect to separated mAdserve reporting database. Please check the variables supplied in /conf/main.config.php and verify that MySQL is running.";
                exit;
            }
        }
    }
    if (!$GLOBALS['_MAX']['CONF']['reportingdatabase']['useseparatereportingdatabase']) {
        global $repdb;
        $repdb = $maindb;
    }
}
 *
 * You might also need to pass the field through the
 * max_formattedNumberStringToFloat() function when the onSubmit()
 * event of the field occurs, so that you get un-formatted input
 * into your form submission script, if said script doesn't deal
 * with the formatted input.
 *
 *
 * @TODO Add support for dealing with exceeding the upper limit of
 *       JS support for numbers.
 */
// Setup the application constants since these are referenced in the language packs
// there's a slight hack here to prevent constants from parsing the config files
include '../../constants.php';
$GLOBALS['_MAX']['CONF'] = true;
setupConstants();
$PRODUCT_NAME = PRODUCT_NAME;
$PRODUCT_DOCSURL = PRODUCT_DOCSURL;
//Always load the English language, in case of incomplete translations
include '../../lib/max/language/en/default.lang.php';
$lang = str_replace(array('../', ""), '', $_GET['lang']);
if (isset($lang) && $lang != "en" && preg_match('/^[a-zA-Z_-]+$/D', $lang)) {
    //if selected directory exist, read language file
    if (is_readable("../../lib/max/language/" . $lang . "/default.lang.php")) {
        include '../../lib/max/language/' . $lang . '/default.lang.php';
    }
}
// Send content-type header
header("Content-type: application/x-javascript");
// The largest possible integer in when using JavaScript's
// default 4-octet storage for numbers