/** * */ public function __construct() { $this->Register = Register::getInstance(); $this->setPhpSettings(); $this->touchStartTime(); $this->Register['Cache'] = new Cache(); $viewerLoader = new Fps_Viewer_Loader(array('template_root' => ROOT . '/template/' . getTemplateName() . '/html/')); $this->Register['Viewer'] = new Fps_Viewer_Manager($viewerLoader); if (isInstall()) { $this->registerCustomTemplateFunctions(); $this->Register['DB'] = class_exists('PDO') && Config::read('use_pdo') ? FpsPDO::get() : FpsDataBase::get(); $this->Register['UserAuth'] = new UserAuth(); $this->Register['Log'] = new Logination(); } $this->Register['DocParser'] = new Document_Parser(); $this->Register['ACL'] = new ACL(ROOT . '/sys/settings/'); $this->Register['PrintText'] = new PrintText(); $this->Register['Validate'] = new Validate(function ($errors) { $Register = Register::getInstance(); return $Register['DocParser']->wrapErrors($errors); }); $this->Register['ModManager'] = new ModulesManager(ROOT . '/sys/settings/modules_access.php'); $this->Register['PluginController'] = new Plugins(); $this->Register['URL'] = new AtmUrl(); $this->Register['Protector'] = new Protect(); if (isInstall()) { $this->inputCheck(); $this->initProtect(); $this->initUser(); $this->loadLanguages(); } }
@ini_set('display_errors', 1); session_start(); define('ROOT', dirname(dirname(__FILE__))); if (function_exists('set_time_limit')) { set_time_limit(0); } include_once '../sys/boot.php'; $errors = array(); new Config('../sys/settings/config.php'); $set = Config::read('all'); if (class_exists('PDO')) { include_once '../sys/inc/fpspdo.class.php'; $DB = FpsPDO::get(); } else { include_once '../sys/inc/fpsdatabase.class.php'; $DB = FpsDataBase::get(); } $array = array(); $array[] = "DROP TABLE IF EXISTS `{$set['db']['prefix']}forum_cat`"; $array[] = "CREATE TABLE `{$set['db']['prefix']}forum_cat` (\n `id` int(11) NOT NULL auto_increment,\n `title` varchar(255) collate utf8_general_ci default NULL,\n `previev_id` int(11) NOT NULL,\n PRIMARY KEY (`id`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci"; $array[] = "INSERT INTO `{$set['db']['prefix']}forum_cat` VALUES (1, 'TEST', 1)"; ##################################################################### $array[] = "DROP TABLE IF EXISTS `{$set['db']['prefix']}forums`"; $array[] = "CREATE TABLE `{$set['db']['prefix']}forums` (\n `id` int(6) NOT NULL auto_increment,\n `title` text character set utf8,\n `description` mediumtext character set utf8,\n `pos` smallint(6) NOT NULL default '0',\n `in_cat` int(11) default NULL,\n `last_theme_id` int(11) NOT NULL default 0,\n `themes` int(11) default '0',\n `posts` int(11) NOT NULL default '0',\n `parent_forum_id` INT(11),\n `lock_posts` INT( 11 ) DEFAULT '0' NOT NULL,\n `lock_passwd` VARCHAR( 100 ) NOT NULL default 0,\n PRIMARY KEY (`id`),\n INDEX (`in_cat`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci"; $array[] = "INSERT INTO `{$set['db']['prefix']}forums` (`title`, `description`, `pos`, `in_cat`) VALUES ('TEST', 'тестовый форум', 1, 1)"; ##################################################################### $array[] = "DROP TABLE IF EXISTS `{$set['db']['prefix']}forum_attaches`"; $array[] = "CREATE TABLE `{$set['db']['prefix']}forum_attaches` (\n\t`id` INT NOT NULL AUTO_INCREMENT ,\n\t`post_id` INT NOT NULL default '0',\n\t`theme_id` INT NOT NULL default '0',\n\t`user_id` INT NOT NULL ,\n\t`attach_number` INT NOT NULL default '0',\n\t`filename` VARCHAR( 100 ) NOT NULL ,\n\t`size` BIGINT NOT NULL ,\n\t`date` DATETIME NOT NULL ,\n\t`is_image` ENUM( '0', '1' ) DEFAULT '0' NOT NULL ,\n\tPRIMARY KEY ( `id` ),\n\tINDEX (`post_id`, `user_id`)\n) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci;"; ##################################################################### $array[] = "DROP TABLE IF EXISTS `{$set['db']['prefix']}pages`"; $array[] = "CREATE TABLE `{$set['db']['prefix']}pages` (\n `id` int(11) NOT NULL auto_increment,\n `name` varchar(255) collate utf8_general_ci NOT NULL,\n `title` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,\n `template` varchar(255) default '' collate utf8_general_ci NOT NULL,\n `content` longtext collate utf8_general_ci NOT NULL,\n `url` varchar(255) default '' NOT NULL,\n `meta_title` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,\n `meta_keywords` varchar(255) default '' NOT NULL,\n `meta_description` text,\n `parent_id` int(11) default 0 NOT NULL,\n `path` varchar(255) default '1.' NOT NULL,\n `visible` enum('1','0') default '1' NOT NULL,\n `publish` ENUM( '0', '1' ) NOT NULL DEFAULT '1',\n `position` INT( 11 ) NOT NULL,\n PRIMARY KEY (`id`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci";
/** * Uses for singlton * Allow initialize only one object */ public static function get() { if (!self::$instance) { self::$instance = new FpsDataBase(); } return self::$instance; }