Beispiel #1
0
 /**
  * @return bool
  */
 public function apply_templates()
 {
     include_once '../modules/system/xoops_version.php';
     $dbm = new Db_manager();
     $time = time();
     foreach ($modversion['templates'] as $tplfile) {
         // Admin templates
         if (isset($tplfile['type']) && $tplfile['type'] === 'admin' && ($fp = fopen('../modules/system/templates/admin/' . $tplfile['file'], 'r'))) {
             $newtplid = $dbm->insert('tplfile', " VALUES (0, 1, 'system', 'default', '" . addslashes($tplfile['file']) . "', '" . addslashes($tplfile['description']) . "', " . $time . ', ' . $time . ", 'admin')");
             $tplsource = fread($fp, filesize('../modules/system/templates/admin/' . $tplfile['file']));
             fclose($fp);
             $dbm->insert('tplsource', ' (tpl_id, tpl_source) VALUES (' . $newtplid . ", '" . addslashes($tplsource) . "')");
         }
     }
     return true;
 }
 * If you did not receive this file, get it at http://www.gnu.org/licenses/gpl-2.0.html
 *
 * @copyright    (c) 2000-2016 XOOPS Project (www.xoops.org)
 * @license          GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
 * @package          installer
 * @since            2.3.0
 * @author           Haruki Setoyama  <*****@*****.**>
 * @author           Kazumi Ono <*****@*****.**>
 * @author           Skalpa Keo <*****@*****.**>
 * @author           Taiwen Jiang <*****@*****.**>
 * @author           DuGris (aka L. JEN) <*****@*****.**>
 **/
require_once './include/common.inc.php';
defined('XOOPS_INSTALL') || die('XOOPS Installation wizard die');
$pageHasForm = false;
$pageHasHelp = false;
$vars =& $_SESSION['settings'];
include_once '../mainfile.php';
include_once './class/dbmanager.php';
$dbm = new Db_manager();
if (!$dbm->isConnectable()) {
    $wizard->redirectToPage('-3');
    exit;
}
if ($dbm->tableExists('users')) {
    $content = '<div class="x2-note confirmMsg">' . XOOPS_TABLES_FOUND . '</div>';
} else {
    $result = $dbm->queryFromFile('./sql/' . XOOPS_DB_TYPE . '.structure.sql');
    $content = '<div class="x2-note successMsg">' . XOOPS_TABLES_CREATED . '</div><br>' . $dbm->report();
}
include './include/install_tpl.php';
    if (!preg_match("/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+([\\.][a-z0-9-]+)+\$/i", $vars['adminmail'])) {
        $error['email'][] = ERR_INVALID_EMAIL;
    }
    if ($vars['adminpass'] != $vars['adminpass2']) {
        $error['pass'][] = ERR_PASSWORD_MATCH;
    }
    if ($error) {
        $wizard->redirectToPage('+0');
        return 200;
    } else {
        $wizard->redirectToPage('+1');
        return 302;
    }
} else {
    include_once './class/dbmanager.php';
    $dbm = new Db_manager();
    if (!$dbm->isConnectable()) {
        $wizard->redirectToPage('dbsettings');
        exit;
    }
    $res = $dbm->query('SELECT COUNT(*) FROM ' . $dbm->db->prefix('users'));
    list($isadmin) = $dbm->db->fetchRow($res);
}
ob_start();
if ($isadmin) {
    $pageHasForm = false;
    $pageHasHelp = false;
    echo "<div class='x2-note errorMsg'>" . ADMIN_EXIST . "</div>\n";
} else {
    ?>
    <fieldset>
 * @package          installer
 * @since            2.3.0
 * @author           Haruki Setoyama  <*****@*****.**>
 * @author           Kazumi Ono <*****@*****.**>
 * @author           Skalpa Keo <*****@*****.**>
 * @author           Taiwen Jiang <*****@*****.**>
 * @author           DuGris (aka L. JEN) <*****@*****.**>
 */
require_once './include/common.inc.php';
defined('XOOPS_INSTALL') || die('XOOPS Installation wizard die');
$pageHasForm = false;
$pageHasHelp = false;
$vars =& $_SESSION['settings'];
include_once '../mainfile.php';
include_once './class/dbmanager.php';
$dbm = new Db_manager();
if (!$dbm->isConnectable()) {
    $wizard->redirectToPage('dbsettings');
    exit;
}
$res = $dbm->query('SELECT COUNT(*) FROM ' . $dbm->db->prefix('users'));
if (!$res) {
    $wizard->redirectToPage('dbsettings');
    exit;
}
list($count) = $dbm->db->fetchRow($res);
$process = $count ? '' : 'insert';
$update = false;
extract($_SESSION['siteconfig'], EXTR_SKIP);
if ($state = xoDiagIfWritable('include/license.php')) {
    if (!is_writable('../include/license.php')) {