📄 200_beta_1.php
字号:
// fix logo link
$logolink = $DB->query_first("SELECT value FROM " . TABLE_PREFIX . "mainsettings WHERE varname = 'logolink'");
if(strlen($logolink['value']))
{
$currentlogo = '<a href="' . $logolink['value'] . '">' . $currentlogo . '</a>';
}
// now update the logo
$DB->query("UPDATE " . TABLE_PREFIX . "mainsettings SET value = '" . addslashes($currentlogo) . "' WHERE varname = 'currentlogo'");
// now we can delete the previous logo settings
$DB->query("DELETE FROM " . TABLE_PREFIX . "mainsettings WHERE groupname = 'Logo Settings'");
// delete previous settings from plugins that had to do with user access (since everything is now handled by usergroups)
$DB->query("DELETE FROM " . TABLE_PREFIX . "pluginsettings WHERE pluginid = '2' AND title = 'Allow News Submission'");
$DB->query("DELETE FROM " . TABLE_PREFIX . "pluginsettings WHERE pluginid = '2' AND title = 'Guest News'");
$DB->query("DELETE FROM " . TABLE_PREFIX . "pluginsettings WHERE pluginid = '4' AND title = 'Members Only'");
$DB->query("DELETE FROM " . TABLE_PREFIX . "pluginsettings WHERE pluginid = '7' AND title = 'Allow only members to post comments:'");
$DB->query("DELETE FROM " . TABLE_PREFIX . "pluginsettings WHERE pluginid = '16' AND title = 'Allow Link Submission'");
$DB->query("DELETE FROM " . TABLE_PREFIX . "pluginsettings WHERE pluginid = '16' AND title = 'Guest Links'");
$DB->query("DELETE FROM " . TABLE_PREFIX . "pluginsettings WHERE pluginid = '17' AND title = 'Allow Image Submission'");
$DB->query("DELETE FROM " . TABLE_PREFIX . "pluginsettings WHERE pluginid = '17' AND title = 'Guest Images'");
// delete phrases from plugin settings that had to do with user access
$DB->query("DELETE FROM " . TABLE_PREFIX . "phrases WHERE pluginid = '4' AND defaultphrase = 'Sorry, you must be logged in to post messages.'");
$DB->query("DELETE FROM " . TABLE_PREFIX . "phrases WHERE pluginid = '7' AND defaultphrase = 'Sorry, you must be logged in to post messages.'");
$DB->query("DELETE FROM " . TABLE_PREFIX . "phrases WHERE pluginid = '11' AND defaultphrase = 'You must be logged in to view this page!'");
$DB->query("ALTER TABLE " . TABLE_PREFIX . "users ADD `lastactivity` INT( 10 ) UNSIGNED DEFAULT '0' NOT NULL");
$DB->query("CREATE TABLE " . TABLE_PREFIX . "sessions
(
sessionid CHAR(32) NOT NULL ,
userid INT(10) UNSIGNED DEFAULT '0' NOT NULL ,
ipaddress CHAR(15) NOT NULL ,
useragent CHAR(100) NOT NULL ,
lastactivity INT(10) UNSIGNED DEFAULT '0' NOT NULL ,
location CHAR(255) NOT NULL ,
loggedin TINYINT(1) NOT NULL ,
PRIMARY KEY (sessionid)
) ");
$DB->query("ALTER TABLE " . TABLE_PREFIX . "usersystems ADD cookietimeout INT( 10 ) UNSIGNED NOT NULL,
ADD cookieprefix VARCHAR( 32 ) NOT NULL,
ADD cookiedomain VARCHAR( 64 ) NOT NULL,
ADD cookiepath VARCHAR( 64 ) NOT NULL,
ADD extra VARCHAR( 64 ) NOT NULL");
// update news plugin
/* reference:
$articlebitfield = array('useglobalsettings' => 1,
'displayonline' => 2,
'displaytitle' => 4,
'displayauthor' => 8,
'displaycreateddate' => 16,
'displayupdateddate' => 32,
'displayprintarticlelink' => 64,
'displayemailarticlelink' => 128,
'displaydescription' => 256,
'displaysmilies' => 512,
'displaycomments' => 1024);
*/
$DB->query("ALTER TABLE " . TABLE_PREFIX . "p2_news ADD `settings` INT( 10 ) UNSIGNED NOT NULL AFTER `categoryid`");
$DB->query("ALTER TABLE " . TABLE_PREFIX . "p2_news ADD `views` INT( 10 ) UNSIGNED NOT NULL AFTER `settings`");
$DB->query("ALTER TABLE " . TABLE_PREFIX . "p2_news ADD `displayorder` INT( 10 ) UNSIGNED NOT NULL AFTER `views`");
// display title
$articlesettings = 4;
// display date updated
$articlesettings += 32;
if($printoption = $DB->query_first("SELECT settingid FROM " . TABLE_PREFIX . "pluginsettings WHERE title = 'Display Print Article Option' AND pluginid = 2 AND value = '1'"))
{
$articlesettings += 64;
}
if($emailoption = $DB->query_first("SELECT settingid FROM " . TABLE_PREFIX . "pluginsettings WHERE title = 'Display Email Article Option' AND pluginid = 2 AND value = '1'"))
{
$articlesettings += 128;
}
$articles = $DB->query("SELECT * FROM " . TABLE_PREFIX . "p2_news ORDER BY articleid ASC");
for($displayorder = 1; $article = $DB->fetch_array($articles); $displayorder++)
{
if($article['activated'] == 1)
{
$articlesettings += 2;
}
if($article['showauthor'] == 1)
{
$articlesettings += 8;
}
if($article['showdate'] == 1)
{
$articlesettings += 16;
}
if($article['allowsmilies'] == 1)
{
$articlesettings += 512;
}
if($article['allowcomments'] == 1)
{
$articlesettings += 1024;
}
// get rid of any description currently in the main article
if(preg_match("'<!--StartSdNewsDescription-->(.*)<!--EndSdNewsDescription-->'ms", $article['article']))
{
// don't insert the description in the article, this is now a setting
$article['article'] = preg_replace("'<!--StartSdNewsDescription-->(.*)<!--EndSdNewsDescription-->'ms", "", $article['article']);
// inset description into article
$articlesettings += 256;
}
$article['article'] = FormatText($article['article']);
$article['description'] = FormatText($article['description']);
$DB->query("UPDATE " . TABLE_PREFIX . "p2_news SET settings = '$articlesettings',
displayorder = '$displayorder',
description = '" . addslashes($article['description']) . "',
article = '" . addslashes($article['article']) . "'
WHERE articleid = '" . $article['articleid'] ."'");
}
$DB->query("ALTER TABLE " . TABLE_PREFIX . "p2_news DROP `activated`, DROP `allowsmilies`, DROP `allowcomments`, DROP `showauthor`, DROP `showdate`");
$DB->query("ALTER TABLE " . TABLE_PREFIX . "p2_news CHANGE `date` `datecreated` INT( 10 ) UNSIGNED DEFAULT '0' NOT NULL");
$DB->query("ALTER TABLE " . TABLE_PREFIX . "p2_news ADD `dateupdated` INT(10) UNSIGNED NOT NULL AFTER `datecreated`,
ADD `datestart` INT(10) UNSIGNED NOT NULL AFTER `dateupdated`,
ADD `dateend` INT(10) UNSIGNED NOT NULL AFTER `datestart`,
ADD `metadescription` TEXT NOT NULL AFTER `title` ,
ADD `metakeywords` TEXT NOT NULL AFTER `metadescription`");
// update, insert p2_news settings // no title, only descriptions
$DB->query("INSERT INTO " . TABLE_PREFIX . "pluginsettings VALUES ('0', '2', 'Article Display Settings', '', 'Display Title', 'yesno', '1', 1) ");
$DB->query("INSERT INTO " . TABLE_PREFIX . "pluginsettings VALUES ('0', '2', 'Article Display Settings', '', 'Display Author', 'yesno', '1', 2) ");
$DB->query("INSERT INTO " . TABLE_PREFIX . "pluginsettings VALUES ('0', '2', 'Article Display Settings', '', 'Display Creation Date', 'yesno', '1', 3) ");
$DB->query("INSERT INTO " . TABLE_PREFIX . "pluginsettings VALUES ('0', '2', 'Article Display Settings', '', 'Display Updated Date', 'yesno', '1', 4) ");
$DB->query("INSERT INTO " . TABLE_PREFIX . "pluginsettings VALUES ('0', '2', 'Article Display Settings', '', 'Display Print Article Link', 'yesno', '1', 5) ");
$DB->query("INSERT INTO " . TABLE_PREFIX . "pluginsettings VALUES ('0', '2', 'Article Display Settings', '', 'Display Email Article Link', 'yesno', '1', 6) ");
$DB->query("INSERT INTO " . TABLE_PREFIX . "pluginsettings VALUES ('0', '2', 'Article Display Settings', '', 'Display Description Inside Article', 'yesno', '0', 7) ");
$DB->query("INSERT INTO " . TABLE_PREFIX . "pluginsettings VALUES ('0', '2', 'Article Display Settings', '', 'Display Smilie Images', 'yesno', '1', 8) ");
$DB->query("INSERT INTO " . TABLE_PREFIX . "pluginsettings VALUES ('0', '2', 'Article Display Settings', '', 'Display User Comments', 'yesno', '1', 9) ");
$DB->query("DELETE FROM " . TABLE_PREFIX . "pluginsettings WHERE pluginid = '2' AND groupname = 'Options' AND title != 'Article Notification'");
$DB->query("UPDATE " . TABLE_PREFIX . "pluginsettings SET displayorder = '1' WHERE pluginid = '2' AND title = 'Article Notification'");
$DB->query("DELETE FROM " . TABLE_PREFIX . "mainsettings WHERE varname = 'allowcomments'");
$DB->query("UPDATE " . TABLE_PREFIX . "mainsettings SET value = 'F j, Y' WHERE varname = 'dateformat'");
$DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES ('0', 2, 'published', 'Published: ', '', '', '', '', '0', '0', '0') ");
$DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES ('0', 2, 'updated', 'Updated: ', '', '', '', '', '0', '0', '0') ");
// update p2_settings
$DB->query("UPDATE " . TABLE_PREFIX . "p2_settings SET sorting = 'title ASC' WHERE sorting = 'Alphabetically A-Z'");
$DB->query("UPDATE " . TABLE_PREFIX . "p2_settings SET sorting = 'title DESC' WHERE sorting = 'Alphabetically Z-A'");
$DB->query("UPDATE " . TABLE_PREFIX . "p2_settings SET sorting = 'author ASC' WHERE sorting = 'Author Name A-Z'");
$DB->query("UPDATE " . TABLE_PREFIX . "p2_settings SET sorting = 'author DESC' WHERE sorting = 'Author Name Z-A'");
$DB->query("UPDATE " . TABLE_PREFIX . "p2_settings SET sorting = 'articleid ASC' WHERE sorting = 'Oldest First'");
$DB->query("UPDATE " . TABLE_PREFIX . "p2_settings SET sorting = 'articleid DESC' WHERE sorting = 'Newest First'");
// update main settings
$DB->query("UPDATE " . TABLE_PREFIX . "mainsettings SET description = 'Format in which the date is presented:<br /><br />See: <a href=\'http://us2.php.net/manual/en/function.date.php\' target=\'_blank\'>http://us2.php.net/manual/en/function.date.php</a>' WHERE varname = 'dateformat'");
$DB->query("INSERT INTO " . TABLE_PREFIX . "mainsettings (settingid, varname, groupname, input, title, description, value)
VALUES ('0', 'modrewrite', 'Site Settings', 'yesno', 'Friendly URLs', 'If your server is running off of apache and has Mod Rewrite enabled, then you can turn this setting on to make your URLs more user friendly:', '0')");
$DB->query("INSERT INTO " . TABLE_PREFIX . "mainsettings (settingid, varname, groupname, input, title, description, value)
VALUES ('0', 'sdurl', 'Website URL', 'text', 'Website URL', 'Please enter the full URL to your Subdreamer website:<br /><br />This setting is very important and is required for Subdreamer to function correctly.<br /><br />Example: http://www.domain.com/', '')");
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -