| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,79 @@ |
| 1 |
+<?php |
|
| 2 |
+$current = "challenges"; |
|
| 3 |
+include ("../../header.php");
|
|
| 4 |
+ |
|
| 5 |
+//make a new TemplatePower object |
|
| 6 |
+if(file_exists( "$skindir/default.tpl")) $tpl = new TemplatePower("$skindir/default.tpl" );
|
|
| 7 |
+else $tpl = new TemplatePower(_BASEDIR."default_tpls/default.tpl"); |
|
| 8 |
+$tpl->assignInclude( "header", "$skindir/header.tpl" ); |
|
| 9 |
+$tpl->assignInclude( "footer", "$skindir/footer.tpl" ); |
|
| 10 |
+include(_BASEDIR."includes/pagesetup.php"); |
|
| 11 |
+include_once(_BASEDIR."languages/".$language."_admin.php"); |
|
| 12 |
+if(file_exists("languages/".$language.".php")) include_once("languages/".$language.".php");
|
|
| 13 |
+else include_once("languages/en.php");
|
|
| 14 |
+if(!isADMIN) accessDenied( ); |
|
| 15 |
+$confirm = isset($_GET['confirm']) ? $_GET['confirm'] : false; |
|
| 16 |
+$table = dbassoc(dbquery("SHOW TABLES LIKE '".TABLEPREFIX."challenges'"));
|
|
| 17 |
+if($table) $output .= write_message(_ALREADYINSTALLED); |
|
| 18 |
+else {
|
|
| 19 |
+if($confirm == "yes") {
|
|
| 20 |
+ include("version.php");
|
|
| 21 |
+ dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_codeblocks`(`code_text`, `code_type`, `code_module`) VALUES ( 'include(_BASEDIR.\"modules/challenges/authorof.php\");', 'AO', 'challenges');");
|
|
| 22 |
+ dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_codeblocks`(`code_text`, `code_type`, `code_module`) VALUES ('include(_BASEDIR.\"modules/challenges/storyblock.php\");', 'storyblock', 'challenges');");
|
|
| 23 |
+ dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_codeblocks`(`code_text`, `code_type`, `code_module`) VALUES ('include(_BASEDIR.\"modules/challenges/seriesblock.php\");', 'seriesblock', 'challenges');");
|
|
| 24 |
+ dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_codeblocks`(`code_text`, `code_type`, `code_module`) VALUES ('include(_BASEDIR.\"modules/challenges/seriestitle.php\");', 'seriestitle', 'challenges');");
|
|
| 25 |
+ dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_codeblocks`(`code_text`, `code_type`, `code_module`) VALUES ('include(_BASEDIR.\"modules/challenges/adminfunctions.php\");', 'delchar', 'challenges');");
|
|
| 26 |
+ dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_codeblocks`(`code_text`, `code_type`, `code_module`) VALUES ('include(_BASEDIR.\"modules/challenges/adminfunctions.php\");', 'delcategory', 'challenges');");
|
|
| 27 |
+ dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_codeblocks`(`code_text`, `code_type`, `code_module`) VALUES ('include(_BASEDIR.\"modules/challenges/otherresults.php\");', 'otherresults', 'challenges');");
|
|
| 28 |
+ dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_codeblocks`(`code_text`, `code_type`, `code_module`) VALUES ( 'include(_BASEDIR.\"modules/challenges/deluser.php\");', 'deluser', 'challenges');");
|
|
| 29 |
+ dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_codeblocks`(`code_text`, `code_type`, `code_module`) VALUES ( 'include(_BASEDIR.\"modules/challenges/stats.php\");', 'sitestats', 'challenges');");
|
|
| 30 |
+ dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_modules(`name`, `version`) VALUES('$moduleName', '$moduleVersion')");
|
|
| 31 |
+ $proquery = dbquery("SELECT count(panel_id) FROM `".TABLEPREFIX."fanfiction_panels` WHERE panel_type = 'P' AND panel_hidden = '0'");
|
|
| 32 |
+ list($profiles) = dbrow($proquery); |
|
| 33 |
+ $profiles++; |
|
| 34 |
+ dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_panels` (`panel_name`, `panel_title`, `panel_url`, `panel_level`, `panel_order`, `panel_hidden`, `panel_type`) VALUES ('challengesby', 'Challenges by {author}', 'modules/challenges/challengesby.php', 0, $profiles, 0, 'P');");
|
|
| 35 |
+ $userquery = dbquery("SELECT count(panel_id) FROM `".TABLEPREFIX."fanfiction_panels` WHERE panel_type = 'U' AND panel_hidden = '0'");
|
|
| 36 |
+ list($userpanels) = dbrow($userquery); |
|
| 37 |
+ $userpanels++; |
|
| 38 |
+ dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_panels` (`panel_name`, `panel_title`, `panel_url`, `panel_level`, `panel_order`, `panel_hidden`, `panel_type`) VALUES ('challengesby', 'Your Challenges', 'modules/challenges/challengesby.php', 0, $userpanels, 0, 'U');");
|
|
| 39 |
+ $topquery = dbquery("SELECT count(panel_id) FROM `".TABLEPREFIX."fanfiction_panels` WHERE panel_type = 'L' AND panel_hidden = '0'");
|
|
| 40 |
+ list($listpanels) = dbrow($topquery); |
|
| 41 |
+ $listpanels++; |
|
| 42 |
+ dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_panels` (`panel_name` , `panel_title` , `panel_url` , `panel_level` , `panel_order` , `panel_hidden` , `panel_type` ) VALUES ('challenges', 'Top 10 Challenges', 'modules/challenges/topchallenges.php', '0', $listpanels, 0, 'L');");
|
|
| 43 |
+ $browsequery = dbquery("SELECT count(panel_id) FROM `".TABLEPREFIX."fanfiction_panels` WHERE panel_type = 'B' AND panel_hidden = '0'");
|
|
| 44 |
+ list($browse) = dbrow($browsequery); |
|
| 45 |
+ $browse++; |
|
| 46 |
+ dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_panels` (`panel_name` , `panel_title` , `panel_url` , `panel_level` , `panel_order` , `panel_hidden` , `panel_type` ) VALUES ('challenges', 'Challenges', 'modules/challenges/browse.php', '0', $browse, 0, 'B');");
|
|
| 47 |
+ dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_pagelinks` (`link_name`, `link_text`, `link_url`, `link_target`, `link_access`) VALUES ('challenges', 'Challenges', 'browse.php?type=challenges', '0', 0);");
|
|
| 48 |
+ dbquery("ALTER TABLE `".$settingsprefix."fanfiction_settings` ADD `anonchallenges` TINYINT( 1 ) NOT NULL");
|
|
| 49 |
+ dbquery("ALTER TABLE `".TABLEPREFIX."fanfiction_stories` ADD `challenges` varchar(200) NOT NULL default '0'");
|
|
| 50 |
+ $series = dbassoc(dbquery("SHOW COLUMNS FROM ".TABLEPREFIX."fanfiction_series LIKE 'challenges'"));
|
|
| 51 |
+ if(!$series) dbquery("ALTER TABLE `".TABLEPREFIX."fanfiction_series` ADD `challenges` varchar(200) NOT NULL default '0'");
|
|
| 52 |
+ dbquery("CREATE TABLE `".TABLEPREFIX."fanfiction_challenges` (
|
|
| 53 |
+ `chalid` int(11) NOT NULL auto_increment, |
|
| 54 |
+ `challenger` varchar(200) NOT NULL default '', |
|
| 55 |
+ `uid` int(11) NOT NULL default '0', |
|
| 56 |
+ `title` varchar(250) NOT NULL default '', |
|
| 57 |
+ `catid` varchar(200) NOT NULL default '', |
|
| 58 |
+ `characters` varchar(200) NOT NULL default '', |
|
| 59 |
+ `summary` text NOT NULL, |
|
| 60 |
+ `responses` int(11) NOT NULL default '0', |
|
| 61 |
+ PRIMARY KEY (`chalid`), |
|
| 62 |
+ KEY `title` (`catid`), |
|
| 63 |
+ KEY `uid` (`uid`), |
|
| 64 |
+ KEY `title_2` (`title`), |
|
| 65 |
+ KEY `characters` (`characters`) |
|
| 66 |
+ ) ENGINE=MyISAM;"); |
|
| 67 |
+ dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_modules`(`version`, `name`) VALUES('$moduleVersion', '$moduleName')");
|
|
| 68 |
+ $output = write_message(_ACTIONSUCCESSFUL); |
|
| 69 |
+} |
|
| 70 |
+else if($confirm == "no") {
|
|
| 71 |
+ $output = write_message(_ACTIONCANCELLED); |
|
| 72 |
+} |
|
| 73 |
+else {
|
|
| 74 |
+ $output = write_message(_CONFIRMINSTALL."<br /><a href='install.php?confirm=yes'>"._YES."</a> "._OR." <a href='install.php?confirm=no'>"._NO."</a>"); |
|
| 75 |
+} |
|
| 76 |
+} |
|
| 77 |
+$tpl->assign("output", $output);
|
|
| 78 |
+$tpl->printToScreen( ); |
|
| 79 |
+?> |
|
| 0 | 80 |
\ No newline at end of file |