コード例 #1
0
ファイル: index.php プロジェクト: NewRoute/glfusion
function _checkUpgrades()
{
    global $_CONF, $_TABLES, $LANG_UPGRADE;
    $retval = '';
    $lastrun = DB_getItem($_TABLES['vars'], 'value', "name = 'updatecheck'");
    if ($lastrun + $_CONF['update_check_interval'] <= time()) {
        // run version check
        list($upToDate, $pluginsUpToDate, $pluginData) = _checkVersion();
        if ($upToDate == 0 || $pluginsUpToDate == 0) {
            $retval = '<p style="width:100%;text-align:center;"><span class="alert pluginAlert" style="text-align:center;font-size:1.5em;">' . $LANG_UPGRADE['updates_available'] . '</span></p>';
        }
        DB_query("REPLACE INTO {$_TABLES['vars']} (name, value) VALUES ('updatecheck',UNIX_TIMESTAMP())");
    }
    return $retval;
}
コード例 #2
0
/**
 * [ADMIN] Backup API - zkontrolovat soubor se zalohou (castecnou nebo databazi)
 * @param string $path cesta k souboru
 * @param array|null $allowed_types povolene typy zaloh (_backup_x) nebo null (= vsechny)
 * @param bool $get_vars vratit atributy archivu namisto true pri uspechu 1/0
 * @return string|array|bool chybova hlaska pri chybe, jinak true nebo array (dle stavu get_vars)
 */
function _backupCheckFile($path, $allowed_types = null, $get_vars = false)
{
    global $_lang;
    // kontrola archivu
    $kzip = new KZip($path);
    if (!empty($kzip->error)) {
        return str_replace('*errstr*', _htmlStr($kzip->error), $_lang['admin.other.backup.restore.upload.err.load']);
    }
    // kontrola formatu a verze
    $req_keys = array('idt', 'version', 'system_version', 'system_state', 'system_revision', 'type', 'void', 'time', 'url', 'size', 'note', 'merge');
    $poss_types = array(_backup_db => 0, _backup_partial => 1, _backup_full => 2);
    do {
        // kontrola pole s hodnotami
        if (!is_array($kzip->vars)) {
            break;
        }
        for ($i = 0; isset($req_keys[$i]); ++$i) {
            if (!array_key_exists($req_keys[$i], $kzip->vars)) {
                break 2;
            }
        }
        // kontrola identifikatoru a typu
        if ($kzip->vars['idt'] !== _backup_idt) {
            break;
        }
        if (!isset($poss_types[$kzip->vars['type']])) {
            break;
        }
        // kontrola typu
        if (isset($allowed_types) && !in_array($kzip->vars['type'], $allowed_types)) {
            return $_lang['admin.other.backup.restore.upload.err.type'];
        }
        // kontrola verze
        if ($kzip->vars['type'] === _backup_db && !_checkVersion('database', $kzip->vars['version'])) {
            break;
        }
        if ($kzip->vars['type'] !== _backup_db && $kzip->vars['version'] != _systemversion) {
            break;
        }
        // vse ok
        $kzip->free();
        if ($get_vars) {
            return $kzip->vars;
        }
        return true;
    } while (false);
    // neplatny format ci verze
    $kzip->free();
    return $_lang['admin.other.backup.restore.upload.err.format'];
}
コード例 #3
0
ファイル: load.php プロジェクト: sunlight-cms/sunlight-cms-7
 /**
  * Inicializovat system
  *
  * @param string      $root            relativni cesta do korenoveho adresare
  * @param string|null $configFile      cesta ke konfiguracnimu skriptu nebo null(= vychozi)
  * @param bool        $envChanges      provest zmeny v prostredi (error reporting, locale, header, ...) 1/0
  * @param bool        $lightMode       odlehceny mod (pouze pripojeni k db, bez session, nastaveni, lokalizace, atd) 1/0
  * @param bool        $databaseEnabled inicializovat pripojeni k databazi 1/0
  * @param bool        $runCron         automaticky spustit cron, je-li aktivovan 1/0
  */
 public static function init($root, $configFile = null, $envChanges = true, $lightMode = false, $databaseEnabled = true, $runCron = true)
 {
     if (self::$initialized) {
         throw new BadMethodCallException();
     }
     $initialized = true;
     self::$start = microtime(true);
     /* ----  konfigurace  ---- */
     if (null === $configFile) {
         self::$configFile = $root . 'config.php';
     } else {
         self::$configFile = $configFile;
     }
     self::$envChanges = $envChanges;
     self::$lightMode = $lightMode;
     self::$databaseEnabled = $databaseEnabled;
     self::$imageError = $root . 'remote/image_error.png';
     // soubor s nastavenim
     require self::$configFile;
     // doplneni konfigurace (kvuli kompatibilite)
     if (!isset($locale)) {
         $locale = array('czech', 'utf8', 'cz_CZ');
     }
     if (!isset($timezone)) {
         $timezone = 'Europe/Prague';
     }
     if (!isset($geo)) {
         $geo = array(50.5, 14.26, 90.583333);
     }
     if (!isset($port)) {
         // pokud neni uveden $port, muze byt definovan jako soucast $server (server:port)
         if (false !== ($serverColonPos = strpos($server, ':'))) {
             $port = (int) substr($server, $serverColonPos + 1);
             $server = substr($server, 0, $serverColonPos);
         } else {
             $port = ini_get('mysqli.default_port');
         }
     }
     // systemove konstanty
     define('_indexroot', $root);
     define('_core', '1');
     define('_nl', "\n");
     define('_sessionprefix', md5($server . $database . $user . $prefix) . '-');
     if (!defined('_administration')) {
         define('_administration', 0);
     }
     define('_dev', isset($dev) ? $dev : true);
     // vyvojovy mod 1/0
     define('_systemstate', 0);
     // 0 = beta, 1 = rc, 2 = stable
     define('_systemstate_revision', 0);
     // revize systemu
     define('_systemversion', '7.5.5');
     // verze systemu
     define('_mysql_prefix', $prefix);
     define('_mysql_db', $database);
     define('_upload_dir', _indexroot . 'upload/');
     define('_plugin_dir', _indexroot . 'plugins/common/');
     define('_tmp_dir', _indexroot . 'data/tmp/');
     define('_void_file', _indexroot . 'data/void.nodelete');
     define('_geo_latitude', $geo[0]);
     define('_geo_longitude', $geo[1]);
     define('_geo_zenith', $geo[2]);
     /* ----  autoloader  ---- */
     require _indexroot . 'require/class/class_loader.php';
     self::$classLoader = new ClassLoader();
     self::$classLoader->setDebug(_dev)->registerClassMap(array('AdminBread' => _indexroot . 'require/class/admin_bread.php', 'Color' => _indexroot . 'require/class/color.php', 'DBDump' => _indexroot . 'require/class/dbdump.php', 'KZip' => _indexroot . 'require/class/kzip.php', 'KZipStream' => _indexroot . 'require/class/kzip.php', 'TreeManager' => _indexroot . 'require/class/tree_manager.php', 'TreeReader' => _indexroot . 'require/class/tree_reader.php', 'LangPack' => _indexroot . 'require/class/lang_pack.php', 'FileCache' => _indexroot . 'require/class/file_cache.php'))->register();
     /* ----  upravy PHP prostredi  ---- */
     if ($envChanges) {
         // kontrola verze PHP a pritomnosti rozsireni
         if (version_compare(PHP_VERSION, '5.1.0', '<')) {
             _systemFailure('Je vyžadováno PHP 5.1.0 nebo novější.');
         }
         if (!extension_loaded('mbstring')) {
             _systemFailure('Chybí PHP rozšíření <code>mbstring</code> (Multibyte String Functions).');
         }
         if (!extension_loaded('mysqli')) {
             _systemFailure('Chybí PHP rozšíření <code>mysqli</code>, které je potřebné pro práci s databází.');
         }
         // kontrola a nastaveni $_SERVER['REQUEST_URI']
         if (!isset($_SERVER['REQUEST_URI'])) {
             if (isset($_SERVER['HTTP_X_REWRITE_URL'])) {
                 $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL'];
             } elseif (isset($_SERVER['HTTP_REQUEST_URI'])) {
                 $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_REQUEST_URI'];
             } else {
                 if (isset($_SERVER['SCRIPT_NAME'])) {
                     $_SERVER['HTTP_REQUEST_URI'] = $_SERVER['SCRIPT_NAME'];
                 } else {
                     $_SERVER['HTTP_REQUEST_URI'] = $_SERVER['PHP_SELF'];
                 }
                 if (!empty($_SERVER['QUERY_STRING'])) {
                     $_SERVER['HTTP_REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
                 }
                 $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_REQUEST_URI'];
             }
         }
         // vyruseni register_globals
         if (ini_get('register_globals') != '') {
             foreach (array_keys($_REQUEST) as $key) {
                 unset($GLOBALS[$key]);
             }
         }
         // vypnuti magic_quotes
         if (get_magic_quotes_gpc()) {
             $search = array(&$_GET, &$_POST, &$_COOKIE);
             for ($i = 0; isset($search[$i]); ++$i) {
                 foreach ($search[$i] as &$value) {
                     if (is_array($value)) {
                         $search[] =& $value;
                     } else {
                         $value = stripslashes($value);
                     }
                 }
                 unset($search[$i]);
             }
             if (function_exists('set_magic_quotes_runtime')) {
                 @set_magic_quotes_runtime(0);
             }
             unset($search, $i, $value);
         }
         // hlaseni chyb
         $err_rep = E_ALL;
         if (_dev) {
             $disable = array();
         } else {
             $disable = array('E_NOTICE ', 'E_USER_NOTICE', 'E_DEPRECATED', 'E_STRICT');
         }
         for ($i = 0; isset($disable[$i]); ++$i) {
             if (defined($disable[$i])) {
                 $err_rep &= ~constant($disable[$i]);
             }
         }
         error_reporting($err_rep);
         // casove pasmo
         @setlocale(LC_TIME, $locale);
         if (function_exists('date_default_timezone_set')) {
             date_default_timezone_set($timezone);
         }
         // interni kodovani
         mb_internal_encoding('UTF-8');
         // vychozi hlavicky
         if (!defined('_header')) {
             header('Content-Type: text/html; charset=UTF-8');
             header('Expires: ' . gmdate('D, d M Y H:i:s', time() - 604800) . ' GMT');
         } elseif (_header) {
             header(_header);
         }
     }
     /* ----  nacteni funkci  ---- */
     require _indexroot . 'require/functions.php';
     if (isset($_GET['___identify'])) {
         echo 'SunLight CMS ', _systemversion, ' ', self::$states[_systemstate], _systemstate_revision;
         exit;
     }
     /* ----  pripojeni k mysql  ---- */
     if ($databaseEnabled) {
         $con = @mysqli_connect($server, $user, $password, $database, $port);
         if (!is_object($con)) {
             _systemFailure('Připojení k databázi se nezdařilo. Důvodem je pravděpodobně výpadek serveru nebo chybné přístupové údaje.</p><hr /><pre>' . _htmlStr(mysqli_connect_error()) . '</pre><hr /><p>Zkontrolujte přístupové údaje v souboru <em>config.php</em>.');
         }
         $con->set_charset('utf8');
         DB::$con = $con;
         DB::query('SET sql_mode=\'\'');
     }
     /* ----  konstanty nastaveni, jazykovy soubor, motiv, session  ---- */
     if (!$lightMode) {
         // definovani konstant nastaveni
         $query = DB::query('SELECT * FROM `' . _mysql_prefix . '-settings`', true);
         $directive = array('banned' => '');
         if (DB::error() != false) {
             _systemFailure('Připojení k databázi proběhlo úspěšně, ale dotaz na databázi selhal.</p><hr /><pre>' . _htmlStr(DB::error()) . '</pre><hr /><p>Zkontrolujte, zda je databáze správně nainstalovaná.');
         }
         while ($item = DB::row($query)) {
             if (isset($directive[$item['var']])) {
                 // direktiva
                 $directive[$item['var']] = $item['val'];
             } elseif ($item['var'][0] === '.') {
                 // nastaveni zacinajici teckou
                 self::$settings[substr($item['var'], 1)] = $item['val'];
             } else {
                 // konstanta
                 define('_' . $item['var'], $item['val']);
             }
         }
         DB::free($query);
         // nastavit interval pro maintenance
         self::$cronIntervals['maintenance'] = _maintenance_interval;
         // ip adresa klienta
         if (empty($_SERVER['REMOTE_ADDR'])) {
             $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
         }
         if (_proxy_mode && isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
             $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
         } else {
             $ip = $_SERVER['REMOTE_ADDR'];
         }
         define('_userip', trim(($addr_comma = strrpos($ip, ',')) === false ? $ip : substr($ip, $addr_comma + 1)));
         // poinstalacni kontrola
         if (_install_check) {
             require _indexroot . 'require/installcheck.php';
         }
         // kontrola verze databaze
         if (!defined('_dbversion') or !_checkVersion('database', _dbversion)) {
             _systemFailure('Verze nainstalované databáze není kompatibilní s verzí systému. Pokud byl právě aplikován patch pro přechod na novější verzi, pravděpodobně jste zapoměl(a) spustit skript pro aktualizaci databáze.');
         }
         // inicializace session
         require _indexroot . 'require/session.php';
         // inicializace jazykoveho souboru
         if (_loginindicator and _language_allowcustom and _loginlanguage != "") {
             $language = _loginlanguage;
         } else {
             $language = _language;
         }
         $langfile = _indexroot . 'plugins/languages/' . $language . '.php';
         $langfile_default = _indexroot . 'plugins/languages/default.php';
         if (file_exists($langfile)) {
             $GLOBALS['_lang'] = (require $langfile);
             define('_active_language', $language);
         } else {
             if (file_exists($langfile_default)) {
                 $GLOBALS['_lang'] = (require $langfile_default);
                 define('_active_language', 'default');
             } else {
                 _systemFailure('Zvolený ani přednastavený jazykový soubor nebyl nalezen.');
             }
         }
         // kontrola verze jazykoveho souboru
         if (!_checkVersion('language_file', $GLOBALS['_lang']['main.version'])) {
             DB::query('UPDATE `' . _mysql_prefix . '-settings` SET val="default" WHERE var="language"');
             _systemFailure('Zvolený jazykový soubor není kompatibilní s verzí systému.');
         }
         // kontrola blokace IP
         if ($directive['banned'] !== '' && !_administration) {
             $directive['banned'] = explode("\n", $directive['banned']);
             for ($i = 0; isset($directive['banned'][$i]); ++$i) {
                 if (0 === strncmp($directive['banned'][$i], _userip, strlen($directive['banned'][$i]))) {
                     header('HTTP/1.0 403 Forbidden');
                     if (defined('_header')) {
                         die('Your IP address is banned');
                     }
                     require _indexroot . 'require/ipban.php';
                     die;
                 }
             }
         }
         // motiv
         $template = _indexroot . 'plugins/templates/' . _template . '/template.php';
         $template_config = _indexroot . 'plugins/templates/' . _template . '/config.php';
         if (!file_exists($template) or !file_exists($template_config)) {
             DB::query('UPDATE `' . _mysql_prefix . '-settings` SET val=\'default\' WHERE var=\'template\'');
             _systemFailure('Zvolený motiv ' . _template . ' nebyl nalezen. Přepnuto na výchozí motiv.');
         }
         require $template_config;
         // kontrola verze motivu
         if (!_checkVersion('template', _template_version) and !_administration) {
             _systemFailure('Zvolený motiv není kompatibilní s verzí systému.');
         }
         // nacist rozsireni
         _extendLoad();
         // udalost inicializace systemu
         _extend('call', 'sys.init');
         // systemove callbacky
         _extend('reg', 'sys.cron.maintenance', array(__CLASS__, 'doMaintenance'));
         // cron
         if (_cron_auto && $runCron) {
             self::runCron();
         }
     }
 }
コード例 #4
0
 /**
  * Import data to the database
  * @param  KZipStream|string $stream KZipStream instance or file path
  * @return array             array(true, skipped_tables) on success, array(false, err_msg) on failure
  */
 public function importData($stream)
 {
     // prepare
     global $_lang;
     $err = null;
     $this->_import_tmap = array();
     // rather ugly hack to use existing file path as KZipStream
     if (is_string($stream)) {
         $file = $stream;
         $stream = new KZipStream(null, array(KZip::FILE_TOADD, $file, null));
         unset($file);
     }
     // vars
     $null = chr(0);
     $nullv = chr(1);
     $version = '';
     // import process
     do {
         // read header
         $offset = 0;
         while (true) {
             ++$offset;
             $byte = $stream->read(1);
             if ($byte === $null) {
                 // header read
                 break;
             } else {
                 $version .= $byte;
             }
             if ($offset > 32) {
                 $err = $_lang['dbdump']['dataerror'];
                 break 2;
             }
         }
         // check version
         if (!_checkVersion('database', $version)) {
             $err = $_lang['dbdump']['badversion'];
             break;
         }
         // find local tables
         $tables = array();
         $q = DB::query('SHOW TABLES LIKE \'' . _mysql_prefix . '-%\'');
         while ($r = DB::rown($q)) {
             $tables[$r[0]] = true;
         }
         DB::free($q);
         unset($r);
         // determine maximum query size
         $max_size = DB::query('SHOW VARIABLES LIKE \'max_allowed_packet\'');
         if (DB::size($max_size) !== 1) {
             $err = $_lang['dbdump']['maxpacket'];
             break;
         }
         $max_size = DB::result($max_size, 0, 1);
         $max_size -= 128;
         $max_size = floor(($max_size - 128) * 0.9);
         // adjust maximum query size to available memory
         $memlimit = _phpIniLimit('memory_limit');
         if (isset($memlimit)) {
             $avail_mem = $memlimit - memory_get_usage() - 131072;
             if ($max_size > $avail_mem) {
                 $max_size = $avail_mem;
             }
             unset($avail_mem);
         }
         if ($max_size < 32768) {
             $err = $_lang['dbdump']['memory'];
             break;
         }
         // turn off auto_increment for zero values
         DB::query('SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"');
         // prepare
         $reset = true;
         $skipped_tables = array();
         $stream_buffer = '';
         $stream_buffer_i = 0;
         // import data
         while (true) {
             // reset?
             if ($reset) {
                 $phase = 0;
                 $table = '';
                 $column = '';
                 $columns = array();
                 $columns_size = 0;
                 $values = array();
                 $value = '';
                 $value_counter = 0;
                 $sql = '';
                 $sql_len = 0;
                 $sql_buffer = '';
                 $sql_buffer_len = 0;
                 $skipping_table = false;
                 $reset = false;
             }
             // get 1 byte
             if (!isset($stream_buffer[$stream_buffer_i])) {
                 if ($stream->eof()) {
                     break;
                 }
                 $stream_buffer = $stream->read();
                 $stream_buffer_i = 0;
                 if ($stream_buffer === '') {
                     break;
                 }
             }
             $byte = $stream_buffer[$stream_buffer_i];
             ++$stream_buffer_i;
             // phase
             switch ($phase) {
                 /* --  reading table name  -- */
                 case 0:
                     // end of table name?
                     if ($byte === $null) {
                         // read column list
                         $phase = 1;
                         if (!isset($tables[_mysql_prefix . '-' . $table])) {
                             $skipping_table = true;
                             $skipped_tables[] = $table;
                         }
                         break;
                     }
                     // znak nazvu tabulky
                     $table .= $byte;
                     break;
                     /* --  reading column list  -- */
                 /* --  reading column list  -- */
                 case 1:
                     // end of column
                     if ($byte === $null) {
                         if ($column === '') {
                             // end of list, process columns
                             if (!$skipping_table) {
                                 $columns = '`' . implode('`,`', $columns) . '`';
                             }
                             // begin to read rows
                             $phase = 2;
                         } else {
                             // end of column
                             if (!$skipping_table) {
                                 $columns[] = $column;
                             }
                             ++$columns_size;
                             $column = '';
                         }
                         break;
                     }
                     // column name char
                     $column .= $byte;
                     break;
                     /* --  reading row data  -- */
                 /* --  reading row data  -- */
                 case 2:
                     // end of value?
                     if ($byte === $null) {
                         if ($value_counter === 0 && $value === '') {
                             // end of all rows, reset
                             $reset = true;
                             // import remaining data
                             if ($sql_buffer !== '' && !$skipping_table) {
                                 $import = $this->_db_import($table, $columns, $sql_buffer, $sql_buffer_len);
                                 if (isset($import)) {
                                     $err = _htmlStr($import);
                                     break 3;
                                 }
                             }
                         } else {
                             // end of value
                             ++$value_counter;
                             $values[] = $value;
                             $value = '';
                             // end of one row?
                             if ($value_counter === $columns_size) {
                                 if (!$skipping_table) {
                                     // build part of the SQL query
                                     $sql = '(';
                                     for ($i = 0, $lastcol = $columns_size - 1; isset($values[$i]); ++$i) {
                                         if ($values[$i] === $nullv) {
                                             $sql .= 'NULL';
                                         } else {
                                             $sql .= '\'' . $values[$i] . '\'';
                                         }
                                         if ($i !== $lastcol) {
                                             $sql .= ',';
                                         }
                                     }
                                     $sql .= ')';
                                     // execute query or use buffer
                                     $sql_len = strlen($sql);
                                     if ($sql_buffer_len + $sql_len + 1 >= $max_size) {
                                         $this->_db_import($table, $columns, $sql_buffer, $sql_buffer_len);
                                         if (isset($import)) {
                                             $err = _htmlStr($import);
                                             break 3;
                                         }
                                     } else {
                                         // separate
                                         if ($sql_buffer !== '') {
                                             $sql_buffer .= ',';
                                             ++$sql_buffer_len;
                                         }
                                         // add query to buffer
                                         $sql_buffer .= $sql;
                                         $sql_buffer_len += $sql_len;
                                     }
                                     // clean up
                                     $sql = '';
                                     $sql_len = 0;
                                 }
                                 $value_counter = 0;
                                 $values = array();
                             }
                         }
                         break;
                     }
                     // value char
                     $value .= $byte;
                     break;
             }
         }
         // restore sql_mode
         DB::query('SET SQL_MODE=""');
     } while (false);
     // void truncate map
     $this->_import_tmap = null;
     // return
     if (!isset($err)) {
         return array(true, $skipped_tables);
     }
     return array(false, $err);
 }
コード例 #5
0
ファイル: vercheck.php プロジェクト: spacequad/glfusion
function _displayVersionData()
{
    global $_CONF, $_USER, $LANG_UPGRADE, $LANG01, $LANG_FILECHECK, $LANG_ADMIN, $_PLUGIN_INFO;
    $retval = '';
    $upToDate = 0;
    $classCounter = 0;
    $pluginInfo = '';
    list($upToDate, $pluginsUpToDate, $pluginData) = _checkVersion();
    $T = new Template($_CONF['path_layout'] . 'admin');
    $T->set_file('page', 'vercheck.thtml');
    $menu_arr = array(array('url' => $_CONF['site_admin_url'] . '/vercheck.php', 'text' => $LANG_UPGRADE['recheck']), array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home']));
    $retval .= COM_startBlock($LANG_UPGRADE['title'], '', COM_getBlockTemplate('_admin_block', 'header'));
    $retval .= ADMIN_createMenu($menu_arr, $LANG_UPGRADE['desc'], $_CONF['layout_url'] . '/images/icons/versioncheck.png');
    $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    switch ($upToDate) {
        case 0:
            $alertIcon = $_CONF['layout_url'] . '/images/alert.png';
            $statusMsg = $LANG_UPGRADE['upgrade_title'];
            $statusText = sprintf($LANG_UPGRADE['upgrade'], $pluginData['glfusioncms']['installed_version'], $pluginData['glfusioncms']['latest_version']);
            break;
        case 1:
            $alertIcon = $_CONF['layout_url'] . '/images/check.png';
            $statusMsg = $LANG_UPGRADE['uptodate_title'];
            $statusText = $LANG_UPGRADE['uptodate'];
            break;
        case 2:
            $alertIcon = $_CONF['layout_url'] . '/images/alert.png';
            $statusMsg = $LANG_UPGRADE['unknown_title'];
            $statusText = sprintf($LANG_UPGRADE['unknown'], $pluginData['glfusioncms']['installed_version']);
            break;
        default:
            $alertIcon = $_CONF['layout_url'] . '/images/alert.png';
            $statusMsg = $LANG_UPGRADE['error_title'];
            $statusText = $LANG_UPGRADE['error'];
            break;
    }
    $T->set_var(array('alerticon' => $alertIcon, 'statusmsg' => $statusMsg, 'statustext' => $statusText));
    if ($pluginsUpToDate != -1) {
        $pluginInfo .= '<div style="margin-top:10px;"><h3>' . $LANG_UPGRADE['plugin_title'] . '</h3>';
        $dt = new Date('now', $_USER['tzid']);
        $data_arr = array();
        $text_arr = array();
        $header_arr = array(array('text' => $LANG_UPGRADE['plugin'], 'field' => 'display_name'), array('text' => $LANG_UPGRADE['installed_version'], 'field' => 'installed_version'), array('text' => $LANG_UPGRADE['latest_version'], 'field' => 'latest_version'), array('text' => $LANG_UPGRADE['notes'], 'field' => 'notes'));
        asort($pluginData);
        foreach ($pluginData as $plugin) {
            if ($plugin['plugin'] == 'glfusioncms') {
                continue;
            }
            $dt->setTimestamp($plugin['release_date']);
            if ($plugin['latest_version'] == 0) {
                $upToDate = -1;
            } else {
                $upToDate = _upToDate($plugin['latest_version'], $plugin['installed_version']);
            }
            switch ($upToDate) {
                case 0:
                    $notes = sprintf($LANG_UPGRADE['was_released'], $plugin['latest_version'], $dt->format("M d, Y", true));
                    $class = "notok";
                    if (strlen($plugin['url']) > 0) {
                        $latest_version = '<a href="' . $plugin['url'] . '" target="_blank">' . $plugin['latest_version'] . '</a>';
                    } else {
                        $latest_version = $plugin['latest_version'];
                    }
                    break;
                case 1:
                    $notes = $LANG_UPGRADE['plugin_uptodate'];
                    $class = "yes";
                    $latest_version = $plugin['latest_version'];
                    break;
                case 2:
                    $notes = $LANG_UPGRADE['plugin_newer'];
                    $class = "yes";
                    $latest_version = $plugin['latest_version'];
                    break;
                default:
                    $notes = $LANG_UPGRADE['no_data'];
                    $class = "ok";
                    $latest_version = '???';
                    break;
            }
            $data_arr[] = array('display_name' => $plugin['display_name'], 'installed_version' => $plugin['installed_version'], 'latest_version' => '<span class="' . $class . '">' . $latest_version . '</span>', 'url' => $plugin['url'], 'notes' => $notes, 'release_date' => $plugin['release_date'], 'update_available' => $upToDate);
        }
        $pluginInfo .= ADMIN_simpleList("", $header_arr, $text_arr, $data_arr);
        $pluginInfo .= '</div>';
    }
    $T->parse('output', 'page');
    $retval .= $T->finish($T->get_var('output'));
    $retval .= $pluginInfo;
    return $retval;
}
コード例 #6
0
ファイル: data.php プロジェクト: sunlight-cms/sunlight-cms-7
<?php

/* --  kontrola jadra, priprava  -- */
if (!defined('_core')) {
    exit;
}
$dbver = _checkVersion('database', null, true);
$dbver = $dbver[0];
$sql_error = false;
/* --  spusteni sql dotazu  -- */
$sql = array();
$sql[] = "CREATE TABLE `" . _mysql_prefix . "-articles` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `title` tinytext NOT NULL,\n  `title_seo` varchar(255) NOT NULL,\n  `keywords` varchar(128) NOT NULL DEFAULT '',\n  `description` varchar(128) NOT NULL DEFAULT '',\n  `perex` text NOT NULL,\n  `picture_uid` varchar(13) DEFAULT NULL,\n  `content` longtext NOT NULL,\n  `infobox` text NOT NULL,\n  `author` int(11) NOT NULL,\n  `home1` int(11) NOT NULL,\n  `home2` int(11) NOT NULL,\n  `home3` int(11) NOT NULL,\n  `time` int(11) NOT NULL,\n  `visible` tinyint(1) NOT NULL,\n  `public` tinyint(1) NOT NULL,\n  `comments` tinyint(1) NOT NULL,\n  `commentslocked` tinyint(1) NOT NULL,\n  `confirmed` tinyint(1) NOT NULL,\n  `showinfo` tinyint(1) NOT NULL,\n  `readed` int(11) NOT NULL,\n  `rateon` tinyint(1) NOT NULL,\n  `ratenum` int(11) NOT NULL,\n  `ratesum` int(11) NOT NULL,\n  PRIMARY KEY (`id`),\n  KEY `title_seo` (`title_seo`),\n  KEY `author` (`author`),\n  KEY `home1` (`home1`),\n  KEY `home2` (`home2`),\n  KEY `home3` (`home3`),\n  KEY `time` (`time`),\n  KEY `visible` (`visible`),\n  KEY `public` (`public`),\n  KEY `confirmed` (`confirmed`),\n  KEY `ratenum` (`ratenum`),\n  KEY `ratesum` (`ratesum`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1";
$sql[] = "CREATE TABLE `" . _mysql_prefix . "-boxes` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `ord` int(11) NOT NULL,\n  `title` varchar(96) NOT NULL,\n  `content` text NOT NULL,\n  `visible` tinyint(1) NOT NULL,\n  `public` tinyint(1) NOT NULL,\n  `column` varchar(64) NOT NULL,\n  `class` varchar(24) DEFAULT NULL,\n  PRIMARY KEY (`id`),\n  KEY `ord` (`ord`),\n  KEY `visible` (`visible`),\n  KEY `public` (`public`),\n  KEY `column` (`column`)\n) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=4";
$sql[] = "INSERT INTO `" . _mysql_prefix . "-boxes` (`id`, `ord`, `title`, `content`, `visible`, `public`, `column`, `class`) VALUES\n(1, 1, 'Menu', '[hcm]menu,1,20[/hcm]', 1, 1, '1', NULL),\n(2, 2, 'Vyhledávání', '[hcm]search[/hcm]', 1, 1, '1', NULL),\n(3, 3, '', '<br /><p class=\"center\"><a href=''http://sunlight.shira.cz/'' title=''redakční systém zdarma''>\r\n<img src=''http://sunlight.shira.cz/ikona.png'' alt=''sunlight.shira.cz'' style=''width:88px;height:31px;border:0;'' />\r\n</a></p>', 1, 1, '1', NULL)";
$sql[] = "CREATE TABLE `" . _mysql_prefix . "-groups` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `title` varchar(32) NOT NULL,\n  `descr` varchar(128) NOT NULL DEFAULT '',\n  `level` int(11) NOT NULL,\n  `icon` varchar(16) NOT NULL,\n  `color` varchar(16) NOT NULL DEFAULT '',\n  `blocked` tinyint(1) NOT NULL,\n  `reglist` tinyint(1) NOT NULL,\n  `administration` tinyint(1) NOT NULL,\n  `adminsettings` tinyint(1) NOT NULL,\n  `adminusers` tinyint(1) NOT NULL,\n  `admingroups` tinyint(1) NOT NULL,\n  `admincontent` tinyint(1) NOT NULL,\n  `adminsection` tinyint(1) NOT NULL,\n  `admincategory` tinyint(1) NOT NULL,\n  `adminbook` tinyint(1) NOT NULL,\n  `adminseparator` tinyint(1) NOT NULL,\n  `admingallery` tinyint(1) NOT NULL,\n  `adminlink` tinyint(1) NOT NULL,\n  `adminintersection` tinyint(1) NOT NULL,\n  `adminforum` tinyint(1) NOT NULL,\n  `adminpluginpage` tinyint(1) NOT NULL,\n  `adminart` tinyint(1) NOT NULL,\n  `adminallart` tinyint(1) NOT NULL,\n  `adminchangeartauthor` tinyint(1) NOT NULL,\n  `adminconfirm` tinyint(1) NOT NULL,\n  `adminneedconfirm` tinyint(1) NOT NULL,\n  `adminpoll` tinyint(1) NOT NULL,\n  `adminpollall` tinyint(1) NOT NULL,\n  `adminsbox` tinyint(1) NOT NULL,\n  `adminbox` tinyint(1) NOT NULL,\n  `adminfman` tinyint(1) NOT NULL,\n  `adminfmanlimit` tinyint(1) NOT NULL,\n  `adminfmanplus` tinyint(1) NOT NULL,\n  `adminhcmphp` tinyint(1) NOT NULL,\n  `adminbackup` tinyint(1) NOT NULL,\n  `adminrestore` tinyint(1) NOT NULL,\n  `adminmassemail` tinyint(1) NOT NULL,\n  `adminbans` tinyint(1) NOT NULL,\n  `adminposts` tinyint(1) NOT NULL,\n  `changeusername` tinyint(1) NOT NULL,\n  `postcomments` tinyint(1) NOT NULL,\n  `unlimitedpostaccess` tinyint(1) NOT NULL,\n  `locktopics` tinyint(1) NOT NULL,\n  `stickytopics` tinyint(1) NOT NULL,\n  `movetopics` tinyint(1) NOT NULL,\n  `artrate` tinyint(1) NOT NULL,\n  `pollvote` tinyint(1) NOT NULL,\n  `selfdestruction` tinyint(1) NOT NULL,\n  PRIMARY KEY (`id`),\n  KEY `level` (`level`),\n  KEY `blocked` (`blocked`),\n  KEY `reglist` (`reglist`)\n) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=11";
$sql[] = "INSERT INTO `" . _mysql_prefix . "-groups` (`id`, `title`, `descr`, `level`, `icon`, `color`, `blocked`, `reglist`, `administration`, `adminsettings`, `adminusers`, `admingroups`, `admincontent`, `adminsection`, `admincategory`, `adminbook`, `adminseparator`, `admingallery`, `adminlink`, `adminintersection`, `adminforum`, `adminpluginpage`, `adminart`, `adminallart`, `adminchangeartauthor`, `adminconfirm`, `adminneedconfirm`, `adminpoll`, `adminpollall`, `adminsbox`, `adminbox`, `adminfman`, `adminfmanlimit`, `adminfmanplus`, `adminhcmphp`, `adminbackup`, `adminrestore`, `adminmassemail`, `adminbans`, `adminposts`, `changeusername`, `postcomments`, `unlimitedpostaccess`, `locktopics`, `stickytopics`, `movetopics`, `artrate`, `pollvote`, `selfdestruction`) VALUES\n(1, 'Hlavní administrátoři', '', 10000, 'redstar.png', '', 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),\n(2, 'Neregistrovaní', '', 0, '', '', 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1),\n(3, 'Čtenáři', '', 1, '', '', 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1),\n(5, 'Administrátoři', '', 1000, 'orangestar.png', '', 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0),\n(10, 'Moderátoři', '', 600, 'greenstar.png', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0),\n(9, 'Redaktoři', '', 500, 'bluestar.png', '', 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0)";
$sql[] = "CREATE TABLE `" . _mysql_prefix . "-images` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `home` int(11) NOT NULL,\n  `ord` int(11) NOT NULL,\n  `title` varchar(64) NOT NULL,\n  `prev` tinytext NOT NULL,\n  `full` tinytext NOT NULL,\n  `in_storage` tinyint(1) NOT NULL DEFAULT '0',\n  PRIMARY KEY (`id`),\n  KEY `home` (`home`),\n  KEY `full` (`full`(8)),\n  KEY `in_storage` (`in_storage`),\n  KEY `ord` (`ord`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1";
$sql[] = "CREATE TABLE `" . _mysql_prefix . "-iplog` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `ip` varchar(15) NOT NULL,\n  `type` tinyint(4) NOT NULL,\n  `time` int(11) NOT NULL,\n  `var` int(11) NOT NULL,\n  PRIMARY KEY (`id`),\n  KEY `ip` (`ip`),\n  KEY `type` (`type`),\n  KEY `time` (`time`),\n  KEY `var` (`var`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1";
$sql[] = "CREATE TABLE `" . _mysql_prefix . "-pm` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `sender` int(11) NOT NULL,\n  `sender_readtime` int(11) NOT NULL DEFAULT '0',\n  `sender_deleted` tinyint(1) NOT NULL DEFAULT '0',\n  `receiver` int(11) NOT NULL,\n  `receiver_readtime` int(11) NOT NULL DEFAULT '0',\n  `receiver_deleted` tinyint(1) NOT NULL DEFAULT '0',\n  `update_time` int(11) NOT NULL DEFAULT '0',\n  PRIMARY KEY (`id`),\n  KEY `sender` (`sender`),\n  KEY `receiver` (`receiver`),\n  KEY `update_time` (`update_time`),\n  KEY `sender_deleted` (`sender_deleted`),\n  KEY `receiver_deleted` (`receiver_deleted`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1";
$sql[] = "CREATE TABLE `" . _mysql_prefix . "-polls` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `author` int(11) NOT NULL,\n  `question` varchar(96) NOT NULL,\n  `answers` text NOT NULL,\n  `locked` tinyint(1) NOT NULL,\n  `votes` tinytext NOT NULL,\n  PRIMARY KEY (`id`),\n  KEY `author` (`author`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1";
$sql[] = "CREATE TABLE `" . _mysql_prefix . "-posts` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `type` tinyint(4) NOT NULL,\n  `home` int(11) NOT NULL,\n  `xhome` int(11) NOT NULL,\n  `subject` varchar(48) NOT NULL,\n  `text` text NOT NULL,\n  `author` int(11) NOT NULL,\n  `guest` varchar(24) NOT NULL,\n  `time` int(11) NOT NULL,\n  `ip` varchar(15) NOT NULL,\n  `locked` tinyint(1) NOT NULL DEFAULT '0',\n  `bumptime` int(11) NOT NULL DEFAULT '0',\n  `sticky` tinyint(1) NOT NULL DEFAULT '0',\n  `flag` int(10) unsigned NOT NULL DEFAULT '0',\n  PRIMARY KEY (`id`),\n  KEY `bumptime` (`bumptime`),\n  KEY `type` (`type`),\n  KEY `home` (`home`),\n  KEY `xhome` (`xhome`),\n  KEY `author` (`author`),\n  KEY `time` (`time`),\n  KEY `sticky` (`sticky`),\n  KEY `flag` (`flag`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1";
$sql[] = "CREATE TABLE `" . _mysql_prefix . "-redir` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `old` varchar(255) NOT NULL,\n  `new` varchar(255) NOT NULL,\n  `active` tinyint(1) NOT NULL DEFAULT '1',\n  PRIMARY KEY (`id`),\n  KEY `old` (`old`),\n  KEY `active` (`active`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1";
$sql[] = "CREATE TABLE `" . _mysql_prefix . "-root` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `title` varchar(96) NOT NULL,\n  `title_seo` varchar(255) NOT NULL,\n  `keywords` varchar(128) NOT NULL DEFAULT '',\n  `description` varchar(128) NOT NULL DEFAULT '',\n  `type` tinyint(4) NOT NULL,\n  `type_idt` varchar(16) DEFAULT NULL,\n  `intersection` int(11) NOT NULL,\n  `intersectionperex` text NOT NULL,\n  `ord` float NOT NULL,\n  `content` longtext NOT NULL,\n  `visible` tinyint(1) NOT NULL,\n  `public` tinyint(1) NOT NULL,\n  `level` int(11) NOT NULL DEFAULT '0',\n  `autotitle` tinyint(1) NOT NULL DEFAULT '0',\n  `events` varchar(255) DEFAULT NULL,\n  `var1` int(11) NOT NULL,\n  `var2` int(11) NOT NULL,\n  `var3` int(11) NOT NULL,\n  `var4` int(11) NOT NULL,\n  PRIMARY KEY (`id`),\n  KEY `title_seo` (`title_seo`),\n  KEY `level` (`level`),\n  KEY `type` (`type`),\n  KEY `intersection` (`intersection`),\n  KEY `ord` (`ord`),\n  KEY `visible` (`visible`),\n  KEY `public` (`public`),\n  KEY `autotitle` (`autotitle`),\n  KEY `var1` (`var1`),\n  KEY `var2` (`var2`),\n  KEY `var3` (`var3`),\n  KEY `var4` (`var4`)\n) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2";
$sql[] = "INSERT INTO `" . _mysql_prefix . "-root` (`id`, `title`, `title_seo`, `keywords`, `description`, `type`, `type_idt`, `intersection`, `intersectionperex`, `ord`, `content`, `visible`, `public`, `level`, `autotitle`, `events`, `var1`, `var2`, `var3`, `var4`) VALUES\n(1, 'Úvod', 'index', '', '', 1, NULL, -1, '', 1, '<p>Instalace redakčního systému SunLight CMS 7.5.4 byla úspěšně dokončena!<br />Nyní se již můžete <a href=\"admin/\">přihlásit do administrace</a> (jméno a heslo bylo zvoleno při instalaci).</p>\r\n\r\n<p>Podporu, diskusi a doplňky ke stažení naleznete na oficiálních webových stránkách <a href=\"http://sunlight.shira.cz/\">sunlight.shira.cz</a>.</p>', 1, 1, 0, 1, NULL, 0, 0, 0, 0)";
$sql[] = "CREATE TABLE `" . _mysql_prefix . "-sboxes` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `title` varchar(64) NOT NULL,\n  `locked` tinyint(1) NOT NULL,\n  `public` tinyint(1) NOT NULL,\n  PRIMARY KEY (`id`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1";
$sql[] = "CREATE TABLE `" . _mysql_prefix . "-settings` (\n  `var` varchar(24) NOT NULL,\n  `val` text NOT NULL,\n  PRIMARY KEY (`var`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8";
$sql[] = "INSERT INTO `" . _mysql_prefix . "-settings` (`var`, `val`) VALUES\n('postsendexpire', '50'),\n('pollvoteexpire', '604800'),\n('artreadexpire', '18000'),\n('maxloginexpire', '900'),\n('maxloginattempts', '20'),\n('pagingmode', '2'),\n('profileemail', '0'),\n('wysiwyg', '0'),\n('captcha', '1'),\n('template', 'default'),\n('title', " . DB::val($title) . "),\n('description', " . DB::val($descr) . "),\n('commentsperpage', '10'),\n('smileys', '1'),\n('postadmintime', '172800'),\n('keywords', " . DB::val($keywords) . "),\n('adminscheme', '0'),\n('dbversion', " . DB::val($dbver) . "),\n('atreplace', '[zavinac]'),\n('bbcode', '1'),\n('defaultgroup', '3'),\n('mailerusefrom', '0'),\n('showpages', '4'),\n('ulist', '0'),\n('registration', '1'),\n('language', 'default'),\n('modrewrite', '0'),\n('titleseparator', '-'),\n('url', " . DB::val($url) . "),\n('notpublicsite', '0'),\n('comments', '1'),\n('artrateexpire', '604800'),\n('lightbox', '1'),\n('rss', '1'),\n('messages', '1'),\n('messagesperpage', '30'),\n('search', '1'),\n('banned', ''),\n('author', ''),\n('titletype', '2'),\n('adminlinkprivate', '0'),\n('language_allowcustom', '0'),\n('lostpass', '1'),\n('registration_grouplist', '0'),\n('favicon', '0'),\n('.rules', ''),\n('printart', '1'),\n('extratopicslimit', '12'),\n('rsslimit', '30'),\n('sboxmemory', '20'),\n('ratemode', '2'),\n('time_format', 'j.n.Y G:i'),\n('uploadavatar', '1'),\n('galuploadresize_w', '750'),\n('galuploadresize_h', '565'),\n('codemirror', '1'),\n('show_avatars', '0'),\n('accactexpire', '1200'),\n('registration_confirm', '0'),\n('sysmail', ''),\n('lostpassexpire', '1800'),\n('cacheid', '0'),\n('.admin_index_custom', ''),\n('.admin_index_custom_pos', '1'),\n('index_page_id', '1'),\n('adminscheme_mode', '0'),\n('extend_enabled', '1'),\n('article_pic_w', '200'),\n('article_pic_h', '200'),\n('topic_hot_ratio', '20'),\n('install_check', '0'),\n('ajaxfm', '0'),\n('proxy_mode', '0'),\n('cron_auto',  '1'),\n('.cron_auth',  ''),\n('.cron_times', 'a:0:{}'),\n('maintenance_interval',  '259200'),\n('thumb_cleanup_threshold',  '604800'),\n('thumb_touch_threshold',  '43200')";
$sql[] = "CREATE TABLE `" . _mysql_prefix . "-user-activation` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `code` varchar(23) NOT NULL,\n  `expire` int(11) NOT NULL,\n  `group` int(11) NOT NULL,\n  `username` varchar(24) NOT NULL,\n  `password` varchar(32) NOT NULL,\n  `salt` varchar(8) NOT NULL,\n  `massemail` tinyint(1) NOT NULL,\n  `ip` varchar(15) NOT NULL,\n  `email` tinytext NOT NULL,\n  PRIMARY KEY (`id`),\n  KEY `code` (`code`),\n  KEY `expire` (`expire`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1";
$sql[] = "CREATE TABLE `" . _mysql_prefix . "-users` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `group` int(11) NOT NULL,\n  `levelshift` tinyint(1) NOT NULL,\n  `username` varchar(24) NOT NULL,\n  `publicname` varchar(24) NOT NULL,\n  `password` varchar(32) NOT NULL,\n  `salt` varchar(8) NOT NULL,\n  `logincounter` int(11) NOT NULL,\n  `registertime` int(11) NOT NULL,\n  `activitytime` int(11) NOT NULL,\n  `blocked` tinyint(1) NOT NULL,\n  `massemail` tinyint(1) NOT NULL,\n  `wysiwyg` tinyint(1) NOT NULL,\n  `language` varchar(12) NOT NULL,\n  `ip` varchar(15) NOT NULL,\n  `email` tinytext NOT NULL,\n  `avatar` varchar(13) DEFAULT NULL,\n  `avatar_mode` tinyint(4) NOT NULL DEFAULT '0',\n  `web` tinytext NOT NULL,\n  `skype` tinytext NOT NULL,\n  `msn` tinytext NOT NULL,\n  `icq` int(11) NOT NULL,\n  `jabber` tinytext NOT NULL,\n  `note` text NOT NULL,\n  PRIMARY KEY (`id`),\n  KEY `group` (`group`),\n  KEY `logincounter` (`logincounter`),\n  KEY `registertime` (`registertime`),\n  KEY `activitytime` (`activitytime`),\n  KEY `blocked` (`blocked`),\n  KEY `massemail` (`massemail`),\n  KEY `username` (`username`(4)),\n  KEY `email` (`email`(4)),\n  KEY `publicname` (`publicname`(4))\n) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2";
$sql[] = "INSERT INTO `" . _mysql_prefix . "-users` (`id`, `group`, `levelshift`, `username`, `publicname`, `password`, `salt`, `logincounter`, `registertime`, `activitytime`, `blocked`, `massemail`, `wysiwyg`, `language`, `ip`, `email`, `avatar`, `avatar_mode`, `web`, `skype`, `msn`, `icq`, `jabber`, `note`) VALUES\n(0, 1, 1, 'admin', 'Admin', " . DB::val($pass[0]) . ", " . DB::val($pass[1]) . ", 0, " . time() . ", " . time() . ", 0, 1, 1, '', '', " . DB::val($email) . ", NULL, 0, '', '', '', 0, '', '')";
foreach ($sql as $line) {