function installClasses()
{
    litepublisher::$urlmap = turlmap::i();
    litepublisher::$urlmap->lock();
    $posts = tposts::i();
    $posts->lock();
    $xmlrpc = TXMLRPC::i();
    $xmlrpc->lock();
    ttheme::$defaultargs = array();
    $theme = ttheme::getinstance('default');
    //  $html = tadminhtml::i();
    //      $html->loadinstall();
    foreach (litepublisher::$classes->items as $class => $item) {
        //echo "$class<br>\n";
        if (preg_match('/^(titem|titem_storage|titemspostsowner|tcomment|IXR_Client|IXR_Server|tautoform|tchildpost|tchildposts|tlitememcache)$/', $class)) {
            continue;
        }
        $obj = getinstance($class);
        if (method_exists($obj, 'install')) {
            $obj->install();
        }
    }
    $xmlrpc->unlock();
    $posts->unlock();
    litepublisher::$urlmap->unlock();
}
Beispiel #2
0
 public static function init()
 {
     if (defined('litepublisher_mode') && litepublisher_mode == 'debug') {
         litepublisher::$debug = true;
     }
     if (!preg_match('/(www\\.)?([\\w\\.\\-]+)(:\\d*)?/', strtolower(trim($_SERVER['HTTP_HOST'])), $domain)) {
         die('cant resolve domain name');
     }
     self::$domain = $domain[2];
     $home = dirname(__FILE__) . DIRECTORY_SEPARATOR;
     $storage = $home . 'storage' . DIRECTORY_SEPARATOR;
     $paths = new tpaths();
     self::$paths = $paths;
     $paths->home = $home;
     $paths->lib = $home . 'lib' . DIRECTORY_SEPARATOR;
     $paths->data = $storage . 'data' . DIRECTORY_SEPARATOR;
     $paths->cache = $storage . 'cache' . DIRECTORY_SEPARATOR;
     $paths->libinclude = $home . 'lib' . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR;
     $paths->languages = $home . 'lib' . DIRECTORY_SEPARATOR . 'languages' . DIRECTORY_SEPARATOR;
     $paths->storage = $storage;
     $paths->backup = $storage . 'backup' . DIRECTORY_SEPARATOR;
     $paths->plugins = $home . 'plugins' . DIRECTORY_SEPARATOR;
     $paths->themes = $home . 'themes' . DIRECTORY_SEPARATOR;
     $paths->files = $home . 'files' . DIRECTORY_SEPARATOR;
     $paths->js = $home . 'js' . DIRECTORY_SEPARATOR;
     self::$microtime = microtime(true);
 }
 public static function i()
 {
     if (!isset(litepublisher::$classes)) {
         $class = __CLASS__;
         litepublisher::$classes = new $class();
         litepublisher::$classes->instances[$class] = litepublisher::$classes;
     }
     return litepublisher::$classes;
 }
Beispiel #4
0
 public static function init()
 {
     if (!preg_match('/(www\\.)?([\\w\\.\\-]+)(:\\d*)?/', strtolower(trim($_SERVER['HTTP_HOST'])), $domain)) {
         die('cant resolve domain name');
     }
     self::$domain = $domain[2];
     $home = dirname(__FILE__) . DIRECTORY_SEPARATOR;
     self::$_paths = array('home' => $home, 'lib' => $home . 'lib' . DIRECTORY_SEPARATOR, 'libinclude' => $home . 'lib' . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR, 'languages' => $home . 'lib' . DIRECTORY_SEPARATOR . 'languages' . DIRECTORY_SEPARATOR, 'data' => $home . 'data' . DIRECTORY_SEPARATOR . self::$domain . DIRECTORY_SEPARATOR, 'cache' => $home . 'cache' . DIRECTORY_SEPARATOR . self::$domain . DIRECTORY_SEPARATOR, 'plugins' => $home . 'plugins' . DIRECTORY_SEPARATOR, 'themes' => $home . 'themes' . DIRECTORY_SEPARATOR, 'files' => $home . 'files' . DIRECTORY_SEPARATOR, 'backup' => $home . 'backup' . DIRECTORY_SEPARATOR, 'js' => $home . 'js' . DIRECTORY_SEPARATOR);
     self::$paths = new tpaths();
     self::$microtime = microtime();
 }
Beispiel #5
0
<?php

Header('Cache-Control: no-cache, must-revalidate');
Header('Pragma: no-cache');
error_reporting(E_ALL | E_NOTICE | E_STRICT | E_WARNING);
ini_set('display_errors', 1);
define('litepublisher_mode', 'xmlrpc');
include 'index.php';
litepublisher::$debug = true;
set_time_limit(300);
$p = tmediaparser::i();
if ($p->maxwidth == 0 || $p->maxheight == 0) {
    die('0 max sizes');
}
$files = tfiles::i();
if ($items = $files->db->getitems("media = 'image' and parent = 0 and (width > {$p->maxwidth} or height > {$p->maxheight})")) {
    echo count($items), ' count<br>';
    foreach ($items as $item) {
        $srcfilename = litepublisher::$paths->files . $item['filename'];
        if ($source = tmediaparser::readimage($srcfilename)) {
            $sourcex = imagesx($source);
            $sourcey = imagesy($source);
            $x = $p->maxwidth;
            $y = $p->maxheight;
            $ratio = $sourcex / $sourcey;
            if ($x / $y > $ratio) {
                $x = $y * $ratio;
            } else {
                $y = $x / $ratio;
            }
            $dest = imagecreatetruecolor($x, $y);
Beispiel #6
0
<?php

/**
* Lite Publisher
* Copyright (C) 2010 - 2015 Vladimir Yushko http://litepublisher.ru/ http://litepublisher.com/
* Dual licensed under the MIT (mit.txt)
* and GPL (gpl.txt) licenses.
**/
litepublisher::$classes = tclasses::i();
litepublisher::$options = toptions::i();
litepublisher::$site = tsite::i();
if (!defined('litepublisher_mode')) {
    define('litepublisher_mode', 'install');
}
/*
if (litepublisher::$debug) {
  require_once(litepublisher::$paths->lib . 'filer.class.php');
  if (is_dir(litepublisher::$paths->data)) tfiler::delete(litepublisher::$paths->data, true, true);
}
*/
require_once litepublisher::$paths->lib . 'installer.class.php';
$installer = new tinstaller();
$installer->install();
if (litepublisher::$options instanceof toptions) {
    litepublisher::$options->savemodified();
    if (!empty(litepublisher::$options->errorlog)) {
        echo litepublisher::$options->errorlog;
    }
}
exit;
Beispiel #7
0
//class
class tmobiletemplate extends ttemplate
{
    public static function i()
    {
        return getinstance(__CLASS__);
    }
    protected function get_view($context)
    {
        $views = tviews::i();
        $idview = isset($views->defaults['mobile']) ? $views->defaults['mobile'] : 1;
        return tview::i($idview);
    }
}
//class
litepublisher::$site = tmobilesite::i();
litepublisher::$paths->cache = litepublisher::$paths->cache . 'mobile.';
if (tfilestorage::$memcache) {
    litepublisher::$urlmap->cache->prefix .= 'mobile:';
}
litepublisher::$classes->instances['ttemplate'] = tmobiletemplate::i();
$url = $_SERVER['REQUEST_URI'];
if ($url == '/mobile') {
    $url = '/';
} elseif (strbegin($url, '/mobile/')) {
    $url = substr($url, strlen('/mobile'));
}
try {
    litepublisher::$urlmap->request(strtolower($_SERVER['HTTP_HOST']), $url);
} catch (Exception $e) {
    litepublisher::$options->handexception($e);
 private function loadlang()
 {
     litepublisher::$options = $this;
     require_once litepublisher::$paths->lib . 'filer.class.php';
     require_once litepublisher::$paths->lib . 'local.class.php';
     require_once litepublisher::$paths->lib . 'htmlresource.class.php';
     $ini = litepublisher::$paths->languages . litepublisher::$options->language . '.ini';
     tlocal::loadini($ini);
     //tlocal::loadlang('admin');
     $ini = litepublisher::$paths->languages . 'admin' . litepublisher::$options->language . '.ini';
     tlocal::loadini($ini);
     date_default_timezone_set(tlocal::$data['installation']['timezone']);
 }
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;
}