예제 #1
0
echo getParam('site-name');
?>
"/> <br />
				<h2><?php 
echo $i10nMan->translate('Database options');
?>
 </h2>
				<?php 
echo $i10nMan->translate('Database type');
?>
: 
					<select name="database-type">
						<?php 
include_once 'core/compatible.php';
include_once 'core/database.class.php';
$DBMan = new genericDatabase();
$types = $DBMan->getAllSupportedDatabases();
foreach ($types as $key => $type) {
    if ($key == getParam('database-type')) {
        //echo $key;
        echo '<option value="' . $key . '" selected="selected">' . $key . '</option>';
    } else {
        echo '<option value="' . $key . '">' . $key . '</option>';
    }
}
?>
					</select> <br />
				<?php 
echo $i10nMan->translate('Database host');
?>
: <input type="text" name="database-host" value="<?php 
예제 #2
0
    echo '<span class="ok">' . $i10nMan->translate('Yes') . '</span>';
} else {
    echo '<span class="notok">' . $i10nMan->translate('No') . '</span>';
    $canrun = false;
}
if (versionCompare(PHP_VERSION, '4.1.0', '<') and versionCompare(PHP_VERSION, '4.0.0', '>=')) {
    echo ' <span class="warning"> ' . $i10nMan->translate('MorgOS is untested on PHP lower than PHP 4.1.0, if you encouter problems please report this. ') . '</span>';
}
?>
			</p>
			<p><?php 
echo $i10nMan->translate('Databases available');
?>
</p>
			<?php 
$DBMan = new genericDatabase($i10nMan);
$supported = $DBMan->getAllSupportedDatabases();
$db = false;
echo '<ul>';
foreach ($supported as $key => $support) {
    $db = true;
    echo '<li>' . $key . '</li>';
}
echo '</ul>';
if ($db == false) {
    echo '<span class="notok">' . $i10nMan->translate('No database detected, please install a database plugin.') . '</span>';
    $canrun = false;
}
?>
			<h2><?php 
echo $i10nMan->translate('Optional');
예제 #3
0
     saveParam($_POST, 'site-name');
     saveParam($_POST, 'database-type');
     saveParam($_POST, 'database-host');
     saveParam($_POST, 'database-user');
     saveParam($_POST, 'database-name');
     saveParam($_POST, 'admin-account');
     saveParam($_POST, 'admin-email');
     if ($_POST['admin-password'] != $_POST['admin-password2']) {
         trigger_error('ERROR: ' . $i10nMan->translate('Provided passwords doesn\'t match.'));
     } else {
         $canrun = true;
     }
     global $errors;
     $curErrors = $errors;
     include_once 'core/database.class.php';
     $DBMan = new genericDatabase($i10nMan);
     $DB = $DBMan->load($_POST['database-type']);
     $DB->connect($_POST['database-host'], $_POST['database-user'], $_POST['database-password']);
     if ($errors == $curErrors) {
         $canrun = true;
     }
     break;
 case PHASE_INSTALLDB:
     $t = checkParam($_POST, 'admin-email', 'Admin email');
     if ($t == false) {
         break;
     }
     $t = checkParam($_POST, 'admin-password', 'Admin password');
     if ($t == false) {
         break;
     }
$this->vars['VAR_PAGE_TITLE'] = $page['name'];
$this->vars['VAR_NAVIGATION'] = $this->getNavigator();
$this->vars['VAR_SITE_TITLE'] = $this->config->getConfigItem('/general/sitename', TYPE_STRING);
$this->vars['TINYMCE'] = 'skins/default/tinymce/jscripts/tiny_mce/tiny_mce.js';
$this->vars['VAR_TO_REGISTER_USER'] = '******';
$this->vars['SIDEBAR'] = $this->getSidebarHTML();
$this->vars['SUBBAR'] = $this->getSubbarHTML();
$this->vars['MORGOS_COPYRIGHT'] = $this->i10nMan->translate('Powered By MorgOS &copy; 2006');
$this->vars['TO_POSTNEW_NEWSITEMFORM'] = 'index.php?module=formpostnews';
if (substr($this->module, 0, 5) == 'admin') {
    $this->vars['VAR_ADMIN_NAVIGATION'] = $this->getAdminNavigator();
    $this->vars['VAR_ADMIN_LINK_INDEX'] = 'admin.php';
    $this->vars['VAR_ADMIN_LINK_GENERAL'] = 'admin.php?module=general';
    if ($this->module == 'admin/databases') {
        $DBTypeOptions = NULL;
        $DBManager = new genericDatabase();
        foreach ($DBManager->getAllSupportedDatabases() as $key => $supported) {
            if ($this->config->getConfigItem('/database/type', TYPE_STRING) == $key) {
                $DBTypeOptions .= ' ADMIN_DATABASE_TYPE_OPTION_SELECTED (' . $key . ')';
            } else {
                $DBTypeOptions .= ' ADMIN_DATABASE_TYPE_OPTION (' . $key . ')';
            }
        }
        $this->vars['VAR_ADMIN_DATABASE_FORM_DATABASE_TYPE_OPTIONS'] = $DBTypeOptions;
        $this->vars['VAR_ADMIN_DATABASE_FORM_ACTION'] = './admin.php?module=databasesave';
        $this->vars['VAR_ADMIN_DATABASE_FORM_NAME_HOST'] = '/database/host';
        $this->vars['VAR_ADMIN_DATABASE_FORM_NAME_DATABASE_TYPE'] = '/database/type';
        $this->vars['VAR_ADMIN_DATABASE_FORM_NAME_DBNAME'] = '/database/name';
        $this->vars['VAR_ADMIN_DATABASE_FORM_NAME_USER'] = '******';
        $this->vars['VAR_ADMIN_DATABASE_FORM_NAME_PASSWORD'] = '******';
        $this->vars['VAR_ADMIN_DATABASE_FORM_VALUE_HOST'] = $this->config->getConfigItem('/database/host', TYPE_STRING);
예제 #5
0
// create the database
// TODO: add prefix config
define('TBL_PREFIX', 'morgos_');
define('TBL_MODULES', TBL_PREFIX . 'modules');
define('TBL_PAGES', TBL_PREFIX . 'userpages');
include_once 'core/user.class.php';
include_once 'core/language.class.php';
include_once 'core/database.class.php';
include_once 'core/config.class.php';
include_once 'core/pages.class.php';
$SQL = file_get_contents('install/sql/news.sql');
$SQL .= file_get_contents('install/sql/pages.sql');
$SQL .= file_get_contents('install/sql/users.sql');
$SQL = str_replace('%prefix%', 'morgos_', $SQL);
$i10nMan = new languages('languages/');
$DBMan = new genericDatabase($i10nMan);
$config = new config($i10nMan);
$config->addConfigItemsFromFile('site.config.php');
$DB = $DBMan->load($config->getConfigItem('/database/type'));
$DB->connect($config->getConfigItem('/database/host'), $config->getConfigItem('/database/user'), $config->getConfigItem('/database/password'));
$DB->select_db($config->getConfigItem('/database/name'));
$arrayOfSQL = explode(';', $SQL);
foreach ($arrayOfSQL as $query) {
    $query = trim($query);
    if (empty($query)) {
        continue;
    }
    $result = $DB->query($query);
    if ($result === false) {
        trigger_error('ERROR: ' . $i10nMan->translate('Query'));
    }
 function __construct()
 {
     $this->notices = array();
     $this->running = false;
     if (versionCompare(PHP_VERSION, '5.0', '>=')) {
         set_error_handler(array($this, "errorHandler"));
     } else {
         set_error_handler('errorHandler');
     }
     if (!file_exists('site.config.php')) {
         header('Location: install.php');
     }
     if (is_readable('site.config.php')) {
         if (file_exists('.install')) {
             if (is_dir('.install')) {
                 trigger_error('ERROR: ' . $this->i10nMan->translate('Remove dir install.php and than continue'));
             }
         }
         $reqFiles = array();
         $reqFiles[] = 'core/compatible.php';
         $reqFiles[] = 'core/config.class.php';
         $reqFiles[] = 'core/database.class.php';
         $reqFiles[] = 'core/language.class.php';
         $reqFiles[] = 'core/pages.class.php';
         $reqFiles[] = 'core/signals.class.php';
         $reqFiles[] = 'core/uimanager.class.php';
         $reqFiles[] = 'core/uimanager.functions.php';
         $reqFiles[] = 'core/uimanager.vars.php';
         $reqFiles[] = 'core/user.class.php';
         $reqFiles[] = 'admin.php';
         $reqFiles[] = 'index.php';
         $reqFiles[] = 'skins/default/tinymce';
         //testFiles ($reqFiles);
         include_once 'core/config.class.php';
         include_once 'core/language.class.php';
         include_once 'core/signals.class.php';
         $this->i10nMan = new languages('languages/');
         $this->signalMan = new signalManager($this->i10nMan);
         $this->signalMan->addSignal('loadPage');
         $this->signalMan->addSignal('login');
         $this->signalMan->addSignal('logout');
         $this->signalMan->addSignal('registeruser');
         $this->config = new config($this->i10nMan);
         $this->config->addConfigItemsFromFile('site.config.php');
         if (!defined('TBL_PREFIX')) {
             define('TBL_PREFIX', 'morgos_');
             define('TBL_MODULES', TBL_PREFIX . 'modules');
             define('TBL_PAGES', TBL_PREFIX . 'userpages');
         }
         include_once 'core/database.class.php';
         include_once 'core/user.class.php';
         include_once 'core/news.class.php';
         include_once 'core/pages.class.php';
         $DBManager = new genericDatabase($this->i10nMan);
         $this->genDB = $DBManager->load($this->config->getConfigItem('/database/type', TYPE_STRING));
         $this->genDB->connect($this->config->getConfigItem('/database/host', TYPE_STRING), $this->config->getConfigItem('/database/user', TYPE_STRING), $this->config->getConfigItem('/database/password', TYPE_STRING));
         $this->genDB->select_db($this->config->getConfigItem('/database/name', TYPE_STRING));
         $this->pages = new pages($this->genDB, $this->i10nMan);
         $this->news = new news($this->genDB, $this->i10nMan);
         if (!$this->i10nMan->loadLanguage('english')) {
             trigger_error('ERROR: ' . $this->i10nMan->translate('Couldn\'t init internationalization.'));
         }
         $this->user = NULL;
         $this->loadedExtensions = array();
         $this->initAllExtensions();
         $this->prependSidebar = array();
         $this->appendSidebar = array();
         $this->prependSidebar['ALL_MODULES'] = array();
         $this->appendSidebar['ALL_MODULES'] = array();
         $this->prependSubbar = array();
         $this->appendSubbar = array();
         $this->prependSubbar['ALL_MODULES'] = array();
         $this->appendSubbar['ALL_MODULES'] = array();
         foreach ($this->config->getConfigDir('/extensions') as $extension => $load) {
             if ($load == true) {
                 $result = $this->loadExtension(substr($extension, strlen('/extensions/')));
                 if ($result == false) {
                     $this->setRunning(true);
                     trigger_error('WARNING: ' . $this->i10nMan->translate('Couldn\'t load extension.'));
                     $this->setRunning(false);
                 }
             }
         }
     } else {
         header('Location: install.php');
     }
 }