require_once litepublisher::$paths->lib . 'options.class.php'; require_once litepublisher::$paths->lib . 'site.class.php'; } else { require_once litepublisher::$paths->lib . 'kernel.php'; } define('dbversion', true); /* if (class_exists('Memcache')) { tfilestorage::$memcache = new Memcache; tfilestorage::$memcache->connect('127.0.0.1', 11211); } */ if (!tstorage::loaddata()) { if (file_exists(litepublisher::$paths->data . 'storage.php') && filesize(litepublisher::$paths->data . 'storage.php')) { die('Storage not loaded'); } require_once litepublisher::$paths->lib . 'install' . DIRECTORY_SEPARATOR . 'install.php'; } litepublisher::$classes = tclasses::i(); litepublisher::$options = toptions::i(); litepublisher::$db = tdatabase::i(); litepublisher::$site = tsite::i(); litepublisher::$urlmap = turlmap::i(); if (!defined('litepublisher_mode')) { litepublisher::$urlmap->request(strtolower($_SERVER['HTTP_HOST']), $_SERVER['REQUEST_URI']); } } catch (Exception $e) { litepublisher::$options->handexception($e); } litepublisher::$options->savemodified(); litepublisher::$options->showerrors();
if (litepublisher::$debug) { require_once litepublisher::$paths->lib . 'data.class.php'; require_once litepublisher::$paths->lib . 'events.class.php'; require_once litepublisher::$paths->lib . 'items.class.php'; require_once litepublisher::$paths->lib . 'classes.php'; require_once litepublisher::$paths->lib . 'options.class.php'; } else { require_once litepublisher::$paths->lib . 'kernel.php'; } litepublisher::$classes = tclasses::instance(); litepublisher::$options = toptions::instance(); if (!litepublisher::$options->installed) { require_once litepublisher::$paths->lib . 'install' . DIRECTORY_SEPARATOR . 'install.php'; } if (dbversion) { litepublisher::$db = new tdatabase(); } litepublisher::$options->admincookie = litepublisher::$options->cookieenabled && litepublisher::$options->authcookie(); litepublisher::$urlmap = turlmap::instance(); if (!defined('litepublisher_mode')) { litepublisher::$urlmap->request(strtolower($_SERVER['HTTP_HOST']), $_SERVER['REQUEST_URI']); } litepublisher::$options->cache = false; litepublisher::$options->savemodified(); litepublisher::$options->showerrors(); if (dbversion && !preg_match('/(^\\/rpc\\.xml|\\/rss|\\/comments\\.)|(\\.xml$)/', $_SERVER['REQUEST_URI'])) { echo "<pre>\n"; $man = tdbmanager::instance(); //$man->deletealltables(); //echo $man->performance(); //file_put_contents(litepublisher::$pathshome. "litepublisher::$domain .sql", $man->export());
function installoptions($email, $language) { $options = toptions::i(); $options->lock(); $options->solt = md5uniq(); $usehost = isset($_REQUEST['usehost']) ? $_REQUEST['usehost'] == '1' : false; $options->data['dbconfig'] = array('driver' => 'mysqli', 'host' => $usehost ? $_REQUEST['dbhost'] : 'localhost', 'port' => $usehost ? (int) $_REQUEST['dbport'] : 0, 'dbname' => $_REQUEST['dbname'], 'login' => $_REQUEST['dblogin'], 'password' => '', 'prefix' => $_REQUEST['dbprefix']); $options->setdbpassword($_REQUEST['dbpassword']); try { litepublisher::$db = new tdatabase(); } catch (Exception $e) { die($e->GetMessage()); } if (litepublisher::$debug) { $db = litepublisher::$db; $list = $db->res2array($db->query("show tables from " . $options->dbconfig['dbname'])); foreach ($list as $row) { $table = $row[0]; if (strbegin($table, $db->prefix)) { $db->exec('DROP TABLE IF EXISTS ' . $table); } } } $options->language = $language; $options->email = $email; $options->dateformat = ''; $options->password = ''; $password = md5uniq(); $options->changepassword($password); $options->authenabled = true; $options->cookiehash = ''; $options->cookieexpired = 0; $options->securecookie = false; $options->mailer = ''; $options->data['cache'] = true; $options->expiredcache = 3600; $options->admincache = false; $options->ob_cache = true; $options->compress = false; $options->filetime_offset = tfiler::get_filetime_offset(); $options->data['perpage'] = 10; $options->commentsdisabled = false; $options->comstatus = 'guest'; $options->pingenabled = true; $options->commentpages = true; $options->commentsperpage = 100; $options->comments_invert_order = false; $options->commentspull = false; $versions = strtoarray(file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'versions.txt')); $options->version = $versions[0]; $options->echoexception = true; $options->parsepost = true; $options->hidefilesonpage = false; $options->show_draft_post = false; $options->usersenabled = false; $options->reguser = false; $options->icondisabled = false; $options->crontime = time(); $options->show_file_perm = false; $options->xxxcheck = empty($_SERVER['HTTP_REFERER']) && isset($_POST) && count($_POST) > 0 ? false : true; $options->fromemail = 'litepublisher@' . $_SERVER['HTTP_HOST']; $options->unlock(); return $password; }