Beispiel #1
0
 function initialize()
 {
     register_storage(new MW_MySQLStorage());
     register_datetime_class("MW_MySQLDateTime");
     set_default_config('db_host', 'localhost');
     set_default_config('db_user', 'miniwiki');
     set_default_config('db_pass', 'miniwiki');
     set_default_config('db_name', 'miniwiki');
     set_default_config('db_use_server_collation', true);
     set_default_config('db_encoding', 'utf8');
     return true;
 }
Beispiel #2
0
    throw new InstallationException($msg);
}
// load the rest of the library files from engine/lib/
$lib_files = array('database.php', 'actions.php', 'admin.php', 'annotations.php', 'calendar.php', 'configuration.php', 'cron.php', 'entities.php', 'export.php', 'extender.php', 'filestore.php', 'group.php', 'location.php', 'mb_wrapper.php', 'memcache.php', 'metadata.php', 'metastrings.php', 'navigation.php', 'notification.php', 'objects.php', 'opendd.php', 'pagehandler.php', 'pageowner.php', 'pam.php', 'plugins.php', 'private_settings.php', 'relationships.php', 'river.php', 'sites.php', 'statistics.php', 'tags.php', 'user_settings.php', 'users.php', 'upgrade.php', 'web_services.php', 'widgets.php', 'xml.php', 'xml-rpc.php', 'deprecated-1.7.php', 'deprecated-1.8.php');
foreach ($lib_files as $file) {
    $file = $lib_dir . $file;
    elgg_log("Loading {$file}...");
    if (!(include_once $file)) {
        $msg = sprintf(elgg_echo('InstallationException:MissingLibrary'), $file);
        throw new InstallationException($msg);
    }
}
// confirm that the installation completed successfully
verify_installation();
// Autodetect some default configuration settings
set_default_config();
// needs to be set for links in html head
$viewtype = get_input('view', 'default');
$lastcached = datalist_get("simplecache_lastcached_{$viewtype}");
$CONFIG->lastcache = $lastcached;
// Trigger boot events for core. Plugins can't hook
// into this because they haven't been loaded yet.
elgg_trigger_event('boot', 'system');
// Load the plugins that are active
elgg_load_plugins();
elgg_trigger_event('plugins_boot', 'system');
// Trigger system init event for plugins
elgg_trigger_event('init', 'system');
// Regenerate the simple cache if expired.
// Don't do it on upgrade because upgrade does it itself.
// @todo - move into function and perhaps run off init system event
 /**
  * Load the contents of the schema into the database and then alter it based on what has been input during the installation
  */
 function load_schema($mode, $sub)
 {
     global $cache, $gallery_config, $phpbb_root_path, $phpEx, $template, $user;
     include $phpbb_root_path . 'includes/acp/auth.' . $phpEx;
     $this->page_title = $user->lang['STAGE_CREATE_TABLE'];
     $s_hidden_fields = '';
     $dbms_data = get_dbms_infos();
     $db_schema = $dbms_data['db_schema'];
     $delimiter = $dbms_data['delimiter'];
     // Create the tables
     nv_create_table('phpbb_gallery_albums', $dbms_data);
     nv_create_table('phpbb_gallery_albums_track', $dbms_data);
     nv_create_table('phpbb_gallery_comments', $dbms_data);
     nv_create_table('phpbb_gallery_config', $dbms_data);
     nv_create_table('phpbb_gallery_contests', $dbms_data);
     nv_create_table('phpbb_gallery_favorites', $dbms_data);
     nv_create_table('phpbb_gallery_images', $dbms_data);
     nv_create_table('phpbb_gallery_modscache', $dbms_data);
     nv_create_table('phpbb_gallery_permissions', $dbms_data);
     nv_create_table('phpbb_gallery_rates', $dbms_data);
     nv_create_table('phpbb_gallery_reports', $dbms_data);
     nv_create_table('phpbb_gallery_roles', $dbms_data);
     nv_create_table('phpbb_gallery_users', $dbms_data);
     nv_create_table('phpbb_gallery_watch', $dbms_data);
     // Create columns
     nv_add_column(SESSIONS_TABLE, 'session_album_id', array('UINT', 0));
     nv_add_column(LOG_TABLE, 'album_id', array('UINT', 0));
     nv_add_column(LOG_TABLE, 'image_id', array('UINT', 0));
     nv_add_index(GALLERY_USERS_TABLE, 'pg_palbum_id', array('personal_album_id'));
     nv_add_index(SESSIONS_TABLE, 'session_aid', array('session_album_id'));
     // Set default config
     set_default_config();
     $auth_admin = new auth_admin();
     $auth_admin->acl_add_option(array('local' => array(), 'global' => array('a_gallery_manage', 'a_gallery_albums', 'a_gallery_import', 'a_gallery_cleanup')));
     $cache->destroy('acl_options');
     $template->assign_vars(array('BODY' => $user->lang['STAGE_CREATE_TABLE_EXPLAIN'], 'L_SUBMIT' => $user->lang['NEXT_STEP'], 'S_HIDDEN' => '', 'U_ACTION' => append_sid("{$phpbb_root_path}install/index.{$phpEx}", "mode={$mode}&sub=in_progress")));
 }
Beispiel #4
0
    }
} else {
    $result = $adb->query("SELECT * FROM vtiger_version");
    $dbversion = $adb->query_result($result, 0, 'current_version');
    if (version_compare($dbversion, $vtiger_current_version, '=')) {
        $_SESSION['VTIGER_DB_VERSION'] = $dbversion;
    } else {
        echo "<table border='0' cellpadding='5' cellspacing='0' width='100%' height='450px'><tr><td align='center'>";
        echo "<div style='border: 3px solid rgb(153, 153, 153); background-color: rgb(255, 255, 255); width: 55%; position: relative; z-index: 10000000;'>\n\n\t\t\t<table border='0' cellpadding='5' cellspacing='0' width='98%'>\n\t\t\t<tbody><tr>\n\t\t\t<td style='border-bottom: 1px solid rgb(204, 204, 204);' nowrap='nowrap' width='70%'><span class='genHeaderSmall'>Migration Incompleted.</span></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t<td class='small' align='right' nowrap='nowrap'>Please contact your system administrator.<br></td>\n\t\t\t</tr>\n\t\t\t</tbody></table>\n\t\t\t</div>";
        echo "</td></tr></table>";
        exit;
    }
}
// END
$default_config_values = array("allow_exports" => "all", "upload_maxsize" => "3000000", "listview_max_textlength" => "40", "php_max_execution_time" => "0");
set_default_config($default_config_values);
// Set the default timezone preferred by user
global $default_timezone;
if (isset($default_timezone) && function_exists('date_default_timezone_set')) {
    @date_default_timezone_set($default_timezone);
}
require_once 'include/logging.php';
require_once 'modules/Users/Users.php';
global $currentModule;
//if($calculate_response_time) $startTime = microtime();
$log =& LoggerManager::getLogger('index');
global $seclog;
$seclog =& LoggerManager::getLogger('SECURITY');
if (isset($_REQUEST['PHPSESSID'])) {
    $log->debug("****Starting for session " . $_REQUEST['PHPSESSID']);
} else {
Beispiel #5
0
 /**
  * Load remaining engine libraries and complete bootstraping (see start.php)
  *
  * @param string $step Which step to boot strap for. Required because
  *                     boot strapping is different until the DB is populated.
  *
  * @return void
  */
 protected function finishBootstraping($step)
 {
     $dbIndex = array_search('database', $this->getSteps());
     $settingsIndex = array_search('settings', $this->getSteps());
     $stepIndex = array_search($step, $this->getSteps());
     if ($stepIndex <= $settingsIndex) {
         // install has its own session handling before the db created and set up
         session_name('Elgg');
         session_start();
         elgg_unregister_event_handler('boot', 'system', 'session_init');
     } else {
         if (!$this->isAction && $stepIndex == $settingsIndex + 1) {
             // now using Elgg session handling so need to pass forward the system messages
             // this is called on the GET of the next step
             session_name('Elgg');
             session_start();
             $messages = $_SESSION['msg'];
         }
     }
     if ($stepIndex > $dbIndex) {
         // once the database has been created, load rest of engine
         global $CONFIG;
         $lib_dir = $CONFIG->path . 'engine/lib/';
         $this->loadSettingsFile();
         $lib_files = array('database.php', 'actions.php', 'admin.php', 'annotations.php', 'calendar.php', 'cron.php', 'entities.php', 'extender.php', 'filestore.php', 'group.php', 'location.php', 'mb_wrapper.php', 'memcache.php', 'metadata.php', 'metastrings.php', 'navigation.php', 'notification.php', 'objects.php', 'opendd.php', 'pagehandler.php', 'pageowner.php', 'pam.php', 'plugins.php', 'private_settings.php', 'relationships.php', 'river.php', 'sites.php', 'statistics.php', 'tags.php', 'user_settings.php', 'users.php', 'upgrade.php', 'web_services.php', 'widgets.php', 'xml.php', 'xml-rpc.php', 'deprecated-1.7.php', 'deprecated-1.8.php');
         foreach ($lib_files as $file) {
             $path = $lib_dir . $file;
             if (!(include_once $path)) {
                 $msg = elgg_echo('InstallationException:MissingLibrary', array($file));
                 throw new InstallationException($msg);
             }
         }
         set_default_config();
         elgg_trigger_event('boot', 'system');
         elgg_trigger_event('init', 'system');
         // @hack finish the process of pushing system messages into new session
         if (!$this->isAction && $stepIndex == $settingsIndex + 1) {
             $_SESSION['msg'] = $messages;
         }
     }
 }
Beispiel #6
0
# Free to copy, free to modify, NO WARRANTY
/** @file
 * support for authorization and authentication
 */
require_once 'registry.php';
require_once 'settings.php';
/** admin user name */
define("MW_USER_NAME_ADMIN", "admin");
define("MW_COMPONENT_ROLE_AUTH", "MW_Auth");
$registry->add_registry(new MW_SingletonComponentRegistry(), MW_COMPONENT_ROLE_AUTH);
$registry->register(new MW_Auth(), MW_COMPONENT_ROLE_AUTH);
define("MW_COMPONENT_ROLE_USERS_MANAGER", "MW_UsersManager");
$registry->add_registry(new MW_SingletonComponentRegistry(), MW_COMPONENT_ROLE_USERS_MANAGER);
set_default_config('auth_realm', config('wiki_name'));
set_default_config('auth_read_logged_only', false);
set_default_config('auth_write_admin_only', false);
/**
 * returns instance of MW_Auth
 */
function &get_auth()
{
    global $registry;
    return $registry->lookup(MW_COMPONENT_ROLE_AUTH);
}
$users_manager_class_name = null;
function register_users_manager(&$users_manager)
{
    global $registry;
    $registry->register($users_manager, MW_COMPONENT_ROLE_USERS_MANAGER);
}
function &get_users_manager()
Beispiel #7
0
    function get($name)
    {
        $name = strtolower($name);
        if (isset($this->settings[$name])) {
            debug("MW_Settings: {$name} set from inside");
            return $this->settings[$name];
        } elseif (($global = $this->get_global_setting($name)) !== null) {
            debug("MW_Settings: {$name} set from outside");
            return $global;
        } elseif (isset($this->defaults[$name])) {
            debug("MW_Settings: {$name} from defaults");
            return $this->defaults[$name];
        }
        debug("MW_Settings: {$name} not found");
        return null;
    }
}
function config($name)
{
    global $registry;
    $settings =& $registry->lookup(MW_COMPONENT_ROLE_SETTINGS);
    return $settings->get($name);
}
function set_default_config($name, $value)
{
    global $registry;
    $settings =& $registry->lookup(MW_COMPONENT_ROLE_SETTINGS);
    $settings->set_default($name, $value);
}
set_default_config('encoding', 'utf-8');
Beispiel #8
0
# $Id$
# (c)2005,2006 Stepan Roh <*****@*****.**>
# Free to copy, free to modify, NO WARRANTY
/** @file
 * support for user interface
 */
require_once "pages.php";
require_once "rendering.php";
/** footer layout name */
define("MW_LAYOUT_FOOTER", "Footer");
/** header layout name */
define("MW_LAYOUT_HEADER", "Header");
define("MW_PAGE_TAG_LAYOUT", "layout");
define("MW_PAGE_TAG_LAYOUT_DATA", "layout_data");
define("MW_LAYOUT_DEFAULT", "Default");
set_default_config('layout', MW_LAYOUT_DEFAULT);
function new_layout_page($name)
{
    $page = new_page_with_tag(MW_PAGE_TAG_LAYOUT, config('layout') . '/' . $name, MW_REVISION_HEAD);
    if (!$page->exists()) {
        $page = new_page_with_tag(MW_PAGE_TAG_LAYOUT, MW_LAYOUT_DEFAULT . '/' . $name, MW_REVISION_HEAD);
    }
    return $page;
}
function new_layout_data_page($name)
{
    $page = new_page_with_tag(MW_PAGE_TAG_LAYOUT_DATA, config('layout') . '/' . $name, MW_REVISION_HEAD);
    if (!$page->exists()) {
        $page = new_page_with_tag(MW_PAGE_TAG_LAYOUT_DATA, MW_LAYOUT_DEFAULT . '/' . $name, MW_REVISION_HEAD);
    }
    return $page;
Beispiel #9
0
 /**
  * Load remaining engine libraries and complete bootstraping (see start.php)
  *
  * @param string $step Which step to boot strap for. Required because
  *                     boot strapping is different until the DB is populated.
  *
  * @return void
  */
 protected function finishBootstraping($step)
 {
     $dbIndex = array_search('database', $this->getSteps());
     $adminIndex = array_search('admin', $this->getSteps());
     $completeIndex = array_search('complete', $this->getSteps());
     $stepIndex = array_search($step, $this->getSteps());
     // To log in the user, we need to use the Elgg core session handling.
     // Otherwise, use default php session handling
     $useElggSession = $stepIndex == $adminIndex && $this->isAction || $stepIndex == $completeIndex;
     if (!$useElggSession) {
         session_name('Elgg_install');
         session_start();
         elgg_unregister_event_handler('boot', 'system', 'session_init');
     }
     if ($stepIndex > $dbIndex) {
         // once the database has been created, load rest of engine
         global $CONFIG;
         $lib_dir = $CONFIG->path . 'engine/lib/';
         $this->loadSettingsFile();
         $lib_files = array('database.php', 'actions.php', 'admin.php', 'annotations.php', 'cron.php', 'entities.php', 'extender.php', 'filestore.php', 'group.php', 'location.php', 'mb_wrapper.php', 'memcache.php', 'metadata.php', 'metastrings.php', 'navigation.php', 'notification.php', 'objects.php', 'opendd.php', 'pagehandler.php', 'pam.php', 'plugins.php', 'private_settings.php', 'relationships.php', 'river.php', 'sites.php', 'statistics.php', 'tags.php', 'user_settings.php', 'users.php', 'upgrade.php', 'web_services.php', 'widgets.php', 'xml.php', 'deprecated-1.7.php', 'deprecated-1.8.php', 'deprecated-1.9.php');
         foreach ($lib_files as $file) {
             $path = $lib_dir . $file;
             if (!(include_once $path)) {
                 $msg = elgg_echo('InstallationException:MissingLibrary', array($file));
                 throw new InstallationException($msg);
             }
         }
         set_default_config();
         elgg_trigger_event('boot', 'system');
         elgg_trigger_event('init', 'system');
     }
 }
Beispiel #10
0
/**
 * Initialize miniWiki infrastructure.
 * <p>
 * Will load and initialize extensions.
 */
function miniwiki_boot($install_mode = false)
{
    set_default_config('install_mode', $install_mode);
    register_shutdown_function('miniwiki_shutdown');
    load_extensions(realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . "ext"), true);
    initialize_extensions();
}
Beispiel #11
0
/**
 * returns new MW_Variables with prefilled global values
 */
function new_global_wiki_variables()
{
    $req =& get_request("MW_ActionRequest");
    $auth =& get_auth();
    $vars = new MW_Variables(null);
    $vars->set('wiki_name', config('wiki_name'));
    $vars->set('user', $auth->is_logged ? $auth->user : '');
    $vars->set('main_page', MW_PAGE_NAME_MAIN);
    $action = $req->get_action();
    $vars->set('req_action', $action->get_name());
    return $vars;
}
set_default_config('datetime_format', "%Y/%m/%d %H:%M:%S");
/**
 * returns MW_DateTime value formatted for UI
 * @param val MW_DateTime
 */
function format_datetime($val)
{
    return $val->format_strftime(config('datetime_format'));
}
/** wiki variables */
class MW_Variables
{
    # [read-only] attributes
    /** variables array */
    var $variables;
    /** super MW_Variables */