discuss.php

Go to the documentation of this file.
00001 <?PHP
00059 $modules_names[] = "Discuss";
00060 $mopules_versions[] = "0.1";
00061 $modules_descriptions[] = "Manages discussion forums";
00062 
00063 $modules_setup[] = "modulesetup_discuss";
00064 
00065 $modules_globalID[] = "globalID_discuss";
00066 
00067 $profilemodules[] = "profilemodule_discuss";
00068 
00069 $modules[] = "parse_discusssection";
00070 $modules[] = "parse_discussforum";
00071 $modules[] = "parse_discussthread";
00072 
00073 $page_help["\\discuss(txt1)"] = "This will show the discussion section named txt1";
00074 $page_help["\\discussforum(txt1,txt2)"] = "This will show the forum named txt2 in the section txt1";
00075 $page_help["\\discussthread(txt1,txt2,txt3)"] = "This will show the thread with ID txt3 in the forum named txt2 in the section txt1";
00076 
00077 $meta_headers .= "
00078         <link rel=\"StyleSheet\" href=\"" . siteURL(true) . "$module_folder/discuss/discuss.css\" type=\"text/css\" />";
00079 
00080 // Usergroup defaults {
00081 $usergroups_global_default["modules_discuss_admin"] = false; // Let users view posts in new forums by default
00082 // Usergroup defaults }
00083 
00084 $discussDirectory = "$module_folder/discuss";
00085 $discussContentDirectory  = "$discussDirectory/sections";
00086 
00087 if( file_exists( "$discussDirectory/options.php" ) )
00088 {
00089         include( "$discussDirectory/options.php" );
00090 }
00091 else
00092 {
00093         $discuss_options = array(
00094                 "page_id" => 12, // If the user's not set anything up yet - show him the way back to module setup!
00095                 "title" => "Travelsized Discussions",
00096                 "header" => ">>//Where people can talk//",
00097                 "footer" => "---\nDiscussions for Travelsized Websites",
00098                 "sectionPositions" => array(),
00099                 "forumdefaults" => array(
00100                         "viewLevel" => 1,
00101                         "postLevel" => 2,
00102                 ),
00103                 "sectiondefaults" => array(
00104                         "viewLevel" => 1,
00105                 ),
00106         );
00107 }
00108 
00109 $discuss_allowanceLevels = array(
00110         1 => "Everybody",
00111         2 => "Only registered users",
00112         3 => "Only moderators"
00113 );
00114 
00115 $discuss_defaultoptions = array(
00116         "user" => array(
00117                 "viewLevel" => 0,
00118                 "replyLevel" => 1,
00119                 "editLevel" => 4
00120                 )
00121 );
00122 
00123 include("$module_folder/discuss/code/discuss_userPosts.php");
00124 include("$module_folder/discuss/code/discussThread.php");
00125 include("$module_folder/discuss/code/discussForum.php");
00126 include("$module_folder/discuss/code/discussSection.php");
00127 
00128 function profilemodule_discuss()
00129 {
00130         global $tabwidget, $globalID, $setup_folder, $userinfo_folder, $language, $languages, $permissionlevels_array, $blogcategories, $formatting_toolbar, $discuss_options, $viewUser;
00131         
00132         $splitID = explode( "/", $globalID );
00133         
00134         if( $splitID[3] == "edit" && ( isAllowed( "global_user_edit" ) || ( $viewUser != "" && $viewUser == currentUser() ) ) )
00135         {
00136                 $tabwidget->addCommand( i18n("View"), i18n("View ##0##'s most recent posts", array( currentUser() ) ), globalIDtoURL("user/$viewUser/discuss") );
00137                 
00138                 // Set up options
00139                         // Default options for my new posts (also, check for with remember these settings during post creation)
00140                         // View options- discuss_verboseListings
00141                 
00142                 $discuss_verboseListings = getUserInfo( $viewUser, "discuss_verboseListings" );
00143                 $discussOptions["viewLevel"] = getUserInfo( $viewUser, "discuss_viewLevel" );
00144                 $discussOptions["replyLevel"] = getUserInfo( $viewUser, "discuss_replyLevel" );
00145                 $discussOptions["editLevel"] = getUserInfo( $viewUser, "discuss_editLevel" );
00146                 if( $_POST["saveOptions"] )
00147                 {
00148                         $discuss_verboseListings = $_POST["discussOptions"]["verboseListings"] ? 1 : 0;
00149                         saveUserInfo( $viewUser, "discuss_verboseListings", $discuss_verboseListings );
00150                         
00151                         $discussOptions["viewLevel"] = $_POST["discussOptions"]["viewLevel"];
00152                         saveUserInfo( $viewUser, "discuss_viewLevel", $discussOptions["viewLevel"] );
00153                         
00154                         $discussOptions["replyLevel"] = $_POST["discussOptions"]["replyLevel"];
00155                         saveUserInfo( $viewUser, "discuss_replyLevel", $discussOptions["replyLevel"] );
00156                         
00157                         $discussOptions["editLevel"] = $_POST["discussOptions"]["editLevel"];
00158                         saveUserInfo( $viewUser, "discuss_editLevel", $discussOptions["editLevel"] );
00159                 }
00160                 
00161                 $discussProfileOptions = new optionsPanel( "discussOptions" );
00162                 
00163                 $discussProfileOptions->addOption(
00164                                 i18n("Hide verbose listings"),
00165                                 i18n("Hide the verbose information in the forum listings, such as last poster, creator, "),
00166                                 $discuss_verboseListings,
00167                                 "verboseListings",
00168                                 "checkbox"
00169                         );
00170                 
00171                 $discussProfileOptions->addOption(
00172                                 i18n("Default view level for new posts"),
00173                                 i18n("The view level that is used for when you create new posts in the forum"),
00174                                 $discussOptions["viewLevel"],
00175                                 "viewLevel",
00176                                 "select",
00177                                 $permissionlevels_array
00178                         );
00179                 $discussProfileOptions->addOption(
00180                                 i18n("Default reply level for new posts"),
00181                                 i18n("The reply level that is used for when you create new posts in the forum"),
00182                                 $discussOptions["replyLevel"],
00183                                 "replyLevel",
00184                                 "select",
00185                                 $permissionlevels_array
00186                         );
00187                 $discussProfileOptions->addOption(
00188                                 i18n("Default edit level for new posts"),
00189                                 i18n("The edit level that is used for when you create new posts in the forum"),
00190                                 $discussOptions["editLevel"],
00191                                 "editLevel",
00192                                 "select",
00193                                 $permissionlevels_array
00194                         );
00195                 
00196                 $data =
00197                                 "<form action=\"" . thisPageURL() . "\" method=\"POST\">" .
00198                                 $discussProfileOptions->render() .
00199                                 "</form>";
00200         }
00201         else
00202         {
00203                 $tabwidget->addCommand( i18n("Options"), i18n("Options for Discuss" ), globalIDtoURL( "user/$viewUser/discuss/edit") );
00204                 // Get all of the threads listed...
00205                 $tempPosts = new discuss_userPosts( $viewUser );
00206                 
00207                 // Render each thread into $data
00208                 if( $tempPosts->postcount() < 1 )
00209                         $data = renderInformationBox( i18n("No posts"), i18n("This user has not yet made any posts in the forum. When they do, this will show a list of the posts made by them or replied to by them.") );
00210                 else
00211                 {
00212                         $data = renderInformationBox( i18n("Last ##0## posts", array( $tempPosts->postcount() ) ), i18n("Bellow is a list of the ##0## posts made by ##1##. Click on each of them to go to the post.", array( $tempPosts->postcount(), getUserInfo( currentUser(), "name" ) ) ) );
00213                         foreach( $tempPosts->posts as $key => $post )
00214                         {
00215                                 $tempURL = globalIDtoURL("discuss/" . $post["sectionID"] . "/" . $post["forumID"] . "/" . $post["threadID"]);
00216                                 
00217                                 if( $post["commentID"] != "" )
00218                                         $tempURL .= "#" . $post["commentID"];
00219                                 
00220                                 $data .= "<div class=\"discuss_threadHeader\"><a
00221                                         href=\"$tempURL\" class=\"discuss_threadHeader\"><span
00222                                         class=\"discuss_threadLink\">" . i18n("Go") . " &raquo;</span><span
00223                                         class=\"discuss_threadTitle\">{$post['title']}</span><span
00224                                         class=\"discuss_threadDescription\">" . i18n("Posted on: ##0##", array(formatTime($post["timestamp"])) ) . "</span></a></div>";
00225                         }
00226                 }
00227         }
00228         return $data;
00229 }
00230 
00231 function parse_discusssection( $page_data )
00232 {
00233         global $setup_folder;
00234 
00235         $moduleCommandName = "discuss";
00236         while( $parameters = spotModuleCommand( $page_data, $moduleCommandName, &$loopcontrol ) )
00237         {
00238                 $theSection = new discussSection($parameters);
00239                 $replaceData = $theSection->render();
00240                 $page_data = str_replace( "\\$moduleCommandName($parameters)", $replaceData, $page_data );
00241         }
00242         return $page_data;
00243 }
00244 
00245 function parse_discussforum( $page_data )
00246 {
00247         global $setup_folder;
00248 
00249         $moduleCommandName = "discussforum";
00250         while( ( $parameters = spotModuleCommand( $page_data, $moduleCommandName, &$loopcontrol ) ) === true )
00251         {
00252                 $replaceData = "";
00253                 $page_data = str_replace( "\\$moduleCommandName($parameters)", $replaceData, $page_data );
00254         }
00255         return $page_data;
00256 }
00257 
00258 function parse_discussthread( $page_data )
00259 {
00260         global $setup_folder;
00261 
00262         $moduleCommandName = "discussthread";
00263         while( ( $parameters = spotModuleCommand( $page_data, $moduleCommandName, &$loopcontrol ) ) === true )
00264         {
00265                 $replaceData = "";
00266                 $page_data = str_replace( "\\$moduleCommandName($parameters)", $replaceData, $page_data );
00267         }
00268         return $page_data;
00269 }
00270 
00278 function globalID_discuss( $splitID )
00279 {
00280         global $discuss_options;
00281         $pageID = null;
00282         
00283         list($toplevel, $sectionID, $forumID, $threadID ) = split( "/", $globalID );
00284         
00285         if( $splitID[0] == "discuss" )
00286         {
00287                 $_REQUEST["page_id"] = $discuss_options["page_id"];
00288                 if( $splitID[1] != "" )
00289                 {
00290                         $_REQUEST["discuss_sectionID"] = $splitID[1];
00291                         if( $splitID[2] != "" )
00292                         {
00293                                 $_REQUEST["discuss_forumID"] = $splitID[2];
00294                                 if( $splitID[3] != "" )
00295                                         $_REQUEST["discuss_threadID"] = $splitID[3];
00296                         }
00297                 }
00298                 $pageID = $_REQUEST["page_id"];
00299         }
00300         else if( $splitID[0] == "user" && $splitID[2] == "discuss" )
00301         {
00302                 $pageID = "13";
00303                 $_REQUEST["module"] = "profilemodule_discuss";
00304         }
00305         
00306         return $pageID;
00307 }
00308 
00314 function discuss_rebuildUserCache()
00315 {
00316         global $discuss_options;
00317         
00318         // First, clear out all existing cache
00319         $allUsers = allUsersArray();
00320         foreach( $allUsers as $key => $username )
00321         {
00322                 $userposts[$username] = new discuss_userposts( $username );
00323                 $userposts[$username]->posts = array();
00324         }
00325         
00326         // Go through each section
00327         foreach( $discuss_options["sectionPositions"] as $position => $sectionID )
00328         {
00329                 $theSection = new discussSection( $sectionID );
00330                 // and each forum in that section
00331                 foreach( $theSection->forums as $key => $theForum )
00332                 {
00333                         $theForum->loadThreads();
00334                         
00335                         //And rebuild the cache for all posts in those, item by item.
00336                         foreach( $theForum->threads as $position => $thread )
00337                         {
00338                                 // We can only do this... if the user is registered!
00339                                 if( array_key_exists( $thread->owner, $userposts ) )
00340                                 {
00341                                         $postdata["sectionID"] = $thread->sectionID;
00342                                         $postdata["forumID"] = $thread->forumID;
00343                                         $postdata["threadID"] = $thread->threadID;
00344                                         $postdata["title"] = $thread->title;
00345                                         $postdata["timestamp"] = $thread->lastChanged;
00346                                         $postdata["viewLevel"] = $thread->viewLevel;
00347                                         $userposts[$thread->owner]->rotate($postdata);
00348                                 }
00349                                 
00350                                 // Make sure to get the replies as well!
00351                                 discuss_rebuildDeep( &$userposts, $thread->replies, &$thread );
00352                         }
00353                 }
00354         }
00355 }
00356 
00362 function discuss_rebuildDeep($userposts, $replies, $thread, $commentID = "")
00363 {
00364         foreach( $replies as $timestamp => $comment )
00365         {
00366                 // We can only do this... if the user is registered!
00367                 if( array_key_exists( $comment["name"], $userposts ) )
00368                 {
00369                         $postdata["sectionID"] = $thread->sectionID;
00370                         $postdata["forumID"] = $thread->forumID;
00371                         $postdata["threadID"] = $thread->threadID;
00372                         $postdata["commentID"] = $commentID . "[$timestamp]";
00373                         $postdata["title"] = i18n("[Commented] ##0##", array($thread->title));
00374                         $postdata["viewLevel"] = $thread->viewLevel;
00375                         $postdata["timestamp"] = $timestamp;
00376                         
00377                         $userposts[$comment["name"]]->rotate( $postdata );
00378                 }
00379                 
00380                 if( array_key_exists( "comments", $comment ) )
00381                         discuss_rebuildDeep( &$userposts, $comment["comments"], &$thread, $commentID . "[$timestamp][comments]" );
00382         }
00383 }
00384 
00385 function discuss_saveOptions()
00386 {
00387         global $discussDirectory, $discuss_options;
00388         
00389         if( file_exists( "$discussDirectory/options.php" ) )
00390                 unlink( "$discussDirectory/options.php" );
00391         
00392         if( !is_dir( $discussDirectory ) )
00393                 mkdir( $discussDirectory );
00394         
00395         file_put_contents( "$discussDirectory/options.php", array_export( $discuss_options, "discuss_options" ) );
00396 }
00397 
00398 function modulesetup_discuss()
00399 {
00400         global $pagectl, $setup_folder, $page_folder, $recent_file, $menu_folder, $discussDirectory, $discussContentDirectory, $discuss_options, $discuss_allowanceLevels, $language, $default_language, $theModuleSection, $theModuleSubsection, $theModuleAction;
00401         if( isAllowed( "modules_discuss_admin" ) )
00402         {
00403                 $discussSetup = new TabWidget;
00404                 $discussSetup->tabbar->addTab(i18n("Forum Setup"), globalIDtoURL("setup/modulesetup/discuss/setup"));
00405                 $discussSetup->tabbar->addTab(i18n("Options"), globalIDtoURL("setup/modulesetup/discuss/options"));
00406                 
00407                 switch( $theModuleSection )
00408                 {
00409                 // Import
00410                 case "import":
00411                         switch( $theModuleSubsection )
00412                         {
00413                         // First, ask user confirmation to clear everything already in the forum... Need a clean slate to work with
00414                         case "":
00415                                 break;
00416                         // Then get which importer to use
00417                         case "":
00418                                 break;
00419                         // Perform actions according to that importer
00420                         default:
00421                                 break;
00422                         }
00423                         break;
00424                 // Options:
00425                 case "options":
00426                         $discussSetup->tabbar->setCurrent( i18n( "Options" ) );
00427                         
00428                         if( $theModuleAction == "create_forum_page" )
00429                         {
00430                                 // Create the page to save the forum to!
00431                                 $edit_page["id"] = $pagectl->getFreePageID($page_folder, $pagectl);
00432                                 $edit_page["title"] = $discuss_options["title"];
00433                                 $edit_page["menu"] = $discuss_options["menu_id"];
00434                                 $edit_page["language"] = $default_language;
00435                                 $edit_page["content"] = i18n("Write the forum structure to this page by going to the Discuss management in Site Setup...");
00436                                 $edit_page["author"] = getUserInfo(currentUser(), "name");
00437                                 $edit_page["email"] = getUserInfo(currentUser(), "email");
00438                                 
00439                                 unlink_multiple( "$page_folder/{$edit_page['id']}.*" );
00440                                 
00441                                 if ($pagectl->savePageData($page_folder, $edit_page["id"], $edit_page["language"], $edit_page["author"], $edit_page["email"], $discuss_options["menu_id"], $edit_page["title"], $edit_page["content"])) {
00442                                         $page_content = parse_page_data(i18n("The page was saved."));
00443                                         update_getpage_id($page_folder, $setup_folder, $pagectl);
00444                                         rotate_recent($edit_page["id"], $edit_page["title"], $edit_page["language"], date("j/n/y"), $recent_file);
00445                                         
00446                                         $discuss_options["page_id"] = $edit_page["id"];
00447                                         if( file_exists( "$discussDirectory/options.php" ) )
00448                                                 unlink( "$discussDirectory/options.php" );
00449                                         
00450                                         if( !is_dir( $discussDirectory ) )
00451                                                 mkdir( $discussDirectory );
00452                                         
00453                                         file_put_contents( "$discussDirectory/options.php", array_export( $discuss_options, "discuss_options" ) );
00454                                         
00455                                         header("Location: " . globalIDtoURL("setup/modulesetup/discuss/options"));
00456                                 } else {
00457                                         $error_description = parse_page_data(i18n("The discuss page could not be saved!"));
00458                                 }
00459                         }
00460                         else if( $_POST["saveOptions"] )
00461                         {
00462                                 $discuss_options["page_id"] = $_POST["discuss"]["page_id"];
00463                                 $discuss_options["menu_id"] = $_POST["discuss"]["menu_id"];
00464                                 $discuss_options["sectiondefaults"]["viewLevel"] = $_POST["discuss"]["sectiondefaults"]["viewLevel"] ? 1 : 0;
00465                                 $discuss_options["forumdefaults"]["viewLevel"] = $_POST["discuss"]["forumdefaults"]["viewLevel"];
00466                                 $discuss_options["forumdefaults"]["postLevel"] = $_POST["discuss"]["forumdefaults"]["postLevel"];
00467                                 $discuss_options["title"] = stripslashes($_POST["discuss"]["title"]);
00468                                 $discuss_options["header"] = stripslashes($_POST["discuss"]["header"]);
00469                                 $discuss_options["footer"] = stripslashes($_POST["discuss"]["footer"]);
00470                                 
00471                                 discuss_saveOptions();
00472                         }
00473                         
00474                         $discussOptionsPanel = new optionsPanel("discuss");
00475                         
00476                         $pagelist = $pagectl->fetchPageList($page_folder);
00477                         $temp_pagelist[12] = i18n("Please select a page...");
00478                         foreach( $pagelist as $key => $value )
00479                         {
00480                                 $temp_pagelist[$key] = $value["title"][0];
00481                         }
00482                         $discussOptionsPanel->addOption(
00483                                 i18n("Forum page"),
00484                                 i18n("This is the page that will be used to save the forum structure to. If you want to create a new page to put the information into, ##0##simply click here##1## and this will be done for you.", array("<a href=\"" . globalIDtoURL("setup/modulesetup/discuss/options/na/create_forum_page") . "\">", "</a>")),
00485                                 $discuss_options["page_id"],
00486                                 "page_id",
00487                                 "select",
00488                                 $temp_pagelist
00489                         );
00490                         
00491                         $menulist = $pagectl->fetchMenuMenuList($menu_folder);
00492                         foreach( $menulist as $key => $value )
00493                         {
00494                                 $temp_menulist[$value["id"]] = $value["title"][0];
00495                         }
00496                         $discussOptionsPanel->addOption(
00497                                 i18n("Forum menu"),
00498                                 i18n("This is the menu that will be shown on the Forum page"),
00499                                 $discuss_options["menu_id"],
00500                                 "menu_id",
00501                                 "select",
00502                                 $temp_menulist
00503                         );
00504                         
00505                         $discussOptionsPanel->addOption(
00506                                 i18n("Anonymous can view new sections by default"),
00507                                 i18n("When creating a new section, this viewing allowance level will be assigned to it"),
00508                                 $discuss_options["sectiondefaults"]["viewLevel"],
00509                                 "sectiondefaults][viewLevel",
00510                                 "checkbox"
00511                         );
00512                         
00513                         $discussOptionsPanel->addOption(
00514                                 i18n("Who can view forums by default"),
00515                                 i18n("When creating a new forum, this viewing allowance level will be assigned to it"),
00516                                 $discuss_options["forumdefaults"]["viewLevel"],
00517                                 "forumdefaults][viewLevel",
00518                                 "select",
00519                                 $discuss_allowanceLevels
00520                         );
00521                         
00522                         $discussOptionsPanel->addOption(
00523                                 i18n("Who can post to forums by default"),
00524                                 i18n("When creating a new forum, this posting allowance level will be assigned to it"),
00525                                 $discuss_options["forumdefaults"]["postLevel"],
00526                                 "forumdefaults][postLevel",
00527                                 "select",
00528                                 $discuss_allowanceLevels
00529                         );
00530                         
00531                         $discussOptionsPanel->addOption(
00532                                 i18n("Forum Title"),
00533                                 i18n("The title of the forum page"),
00534                                 $discuss_options["title"],
00535                                 "title",
00536                                 "text"
00537                         );
00538                         
00539                         $discussOptionsPanel->addOption(
00540                                 i18n("Forum header"),
00541                                 i18n("The header that is shown above the forum sections on the main forum page - it is also shown above all loaded threads, so be careful how much you write here!"),
00542                                 $discuss_options["header"],
00543                                 "header",
00544                                 "textbox"
00545                         );
00546                         
00547                         $discussOptionsPanel->addOption(
00548                                 i18n("Forum Footer"),
00549                                 i18n("The footer that is shown below the forum sections on the main forum page - it is also shown below all loaded threads, so be careful how much you write here!"),
00550                                 $discuss_options["footer"],
00551                                 "footer",
00552                                 "textbox"
00553                         );
00554                         
00555                         
00556                         $discussSetup->contents = "<form action=\"" . globalIDtoURL("setup/modulesetup/discuss/options") . "\" method=\"POST\">" . $discussOptionsPanel->render() . "</form>";
00557                         break;
00558                 case "setup":
00559                 default:
00560                         $discussSetup->tabbar->setCurrent( i18n( "Forum Setup" ) );
00561                         
00562                         $discussSetup->addCommand(i18n("Rebuild cache"), i18n("Rebuild the user post cache, used for showing what posts the user has created."), globalIDtoURL("setup/modulesetup/discuss/setup/na/rebuild_user_cache") );
00563                         $discussSetup->addCommand(i18n("Add Section"), i18n("Add a section to the end of the forum"), globalIDtoURL("setup/modulesetup/discuss/setup/na/add_section"));
00564                         if( $discuss_options["page_id"] != 12 )
00565                         {
00566                                 $discussSetup->addCommand(i18n("Write section order"), i18n("Write the order of the sections to the page defined in options"), globalIDtoURL("setup/modulesetup/discuss/setup/na/write_forum") );
00567                                 $discussSetup->addCommand(i18n("Go to forum page"), i18n("Go to the page defined in options as the forum page"), globalIDtoURL("content/$language/" . $discuss_options["page_id"] ));
00568                         }
00569                         
00570                         switch( $theModuleAction )
00571                         {
00572                         case "rebuild_user_cache":
00573                                 discuss_rebuildUserCache();
00574                                 header("Location: " . globalIDtoURL("setup/modulesetup/discuss/setup"));
00575                                 break;
00576                         case "add_section":
00577                                 // We do this until there is no directory called that already (this avoids two people attempting to create a new section with the same ID at the same time)
00578                                 do {
00579                                         // Increase the lastsectionid by one (thus also making sure the first is 1)
00580                                         $discuss_options["counters"]["lastSectionID"]++;
00581                                         // Assign this value to the be the new section's ID
00582                                         $newSectionID = $discuss_options["counters"]["lastSectionID"];
00583                                 } while( is_dir( "$discussContentDirectory/$newSectionID" ) );
00584                                 
00585                                 $section_options["title"] = i18n("Section title");
00586                                 $section_options["description"] = i18n("Section description - a one line text describing the section. Can be empty.");
00587                                 $section_options["viewLevel"] = $discuss_options["sectiondefaults"]["viewLevel"];
00588                                 $section_options["forumPositions"] = array();
00589                                 
00590                                 RecursiveMkdir( "$discussContentDirectory/$newSectionID" );
00591                                 
00592                                 file_put_contents( "$discussContentDirectory/$newSectionID/options.php", array_export( $section_options, "section_options" ) );
00593                                 
00594                                 $discuss_options["sectionPositions"][] = $newSectionID;
00595                                 discuss_saveOptions();
00596                                 
00597                                 header("Location: " . globalIDtoURL("setup/modulesetup/discuss/setup"));
00598                                 
00599                                 break;
00600                         case "delete_section":
00601                                 foreach( $discuss_options["sectionPositions"] as $position => $positionID )
00602                                         if( $positionID == $_REQUEST["discuss_sectionID"] )
00603                                                 unset( $discuss_options["sectionPositions"][$position] );
00604                                 
00605                                 // Update the array with the new position indexes... stops confusion when moving sections up and down
00606                                 foreach( $discuss_options["sectionPositions"] as $position => $positionID )
00607                                         $temp_positions[] = $positionID;
00608                                 $discuss_options["sectionPositions"] = $temp_positions;
00609                                 
00610                                 discuss_saveOptions();
00611                                 
00612                                 rmdirr( $discussContentDirectory . "/" . $_REQUEST["discuss_sectionID"] ); // Recursively remove the section data itself...
00613                                 
00614                                 header("Location: " . globalIDtoURL("setup/modulesetup/discuss/setup"));
00615                         
00616                                 break;
00617                         case "move_section_down":
00618                                 foreach( $discuss_options["sectionPositions"] as $position => $positionID )
00619                                 {
00620                                         if( $positionID == $_REQUEST["discuss_sectionID"] )
00621                                         {
00622                                                 $temp_sectionID = $discuss_options["sectionPositions"][$position + 1];
00623                                                 $discuss_options["sectionPositions"][$position + 1] = $positionID;
00624                                                 $discuss_options["sectionPositions"][$position] = $temp_sectionID;
00625                                         }
00626                                 }
00627                                 discuss_saveOptions();
00628                                 header("Location: " . globalIDtoURL("setup/modulesetup/discuss/setup"));
00629                                 break;
00630                         case "move_section_up":
00631                                 foreach( $discuss_options["sectionPositions"] as $position => $positionID )
00632                                 {
00633                                         if( $positionID == $_REQUEST["discuss_sectionID"] )
00634                                         {
00635                                                 $temp_sectionID = $discuss_options["sectionPositions"][$position - 1];
00636                                                 $discuss_options["sectionPositions"][$position - 1] = $positionID;
00637                                                 $discuss_options["sectionPositions"][$position] = $temp_sectionID;
00638                                         }
00639                                 }
00640                                 discuss_saveOptions();
00641                                 header("Location: " . globalIDtoURL("setup/modulesetup/discuss/setup"));
00642                                 break;
00643                         case "add_forum":
00644                                 // We do this until there is no directory called that already (this avoids two people attempting to create a new forum with the same ID at the same time)
00645                                 do {
00646                                         // Increase the lastsectionid by one (thus also making sure the first is 1) - we have loads of IDs to use, no need to save this information with the section
00647                                         $discuss_options["counters"]["lastForumID"]++;
00648                                         // Assign this value to the be the new forum's ID
00649                                         $newForumID = $discuss_options["counters"]["lastForumID"];
00650                                 } while( is_dir( "$discussContentDirectory/{$_REQUEST['discuss_sectionID']}/forums/$newForumID" ) );
00651                                 
00652                                 RecursiveMkdir( "$discussContentDirectory/{$_REQUEST['discuss_sectionID']}/forums/$newForumID" );
00653                                 
00654                                 $forum_options["title"] = i18n("Forum title");
00655                                 $forum_options["description"] = i18n("Forum description - a one line text describing the forum. Can be empty.");
00656                                 $forum_options["postLevel"] = $discuss_options["forumdefaults"]["postLevel"];
00657                                 $forum_options["viewLevel"] = $discuss_options["forumdefaults"]["viewLevel"];
00658                                 
00659                                 file_put_contents( "$discussContentDirectory/{$_REQUEST['discuss_sectionID']}/forums/$newForumID/options.php", array_export( $forum_options, "forum_options" ) );
00660                                 
00661                                 // Add the new forum to the section's forum list...
00662                                 $theSection = new discussSection($_REQUEST["discuss_sectionID"]);
00663                                 $theSection->forumPositions[] = $newForumID;
00664                                 $theSection->save();
00665                                 
00666                                 discuss_saveOptions();
00667                                 
00668                                 header("Location: " . globalIDtoURL("setup/modulesetup/discuss/setup"));
00669                                 
00670                                 break;
00671                         case "delete_forum":
00672                                 $theSection = new discussSection($_REQUEST["discuss_sectionID"]);
00673                                 foreach( $theSection->forumPositions as $position => $positionID )
00674                                         if( $positionID == $_REQUEST["discuss_forumID"] )
00675                                                 unset( $theSection->forumPositions[$position] );
00676                                 
00677                                 // Update the array with the new position indexes... stops confusion when moving forums up and down
00678                                 foreach( $theSection->forumPositions as $position => $positionID )
00679                                         $temp_positions[] = $positionID;
00680                                 $theSection->forumPositions = $temp_positions;
00681                                 
00682                                 $theSection->save();
00683                                 
00684                                 rmdirr( $discussContentDirectory . "/" . $_REQUEST["discuss_sectionID"] . "/forums/" . $_REQUEST["discuss_forumID"] ); // Recursively remove the section data itself...
00685                                 
00686                                 header("Location: " . globalIDtoURL("setup/modulesetup/discuss/setup"));
00687                         
00688                                 break;
00689                         case "move_forum_down":
00690                                 $theSection = new discussSection($_REQUEST["discuss_sectionID"]);
00691                                 foreach( $theSection->forumPositions as $position => $positionID )
00692                                 {
00693                                         if( $positionID == $_REQUEST["discuss_forumID"] )
00694                                         {
00695                                                 $temp_forumID = $theSection->forumPositions[$position + 1];
00696                                                 $theSection->forumPositions[$position + 1] = $positionID;
00697                                                 $theSection->forumPositions[$position] = $temp_forumID;
00698                                         }
00699                                 }
00700                                 $theSection->save();
00701                                 header("Location: " . globalIDtoURL("setup/modulesetup/discuss/setup"));
00702                                 break;
00703                         case "move_forum_up":
00704                                 $theSection = new discussSection($_REQUEST["discuss_sectionID"]);
00705                                 foreach( $theSection->forumPositions as $position => $positionID )
00706                                 {
00707                                         if( $positionID == $_REQUEST["discuss_forumID"] )
00708                                         {
00709                                                 $temp_forumID = $theSection->forumPositions[$position - 1];
00710                                                 $theSection->forumPositions[$position - 1] = $positionID;
00711                                                 $theSection->forumPositions[$position] = $temp_forumID;
00712                                         }
00713                                 }
00714                                 $theSection->save();
00715                                 header("Location: " . globalIDtoURL("setup/modulesetup/discuss/setup"));
00716                                 break;
00717                         case "write_forum":
00718                                 
00719                                 // Create the page to save the forum to!
00720                                 $edit_page["id"] = $discuss_options["page_id"];
00721                                 $edit_page["menu"] = $discuss_options["menu_id"];
00722                                 $edit_page["title"] = $discuss_options["title"];
00723                                 $edit_page["language"] = $default_language;
00724                                 $edit_page["author"] = getUserInfo(currentUser(), "name");
00725                                 $edit_page["email"] = getUserInfo(currentUser(), "email");
00726                                 
00727                                 $edit_page["content"] = $discuss_options["header"] . "\n";
00728                                 if( is_array( $discuss_options["sectionPositions"] ) )
00729                                 {
00730                                         foreach( $discuss_options["sectionPositions"] as $position => $positionID )
00731                                                 $edit_page["content"] .= "\\\\discuss($positionID)\n";
00732                                 }
00733                                 $edit_page["content"] .= $discuss_options["footer"] . "\n";
00734                                 
00735                                 unlink_multiple("$page_folder/{$discuss_options["page_id"]}.*");
00736                                 
00737                                 if ($pagectl->savePageData($page_folder, $edit_page["id"], $edit_page["language"], $edit_page["author"], $edit_page["email"], $discuss_options["menu_id"], $edit_page["title"], $edit_page["content"])) {
00738                                         $page_content = parse_page_data(i18n("The page was saved."));
00739                                         update_getpage_id($page_folder, $setup_folder, $pagectl);
00740                                         rotate_recent($edit_page["id"], $edit_page["title"], $edit_page["language"], date("j/n/y"), $recent_file);
00741                                         
00742                                         $error_description = renderInformationBox(
00743                                                         i18n("The discuss page was saved successfully"),
00744                                                         i18n("The section structure was saved to the page described by you in the options panel. If you want, you can go to that page right now, ##0##simply by clicking right here##1##.", array( "<a href=\"" . globalIDtoURL("content/$language/" . $discuss_options["page_id"]) . "\">", "</a>" ) )
00745                                                 );
00746                                 } else {
00747                                         $error_description = renderInformationBox(
00748                                                         i18n("The discuss page could not be saved!"),
00749                                                         i18n("An error occured while attempting to save the section structure to the forum page. Please check any error messages found in the browser and act accordingly. There is a high risk it is due to errors in file permissions, or that you have run out of disc space.")
00750                                                 );
00751                                 }
00752                                 break;
00753                         default:
00754                                 // Naaafink
00755                         }
00756                         
00757                         if( count( $discuss_options["sectionPositions"] ) > 0 ){
00758                                 foreach( $discuss_options["sectionPositions"] as $key => $value )
00759                                 {
00760                                 // Section
00761                                         $theSection = new discussSection($value);
00762                                         
00763                                         if( $_REQUEST["discuss_sectionDeleteID"] == $value )
00764                                                 $discussSetup->contents .= "
00765                                         <div class=\"discussSetup_sectionContainerDelete\">
00766                                                 <p class=\"wikicenteralign\"><a name=\"deleteConfirmPanel\" class=\"namedanchor\"> </a>" . i18n("Please confirm below that you really wish to delete this section. Note that you will be unable to undo this, and all threads in all forums contained in the section will be irreversibly deleted!") . "</p>
00767                                                 <div class=\"wikicenteralign\">
00768                                                 " . drawCommand( i18n("Confirm delete"), i18n("Confirm delete"), globalIDtoURL("setup/modulesetup/discuss/setup/na/delete_section", array("discuss_sectionID"=>$value) ) ) . "
00769                                                 " . drawCommand( i18n("Abort delete"), i18n("Abort delete"), globalIDtoURL("setup/modulesetup/discuss/setup") ) . "
00770                                                 </div>
00771                                                 <hr />";
00772                                         else
00773                                                 $discussSetup->contents .= "
00774                                         <div class=\"discussSetup_sectionContainer\">";
00775                                                 
00776                                         if( $_REQUEST["discuss_editSectionID"] == $value )
00777                                         {
00778                                                 $temp_viewLevel = "";
00779                                                 if( $theSection->viewLevel == 1 )
00780                                                         $temp_viewLevel = " checked";
00781                                                 
00782                                                 $discussSetup->contents .= "
00783                                                 <form action=\"" . globalIDtoURL("setup/modulesetup/discuss/setup") . "#discussSectionEdit\" method=\"post\">
00784                                                 <input type=\"hidden\" name=\"discussSectionEdit[sectionID]\" value=\"$value\" />
00785                                                 <div class=\"discussSetup_sectionHeader\">
00786                                                         <span class=\"discussSetup_sectionTitle\">" . i18n("Section title") . ":<a name=\"discussSectionEdit\" class=\"namedanchor\"> </a></span><input class=\"discussSetup_sectionTitle\" type=\"text\" name=\"discussSectionEdit[title]\" value=\"{$theSection->title}\" />
00787                                                         <span class=\"discussSetup_sectionDescription\">" . i18n("Section description") . ":</span><input class=\"discussSetup_sectionDescription\" type=\"text\" name=\"discussSectionEdit[description]\" value=\"{$theSection->description}\" />
00788                                                         <span class=\"discussSetup_sectionViewlevel\">" . i18n("Viewable by") . ":</span><label class=\"discussSetup_sectionViewlevel\"><input type=\"checkbox\" name=\"discussSectionEdit[viewLevel]\"$temp_viewLevel>Anonymous can view new sections by default</label>
00789                                                         <input style=\"width: 99%\" type=\"submit\" name=\"save_section\" value=\"" . i18n("Save") . "\"/>
00790                                                 </div>
00791                                                 </form>";
00792                                                 $editThisSection = "
00793                                                         " . drawCommand( i18n("Abort delete"), i18n("Abort delete"), globalIDtoURL("setup/modulesetup/discuss/setup") );
00794                                         }
00795                                         else
00796                                         {
00797                                                 $temp_viewLevel = "";
00798                                                 if( $theSection->viewLevel == 1 )
00799                                                         $temp_viewLevel = i18n("Everybody");
00800                                                 else
00801                                                         $temp_viewLevel = i18n("Only registered users");
00802                                                 
00803                                                 $discussSetup->contents .= "
00804                                                 <div class=\"discuss_sectionHeader\">
00805                                                         <span class=\"discuss_sectionTitle\">{$theSection->title}</span>
00806                                                         <span class=\"discuss_sectionDescription\">{$theSection->description}</span>
00807                                                         <span class=\"discuss_sectionViewlevel\">" . i18n("##0## can view this section", array( $temp_viewLevel ) ) . "</span>
00808                                                 </div>";
00809                                                 $editThisSection = "
00810                                                         " . drawCommand( i18n("Edit"), i18n("Edit this section"), globalIDtoURL("setup/modulesetup/discuss/setup", array("discuss_editSectionID" => "$value#discussSectionEdit") ) );
00811                                         }
00812                                         
00813                                         if( $key > 0 )
00814                                                 $moveSectionUp = drawCommand( i18n("Move up"), i18n("Move the section up one step"), globalIDtoURL("setup/modulesetup/discuss/setup/na/move_section_up", array("discuss_sectionID" => $value ) ) );
00815                                         else
00816                                                 $moveSectionUp = "<acronym title=\"" . i18n("Alrady topmost") . "\">[" . i18n("Move up") . "]</acronym>";
00817                                         
00818                                         if( count( $discuss_options["sectionPositions"] ) > $key + 1 )
00819                                                 $moveSectionDown = drawCommand(i18n("Move down") ,i18n("Move the section down one step") , globalIDtoURL("setup/modulesetup/discuss/setup/na/move_section_down", array("discuss_sectionID"=>$value) ) );
00820                                         else
00821                                                 $moveSectionDown = "<acronym title=\"" . i18n("Alrady bottommost") . "\">[" . i18n("Move down") . "]</acronym>";
00822                                         
00823                                         $discussSetup->contents .= "
00824                                                 <div class=\"discussSetup_sectionAddForum\">
00825                                                         " . drawCommand( i18n("Add a new forum to this section"), i18n("Add a new forum to this section"), globalIDtoURL("setup/modulesetup/discuss/setup/na/add_forum", array("discuss_sectionID" => $value ) ) ) . " &nbsp; &nbsp;
00826                                                         " . drawCommand( i18n("Delete"), i18n("Delete this section"), globalIDtoURL("setup/modulesetup/discuss/setup",  array( "discuss_sectionDeleteID" => "$value#deleteConfirmPanel" ) ) ) . " &nbsp; &nbsp;
00827                                                         $moveSectionUp
00828                                                         $moveSectionDown &nbsp; &nbsp; 
00829                                                         $editThisSection
00830                                                 </div>";
00831                                         if( count( $theSection->forumPositions ) > 0 )
00832                                         {
00833                                                 foreach( $theSection->forumPositions as $key2 => $value2 )
00834                                                 {
00835                                                         $temp_title = $theSection->forums[$theSection->forumByID($value2)]->title;
00836                                                         $temp_description = $theSection->forums[$theSection->forumByID($value2)]->description;
00837                                                         
00838                                                         if( $_POST["add_moderator"] )
00839                                                         {
00840                                                                 $theSection->forums[$theSection->forumByID($value2)]->moderators[] = $_POST["discussForumEdit"]["newModerator"];
00841                                                                 $theSection->forums[$theSection->forumByID($value2)]->save();
00842                                                         }
00843                                                         else if( $_POST["remove_moderator"] )
00844                                                         {
00845                                                                 unset( $theSection->forums[$theSection->forumByID($value2)]->moderators[$_POST["discussForumEdit"]["moderators"]] );
00846                                                                 $theSection->forums[$theSection->forumByID($value2)]->save();
00847                                                         }
00848                                                         
00849                                                         $theModerators = array();
00850                                                         if( is_array( $theSection->forums[$theSection->forumByID($value2)]->moderators ) && count( $theSection->forums[$theSection->forumByID($value2)]->moderators ) > 0 )
00851                                                                 $theModerators = $theSection->forums[$theSection->forumByID($value2)]->moderators;
00852                                                         
00853                                                         if( is_array( $theModerators ) && count( $theModerators ) > 0 )
00854                                                         {
00855                                                                 foreach( $theModerators as $key3 => $value3 )
00856                                                                 {
00857                                                                         if( $_REQUEST["discuss_editForumID"] == $value2 || ( $_POST["discussForumEdit"]["forumID"] == $value2 && ( $_POST["add_moderator"] || $_POST["remove_moderator"] ) ) )
00858                                                                                 $temp_moderators .= "
00859                                                                                 <option value=\"$key3\">" . getUserInfo( $value3, "name" ) . "</option>";
00860                                                                         else
00861                                                                                 $temp_moderators .= parse_profilelinks("%%$value3%%") . ", ";
00862                                                                 }
00863                                                                 if( ! ($_REQUEST["discuss_editForumID"] == $value2 || ( $_POST["discussForumEdit"]["forumID"] == $value2 && ( $_POST["add_moderator"] || $_POST["remove_moderator"] ) ) ) )
00864                                                                         $temp_moderators = substr($temp_moderators, 0, -2); // Remove the last comma...
00865                                                         }
00866                                                         else
00867                                                         {
00868                                                                 if( $_REQUEST["discuss_editForumID"] == $value2 || ( $_POST["discussForumEdit"]["forumID"] == $value2 && ( $_POST["add_moderator"] || $_POST["remove_moderator"] ) ) )
00869                                                                 {
00870                                                                         $temp_moderators_disabled = " disabled";
00871                                                                         $temp_moderators = "
00872                                                                         <option>" . i18n("No moderators assigned to this forum") . "</option>";
00873                                                                 }
00874                                                                 else
00875                                                                         $temp_moderators = i18n("No moderators assigned to this forum");
00876                                                         }
00877                                                         
00878                                                         if( $_REQUEST["discuss_editForumID"] == $value2 || ( $_POST["discussForumEdit"]["forumID"] == $value2 && ( $_POST["add_moderator"] || $_POST["remove_moderator"] ) ) )
00879                                                         {
00880                                                                 $temp_users = allUsersArray();
00881                                                                 foreach( $temp_users as $user )
00882                                                                         $allUsersList .= "<option value=\"$user\">" . getUserInfo( $user, "name" ) . "</option>";
00883                                                                 
00884                                                                 foreach( $discuss_allowanceLevels as $level => $description )
00885                                                                 {
00886                                                                         if( $level == $theSection->forums[$theSection->forumByID($value2)]->postLevel )
00887                                                                                 $postlevel_selected = " selected";
00888                                                                         else
00889                                                                                 $postlevel_selected = "";
00890                                                                         
00891                                                                         $temp_setuppostlevel .= "<option value=\"$level\"$postlevel_selected>$description</option>";
00892                                                                         
00893                                                                         if( $level == $theSection->forums[$theSection->forumByID($value2)]->viewLevel )
00894                                                                                 $viewlevel_selected = " selected";
00895                                                                         else
00896                                                                                 $viewlevel_selected = "";
00897                                                                         
00898                                                                         $temp_setupviewlevel .= "<option value=\"$level\"$viewlevel_selected>$description</option>";
00899                                                                 }
00900                                                                 
00901                                                                 $discussSetup->contents .= "
00902                                                                 <form action=\"" . globalIDtoURL("setup/modulesetup/discuss/setup") . "#discussForumEdit\" method=\"post\">
00903                                                                 <input type=\"hidden\" name=\"discussForumEdit[sectionID]\" value=\"$value\" />
00904                                                                 <input type=\"hidden\" name=\"discussForumEdit[forumID]\" value=\"$value2\" />
00905                                                                 <div class=\"discussSetup_forumHeader\">
00906                                                                         <span class=\"discussSetup_forumTitle\">" . i18n("Forum title") . ":<a name=\"discussForumEdit\" class=\"namedanchor\"> </a></span><input class=\"discussSetup_forumTitle\" type=\"text\" name=\"discussForumEdit[title]\" value=\"$temp_title\" />
00907                                                                         <span class=\"discussSetup_forumDescription\">" . i18n("Forum title") . ": </span><input class=\"discussSetup_forumDescription\" type=\"text\" name=\"discussForumEdit[description]\" value=\"$temp_description\" />
00908                                                                         <span class=\"discussSetup_forumPostLevel\">" . i18n("Can post in the forum") . ": </span><select class=\"discussSetup_forumPostLevel\" name=\"discussForumEdit[postLevel]\">$temp_setuppostlevel</select>
00909                                                                         <span class=\"discussSetup_forumViewLevel\">" . i18n("Can view the forum") . ": </span><select class=\"discussSetup_forumViewLevel\" name=\"discussForumEdit[viewLevel]\">$temp_setupviewlevel</select>
00910                                                                         <input style=\"width: 99%\" type=\"submit\" name=\"save_forum\" value=\"" . i18n("Save") . "\"/>
00911                                                                         <span class=\"discussSetip_forumModeratorsHeader\">" . i18n("Moderators") . "</span>
00912                                                                         <span class=\"discussSetup_forumModerators\">" . i18n("Current moderators") . ": </span><select class=\"discussSetup_forumModerators\" name=\"discussForumEdit[moderators]\" $temp_moderators_disabled>$temp_moderators</select><input class=\"discussSetup_forumModeratorsRemove\" type=\"submit\" name=\"remove_moderator\" value=\"" . i18n("Remove selected") . "\"$temp_moderators_disabled />
00913                                                                         <span class=\"discussSetup_forumModeratorsAdd\">" . i18n("Add a moderator") . ": </span><select class=\"discussSetup_forumModeratorsAdd\" name=\"discussForumEdit[newModerator]>$allUsersList</select><input type=\"submit\" class=\"discussSetup_forumModeratorsAdd\" name=\"add_moderator\" value=\"" . i18n("Add selected") . "\" />
00914                                                                 </div>";
00915                                                                 $editThisForum = "
00916                                                                         " . drawCommand(i18n("Abort Edit") ,i18n("Abort Edit") , globalIDtoURL("setup/modulesetup/discuss/setup") );
00917                                                         }
00918                                                         else
00919                                                         {
00920                                                                 $temp_postlevel = $discuss_allowanceLevels[$theSection->forums[$theSection->forumByID($value2)]->postLevel];
00921                                                                 $temp_viewlevel = $discuss_allowanceLevels[$theSection->forums[$theSection->forumByID($value2)]->viewLevel];
00922                                                                 
00923                                                                 if( $_REQUEST["discuss_forumDeleteID"] == $value2 )
00924                                                                         $discussSetup->contents .= "
00925                                                                 <div class=\"discussSetup_forumHeader\">
00926                                                                         <p class=\"wikicenteralign\"><a name=\"deleteConfirmPanel\" class=\"namedanchor\"> </a>" . i18n("Please confirm below that you really wish to delete this forum. Note that you will be unable to undo this, and all threads in the forum will be irreversibly deleted!") . "</p>
00927                                                                         <div class=\"wikicenteralign\">
00928                                                                         " . drawCommand(i18n("Confirm delete") ,i18n("Confirm delete") , globalIDtoURL("setup/modulesetup/discuss/setup/na/delete_forum", array("discuss_sectionID" => $value, "discuss_forumID" => $value2 ) ) ) . "
00929                                                                         " . drawCommand(i18n("Abort delete") ,i18n("Abort delete") , globalIDtoURL("setup/modulesetup/discuss/setup") ) . "
00930                                                                         </div>
00931                                                                         <hr />";
00932                                                                 else
00933                                                                         $discussSetup->contents .= "
00934                                                                 <div class=\"discuss_forumHeader\">
00935                                                                 ";
00936                                                                 
00937                                                                 $discussSetup->contents .= "
00938                                                                         <span class=\"discuss_forumTitle\">$temp_title</span>
00939                                                                         <span class=\"discuss_forumDescription\">$temp_description</span>
00940                                                                         <span class=\"discuss_forumModerators\">" . i18n("Moderators") . ": $temp_moderators</span>
00941                                                                         <span class=\"discuss_forumLevels\">" . i18n("##0## can post new threads and ##1## can view existing threads in the forum.", array( $temp_postlevel, $temp_viewlevel ) ) . "</span>
00942                                                                 </div>";
00943                                                                 $editThisForum = "
00944                                                                         " . drawCommand(i18n("Edit") ,i18n("Edit this forum") , globalIDtoURL("setup/modulesetup/discuss/setup", array("discuss_editForumID" => "$value2#discussForumEdit" ) ) );
00945                                                         }
00946                                                         
00947                                                         if( $key2 > 0 )
00948                                                                 $moveForumUp = drawCommand(i18n("Move up") ,i18n("Move the forum up one step") , globalIDtoURL("setup/modulesetup/discuss/setup/na/move_forum_up", array("discuss_sectionID" => $value, "discuss_forumID" => $value2 ) ) );
00949                                                         else
00950                                                                 $moveForumUp = "<acronym title=\"" . i18n("Alrady topmost") . "\">[" . i18n("Move up") . "]</acronym>";
00951                                                         
00952                                                         if( count( $theSection->forums ) > $key2 + 1 )
00953                                                                 $moveForumDown = drawCommand(i18n("Move down") ,i18n("Move down") , globalIDtoURL("setup/modulesetup/discuss/setup/na/move_forum_down", array("discuss_sectionID" => $value, "discuss_forumID" => $value2 ) ) );
00954                                                         else
00955                                                                 $moveForumDown = "<acronym title=\"" . i18n("Alrady bottommost") . "\">[" . i18n("Move down") . "]</acronym>";
00956                                                         
00957                                                         $discussSetup->contents .= "
00958                                                                 <span class=\"discussSetup_forumCommands\">
00959                                                                         <acronym title=\"Not implemented, sorry\">[Move to another section]</acronym> &nbsp; &nbsp;
00960                                                                         " . drawCommand( i18n("Delete"), i18n("Delete"), globalIDtoURL("setup/modulesetup/discuss/setup", array("discuss_sectionID" => $value, "discuss_forumDeleteID" => "$value2#deleteConfirmPanel" ) ) ) . " &nbsp; &nbsp;
00961                                                                         $moveForumUp
00962                                                                         $moveForumDown &nbsp; &nbsp;
00963                                                                         $editThisForum
00964                                                                 </span>";
00965                                                 }
00966                                         }
00967                                         else
00968                                         {
00969                                                 $discussSetup->contents .= "
00970                                                 <small class=\"comment\">" . i18n("There are currently no forums in this section.") . "</small>";
00971                                         }
00972                                         $discussSetup->contents .= "
00973                                         </div>";
00974                                 }
00975                                 $discussSetup->contents = $error_description . $discussSetup->contents;
00976                         }
00977                         else
00978                         {
00979                                 $discussSetup->contents = renderInformationBox(
00980                                                 i18n("Welcome to the Discuss forum setup"),
00981                                                 i18n("Here is where you set up forums, sections and the options retaining to them, such as viewing and posting allowance levels, moderators and so on. You have not yet added any sections. Please do so by clicking on this ##0##[Add Section]##1## command link. Please also make sure to check out ##2##the options##1## before doing anything further.", array("<a class=\"command\" href=\"" . globalIDtoURL("setup/modulesetup/discuss/setup/na/add_section") . "\">", "</a>", "<a href=\"" . globalIDtoURL("setup/modulesetup/discuss/options") . "\">"))
00982                                         );
00983                         }
00984                 }
00985                 return $discussSetup->renderTabWidget();
00986         }
00987         else
00988         {
00989                 return "<div>D'oh! Who do you think you are, you are not authorised to come in here - and you can only click your way here if you're allowed. Hacker!</div>";
00990         }
00991 }
00992 
00993 
01002 function globalIDThumbnail_discuss( $splitID )
01003 {
01004         global $module_folder;
01005         $data = array( "uri" => siteURL(true) . "$module_folder/discuss/thumb.png", "width" => 64, "height" => 64 );
01006         return $data;
01007 }
01008 ?>

Generated on Sun Oct 26 20:33:13 2008 for The Travelsized Content Management System by  doxygen 1.5.5