Changeset 1058 in ExiteCMS
- Timestamp:
- 11/04/07 23:02:51 (4 years ago)
- Location:
- modules/common/wiki/php-files/modules/wiki
- Files:
-
- 2 edited
-
module_installer.php (modified) (17 diffs)
-
wikka.config.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
modules/common/wiki/php-files/modules/wiki/module_installer.php
r986 r1058 1 1 <?php 2 2 /*---------------------------------------------------+ 3 | PLi-Fusion Content Management System|3 | ExiteCMS Content Management System | 4 4 +----------------------------------------------------+ 5 | Copyright 2007 WanWizard (wanwizard@gmail.com)|6 | http://www.pli-images.org/pli-fusion|5 | Copyright 2007 Harro "WanWizard" Verton, Exite BV | 6 | for support, please visit http://exitecms.exite.eu | 7 7 +----------------------------------------------------+ 8 | Some portions copyright ? 2002 - 2006 Nick Jones|8 | Some portions copyright 2002 - 2006 Nick Jones | 9 9 | http://www.php-fusion.co.uk/ | 10 +----------------------------------------------------+ 10 11 | Released under the terms & conditions of v2 of the | 11 12 | GNU General Public License. For details refer to | … … 29 30 $mod_title = $locale['wiki100']; // title or name of this module 30 31 $mod_description = $locale['wiki101']; // short description of it's purpose 31 $mod_version = $locale['wikiver'];// module version number32 $mod_version = "1.0.2"; // module version number 32 33 $mod_developer = "WanWizard"; // author's name 33 34 $mod_email = "wanwizard@gmail.com"; … … 40 41 41 42 $mod_folder = "wiki"; // sub-folder of the /modules folder 42 $mod_admin_image = " ";// icon to be used for the admin panel43 $mod_admin_panel = " ";// name of the admin panel for this module44 $mod_admin_rights = "wW"; // admin rights code. This HAS to be assigned by PLi-Fusionto avoid duplicates!45 $mod_admin_page = 1; // admin page this panel has to be placed on43 $mod_admin_image = "wiki_admin.gif"; // icon to be used for the admin panel 44 $mod_admin_panel = "wiki_admin.php"; // name of the admin panel for this module 45 $mod_admin_rights = "wW"; // admin rights code. This HAS to be assigned by the ExiteCMS team to avoid duplicates! 46 $mod_admin_page = 4; // admin page this panel has to be placed on 46 47 47 48 /*---------------------------------------------------+ … … 75 76 $mod_install_cmds = array(); // commands to execute when installing this module 76 77 77 // wiki_acls78 // create the table: wiki_acls 78 79 $mod_install_cmds[] = array('type' => 'db', 'value' => "CREATE TABLE ##PREFIX##wiki_acls ( 79 80 page_tag varchar(75) NOT NULL default '', … … 84 85 ) ENGINE=MyISAM;"); 85 86 87 // and add initial record(s) to it 86 88 $mod_install_cmds[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##wiki_acls (page_tag, read_acl, write_acl, comment_acl) VALUES ('UserSettings', '*', '+', '+')"); 87 89 88 // wiki_comments90 // create the table: wiki_comments 89 91 $mod_install_cmds[] = array('type' => 'db', 'value' => "CREATE TABLE ##PREFIX##wiki_comments ( 90 92 id int(10) unsigned NOT NULL auto_increment, … … 98 100 ) ENGINE=MyISAM;"); 99 101 100 // wiki_links102 // create the table: wiki_links 101 103 $mod_install_cmds[] = array('type' => 'db', 'value' => "CREATE TABLE ##PREFIX##wiki_links ( 102 104 from_tag varchar(75) NOT NULL default '', … … 107 109 ) ENGINE=MyISAM;"); 108 110 109 // wiki_pages111 // create the table: wiki_pages 110 112 $mod_install_cmds[] = array('type' => 'db', 'value' => "CREATE TABLE ##PREFIX##wiki_pages ( 111 113 id int(10) unsigned NOT NULL auto_increment, … … 126 128 ) ENGINE=MyISAM;"); 127 129 130 // and add initial record(s) to it 128 131 $mod_install_cmds[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##wiki_pages (id, tag, time, body, owner, user, latest, note, handler) VALUES (1, 'HomePage', now(), '{{image url=\"images/wikka_logo.jpg\" alt=\"wikka logo\" title=\"Welcome to this Wikka Wiki!\"}}\n\nThis site is running on version ##{{wikkaversion}}## (see WikkaReleaseNotes). \nYou need to double-click on any page or click on the \"Edit page\" link at the bottom to get started. \n\nFor more information, visit the [[Wikka:HomePage WikkaWiki website]]! \n\nUseful pages: FormattingRules, WikkaDocumentation, OrphanedPages, WantedPages, TextSearch.', '##WEBMASTER##', '##WEBMASTER##', 'Y', '', 'page')"); 129 132 $mod_install_cmds[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##wiki_pages (id, tag, time, body, owner, user, latest, note, handler) VALUES (2, 'RecentChanges', now(), '{{RecentChanges}}{{nocomments}}\n\n\n----\nCategoryWiki', '(Public)', '##WEBMASTER##', 'Y', '', 'page')"); … … 149 152 $mod_install_cmds[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##wiki_pages (id, tag, time, body, owner, user, latest, note, handler) VALUES (22, 'SysInfo', now(), '===== System Information =====\n\n~-Wikka version: ##{{wikkaversion}}##\n~-PHP version: ##{{phpversion}}##\n~-\"\"MySQL\"\" version: ##{{mysqlversion}}##\n~-\"\"GeSHi\"\" version: ##{{geshiversion}}##\n~-Server:\n~~-Host: ##{{system show=\"host\"}}##\n~~-Operative System: ##{{system show=\"os\"}}##\n~~-Machine: ##{{system show=\"machine\"}}##\n\n----\nCategoryWiki', '(Public)', '##WEBMASTER##', 'Y', '', 'page')"); 150 153 151 // wiki_referrer_blacklist154 // create the table: wiki_referrer_blacklist 152 155 $mod_install_cmds[] = array('type' => 'db', 'value' => "CREATE TABLE ##PREFIX##wiki_referrer_blacklist ( 153 156 spammer varchar(150) NOT NULL default '', … … 155 158 ) ENGINE=MyISAM;"); 156 159 157 // wiki_referrers160 // create the table: wiki_referrers 158 161 $mod_install_cmds[] = array('type' => 'db', 'value' => "CREATE TABLE ##PREFIX##wiki_referrers ( 159 162 page_tag varchar(75) NOT NULL default '', … … 164 167 ) ENGINE=MyISAM;"); 165 168 166 // wiki_users169 // create the table: wiki_users 167 170 $mod_install_cmds[] = array('type' => 'db', 'value' => "CREATE TABLE ##PREFIX##wiki_users ( 168 171 name varchar(75) NOT NULL default '', … … 178 181 ) ENGINE=MyISAM;"); 179 182 180 // wiki_images183 // create the table: wiki_images 181 184 $mod_install_cmds[] = array('type' => 'db', 'value' => "CREATE TABLE ##PREFIX##wiki_images ( 182 185 image_id SMALLINT( 5 ) UNSIGNED NOT NULL , … … 187 190 ) ENGINE=MyISAM;"); 188 191 189 // add a user group for this module 190 $mod_install_cmds[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##user_groups (group_ident, group_name, group_description, group_forumname, group_visible) VALUES ('".$mod_admin_rights."01', 'Wiki Admins', 'Wiki Admins', 'Wiki Admin', '1')"); 191 $mod_install_cmds[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##user_groups (group_ident, group_name, group_description, group_forumname, group_visible) VALUES ('".$mod_admin_rights."02', 'Wiki Editors', 'Wiki Editors', 'Wiki Editor', '1')"); 192 193 $mod_install_cmds[] = array('type' => 'function', 'value' => "install_wiki"); 192 // add the Wiki config variables 193 $mod_install_cmds[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##CMSconfig (cfg_name, cfg_value) VALUES ('wiki_root_page', 'HomePage')"); 194 $mod_install_cmds[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##CMSconfig (cfg_name, cfg_value) VALUES ('wiki_wakka_name', 'ExiteCMS Wiki')"); 195 $mod_install_cmds[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##CMSconfig (cfg_name, cfg_value) VALUES ('wiki_navigation_links', '[[CategoryCategory Categories]] | PageIndex | RecentChanges | RecentlyCommented')"); 196 $mod_install_cmds[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##CMSconfig (cfg_name, cfg_value) VALUES ('wiki_logged_in_navigation_links', '[[CategoryCategory Categories]] | PageIndex | RecentChanges | RecentlyCommented | [[UserSettings Change settings]]')"); 197 $mod_install_cmds[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##CMSconfig (cfg_name, cfg_value) VALUES ('wiki_hide_comments', '0')"); 198 $mod_install_cmds[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##CMSconfig (cfg_name, cfg_value) VALUES ('wiki_require_edit_note', '0')"); 199 $mod_install_cmds[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##CMSconfig (cfg_name, cfg_value) VALUES ('wiki_anony_delete_own_comments', '1')"); 200 $mod_install_cmds[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##CMSconfig (cfg_name, cfg_value) VALUES ('wiki_external_link_new_window', '1')"); 201 $mod_install_cmds[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##CMSconfig (cfg_name, cfg_value) VALUES ('wiki_default_write_acl', '101')"); 202 $mod_install_cmds[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##CMSconfig (cfg_name, cfg_value) VALUES ('wiki_default_read_acl', '0')"); 203 $mod_install_cmds[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##CMSconfig (cfg_name, cfg_value) VALUES ('wiki_default_comment_acl', '101')"); 204 205 // custom module install code 206 // $mod_install_cmds[] = array('type' => 'function', 'value' => "module_install"); 194 207 195 208 /*---------------------------------------------------+ … … 199 212 $mod_uninstall_cmds = array(); // commands to execute when uninstalling this module 200 213 201 // delete the wiki tables214 // delete all the wiki tables 202 215 $mod_uninstall_cmds[] = array('type' => 'db', 'value' => "DROP TABLE ##PREFIX##wiki_acls"); 203 216 $mod_uninstall_cmds[] = array('type' => 'db', 'value' => "DROP TABLE ##PREFIX##wiki_comments"); … … 209 222 $mod_uninstall_cmds[] = array('type' => 'db', 'value' => "DROP TABLE ##PREFIX##wiki_images"); 210 223 211 // delete the user groups 212 $mod_uninstall_cmds[] = array('type' => 'db', 'value' => "DELETE FROM ##PREFIX##user_groups WHERE group_ident = '".$mod_admin_rights."01'"); 213 $mod_uninstall_cmds[] = array('type' => 'db', 'value' => "DELETE FROM ##PREFIX##user_groups WHERE group_ident = '".$mod_admin_rights."02'"); 214 215 $mod_install_cmds[] = array('type' => 'function', 'value' => "uninstall_wiki"); 224 // delete the wiki config variables 225 $mod_uninstall_cmds[] = array('type' => 'db', 'value' => "DELETE FROM ##PREFIX##CMSconfig WHERE cfg_name = 'wiki_root_page'"); 226 $mod_uninstall_cmds[] = array('type' => 'db', 'value' => "DELETE FROM ##PREFIX##CMSconfig WHERE cfg_name = 'wiki_wakka_name'"); 227 $mod_uninstall_cmds[] = array('type' => 'db', 'value' => "DELETE FROM ##PREFIX##CMSconfig WHERE cfg_name = 'wiki_navigation_links'"); 228 $mod_uninstall_cmds[] = array('type' => 'db', 'value' => "DELETE FROM ##PREFIX##CMSconfig WHERE cfg_name = 'wiki_logged_in_navigation_links'"); 229 $mod_uninstall_cmds[] = array('type' => 'db', 'value' => "DELETE FROM ##PREFIX##CMSconfig WHERE cfg_name = 'wiki_hide_comments'"); 230 $mod_uninstall_cmds[] = array('type' => 'db', 'value' => "DELETE FROM ##PREFIX##CMSconfig WHERE cfg_name = 'wiki_require_edit_note'"); 231 $mod_uninstall_cmds[] = array('type' => 'db', 'value' => "DELETE FROM ##PREFIX##CMSconfig WHERE cfg_name = 'wiki_anony_delete_own_comments'"); 232 $mod_uninstall_cmds[] = array('type' => 'db', 'value' => "DELETE FROM ##PREFIX##CMSconfig WHERE cfg_name = 'wiki_external_link_new_window'"); 233 $mod_uninstall_cmds[] = array('type' => 'db', 'value' => "DELETE FROM ##PREFIX##CMSconfig WHERE cfg_name = 'wiki_default_write_acl'"); 234 $mod_uninstall_cmds[] = array('type' => 'db', 'value' => "DELETE FROM ##PREFIX##CMSconfig WHERE cfg_name = 'wiki_default_read_acl'"); 235 $mod_uninstall_cmds[] = array('type' => 'db', 'value' => "DELETE FROM ##PREFIX##CMSconfig WHERE cfg_name = 'wiki_default_comment_acl'"); 236 237 // remove any reference to the wiki groups created at installation time by an other version 238 $mod_uninstall_cmds[] = array('type' => 'function', 'value' => "module_uninstall"); 216 239 217 240 /*---------------------------------------------------+ 218 241 | function for special installations | 219 242 +----------------------------------------------------*/ 220 if (!function_exists('install_wiki')) { 221 function install_wiki() { 243 if (!function_exists('module_install')) { 244 function module_install() { 245 246 global $db_prefix; 247 248 } 249 } 250 /*---------------------------------------------------+ 251 | function for special de-installations | 252 +----------------------------------------------------*/ 253 if (!function_exists('module_uninstall')) { 254 function module_uninstall() { 222 255 223 256 global $db_prefix, $mod_admin_rights; 224 257 225 // get the group_id of the Wiki Admins group 226 $admins = dbarray(dbquery("SELECT group_id FROM ".$db_prefix."user_groups WHERE group_ident = '".$mod_admin_rights."01'")); 258 // check if the old wiki groups still exist. If so, remove them 227 259 228 // add all webmasters to the wiki user table 229 $result = dbquery("SELECT * FROM ".$db_prefix."users WHERE user_level = '103'"); 230 while ($data = dbarray($result)) { 231 $result2 = dbquery("INSERT INTO ".$db_prefix."wiki_users (name, email, revisioncount, changescount, doubleclickedit, signuptime, show_comments) VALUES ('".$data['user_name']."', '".$data['user_email']."', 20, 50, 'Y', now(), 'N')"); 232 // and update references to the webmaster 233 if ($data['user_id'] == 1) { 234 $result2 = dbquery("UPDATE ".$db_prefix."wiki_pages SET owner = '".$data['user_name']."' WHERE owner = '##WEBMASTER##'"); 235 $result2 = dbquery("UPDATE ".$db_prefix."wiki_pages SET user = '".$data['user_name']."' WHERE user = '##WEBMASTER##'"); 236 } 237 // add them to the Wiki Admins group 238 if (isset($admins['group_id'])) { 239 $user_groups = $data['user_groups'].".".$admins['group_id']; 240 $result2 = dbquery("UPDATE ".$db_prefix."users SET user_groups = '$user_groups' WHERE user_id = '".$data['user_id']."'"); 241 } 260 // get the group id of the Wiki Admin group 261 $result = dbquery("SELECT group_id FROM ".$db_prefix."user_groups WHERE group_ident = '".$mod_admin_rights."01'"); 262 if ($data = dbarray($result)) { 263 // get all groups with membership of this group, and remove the membership 264 265 // get all users with membership of this group, and remove the membership 266 267 // delete the user group 268 $result = dbquery("DELETE FROM ".$db_prefix."user_groups WHERE group_ident = '".$mod_admin_rights."01'"); 242 269 } 243 } 244 } 245 /*---------------------------------------------------+ 246 | function for special de-installations | 247 +----------------------------------------------------*/ 248 if (!function_exists('uninstall_wiki')) { 249 function uninstall_wiki() { 270 271 272 // get the group id of the Wiki Editors group 273 $result = dbquery("SELECT group_id FROM ".$db_prefix."user_groups WHERE group_ident = '".$mod_admin_rights."02'"); 274 if ($data = dbarray($result)) { 275 // get all groups with membership of this group, and remove the membership 276 277 // get all users with membership of this group, and remove the membership 278 279 // delete the user group 280 $result = dbquery("DELETE FROM ".$db_prefix."user_groups WHERE group_ident = '".$mod_admin_rights."02'"); 281 } 282 250 283 } 251 284 } … … 259 292 260 293 switch($current_version) { 261 case "1.1.6.3": 294 case "1.0.0": 295 // changes between this version and the next one 296 262 297 // create the wiki_images table 263 298 $result = dbquery("CREATE TABLE ".$db_prefix."wiki_images ( … … 268 303 PRIMARY KEY ( image_id ) 269 304 ) ENGINE=MyISAM;"); 305 306 case "1.0.1": 307 // changes between this version and the next one 308 309 default: 310 // commands to execute for every upgrade 270 311 } 271 312 } -
modules/common/wiki/php-files/modules/wiki/wikka.config.php
r979 r1058 52 52 ); 53 53 54 // get wiki config variables from the CMSconfig table. They override the default config 55 $result = dbquery("SELECT * FROM ".$db_prefix."CMSconfig WHERE cfg_name LIKE 'wiki_%'"); 56 while ($data = dbarray($result)) { 57 // extract the wakkaConfig key from the cfg_name 58 $cfgkey = substr($data['cfg_name'],5); 59 // if the wakkaConfig key exists, overwrite the value 60 if (isset($wakkaConfig[$cfgkey])) { 61 $wakkaConfig[$cfgkey] = $data['cfg_value']; 62 } 63 } 64 54 65 // check if there is a stylesheet for the Wiki in the current theme 55 66 // if not, take the Wiki module default … … 58 69 } else { 59 70 $wakkaConfig['stylesheet'] = 'css/wikka.css'; 60 }61 62 // generate the admin users based on group membership63 $result = dbquery("SELECT * FROM ".$db_prefix."user_groups WHERE group_name = 'Wiki Admins'");64 if ($data = dbarray($result)) {65 $users = allusersingroup($data['group_id']);66 $admins = "";67 foreach ($users as $user) {68 $admins .= ($admins == "" ? "" : "\n") . $user['user_name'];69 }70 if ($admins != "") $wakkaConfig['admin_users'] = $admins;71 71 } 72 72
Note: See TracChangeset
for help on using the changeset viewer.
