Ejemplo n.º 1
0
     $activatemail = 'true';
 } elseif ($activatemail == NO) {
     $activatemail = 'false';
 } else {
     // Can never happen
     $activatemail = 'true';
 }
 $config .= "\$config['user']['activatemail'] = {$activatemail};";
 $config .= ' ?>';
 $handle = fopen('site.config.php', 'w');
 fwrite($handle, $config);
 fclose($handle);
 // do dbstuff
 try {
     $config = new config();
     loaddbclass($_POST['databasetype']);
     $database = new database($config, 'site.config.php');
     $database->connect();
     $queries = file_get_contents('kernel/sql/users.sql');
     $queries .= file_get_contents('kernel/sql/news.sql');
     $queries .= file_get_contents('kernel/sql/polls.sql');
     $queries .= file_get_contents('kernel/sql/basic.sql');
     $queries .= file_get_contents('kernel/sql/help.sql');
     // TODO
     $languages = languagesinstalled();
     foreach ($languages as $language) {
         echo $language;
         $lang = loadlang($language);
         $tmpquery = file_get_contents('kernel/sql/basicpages.sql');
         $tmpquery = ereg_replace('%language%', $language, $tmpquery);
         $tmpquery = ereg_replace('%shown_logout%', $lang->translate('logout'), $tmpquery);
Ejemplo n.º 2
0
 function __construct()
 {
     error_reporting(E_ALL);
     session_start();
     // check for PHP version
     $req = '5.0.0';
     if (version_compare($req, phpversion(), '>=')) {
         die('PHP Version ' . $req . ' or higher is required');
     }
     // as it crashes between this and load of the config
     // we need to have all debug info
     // FIXME
     if (!file_exists('.install.php')) {
         include_once 'kernel/constants.php';
         include_once 'kernel/config.class.php';
         include_once 'kernel/language.class.php';
         $config = new CConfig();
         $config->addConfigByFileName('site.config.php', TYPE_STRING, 'database/tblprefix', 0);
         define('TBL_PREFIX', $config->getConfigByNameType('database/tblprefix', TYPE_STRING));
         include_once 'kernel/help.class.php';
         include_once 'kernel/users.class.php';
         include_once 'kernel/news.class.php';
         include_once 'kernel/polls.class.php';
         include_once 'kernel/exception.class.php';
         include_once 'kernel/database.class.php';
         define('TBL_PAGES', TBL_PREFIX . 'pages');
         $config->addConfigByFileName('site.config.php', TYPE_INT, 'general/errorreporting', 0);
         $config->addConfigByFileName('site.config.php', TYPE_STRING, 'general/webmastermail', 0);
         error_reporting($config->getConfigByNameType('general/errorreporting', TYPE_INT));
         $config->addConfigByFileName('site.config.php', TYPE_STRING, 'general/databasetype', 0);
         $dbType = $config->getConfigByNameType('general/databasetype', TYPE_STRING);
         $dbclass = new CDatabase();
         $database = $dbclass->load($dbType, $config, 'site.config.php');
         $config->addConfigByFileName('site.config.php', TYPE_STRING, 'database/host', 'localhost');
         $config->addConfigByFileName('site.config.php', TYPE_STRING, 'database/user', 0);
         $config->addConfigByFileName('site.config.php', TYPE_STRING, 'database/password', 0);
         $config->addConfigByFileName('site.config.php', TYPE_STRING, 'database/name', 0);
         $host = $config->getConfigByNameType('database/host', TYPE_STRING);
         $user = $config->getConfigByNameType('database/user', TYPE_STRING);
         $password = $config->getConfigByNameType('database/password', TYPE_STRING);
         $dbname = $config->getConfigByNameType('database/name', TYPE_STRING);
         $database->connect($host, $user, $password, $dbname);
         // TODO
         $tables = array();
         if (checkDatabase($database, $tables)) {
             // Database seems to be OK
             $config->addConfigByFileName('site.config.php', TYPE_BOOL, 'user/activatemail', 0);
             $lang = new CLang();
             $user = new CUser($database, $config->getConfigByNameType('user/activatemail', TYPE_BOOL), $lang);
             $config->addConfigByList('GET;YAPCAS_USER;COOKIE;FILE', array('contentlanguage', $user, 'contentlanguage', 'site.config.php'), 'general/contentlanguage', TYPE_STRING, DEFAULT_CONTENT_LANG);
             $contentLang = $config->getConfigByNameType('general/contentlanguage', TYPE_STRING);
             $news = new CNews($database, $lang, $contentLang);
             $poll = new CPoll($database, $config, $lang);
             $this->help = new CHelp($database, $config, $lang);
             $config->addConfigByFileName('site.config.php', TYPE_STRING, 'general/httplink');
             $config->addConfigByFileName('site.config.php', TYPE_STRING, 'general/sitename');
             $config->addConfigByFileName('site.config.php', TYPE_STRING, 'general/description');
             $config->addConfigByList('GET;YAPCAS_USER;COOKIE;FILE', array('timezone', $user, 'timezone', 'site.config.php'), 'general/timezone', TYPE_FLOAT, 0);
             $config->addConfigByList('GET;YAPCAS_USER;COOKIE;FILE', array('timeformat', $user, 'timeformat', 'site.config.php'), 'general/timeformat', TYPE_STRING, '');
             $config->addConfigByList('GET;YAPCAS_USER;COOKIE;FILE', array('uilanguage', $user, 'uilanguage', 'site.config.php'), 'general/uilanguage', TYPE_STRING, STANDARD_LANGUAGE);
             $lang->update($config->getConfigByNameType('general/uilanguage', TYPE_STRING));
             $config->addConfigByList('GET;YAPCAS_USER;COOKIE;FILE', array('theme', $user, 'theme', 'site.config.php'), 'general/theme', TYPE_STRING, 'moderngray');
             $config->addConfigByList('GET;YAPCAS_USER;COOKIE;FILE', array('threaded', $user, 'threaded', 'site.config.php'), 'news/threaded', TYPE_BOOL, YES);
             $config->addConfigByList('GET;YAPCAS_USER;COOKIE;FILE', array('headlines', $user, 'headlines', 'site.config.php'), 'news/headlines', TYPE_INT, 5);
             $config->addConfigByList('GET;YAPCAS_USER;COOKIE;FILE', array('postsonpage', $user, 'postsonpage', 'site.config.php'), 'news/postsonpage', TYPE_INT, 10);
             $config->addConfigByList('YAPCAS_USER', array($user), 'user/email', TYPE_STRING);
             $config->addConfigByList('YAPCAS_USER', array($user), 'user/name', TYPE_STRING, 'anonymous');
             $this->loadtheme($config->getConfigByNameType('general/theme', TYPE_STRING));
             $this->config = $config;
             $this->news = $news;
             $this->config = $config;
             $this->poll = $poll;
             $this->lang = $lang;
             $this->user = $user;
             $this->database = $database;
             $this->BBCTags = array('b', 'u', 'i', 'quote');
             global $theme, $config, $news, $poll, $user, $lang, $database;
             $config = $this->config;
             $news = $this->news;
             $config = $this->config;
             $poll = $this->poll;
             $lang = $this->lang;
             $user = $this->user;
             $database = $this->database;
             $theme = $this;
         }
     } else {
         if (file_exists('site.config.php')) {
             include_once 'kernel/config.class.php';
             $config = new config();
             $config->addConfigByFileName('site.config.php', TYPE_STRING, 'database/tblprefix', 0);
             define('TBL_PREFIX', $config->getConfigByNameType('database/tblprefix', TYPE_STRING));
             define('TBL_PAGES', TBL_PREFIX . 'pages');
             $config->addConfigByFileName('site.config.php', TYPE_INT, 'general/errorreporting', 0);
             //error_reporting ($config->getConfigByNameType('general/errorreporting',TYPE_INT));
             $config->addConfigByFileName('site.config.php', TYPE_STRING, 'general/databasetype', 0);
             loaddbclass($config->getConfigByNameType('general/databasetype', TYPE_STRING));
             $database = new database($config, 'site.config.php');
             $database->connect();
             // FIXME
             $tables = array();
             if (checkDatabase($database, $tables)) {
                 // site is configured but the installscript exists???
                 echo 'DELETE install.php and than reload this page';
                 exit;
             } else {
                 header('Location: install.php');
             }
         } else {
             header('Location: install.php');
         }
     }
 }
Ejemplo n.º 3
0
 function __construct()
 {
     error_reporting(E_ALL);
     // as it crashes between this and load of the config
     // we need to have all debug info
     // FIXME
     if (!file_exists('.install.php')) {
         include 'kernel/config.class.php';
         $config = new config();
         $lang = new lang();
         $config->addConfigByFileName('site.config.php', TYPE_STRING, 'database/tblprefix', 0);
         define('TBL_PREFIX', $config->getConfigByNameType('database/tblprefix', TYPE_STRING));
         define('TBL_PAGES', TBL_PREFIX . 'pages');
         include 'kernel/help.class.php';
         include 'kernel/error.class.php';
         // This should not be in the release
         include 'kernel/users.class.php';
         include 'kernel/news.class.php';
         include 'kernel/polls.class.php';
         $config->addConfigByFileName('site.config.php', TYPE_INT, 'general/errorreporting', 0);
         $config->addConfigByFileName('site.config.php', TYPE_STRING, 'general/webmastermail', 0);
         error_reporting($config->getConfigByNameType('general/errorreporting', TYPE_INT));
         $config->addConfigByFileName('site.config.php', TYPE_STRING, 'general/databasetype', 0);
         loaddbclass($config->getConfigByNameType('general/databasetype', TYPE_STRING));
         $database = new database($config, 'site.config.php');
         $database->connect();
         // TODO
         $tables = array();
         if (checkDatabase($database, $tables)) {
             // Database seems to be OK
             $config->addConfigByFileName('site.config.php', TYPE_BOOL, 'user/activatemail', 0);
             $user = new user($database, $config->getConfigByNameType('user/activatemail', TYPE_BOOL), $lang);
             $news = new news($database, $user, $config, $lang);
             $poll = new polls($database, $config, $lang);
             $this->help = new help($database, $config, $lang);
             $config->addConfigByFileName('site.config.php', TYPE_FLOAT, 'general/servertimezone');
             $config->addConfigByFileName('site.config.php', TYPE_STRING, 'general/httplink');
             $config->addConfigByFileName('site.config.php', TYPE_STRING, 'general/sitename');
             $config->addConfigByFileName('site.config.php', TYPE_STRING, 'general/description');
             $config->addConfigByList('GET;YAPCAS_USER;COOKIE;FILE', array('timezone', $user, 'timezone', 'site.config.php'), 'general/timezone', TYPE_FLOAT, 1);
             $config->addConfigByList('GET;YAPCAS_USER;COOKIE;FILE', array('timeformat', $user, 'timeformat', 'site.config.php'), 'general/timeformat', TYPE_STRING, '');
             $config->addConfigByList('GET;YAPCAS_USER;COOKIE;FILE', array('language', $user, 'language', 'site.config.php'), 'general/language', TYPE_STRING, STANDARD_LANGUAGE);
             $lang->updatelang($config->getConfigByNameType('general/language', TYPE_STRING));
             $config->addConfigByList('GET;YAPCAS_USER;COOKIE;FILE', array('theme', $user, 'theme', 'site.config.php'), 'general/theme', TYPE_STRING, 'moderngray');
             $config->addConfigByList('GET;YAPCAS_USER;COOKIE;FILE', array('threaded', $user, 'threaded', 'site.config.php'), 'news/threaded', TYPE_BOOL, YES);
             $config->addConfigByList('GET;YAPCAS_USER;COOKIE;FILE', array('langcode', $user, 'langcode', 'site.config.php'), 'general/langcode', TYPE_STRING);
             $config->addConfigByList('YAPCAS_USER', array($user), 'user/email', TYPE_STRING);
             $config->addConfigByList('YAPCAS_USER', array($user), 'user/name', TYPE_STRING, 'anonymous');
             $this->loadtheme($config->getConfigByNameType('general/theme', TYPE_STRING));
             $this->config = $config;
             $this->news = $news;
             $this->config = $config;
             $this->poll = $poll;
             $this->lang = $lang;
             $this->user = $user;
             $this->database = $database;
             global $theme, $config, $news, $poll, $user, $lang, $database;
             $config = $this->config;
             $news = $this->news;
             $config = $this->config;
             $poll = $this->poll;
             $lang = $this->lang;
             $user = $this->user;
             $database = $this->database;
             $theme = $this;
         }
     } else {
         if (file_exists('site.config.php')) {
             include 'kernel/config.class.php';
             $config = new config();
             $config->addConfigByFileName('site.config.php', TYPE_STRING, 'database/tblprefix', 0);
             define('TBL_PREFIX', $config->getConfigByNameType('database/tblprefix', TYPE_STRING));
             define('TBL_PAGES', TBL_PREFIX . 'pages');
             $config->addConfigByFileName('site.config.php', TYPE_INT, 'general/errorreporting', 0);
             //error_reporting ($config->getConfigByNameType('general/errorreporting',TYPE_INT));
             $config->addConfigByFileName('site.config.php', TYPE_STRING, 'general/databasetype', 0);
             loaddbclass($config->getConfigByNameType('general/databasetype', TYPE_STRING));
             $database = new database($config, 'site.config.php');
             $database->connect();
             // FIXME
             $tables = array();
             if (checkDatabase($database, $tables)) {
                 // site is configured but the installscript exists???
                 echo 'DELETE install.php and than reload this page';
                 exit;
             } else {
                 header('Location: install.php');
             }
         } else {
             header('Location: install.php');
         }
     }
 }