Esempio n. 1
0
 }
 fclose($fp);
 //密码加密存储
 $PHPASS = new PasswordHash(8, true);
 $adminpw = $PHPASS->HashPassword($adminpw);
 $dbcharset = 'utf8';
 $type = 'MYISAM';
 $table_charset_sql = $DB->getMysqlVersion() > '4.1' ? 'ENGINE=' . $type . ' DEFAULT CHARSET=' . $dbcharset . ';' : 'ENGINE=' . $type . ';';
 if ($DB->getMysqlVersion() > '4.1') {
     $DB->query("ALTER DATABASE `{$db_name}` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;", true);
 }
 $widgets = Option::getWidgetTitle();
 $sider_wg = Option::getDefWidget();
 $widget_title = serialize($widgets);
 $widgets = serialize($sider_wg);
 define('BLOG_URL', getBlogUrl());
 $sql = "\nDROP TABLE IF EXISTS {$db_prefix}blog;\nCREATE TABLE {$db_prefix}blog (\n  gid int(10) unsigned NOT NULL auto_increment,\n  title varchar(255) NOT NULL default '',\n  date bigint(20) NOT NULL,\n  content longtext NOT NULL,\n  excerpt longtext NOT NULL,\n  alias VARCHAR(200) NOT NULL DEFAULT '',\n  author int(10) NOT NULL default '1',\n  sortid int(10) NOT NULL default '-1',\n  type varchar(20) NOT NULL default 'blog',\n  views int(10) unsigned NOT NULL default '0',\n  comnum int(10) unsigned NOT NULL default '0',\n  attnum int(10) unsigned NOT NULL default '0',\n  top enum('n','y') NOT NULL default 'n',\n  sortop enum('n','y') NOT NULL default 'n',\n  hide enum('n','y') NOT NULL default 'n',\n  checked enum('n','y') NOT NULL default 'y',\n  allow_remark enum('n','y') NOT NULL default 'y',\n  password varchar(255) NOT NULL default '',\n  template varchar(255) NOT NULL default '',\n  PRIMARY KEY  (gid),\n  KEY date (date),\n  KEY author (author),\n  KEY sortid (sortid),\n  KEY type (type),\n  KEY views (views),\n  KEY comnum (comnum),\n  KEY hide (hide)\n)" . $table_charset_sql . "\nINSERT INTO {$db_prefix}blog (gid,title,date,content,excerpt,author,views,comnum,attnum,top,sortop,hide,allow_remark,password) VALUES (1, '欢迎使用emlog', '" . time() . "', '恭喜您成功安装了emlog,这是系统自动生成的演示文章。编辑或者删除它,然后开始您的创作吧!', '', 1, 0, 0, 0, 'n', 'n', 'n', 'y', '');\nDROP TABLE IF EXISTS {$db_prefix}attachment;\nCREATE TABLE {$db_prefix}attachment (\n  aid int(10) unsigned NOT NULL auto_increment,\n  blogid int(10) unsigned NOT NULL default '0',\n  filename varchar(255) NOT NULL default '',\n  filesize int(10) NOT NULL default '0',\n  filepath varchar(255) NOT NULL default '',\n  addtime bigint(20) NOT NULL default '0',\n  width int(10) NOT NULL default '0',\n  height int(10) NOT NULL default '0',\n  mimetype varchar(40) NOT NULL default '',\n  thumfor int(10) NOT NULL default 0,\n  PRIMARY KEY  (aid),\n  KEY blogid (blogid)\n)" . $table_charset_sql . "\nDROP TABLE IF EXISTS {$db_prefix}comment;\nCREATE TABLE {$db_prefix}comment (\n  cid int(10) unsigned NOT NULL auto_increment,\n  gid int(10) unsigned NOT NULL default '0',\n  pid int(10) unsigned NOT NULL default '0',\n  date bigint(20) NOT NULL,\n  poster varchar(20) NOT NULL default '',\n  comment text NOT NULL,\n  mail varchar(60) NOT NULL default '',\n  url varchar(75) NOT NULL default '',\n  ip varchar(128) NOT NULL default '',\n  hide enum('n','y') NOT NULL default 'n',\n  PRIMARY KEY  (cid),\n  KEY gid (gid),\n  KEY date (date),\n  KEY hide (hide)\n)" . $table_charset_sql . "\nDROP TABLE IF EXISTS {$db_prefix}options;\nCREATE TABLE {$db_prefix}options (\noption_id INT( 11 ) UNSIGNED NOT NULL auto_increment,\noption_name VARCHAR( 255 ) NOT NULL ,\noption_value LONGTEXT NOT NULL ,\nPRIMARY KEY (option_id),\nKEY option_name (option_name)\n)" . $table_charset_sql . "\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('blogname','点滴记忆');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('bloginfo','使用emlog搭建的站点');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('site_title','');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('site_description','');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('site_key','emlog');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('log_title_style','0');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('blogurl','" . BLOG_URL . "');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('icp','');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('footer_info','');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('admin_perpage_num','15');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('rss_output_num','0');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('rss_output_fulltext','y');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('index_lognum','10');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('index_comnum','10');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('index_twnum','10');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('index_newtwnum','5');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('index_newlognum','5');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('index_randlognum','5');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('index_hotlognum','5');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('comment_subnum','20');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('nonce_templet','default');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('admin_style','default');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('tpl_sidenum','1');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('comment_code','n');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('comment_needchinese','y');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('comment_interval',60);\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('isgravatar','y');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('isthumbnail','y');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('att_maxsize','20480');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('att_type','rar,zip,gif,jpg,jpeg,png,txt,pdf,docx,doc,xls,xlsx');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('att_imgmaxw','420');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('att_imgmaxh','460');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('comment_paging','y');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('comment_pnum','10');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('comment_order','newer');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('login_code','n');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('reply_code','n');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('iscomment','y');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('ischkcomment','y');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('ischkreply','n');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('isurlrewrite','0');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('isalias','n');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('isalias_html','n');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('isgzipenable','n');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('isxmlrpcenable','n');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('ismobile','n');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('isexcerpt','n');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('excerpt_subnum','300');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('istwitter','y');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('istreply','n');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('topimg','content/templates/default/images/top/default.jpg');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('custom_topimgs','a:0:{}');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('timezone','8');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('active_plugins','');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('widget_title','{$widget_title}');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('custom_widget','a:0:{}');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('widgets1','{$widgets}');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('widgets2','');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('widgets3','');\nINSERT INTO {$db_prefix}options (option_name, option_value) VALUES ('widgets4','');\nDROP TABLE IF EXISTS {$db_prefix}link;\nCREATE TABLE {$db_prefix}link (\n  id int(10) unsigned NOT NULL auto_increment,\n  sitename varchar(30) NOT NULL default '',\n  siteurl varchar(75) NOT NULL default '',\n  description varchar(255) NOT NULL default '',\n  hide enum('n','y') NOT NULL default 'n',\n  taxis int(10) unsigned NOT NULL default '0',\n  PRIMARY KEY  (id)\n)" . $table_charset_sql . "\nINSERT INTO {$db_prefix}link (id, sitename, siteurl, description, taxis) VALUES (1, 'emlog', 'http://www.emlog.net', 'emlog官方主页', 0);\nDROP TABLE IF EXISTS {$db_prefix}navi;\nCREATE TABLE {$db_prefix}navi (\n  id int(10) unsigned NOT NULL auto_increment,\n  naviname varchar(30) NOT NULL default '',\n  url varchar(75) NOT NULL default '',\n  newtab enum('n','y') NOT NULL default 'n',\n  hide enum('n','y') NOT NULL default 'n',\n  taxis int(10) unsigned NOT NULL default '0',\n  pid int(10) unsigned NOT NULL default '0',\n  isdefault enum('n','y') NOT NULL default 'n',\n  type tinyint(3) unsigned NOT NULL default '0',\n  type_id int(10) unsigned NOT NULL default '0',\n  PRIMARY KEY  (id)\n)" . $table_charset_sql . "\nINSERT INTO {$db_prefix}navi (id, naviname, url, taxis, isdefault, type) VALUES (1, '首页', '', 1, 'y', 1);\nINSERT INTO {$db_prefix}navi (id, naviname, url, taxis, isdefault, type) VALUES (2, '微语', 't', 2, 'y', 2);\nINSERT INTO {$db_prefix}navi (id, naviname, url, taxis, isdefault, type) VALUES (3, '登录', 'admin', 3, 'y', 3);\nDROP TABLE IF EXISTS {$db_prefix}tag;\nCREATE TABLE {$db_prefix}tag (\n  tid int(10) unsigned NOT NULL auto_increment,\n  tagname varchar(60) NOT NULL default '',\n  gid text NOT NULL,\n  PRIMARY KEY  (tid),\n  KEY tagname (tagname)\n)" . $table_charset_sql . "\nDROP TABLE IF EXISTS {$db_prefix}sort;\nCREATE TABLE {$db_prefix}sort (\n  sid int(10) unsigned NOT NULL auto_increment,\n  sortname varchar(255) NOT NULL default '',\n  alias VARCHAR(200) NOT NULL DEFAULT '',\n  taxis int(10) unsigned NOT NULL default '0',\n  pid int(10) unsigned NOT NULL default '0',\n  description text NOT NULL,\n  template varchar(255) NOT NULL default '',\n  PRIMARY KEY  (sid)\n)" . $table_charset_sql . "\nDROP TABLE IF EXISTS {$db_prefix}twitter;\nCREATE TABLE {$db_prefix}twitter (\nid INT NOT NULL AUTO_INCREMENT,\ncontent text NOT NULL,\nimg varchar(200) DEFAULT NULL,\nauthor int(10) NOT NULL default '1',\ndate bigint(20) NOT NULL,\nreplynum int(10) unsigned NOT NULL default '0',\nPRIMARY KEY (id),\nKEY author (author)\n)" . $table_charset_sql . "\nINSERT INTO {$db_prefix}twitter (id, content, img, author, date, replynum) VALUES (1, '使用微语记录您身边的新鲜事', '', 1, '" . time() . "', 0);\nDROP TABLE IF EXISTS {$db_prefix}reply;\nCREATE TABLE {$db_prefix}reply (\n  id int(10) unsigned NOT NULL auto_increment,\n  tid int(10) unsigned NOT NULL default '0',\n  date bigint(20) NOT NULL,\n  name varchar(20) NOT NULL default '',\n  content text NOT NULL,\n  hide enum('n','y') NOT NULL default 'n',\n  ip varchar(128) NOT NULL default '',\n  PRIMARY KEY  (id),\n  KEY gid (tid),\n  KEY hide (hide)\n)" . $table_charset_sql . "\nDROP TABLE IF EXISTS {$db_prefix}user;\nCREATE TABLE {$db_prefix}user (\n  uid int(10) unsigned NOT NULL auto_increment,\n  username varchar(32) NOT NULL default '',\n  password varchar(64) NOT NULL default '',\n  nickname varchar(20) NOT NULL default '',\n  role varchar(60) NOT NULL default '',\n  ischeck enum('n','y') NOT NULL default 'n',\n  photo varchar(255) NOT NULL default '',\n  email varchar(60) NOT NULL default '',\n  description varchar(255) NOT NULL default '',\nPRIMARY KEY  (uid),\nKEY username (username)\n)" . $table_charset_sql . "\nINSERT INTO {$db_prefix}user (uid, username, password, role) VALUES (1,'{$admin}','" . $adminpw . "','admin');";
 $array_sql = preg_split("/;[\r\n]/", $sql);
 foreach ($array_sql as $sql) {
     $sql = trim($sql);
     if ($sql) {
         $DB->query($sql);
     }
 }
 //重建缓存
 $CACHE->updateCache();
 $result .= "\n\t\t<p style=\"font-size:24px; border-bottom:1px solid #E6E6E6; padding:10px 0px;\">恭喜,安装成功!</p>\n\t\t<p>您的emlog已经安装好了,现在可以开始您的创作了,就这么简单!</p>\n\t\t<p><b>用户名</b>:{$admin}</p>\n\t\t<p><b>密 码</b>:您刚才设定的密码</p>";
 if (DEL_INSTALLER === 1 && !@unlink('./install.php') || DEL_INSTALLER === 0) {
     $result .= '<p style="color:red;margin:10px 20px;">警告:请手动删除根目录下安装文件:install.php</p> ';
 }
 $result .= "<p style=\"text-align:right;\"><a href=\"./\">访问首页</a> | <a href=\"./admin/\">登录后台</a></p>";
Esempio n. 2
0
doStripslashes();
$CACHE = Cache::getInstance();
$userData = array();
define('ISLOGIN', LoginAuth::isLogin());
//用户组:admin管理员, writer联合撰写人, visitor访客
define('ROLE_ADMIN', 'admin');
define('ROLE_WRITER', 'writer');
define('ROLE_VISITOR', 'visitor');
//用户角色
define('ROLE', ISLOGIN === true ? $userData['role'] : ROLE_VISITOR);
//用户ID
define('UID', ISLOGIN === true ? $userData['uid'] : '');
//站点固定地址
define('BLOG_URL', Option::get('blogurl'));
//模板库地址
define('TPLS_URL', BLOG_URL . 'content/templates/');
//模板库路径
define('TPLS_PATH', EMLOG_ROOT . '/content/templates/');
//解决前台多域名ajax跨域
define('DYNAMIC_BLOGURL', getBlogUrl());
//前台模板URL
define('TEMPLATE_URL', TPLS_URL . Option::get('nonce_templet') . '/');
$active_plugins = Option::get('active_plugins');
$emHooks = array();
if ($active_plugins && is_array($active_plugins)) {
    foreach ($active_plugins as $plugin) {
        if (true === checkPlugin($plugin)) {
            include_once EMLOG_ROOT . '/content/plugins/' . $plugin;
        }
    }
}