plugins/SpecialUserPrefs.php
author Dan
Thu, 20 Aug 2009 21:15:19 -0400
changeset 1084 742cb0f10766
parent 1083 ef2dbcac5d56
child 1086 6a59951b70e4
permissions -rw-r--r--
Sessions: whoops, left a debug message in by accident, broke a few redirects
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     1
<?php
519
94214ec0871c Started work on the new plugin manager and associated management code. Very incomplete at this point and not usable.
Dan
parents: 504
diff changeset
     2
/**!info**
94214ec0871c Started work on the new plugin manager and associated management code. Very incomplete at this point and not usable.
Dan
parents: 504
diff changeset
     3
{
94214ec0871c Started work on the new plugin manager and associated management code. Very incomplete at this point and not usable.
Dan
parents: 504
diff changeset
     4
  "Plugin Name"  : "plugin_specialuserprefs_title",
94214ec0871c Started work on the new plugin manager and associated management code. Very incomplete at this point and not usable.
Dan
parents: 504
diff changeset
     5
  "Plugin URI"   : "http://enanocms.org/",
94214ec0871c Started work on the new plugin manager and associated management code. Very incomplete at this point and not usable.
Dan
parents: 504
diff changeset
     6
  "Description"  : "plugin_specialuserprefs_desc",
94214ec0871c Started work on the new plugin manager and associated management code. Very incomplete at this point and not usable.
Dan
parents: 504
diff changeset
     7
  "Author"       : "Dan Fuhry",
960
e74741b8360b Added register_special_page() function, to make it much easier to create special pages. Also, rewrote Special:Memberlist to use more efficient fetch method and not use an unbuffered whole-table query.
Dan
parents: 953
diff changeset
     8
  "Version"      : "1.1.6",
519
94214ec0871c Started work on the new plugin manager and associated management code. Very incomplete at this point and not usable.
Dan
parents: 504
diff changeset
     9
  "Author URI"   : "http://enanocms.org/"
94214ec0871c Started work on the new plugin manager and associated management code. Very incomplete at this point and not usable.
Dan
parents: 504
diff changeset
    10
}
94214ec0871c Started work on the new plugin manager and associated management code. Very incomplete at this point and not usable.
Dan
parents: 504
diff changeset
    11
**!*/
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    12
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    13
/*
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    14
 * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
1081
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 1079
diff changeset
    15
 * Copyright (C) 2006-2009 Dan Fuhry
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    16
 *
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    17
 * This program is Free Software; you can redistribute it and/or modify it under the terms of the GNU General Public License
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    18
 * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    19
 *
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    20
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    21
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    22
 */
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    23
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    24
$userprefs_menu = Array();
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    25
$userprefs_menu_links = Array();
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    26
function userprefs_menu_add($section, $text, $link)
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    27
{
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    28
  global $userprefs_menu;
286
b2f985e4cef3 Fixed a number of issues with SQL query readability and some undefined index-ish errors; consequently the SQL report feature was added
Dan
parents: 224
diff changeset
    29
  if ( isset($userprefs_menu[$section]) && is_array($userprefs_menu[$section]) )
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    30
  {
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    31
    $userprefs_menu[$section][] = Array(
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    32
      'text' => $text,
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    33
      'link' => $link
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    34
      );
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    35
  }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    36
  else
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    37
  {
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    38
    $userprefs_menu[$section] = Array(Array(
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    39
      'text' => $text,
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    40
      'link' => $link
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    41
      ));
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    42
  }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    43
}
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    44
953
323c4cd1aa37 Made some more changes to the way namespaces are handled, for optimization purposes. This is a bit of a structural reorganization: $paths->pages is obsoleted in its entirety; calculating page existence and metadata is now the job of the Namespace_* backend class. There are many things in PageProcessor that should be reorganized, and page actions in general should really be rethought. This is probably the beginning of a long process that will be taking place over the course of the betas.
Dan
parents: 922
diff changeset
    45
$plugins->attachHook('tpl_compile_sidebar', 'userprefs_jbox_setup($button, $tb, $menubtn);');
103
a8891e108c95 Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents: 85
diff changeset
    46
a8891e108c95 Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents: 85
diff changeset
    47
function userprefs_jbox_setup(&$button, &$tb, &$menubtn)
a8891e108c95 Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents: 85
diff changeset
    48
{
a8891e108c95 Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents: 85
diff changeset
    49
  global $db, $session, $paths, $template, $plugins; // Common objects
388
9829ca63b53a Localized stray string "list of registered members" in UCP
Dan
parents: 372
diff changeset
    50
  global $lang;
103
a8891e108c95 Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents: 85
diff changeset
    51
  
322
5f1cd51bf1be Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents: 317
diff changeset
    52
  if ( $paths->namespace != 'Special' || $paths->page_id != 'Preferences' )
103
a8891e108c95 Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents: 85
diff changeset
    53
    return false;
a8891e108c95 Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents: 85
diff changeset
    54
  
a8891e108c95 Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents: 85
diff changeset
    55
  $tb .= "<ul>$template->toolbar_menu</ul>";
a8891e108c95 Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents: 85
diff changeset
    56
  $template->toolbar_menu = '';
a8891e108c95 Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents: 85
diff changeset
    57
  
a8891e108c95 Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents: 85
diff changeset
    58
  $button->assign_vars(array(
388
9829ca63b53a Localized stray string "list of registered members" in UCP
Dan
parents: 372
diff changeset
    59
      'TEXT' => $lang->get('usercp_btn_memberlist'),
103
a8891e108c95 Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents: 85
diff changeset
    60
      'FLAGS' => '',
a8891e108c95 Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents: 85
diff changeset
    61
      'PARENTFLAGS' => '',
a8891e108c95 Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents: 85
diff changeset
    62
      'HREF' => makeUrlNS('Special', 'Memberlist')
a8891e108c95 Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents: 85
diff changeset
    63
    ));
a8891e108c95 Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents: 85
diff changeset
    64
  
a8891e108c95 Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents: 85
diff changeset
    65
  $tb .= $button->run();
a8891e108c95 Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents: 85
diff changeset
    66
}
a8891e108c95 Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents: 85
diff changeset
    67
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    68
function userprefs_menu_html()
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    69
{
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    70
  global $userprefs_menu;
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    71
  global $userprefs_menu_links;
362
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
    72
  global $lang;
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    73
  
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    74
  $html = '';
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    75
  $quot = '"';
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    76
  
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    77
  foreach ( $userprefs_menu as $section => $buttons )
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    78
  {
362
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
    79
    $section_name = $section;
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
    80
    if ( preg_match('/^[a-z]+_[a-z_]+$/', $section) )
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
    81
    {
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
    82
      $section_name = $lang->get($section_name);
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
    83
    }
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
    84
    $html .= ( isset($userprefs_menu_links[$section]) ) ? "<a href={$quot}{$userprefs_menu_links[$section]}{$quot}>{$section_name}</a>\n        " : "<a>{$section_name}</a>\n        ";
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    85
    $html .= "<ul>\n          ";
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    86
    foreach ( $buttons as $button )
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    87
    {
362
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
    88
      $buttontext = $button['text'];
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
    89
      if ( preg_match('/^[a-z]+_[a-z_]+$/', $buttontext) )
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
    90
      {
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
    91
        $buttontext = $lang->get($buttontext);
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
    92
      }
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
    93
      $html .= "  <li><a href={$quot}{$button['link']}{$quot}>{$buttontext}</a></li>\n          ";
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    94
    }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    95
    $html .= "</ul>\n        ";
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    96
  }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    97
  
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    98
  return $html;
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    99
}
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   100
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   101
function userprefs_show_menu()
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   102
{
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   103
  echo '<div class="menu_nojs">
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   104
          ' . userprefs_menu_html() . '
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   105
          <span class="menuclear"></span>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   106
        </div>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   107
        <br />
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   108
        ';
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   109
}
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   110
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   111
function userprefs_menu_init()
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   112
{
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   113
  global $db, $session, $paths, $template, $plugins; // Common objects
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   114
  global $userprefs_menu_links;
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   115
  
362
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
   116
  userprefs_menu_add('usercp_sec_profile', 'usercp_sec_profile_emailpassword', makeUrlNS('Special', 'Preferences/EmailPassword') . '" onclick="ajaxLoginNavTo(\'Special\', \'Preferences/EmailPassword\', '.USER_LEVEL_CHPREF.'); return false;');
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
   117
  userprefs_menu_add('usercp_sec_profile', 'usercp_sec_profile_signature', makeUrlNS('Special', 'Preferences/Signature'));
1064
5a34101dfcf9 Moved User CP profile settings to front page of CP, and changed associated language
Dan
parents: 1055
diff changeset
   118
  // userprefs_menu_add('usercp_sec_profile', 'usercp_sec_profile_publicinfo', makeUrlNS('Special', 'Preferences/Profile'));
362
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
   119
  userprefs_menu_add('usercp_sec_profile', 'usercp_sec_profile_usergroups', makeUrlNS('Special', 'Usergroups'));
328
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   120
  if ( getConfig('avatar_enable') == '1' )
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   121
  {
362
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
   122
    userprefs_menu_add('usercp_sec_profile', 'usercp_sec_profile_avatar', makeUrlNS('Special', 'Preferences/Avatar'));
328
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   123
  }
362
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
   124
  userprefs_menu_add('usercp_sec_pm', 'usercp_sec_pm_inbox', makeUrlNS('Special', 'PrivateMessages/Folder/Inbox'));
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
   125
  userprefs_menu_add('usercp_sec_pm', 'usercp_sec_pm_outbox', makeUrlNS('Special', 'PrivateMessages/Folder/Outbox'));
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
   126
  userprefs_menu_add('usercp_sec_pm', 'usercp_sec_pm_sent', makeUrlNS('Special', 'PrivateMessages/Folder/Sent'));
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
   127
  userprefs_menu_add('usercp_sec_pm', 'usercp_sec_pm_drafts', makeUrlNS('Special', 'PrivateMessages/Folder/Drafts'));
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
   128
  userprefs_menu_add('usercp_sec_pm', 'usercp_sec_pm_archive', makeUrlNS('Special', 'PrivateMessages/Folder/Archive'));
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
   129
  
334
c72b545f1304 More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents: 329
diff changeset
   130
  /*
362
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
   131
  // Reserved for Enano's Next Big Innovation.(TM)
334
c72b545f1304 More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents: 329
diff changeset
   132
  userprefs_menu_add('Private messages', 'Inbox', makeUrlNS('Special',      'Private_Messages#folder:inbox'));
c72b545f1304 More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents: 329
diff changeset
   133
  userprefs_menu_add('Private messages', 'Starred', makeUrlNS('Special',     'Private_Messages#folder:starred'));
c72b545f1304 More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents: 329
diff changeset
   134
  userprefs_menu_add('Private messages', 'Sent items', makeUrlNS('Special', 'Private_Messages#folder:sent'));
c72b545f1304 More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents: 329
diff changeset
   135
  userprefs_menu_add('Private messages', 'Drafts', makeUrlNS('Special',     'Private_Messages#folder:drafts'));
c72b545f1304 More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents: 329
diff changeset
   136
  userprefs_menu_add('Private messages', 'Archive', makeUrlNS('Special',    'Private_Messages#folder:archive'));
c72b545f1304 More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents: 329
diff changeset
   137
  userprefs_menu_add('Private messages', 'Trash', makeUrlNS('Special',    'Private_Messages#folder:trash'));
c72b545f1304 More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents: 329
diff changeset
   138
  */
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   139
  
670
5e67afb31138 Fixed non-localized buttons in navbar on user CP, top menu trigger buttons should act as links again
Dan
parents: 621
diff changeset
   140
  $userprefs_menu_links['usercp_sec_profile'] = makeUrlNS('Special', 'Preferences');
5e67afb31138 Fixed non-localized buttons in navbar on user CP, top menu trigger buttons should act as links again
Dan
parents: 621
diff changeset
   141
  $userprefs_menu_links['usercp_sec_pm']  = makeUrlNS('Special', 'PrivateMessages');
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   142
  
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   143
  $code = $plugins->setHook('userprefs_jbox');
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   144
  foreach ( $code as $cmd )
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   145
  {
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   146
    eval($cmd);
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   147
  }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   148
}
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   149
334
c72b545f1304 More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents: 329
diff changeset
   150
$plugins->attachHook('common_post', 'userprefs_menu_init();');
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   151
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   152
function page_Special_Preferences()
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   153
{
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   154
  global $db, $session, $paths, $template, $plugins; // Common objects
328
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   155
  global $lang;
406
7468a663315f Added some basic timezone support; DST support is still to come.
Dan
parents: 389
diff changeset
   156
  global $timezone;
770
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   157
  global $cache;
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   158
  
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   159
  // We need a login to continue
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   160
  if ( !$session->user_logged_in )
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   161
    redirect(makeUrlNS('Special', 'Login/' . $paths->page), 'Login required', 'You need to be logged in to access this page. Please wait while you are redirected to the login page.');
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   162
  
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   163
  // User ID - later this will be specified on the URL, but hardcoded for now
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   164
  $uid = intval($session->user_id);
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   165
  
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   166
  // Instanciate the AES encryptor
286
b2f985e4cef3 Fixed a number of issues with SQL query readability and some undefined index-ish errors; consequently the SQL report feature was added
Dan
parents: 224
diff changeset
   167
  $aes = AESCrypt::singleton(AES_BITS, AES_BLOCKSIZE);
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   168
  
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   169
  // Basic user info
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   170
  $q = $db->sql_query('SELECT username, password, email, real_name, signature, theme, style FROM '.table_prefix.'users WHERE user_id='.$uid.';');
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   171
  if ( !$q )
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   172
    $db->_die();
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   173
  
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   174
  $row = $db->fetchrow();
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   175
  $db->free_result();
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   176
  
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   177
  $section = $paths->getParam(0);
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   178
  if ( !$section )
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   179
  {
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   180
    $section = 'Home';
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   181
  }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   182
  
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   183
  $errors = '';
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   184
  
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   185
  switch ( $section )
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   186
  {
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   187
    case 'EmailPassword':
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   188
      // Require elevated privileges (well sortof)
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   189
      if ( $session->auth_level < USER_LEVEL_CHPREF )
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   190
      {
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   191
        redirect(makeUrlNS('Special', 'Login/' . $paths->fullpage, 'level=' . USER_LEVEL_CHPREF, true), 'Authentication required', 'You need to re-authenticate to access this page.', 0);
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   192
      }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   193
      
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   194
      if ( isset($_POST['submit']) )
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   195
      {
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   196
        $email_changed = false;
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   197
        // First do the e-mail address
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   198
        if ( strlen($_POST['newemail']) > 0 )
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   199
        {
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   200
          switch('foo') // Same reason as in the password code...
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   201
          {
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   202
            case 'foo':
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   203
              if ( $_POST['newemail'] != $_POST['newemail_conf'] )
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   204
              {
362
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
   205
                $errors .= '<div class="error-box">' . $lang->get('usercp_emailpassword_err_email_no_match') . '</div>';
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   206
                break;
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   207
              }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   208
          }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   209
          $q = $db->sql_query('SELECT password FROM '.table_prefix.'users WHERE user_id='.$session->user_id.';');
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   210
          if ( !$q )
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   211
            $db->_die();
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   212
          $row = $db->fetchrow();
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   213
          $db->free_result();
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   214
          
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   215
          $new_email = $_POST['newemail'];
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   216
          
1079
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   217
          $result = $session->change_email($session->user_id, $new_email);
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   218
          if ( $result != 'success' )
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   219
          {
362
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
   220
            $message = '<p>' . $lang->get('usercp_emailpassword_err_list') . '</p>';
32
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 31
diff changeset
   221
            $message .= '<ul><li>' . implode("</li>\n<li>", $result) . '</li></ul>';
362
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
   222
            die_friendly($lang->get('usercp_emailpassword_err_title'), $message);
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   223
          }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   224
          $email_changed = true;
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   225
        }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   226
        // Obtain password
1079
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   227
        if ( !empty($_POST['crypt_data']) || !empty($_POST['newpass']) || $session->password_change_disabled )
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   228
        {
1079
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   229
          $newpass = $session->password_change_disabled ? '' : $session->get_aes_post('newpass');
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   230
          // At this point we know if we _want_ to change the password...
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   231
          
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   232
          // We can't check the password to see if it matches the confirmation
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   233
          // because the confirmation was destroyed during the encryption. I figured
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   234
          // this wasn't a big deal because if the encryption worked, then either
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   235
          // the Javascript validated it or the user hacked the form. In the latter
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   236
          // case, if he's smart enough to hack the encryption code, he's probably
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   237
          // smart enough to remember his password.
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   238
          
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   239
          if ( strlen($newpass) > 0 )
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   240
          {
224
6a4573507ff8 Fixed: invalid smartform input to Admin:UserManager when errors present and changing own account; [demo mode] default user can no longer change password
Dan
parents: 192
diff changeset
   241
            if ( defined('ENANO_DEMO_MODE') )
362
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
   242
              $errors .= '<div class="error-box" style="margin: 0 0 10px 0;">' . $lang->get('usercp_emailpassword_err_demo') . '</div>';
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   243
            // Perform checks
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   244
            if ( strlen($newpass) < 6 )
362
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
   245
              $errors .= '<div class="error-box" style="margin: 0 0 10px 0;">' . $lang->get('usercp_emailpassword_err_password_too_short') . '</div>';
133
af0f6ec48de3 Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents: 103
diff changeset
   246
            if ( getConfig('pw_strength_enable') == '1' )
af0f6ec48de3 Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents: 103
diff changeset
   247
            {
af0f6ec48de3 Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents: 103
diff changeset
   248
              $score_inp = password_score($newpass);
af0f6ec48de3 Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents: 103
diff changeset
   249
              if ( $score_inp < $score_min )
362
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
   250
                $errors .= '<div class="error-box" style="margin: 0 0 10px 0;">' . $lang->get('usercp_emailpassword_err_password_too_weak', array('score' => $score_inp)) . '</div>';
133
af0f6ec48de3 Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents: 103
diff changeset
   251
            }
801
eb8b23f11744 Two big commits in one day I know, but redid password storage to use HMAC-SHA1. Consolidated much AES processing to three core methods in session that should handle everything automagically. Installation works; upgrades should. Rebranded as 1.1.6.
Dan
parents: 770
diff changeset
   252
            if ( $_POST['use_crypt'] == 'no' && $newpass != $_POST['newpass_confirm'] )
eb8b23f11744 Two big commits in one day I know, but redid password storage to use HMAC-SHA1. Consolidated much AES processing to three core methods in session that should handle everything automagically. Installation works; upgrades should. Rebranded as 1.1.6.
Dan
parents: 770
diff changeset
   253
            {
eb8b23f11744 Two big commits in one day I know, but redid password storage to use HMAC-SHA1. Consolidated much AES processing to three core methods in session that should handle everything automagically. Installation works; upgrades should. Rebranded as 1.1.6.
Dan
parents: 770
diff changeset
   254
              $errors .= '<div class="error-box">' . $lang->get('usercp_emailpassword_err_password_no_match') . '</div>';
eb8b23f11744 Two big commits in one day I know, but redid password storage to use HMAC-SHA1. Consolidated much AES processing to three core methods in session that should handle everything automagically. Installation works; upgrades should. Rebranded as 1.1.6.
Dan
parents: 770
diff changeset
   255
            }
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   256
            // Encrypt new password
32
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 31
diff changeset
   257
            if ( empty($errors) )
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   258
            {
32
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 31
diff changeset
   259
              // Perform the swap
801
eb8b23f11744 Two big commits in one day I know, but redid password storage to use HMAC-SHA1. Consolidated much AES processing to three core methods in session that should handle everything automagically. Installation works; upgrades should. Rebranded as 1.1.6.
Dan
parents: 770
diff changeset
   260
              $session->set_password($session->username, $newpass);
32
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 31
diff changeset
   261
              // Log out and back in
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 31
diff changeset
   262
              $username = $session->username;
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 31
diff changeset
   263
              $session->logout();
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 31
diff changeset
   264
              if ( $email_changed )
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   265
              {
32
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 31
diff changeset
   266
                if ( getConfig('account_activation') == 'user' )
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 31
diff changeset
   267
                {
741
a216e412c439 Added ability to have alternate main page for members
Dan
parents: 711
diff changeset
   268
                  redirect(makeUrl(get_main_page()), $lang->get('usercp_emailpassword_msg_profile_success'), $lang->get('usercp_emailpassword_msg_need_activ_user'), 20);
32
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 31
diff changeset
   269
                }
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 31
diff changeset
   270
                else if ( getConfig('account_activation') == 'admin' )
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 31
diff changeset
   271
                {
741
a216e412c439 Added ability to have alternate main page for members
Dan
parents: 711
diff changeset
   272
                  redirect(makeUrl(get_main_page()), $lang->get('usercp_emailpassword_msg_profile_success'), $lang->get('usercp_emailpassword_msg_need_activ_admin'), 20);
32
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 31
diff changeset
   273
                }
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   274
              }
1079
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   275
              $session->login_without_crypto($username, $newpass);
362
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
   276
              redirect(makeUrlNS('Special', 'Preferences'), $lang->get('usercp_emailpassword_msg_pass_success'), $lang->get('usercp_emailpassword_msg_password_changed'), 5);
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   277
            }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   278
          }
1079
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   279
          else if ( $email_changed )
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   280
          {
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   281
            $session->logout(USER_LEVEL_CHPREF);
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   282
            $activation = $session->user_level >= USER_LEVEL_MOD ? 'none' : getConfig('account_activation', 'none');
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   283
            switch($activation)
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   284
            {
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   285
              default:
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   286
                $message_body = $lang->get('usercp_emailpassword_msg_password_changed');
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   287
                $timeout = 5;
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   288
                break;
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   289
              case 'admin':
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   290
                $message_body = $lang->get('usercp_emailpassword_msg_need_activ_user');
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   291
                $timeout = 20;
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   292
                break;
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   293
              case 'user':
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   294
                $message_body = $lang->get('usercp_emailpassword_msg_need_activ_admin');
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   295
                $timeout = 20;
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   296
                break;
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   297
            }
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   298
            redirect(makeUrlNS('Special', 'Preferences'), $lang->get('usercp_emailpassword_msg_email_success'), $message_body, $timeout);
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   299
          }
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   300
        }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   301
      }
362
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
   302
      $template->tpl_strings['PAGE_NAME'] = $lang->get('usercp_emailpassword_title');
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   303
      break;
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   304
    case 'Signature':
362
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
   305
      $template->tpl_strings['PAGE_NAME'] = $lang->get('usercp_signature_title');
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   306
      break;
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   307
    case 'Profile':
1083
ef2dbcac5d56 SECURITY: UCP: Added CSRF protection on Profile (unneeded on EmailPassword due to USER_LEVEL_CHPREF requirement)
Dan
parents: 1081
diff changeset
   308
    case 'Home':
ef2dbcac5d56 SECURITY: UCP: Added CSRF protection on Profile (unneeded on EmailPassword due to USER_LEVEL_CHPREF requirement)
Dan
parents: 1081
diff changeset
   309
      if ( isset($_POST['submit']) )
ef2dbcac5d56 SECURITY: UCP: Added CSRF protection on Profile (unneeded on EmailPassword due to USER_LEVEL_CHPREF requirement)
Dan
parents: 1081
diff changeset
   310
        csrf_request_confirm();
ef2dbcac5d56 SECURITY: UCP: Added CSRF protection on Profile (unneeded on EmailPassword due to USER_LEVEL_CHPREF requirement)
Dan
parents: 1081
diff changeset
   311
      
362
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
   312
      $template->tpl_strings['PAGE_NAME'] = $lang->get('usercp_publicinfo_title');
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   313
      break;
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   314
  }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   315
  
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   316
  $template->header();
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   317
  
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   318
  // Output the menu
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   319
  // This is not templatized because it conforms to the jBox menu standard.
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   320
  
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   321
  userprefs_show_menu();
1055
15ef8d2147c2 Here we go, preload_js() officially added to admin panel. Pray with me.
Dan
parents: 960
diff changeset
   322
  
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   323
  switch ( $section )
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   324
  {
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   325
    case 'EmailPassword':
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   326
      
133
af0f6ec48de3 Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents: 103
diff changeset
   327
      $errors = trim($errors);
af0f6ec48de3 Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents: 103
diff changeset
   328
      if ( !empty($errors) )
af0f6ec48de3 Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents: 103
diff changeset
   329
      {
af0f6ec48de3 Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents: 103
diff changeset
   330
        echo $errors;
af0f6ec48de3 Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents: 103
diff changeset
   331
      }
af0f6ec48de3 Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents: 103
diff changeset
   332
      
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   333
      echo '<form action="' . makeUrlNS('Special', 'Preferences/EmailPassword') . '" method="post" onsubmit="return runEncryption();" name="empwform" >';
1079
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   334
      echo '<fieldset>';
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   335
      echo '<legend>' . $lang->get('usercp_emailpassword_grp_chpasswd') . '</legend>';
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   336
      
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   337
      // Password change form
1079
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   338
      if ( $session->password_change_disabled )
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   339
      {
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   340
        echo '<p>' . $lang->get('usercp_emailpassword_msg_change_disabled') . '</p>';
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   341
        if ( $session->password_change_dest['url'] )
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   342
        {
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   343
          echo '<p>' . $lang->get('usercp_emailpassword_msg_change_disabled_url') . '
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   344
                   <a onclick="window.open(this.href); return false;" href="' . htmlspecialchars($session->password_change_dest['url']) . '">' . htmlspecialchars($session->password_change_dest['title']) . '</a></p>';
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   345
        }
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   346
      }
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   347
      else
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   348
      {
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   349
      echo $lang->get('usercp_emailpassword_field_newpass') . '<br />
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   350
                <input type="password" name="newpass" size="30" tabindex="1" ' . ( getConfig('pw_strength_enable') == '1' ? 'onkeyup="password_score_field(this);" ' : '' ) . '/>' . ( getConfig('pw_strength_enable') == '1' ? '<span class="password-checker" style="font-weight: bold; color: #aaaaaa;"> Loading...</span>' : '' ) . '
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   351
              <br />
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   352
              <br />
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   353
              ' . $lang->get('usercp_emailpassword_field_newpass_confirm') . '<br />
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   354
              <input type="password" name="newpass_confirm" size="30" tabindex="2" />
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   355
              ' . ( getConfig('pw_strength_enable') == '1' ? '<br /><br /><div id="pwmeter"></div>
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   356
              <small>' . $lang->get('usercp_emailpassword_msg_password_min_score') . '</small>' : '' );
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   357
      }
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   358
      echo '</fieldset><br />';
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   359
      echo '<fieldset>
362
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
   360
        <legend>' . $lang->get('usercp_emailpassword_grp_chemail') . '</legend>
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
   361
        ' . $lang->get('usercp_emailpassword_field_newemail') . '<br />
133
af0f6ec48de3 Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents: 103
diff changeset
   362
          <input type="text" value="' . ( isset($_POST['newemail']) ? htmlspecialchars($_POST['newemail']) : '' ) . '" name="newemail" size="30" tabindex="3" />
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   363
        <br />
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   364
        <br />
362
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
   365
        ' . $lang->get('usercp_emailpassword_field_newemail_confirm') . '<br />
133
af0f6ec48de3 Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents: 103
diff changeset
   366
          <input type="text" value="' . ( isset($_POST['newemail']) ? htmlspecialchars($_POST['newemail']) : '' ) . '" name="newemail_conf" size="30" tabindex="4" />
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   367
      </fieldset>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   368
      <br />
362
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
   369
      <div style="text-align: right;"><input type="submit" name="submit" value="' . $lang->get('etc_save_changes') . '" tabindex="5" /></div>';
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   370
      
1079
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   371
      if ( !$session->password_change_disabled )
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   372
        echo $session->generate_aes_form();
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   373
      
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   374
      echo '</form>';
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   375
      
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   376
      // ENCRYPTION CODE
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   377
      ?>
1079
fcc42560afe6 Added ability for authentication plugins to modify session keys (to allow invalidation when their own authentication data is changed) as well as the ability to disable the built-in password change facility
Dan
parents: 1064
diff changeset
   378
      <?php if ( !$session->password_change_disabled && getConfig('pw_strength_enable') == '1' ): ?>
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   379
      <script type="text/javascript">
586
234ddd896555 Made encryption work in form-based logon again; modified load_component() to fetch compressed versions when possible
Dan
parents: 573
diff changeset
   380
      addOnloadHook(function()
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   381
        {
586
234ddd896555 Made encryption work in form-based logon again; modified load_component() to fetch compressed versions when possible
Dan
parents: 573
diff changeset
   382
          password_score_field(document.forms.empwform.newpass);
234ddd896555 Made encryption work in form-based logon again; modified load_component() to fetch compressed versions when possible
Dan
parents: 573
diff changeset
   383
        });
801
eb8b23f11744 Two big commits in one day I know, but redid password storage to use HMAC-SHA1. Consolidated much AES processing to three core methods in session that should handle everything automagically. Installation works; upgrades should. Rebranded as 1.1.6.
Dan
parents: 770
diff changeset
   384
      </script>
586
234ddd896555 Made encryption work in form-based logon again; modified load_component() to fetch compressed versions when possible
Dan
parents: 573
diff changeset
   385
      <?php endif; ?>
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   386
      <?php
801
eb8b23f11744 Two big commits in one day I know, but redid password storage to use HMAC-SHA1. Consolidated much AES processing to three core methods in session that should handle everything automagically. Installation works; upgrades should. Rebranded as 1.1.6.
Dan
parents: 770
diff changeset
   387
      echo $session->aes_javascript('empwform', 'newpass');
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   388
      break;
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   389
    case 'Signature':
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   390
      if ( isset($_POST['new_sig']) )
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   391
      {
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   392
        $sig = $_POST['new_sig'];
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   393
        $sig = RenderMan::preprocess_text($sig, true, false);
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   394
        $sql_sig = $db->escape($sig);
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   395
        $q = $db->sql_query('UPDATE '.table_prefix.'users SET signature=\'' . $sql_sig . '\' WHERE user_id=' . $session->user_id . ';');
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   396
        if ( !$q )
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   397
          $db->_die();
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   398
        $session->signature = $sig;
362
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
   399
        echo '<div class="info-box" style="margin: 0 0 10px 0;">' . $lang->get('usercp_signature_msg_saved') . '</div>';
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   400
      }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   401
      echo '<form action="'.makeUrl($paths->fullpage).'" method="post">';
74
68469a95658d Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents: 36
diff changeset
   402
      echo $template->tinymce_textarea('new_sig', htmlspecialchars($session->signature));
362
02d315d1cc58 Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
Dan
parents: 343
diff changeset
   403
      echo '<input type="submit" value="' . $lang->get('usercp_signature_btn_save') . '" />';
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   404
      echo '</form>';
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   405
      break;
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   406
    case "Profile":
1064
5a34101dfcf9 Moved User CP profile settings to front page of CP, and changed associated language
Dan
parents: 1055
diff changeset
   407
    case 'Home':
5a34101dfcf9 Moved User CP profile settings to front page of CP, and changed associated language
Dan
parents: 1055
diff changeset
   408
      
5a34101dfcf9 Moved User CP profile settings to front page of CP, and changed associated language
Dan
parents: 1055
diff changeset
   409
      global $email;
5a34101dfcf9 Moved User CP profile settings to front page of CP, and changed associated language
Dan
parents: 1055
diff changeset
   410
      $userpage_id = $paths->nslist['User'] . sanitize_page_id($session->username);
5a34101dfcf9 Moved User CP profile settings to front page of CP, and changed associated language
Dan
parents: 1055
diff changeset
   411
      $userpage_exists = ( isPage($userpage_id) ) ? '' : ' class="wikilink-nonexistent"';
5a34101dfcf9 Moved User CP profile settings to front page of CP, and changed associated language
Dan
parents: 1055
diff changeset
   412
      $user_page = makeUrlNS('User', sanitize_page_id($session->username));
5a34101dfcf9 Moved User CP profile settings to front page of CP, and changed associated language
Dan
parents: 1055
diff changeset
   413
      $site_admin = $email->encryptEmail(getConfig('contact_email'), '', '', $lang->get('usercp_intro_para3_admin_link'));
5a34101dfcf9 Moved User CP profile settings to front page of CP, and changed associated language
Dan
parents: 1055
diff changeset
   414
      
5a34101dfcf9 Moved User CP profile settings to front page of CP, and changed associated language
Dan
parents: 1055
diff changeset
   415
      echo '<h3 style="margin-top: 0;">' . $lang->get('usercp_intro_heading_main', array('username' => $session->username)) . '</h3>';
5a34101dfcf9 Moved User CP profile settings to front page of CP, and changed associated language
Dan
parents: 1055
diff changeset
   416
      
5a34101dfcf9 Moved User CP profile settings to front page of CP, and changed associated language
Dan
parents: 1055
diff changeset
   417
      echo  $lang->get('usercp_intro', array('userpage_link' => $user_page));
5a34101dfcf9 Moved User CP profile settings to front page of CP, and changed associated language
Dan
parents: 1055
diff changeset
   418
      
770
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   419
      $available_ranks = $session->get_user_possible_ranks($session->user_id);
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   420
      $current_rank = $session->get_user_rank($session->user_id);
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   421
      
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   422
      if ( isset($_POST['submit']) )
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   423
      {
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   424
        $real_name = htmlspecialchars($_POST['real_name']);
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   425
        $real_name = $db->escape($real_name);
31
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   426
        
406
7468a663315f Added some basic timezone support; DST support is still to come.
Dan
parents: 389
diff changeset
   427
        $timezone = intval($_POST['timezone']);
7468a663315f Added some basic timezone support; DST support is still to come.
Dan
parents: 389
diff changeset
   428
        $tz_local = $timezone + 1440;
7468a663315f Added some basic timezone support; DST support is still to come.
Dan
parents: 389
diff changeset
   429
        
770
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   430
        $dst = $db->escape($_POST['dst']);
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   431
        if ( !preg_match('/^[0-9]+;[0-9]+;[0-9]+;[0-9]+;[0-9]+$/', $dst) )
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   432
          $dst = '0;0;0;0;60';
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   433
        
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   434
        $GLOBALS['dst_params'] = explode(';', $dst);
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   435
        
31
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   436
        $imaddr_aim = htmlspecialchars($_POST['imaddr_aim']);
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   437
        $imaddr_aim = $db->escape($imaddr_aim);
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   438
        
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   439
        $imaddr_msn = htmlspecialchars($_POST['imaddr_msn']);
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   440
        $imaddr_msn = $db->escape($imaddr_msn);
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   441
        
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   442
        $imaddr_yahoo = htmlspecialchars($_POST['imaddr_yahoo']);
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   443
        $imaddr_yahoo = $db->escape($imaddr_yahoo);
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   444
        
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   445
        $imaddr_xmpp = htmlspecialchars($_POST['imaddr_xmpp']);
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   446
        $imaddr_xmpp = $db->escape($imaddr_xmpp);
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   447
        
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   448
        $homepage = htmlspecialchars($_POST['homepage']);
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   449
        $homepage = $db->escape($homepage);
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   450
        
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   451
        $location = htmlspecialchars($_POST['location']);
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   452
        $location = $db->escape($location);
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   453
        
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   454
        $occupation = htmlspecialchars($_POST['occupation']);
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   455
        $occupation = $db->escape($occupation);
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   456
        
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   457
        $hobbies = htmlspecialchars($_POST['hobbies']);
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   458
        $hobbies = $db->escape($hobbies);
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   459
        
1081
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 1079
diff changeset
   460
        $date_format = $db->escape(htmlspecialchars($_POST['date_format']));
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 1079
diff changeset
   461
        $time_format = $db->escape(htmlspecialchars($_POST['time_format']));
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 1079
diff changeset
   462
        
31
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   463
        $email_public = ( isset($_POST['email_public']) ) ? '1' : '0';
555
ac4c6a7f01d8 Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents: 541
diff changeset
   464
        $disable_js_fx = ( isset($_POST['disable_js_fx']) ) ? '1' : '0';
31
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   465
        
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   466
        $session->real_name = $real_name;
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   467
        
32
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 31
diff changeset
   468
        if ( !preg_match('/@([a-z0-9-]+)(\.([a-z0-9-\.]+))?/', $imaddr_msn) && !empty($imaddr_msn) )
31
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   469
        {
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   470
          $imaddr_msn = "$imaddr_msn@hotmail.com";
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   471
        }
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   472
        
829
87fcc7175c61 Fixed https urls not allowed in user_extra CPs; fixed nonworking password reset in admin CP
Dan
parents: 801
diff changeset
   473
        if ( !preg_match('#^https?://#', $homepage) )
31
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   474
        {
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   475
          $homepage = "http://$homepage";
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   476
        }
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   477
        
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   478
        if ( !preg_match('/^http:\/\/([a-z0-9-.]+)([A-z0-9@#\$%\&:;<>,\.\?=\+\(\)\[\]_\/\\\\]*?)$/i', $homepage) )
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   479
        {
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   480
          $homepage = '';
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   481
        }
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   482
        
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   483
        $session->user_extra['user_aim'] = $imaddr_aim;
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   484
        $session->user_extra['user_msn'] = $imaddr_msn;
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   485
        $session->user_extra['user_xmpp'] = $imaddr_xmpp;
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   486
        $session->user_extra['user_yahoo'] = $imaddr_yahoo;
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   487
        $session->user_extra['user_homepage'] = $homepage;
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   488
        $session->user_extra['user_location'] = $location;
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   489
        $session->user_extra['user_job'] = $occupation;
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   490
        $session->user_extra['user_hobbies'] = $hobbies;
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   491
        $session->user_extra['email_public'] = intval($email_public);
1081
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 1079
diff changeset
   492
        $session->date_format = $date_format;
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 1079
diff changeset
   493
        $session->time_format = $time_format;
31
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   494
        
541
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   495
        // user title
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   496
        $user_title_col = '';
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   497
        if ( $session->get_permissions('custom_user_title') && isset($_POST['user_title']) )
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   498
        {
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   499
          $user_title = trim($_POST['user_title']);
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   500
          if ( empty($user_title) )
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   501
          {
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   502
            $colval = 'NULL';
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   503
            $session->user_title = null;
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   504
          }
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   505
          else
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   506
          {
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   507
            $colval = "'" . $db->escape($user_title) . "'";
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   508
            $session->user_title = $user_title;
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   509
          }
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   510
          $user_title_col = ", user_title = $colval";
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   511
        }
770
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   512
        $user_rank_col = '';
953
323c4cd1aa37 Made some more changes to the way namespaces are handled, for optimization purposes. This is a bit of a structural reorganization: $paths->pages is obsoleted in its entirety; calculating page existence and metadata is now the job of the Namespace_* backend class. There are many things in PageProcessor that should be reorganized, and page actions in general should really be rethought. This is probably the beginning of a long process that will be taking place over the course of the betas.
Dan
parents: 922
diff changeset
   513
        if ( isset($_POST['user_rank']) && intval($_POST['user_rank']) != $current_rank['rank_id'] && count($available_ranks) > 1 )
770
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   514
        {
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   515
          if ( $_POST['user_rank'] == 'NULL' )
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   516
          {
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   517
            $user_rank_col = ", user_rank = NULL, user_rank_userset = 0";
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   518
          }
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   519
          else
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   520
          {
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   521
            $new_rank = intval($_POST['user_rank']);
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   522
            $rank_allowed = false;
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   523
            foreach ( $available_ranks as $rank )
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   524
            {
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   525
              if ( $rank['rank_id'] == $new_rank )
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   526
              {
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   527
                $rank_allowed = true;
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   528
                break;
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   529
              }
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   530
            }
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   531
            if ( $rank_allowed )
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   532
            {
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   533
              $user_rank_col = ", user_rank = $new_rank, user_rank_userset = 1";
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   534
              // hack
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   535
              $current_rank['rank_id'] = $new_rank;
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   536
              $cache->purge('ranks');
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   537
            }
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   538
          }
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   539
        }
541
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   540
        
770
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   541
        $q = $db->sql_query('UPDATE '.table_prefix."users SET real_name='$real_name', user_timezone = {$tz_local}, user_dst = '$dst'{$user_title_col}{$user_rank_col} WHERE user_id=$session->user_id;");
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   542
        if ( !$q )
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   543
          $db->_die();
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   544
        
31
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   545
        $q = $db->sql_query('UPDATE '.table_prefix."users_extra SET user_aim='$imaddr_aim',user_yahoo='$imaddr_yahoo',user_msn='$imaddr_msn',
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   546
                               user_xmpp='$imaddr_xmpp',user_homepage='$homepage',user_location='$location',user_job='$occupation',
1081
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 1079
diff changeset
   547
                               user_hobbies='$hobbies',email_public=$email_public,disable_js_fx=$disable_js_fx,date_format='$date_format',
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 1079
diff changeset
   548
                               time_format='$time_format'
31
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   549
                               WHERE user_id=$session->user_id;");
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   550
        
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   551
        if ( !$q )
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   552
          $db->_die();
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   553
        
372
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   554
        // verify language id
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   555
        $lang_id = strval(intval($_POST['lang_id']));
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   556
        $q = $db->sql_query('SELECT 1 FROM ' . table_prefix . 'language WHERE lang_id = ' . $lang_id . ';');
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   557
        if ( !$q )
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   558
          $db->_die();
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   559
        
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   560
        if ( $db->numrows() > 0 )
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   561
        {
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   562
          $db->free_result();
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   563
          
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   564
          // unload / reload $lang, this verifies that the selected language works
770
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   565
          // enano should die a violent death if the language fails to load
372
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   566
          unset($GLOBALS['lang']);
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   567
          unset($lang);
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   568
          $lang_id = intval($lang_id);
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   569
          $GLOBALS['lang'] = new Language($lang_id);
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   570
          global $lang;
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   571
          
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   572
          $q = $db->sql_query('UPDATE ' . table_prefix . 'users SET user_lang = ' . $lang_id . " WHERE user_id = {$session->user_id};");
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   573
          if ( !$q )
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   574
            $db->_die();
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   575
        }
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   576
        else
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   577
        {
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   578
          $db->free_result();
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   579
        }
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   580
        
573
43e7254afdb4 Renamed some functions (that were new in this release anyway) due to compatibility broken with PunBB bridge
Dan
parents: 564
diff changeset
   581
        generate_cache_userranks();
541
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   582
        
364
390eb356cd49 Finished l10n on user CP
Dan
parents: 362
diff changeset
   583
        echo '<div class="info-box" style="margin: 0 0 10px 0;">' . $lang->get('usercp_publicinfo_msg_save_success') . '</div>';
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   584
      }
372
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   585
      
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   586
      $lang_box = '<select name="lang_id">';
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   587
      $q = $db->sql_query('SELECT lang_id, lang_name_native FROM ' . table_prefix . "language;");
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   588
      if ( !$q )
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   589
        $db->_die();
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   590
      
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   591
      while ( $row = $db->fetchrow_num() )
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   592
      {
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   593
        list($lang_id, $lang_name) = $row;
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   594
        $lang_name = htmlspecialchars($lang_name);
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   595
        $selected = ( $lang->lang_id == $lang_id ) ? ' selected="selected"' : '';
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   596
        $lang_box .= "<option value=\"$lang_id\"$selected>$lang_name</option>";
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   597
      }
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   598
      
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   599
      $lang_box .= '</select>';
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   600
      
406
7468a663315f Added some basic timezone support; DST support is still to come.
Dan
parents: 389
diff changeset
   601
      $tz_select = '<select name="timezone">';
7468a663315f Added some basic timezone support; DST support is still to come.
Dan
parents: 389
diff changeset
   602
      $tz_list = $lang->get('tz_list');
7468a663315f Added some basic timezone support; DST support is still to come.
Dan
parents: 389
diff changeset
   603
      try
7468a663315f Added some basic timezone support; DST support is still to come.
Dan
parents: 389
diff changeset
   604
      {
7468a663315f Added some basic timezone support; DST support is still to come.
Dan
parents: 389
diff changeset
   605
        $tz_list = enano_json_decode($tz_list);
7468a663315f Added some basic timezone support; DST support is still to come.
Dan
parents: 389
diff changeset
   606
      }
7468a663315f Added some basic timezone support; DST support is still to come.
Dan
parents: 389
diff changeset
   607
      catch(Exception $e)
7468a663315f Added some basic timezone support; DST support is still to come.
Dan
parents: 389
diff changeset
   608
      {
7468a663315f Added some basic timezone support; DST support is still to come.
Dan
parents: 389
diff changeset
   609
        die("Caught exception decoding timezone data: <pre>$e</pre>");
7468a663315f Added some basic timezone support; DST support is still to come.
Dan
parents: 389
diff changeset
   610
      }
7468a663315f Added some basic timezone support; DST support is still to come.
Dan
parents: 389
diff changeset
   611
      foreach ( $tz_list as $key => $i )
7468a663315f Added some basic timezone support; DST support is still to come.
Dan
parents: 389
diff changeset
   612
      {
7468a663315f Added some basic timezone support; DST support is still to come.
Dan
parents: 389
diff changeset
   613
        $i = ($i * 60);
7468a663315f Added some basic timezone support; DST support is still to come.
Dan
parents: 389
diff changeset
   614
        $title = $lang->get("tz_title_{$key}");
7468a663315f Added some basic timezone support; DST support is still to come.
Dan
parents: 389
diff changeset
   615
        $hrs = $lang->get("tz_hrs_{$key}");
7468a663315f Added some basic timezone support; DST support is still to come.
Dan
parents: 389
diff changeset
   616
        $selected = ( $i == $timezone ) ? ' selected="selected"' : '';
7468a663315f Added some basic timezone support; DST support is still to come.
Dan
parents: 389
diff changeset
   617
        $tz_select .= "<option value=\"$i\"$selected>$title</option>";
7468a663315f Added some basic timezone support; DST support is still to come.
Dan
parents: 389
diff changeset
   618
      }
7468a663315f Added some basic timezone support; DST support is still to come.
Dan
parents: 389
diff changeset
   619
      $tz_select .= '</select>';
7468a663315f Added some basic timezone support; DST support is still to come.
Dan
parents: 389
diff changeset
   620
      
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   621
      echo '<form action="'.makeUrl($paths->fullpage).'" method="post">';
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   622
      ?>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   623
      <div class="tblholder">
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   624
        <table border="0" cellspacing="1" cellpadding="4">
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   625
          <tr>
364
390eb356cd49 Finished l10n on user CP
Dan
parents: 362
diff changeset
   626
            <th colspan="2"><?php echo $lang->get('usercp_publicinfo_heading_main'); ?></th>
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   627
          </tr>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   628
          <tr>
364
390eb356cd49 Finished l10n on user CP
Dan
parents: 362
diff changeset
   629
            <td colspan="2" class="row3"><?php echo $lang->get('usercp_publicinfo_note_optional'); ?></td>
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   630
          </tr>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   631
          <tr>
364
390eb356cd49 Finished l10n on user CP
Dan
parents: 362
diff changeset
   632
            <td class="row2" style="width: 50%;"><?php echo $lang->get('usercp_publicinfo_field_realname'); ?></td>
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   633
            <td class="row1" style="width: 50%;"><input type="text" name="real_name" value="<?php echo $session->real_name; ?>" size="30" /></td>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   634
          </tr>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   635
          <tr>
372
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   636
            <td class="row2"><?php echo $lang->get('usercp_publicinfo_field_language') . '<br /><small>' . $lang->get('usercp_publicinfo_field_language_hint') . '</small>'; ?></td>
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   637
            <td class="row1"><?php echo $lang_box; ?></td>
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   638
          </tr>
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 364
diff changeset
   639
          <tr>
364
390eb356cd49 Finished l10n on user CP
Dan
parents: 362
diff changeset
   640
            <td class="row2"><?php echo $lang->get('usercp_publicinfo_field_changetheme_title'); ?></td>
390eb356cd49 Finished l10n on user CP
Dan
parents: 362
diff changeset
   641
            <td class="row1"><?php echo $lang->get('usercp_publicinfo_field_changetheme_hint'); ?> <a href="<?php echo makeUrlNS('Special', 'ChangeStyle/' . $paths->page); ?>" onclick="ajaxChangeStyle(); return false;"><?php echo $lang->get('usercp_publicinfo_field_changetheme'); ?></a></td>
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   642
          </tr>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   643
          <tr>
1081
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 1079
diff changeset
   644
            <td class="row2"><?php echo $lang->get('usercp_publicinfo_field_dateformat'); ?></td>
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 1079
diff changeset
   645
            <td class="row1">
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 1079
diff changeset
   646
            <select name="date_format">
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 1079
diff changeset
   647
              <?php
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 1079
diff changeset
   648
              foreach ( array(DATE_1, DATE_2, DATE_3, DATE_4) as $format )
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 1079
diff changeset
   649
              {
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 1079
diff changeset
   650
                $selected = $format === $session->date_format ? ' selected="selected"' : '';
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 1079
diff changeset
   651
                echo '<option value="' . $format . '"' . $selected . '>' . enano_date($format) . '</option>';
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 1079
diff changeset
   652
              }
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 1079
diff changeset
   653
              ?>
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 1079
diff changeset
   654
            </select>
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 1079
diff changeset
   655
            </td>
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 1079
diff changeset
   656
          </tr>
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 1079
diff changeset
   657
          <tr>
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 1079
diff changeset
   658
            <td class="row2"><?php echo $lang->get('usercp_publicinfo_field_timeformat'); ?></td>
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 1079
diff changeset
   659
            <td class="row1">
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 1079
diff changeset
   660
            <select name="time_format">
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 1079
diff changeset
   661
              <?php
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 1079
diff changeset
   662
              foreach ( array(TIME_12_NS, TIME_12_S, TIME_24_NS, TIME_24_S) as $format )
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 1079
diff changeset
   663
              {
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 1079
diff changeset
   664
                $selected = $format === $session->time_format ? ' selected="selected"' : '';
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 1079
diff changeset
   665
                echo '<option value="' . $format . '"' . $selected . '>' . enano_date($format) . '</option>';
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 1079
diff changeset
   666
              }
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 1079
diff changeset
   667
              ?>
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 1079
diff changeset
   668
            </select>
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 1079
diff changeset
   669
            </td>
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 1079
diff changeset
   670
          </tr>
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 1079
diff changeset
   671
          <tr>
922
d6f391475bb9 [QA] User CP: rearranged some things to fix overly tall cells and/or sidescrolling
Dan
parents: 893
diff changeset
   672
            <td class="row3" colspan="2"><?php echo $lang->get('usercp_publicinfo_field_timezone'); ?> <?php echo $tz_select; ?><br /><small><?php echo $lang->get('usercp_publicinfo_field_timezone_hint'); ?></small></td>
406
7468a663315f Added some basic timezone support; DST support is still to come.
Dan
parents: 389
diff changeset
   673
          </tr>
711
f70d764aab33 Added initial support for DST. Rules are defined in constants.php and are extensible.
Dan
parents: 685
diff changeset
   674
          <tr>
f70d764aab33 Added initial support for DST. Rules are defined in constants.php and are extensible.
Dan
parents: 685
diff changeset
   675
            <td class="row2"><?php echo $lang->get('usercp_publicinfo_field_dst'); ?></td>
f70d764aab33 Added initial support for DST. Rules are defined in constants.php and are extensible.
Dan
parents: 685
diff changeset
   676
            <td class="row1">
f70d764aab33 Added initial support for DST. Rules are defined in constants.php and are extensible.
Dan
parents: 685
diff changeset
   677
              <select name="dst">
f70d764aab33 Added initial support for DST. Rules are defined in constants.php and are extensible.
Dan
parents: 685
diff changeset
   678
                <?php
f70d764aab33 Added initial support for DST. Rules are defined in constants.php and are extensible.
Dan
parents: 685
diff changeset
   679
                global $dst_profiles, $dst_params;
f70d764aab33 Added initial support for DST. Rules are defined in constants.php and are extensible.
Dan
parents: 685
diff changeset
   680
                $user_dst = implode(';', $dst_params);
f70d764aab33 Added initial support for DST. Rules are defined in constants.php and are extensible.
Dan
parents: 685
diff changeset
   681
                foreach ( $dst_profiles as $region => $data )
f70d764aab33 Added initial support for DST. Rules are defined in constants.php and are extensible.
Dan
parents: 685
diff changeset
   682
                {
f70d764aab33 Added initial support for DST. Rules are defined in constants.php and are extensible.
Dan
parents: 685
diff changeset
   683
                  $selected = ( $data === $user_dst ) ? ' selected="selected"' : '';
f70d764aab33 Added initial support for DST. Rules are defined in constants.php and are extensible.
Dan
parents: 685
diff changeset
   684
                  echo '<option value="' . $data . '"' . $selected . '>' . $lang->get("tz_dst_$region") . '</option>';
f70d764aab33 Added initial support for DST. Rules are defined in constants.php and are extensible.
Dan
parents: 685
diff changeset
   685
                }
f70d764aab33 Added initial support for DST. Rules are defined in constants.php and are extensible.
Dan
parents: 685
diff changeset
   686
                ?>
f70d764aab33 Added initial support for DST. Rules are defined in constants.php and are extensible.
Dan
parents: 685
diff changeset
   687
              </select>
f70d764aab33 Added initial support for DST. Rules are defined in constants.php and are extensible.
Dan
parents: 685
diff changeset
   688
            </td>
f70d764aab33 Added initial support for DST. Rules are defined in constants.php and are extensible.
Dan
parents: 685
diff changeset
   689
          </tr>
541
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   690
          <?php
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   691
          if ( $session->get_permissions('custom_user_title') ):
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   692
          ?>
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   693
            <tr>
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   694
              <td class="row2">
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   695
                <?php echo $lang->get('usercp_publicinfo_field_usertitle_title'); ?><br />
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   696
                <small><?php echo $lang->get('usercp_publicinfo_field_usertitle_hint'); ?></small>
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   697
              </td>
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   698
              <td class="row1">
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   699
                <input type="text" name="user_title" value="<?php echo htmlspecialchars($session->user_title); ?>" />
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   700
              </td>
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   701
            </tr>
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   702
          <?php
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   703
          endif;
770
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   704
          if ( count($available_ranks) > 1 ):
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   705
          ?>
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   706
          <tr>
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   707
            <td class="row2">
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   708
              <?php echo $lang->get('usercp_publicinfo_field_rank_title'); ?><br />
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   709
              <small><?php echo $lang->get('usercp_publicinfo_field_rank_hint'); ?></small>
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   710
            </td>
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   711
            <td class="row1">
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   712
              <select name="user_rank">
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   713
                <?php
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   714
                foreach ( $available_ranks as $rank )
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   715
                {
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   716
                  $sel = ( $rank['rank_id'] == $current_rank['rank_id'] ) ? ' selected="selected"' : '';
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   717
                  echo '<option' . $sel . ' value="' . $rank['rank_id'] . '" style="' . htmlspecialchars($rank['rank_style']) . '">';
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   718
                  echo htmlspecialchars($lang->get($rank['rank_title']));
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   719
                  echo '</option>';
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   720
                }
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   721
                ?>
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   722
              </select>
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   723
            </td>
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   724
          </tr>
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   725
          <?php
62fed244fa1c Fixed timezone preference setting not fully implemented; added ability for users to select their own rank from a list of possible ranks based on group membership and user level
Dan
parents: 741
diff changeset
   726
          endif;
541
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   727
          ?>
406
7468a663315f Added some basic timezone support; DST support is still to come.
Dan
parents: 389
diff changeset
   728
          <tr>
31
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   729
            <th class="subhead" colspan="2">
364
390eb356cd49 Finished l10n on user CP
Dan
parents: 362
diff changeset
   730
              <?php echo $lang->get('usercp_publicinfo_th_im'); ?>
31
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   731
            </th>
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   732
          <tr>
364
390eb356cd49 Finished l10n on user CP
Dan
parents: 362
diff changeset
   733
            <td class="row2" style="width: 50%;"><?php echo $lang->get('usercp_publicinfo_field_aim'); ?></td>
31
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   734
            <td class="row1" style="width: 50%;"><input type="text" name="imaddr_aim" value="<?php echo $session->user_extra['user_aim']; ?>" size="30" /></td>
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   735
          </tr>
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   736
          <tr>
364
390eb356cd49 Finished l10n on user CP
Dan
parents: 362
diff changeset
   737
            <td class="row2" style="width: 50%;"><?php echo $lang->get('usercp_publicinfo_field_wlm'); ?></td>
31
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   738
            <td class="row1" style="width: 50%;"><input type="text" name="imaddr_msn" value="<?php echo $session->user_extra['user_msn']; ?>" size="30" /></td>
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   739
          </tr>
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   740
          <tr>
364
390eb356cd49 Finished l10n on user CP
Dan
parents: 362
diff changeset
   741
            <td class="row2" style="width: 50%;"><?php echo $lang->get('usercp_publicinfo_field_yim'); ?></td>
31
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   742
            <td class="row1" style="width: 50%;"><input type="text" name="imaddr_yahoo" value="<?php echo $session->user_extra['user_yahoo']; ?>" size="30" /></td>
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   743
          </tr>
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   744
          <tr>
364
390eb356cd49 Finished l10n on user CP
Dan
parents: 362
diff changeset
   745
            <td class="row2" style="width: 50%;"><?php echo $lang->get('usercp_publicinfo_field_xmpp'); ?></td>
31
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   746
            <td class="row1" style="width: 50%;"><input type="text" name="imaddr_xmpp" value="<?php echo $session->user_extra['user_xmpp']; ?>" size="30" /></td>
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   747
          </tr>
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   748
          <tr>
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   749
            <th class="subhead" colspan="2">
364
390eb356cd49 Finished l10n on user CP
Dan
parents: 362
diff changeset
   750
              <?php echo $lang->get('usercp_publicinfo_th_contact'); ?>
31
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   751
            </th>
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   752
          </tr>
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   753
          <tr>
364
390eb356cd49 Finished l10n on user CP
Dan
parents: 362
diff changeset
   754
            <td class="row2" style="width: 50%;"><?php echo $lang->get('usercp_publicinfo_field_homepage'); ?></td>
31
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   755
            <td class="row1" style="width: 50%;"><input type="text" name="homepage" value="<?php echo $session->user_extra['user_homepage']; ?>" size="30" /></td>
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   756
          </tr>
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   757
          <tr>
364
390eb356cd49 Finished l10n on user CP
Dan
parents: 362
diff changeset
   758
            <td class="row2" style="width: 50%;"><?php echo $lang->get('usercp_publicinfo_field_location'); ?></td>
31
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   759
            <td class="row1" style="width: 50%;"><input type="text" name="location" value="<?php echo $session->user_extra['user_location']; ?>" size="30" /></td>
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   760
          </tr>
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   761
          <tr>
364
390eb356cd49 Finished l10n on user CP
Dan
parents: 362
diff changeset
   762
            <td class="row2" style="width: 50%;"><?php echo $lang->get('usercp_publicinfo_field_job'); ?></td>
31
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   763
            <td class="row1" style="width: 50%;"><input type="text" name="occupation" value="<?php echo $session->user_extra['user_job']; ?>" size="30" /></td>
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   764
          </tr>
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   765
          <tr>
364
390eb356cd49 Finished l10n on user CP
Dan
parents: 362
diff changeset
   766
            <td class="row2" style="width: 50%;"><?php echo $lang->get('usercp_publicinfo_field_hobbies'); ?></td>
31
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   767
            <td class="row1" style="width: 50%;"><input type="text" name="hobbies" value="<?php echo $session->user_extra['user_hobbies']; ?>" size="30" /></td>
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   768
          </tr>
dc8741857bde Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents: 0
diff changeset
   769
          <tr>
922
d6f391475bb9 [QA] User CP: rearranged some things to fix overly tall cells and/or sidescrolling
Dan
parents: 893
diff changeset
   770
            <td class="row2" style="width: 50%;"><label for="chk_email_public"><?php echo $lang->get('usercp_publicinfo_field_email_public'); ?></label></td>
d6f391475bb9 [QA] User CP: rearranged some things to fix overly tall cells and/or sidescrolling
Dan
parents: 893
diff changeset
   771
            <td class="row1" style="width: 50%;"><label><input type="checkbox" id="chk_email_public" name="email_public" <?php if ($session->user_extra['email_public'] == 1) echo 'checked="checked"'; ?> size="30" /> <small><?php echo $lang->get('usercp_publicinfo_field_email_public_hint'); ?></small></label></td>
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   772
          </tr>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   773
          <tr>
922
d6f391475bb9 [QA] User CP: rearranged some things to fix overly tall cells and/or sidescrolling
Dan
parents: 893
diff changeset
   774
            <td class="row2" style="width: 50%;"><label for="chk_jsfx"><?php echo $lang->get('usercp_publicinfo_field_jsfx'); ?></label></td>
d6f391475bb9 [QA] User CP: rearranged some things to fix overly tall cells and/or sidescrolling
Dan
parents: 893
diff changeset
   775
            <td class="row1" style="width: 50%;"><label><input type="checkbox" id="chk_jsfx" name="disable_js_fx" <?php if ($session->user_extra['disable_js_fx'] == 1) echo 'checked="checked"'; ?> size="30" /> <small><?php echo $lang->get('usercp_publicinfo_field_jsfx_hint'); ?></small></label></td>
555
ac4c6a7f01d8 Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents: 541
diff changeset
   776
          </tr>
ac4c6a7f01d8 Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents: 541
diff changeset
   777
          <tr>
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   778
            <th class="subhead" colspan="2">
364
390eb356cd49 Finished l10n on user CP
Dan
parents: 362
diff changeset
   779
              <input type="submit" name="submit" value="<?php echo $lang->get('usercp_publicinfo_btn_save'); ?>" />
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   780
            </th>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   781
          </tr>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   782
        </table>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   783
      </div>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   784
      <?php
1083
ef2dbcac5d56 SECURITY: UCP: Added CSRF protection on Profile (unneeded on EmailPassword due to USER_LEVEL_CHPREF requirement)
Dan
parents: 1081
diff changeset
   785
      // CSRF protection
ef2dbcac5d56 SECURITY: UCP: Added CSRF protection on Profile (unneeded on EmailPassword due to USER_LEVEL_CHPREF requirement)
Dan
parents: 1081
diff changeset
   786
      echo '<input type="hidden" name="cstok" value="' . $session->csrf_token . '" />';
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   787
      echo '</form>';
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   788
      break;
328
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   789
    case 'Avatar':
835
146bc1daf498 Fixed: no default values in for avatar upload settings
Dan
parents: 829
diff changeset
   790
      if ( getConfig('avatar_enable', 0) !== 1 )
328
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   791
      {
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   792
        echo '<div class="error-box"><b>' . $lang->get('usercp_avatar_err_disabled_title') . '</b><br />' . $lang->get('usercp_avatar_err_disabled_body') . '</div>';
835
146bc1daf498 Fixed: no default values in for avatar upload settings
Dan
parents: 829
diff changeset
   793
        break;
328
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   794
      }
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   795
      
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   796
      // Determine current avatar
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   797
      $q = $db->sql_query('SELECT user_has_avatar, avatar_type FROM ' . table_prefix . 'users WHERE user_id = ' . $session->user_id . ';');
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   798
      if ( !$q )
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   799
        $db->_die('Avatar CP selecting user\'s avatar data');
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   800
      
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   801
      list($has_avi, $avi_type) = $db->fetchrow_num();
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   802
      
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   803
      if ( isset($_POST['submit']) )
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   804
      {
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   805
        $action = ( isset($_POST['avatar_action']) ) ? $_POST['avatar_action'] : 'keep';
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   806
        $avi_path = ENANO_ROOT . '/' . getConfig('avatar_directory') . '/' . $session->user_id . '.' . $avi_type;
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   807
        switch($action)
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   808
        {
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   809
          case 'keep':
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   810
          default:
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   811
            break;
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   812
          case 'remove':
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   813
            if ( $has_avi )
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   814
            {
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   815
              // First switch the avatar off
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   816
              $q = $db->sql_query('UPDATE ' . table_prefix . 'users SET user_has_avatar = 0 WHERE user_id = ' . $session->user_id . ';');
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   817
              if ( !$q )
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   818
                $db->_die('Avatar CP switching user avatar off');
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   819
              
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   820
              if ( @unlink($avi_path) )
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   821
              {
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   822
                echo '<div class="info-box">' . $lang->get('usercp_avatar_delete_success') . '</div>';
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   823
              }
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   824
              $has_avi = 0;
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   825
            }
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   826
            break;
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   827
          case 'set_http':
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   828
          case 'set_file':
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   829
            // Hackish way to preserve the UNIX philosophy of reusing as much code as possible
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   830
            if ( $action == 'set_http' )
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   831
            {
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   832
              // Check if this action is enabled
836
f8199a8d6153 Blah. Wrong type for those getConfig values.
Dan
parents: 835
diff changeset
   833
              if ( getConfig('avatar_upload_http', 1) !== 1 )
328
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   834
              {
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   835
                // non-localized, only appears on hack attempt
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   836
                echo '<div class="error-box">Uploads over HTTP are disabled.</div>';
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   837
                break;
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   838
              }
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   839
              // Download the file
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   840
              require_once( ENANO_ROOT . '/includes/http.php' );
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   841
              
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   842
              if ( !preg_match('/^http:\/\/([a-z0-9-\.]+)(:([0-9]+))?\/(.+)$/', $_POST['avatar_http_url'], $match) )
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   843
              {
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   844
                echo '<div class="error-box">' . $lang->get('usercp_avatar_invalid_url') . '</div>';
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   845
                break;
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   846
              }
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   847
              
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   848
              $hostname = $match[1];
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   849
              $uri = '/' . $match[4];
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   850
              $port = ( $match[3] ) ? intval($match[3]) : 80;
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   851
              $max_size = intval(getConfig('avatar_max_size'));
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   852
              
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   853
              // Get temporary file
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   854
              $tempfile = tempnam(false, "enanoavatar_{$session->user_id}");
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   855
              if ( !$tempfile )
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   856
                echo '<div class="error-box">Error getting temp file.</div>';
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   857
              
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   858
              @unlink($tempfile);
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   859
              $request = new Request_HTTP($hostname, $uri, 'GET', $port);
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   860
              $result = $request->write_response_to_file($tempfile, 50, $max_size);
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   861
              if ( !$result || $request->response_code != HTTP_OK )
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   862
              {
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   863
                @unlink($tempfile);
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   864
                echo '<div class="error-box">' . $lang->get('usercp_avatar_bad_write') . '</div>';
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   865
                break;
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   866
              }
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   867
              
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   868
              // Response written. Proceed to validation...
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   869
            }
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   870
            else
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   871
            {
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   872
              // Check if this action is enabled
836
f8199a8d6153 Blah. Wrong type for those getConfig values.
Dan
parents: 835
diff changeset
   873
              if ( getConfig('avatar_upload_file', 1) !== 1 )
328
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   874
              {
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   875
                // non-localized, only appears on hack attempt
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   876
                echo '<div class="error-box">Uploads from the browser are disabled.</div>';
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   877
                break;
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   878
              }
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   879
              
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   880
              $max_size = intval(getConfig('avatar_max_size'));
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   881
              
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   882
              $file =& $_FILES['avatar_file'];
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   883
              $tempfile =& $file['tmp_name'];
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   884
              if ( filesize($tempfile) > $max_size )
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   885
              {
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   886
                @unlink($tempfile);
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   887
                echo '<div class="error-box">' . $lang->get('usercp_avatar_file_too_large') . '</div>';
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   888
                break;
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   889
              }
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   890
            }
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   891
            $file_type = get_image_filetype($tempfile);
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   892
            if ( !$file_type )
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   893
            {
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   894
              unlink($tempfile);
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   895
              echo '<div class="error-box">' . $lang->get('usercp_avatar_bad_filetype') . '</div>';
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   896
              break;
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   897
            }
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   898
            
329
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 328
diff changeset
   899
            $avi_path_new = ENANO_ROOT . '/' . getConfig('avatar_directory') . '/' . $session->user_id . '.' . $file_type;
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 328
diff changeset
   900
            
328
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   901
            // The file type is good - validate dimensions and animation
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   902
            switch($file_type)
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   903
            {
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   904
              case 'png':
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   905
                $is_animated = is_png_animated($tempfile);
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   906
                $dimensions = png_get_dimensions($tempfile);
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   907
                break;
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   908
              case 'gif':
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   909
                $is_animated = is_gif_animated($tempfile);
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   910
                $dimensions = gif_get_dimensions($tempfile);
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   911
                break;
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   912
              case 'jpg':
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   913
                $is_animated = false;
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   914
                $dimensions = jpg_get_dimensions($tempfile);
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   915
                break;
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   916
              default:
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   917
                echo '<div class="error-box">API mismatch</div>';
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   918
                break 2;
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   919
            }
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   920
            // Did we get invalid size data? If so the image is probably corrupt.
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   921
            if ( !$dimensions )
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   922
            {
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   923
              @unlink($tempfile);
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   924
              echo '<div class="error-box">' . $lang->get('usercp_avatar_corrupt_image') . '</div>';
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   925
              break;
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   926
            }
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   927
            // Is the image animated?
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   928
            if ( $is_animated && getConfig('avatar_enable_anim') !== '1' )
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   929
            {
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   930
              @unlink($tempfile);
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   931
              echo '<div class="error-box">' . $lang->get('usercp_avatar_disallowed_animation') . '</div>';
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   932
              break;
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   933
            }
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   934
            // Check image dimensions
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   935
            list($image_x, $image_y) = $dimensions;
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   936
            $max_x = intval(getConfig('avatar_max_width'));
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   937
            $max_y = intval(getConfig('avatar_max_height'));
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   938
            if ( $image_x > $max_x || $image_y > $max_y )
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   939
            {
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   940
              @unlink($tempfile);
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   941
              echo '<div class="error-box">' . $lang->get('usercp_avatar_too_large') . '</div>';
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   942
              break;
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   943
            }
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   944
            // All good!
329
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 328
diff changeset
   945
            @unlink($avi_path);
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 328
diff changeset
   946
            if ( rename($tempfile, $avi_path_new) )
328
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   947
            {
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   948
              $q = $db->sql_query('UPDATE ' . table_prefix . "users SET user_has_avatar = 1, avatar_type = '$file_type' WHERE user_id = {$session->user_id};");
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   949
              if ( !$q )
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   950
                $db->_die('Avatar CP updating users table after successful avatar upload');
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   951
              $has_avi = 1;
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   952
              $avi_type = $file_type;
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   953
              echo '<div class="info-box">' . $lang->get('usercp_avatar_upload_success') . '</div>';
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   954
            }
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   955
            else
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   956
            {
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   957
              echo '<div class="error-box">' . $lang->get('usercp_avatar_move_failed') . '</div>';
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   958
            }
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   959
            break;
621
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
   960
          case 'set_gravatar':
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
   961
            // set avatar to use Gravatar
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
   962
            // make sure we're allowed to do this
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
   963
            if ( getConfig('avatar_upload_gravatar') != '1' )
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
   964
            {
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
   965
              // access denied
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
   966
              break;
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
   967
            }
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
   968
            // first, remove old image
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
   969
            if ( $has_avi )
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
   970
            {
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
   971
              // First switch the avatar off
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
   972
              $q = $db->sql_query('UPDATE ' . table_prefix . 'users SET user_has_avatar = 0 WHERE user_id = ' . $session->user_id . ';');
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
   973
              if ( !$q )
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
   974
                $db->_die('Avatar CP switching user avatar off');
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
   975
              
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
   976
              @unlink($avi_path);
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
   977
            }
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
   978
            // set to gravatar mode
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
   979
            $q = $db->sql_query('UPDATE ' . table_prefix . 'users SET user_has_avatar = 1, avatar_type = \'grv\' WHERE user_id = ' . $session->user_id . ';');
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
   980
            if ( !$q )
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
   981
              $db->_die('Avatar CP switching user avatar off');
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
   982
              
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
   983
            $has_avi = 1;
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
   984
            echo '<div class="info-box">' . $lang->get('usercp_avatar_gravatar_success') . '</div>';
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
   985
            break;
328
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   986
        }
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   987
      }
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   988
      
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   989
      ?>
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   990
      <script type="text/javascript">
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   991
      
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   992
        function avatar_select_field(elParent)
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   993
        {
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   994
          switch(elParent.value)
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   995
          {
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   996
            case 'keep':
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   997
            case 'remove':
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   998
              $('avatar_upload_http').object.style.display = 'none';
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
   999
              $('avatar_upload_file').object.style.display = 'none';
621
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
  1000
              $('avatar_upload_gravatar').object.style.display = 'none';
328
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1001
              break;
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1002
            case 'set_http':
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1003
              $('avatar_upload_http').object.style.display = 'block';
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1004
              $('avatar_upload_file').object.style.display = 'none';
621
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
  1005
              $('avatar_upload_gravatar').object.style.display = 'none';
328
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1006
              break;
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1007
            case 'set_file':
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1008
              $('avatar_upload_http').object.style.display = 'none';
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1009
              $('avatar_upload_file').object.style.display = 'block';
621
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
  1010
              $('avatar_upload_gravatar').object.style.display = 'none';
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
  1011
              break;
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
  1012
            case 'set_gravatar':
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
  1013
              $('avatar_upload_gravatar').object.style.display = 'block';
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
  1014
              $('avatar_upload_http').object.style.display = 'none';
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
  1015
              $('avatar_upload_file').object.style.display = 'none';
328
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1016
              break;
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1017
          }
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1018
        }
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1019
      
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1020
      </script>
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1021
      <?php
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1022
      
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1023
      echo '<form action="' . makeUrl($paths->fullpage) . '" method="post" enctype="multipart/form-data">';
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1024
      echo '<div class="tblholder">';
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1025
      echo '<table border="0" cellspacing="1" cellpadding="4">';
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1026
      echo '<tr>
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1027
              <th colspan="2">
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1028
                ' . $lang->get('usercp_avatar_table_title') . '
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1029
              </th>
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1030
            </tr>';
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1031
            
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1032
      echo '<tr>
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1033
              <td class="row2" style="width: 50%;">
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1034
                ' . $lang->get('usercp_avatar_label_current') . '
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1035
              </td>
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1036
              <td class="row1" style="text-align: center;">';
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1037
              
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1038
      if ( $has_avi == 1 )
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1039
      {
621
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
  1040
        echo '<img alt="' . $lang->get('usercp_avatar_image_alt', array('username' => $session->username)) . '" src="' . make_avatar_url($session->user_id, $avi_type, $session->email) . '" />';
328
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1041
      }
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1042
      else
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1043
      {
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1044
        echo $lang->get('usercp_avatar_image_none');
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1045
      }
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1046
      
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1047
      echo '    </td>
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1048
              </tr>';
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1049
              
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1050
      echo '  <tr>
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1051
                <td class="row2">
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1052
                  ' . $lang->get('usercp_avatar_lbl_change') . '
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1053
                </td>
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1054
                <td class="row1">
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1055
                  <label><input type="radio" name="avatar_action" value="keep" onclick="avatar_select_field(this);" checked="checked" /> ' . $lang->get('usercp_avatar_lbl_keep') . '</label><br />
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1056
                  <label><input type="radio" name="avatar_action" value="remove" onclick="avatar_select_field(this);" /> ' . $lang->get('usercp_avatar_lbl_remove') . '</label><br />';
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1057
      if ( getConfig('avatar_upload_http') == '1' )
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1058
      {
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1059
        echo '    <label><input type="radio" name="avatar_action" value="set_http" onclick="avatar_select_field(this);" /> ' . $lang->get('usercp_avatar_lbl_set_http') . '</label><br />
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1060
                  <div id="avatar_upload_http" style="display: none; margin: 10px 0 0 2.2em;">
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1061
                    ' . $lang->get('usercp_avatar_lbl_url') . ' <input type="text" name="avatar_http_url" size="40" value="http://" /><br />
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1062
                    <small>' . $lang->get('usercp_avatar_lbl_url_desc') . ' ' . $lang->get('usercp_avatar_limits') . '</small>
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1063
                  </div>';
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1064
      }
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1065
      else
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1066
      {
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1067
        echo '    <div id="avatar_upload_http" style="display: none;"></div>';
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1068
      }
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1069
      if ( getConfig('avatar_upload_file') == '1' )
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1070
      {
621
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
  1071
        echo '    <label><input type="radio" name="avatar_action" value="set_file" onclick="avatar_select_field(this);" /> ' . $lang->get('usercp_avatar_lbl_set_file') . '</label><br />
328
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1072
                  <div id="avatar_upload_file" style="display: none; margin: 10px 0 0 2.2em;">
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1073
                    ' . $lang->get('usercp_avatar_lbl_file') . ' <input type="file" name="avatar_file" size="40" /><br />
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1074
                    <small>' . $lang->get('usercp_avatar_lbl_file_desc') . ' ' . $lang->get('usercp_avatar_limits') . '</small>
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1075
                  </div>';
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1076
      }
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1077
      else
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1078
      {
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1079
        echo '    <div id="avatar_upload_file" style="display: none;"></div>';
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1080
      }
621
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
  1081
      if ( getConfig('avatar_upload_gravatar') == '1' )
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
  1082
      {
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
  1083
        $rating_images = array('g' => '0', 'pg' => '1', 'r' => '2', 'x' => '3');
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
  1084
        $rating_id = $rating_images[ getConfig('gravatar_rating', 'g') ];
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
  1085
        $rating_image = "http://s.gravatar.com/images/gravatars/ratings/$rating_id.gif";
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
  1086
        $max_rating = getConfig('gravatar_rating', 'g');
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
  1087
        echo '    <label><input type="radio" name="avatar_action" value="set_gravatar" onclick="avatar_select_field(this);" /> ' . $lang->get('usercp_avatar_lbl_set_gravatar') . ' <img alt=" " src="' . make_gravatar_url($session->email, 16) . '" /></label> (<a href="http://www.gravatar.com/" onclick="window.open(this); return false;">' . $lang->get('usercp_avatar_link_gravatar_info') . '</a>)
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
  1088
                  <div id="avatar_upload_gravatar" style="display: none; margin: 10px 0 0 2.2em;">
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
  1089
                    <div style="float: left; margin-right: 5px; margin-bottom: 20px;">
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
  1090
                      <img alt=" " src="' . $rating_image . '" />
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
  1091
                    </div>
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
  1092
                    ' . $lang->get("usercp_avatar_gravatar_rating_$max_rating") . '
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
  1093
                  </div>';
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
  1094
      }
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
  1095
      else
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
  1096
      {
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
  1097
        echo '    <div id="avatar_upload_gravatar" style="display: none;"></div>';
68f8a9cc0a18 Added Gravatar support! And it's really configurable too.
Dan
parents: 591
diff changeset
  1098
      }
328
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1099
      echo '    </td>
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1100
              </tr>';
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1101
              
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1102
      echo '  <tr>
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1103
                <th class="subhead" colspan="2">
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1104
                  <input type="submit" name="submit" value="' . $lang->get('etc_save_changes') . '" />
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1105
                </th>
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1106
              </tr>';
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1107
              
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1108
      echo '</table>
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1109
            </div>';
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1110
      
dc838fd61a06 Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents: 322
diff changeset
  1111
      break;
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1112
    default:
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1113
      $good = false;
893
b24601274cd2 SpecialUserPrefs: fixed: userprefs_body hook only allowed first loaded plugin to work
Dan
parents: 836
diff changeset
  1114
      $code = $plugins->setHook('userprefs_body', true);
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1115
      foreach ( $code as $cmd )
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1116
      {
315
f49e3c8b638c Fixed focus of AJAX login form fields in IE; removed stale/unused call to $template->makeParserText() in paginate_array(); added hook page_create_request to possibly help control creation of pages of certain namespaces from plugins; fixed critical bug in user CP that prevented plugins from adding custom CP modules
Dan
parents: 286
diff changeset
  1117
        if ( eval($cmd) )
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1118
          $good = true;
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1119
      }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1120
      if ( !$good )
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1121
      {
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1122
        echo '<h3>Invalid module</h3>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1123
              <p>Userprefs module "'.$section.'" not found.</p>';
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1124
      }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1125
      break;
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1126
  }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1127
  
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1128
  $template->footer();
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1129
}
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1130
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1131
?>