Changeset 1161 in ExiteCMS
- Timestamp:
- 12/08/07 00:11:27 (4 years ago)
- Location:
- modules/common/wiki/php-files/modules/wiki
- Files:
-
- 2 added
- 1 deleted
- 6 edited
-
actions/footer.php (modified) (2 diffs)
-
actions/usersettings.php (modified) (1 diff)
-
handlers/page/acls.php (modified) (5 diffs)
-
libs/Wakka.class.php (modified) (1 diff)
-
locale (deleted)
-
module_installer.php (modified) (10 diffs)
-
templates/modules.wiki.wiki_admin.tpl (added)
-
wiki_admin.php (added)
-
wikka.config.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
modules/common/wiki/php-files/modules/wiki/actions/footer.php
r986 r1161 34 34 } 35 35 36 print "</td>< td width='1%' align='right' style='white-space:nowrap;'>";36 print "</td></tr><tr>"; 37 37 echo $this->FormOpen("", "TextSearch", "get"); 38 ?>39 Search: <input name="phrase" size="15" class="searchbox" />40 <?php41 echo $this->FormClose();42 38 ?> 43 39 </td> … … 46 42 <table width='100%'> 47 43 <tr> 48 <td width='1%'> 44 <td width='1%' style='white-space:nowrap;'> 45 46 Search: <input name="phrase" size="75" class="searchbox" /> 47 <?php 48 echo $this->FormClose(); 49 ?> 50 </td> 51 <td width='1%' align='right'> 49 52 <?php 50 53 echo $this->GetPageTime() ? " <a href=\"".$this->href("revisions.xml")."\" title=\"Click to view recent page revisions in XML format.\"><img src=\"images/xml.png\" width=\"36\" height=\"14\" align=\"bottom\" style=\"border : 0px;\" alt=\"XML\" /></a>\n" : " "; 51 54 ?> 52 55 </td> 53 <td width='99%' align='right'> 56 </tr> 57 <tr> 58 <td colspan='2' width='99%' align='right'> 54 59 <div class="smallprint"> 55 60 <?php echo $this->Link("http://validator.w3.org/check/referer", "", "Valid XHTML 1.0 Transitional") ?> | -
modules/common/wiki/php-files/modules/wiki/actions/usersettings.php
r876 r1161 310 310 else 311 311 { 312 // print confirmation message on successful logout 313 if (isset($_GET['out']) && ($_GET['out'] == 'true')) 314 { 315 $success = USER_LOGGED_OUT; 316 } 317 318 // is user trying to log in or register? 319 if (isset($_POST['action']) && ($_POST['action'] == 'login')) 320 { 321 // if user name already exists, check password 322 if (isset($_POST['name']) && $existingUser = $this->LoadUser($_POST['name'])) 323 { 324 // check password 325 switch(TRUE){ 326 case (strlen($_POST['password']) == 0): 327 $error = ERROR_EMPTY_PASSWORD; 328 $password_highlight = INPUT_ERROR_STYLE; 329 break; 330 case (md5($_POST['password']) != $existingUser['password']): 331 $error = ERROR_WRONG_PASSWORD; 332 $password_highlight = INPUT_ERROR_STYLE; 333 break; 334 default: 335 $this->SetUser($existingUser); 336 $this->Redirect($url, ''); 337 } 338 } 339 // BEGIN *** Register *** 340 else // otherwise, proceed to registration 341 { 342 $name = trim($_POST['name']); 343 $email = trim($this->GetSafeVar('email', 'post')); 344 $password = $_POST['password']; 345 $confpassword = $_POST['confpassword']; 346 347 // validate input 348 switch(TRUE) 349 { 350 case (strlen($name) == 0): 351 $error = ERROR_EMPTY_USERNAME; 352 $username_highlight = INPUT_ERROR_STYLE; 353 break; 354 case (!$this->IsWikiName($name)): 355 $error = ERROR_WIKINAME; 356 $username_highlight = INPUT_ERROR_STYLE; 357 break; 358 case ($this->ExistsPage($name)): 359 $error = ERROR_RESERVED_PAGENAME; 360 $username_highlight = INPUT_ERROR_STYLE; 361 break; 362 case (strlen($password) == 0): 363 $error = ERROR_EMPTY_PASSWORD; 364 $password_highlight = INPUT_ERROR_STYLE; 365 break; 366 case (preg_match("/ /", $password)): 367 $error = ERROR_NO_BLANK; 368 $password_highlight = INPUT_ERROR_STYLE; 369 break; 370 case (strlen($password) < PASSWORD_MIN_LENGTH): 371 $error = sprintf(ERROR_PASSWORD_TOO_SHORT, PASSWORD_MIN_LENGTH); 372 $password_highlight = INPUT_ERROR_STYLE; 373 break; 374 case (strlen($confpassword) == 0): 375 $error = ERROR_EMPTY_CONFIRMATION_PASSWORD; 376 $password_highlight = INPUT_ERROR_STYLE; 377 $password_confirm_highlight = INPUT_ERROR_STYLE; 378 break; 379 case ($confpassword != $password): 380 $error = ERROR_PASSWORD_MATCH; 381 $password_highlight = INPUT_ERROR_STYLE; 382 $password_confirm_highlight = INPUT_ERROR_STYLE; 383 break; 384 case (strlen($email) == 0): 385 $error = ERROR_EMAIL_ADDRESS_REQUIRED; 386 $email_highlight = INPUT_ERROR_STYLE; 387 $password_highlight = INPUT_ERROR_STYLE; 388 $password_confirm_highlight = INPUT_ERROR_STYLE; 389 break; 390 case (!preg_match(VALID_EMAIL_PATTERN, $email)): 391 $error = ERROR_INVALID_EMAIL_ADDRESS; 392 $email_highlight = INPUT_ERROR_STYLE; 393 $password_highlight = INPUT_ERROR_STYLE; 394 $password_confirm_highlight = INPUT_ERROR_STYLE; 395 break; 396 default: //valid input, create user 397 $this->Query("INSERT INTO ".$this->config['table_prefix']."users SET ". 398 "signuptime = now(), ". 399 "name = '".mysql_real_escape_string($name)."', ". 400 "email = '".mysql_real_escape_string($email)."', ". 401 "password = md5('".mysql_real_escape_string($_POST['password'])."')"); 402 403 // log in 404 $this->SetUser($this->LoadUser($name)); 405 $params .= 'registered=true'; 406 $this->Redirect($url.$params); 407 } 408 } 409 // END *** Register *** 410 } 411 412 // BEGIN *** Usersettings *** 413 elseif (isset($_POST['action']) && ($_POST['action'] == 'updatepass')) 414 { 415 $name = trim($_POST['yourname']); 416 if (strlen($name) == 0) // empty username 417 { 418 $newerror = ERROR_EMPTY_USERNAME; 419 $username_temp_highlight = INPUT_ERROR_STYLE; 420 } 421 elseif (!$this->IsWikiName($name)) // check if name is WikiName style 422 { 423 $newerror = ERROR_WIKINAME; 424 $username_temp_highlight = INPUT_ERROR_STYLE; 425 } 426 elseif (!($this->LoadUser($_POST['yourname']))) //check if user exists 427 { 428 $newerror = ERROR_NON_EXISTENT_USERNAME; 429 $username_temp_highlight = INPUT_ERROR_STYLE; 430 } 431 elseif ($existingUser = $this->LoadUser($_POST['yourname'])) // if user name already exists, check password 432 { 433 // updatepassword 434 if ($existingUser['password'] == $_POST['temppassword']) 435 { 436 $this->SetUser($existingUser, $_POST['remember']); 437 $this->Redirect($url); 438 } 439 else 440 { 441 $newerror = ERROR_WRONG_PASSWORD; 442 $password_temp_highlight = INPUT_ERROR_STYLE; 443 } 444 } 445 } 446 // END *** Usersettings *** 447 448 // BEGIN *** Login/Register *** 449 print($this->FormOpen()); 450 ?> 451 <input type="hidden" name="action" value="login" /> 452 <table class="usersettings"> 453 <tr> 454 <td colspan="2"><?php echo $this->Format(REGISTER_HEADING) ?></td> 455 <td> </td> 456 </tr> 457 <tr> 458 <td> </td> 459 <td><?php echo $this->Format(REGISTERED_USER_LOGIN_LABEL); ?></td> 460 </tr> 461 <?php 462 switch (true) 463 { 464 case (isset($error)): 465 echo '<tr><td></td><td><em class="error">'.$this->Format($error).'</em></td></tr>'."\n"; 466 break; 467 case (isset($success)): 468 echo '<tr><td></td><td><em class="success">'.$this->Format($success).'</em></td></tr>'."\n"; 469 break; 470 } 471 ?> 472 <tr> 473 <td align="right"><?php echo WIKINAME_LABEL ?></td> 474 <td><input <?php echo $username_highlight; ?> name="name" size="40" value="<?php echo $this->GetSafeVar('name', 'post'); ?>" /></td> 475 </tr> 476 <tr> 477 <td align="right"><?php echo sprintf(PASSWORD_LABEL, PASSWORD_MIN_LENGTH) ?></td> 478 <td><input <?php echo $password_highlight; ?> type="password" name="password" size="40" /></td> 479 </tr> 480 <tr> 481 <td> </td> 482 <td><input type="submit" value="<?php echo LOGIN_BUTTON_LABEL ?>" size="40" /></td> 483 </tr> 484 <tr> 485 <td> </td> 486 <td width="500"><?php echo $this->Format(NEW_USER_REGISTER_LABEL); ?></td> 487 </tr> 488 <tr> 489 <td align="right"><?php echo CONFIRM_PASSWORD_LABEL ?></td> 490 <td><input <?php echo $password_confirm_highlight; ?> type="password" name="confpassword" size="40" /></td> 491 </tr> 492 <tr> 493 <td align="right"><?php echo USER_EMAIL_LABEL ?></td> 494 <td><input <?php echo $email_highlight; ?> name="email" size="40" value="<?php echo $email; ?>" /></td> 495 </tr> 496 <tr> 497 <td> </td> 498 <td><input type="submit" value="<?php echo REGISTER_BUTTON_LABEL ?>" size="40" /></td> 499 </tr> 500 </table> 501 <?php 502 print($this->FormClose()); 503 // END *** Login/Register *** 504 505 // BEGIN *** Login Temp Password *** 506 print($this->FormOpen()); 507 ?> 508 <input type="hidden" name="action" value="updatepass" /> 509 <table class="usersettings"> 510 <tr> 511 <td colspan="2"><br /><hr /><?php echo $this->Format(RETRIEVE_PASSWORD_HEADING) ?></td><td></td> 512 </tr> 513 <tr> 514 <td align="left"></td> 515 <td><?php echo $this->Format(RETRIEVE_PASSWORD_MESSAGE) ?></td> 516 </tr> 517 <?php 518 if (isset($newerror)) 519 { 520 print('<tr><td></td><td><em class="error">'.$this->Format($newerror).'</em></td></tr>'."\n"); 521 } 522 ?> 523 <tr> 524 <td align="right"><?php echo WIKINAME_LABEL ?></td> 525 <td><input <?php echo $username_temp_highlight; ?> name="yourname" value="<?php echo $this->GetSafeVar('yourname', 'post'); ?>" size="40" /></td> 526 </tr> 527 <tr> 528 <td align="right"><?php echo TEMP_PASSWORD_LABEL ?></td> 529 <td><input <?php echo $password_temp_highlight; ?> name="temppassword" size="40" /></td> 530 </tr> 531 <tr> 532 <td> </td> 533 <td><input type="submit" value="<?php echo LOGIN_BUTTON_LABEL ?>" size="40" /></td> 534 </tr> 535 </table> 536 <?php 537 print($this->FormClose()); 538 // END *** Login Temp Password *** 312 echo '<p><em class="error">You aren\'t allowed to read this page.</em></p></div>'; 313 echo "\n".'</div><!--closing page content-->'."\n"; //TODO: move to templating class 539 314 } 540 315 ?> -
modules/common/wiki/php-files/modules/wiki/handlers/page/acls.php
r806 r1161 13 13 * @todo - move main <div> to templating class 14 14 */ 15 global $db_prefix, $locale, $settings, $userdata; 15 16 16 17 //i18n … … 20 21 if (!defined('PAGE_OWNERSHIP_CHANGED')) define('PAGE_OWNERSHIP_CHANGED', 'Ownership changed to %s'); // %s - name of new owner 21 22 if (!defined('ACL_HEADING')) define('ACL_HEADING', '====Access Control Lists for %s===='); // %s - name of current page 22 if (!defined('READ_ACL_LABEL')) define('READ_ACL_LABEL', 'Read ACL :');23 if (!defined('WRITE_ACL_LABEL')) define('WRITE_ACL_LABEL', 'Write ACL :');24 if (!defined('COMMENT_ACL_LABEL')) define('COMMENT_ACL_LABEL', 'Comment ACL :');23 if (!defined('READ_ACL_LABEL')) define('READ_ACL_LABEL', 'Read ACL for this page'); 24 if (!defined('WRITE_ACL_LABEL')) define('WRITE_ACL_LABEL', 'Write ACL for this page'); 25 if (!defined('COMMENT_ACL_LABEL')) define('COMMENT_ACL_LABEL', 'Comment ACL for this page'); 25 26 if (!defined('SET_OWNER_LABEL')) define('SET_OWNER_LABEL', 'Set Page Owner:'); 26 27 if (!defined('SET_OWNER_CURRENT_LABEL')) define('SET_OWNER_CURRENT_LABEL', '(Current Owner)'); 27 28 if (!defined('SET_OWNER_PUBLIC_LABEL')) define('SET_OWNER_PUBLIC_LABEL','(Public)'); 28 29 if (!defined('SET_NO_OWNER_LABEL')) define('SET_NO_OWNER_LABEL', '(Nobody - Set free)'); 29 if (!defined('ACL_SYNTAX_HELP')) define('ACL_SYNTAX_HELP', '===Syntax:=== ---##*## = Everyone ---##+## = Registered users ---##""JohnDoe""## = the user called ""JohnDoe"", enter as many users as you want, one per line --- --- Any of these items can be negated with a ##!##: ---##!*## = No one (except admins) ---##!+## = Anonymous users only ---##""!JohnDoe""## = ""JohnDoe"" will be denied access --- --- //ACLs are tested in the order they are specified:// --- So be sure to specify ##*## on a separate line //after// negating any users, not before.'); 30 if (!defined('USERS_LABEL')) define('USERS_LABEL', 'Users:'); 31 if (!defined('SELECTED_LABEL')) define('SELECTED_LABEL', 'Selected:'); 32 if (!defined('GROUPS_LABEL')) define('GROUPS_LABEL', 'Usergroups:'); 33 if (!defined('INSTRUCTION_LABEL')) define('INSTRUCTION_LABEL', 'Click on the user or groupname to move it in or out of the selected box'); 30 34 31 35 echo '<div class="page">'."\n"; //TODO: move to templating class … … 38 42 $default_write_acl = $this->GetConfigValue('default_write_acl'); 39 43 $default_comment_acl = $this->GetConfigValue('default_comment_acl'); 40 $posted_read_acl = $_POST['read_acl']; 41 $posted_write_acl = $_POST['write_acl']; 42 $posted_comment_acl = $_POST['comment_acl']; 44 $posted_read_acl = ""; 45 if (is_array($_POST['read_acl_selected'])) { 46 foreach($_POST['read_acl_selected'] as $value) { 47 $posted_read_acl .= $value."\n"; 48 } 49 } 50 $posted_write_acl = ""; 51 if (is_array($_POST['write_acl_selected'])) { 52 foreach($_POST['write_acl_selected'] as $value) { 53 $posted_write_acl .= $value."\n"; 54 } 55 } 56 $posted_comment_acl = ""; 57 if (is_array($_POST['comment_acl_selected'])) { 58 foreach($_POST['comment_acl_selected'] as $value) { 59 $posted_comment_acl .= $value."\n"; 60 } 61 } 43 62 $message = ''; 44 63 … … 81 100 else // show form 82 101 { 83 echo $this->Format(sprintf(ACL_HEADING, '[['.$this->tag.']]').' --- '); 102 echo $this->Format(sprintf(ACL_HEADING, '[['.$this->tag.']]').' --- '); 103 // get the list of groups 104 $user_groups = getusergroups(); 105 // get the list of users 106 $user_list = array(); 107 $result = dbquery("SELECT u.user_id, u.user_name FROM ".$db_prefix."users u WHERE user_status = 0 ORDER BY user_level DESC, user_name ASC"); 108 while ($data = dbarray($result)) { 109 // no need to give yourself access. owners always have full access 110 if (!iMEMBER || $data['user_id'] != $userdata['user_id']) { 111 $user_list[] = $data; 112 } 113 } 114 // populate the selected fields 115 if ($this->ACLs['read_acl'] == "") { 116 $selected_read_acl = array(); 117 } else { 118 $selected_read_acl = explode("\n", $this->ACLs['read_acl']); 119 foreach ($selected_read_acl as $key => $acl) { 120 if ($acl{0} == "G") { 121 $group = substr($acl,1); 122 foreach ($user_groups as $user_group) { 123 if ($user_group[0] == $group) { 124 $selected_read_acl[$key] = array($acl, $user_group[1]); 125 break; 126 } 127 } 128 if (!is_array($selected_read_acl[$key])) $selected_read_acl[$key] = array($key, "?"); 129 } else { 130 $result = dbquery("SELECT u.user_id, u.user_name FROM ".$db_prefix."users u WHERE user_status = 0 AND user_id = '$acl' LIMIT 1"); 131 if (dbrows($result)) { 132 $data = dbarray($result); 133 $selected_read_acl[$key] = array($acl, $data['user_name']); 134 } 135 } 136 } 137 } 138 if ($this->ACLs['write_acl'] == "") { 139 $selected_write_acl = array(); 140 } else { 141 $selected_write_acl = explode("\n", $this->ACLs['write_acl']); 142 foreach ($selected_write_acl as $key => $acl) { 143 if ($acl{0} == "G") { 144 $group = substr($acl,1); 145 foreach ($user_groups as $user_group) { 146 if ($user_group[0] == $group) { 147 $selected_write_acl[$key] = array($acl, $user_group[1]); 148 break; 149 } 150 } 151 if (!is_array($selected_write_acl[$key])) $selected_write_acl[$key] = array($key, "?"); 152 } else { 153 $result = dbquery("SELECT u.user_id, u.user_name FROM ".$db_prefix."users u WHERE user_status = 0 AND user_id = '$acl' LIMIT 1"); 154 if (dbrows($result)) { 155 $data = dbarray($result); 156 $selected_write_acl[$key] = array($acl, $data['user_name']); 157 } 158 } 159 } 160 } 161 if ($this->ACLs['comment_acl'] == "") { 162 $selected_comment_acl = array(); 163 } else { 164 $selected_comment_acl = explode("\n", $this->ACLs['comment_acl']); 165 foreach ($selected_comment_acl as $key => $acl) { 166 if ($acl{0} == "G") { 167 $group = substr($acl,1); 168 foreach ($user_groups as $user_group) { 169 if ($user_group[0] == $group) { 170 $selected_comment_acl[$key] = array($acl, $user_group[1]); 171 break; 172 } 173 } 174 if (!is_array($selected_comment_acl[$key])) $selected_comment_acl[$key] = array($key, "?"); 175 } else { 176 $result = dbquery("SELECT u.user_id, u.user_name FROM ".$db_prefix."users u WHERE user_status = 0 AND user_id = '$acl' LIMIT 1"); 177 if (dbrows($result)) { 178 $data = dbarray($result); 179 $selected_comment_acl[$key] = array($acl, $data['user_name']); 180 } 181 } 182 } 183 } 84 184 ?> 85 185 <?php echo $this->FormOpen('acls') ?> 86 <table class="acls"> 186 <table class="acls" width="100%"> 187 <tr> 188 <td colspan='3' class='tbl2' align='center'> 189 <strong><?php echo READ_ACL_LABEL; ?></strong> 190 </td> 191 </tr> 192 <tr> 193 <td width='33%' align='center'> 194 <strong><?php echo USERS_LABEL; ?></strong> 195 </td> 196 <td width='33%' align='center'> 197 <strong><?php echo SELECTED_LABEL; ?></strong> 198 </td> 199 <td width='33%' align='center'> 200 <strong><?php echo GROUPS_LABEL; ?></strong> 201 </td> 202 </tr> 203 <tr> 204 <td width='33%' align='left'> 205 <select multiple="multiple" size='5' id='read_acl_users' name='read_acl_users' class='textbox' style='width:175px;' onclick='return AddUser(this, "r");'> 206 <?php 207 foreach($user_list as $entry) { 208 echo "<option value='".$entry['user_id']."'>".$entry['user_name']."</option>\n"; 209 } 210 ?> 211 </select> 212 </td> 213 <td width='33%'> 214 <select multiple="multiple" size='5' name='read_acl_selected[]' id='read_acl_selected' class='textbox' style='width:175px' onclick='return RemoveSelected(this);'> 215 <?php 216 foreach($selected_read_acl as $entry) { 217 echo "<option value='".$entry[0]."'>".($entry[0]{0}=="G"?"@":"").$entry[1]."</option>\n"; 218 } 219 ?> 220 </select> 221 </td> 222 <td width='33%' align='right'> 223 <select multiple="multiple" size='5' id='read_acl_groups' name='read_acl_groups' class='textbox' style='width:175px;' onclick='return AddGroup(this, "r");'> 224 <?php 225 foreach($user_groups as $entry) { 226 echo "<option value='G".$entry[0]."'>".$entry[1]."</option>\n"; 227 } 228 ?> 229 </select> 230 </td> 231 </tr> 232 <tr> 233 <td colspan='3' align='center'> 234 <br /> 235 </td> 236 </tr> 237 <tr> 238 <td colspan='3' class='tbl2' align='center'> 239 <strong><?php echo WRITE_ACL_LABEL; ?></strong> 240 </td> 241 </tr> 242 <tr> 243 <td width='33%' align='center'> 244 <strong><?php echo USERS_LABEL; ?></strong> 245 </td> 246 <td width='33%' align='center'> 247 <strong><?php echo SELECTED_LABEL; ?></strong> 248 </td> 249 <td width='33%' align='center'> 250 <strong><?php echo GROUPS_LABEL; ?></strong> 251 </td> 252 </tr> 253 <tr> 254 <td width='33%' align='left'> 255 <select multiple="multiple" size='5' id='write_acl_users' name='write_acl_users' class='textbox' style='width:175px;' onclick='return AddUser(this, "w");'> 256 <?php 257 foreach($user_list as $entry) { 258 echo "<option value='".$entry['user_id']."'>".$entry['user_name']."</option>\n"; 259 } 260 ?> 261 </select> 262 </td> 263 <td width='33%'> 264 <select multiple="multiple" size='5' name='write_acl_selected[]' id='write_acl_selected' class='textbox' style='width:175px' onclick='return RemoveSelected(this);'> 265 <?php 266 foreach($selected_write_acl as $entry) { 267 echo "<option value='".$entry[0]."'>".($entry[0]{0}=="G"?"@":"").$entry[1]."</option>\n"; 268 } 269 ?> 270 </select> 271 </td> 272 <td width='33%' align='right'> 273 <select multiple="multiple" size='5' id='write_acl_groups' name='write_acl_groups' class='textbox' style='width:175px;' onclick='return AddGroup(this, "w");'> 274 <?php 275 foreach($user_groups as $entry) { 276 echo "<option value='G".$entry[0]."'>".$entry[1]."</option>\n"; 277 } 278 ?> 279 </select> 280 </td> 281 </tr> 282 <tr> 283 <td colspan='3' align='center'> 284 <br /> 285 </td> 286 </tr> 287 <tr> 288 <td colspan='3' class='tbl2' align='center'> 289 <strong><?php echo COMMENT_ACL_LABEL; ?></strong> 290 </td> 291 </tr> 292 <tr> 293 <td width='33%' align='center'> 294 <strong><?php echo USERS_LABEL; ?></strong> 295 </td> 296 <td width='33%' align='center'> 297 <strong><?php echo SELECTED_LABEL; ?></strong> 298 </td> 299 <td width='33%' align='center'> 300 <strong><?php echo GROUPS_LABEL; ?></strong> 301 </td> 302 </tr> 303 <tr> 304 <td width='33%' align='left'> 305 <select multiple="multiple" size='5' id='comment_acl_users' name='comment_acl_users' class='textbox' style='width:175px;' onclick='return AddUser(this, "c");'> 306 <?php 307 foreach($user_list as $entry) { 308 echo "<option value='".$entry['user_id']."'>".$entry['user_name']."</option>\n"; 309 } 310 ?> 311 </select> 312 </td> 313 <td width='33%'> 314 <select multiple="multiple" size='5' name='comment_acl_selected[]' id='comment_acl_selected' class='textbox' style='width:175px' onclick='return RemoveSelected(this);'> 315 <?php 316 foreach($selected_comment_acl as $entry) { 317 echo "<option value='".$entry[0]."'>".($entry[0]{0}=="G"?"@":"").$entry[1]."</option>\n"; 318 } 319 ?> 320 </select> 321 </td> 322 <td width='33%' align='right'> 323 <select multiple="multiple" size='5' id='comment_acl_groups' name='comment_acl_groups' class='textbox' style='width:175px;' onclick='return AddGroup(this, "c");'> 324 <?php 325 foreach($user_groups as $entry) { 326 echo "<option value='G".$entry[0]."'>".$entry[1]."</option>\n"; 327 } 328 ?> 329 </select> 330 </td> 331 </tr> 332 <tr> 333 <td colspan='3' align='center'> 334 <br /> 335 <strong><?php echo INSTRUCTION_LABEL; ?></strong> 336 </td> 337 </tr> 87 338 <tr> 88 339 <td> 89 <strong><?php echo READ_ACL_LABEL; ?></strong><br />90 <textarea name="read_acl" rows="4" cols="20"><?php echo $this->ACLs['read_acl'] ?></textarea>91 </td>92 93 <td>94 <strong><?php echo WRITE_ACL_LABEL; ?></strong><br />95 <textarea name="write_acl" rows="4" cols="20"><?php echo $this->ACLs['write_acl'] ?></textarea>96 </td>97 98 <td>99 <strong><?php echo COMMENT_ACL_LABEL; ?></strong><br />100 <textarea name="comment_acl" rows="4" cols="20"><?php echo $this->ACLs['comment_acl'] ?></textarea>101 </td>102 </tr>103 104 <tr>105 <td colspan="2">106 340 <br /> 107 <input type="submit" class="button" value="Store ACLs" />341 <input type="submit" class="button" value="Store ACLs" onclick="PrepareSave();" /> 108 342 <input type="button" class="button" value="Cancel" onclick="history.back();" /> 109 343 </td> 110 344 111 <td> 112 <strong><?php echo SET_OWNER_LABEL; ?></strong><br /> 345 <td colspan='2' align="right"> 346 <br /> 347 <strong><?php echo SET_OWNER_LABEL; ?></strong> 113 348 <select name="newowner"> 114 349 <option value="same"><?php echo $this->GetPageOwner().' '.SET_OWNER_CURRENT_LABEL ?></option> … … 128 363 </tr> 129 364 </table> 130 131 <br /> 132 <?php echo $this->Format(ACL_SYNTAX_HELP); ?> 365 <script type='text/javascript'> 366 function AddUser(fld, fldtype) { 367 var i = 0; 368 switch (fldtype) { 369 case "c": 370 var listLength = document.getElementById("comment_acl_selected").length; 371 for (i=0; i < listLength; i++) { 372 if (document.getElementById("comment_acl_selected").options[i].value == fld.options[fld.selectedIndex].value) return false; 373 } 374 document.getElementById("comment_acl_selected").options[listLength] = new Option(fld.options[fld.selectedIndex].text, fld.options[fld.selectedIndex].value); 375 break; 376 case "r": 377 var listLength = document.getElementById("read_acl_selected").length; 378 for (i=0; i < listLength; i++) { 379 if (document.getElementById("read_acl_selected").options[i].value == fld.options[fld.selectedIndex].value) return false; 380 } 381 document.getElementById("read_acl_selected").options[listLength] = new Option(fld.options[fld.selectedIndex].text, fld.options[fld.selectedIndex].value); 382 break; 383 case "w": 384 var listLength = document.getElementById("write_acl_selected").length; 385 for (i=0; i < listLength; i++) { 386 if (document.getElementById("write_acl_selected").options[i].value == fld.options[fld.selectedIndex].value) return false; 387 } 388 document.getElementById("write_acl_selected").options[listLength] = new Option(fld.options[fld.selectedIndex].text, fld.options[fld.selectedIndex].value); 389 break; 390 } 391 return false; 392 } 393 394 function AddGroup(fld, fldtype) { 395 var i = 0; 396 switch (fldtype) { 397 case "c": 398 var listLength = document.getElementById("comment_acl_selected").length; 399 document.getElementById("comment_acl_selected").options[listLength] = new Option("@"+fld.options[fld.selectedIndex].text, fld.options[fld.selectedIndex].value); 400 for (i=0; i < listLength; i++) { 401 if (document.getElementById("comment_acl_selected").options[i].value == fld.options[fld.selectedIndex].value) return false; 402 } 403 break; 404 case "r": 405 var listLength = document.getElementById("read_acl_selected").length; 406 for (i=0; i < listLength; i++) { 407 if (document.getElementById("read_acl_selected").options[i].value == fld.options[fld.selectedIndex].value) return false; 408 } 409 document.getElementById("read_acl_selected").options[listLength] = new Option("@"+fld.options[fld.selectedIndex].text, fld.options[fld.selectedIndex].value); 410 break; 411 case "w": 412 var listLength = document.getElementById("write_acl_selected").length; 413 for (i=0; i < listLength; i++) { 414 if (document.getElementById("write_acl_selected").options[i].value == fld.options[fld.selectedIndex].value) return false; 415 } 416 document.getElementById("write_acl_selected").options[listLength] = new Option("@"+fld.options[fld.selectedIndex].text, fld.options[fld.selectedIndex].value); 417 break; 418 } 419 return false; 420 } 421 422 function RemoveSelected(fld) { 423 fld.options[fld.selectedIndex] = null; 424 return false; 425 } 426 427 function PrepareSave() { 428 var i = 0; 429 var listlength = 0; 430 listlength = document.getElementById("comment_acl_selected").options.length; 431 for (var i = 0; i < listlength; i++) { 432 document.getElementById("comment_acl_selected").options[i].selected = true; 433 } 434 listlength = document.getElementById("read_acl_selected").options.length; 435 for (var i = 0; i < listlength; i++) { 436 document.getElementById("read_acl_selected").options[i].selected = true; 437 } 438 listlength = document.getElementById("write_acl_selected").options.length; 439 for (var i = 0; i < listlength; i++) { 440 document.getElementById("write_acl_selected").options[i].selected = true; 441 } 442 } 443 444 </script> 445 133 446 <?php 134 447 print($this->FormClose()); -
modules/common/wiki/php-files/modules/wiki/libs/Wakka.class.php
r984 r1161 1236 1236 $acl = $tag_ACLs[$privilege."_acl"]; 1237 1237 } 1238 1239 1238 // fine fine... now go through acl 1240 1239 foreach (explode("\n", $acl) as $line) 1241 1240 { 1242 // check for inversion character "!" 1243 if (preg_match("/^[!](.*)$/", $line, $matches)) 1244 { 1245 $negate = 1; 1246 $line = $matches[1]; 1247 } 1248 else 1249 { 1250 $negate = 0; 1251 } 1252 1253 // if there's still anything left... lines with just a "!" don't count! 1254 if ($line) 1255 { 1256 switch ($line[0]) 1257 { 1258 // comments 1259 case "#": 1260 break; 1261 // everyone 1262 case "*": 1263 return !$negate; 1264 // only registered users 1265 case "+": 1266 // return ($registered) ? !$negate : false; 1267 return ($registered) ? !$negate : $negate; 1268 // aha! a user entry. 1269 default: 1270 if ($line == $user) 1271 { 1272 return !$negate; 1273 } 1274 } 1241 if ($line{0} == "G") { 1242 // check group membership 1243 if (checkgroup(substr($line,1))) return true; 1244 } else { 1245 // check userid for a match 1246 if (iMEMBER && $userdata['user_id'] == $line) return true; 1275 1247 } 1276 1248 } -
modules/common/wiki/php-files/modules/wiki/module_installer.php
r1074 r1161 16 16 17 17 /*---------------------------------------------------+ 18 | Locale definition for this installation module |19 +----------------------------------------------------*/20 21 locale_load("modules.wiki");22 23 /*---------------------------------------------------+24 18 | Module identification | 25 19 +----------------------------------------------------*/ 26 $mod_title = $locale['wiki100'];// title or name of this module27 $mod_description = $locale['wiki101'];// short description of it's purpose20 $mod_title = "Wikka Wiki"; // title or name of this module 21 $mod_description = "ExiteCMS embedded implementation of Wikka Wakka Wiki"; // short description of it's purpose 28 22 $mod_version = "1.0.2"; // module version number 29 23 $mod_developer = "WanWizard"; // author's name … … 64 58 65 59 $mod_site_links = array(); // site_links definitions. Multiple can be defined 66 $mod_site_links[] = array('name' => $locale['wiki102'], 'url' => 'index.php', 'panel' => '', 'visibility' => 102); 60 $mod_site_links[] = array('name' => 'ExiteCMS Wiki', 'url' => 'index.php', 'panel' => '', 'visibility' => 102); 61 62 /*---------------------------------------------------+ 63 | locale strings for this module | 64 +----------------------------------------------------*/ 65 66 $localestrings = array(); 67 $localestrings['en'] = array(); 68 $localestrings['en']['400'] = "Wiki Configuration"; 69 $localestrings['en']['401'] = "Name of this wiki:"; 70 $localestrings['en']['402'] = "Name of the homepage:"; 71 $localestrings['en']['403'] = "Wiki navigation (guests):"; 72 $localestrings['en']['404'] = "Wiki navigation (users):"; 73 $localestrings['en']['405'] = "Allow users to leave comments:"; 74 $localestrings['en']['406'] = "Page note required when editing?"; 75 $localestrings['en']['407'] = "Anonymous user can delete comments:"; 76 $localestrings['en']['408'] = "Open external links in a new window:"; 77 $localestrings['en']['409'] = "Wiki administrators:"; 78 $localestrings['en']['410'] = "Default read access for:"; 79 $localestrings['en']['411'] = "Default write access for:"; 80 $localestrings['en']['412'] = "Default allow comments by:"; 81 $localestrings['en']['413'] = "Yes"; 82 $localestrings['en']['414'] = "No"; 83 $localestrings['en']['415'] = "Disabled"; 84 $localestrings['en']['416'] = "Optional"; 85 $localestrings['en']['419'] = "Save Settings"; 86 $localestrings['en']['420'] = "(only if IP address matches)"; 87 88 $localestrings = array(); 89 $localestrings['nl'] = array(); 90 $localestrings['nl']['400'] = "Wiki configuratie"; 91 $localestrings['nl']['401'] = "Naam van deze wiki:"; 92 $localestrings['nl']['402'] = "Naam van de beginpagina:"; 93 $localestrings['nl']['403'] = "Wiki navigatie menu (bezoekers):"; 94 $localestrings['nl']['404'] = "Wiki navigatie menu (leden):"; 95 $localestrings['nl']['405'] = "Sta gebruikers toe om commentaar te geven:"; 96 $localestrings['nl']['406'] = "Reden van modificatie verplicht?"; 97 $localestrings['nl']['407'] = "Bezoekers mogen hun commentaar verwijderen:"; 98 $localestrings['nl']['408'] = "Open externe links in een nieuw scherm:"; 99 $localestrings['nl']['409'] = "Wiki beheerders:"; 100 $localestrings['nl']['410'] = "Standaard lezen toegestaan voor:"; 101 $localestrings['nl']['411'] = "Standaard schrijven toegestaan voor:"; 102 $localestrings['nl']['412'] = "Standaard commentaar geven voor:"; 103 $localestrings['nl']['413'] = "Ja"; 104 $localestrings['nl']['414'] = "Nee"; 105 $localestrings['nl']['415'] = "Uitgeschakeld"; 106 $localestrings['nl']['416'] = "Optioneel"; 107 $localestrings['nl']['419'] = "Bewaren"; 108 $localestrings['nl']['420'] = "(alleen vanaf hun eigen IP adres)"; 67 109 68 110 /*---------------------------------------------------+ … … 82 124 83 125 // and add initial record(s) to it 84 $mod_install_cmds[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##wiki_acls (page_tag, read_acl, write_acl, comment_acl) VALUES ('UserSettings', ' *', '+', '+')");126 $mod_install_cmds[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##wiki_acls (page_tag, read_acl, write_acl, comment_acl) VALUES ('UserSettings', 'G0', 'G101', 'G101')"); 85 127 86 128 // create the table: wiki_comments … … 143 185 $mod_install_cmds[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##wiki_pages (id, tag, time, body, owner, user, latest, note, handler) VALUES (17, 'CategoryWiki', now(), '===Wiki Related Category===\nThis Category will contain links to pages talking about Wikis and Wikis specific topics. When creating such pages, be sure to include CategoryWiki at the bottom of each page, so that page shows listed.\n\n\n----\n\n{{Category col=\"3\"}}\n\n\n----\n[[CategoryCategory List of all categories]]', '(Public)', '##WEBMASTER##', 'Y', '', 'page')"); 144 186 $mod_install_cmds[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##wiki_pages (id, tag, time, body, owner, user, latest, note, handler) VALUES (18, 'CategoryCategory', now(), '===List of All Categories===\nBelow is the list of all Categories existing on this Wiki, granted that users did things right when they created their pages or new Categories. See WikiCategory for how the system works.\n\n----\n\n{{Category}}', '(Public)', '##WEBMASTER##', 'Y', '', 'page')"); 145 $mod_install_cmds[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##wiki_pages (id, tag, time, body, owner, user, latest, note, handler) VALUES (19, 'FormattingRules', now(), '======Wikka Formatting Guide======\n\n<<**Note:** Anything between 2 sets of double-quotes is not formatted.<<::c::\nOnce you have read through this, test your formatting skills in the SandBox.\n----\n===1. Text Formatting===\n\n~##\"\"**I''m bold**\"\"##\n~**I''m bold **\n\n~##\"\"//I''m italic text!//\"\"##\n~//I''m italic text!//\n\n~##\"\"And I''m __underlined__!\"\"##\n~And I''m __underlined__!\n\n~##\"\"##monospace text##\"\"##\n~##monospace text##\n\n~##\"\"''''highlight text''''\"\"## (using 2 single-quotes)\n~''''highlight text''''\n\n~##\"\"++Strike through text++\"\"##\n~++Strike through text++\n\n~##\"\"Press #%ANY KEY#%\"\"##\n~Press #%ANY KEY#%\n\n~##\"\"@@Center text@@\"\"##\n~@@Center text@@\n\n===2. Headers===\n\nUse between five ##=## (for the biggest header) and two ##=## (for the smallest header) on both sides of a text to render it as a header.\n\n~##\"\"====== Really big header ======\"\"##\n~====== Really big header ======\n \n~##\"\"===== Rather big header =====\"\"##\n~===== Rather big header =====\n\n~##\"\"==== Medium header ====\"\"##\n~==== Medium header ====\n\n~##\"\"=== Not-so-big header ===\"\"##\n~=== Not-so-big header ===\n\n~##\"\"== Smallish header ==\"\"##\n~== Smallish header ==\n\n===3. Horizontal separator===\n~##\"\"----\"\"##\n----\n\n===4. Forced line break===\n~##\"\"---\"\"##\n---\n\n===5. Lists and indents===\n\nYou can indent text using a **~**, a **tab** or **4 spaces** (which will auto-convert into a tab).\n\n##\"\"~This text is indented<br />~~This text is double-indented<br /> This text is also indented\"\"##\n\n~This text is indented\n~~This text is double-indented\n This text is also indented\n\nTo create bulleted/ordered lists, use the following markup (you can always use 4 spaces instead of a ##**~**##):\n\n**Bulleted lists**\n##\"\"~- Line one\"\"##\n##\"\"~- Line two\"\"##\n\n- Line one\n- Line two\n\n**Numbered lists**\n##\"\"~1) Line one\"\"##\n##\"\"~1) Line two\"\"##\n\n1) Line one\n1) Line two\n\n**Ordered lists using uppercase characters**\n##\"\"~A) Line one\"\"##\n##\"\"~A) Line two\"\"##\n\nA) Line one\nA) Line two\n\n**Ordered lists using lowercase characters**\n##\"\"~a) Line one\"\"##\n##\"\"~a) Line two\"\"##\n\na) Line one\na) Line two\n\n**Ordered lists using roman numerals**\n##\"\"~I) Line one\"\"##\n##\"\"~I) Line two\"\"##\n\n I) Line one\nI) Line two\n\n**Ordered lists using lowercase roman numerals**\n##\"\"~i) Line one\"\"##\n##\"\"~i) Line two\"\"##\n\n i) Line one\ni) Line two\n\n===6. Inline comments===\n\nTo format some text as an inline comment, use an indent ( **~**, a **tab** or **4 spaces**) followed by a **\"\"&\"\"**.\n\n**Example:**\n\n##\"\"~& Comment\"\"##\n##\"\"~~& Subcomment\"\"##\n##\"\"~~~& Subsubcomment\"\"##\n\n~& Comment\n~~& Subcomment\n~~~& Subsubcomment\n\n===7. Images===\n\nTo place images on a Wiki page, you can use the ##image## action.\n\n**Example:**\n\n~##\"\"{{image class=\"center\" alt=\" DVD logo\" title=\"An Image Link\" url=\"images/dvdvideo.gif\" link=\"RecentChanges\"}}\"\"##\n~{{image class=\"center\" alt=\"dvd logo\" title=\"An Image Link\" url=\"images/dvdvideo.gif\" link=\"RecentChanges\"}}\n\nLinks can be external, or internal Wiki links. You don''t need to enter a link at all, and in that case just an image will be inserted. You can use the optional classes ##left## and ##right## to float images left and right. You don''t need to use all those attributes, only ##url## is required while ##alt## is recommended for accessibility.\n\n===8. Links===\n\nTo create a **link to a wiki page** you can use any of the following options: ---\n~1) type a ##\"\"WikiName\"\"##: --- --- ##\"\"FormattingRules\"\"## --- FormattingRules --- ---\n~1) add a forced link surrounding the page name by ##\"\"[[\"\"## and ##\"\"]]\"\"## (everything after the first space will be shown as description): --- --- ##\"\"[[SandBox Test your formatting skills]]\"\"## --- [[SandBox Test your formatting skills]] --- --- ##\"\"[[SandBox 沙箱]]\"\"## --- [[SandBox 沙箱]] --- ---\n~1) add an image with a link (see instructions above).\n\nTo **link to external pages**, you can do any of the following: ---\n~1) type a URL inside the page: --- --- ##\"\"http://www.example.com\"\"## --- http://www.example.com --- --- \n~1) add a forced link surrounding the URL by ##\"\"[[\"\"## and ##\"\"]]\"\"## (everything after the first space will be shown as description): --- --- ##\"\"[[http://example.com/jenna/ Jenna''s Home Page]]\"\"## --- [[http://example.com/jenna/ Jenna''s Home Page]] --- --- ##\"\"[[mail@example.com Write me!]]\"\"## --- [[mail@example.com Write me!]] ---\nFor links to pages within the current website, use a relative link without the http:// prefix. ---\n~1) add an image with a link (see instructions above);\n~1) add an interwiki link (browse the [[InterWiki list of available interwiki tags]]): --- --- ##\"\"WikiPedia:WikkaWiki\"\"## --- WikiPedia:WikkaWiki --- --- ##\"\"Google:CSS\"\"## --- Google:CSS --- --- ##\"\"Thesaurus:Happy\"\"## --- Thesaurus:Happy --- ---\n\n===9. Tables===\n\nTo create a table, you can use the ##table## action.\n\n**Example:**\n\n~##\"\"{{table columns=\"3\" cellpadding=\"1\" cells=\"BIG;GREEN;FROGS;yes;yes;no;no;no;###\"}}\"\"##\n\n~{{table columns=\"3\" cellpadding=\"1\" cells=\"BIG;GREEN;FROGS;yes;yes;no;no;no;###\"}}\n\nNote that ##\"\"###\"\"## must be used to indicate an empty cell.\nComplex tables can also be created by embedding HTML code in a wiki page (see instructions below).\n\n===10. Colored Text===\n\nColored text can be created using the ##color## action:\n\n**Example:**\n\n~##\"\"{{color c=\"blue\" text=\"This is a test.\"}}\"\"##\n~{{color c=\"blue\" text=\"This is a test.\"}}\n\nYou can also use hex values:\n\n**Example:**\n\n~##\"\"{{color hex=\"#DD0000\" text=\"This is another test.\"}}\"\"##\n~{{color hex=\"#DD0000\" text=\"This is another test.\"}}\n\nAlternatively, you can specify a foreground and background color using the ##fg## and ##bg## parameters (they accept both named and hex values):\n\n**Examples:**\n\n~##\"\"{{color fg=\"#FF0000\" bg=\"#000000\" text=\"This is colored text on colored background\"}}\"\"##\n~{{color fg=\"#FF0000\" bg=\"#000000\" text=\"This is colored text on colored background\"}}\n\n~##\"\"{{color fg=\"lightgreen\" bg=\"black\" text=\"This is colored text on colored background\"}}\"\"##\n~{{color fg=\"lightgreen\" bg=\"black\" text=\"This is colored text on colored background\"}}\n\n\n===11. Floats===\n\nTo create a **left floated box**, use two ##<## characters before and after the block.\n\n**Example:**\n\n~##\"\"<<Some text in a left-floated box hanging around<< Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler.\"\"##\n\n<<Some text in a left-floated box hanging around<<Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler.\n\n::c::To create a **right floated box**, use two ##>## characters before and after the block.\n\n**Example:**\n\n~##\"\">>Some text in a right-floated box hanging around>> Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler.\"\"##\n\n >>Some text in a right-floated box hanging around>>Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler.\n\n::c:: Use ##\"\"::c::\"\"## to clear floated blocks.\n\n===12. Code formatters===\n\nYou can easily embed code blocks in a wiki page using a simple markup. Anything within a code block is displayed literally. \nTo create a **generic code block** you can use the following markup:\n\n~##\"\"%% This is a code block %%\"\"##. \n\n%% This is a code block %%\n\nTo create a **code block with syntax highlighting**, you need to specify a //code formatter// (see below for a list of available code formatters). \n\n~##\"\"%%(\"\"{{color c=\"red\" text=\"php\"}}\"\")<br /><?php<br />echo \"Hello, World!\";<br />?><br />%%\"\"##\n\n%%(php)\n<?php\necho \"Hello, World!\";\n?>\n%%\n\nYou can also specify an optional //starting line// number.\n\n~##\"\"%%(php;\"\"{{color c=\"red\" text=\"15\"}}\"\")<br /><?php<br />echo \"Hello, World!\";<br />?><br />%%\"\"##\n\n%%(php;15)\n<?php\necho \"Hello, World!\";\n?>\n%%\n\nIf you specify a //filename//, this will be used for downloading the code.\n\n~##\"\"%%(php;15;\"\"{{color c=\"red\" text=\"test.php\"}}\"\")<br /><?php<br />echo \"Hello, World!\";<br />?><br />%%\"\"##\n\n%%(php;15;test.php)\n<?php\necho \"Hello, World!\";\n?>\n%%\n\n**List of available code formatters:**\n{{table columns=\"6\" cellpadding=\"1\" cells=\"LANGUAGE;FORMATTER;LANGUAGE;FORMATTER;LANGUAGE;FORMATTER;Actionscript;actionscript;ADA;ada;Apache Log;apache;AppleScript; applescript;ASM;asm;ASP;asp;AutoIT;autoit;Bash;bash;BlitzBasic;blitzbasic;BNF;bnf;C;c;C for Macs;c_mac;c#;csharp;C++;cpp;C++ (QT extensions);cpp-qt;CAD DCL;caddcl;CadLisp;cadlisp;CFDG;cfdg;ColdFusion;cfm; CSS;css;D;d;Delphi;delphi;Diff-Output;diff;DIV; div;DOS;dos;Eiffel;eiffel;Fortran;fortran;FreeBasic;freebasic;GML;gml;Groovy;groovy;HTML;html4strict;INI;ini;IO;io;Inno Script;inno;Java 5;java5;Java;java;Javascript;javascript;LaTeX;latex;Lisp;lisp;Lua;lua;Matlab;matlab;Microchip Assembler;mpasm;Microsoft Registry;reg;mIRC;mirc;MySQL;mysql;NSIS;nsis;Objective C;objc;OpenOffice BASIC;oobas;Objective Caml;ocaml;Objective Caml (brief);ocaml-brief;Oracle 8;oracle8;Pascal;pascal;Perl;perl;PHP;php;PHP (brief);php-brief;PL/SQL;plsql;Python;phyton;Q(uick)BASIC;qbasic;robots.txt;robots;Ruby;ruby;SAS;sas;Scheme;scheme;sdlBasic;sdlbasic;SmallTalk;smalltalk;Smarty;smarty;SQL;sql;TCL/iTCL;tcl;T-SQL;tsql;Text;text;thinBasic;thinbasic;Unoidl;idl;VB.NET;vbnet;VHDL;vhdl;Visual BASIC;vb;Visual Fox Pro;visualfoxpro;WinBatch;winbatch;XML;xml;ZiLOG Z80;z80\"}}\n\n===13. Mindmaps===\n\nWikka has native support for [[Wikka:FreeMind mindmaps]]. There are two options for embedding a mindmap in a wiki page.\n\n**Option 1:** Upload a \"\"FreeMind\"\" file to a webserver, and then place a link to it on a wikka page:\n ##\"\"http://yourdomain.com/freemind/freemind.mm\"\"##\nNo special formatting is necessary.\n\n**Option 2:** Paste the \"\"FreeMind\"\" data directly into a wikka page:\n~- Open a \"\"FreeMind\"\" file with a text editor.\n~- Select all, and copy the data.\n~- Browse to your Wikka site and paste the Freemind data into a page. \n\n===14. Embedded HTML===\n\nYou can easily paste HTML in a wiki page by wrapping it into two sets of doublequotes. \n\n~##""[html code]""##\n\n**Examples:**\n\n~##""y = x<sup>n+1</sup>""##\n~\"\"y = x<sup>n+1</sup>\"\"\n\n~##""<acronym title=\"Cascade Style Sheet\">CSS</acronym>""##\n~\"\"<acronym title=\"Cascade Style Sheet\">CSS</acronym>\"\"\n\nBy default, some HTML tags are removed by the \"\"SafeHTML\"\" parser to protect against potentially dangerous code. The list of tags that are stripped can be found on the Wikka:SafeHTML page.\n\nIt is possible to allow //all// HTML tags to be used, see Wikka:UsingHTML for more information.\n\n----\nCategoryWiki', '(Public)', '##WEBMASTER##', 'Y', '', 'page')");187 $mod_install_cmds[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##wiki_pages (id, tag, time, body, owner, user, latest, note, handler) VALUES (19, 'FormattingRules', now(), '======Wikka Formatting Guide======\n\n<<**Note:** Anything between 2 sets of double-quotes is not formatted.<<::c::\nOnce you have read through this, test your formatting skills in the SandBox.\n----\n===1. Text Formatting===\n\n~##\"\"**I''m bold**\"\"##\n~**I''m bold **\n\n~##\"\"//I''m italic text!//\"\"##\n~//I''m italic text!//\n\n~##\"\"And I''m __underlined__!\"\"##\n~And I''m __underlined__!\n\n~##\"\"##monospace text##\"\"##\n~##monospace text##\n\n~##\"\"''''highlight text''''\"\"## (using 2 single-quotes)\n~''''highlight text''''\n\n~##\"\"++Strike through text++\"\"##\n~++Strike through text++\n\n~##\"\"Press #%ANY KEY#%\"\"##\n~Press #%ANY KEY#%\n\n~##\"\"@@Center text@@\"\"##\n~@@Center text@@\n\n===2. Headers===\n\nUse between five ##=## (for the biggest header) and two ##=## (for the smallest header) on both sides of a text to render it as a header.\n\n~##\"\"====== Really big header ======\"\"##\n~====== Really big header ======\n \n~##\"\"===== Rather big header =====\"\"##\n~===== Rather big header =====\n\n~##\"\"==== Medium header ====\"\"##\n~==== Medium header ====\n\n~##\"\"=== Not-so-big header ===\"\"##\n~=== Not-so-big header ===\n\n~##\"\"== Smallish header ==\"\"##\n~== Smallish header ==\n\n===3. Horizontal separator===\n~##\"\"----\"\"##\n----\n\n===4. Forced line break===\n~##\"\"---\"\"##\n---\n\n===5. Lists and indents===\n\nYou can indent text using a **~**, a **tab** or **4 spaces** (which will auto-convert into a tab).\n\n##\"\"~This text is indented<br />~~This text is double-indented<br /> This text is also indented\"\"##\n\n~This text is indented\n~~This text is double-indented\n This text is also indented\n\nTo create bulleted/ordered lists, use the following markup (you can always use 4 spaces instead of a ##**~**##):\n\n**Bulleted lists**\n##\"\"~- Line one\"\"##\n##\"\"~- Line two\"\"##\n\n- Line one\n- Line two\n\n**Numbered lists**\n##\"\"~1) Line one\"\"##\n##\"\"~1) Line two\"\"##\n\n1) Line one\n1) Line two\n\n**Ordered lists using uppercase characters**\n##\"\"~A) Line one\"\"##\n##\"\"~A) Line two\"\"##\n\nA) Line one\nA) Line two\n\n**Ordered lists using lowercase characters**\n##\"\"~a) Line one\"\"##\n##\"\"~a) Line two\"\"##\n\na) Line one\na) Line two\n\n**Ordered lists using roman numerals**\n##\"\"~I) Line one\"\"##\n##\"\"~I) Line two\"\"##\n\n I) Line one\nI) Line two\n\n**Ordered lists using lowercase roman numerals**\n##\"\"~i) Line one\"\"##\n##\"\"~i) Line two\"\"##\n\n i) Line one\ni) Line two\n\n===6. Inline comments===\n\nTo format some text as an inline comment, use an indent ( **~**, a **tab** or **4 spaces**) followed by a **\"\"&\"\"**.\n\n**Example:**\n\n##\"\"~& Comment\"\"##\n##\"\"~~& Subcomment\"\"##\n##\"\"~~~& Subsubcomment\"\"##\n\n~& Comment\n~~& Subcomment\n~~~& Subsubcomment\n\n===7. Images===\n\nTo place images on a Wiki page, you can use the ##image## action.\n\n**Example:**\n\n~##\"\"{{image class=\"center\" alt=\"Wizard Logo\" title=\"An Image Link\" url=\"images/wizard.gif\" link=\"RecentChanges\"}}\"\"##\n~{{image class=\"center\" alt=\"Wizard Logo\" title=\"An Image Link\" url=\"images/wizard.gif\" link=\"RecentChanges\"}}\n\nLinks can be external, or internal Wiki links. You don''t need to enter a link at all, and in that case just an image will be inserted. You can use the optional classes ##left## and ##right## to float images left and right. You don''t need to use all those attributes, only ##url## is required while ##alt## is recommended for accessibility.\n\n===8. Links===\n\nTo create a **link to a wiki page** you can use any of the following options: ---\n~1) type a ##\"\"WikiName\"\"##: --- --- ##\"\"FormattingRules\"\"## --- FormattingRules --- ---\n~1) add a forced link surrounding the page name by ##\"\"[[\"\"## and ##\"\"]]\"\"## (everything after the first space will be shown as description): --- --- ##\"\"[[SandBox Test your formatting skills]]\"\"## --- [[SandBox Test your formatting skills]] --- --- ##\"\"[[SandBox 沙箱]]\"\"## --- [[SandBox 沙箱]] --- ---\n~1) add an image with a link (see instructions above).\n\nTo **link to external pages**, you can do any of the following: ---\n~1) type a URL inside the page: --- --- ##\"\"http://www.example.com\"\"## --- http://www.example.com --- --- \n~1) add a forced link surrounding the URL by ##\"\"[[\"\"## and ##\"\"]]\"\"## (everything after the first space will be shown as description): --- --- ##\"\"[[http://example.com/jenna/ Jenna''s Home Page]]\"\"## --- [[http://example.com/jenna/ Jenna''s Home Page]] --- --- ##\"\"[[mail@example.com Write me!]]\"\"## --- [[mail@example.com Write me!]] ---\nFor links to pages within the current website, use a relative link without the http:// prefix. ---\n~1) add an image with a link (see instructions above);\n~1) add an interwiki link (browse the [[InterWiki list of available interwiki tags]]): --- --- ##\"\"WikiPedia:WikkaWiki\"\"## --- WikiPedia:WikkaWiki --- --- ##\"\"Google:CSS\"\"## --- Google:CSS --- --- ##\"\"Thesaurus:Happy\"\"## --- Thesaurus:Happy --- ---\n\n===9. Tables===\n\nTo create a table, you can use the ##table## action.\n\n**Example:**\n\n~##\"\"{{table columns=\"3\" cellpadding=\"1\" cells=\"BIG;GREEN;FROGS;yes;yes;no;no;no;###\"}}\"\"##\n\n~{{table columns=\"3\" cellpadding=\"1\" cells=\"BIG;GREEN;FROGS;yes;yes;no;no;no;###\"}}\n\nNote that ##\"\"###\"\"## must be used to indicate an empty cell.\nComplex tables can also be created by embedding HTML code in a wiki page (see instructions below).\n\n===10. Colored Text===\n\nColored text can be created using the ##color## action:\n\n**Example:**\n\n~##\"\"{{color c=\"blue\" text=\"This is a test.\"}}\"\"##\n~{{color c=\"blue\" text=\"This is a test.\"}}\n\nYou can also use hex values:\n\n**Example:**\n\n~##\"\"{{color hex=\"#DD0000\" text=\"This is another test.\"}}\"\"##\n~{{color hex=\"#DD0000\" text=\"This is another test.\"}}\n\nAlternatively, you can specify a foreground and background color using the ##fg## and ##bg## parameters (they accept both named and hex values):\n\n**Examples:**\n\n~##\"\"{{color fg=\"#FF0000\" bg=\"#000000\" text=\"This is colored text on colored background\"}}\"\"##\n~{{color fg=\"#FF0000\" bg=\"#000000\" text=\"This is colored text on colored background\"}}\n\n~##\"\"{{color fg=\"lightgreen\" bg=\"black\" text=\"This is colored text on colored background\"}}\"\"##\n~{{color fg=\"lightgreen\" bg=\"black\" text=\"This is colored text on colored background\"}}\n\n\n===11. Floats===\n\nTo create a **left floated box**, use two ##<## characters before and after the block.\n\n**Example:**\n\n~##\"\"<<Some text in a left-floated box hanging around<< Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler.\"\"##\n\n<<Some text in a left-floated box hanging around<<Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler.\n\n::c::To create a **right floated box**, use two ##>## characters before and after the block.\n\n**Example:**\n\n~##\"\">>Some text in a right-floated box hanging around>> Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler.\"\"##\n\n >>Some text in a right-floated box hanging around>>Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler.\n\n::c:: Use ##\"\"::c::\"\"## to clear floated blocks.\n\n===12. Code formatters===\n\nYou can easily embed code blocks in a wiki page using a simple markup. Anything within a code block is displayed literally. \nTo create a **generic code block** you can use the following markup:\n\n~##\"\"%% This is a code block %%\"\"##. \n\n%% This is a code block %%\n\nTo create a **code block with syntax highlighting**, you need to specify a //code formatter// (see below for a list of available code formatters). \n\n~##\"\"%%(\"\"{{color c=\"red\" text=\"php\"}}\"\")<br /><?php<br />echo \"Hello, World!\";<br />?><br />%%\"\"##\n\n%%(php)\n<?php\necho \"Hello, World!\";\n?>\n%%\n\nYou can also specify an optional //starting line// number.\n\n~##\"\"%%(php;\"\"{{color c=\"red\" text=\"15\"}}\"\")<br /><?php<br />echo \"Hello, World!\";<br />?><br />%%\"\"##\n\n%%(php;15)\n<?php\necho \"Hello, World!\";\n?>\n%%\n\nIf you specify a //filename//, this will be used for downloading the code.\n\n~##\"\"%%(php;15;\"\"{{color c=\"red\" text=\"test.php\"}}\"\")<br /><?php<br />echo \"Hello, World!\";<br />?><br />%%\"\"##\n\n%%(php;15;test.php)\n<?php\necho \"Hello, World!\";\n?>\n%%\n\n**List of available code formatters:**\n{{table columns=\"6\" cellpadding=\"1\" cells=\"LANGUAGE;FORMATTER;LANGUAGE;FORMATTER;LANGUAGE;FORMATTER;Actionscript;actionscript;ADA;ada;Apache Log;apache;AppleScript; applescript;ASM;asm;ASP;asp;AutoIT;autoit;Bash;bash;BlitzBasic;blitzbasic;BNF;bnf;C;c;C for Macs;c_mac;c#;csharp;C++;cpp;C++ (QT extensions);cpp-qt;CAD DCL;caddcl;CadLisp;cadlisp;CFDG;cfdg;ColdFusion;cfm; CSS;css;D;d;Delphi;delphi;Diff-Output;diff;DIV; div;DOS;dos;Eiffel;eiffel;Fortran;fortran;FreeBasic;freebasic;GML;gml;Groovy;groovy;HTML;html4strict;INI;ini;IO;io;Inno Script;inno;Java 5;java5;Java;java;Javascript;javascript;LaTeX;latex;Lisp;lisp;Lua;lua;Matlab;matlab;Microchip Assembler;mpasm;Microsoft Registry;reg;mIRC;mirc;MySQL;mysql;NSIS;nsis;Objective C;objc;OpenOffice BASIC;oobas;Objective Caml;ocaml;Objective Caml (brief);ocaml-brief;Oracle 8;oracle8;Pascal;pascal;Perl;perl;PHP;php;PHP (brief);php-brief;PL/SQL;plsql;Python;phyton;Q(uick)BASIC;qbasic;robots.txt;robots;Ruby;ruby;SAS;sas;Scheme;scheme;sdlBasic;sdlbasic;SmallTalk;smalltalk;Smarty;smarty;SQL;sql;TCL/iTCL;tcl;T-SQL;tsql;Text;text;thinBasic;thinbasic;Unoidl;idl;VB.NET;vbnet;VHDL;vhdl;Visual BASIC;vb;Visual Fox Pro;visualfoxpro;WinBatch;winbatch;XML;xml;ZiLOG Z80;z80\"}}\n\n===13. Mindmaps===\n\nWikka has native support for [[Wikka:FreeMind mindmaps]]. There are two options for embedding a mindmap in a wiki page.\n\n**Option 1:** Upload a \"\"FreeMind\"\" file to a webserver, and then place a link to it on a wikka page:\n ##\"\"http://yourdomain.com/freemind/freemind.mm\"\"##\nNo special formatting is necessary.\n\n**Option 2:** Paste the \"\"FreeMind\"\" data directly into a wikka page:\n~- Open a \"\"FreeMind\"\" file with a text editor.\n~- Select all, and copy the data.\n~- Browse to your Wikka site and paste the Freemind data into a page. \n\n===14. Embedded HTML===\n\nYou can easily paste HTML in a wiki page by wrapping it into two sets of doublequotes. \n\n~##""[html code]""##\n\n**Examples:**\n\n~##""y = x<sup>n+1</sup>""##\n~\"\"y = x<sup>n+1</sup>\"\"\n\n~##""<acronym title=\"Cascade Style Sheet\">CSS</acronym>""##\n~\"\"<acronym title=\"Cascade Style Sheet\">CSS</acronym>\"\"\n\nBy default, some HTML tags are removed by the \"\"SafeHTML\"\" parser to protect against potentially dangerous code. The list of tags that are stripped can be found on the Wikka:SafeHTML page.\n\nIt is possible to allow //all// HTML tags to be used, see Wikka:UsingHTML for more information.\n\n----\nCategoryWiki', '(Public)', '##WEBMASTER##', 'Y', '', 'page')"); 146 188 $mod_install_cmds[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##wiki_pages (id, tag, time, body, owner, user, latest, note, handler) VALUES (20, 'OwnedPages', now(), '{{ownedpages}}{{nocomments}}These numbers merely reflect how many pages you have created, not how much content you have contributed or the quality of your contributions. To see how you rank with other members, you may be interested in checking out the HighScores. \n\n\n----\nCategoryWiki', '(Public)', '##WEBMASTER##', 'Y', '', 'page')"); 147 189 $mod_install_cmds[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##wiki_pages (id, tag, time, body, owner, user, latest, note, handler) VALUES (21, 'SandBox', now(), 'Test your formatting skills here.\n\n\n\n\n----\nCategoryWiki', '(Public)', '##WEBMASTER##', 'Y', '', 'page')"); … … 153 195 KEY idx_spammer (spammer) 154 196 ) ENGINE=MyISAM;"); 197 198 // and add initial record(s) to it 199 $mod_install_cmds[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##wiki_referrer_blacklist (spammer) VALUES ('".$_SERVER['SERVER_NAME']."')"); 155 200 156 201 // create the table: wiki_referrers … … 195 240 $mod_install_cmds[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##CMSconfig (cfg_name, cfg_value) VALUES ('wiki_anony_delete_own_comments', '1')"); 196 241 $mod_install_cmds[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##CMSconfig (cfg_name, cfg_value) VALUES ('wiki_external_link_new_window', '1')"); 197 $mod_install_cmds[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##CMSconfig (cfg_name, cfg_value) VALUES ('wiki_default_write_acl', '101')"); 198 $mod_install_cmds[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##CMSconfig (cfg_name, cfg_value) VALUES ('wiki_default_read_acl', '0')"); 199 $mod_install_cmds[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##CMSconfig (cfg_name, cfg_value) VALUES ('wiki_default_comment_acl', '101')"); 242 $mod_install_cmds[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##CMSconfig (cfg_name, cfg_value) VALUES ('wiki_default_read_acl', 'G0')"); 243 $mod_install_cmds[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##CMSconfig (cfg_name, cfg_value) VALUES ('wiki_default_write_acl', 'G101')"); 244 $mod_install_cmds[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##CMSconfig (cfg_name, cfg_value) VALUES ('wiki_default_comment_acl', 'G101')"); 245 $mod_install_cmds[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##CMSconfig (cfg_name, cfg_value) VALUES ('wiki_admin_group', 'G103')"); 200 246 201 247 // custom module install code 202 //$mod_install_cmds[] = array('type' => 'function', 'value' => "module_install");248 $mod_install_cmds[] = array('type' => 'function', 'value' => "module_install"); 203 249 204 250 /*---------------------------------------------------+ … … 230 276 $mod_uninstall_cmds[] = array('type' => 'db', 'value' => "DELETE FROM ##PREFIX##CMSconfig WHERE cfg_name = 'wiki_default_read_acl'"); 231 277 $mod_uninstall_cmds[] = array('type' => 'db', 'value' => "DELETE FROM ##PREFIX##CMSconfig WHERE cfg_name = 'wiki_default_comment_acl'"); 278 $mod_uninstall_cmds[] = array('type' => 'db', 'value' => "DELETE FROM ##PREFIX##CMSconfig WHERE cfg_name = 'wiki_admin_group'"); 232 279 233 280 // remove any reference to the wiki groups created at installation time by an other version … … 240 287 function module_install() { 241 288 242 global $db_prefix; 243 289 global $db_prefix, $mod_admin_rights; 290 291 // update the default wiki pages with the name of the webmasters account 292 $result = dbquery("SELECT * FROM ".$db_prefix."users WHERE user_id = '1'"); 293 if ($data = dbarray($result)) { 294 $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')"); 295 // and update references to the webmaster 296 $result2 = dbquery("UPDATE ".$db_prefix."wiki_pages SET owner = '".$data['user_name']."' WHERE owner = '##WEBMASTER##'"); 297 $result2 = dbquery("UPDATE ".$db_prefix."wiki_pages SET user = '".$data['user_name']."' WHERE user = '##WEBMASTER##'"); 298 } 299 // create the wiki image directory 300 if (!is_dir(PATH_IMAGES."wiki")) { 301 @mkdir(PATH_IMAGES."wiki"); 302 } 244 303 } 245 304 } … … 249 308 if (!function_exists('module_uninstall')) { 250 309 function module_uninstall() { 251 252 global $db_prefix, $mod_admin_rights; 253 254 // check if the old wiki groups still exist. If so, remove them 255 256 // get the group id of the Wiki Admin group 257 $result = dbquery("SELECT group_id FROM ".$db_prefix."user_groups WHERE group_ident = '".$mod_admin_rights."01'"); 258 if ($data = dbarray($result)) { 259 // get all groups with membership of this group, and remove the membership 260 261 // get all users with membership of this group, and remove the membership 262 263 // delete the user group 264 $result = dbquery("DELETE FROM ".$db_prefix."user_groups WHERE group_ident = '".$mod_admin_rights."01'"); 265 } 266 267 268 // get the group id of the Wiki Editors group 269 $result = dbquery("SELECT group_id FROM ".$db_prefix."user_groups WHERE group_ident = '".$mod_admin_rights."02'"); 270 if ($data = dbarray($result)) { 271 // get all groups with membership of this group, and remove the membership 272 273 // get all users with membership of this group, and remove the membership 274 275 // delete the user group 276 $result = dbquery("DELETE FROM ".$db_prefix."user_groups WHERE group_ident = '".$mod_admin_rights."02'"); 277 } 278 310 311 // code to be executed when uninstalling this module 279 312 } 280 313 } … … 289 322 switch($current_version) { 290 323 case "1.0.0": 291 // changes between this version and the next one 292 293 // create the wiki_images table 294 $result = dbquery("CREATE TABLE ".$db_prefix."wiki_images ( 295 image_id SMALLINT( 5 ) UNSIGNED NOT NULL , 296 image_user_id SMALLINT( 5 ) UNSIGNED NOT NULL , 297 image_name VARCHAR( 100 ) NOT NULL , 298 image_realname VARCHAR( 100 ) NOT NULL , 299 PRIMARY KEY ( image_id ) 300 ) ENGINE=MyISAM;"); 324 // no specific changes between this version and the new one 301 325 302 326 case "1.0.1": 303 // changes between this version and the nextone327 // no specific changes between this version and the new one 304 328 305 329 default: -
modules/common/wiki/php-files/modules/wiki/wikka.config.php
r1058 r1161 70 70 $wakkaConfig['stylesheet'] = 'css/wikka.css'; 71 71 } 72 73 // generate the default write ACL based on group membership 74 /*$result = dbquery("SELECT * FROM ".$db_prefix."user_groups WHERE group_name = 'Wiki Editors'"); 75 if ($data = dbarray($result)) { 76 $users = allusersingroup($data['group_id']); 77 $acl = ""; 78 foreach ($users as $user) { 79 $acl .= ($acl == "" ? "" : "\n") . $user['user_name']; 80 } 81 if ($acl != "") $wakkaConfig['default_write_acl'] = $acl; 82 }*/ 72 // if the current user is an admin, add the username to the list of admins 73 $wakkaConfig['admin_users'] = checkgroup($wakkaConfig['admin_group']) ? (iMEMBER ? $userdata['user_name'] : "*") : ""; 83 74 ?>
Note: See TracChangeset
for help on using the changeset viewer.
