Example #1
0
set_include_path('lib/pear/');
require_once 'Global/Functions.php';
define('CONFIG_CREATED', is_file('config/core/config.php'));
if (CONFIG_CREATED) {
    require_once './config/core/config.php';
} else {
    define('SITE_HASH', md5(rand()));
}
if (!defined('PHPWS_SOURCE_DIR')) {
    define('PHPWS_SOURCE_DIR', getcwd() . '/');
}
if (!defined('PHPWS_SOURCE_HTTP')) {
    define('PHPWS_SOURCE_HTTP', './');
}
require_once 'core/conf/defines.dist.php';
loadTimeZone();
require_once './setup/config.php';
require_once './core/class/Template.php';
require_once './setup/class/Setup.php';
// Core is loaded in Init
PHPWS_Core::initCoreClass('Form.php');
PHPWS_Core::initModClass('boost', 'Boost.php');
PHPWS_Core::initModClass('users', 'Current_User.php');
$setup = new Setup();
/**
 * Starts session, checks if supported on client and server
 * Program exits here if fails.
 */
$setup->checkSession();
/**
 * Check the server for certain settings before getting into the meat
Example #2
0
/**
 * Logs a message to the specified $filename in side the defined LOG_DIRECTORY
 *
 * @param string $message
 * @param string $filename
 * @return boolean
 */
function logMessage($message, $filename)
{
    if (preg_match('|[/\\\\]|', $filename)) {
        trigger_error('Slashes not allowed in log file names.', E_USER_ERROR);
    }
    loadTimeZone();
    $log_path = LOG_DIRECTORY . $filename;
    $message = strftime('[' . LOG_TIME_FORMAT . ']', time()) . trim($message) . "\n";
    if (error_log($message, 3, $log_path)) {
        chmod($log_path, LOG_PERMISSION);
        return true;
    } else {
        trigger_error("Could not write {$filename} file. Check error directory setting and file permissions.", E_USER_ERROR);
    }
}