Changeset 1021
- Timestamp:
- 03/30/2008 01:46:37 AM (2 years ago)
- Location:
- trunk
- Files:
-
- 13 added
- 7 modified
-
actions/adminpages (added)
-
actions/adminpages/adminpages.php (added)
-
actions/adminusers (added)
-
actions/adminusers/adminusers.php (added)
-
actions/mychanges/mychanges.php (modified) (3 diffs)
-
actions/mypages/mypages.php (modified) (3 diffs)
-
css/wikka.css (modified) (9 diffs)
-
images/icons/comment.png (added)
-
images/icons/edit.png (added)
-
images/icons/keyring.png (added)
-
images/icons/link.png (added)
-
images/icons/star.png (added)
-
images/icons/world.png (added)
-
lang/en/defaults/AdminPages.txt (added)
-
lang/en/defaults/AdminUsers.txt (added)
-
lang/en/en.inc.php (modified) (2 diffs)
-
libs/Wakka.class.php (modified) (3 diffs)
-
libs/admin.lib.php (added)
-
setup/install.php (modified) (2 diffs)
-
wikka.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/actions/mychanges/mychanges.php
r911 r1021 35 35 $time_output = ''; 36 36 37 if ($this->existsUser()) 37 $params = ''; 38 $username = ''; 39 if(isset($_REQUEST['user'])) 40 { 41 $username = $this->htmlspecialchars_ent($_REQUEST['user']); 42 $params .= "user=$username&"; 43 } 44 45 $action = ''; 46 if(isset($_REQUEST['action'])) 47 { 48 $action = $this->htmlspecialchars_ent($_REQUEST['action']); 49 $params .= "action=$action&"; 50 } 51 $params = substr($params, 0, -1); 52 53 if (($this->IsAdmin() && !empty($username)) || 54 ($this->existsUser() && $username = $this->GetUserName())) 38 55 { 39 56 $my_edits_count = 0; … … 43 60 if ($alpha) 44 61 { 45 $output .= MYCHANGES_ALPHA_LIST.' (<a href="'.$this->href("", $tag).'">'.ORDER_DATE_LINK_DESC;62 $output .= sprintf(MYCHANGES_ALPHA_LIST, $username).' (<a href="'.$this->Href("", $tag, $params).'">'.ORDER_DATE_LINK_DESC; 46 63 } 47 64 else 48 65 { 49 $output .= MYCHANGES_DATE_LIST.' (<a href="'.$this->href("", $tag, "alphabetically=1").'">'.ORDER_ALPHA_LINK_DESC; 66 if(!empty($params)) 67 { 68 $params .= "&alphabetically=1"; 69 } 70 else 71 { 72 $params = "alphabetically=1"; 73 } 74 75 $output .= sprintf(MYCHANGES_DATE_LIST, $username).' (<a href="'.$this->href("", $tag, $params).'">'.ORDER_ALPHA_LINK_DESC; 50 76 } 51 77 $output .= '</a>)</div><div class="clear"> </div>'."\n"; … … 55 81 SELECT id, tag, time 56 82 FROM ".$this->GetConfigValue('table_prefix')."pages 57 WHERE user = '".mysql_real_escape_string($ this->reg_username)."'83 WHERE user = '".mysql_real_escape_string($username)."' 58 84 AND latest = 'Y' 59 85 ORDER BY ".$order; -
trunk/actions/mypages/mypages.php
r820 r1021 22 22 */ 23 23 24 #if ($user = $this->GetUser()) 25 if ($this->existsUser())24 $username = ''; 25 if(isset($_REQUEST['user'])) 26 26 { 27 echo '<div class="floatl">'.OWNED_PAGES_TXT.'</div><div class="clear"> </div>'."\n"; 27 $username = $this->htmlspecialchars_ent($_REQUEST['user']); 28 } 29 if (($this->IsAdmin() && !empty($username)) || 30 ($this->GetUser() && $username = $this->GetUserName())) 31 { 32 printf("<div class="floatl">".OWNED_PAGES_TXT."</div><div class="clear"> </div>\n", $username); 28 33 $curChar = ''; 29 34 … … 32 37 if ($pages = $this->LoadPagesByOwner($this->reg_username)) 33 38 { 39 $my_pages_count = 0; 34 40 foreach ($pages as $page) 35 41 { 36 //if ($this->GetUserName() == $page["owner"]) 37 //{ 42 if($username == $page['owner']) 43 { 44 ++$my_pages_count; 38 45 $firstChar = strtoupper($page["tag"][0]); 39 46 if (!preg_match("/[A-Z,a-z]/", $firstChar)) //TODO: (#104 #340, #34) Internationalization (allow other starting chars, make consistent with Formatter REs) … … 51 58 echo $this->Link($page['tag'])."<br />\n"; 52 59 53 //} 60 } 61 } 62 if($my_pages_count == 0) 63 { 64 print("<em class='error'>".MYPAGES_NONE_OWNED."</em>"); 54 65 } 55 66 -
trunk/css/wikka.css
r954 r1021 235 235 236 236 tt { 237 color: #666; 237 color: #393; 238 background-color: #EFE; 238 239 } 239 240 … … 325 326 .code { 326 327 color: black; 327 background: # FAFAFA;328 background: #ffffee; 328 329 border: 1px solid #CCC; 329 330 font-size: 11px; … … 402 403 } 403 404 404 input[readonly=readonly] {405 color: #666;406 }407 408 input[readonly=readonly]:hover, input[readonly=readonly]:focus {409 background-color: transparent;410 }411 412 /* editor textarea decorations */413 /* (decorations can't be in "textarea#body" declaration, else the "width:100%" won't work) */414 #textarea_container {415 border: 1px solid #CCC;416 padding: 2px;417 margin-bottom: 2px;418 }419 420 405 textarea#body{ 421 406 width: 100%; 422 407 height: 500px; 423 /* padding and border must be 0 for the "width:100%" to work */ 424 padding: 0; 425 border: 0; 408 padding: 2px; 426 409 } 427 410 … … 446 429 447 430 /* system information */ 448 449 .datetime {450 color: #666;451 font-size: 80%;452 font-family: "Lucida Console", Monaco, monospace;453 }454 431 455 432 .missingpage { … … 541 518 } 542 519 520 .recentchanges {font-size: 0.9em;} 521 543 522 .pagenote {color: #888;} 544 523 … … 553 532 } 554 533 534 /* ACTION-related styling */ 535 536 /* File attachments */ 537 538 div.files { 539 display: block; 540 padding: 5px; 541 width: 40%; 542 } 543 544 table.files { 545 width: 100%; 546 font-size: 90%; 547 border: 2px solid #CCC; 548 border-collapse: collapse; 549 border-spacing: 0; 550 } 551 552 table.files caption { 553 border: 1px solid #CCC; 554 color: #666; 555 margin:5px 0; 556 padding:2px; 557 } 558 559 table.files thead { 560 background-color: #DDD; 561 } 562 563 table.files th, table.files td { 564 border: 1px solid #CCC; 565 padding: 1px 3px; 566 } 567 568 table.files thead th { 569 background-color: #DDD; 570 } 571 572 table.files tfoot th { 573 background-color: #DDD; 574 } 575 576 table.files tbody th { 577 background-color: #EEE; 578 } 579 580 table.files tbody tr:hover { 581 background-color: #EEE; 582 } 583 555 584 /* Tables */ 556 557 585 table.data { 558 586 border: 2px solid #CCC; … … 598 626 } 599 627 600 table.data tbody tr.alt:hover {601 background-color: #E9E9F9;602 }603 604 628 table.data td { 605 629 border: 1px solid #CCC; 606 630 padding: .1em .25em; 607 }608 609 table.data td.number {610 text-align: right;611 }612 613 table.data td.datetime {614 color: #666;615 font-size: 80%;616 font-family: "Lucida Console", Monaco, monospace;617 text-align: right;618 white-space: nowrap;619 }620 621 /* --- alternate row & column color --- */622 623 table.data tr.alt {624 background-color: #EEE;625 }626 627 table.data th.c1 {628 background-color: #CDD;629 }630 631 table.data th.c2 {632 background-color: #DCC;633 }634 635 table.data th.c3 {636 background-color: #DDC;637 }638 639 table.data th.c4 {640 background-color: #CDC;641 }642 643 table.data th.c5 {644 background-color: #CCD;645 }646 647 table.data th.c6 {648 background-color: #DCD;649 }650 651 table.data td.c1 {652 background-color: #EFF;653 }654 655 table.data td.c2 {656 background-color: #FEE;657 }658 659 table.data td.c3 {660 background-color: #FFE;661 }662 663 table.data td.c4 {664 background-color: #EFE;665 }666 667 table.data td.c5 {668 background-color: #EEF;669 }670 671 table.data td.c6 {672 background-color: #FEF;673 }674 675 table.data tr.alt td.c1 {676 background-color: #DEE;677 }678 679 table.data tr.alt td.c2 {680 background-color: #EDD;681 }682 683 table.data tr.alt td.c3 {684 background-color: #EED;685 }686 687 table.data tr.alt td.c4 {688 background-color: #DED;689 }690 691 table.data tr.alt td.c5 {692 background-color: #DDE;693 }694 695 table.data tr.alt td.c6 {696 background-color: #EDE;697 }698 699 /* ACTION-related styling */700 701 /* Files action */702 703 div.files {704 display: block;705 padding: 5px;706 width: 40%;707 }708 709 table.files {710 width: 100%;711 font-size: 90%;712 border: 2px solid #CCC;713 border-collapse: collapse;714 border-spacing: 0;715 }716 717 table.files caption {718 border: 1px solid #CCC;719 color: #666;720 margin:5px 0;721 padding:2px;722 }723 724 table.files thead {725 background-color: #DDD;726 }727 728 table.files th, table.files td {729 border: 1px solid #CCC;730 padding: 1px 3px;731 }732 733 table.files thead th {734 background-color: #DDD;735 }736 737 table.files tfoot th {738 background-color: #DDD;739 }740 741 table.files tbody th {742 background-color: #EEE;743 }744 745 table.files tbody tr:hover {746 background-color: #EEE;747 631 } 748 632 … … 900 784 fieldset.feedback br { 901 785 clear: left; 902 }903 904 /* HighScores action */905 906 table.highscores {907 white-space: nowrap;908 padding 1px 3px909 786 } 910 787 … … 1042 919 margin-left: 1em; 1043 920 margin-bottom: 1em; 1044 }1045 1046 ul.recentchanges li {1047 font-size: 0.9em;1048 921 } 1049 922 -
trunk/lang/en/en.inc.php
r962 r1021 325 325 // mychanges 326 326 define('NO_PAGES_EDITED', 'You have not edited any pages yet.'); 327 define('MYCHANGES_ALPHA_LIST', "This is a list of pages you've edited, along with the time of yourlast change.");328 define('MYCHANGES_DATE_LIST', "This is a list of pages you've edited, ordered by the time of yourlast change.");327 define('MYCHANGES_ALPHA_LIST', "This is a list of pages edited by %s, along with the time of the last change."); 328 define('MYCHANGES_DATE_LIST', "This is a list of pages edited by %s, ordered by the time of the last change."); 329 329 define('ORDER_DATE_LINK_DESC', 'order by date'); 330 330 define('ORDER_ALPHA_LINK_DESC', 'order alphabetically'); … … 336 336 */ 337 337 // mypages 338 define('OWNED_PAGES_TXT', 'This is the list of pages you own.');338 define('OWNED_PAGES_TXT', "This is the list of pages owned by %s."); 339 339 define('OWNED_NO_PAGES', 'You don\'t own any pages.'); 340 define('OWNED_NONE_FOUND', 'No pages found.'); 340 341 define('OWNED_NOT_LOGGED_IN', "You're not logged in, thus the list of your pages couldn't be retrieved."); 341 342 /**#@-*/ -
trunk/libs/Wakka.class.php
r961 r1021 3914 3914 $this->deleteWikkaCookie('user_name'); 3915 3915 $this->deleteWikkaCookie('pass'); 3916 // Delete this session from sessions table 3917 $this->Query("DELETE FROM ".$this->config['table_prefix']."sessions WHERE userid='".$this->GetUserName()."' AND sessionid='".session_id()."'"); 3918 $_SESSION["user"] = ""; 3919 // This seems a good as place as any to purge all session 3920 // records older than PERSISTENT_COOKIE_EXPIRY, as this is 3921 // not a time-critical function for the user. The 3922 // assumption here is that server-side sessions have long 3923 // ago been cleaned up by PHP. 3924 $cookie_expiration_secs = DEFAULT_COOKIE_EXPIRATION_HOURS * 3600; 3925 $this->Query("DELETE FROM 3926 ".$this->config['table_prefix']."sessions WHERE DATE_SUB(NOW(), INTERVAL ".$cookie_expiration_secs." SECOND) > session_start"); 3916 3927 } 3917 3928 return $rc; … … 4347 4358 * @return boolean TRUE if the user is an admin, FALSE otherwise 4348 4359 */ 4349 function IsAdmin() 4350 { 4360 function IsAdmin($user='') 4361 { 4362 if(TRUE===empty($user)) 4363 { 4364 $user = $this->reg_username; 4365 } 4366 else if(is_array($user)) 4367 { 4368 $user = $user['name']; 4369 } 4351 4370 $isadmin = FALSE; 4352 4371 // use preg_split to get an array with already-trimmed elements (no looping needed) … … 4354 4373 4355 4374 // only a logged-in user can be admin; check if name occurs in the array 4356 if ($this->existsUser() && in_array($ this->reg_username, $adminarray))4375 if ($this->existsUser() && in_array($user, $adminarray)) 4357 4376 { 4358 4377 $isadmin = TRUE; -
trunk/setup/install.php
r928 r1021 107 107 "signuptime datetime NOT NULL default '0000-00-00 00:00:00',". 108 108 "show_comments enum('Y','N') NOT NULL default 'N',". 109 "status enum('invited','signed-up','pending','active','suspended','banned','deleted'),". 109 110 "default_comment_display int(10) unsigned NOT NULL default '1',". 110 111 "challenge char(8) NOT NULL default '00000000',". … … 344 345 test(__('Dropping unnecessary index `from_tag`').'...', 345 346 @mysql_query('alter table '.$config['table_prefix'].'links drop index `idx_from`', $dblink), __('Already done? OK!'), 0); 347 test("Adding sessions tracking table...", 348 mysql_query("create table ".$config['table_prefix']."sessions (sessionid char(32) NOT NULL, userid varchar(75) NOT NULL, PRIMARY KEY (sessionid, userid), session_start datetime NOT NULL)"), "Already done? OK!", 0); 349 test("Adding AdminUsers page...", 350 mysql_query("insert into ".$config['table_prefix']."pages set tag = 'AdminUsers', body = '{{adminusers}}\n\n----\nCategoryAdmin', owner = '(Public)', note='".$upgrade_note."', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink), "Already done? OK!", 0); 351 test("Adding AdminPages page...", 352 mysql_query("insert into ".$config['table_prefix']."pages set tag = 'AdminPages', body = '{{adminpages}}\n\n----\nCategoryAdmin', owner = '(Public)', note='".$upgrade_note."', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink), "Already done? OK!", 0); 346 353 break; 347 354 case "trunk": //latest development version from the SVN repository - do not remove -
trunk/wikka.php
r1020 r1021 90 90 * Do not change the version number or you will have problems upgrading. 91 91 */ 92 if (!defined('WAKKA_VERSION')) define('WAKKA_VERSION', 'trunk ');92 if (!defined('WAKKA_VERSION')) define('WAKKA_VERSION', 'trunk-r1020'); 93 93 /** 94 94 * Defines the basic name the session name will be derived from. … … 954 954 die($mysql_version_error); #FatalErrorAfterLangFileIncluded 955 955 } 956 957 /** 958 * Save session ID 959 */ 960 $user = $wakka->GetUser(); 961 // Only store sessions for real users! 962 if(NULL != $user) 963 { 964 $res = $wakka->LoadSingle("SELECT * FROM ".$wakka->config['table_prefix']."sessions WHERE sessionid='".session_id()."' AND userid='".$user['name']."'"); 965 if(isset($res)) 966 { 967 // Just update the session_start time 968 $wakka->Query("UPDATE ".$wakka->config['table_prefix']."sessions SET session_start=FROM_UNIXTIME(".$wakka->GetMicroTime().") WHERE sessionid='".session_id()."' AND userid='".$user['name']."'"); 969 } 970 else 971 { 972 // Create new session record 973 $wakka->Query("INSERT INTO ".$wakka->config['table_prefix']."sessions (sessionid, userid, session_start) VALUES('".session_id()."', '".$user['name']."', FROM_UNIXTIME(".$wakka->GetMicroTime()."))"); 974 } 975 } 976 956 977 // ---------------------------- READY TO ROLL NOW ------------------------------ 957 958 959 978 // ---------------------------------- ROLL! ------------------------------------ 960 979 // --- Dependencies: