From c2880a56c5df67c1a30cf2a07d38df890384fdea Mon Sep 17 00:00:00 2001 From: Kazuki Przyborowski Date: Sun, 12 Sep 2010 07:55:12 +0000 Subject: [PATCH] Small update: You can now resync sqlthemes. git-svn-id: svn://svn.code.sf.net/p/intdb/svn/trunk@542 2b68903e-0b30-0410-9a39-a2e4f3c5be39 --- admin.php | 5 +++-- inc/admin/main.php | 46 ++++++++++++++++++++++++++++++++++++++++++++-- inc/admin/table.php | 6 +++++- inc/html5.php | 11 ++++++++--- inc/versioninfo.php | 6 +++--- inc/xhtml10.php | 11 ++++++++--- inc/xhtml11.php | 12 +++++++++--- setup/sql/mysql.php | 4 ++-- setup/sql/pgsql.php | 4 ++-- setup/sql/sqlite.php | 4 ++-- 10 files changed, 86 insertions(+), 23 deletions(-) diff --git a/admin.php b/admin.php index 4e7d43c..200e35f 100644 --- a/admin.php +++ b/admin.php @@ -11,7 +11,7 @@ Copyright 2004-2010 iDB Support - http://idb.berlios.de/ Copyright 2004-2010 Game Maker 2k - http://gamemaker2k.org/ - $FileInfo: admin.php - Last Update: 06/07/2010 SVN 520 - Author: cooldude2k $ + $FileInfo: admin.php - Last Update: 09/12/2010 SVN 542 - Author: cooldude2k $ */ if(ini_get("register_globals")) { require_once('inc/misc/killglobals.php'); } @@ -73,7 +73,8 @@ if($_GET['act']=="settings"|| $_GET['act']=="sql"|| $_GET['act']=="info"|| $_GET['act']=="optimize"|| - $_GET['act']=="delsessions") + $_GET['act']=="delsessions"|| + $_GET['act']=="resyncthemes") { $AdminMenu = "main"; require($SettDir['admin'].'main.php'); } if($_GET['act']=="addforum"|| diff --git a/inc/admin/main.php b/inc/admin/main.php index 0dbcd8b..0fa1090 100644 --- a/inc/admin/main.php +++ b/inc/admin/main.php @@ -11,7 +11,7 @@ Copyright 2004-2010 iDB Support - http://idb.berlios.de/ Copyright 2004-2010 Game Maker 2k - http://gamemaker2k.org/ - $FileInfo: main.php - Last Update: 06/07/2010 SVN 520 - Author: cooldude2k $ + $FileInfo: main.php - Last Update: 09/12/2010 SVN 542 - Author: cooldude2k $ */ $File3Name = basename($_SERVER['SCRIPT_NAME']); if ($File3Name=="main.php"||$File3Name=="/main.php") { @@ -29,6 +29,7 @@ redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext']," ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); } if(!isset($_POST['update'])) { $_POST['update'] = null; } +if($_GET['act']=="resyncthemes"&&$Settings['SQLThemes']!="on") { $_GET['act'] = "view"; } $iDBRDate = $SVNDay[0]."/".$SVNDay[1]."/".$SVNDay[2]; $iDBRSVN = $VER2[2]." ".$SubVerN; $OutPutLog = null; @@ -107,7 +108,7 @@ if(!isset($Settings['start_date'])) { $Settings['start_date'] = GMTimeStamp(); } if(!isset($Settings['SQLThemes'])) { $Settings['SQLThemes'] = 'off'; } -if($Settings['SQLThemes']!="on"|| +if($Settings['SQLThemes']!="on"&& $Settings['SQLThemes']!="off") { $Settings['SQLThemes'] = 'off'; } ?> @@ -121,6 +122,47 @@ $time = GMTimeStamp() - ini_get("session.gc_maxlifetime"); //$sqlg = sql_pre_query('DELETE FROM \"'.$Settings['sqltable'].'sessions\" WHERE \"expires\" < UNIX_TIMESTAMP();', array(null)); $sqlgc = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."sessions\" WHERE \"expires\" < %i", array($time)); sql_query($sqlgc,$SQLStat); +$_GET['act'] = "optimize"; +$_POST['update'] = "now"; $_GET['act'] = "view"; } +if($_GET['act']=="resyncthemes"&&$GroupInfo['ViewDBInfo']=="yes"&&$Settings['SQLThemes']=="on") { +$time = GMTimeStamp() - ini_get("session.gc_maxlifetime"); +//$sqlg = sql_pre_query('DELETE FROM \"'.$Settings['sqltable'].'sessions\" WHERE \"expires\" < UNIX_TIMESTAMP();', array(null)); +if($Settings['sqltype']=="mysql"|| + $Settings['sqltype']=="mysqli") { +$sqlgc = sql_pre_query("TRUNCATE TABLE \"".$Settings['sqltable']."themes\"", array(null)); +sql_query($sqlgc,$SQLStat); +$sqlgc = sql_pre_query("ALTER TABLE \"".$Settings['sqltable']."themes\" AUTO_INCREMENT=1", array(null)); +sql_query($sqlgc,$SQLStat); } +if($Settings['sqltype']=="pgsql") { +$sqlgc = sql_pre_query("TRUNCATE TABLE \"".$Settings['sqltable']."themes\"", array(null)); +sql_query($sqlgc,$SQLStat); +$sqlgc = sql_pre_query("SELECT setval('".$Settings['sqltable']."themes_id_seq', 1, false);", array(null)); +sql_query($sqlgc,$SQLStat); } +if($Settings['sqltype']=="sqlite") { +$sqlgc = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."themes\";", array(null)); +sql_query($sqlgc,$SQLStat); } +$skindir = dirname(realpath("sql.php"))."/".$SettDir['themes']; +if ($handle = opendir($skindir)) { $dirnum = null; + while (false !== ($file = readdir($handle))) { + if ($dirnum==null) { $dirnum = 0; } + if (file_exists($skindir.$file."/info.php")) { + if ($file != "." && $file != "..") { + include($skindir.$file."/info.php"); + $themelist[$dirnum] = $file; + ++$dirnum; } } } + closedir($handle); asort($themelist); + $themenum=count($themelist); $themei=0; + while ($themei < $themenum) { + include($skindir.$themelist[$themei]."/settings.php"); + $query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."themes\" (\"Name\", \"ThemeName\", \"ThemeMaker\", \"ThemeVersion\", \"ThemeVersionType\", \"ThemeSubVersion\", \"MakerURL\", \"CopyRight\", \"CSS\", \"CSSType\", \"FavIcon\", \"TableStyle\", \"MiniPageAltStyle\", \"PreLogo\", \"Logo\", \"LogoStyle\", \"SubLogo\", \"TopicIcon\", \"MovedTopicIcon\", \"HotTopic\", \"MovedHotTopic\", \"PinTopic\", \"AnnouncementTopic\", \"MovedPinTopic\", \"HotPinTopic\", \"MovedHotPinTopic\", \"ClosedTopic\", \"MovedClosedTopic\", \"HotClosedTopic\", \"MovedHotClosedTopic\", \"PinClosedTopic\", \"MovedPinClosedTopic\", \"HotPinClosedTopic\", \"MovedHotPinClosedTopic\", \"MessageRead\", \"MessageUnread\", \"Profile\", \"WWW\", \"PM\", \"TopicLayout\", \"AddReply\", \"FastReply\", \"NewTopic\", \"QuoteReply\", \"EditReply\", \"DeleteReply\", \"Report\", \"LineDivider\", \"ButtonDivider\", \"LineDividerTopic\", \"TitleDivider\", \"ForumStyle\", \"ForumIcon\", \"SubForumIcon\", \"RedirectIcon\", \"TitleIcon\", \"NavLinkIcon\", \"NavLinkDivider\", \"StatsIcon\", \"NoAvatar\", \"NoAvatarSize\") VALUES\n". + "('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s');", array($themelist[$themei], $ThemeSet['ThemeName'], $ThemeSet['ThemeMaker'], $ThemeSet['ThemeVersion'], $ThemeSet['ThemeVersionType'], $ThemeSet['ThemeSubVersion'], $ThemeSet['MakerURL'], $ThemeSet['CopyRight'], $ThemeSet['CSS'], $ThemeSet['CSSType'], $ThemeSet['FavIcon'], $ThemeSet['TableStyle'], $ThemeSet['MiniPageAltStyle'], $ThemeSet['PreLogo'], $ThemeSet['Logo'], $ThemeSet['LogoStyle'], $ThemeSet['SubLogo'], $ThemeSet['TopicIcon'], $ThemeSet['MovedTopicIcon'], $ThemeSet['HotTopic'], $ThemeSet['MovedHotTopic'], $ThemeSet['PinTopic'], $ThemeSet['AnnouncementTopic'], $ThemeSet['MovedPinTopic'], $ThemeSet['HotPinTopic'], $ThemeSet['MovedHotPinTopic'], $ThemeSet['ClosedTopic'], $ThemeSet['MovedClosedTopic'], $ThemeSet['HotClosedTopic'], $ThemeSet['MovedHotClosedTopic'], $ThemeSet['PinClosedTopic'], $ThemeSet['MovedPinClosedTopic'], $ThemeSet['HotPinClosedTopic'], $ThemeSet['MovedHotPinClosedTopic'], $ThemeSet['MessageRead'], $ThemeSet['MessageUnread'], $ThemeSet['Profile'], $ThemeSet['WWW'], $ThemeSet['PM'], $ThemeSet['TopicLayout'], $ThemeSet['AddReply'], $ThemeSet['FastReply'], $ThemeSet['NewTopic'], $ThemeSet['QuoteReply'], $ThemeSet['EditReply'], $ThemeSet['DeleteReply'], $ThemeSet['Report'], $ThemeSet['LineDivider'], $ThemeSet['ButtonDivider'], $ThemeSet['LineDividerTopic'], $ThemeSet['TitleDivider'], $ThemeSet['ForumStyle'], $ThemeSet['ForumIcon'], $ThemeSet['SubForumIcon'], $ThemeSet['RedirectIcon'], $ThemeSet['TitleIcon'], $ThemeSet['NavLinkIcon'], $ThemeSet['NavLinkDivider'], $ThemeSet['StatsIcon'], $ThemeSet['NoAvatar'], $ThemeSet['NoAvatarSize'])); + sql_query($query,$SQLStat); + ++$themei; } } +$themequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."themes\" WHERE \"Name\"='%s'", array($_GET['theme'])); +$themeresult=sql_query($themequery,$SQLStat); +$themenum=sql_num_rows($themeresult); +require($SettDir['inc'].'sqlthemes.php'); +$_GET['act'] = "optimize"; $_POST['update'] = "now"; $_GET['act'] = "view"; } if($_GET['act']=="optimize"&&$GroupInfo['ViewDBInfo']=="yes") { $TablePreFix = $Settings['sqltable']; diff --git a/inc/admin/table.php b/inc/admin/table.php index 028031e..7e6bd5f 100644 --- a/inc/admin/table.php +++ b/inc/admin/table.php @@ -64,15 +64,19 @@ if ($File3Name=="table.php"||$File3Name=="/table.php") { ">SQL Settings " onclick="window.open(this.href);return false;">Version Checker - + ">SQL Dumper ">Clean Sessions + + +">Resync Themes + ">Optimize Tables diff --git a/inc/html5.php b/inc/html5.php index 8737b60..b899651 100644 --- a/inc/html5.php +++ b/inc/html5.php @@ -11,7 +11,7 @@ Copyright 2004-2010 iDB Support - http://idb.berlios.de/ Copyright 2004-2010 Game Maker 2k - http://gamemaker2k.org/ - $FileInfo: html5.php - Last Update: 05/15/2010 SVN 491 - Author: cooldude2k $ + $FileInfo: html5.php - Last Update: 09/12/2010 SVN 542 - Author: cooldude2k $ */ $File3Name = basename($_SERVER['SCRIPT_NAME']); if ($File3Name=="xhtml10.php"||$File3Name=="/xhtml10.php") { @@ -38,7 +38,8 @@ if($checklowview===true&&$_GET['act']=="lowview") { if($ThemeSet['CSSType']!="import"&& $ThemeSet['CSSType']!="link"&& $ThemeSet['CSSType']!="lowview"&& - $ThemeSet['CSSType']!="xml") { + $ThemeSet['CSSType']!="xml"&& + $ThemeSet['CSSType']!="sql") { $ThemeSet['CSSType'] = "import"; } header("Content-Style-Type: text/css"); header("Content-Script-Type: text/javascript"); @@ -113,7 +114,11 @@ if($Settings['html_level']!="Strict") { + + + diff --git a/inc/versioninfo.php b/inc/versioninfo.php index d7908e7..910f04b 100644 --- a/inc/versioninfo.php +++ b/inc/versioninfo.php @@ -11,7 +11,7 @@ Copyright 2004-2010 iDB Support - http://idb.berlios.de/ Copyright 2004-2010 Game Maker 2k - http://gamemaker2k.org/ - $FileInfo: versioninfo.php - Last Update: 09/11/2010 SVN 541 - Author: cooldude2k $ + $FileInfo: versioninfo.php - Last Update: 09/12/2010 SVN 542 - Author: cooldude2k $ */ $File3Name = basename($_SERVER['SCRIPT_NAME']); if ($File3Name=="versioninfo.php"||$File3Name=="/versioninfo.php") { @@ -27,8 +27,8 @@ function version_info($proname,$subver,$ver,$supver,$reltype,$svnver,$showsvn) { return $return_var; } // Version number and date stuff. :P $VER1[0] = 0; $VER1[1] = 4; $VER1[2] = 1; $VERFull[1] = $VER1[0].".".$VER1[1].".".$VER1[2]; -$VER2[0] = "Alpha"; $VER2[1] = "Al"; $VER2[2] = "SVN"; $SubVerN = 541; $RName = "iDB"; $SFName = "IntDB"; -$SVNDay[0] = 09; $SVNDay[1] = 11; $SVNDay[2] = 2010; $SVNDay[3] = $SVNDay[0]."/".$SVNDay[1]."/".$SVNDay[2]; +$VER2[0] = "Alpha"; $VER2[1] = "Al"; $VER2[2] = "SVN"; $SubVerN = 542; $RName = "iDB"; $SFName = "IntDB"; +$SVNDay[0] = 09; $SVNDay[1] = 12; $SVNDay[2] = 2010; $SVNDay[3] = $SVNDay[0]."/".$SVNDay[1]."/".$SVNDay[2]; $VerInfo['iDB_Ver'] = version_info($RName,$VER1[0],$VER1[1],$VER1[2],$VER2[1],$SubVerN,false); $VerInfo['iDB_Ver_SVN'] = version_info($RName,$VER1[0],$VER1[1],$VER1[2],$VER2[1],$SubVerN,true); $VerInfo['iDB_Full_Ver'] = version_info($RName,$VER1[0],$VER1[1],$VER1[2],$VER2[0],$SubVerN,false); diff --git a/inc/xhtml10.php b/inc/xhtml10.php index d9d98c9..74c6b5d 100644 --- a/inc/xhtml10.php +++ b/inc/xhtml10.php @@ -11,7 +11,7 @@ Copyright 2004-2010 iDB Support - http://idb.berlios.de/ Copyright 2004-2010 Game Maker 2k - http://gamemaker2k.org/ - $FileInfo: xhtml10.php - Last Update: 05/15/2010 SVN 491 - Author: cooldude2k $ + $FileInfo: xhtml10.php - Last Update: 09/12/2010 SVN 542 - Author: cooldude2k $ */ $File3Name = basename($_SERVER['SCRIPT_NAME']); if ($File3Name=="xhtml10.php"||$File3Name=="/xhtml10.php") { @@ -57,7 +57,8 @@ if($checklowview===true&&$_GET['act']=="lowview") { if($ThemeSet['CSSType']!="import"&& $ThemeSet['CSSType']!="link"&& $ThemeSet['CSSType']!="lowview"&& - $ThemeSet['CSSType']!="xml") { + $ThemeSet['CSSType']!="xml"&& + $ThemeSet['CSSType']!="sql") { $ThemeSet['CSSType'] = "import"; } if($ThemeSet['CSSType']=="xhtml") { xml_tag_make("xml-stylesheet","type=text/css&href=".$ThemeSet['CSS']); } @@ -148,7 +149,11 @@ if($Settings['html_level']=="Strict") { ?> + + + diff --git a/inc/xhtml11.php b/inc/xhtml11.php index 7ff8e02..ab4e1cc 100644 --- a/inc/xhtml11.php +++ b/inc/xhtml11.php @@ -11,7 +11,7 @@ Copyright 2004-2010 iDB Support - http://idb.berlios.de/ Copyright 2004-2010 Game Maker 2k - http://gamemaker2k.org/ - $FileInfo: xhtml11.php - Last Update: 05/15/2010 SVN 491 - Author: cooldude2k $ + $FileInfo: xhtml11.php - Last Update: 09/12/2010 SVN 542 - Author: cooldude2k $ */ $File3Name = basename($_SERVER['SCRIPT_NAME']); if ($File3Name=="xhtml11.php"||$File3Name=="/xhtml11.php") { @@ -60,7 +60,8 @@ if($checklowview===true&&$_GET['act']=="lowview") { if($ThemeSet['CSSType']!="import"&& $ThemeSet['CSSType']!="link"&& $ThemeSet['CSSType']!="lowview"&& - $ThemeSet['CSSType']!="xml") { + $ThemeSet['CSSType']!="xml"&& + $ThemeSet['CSSType']!="sql") { $ThemeSet['CSSType'] = "import"; } if($ThemeSet['CSSType']=="xhtml") { xml_tag_make("xml-stylesheet","type=text/css&href=".$ThemeSet['CSS']); } @@ -139,7 +140,12 @@ if($Settings['idburl']!="localhost"&&$Settings['idburl']!=null) { + + + + diff --git a/setup/sql/mysql.php b/setup/sql/mysql.php index 2e49e30..752b005 100644 --- a/setup/sql/mysql.php +++ b/setup/sql/mysql.php @@ -12,7 +12,7 @@ Copyright 2004-2010 Game Maker 2k - http://gamemaker2k.org/ iDB Installer made by Game Maker 2k - http://idb.berlios.net/ - $FileInfo: mysql.php - Last Update: 09/11/2010 SVN 538 - Author: cooldude2k $ + $FileInfo: mysql.php - Last Update: 09/12/2010 SVN 542 - Author: cooldude2k $ */ $File3Name = basename($_SERVER['SCRIPT_NAME']); if ($File3Name=="mysql.php"||$File3Name=="/mysql.php") { @@ -326,7 +326,7 @@ $query=sql_pre_query("CREATE TABLE IF NOT EXISTS \"".$_POST['tableprefix']."them " \"ThemeSubVersion\" varchar(150) COLLATE ".$SQLCollate." NOT NULL default '',\n". " \"MakerURL\" varchar(150) COLLATE ".$SQLCollate." NOT NULL default '',\n". " \"CopyRight\" varchar(150) COLLATE ".$SQLCollate." NOT NULL default '',\n". -" \"CSS\" varchar(150) COLLATE ".$SQLCollate." NOT NULL default '',\n". +" \"CSS\" text COLLATE ".$SQLCollate." NOT NULL,\n". " \"CSSType\" varchar(150) COLLATE ".$SQLCollate." NOT NULL default '',\n". " \"FavIcon\" varchar(150) COLLATE ".$SQLCollate." NOT NULL default '',\n". " \"TableStyle\" varchar(150) COLLATE ".$SQLCollate." NOT NULL default '',\n". diff --git a/setup/sql/pgsql.php b/setup/sql/pgsql.php index 49c7134..74ddd16 100644 --- a/setup/sql/pgsql.php +++ b/setup/sql/pgsql.php @@ -12,7 +12,7 @@ Copyright 2004-2010 Game Maker 2k - http://gamemaker2k.org/ iDB Installer made by Game Maker 2k - http://idb.berlios.net/ - $FileInfo: pgsql.php - Last Update: 09/11/2010 SVN 538 - Author: cooldude2k $ + $FileInfo: pgsql.php - Last Update: 09/12/2010 SVN 542 - Author: cooldude2k $ */ $File3Name = basename($_SERVER['SCRIPT_NAME']); if ($File3Name=="pgsql.php"||$File3Name=="/pgsql.php") { @@ -315,7 +315,7 @@ $query=sql_pre_query("CREATE TABLE \"".$_POST['tableprefix']."themes\" (\n". " \"ThemeSubVersion\" varchar(150) NOT NULL default '',\n". " \"MakerURL\" varchar(150) NOT NULL default '',\n". " \"CopyRight\" varchar(150) NOT NULL default '',\n". -" \"CSS\" varchar(150) NOT NULL default '',\n". +" \"CSS\" text NOT NULL,\n". " \"CSSType\" varchar(150) NOT NULL default '',\n". " \"FavIcon\" varchar(150) NOT NULL default '',\n". " \"TableStyle\" varchar(150) NOT NULL default '',\n". diff --git a/setup/sql/sqlite.php b/setup/sql/sqlite.php index 79c22b2..0d001d2 100644 --- a/setup/sql/sqlite.php +++ b/setup/sql/sqlite.php @@ -12,7 +12,7 @@ Copyright 2004-2010 Game Maker 2k - http://gamemaker2k.org/ iDB Installer made by Game Maker 2k - http://idb.berlios.net/ - $FileInfo: sqlite.php - Last Update: 09/11/2010 SVN 538 - Author: cooldude2k $ + $FileInfo: sqlite.php - Last Update: 09/12/2010 SVN 542 - Author: cooldude2k $ */ $File3Name = basename($_SERVER['SCRIPT_NAME']); if ($File3Name=="sqlite.php"||$File3Name=="/sqlite.php") { @@ -382,7 +382,7 @@ $query=sql_pre_query("CREATE TABLE \"".$_POST['tableprefix']."themes\" (\n". " \"ThemeSubVersion\" VARCHAR(150) NOT NULL default '',\n". " \"MakerURL\" VARCHAR(150) NOT NULL default '',\n". " \"CopyRight\" VARCHAR(150) NOT NULL default '',\n". -" \"CSS\" VARCHAR(150) NOT NULL default '',\n". +" \"CSS\" TEXT NOT NULL,\n". " \"CSSType\" VARCHAR(150) NOT NULL default '',\n". " \"FavIcon\" VARCHAR(150) NOT NULL default '',\n". " \"TableStyle\" VARCHAR(150) NOT NULL default '',\n". -- 2.11.0