# HG changeset patch # User Dan # Date 1241981090 14400 # Node ID e5abd87bccef3e39b113569bd0d090d11be31d04 # Parent e74741b8360bdd21915607828c21a90b47c919a8# Parent 25b1bdce985b3a13b577cd9649efad1c18dc7e5c Merging from accidental branch split diff -r 25b1bdce985b -r e5abd87bccef includes/paths.php --- a/includes/paths.php Tue May 05 22:06:23 2009 -0400 +++ b/includes/paths.php Sun May 10 14:44:50 2009 -0400 @@ -1115,4 +1115,28 @@ } +/** + * Register a special page. + * @param string urlname of the page ("Administration" in "Special:Administration") + * @param string Page title; if in the right format, will be treated as a l10n string identifier + * @param bool If true, page is visible (shown in lists/search). Otherwise, hidden. Defaults to true. + */ + +function register_special_page($urlname, $name, $visible = true) +{ + global $paths; + + return $paths->add_page(Array( + 'name' => $name, + 'urlname' => $urlname, + 'namespace' => 'Special', + 'special' => 0, + 'visible' => $visible ? 1 : 0, + 'comments_on' => 0, + 'protected' => 1, + 'delvotes' => 0, + 'delvote_ips' => '', + )); +} + ?> diff -r 25b1bdce985b -r e5abd87bccef includes/template.php --- a/includes/template.php Tue May 05 22:06:23 2009 -0400 +++ b/includes/template.php Sun May 10 14:44:50 2009 -0400 @@ -336,15 +336,17 @@ function get_css($s = false) { global $db, $session, $paths, $template, $plugins; // Common objects - if(!defined('ENANO_TEMPLATE_LOADED')) - $this->load_theme($session->theme, $session->style); + $this->init_vars(); + $path = ( $s ) ? 'css/'.$s : 'css/'.$this->style.'.css'; + if ( !file_exists(ENANO_ROOT . '/themes/' . $this->theme . '/' . $path) ) { echo "/* WARNING: Falling back to default file because file $path does not exist */\n"; $path = 'css/' . $this->style_list[0] . '.css'; } - return '' . $this->process_template($path) . ''; + + return $this->process_template($path); } function load_theme($name = false, $css = false) { @@ -639,6 +641,9 @@ 'STYLE_ID' => $this->style )); + // Add the site description sidebar block + $this->sidebar_widget($lang->get('sidebar_title_about'), '

' . htmlspecialchars(getConfig('site_desc')) . '

'); + $this->theme_initted = true; } @@ -873,7 +878,7 @@ // Protect button if ( $conds['protect'] ) { - switch($this->page->ns->page_protected) + switch($this->page->ns->cdata['protected']) { case PROTECT_FULL: $protect_status = $lang->get('onpage_btn_protect_on'); break; case PROTECT_SEMI: $protect_status = $lang->get('onpage_btn_protect_semi'); break; @@ -885,7 +890,7 @@ $t0 = $label->run(); $menubtn->assign_vars(array( - 'FLAGS' => 'accesskey="p" onclick="ajaxProtect(' . $this->page->ns->page_protected . '); return false;" id="tb_ajax_protect_btn" title="' . $lang->get('onpage_tip_protect') . '"', + 'FLAGS' => 'accesskey="p" onclick="ajaxProtect(' . $this->page->ns->cdata['protected'] . '); return false;" id="tb_ajax_protect_btn" title="' . $lang->get('onpage_tip_protect') . '"', 'HREF' => makeUrl($local_page, 'do=protect', true), 'TEXT' => $lang->get('onpage_btn_protect_change') )); @@ -2863,8 +2868,9 @@ } return $ds; } - function get_css($s = false) { - if($s) + function get_css($s = false) + { + if ( $s ) return $this->process_template('css/'.$s); else return $this->process_template('css/'.$this->style.'.css'); diff -r 25b1bdce985b -r e5abd87bccef language/english/core.json --- a/language/english/core.json Tue May 05 22:06:23 2009 -0400 +++ b/language/english/core.json Sun May 10 14:44:50 2009 -0400 @@ -536,6 +536,7 @@ title_tools: 'Tools', title_search: 'Search', title_links: 'Links', + title_about: 'About', btn_home: 'Home', btn_createpage: 'Create a page', diff -r 25b1bdce985b -r e5abd87bccef plugins/PrivateMessages.php --- a/plugins/PrivateMessages.php Tue May 05 22:06:23 2009 -0400 +++ b/plugins/PrivateMessages.php Sun May 10 14:44:50 2009 -0400 @@ -5,7 +5,7 @@ "Plugin URI" : "http://enanocms.org/", "Description" : "plugin_privatemessages_desc", "Author" : "Dan Fuhry", - "Version" : "1.1.5", + "Version" : "1.1.6", "Author URI" : "http://enanocms.org/" } **!*/ @@ -24,17 +24,9 @@ global $db, $session, $paths, $template, $plugins; // Common objects -// $plugins->attachHook('session_started', 'PrivateMessages_paths_init();'); - function PrivateMessages_paths_init() { - global $paths; - $paths->add_page(Array( - 'name'=>'specialpage_private_messages', - 'urlname'=>'PrivateMessages', - 'namespace'=>'Special', - 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', - )); + register_special_page('PrivateMessages', 'specialpage_private_messages'); } function page_Special_PrivateMessages() diff -r 25b1bdce985b -r e5abd87bccef plugins/SpecialAdmin.php --- a/plugins/SpecialAdmin.php Tue May 05 22:06:23 2009 -0400 +++ b/plugins/SpecialAdmin.php Sun May 10 14:44:50 2009 -0400 @@ -5,7 +5,7 @@ "Plugin URI" : "http://enanocms.org/", "Description" : "plugin_specialadmin_desc", "Author" : "Dan Fuhry", - "Version" : "1.1.5", + "Version" : "1.1.6", "Author URI" : "http://enanocms.org/" } **!*/ @@ -29,19 +29,9 @@ function SpecialAdmin_paths_init() { global $paths; - $paths->add_page(Array( - 'name'=>'specialpage_administration', - 'urlname'=>'Administration', - 'namespace'=>'Special', - 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', - )); - $paths->add_page(Array( - 'name'=>'specialpage_manage_sidebar', - 'urlname'=>'EditSidebar', - 'namespace'=>'Special', - 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', - )); + register_special_page('Administration', 'specialpage_administration'); + register_special_page('EditSidebar', 'specialpage_manage_sidebar'); } $plugins->attachHook('base_classes_initted', 'SpecialAdmin_include();'); diff -r 25b1bdce985b -r e5abd87bccef plugins/SpecialCSS.php --- a/plugins/SpecialCSS.php Tue May 05 22:06:23 2009 -0400 +++ b/plugins/SpecialCSS.php Sun May 10 14:44:50 2009 -0400 @@ -5,7 +5,7 @@ "Plugin URI" : "http://enanocms.org/", "Description" : "plugin_specialcss_desc", "Author" : "Dan Fuhry", - "Version" : "1.1.5", + "Version" : "1.1.6", "Author URI" : "http://enanocms.org/" } **!*/ @@ -24,17 +24,10 @@ global $db, $session, $paths, $template, $plugins; // Common objects -// $plugins->attachHook('session_started', 'SpecialCSS_paths_init();'); - function SpecialCSS_paths_init() { global $paths; - $paths->add_page(Array( - 'name'=>'specialpage_css', - 'urlname'=>'CSS', - 'namespace'=>'Special', - 'special'=>0,'visible'=>0,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', - )); + register_special_page('CSS', 'specialpage_css', false); } // function names are IMPORTANT!!! The name pattern is: page__ diff -r 25b1bdce985b -r e5abd87bccef plugins/SpecialGroups.php --- a/plugins/SpecialGroups.php Tue May 05 22:06:23 2009 -0400 +++ b/plugins/SpecialGroups.php Sun May 10 14:44:50 2009 -0400 @@ -5,7 +5,7 @@ "Plugin URI" : "http://enanocms.org/", "Description" : "plugin_specialgroups_desc", "Author" : "Dan Fuhry", - "Version" : "1.1.5", + "Version" : "1.1.6", "Author URI" : "http://enanocms.org/" } **!*/ @@ -26,13 +26,7 @@ function SpecialGroups_paths_init() { - global $paths; - $paths->add_page(Array( - 'name'=>'specialpage_groupcp', - 'urlname'=>'Usergroups', - 'namespace'=>'Special', - 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', - )); + register_special_page('Usergroups', 'specialpage_groupcp'); } function page_Special_Usergroups() diff -r 25b1bdce985b -r e5abd87bccef plugins/SpecialLog.php --- a/plugins/SpecialLog.php Tue May 05 22:06:23 2009 -0400 +++ b/plugins/SpecialLog.php Sun May 10 14:44:50 2009 -0400 @@ -24,13 +24,7 @@ function SpecialLog_paths_init() { - global $paths; - $paths->add_page(Array( - 'name'=>'specialpage_log', - 'urlname'=>'Log', - 'namespace'=>'Special', - 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', - )); + register_special_page('Log', 'specialpage_log'); } function page_Special_Log() diff -r 25b1bdce985b -r e5abd87bccef plugins/SpecialPageFuncs.php --- a/plugins/SpecialPageFuncs.php Tue May 05 22:06:23 2009 -0400 +++ b/plugins/SpecialPageFuncs.php Sun May 10 14:44:50 2009 -0400 @@ -5,7 +5,7 @@ "Plugin URI" : "http://enanocms.org/", "Description" : "plugin_specialpagefuncs_desc", "Author" : "Dan Fuhry", - "Version" : "1.1.5", + "Version" : "1.1.6", "Author URI" : "http://enanocms.org/" } **!*/ @@ -28,55 +28,13 @@ function SpecialPageFuncs_paths_init() { - global $paths; - $paths->add_page(Array( - 'name'=>'specialpage_create_page', - 'urlname'=>'CreatePage', - 'namespace'=>'Special', - 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', - )); - - $paths->add_page(Array( - 'name'=>'specialpage_all_pages', - 'urlname'=>'AllPages', - 'namespace'=>'Special', - 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', - )); - - $paths->add_page(Array( - 'name'=>'specialpage_special_pages', - 'urlname'=>'SpecialPages', - 'namespace'=>'Special', - 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', - )); - - $paths->add_page(Array( - 'name'=>'specialpage_about_enano', - 'urlname'=>'About_Enano', - 'namespace'=>'Special', - 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', - )); - - $paths->add_page(Array( - 'name'=>'specialpage_gnu_gpl', - 'urlname'=>'GNU_General_Public_License', - 'namespace'=>'Special', - 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', - )); - - $paths->add_page(Array( - 'name'=>'specialpage_tag_cloud', - 'urlname'=>'TagCloud', - 'namespace'=>'Special', - 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', - )); - - $paths->add_page(Array( - 'name'=>'specialpage_autofill', - 'urlname'=>'Autofill', - 'namespace'=>'Special', - 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', - )); + register_special_page('CreatePage', 'specialpage_create_page'); + register_special_page('AllPages', 'specialpage_all_pages'); + register_special_page('SpecialPages', 'specialpage_special_pages'); + register_special_page('About_Enano', 'specialpage_about_enano'); + register_special_page('GNU_General_Public_License', 'specialpage_gnu_gpl'); + register_special_page('TagCloud', 'specialpage_tag_cloud'); + register_special_page('Autofill', 'specialpage_autofill', false); } // function names are IMPORTANT!!! The name pattern is: page__ diff -r 25b1bdce985b -r e5abd87bccef plugins/SpecialSearch.php --- a/plugins/SpecialSearch.php Tue May 05 22:06:23 2009 -0400 +++ b/plugins/SpecialSearch.php Sun May 10 14:44:50 2009 -0400 @@ -5,7 +5,7 @@ "Plugin URI" : "http://enanocms.org/", "Description" : "plugin_specialsearch_desc", "Author" : "Dan Fuhry", - "Version" : "1.1.5", + "Version" : "1.1.6", "Author URI" : "http://enanocms.org/" } **!*/ @@ -26,20 +26,8 @@ function SpecialSearch_paths_init() { - global $paths; - $paths->add_page(Array( - 'name'=>'specialpage_search_rebuild', - 'urlname'=>'SearchRebuild', - 'namespace'=>'Special', - 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', - )); - - $paths->add_page(Array( - 'name'=>'specialpage_search', - 'urlname'=>'Search', - 'namespace'=>'Special', - 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', - )); + register_special_page('SearchRebuild', 'specialpage_search_rebuild'); + register_special_page('Search', 'specialpage_search'); } function page_Special_SearchRebuild() diff -r 25b1bdce985b -r e5abd87bccef plugins/SpecialUpdownload.php --- a/plugins/SpecialUpdownload.php Tue May 05 22:06:23 2009 -0400 +++ b/plugins/SpecialUpdownload.php Sun May 10 14:44:50 2009 -0400 @@ -5,7 +5,7 @@ "Plugin URI" : "http://enanocms.org/", "Description" : "plugin_specialupdownload_desc", "Author" : "Dan Fuhry", - "Version" : "1.1.5", + "Version" : "1.1.6", "Author URI" : "http://enanocms.org/" } **!*/ @@ -29,22 +29,10 @@ function SpecialUpDownload_paths_init() { - global $paths; - $paths->add_page(Array( - 'name'=>'specialpage_upload_file', - 'urlname'=>'UploadFile', - 'namespace'=>'Special', - 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', - )); + register_special_page('UploadFile', 'specialpage_upload_file'); + register_special_page('DownloadFile', 'specialpage_download_file'); +} - $paths->add_page(Array( - 'name'=>'specialpage_download_file', - 'urlname'=>'DownloadFile', - 'namespace'=>'Special', - 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', - )); -} - function page_Special_UploadFile() { global $db, $session, $paths, $template, $plugins; // Common objects diff -r 25b1bdce985b -r e5abd87bccef plugins/SpecialUserFuncs.php --- a/plugins/SpecialUserFuncs.php Tue May 05 22:06:23 2009 -0400 +++ b/plugins/SpecialUserFuncs.php Sun May 10 14:44:50 2009 -0400 @@ -5,7 +5,7 @@ "Plugin URI" : "http://enanocms.org/", "Description" : "plugin_specialuserfuncs_desc", "Author" : "Dan Fuhry", - "Version" : "1.1.5", + "Version" : "1.1.6", "Author URI" : "http://enanocms.org/" } **!*/ @@ -28,87 +28,18 @@ function SpecialUserFuncs_paths_init() { - global $paths; - $paths->add_page(Array( - 'name'=>'specialpage_log_in', - 'urlname'=>'Login', - 'namespace'=>'Special', - 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', - )); - $paths->add_page(Array( - 'name'=>'specialpage_log_out', - 'urlname'=>'Logout', - 'namespace'=>'Special', - 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', - )); - $paths->add_page(Array( - 'name'=>'specialpage_register', - 'urlname'=>'Register', - 'namespace'=>'Special', - 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', - )); - $paths->add_page(Array( - 'name'=>'specialpage_preferences', - 'urlname'=>'Preferences', - 'namespace'=>'Special', - 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', - )); - - $paths->add_page(Array( - 'name'=>'specialpage_contributions', - 'urlname'=>'Contributions', - 'namespace'=>'Special', - 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', - )); - - $paths->add_page(Array( - 'name'=>'specialpage_change_theme', - 'urlname'=>'ChangeStyle', - 'namespace'=>'Special', - 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', - )); - - $paths->add_page(Array( - 'name'=>'specialpage_activate_account', - 'urlname'=>'ActivateAccount', - 'namespace'=>'Special', - 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', - )); - - $paths->add_page(Array( - 'name'=>'specialpage_captcha', - 'urlname'=>'Captcha', - 'namespace'=>'Special', - 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', - )); - - $paths->add_page(Array( - 'name'=>'specialpage_password_reset', - 'urlname'=>'PasswordReset', - 'namespace'=>'Special', - 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', - )); - - $paths->add_page(Array( - 'name'=>'specialpage_member_list', - 'urlname'=>'Memberlist', - 'namespace'=>'Special', - 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', - )); - - $paths->add_page(Array( - 'name'=>'specialpage_language_export', - 'urlname'=>'LangExportJSON', - 'namespace'=>'Special', - 'special'=>0,'visible'=>0,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', - )); - - $paths->add_page(Array( - 'name'=>'specialpage_avatar', - 'urlname'=>'Avatar', - 'namespace'=>'Special', - 'special'=>0,'visible'=>0,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', - )); + register_special_page('Login', 'specialpage_log_in'); + register_special_page('Logout', 'specialpage_log_out'); + register_special_page('Register', 'specialpage_register'); + register_special_page('Preferences', 'specialpage_preferences'); + register_special_page('Contributions', 'specialpage_contributions'); + register_special_page('ChangeStyle', 'specialpage_change_theme'); + register_special_page('ActivateAccount', 'specialpage_activate_account'); + register_special_page('Captcha', 'specialpage_captcha'); + register_special_page('PasswordReset', 'specialpage_password_reset'); + register_special_page('Memberlist', 'specialpage_member_list'); + register_special_page('LangExportJSON', 'specialpage_language_export', false); + register_special_page('Avatar', 'specialpage_avatar', false); } // function names are IMPORTANT!!! The name pattern is: page__ @@ -1641,7 +1572,9 @@ } // offset - $offset = ( isset($_GET['offset']) && strval(intval($_GET['offset'])) === $_GET['offset']) ? intval($_GET['offset']) : 0; + $perpage = 25; + $page = (( isset($_GET['offset']) && strval(intval($_GET['offset'])) === $_GET['offset']) ? intval($_GET['offset']) : 1) - 1; + $offset = $page * $perpage; // sort order $sortkeys = array( @@ -1719,11 +1652,11 @@ '; // determine number of rows - $q = $db->sql_query('SELECT u.user_id FROM '.table_prefix.'users AS u WHERE ' . $username_where . ' AND u.username != \'Anonymous\';'); + $q = $db->sql_query('SELECT COUNT(u.user_id) FROM '.table_prefix.'users AS u WHERE ' . $username_where . ' AND u.username != \'Anonymous\';'); if ( !$q ) $db->_die(); - $num_rows = $db->numrows(); + list($num_rows) = $db->fetchrow_num(); $db->free_result(); if ( !empty($finduser_url) ) @@ -1731,7 +1664,7 @@ switch ( $num_rows ) { case 0: - $str = $lang->get('userfuncs_ml_msg_matches_zero'); break; + $str = ''; /* $lang->get('userfuncs_ml_msg_matches_zero'); */ break; case 1: $str = $lang->get('userfuncs_ml_msg_matches_one'); break; default: @@ -1742,14 +1675,15 @@ // main selector $pgsql_additional_group_by = ( ENANO_DBLAYER == 'PGSQL' ) ? ', u.username, u.reg_time, u.email, u.user_level, u.user_has_avatar, u.avatar_type, x.email_public' : ''; - $q = $db->sql_unbuffered_query('SELECT \'\' AS infobit, u.user_id, u.username, u.reg_time, u.email, u.user_level, u.user_has_avatar, u.avatar_type, x.email_public, COUNT(c.comment_id) AS num_comments FROM '.table_prefix.'users AS u + $q = $db->sql_query('SELECT \'\' AS infobit, u.user_id, u.username, u.reg_time, u.email, u.user_level, u.user_has_avatar, u.avatar_type, x.email_public, COUNT(c.comment_id) AS num_comments FROM '.table_prefix.'users AS u LEFT JOIN '.table_prefix.'users_extra AS x ON ( u.user_id = x.user_id ) LEFT JOIN ' . table_prefix . 'comments AS c ON ( u.user_id = c.user_id ) WHERE ' . $username_where . ' AND u.username != \'Anonymous\' GROUP BY u.user_id' . $pgsql_additional_group_by . ' - ORDER BY ' . $sort_sqllet . ' ' . $target_order . ';'); + ORDER BY ' . $sort_sqllet . ' ' . $target_order . ' + LIMIT ' . $perpage . ' OFFSET ' . $offset . ';'); if ( !$q ) $db->_die(); @@ -1763,56 +1697,61 @@ 'infobit' => array($formatter, 'infobit') ); - $html = paginate( - $q, // MySQL result resource - ' - {user_id} - {username} - {user_level} - {email} - {reg_time} - - - -