Zikula_Core
[ class tree: Zikula_Core ] [ index: Zikula_Core ] [ all elements ]

Source for file oldfuncs.php

Documentation is available at oldfuncs.php

  1. <?php
  2. /**
  3.  * Zikula Application Framework
  4.  *
  5.  * @copyright (c) 2001, Zikula Development Team
  6.  * @link http://www.zikula.org
  7.  * @version $Id: oldfuncs.php 24342 2008-06-06 12:03:14Z markwest $
  8.  * @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
  9.  * @package Zikula_Core
  10.  * @subpackage Zikula_legacy
  11.  */
  12.  
  13. /**
  14.  * Is user site admin
  15.  */
  16. function is_admin()
  17. {
  18.     return SecurityUtil::checkPermission('::''::'ACCESS_ADMIN);
  19. }
  20.  
  21. /**
  22.  * Is user logged in
  23.  */
  24. function is_user()
  25. {
  26.     return pnUserLoggedIn();
  27. }
  28.  
  29. /**
  30.  * Get user variables
  31.  */
  32. function cookiedecode()
  33. {
  34.     if (!pnUserLoggedIn()) {
  35.         return;
  36.     }
  37.  
  38.     global $cookie;
  39.     $cookie array(pnUserGetVar('uid'),
  40.         pnUserGetVar('uname'),
  41.         pnUserGetVar('pass'),
  42.         pnUserGetVar('storynum'),
  43.         pnUserGetVar('umode'),
  44.         pnUserGetVar('uorder'),
  45.         pnUserGetVar('thold'),
  46.         pnUserGetVar('noscore'),
  47.         pnUserGetVar('ublockon'),
  48.         pnUserGetVar('theme'),
  49.         pnUserGetVar('commentmax'));
  50.  
  51.     return $cookie;
  52. }
  53.  
  54. // Needed for some old modules
  55. global $user;
  56. if (pnUserLoggedIn()) {
  57.     $user pnUserGetVar('uid');
  58. else {
  59.     $user '';
  60. }
  61. // More needed for some old modules
  62. global $prefix;
  63. $prefix pnConfigGetVar('prefix');
  64.  
  65. // Yet another one needed for older modules
  66. include('includes/legacy/textsanitizer.php');
  67.  
  68. /**
  69.  * Get full user info
  70.  * The depreciated parameter was never used in the previous version of this function
  71.  */
  72. function getusrinfo($_depreciated)
  73. {
  74.     global $userinfo;
  75.  
  76.     $vars pnUserGetVars(pnUserGetVar('uid'));
  77.  
  78.     // A map of keys we want in the result to keys we get from the API.
  79.     $keys array('uid' => 'uid''name' => '_UREALNAME''uname' => 'uname''email' => 'email''femail' => '_UFAKEMAIL',
  80.                   'url' => '_YOURHOMEPAGE''user_avatar' => '_YOURAVATAR''user_icq' => '_YICQ''user_occ' => '_YOCCUPATION''user_from' => '_YLOCATION',
  81.                   'user_intrest' => '_YINTERESTS''user_sig' => '_SIGNATURE''user_viewemail' => 'user_viewemail''user_theme' => 'theme',
  82.                   'user_aim' => '_YAIM''user_yim' => '_YYIM''user_msnm' => '_YMSNM''pass' => 'pass''storynum' => 'storynum',
  83.                   'umode' => 'umode''uorder' => 'uorder''thold' => 'thold''noscore' => 'noscore''bio' => 'bio',
  84.                   'ublockon' => 'ublockon''ublock' => 'ublock''theme' => 'user_theme''commentmax' => 'commentmax''timezone_offset' => 'timezone_offset');
  85.  
  86.     $userinfo array();
  87.     foreach ($keys as $key => $val{
  88.         if (isset($vars[$val])) {
  89.             $userinfo[$key$vars[$val];
  90.         else {
  91.             // Set some sensible defaults for values that don't exist anymore...
  92.             switch ($val{
  93.                 case 'uorder':
  94.                 case 'thold':
  95.                 case 'noscore':
  96.                   $userinfo[$key0;
  97.                   break;
  98.                 case 'commentmax':
  99.                   $userinfo[$key4096;
  100.                   break;
  101.                 default:
  102.                   $userinfo[$key'';
  103.             }
  104.         }
  105.     }
  106.  
  107.     return $userinfo;
  108. }

Documentation generated on Fri, 18 Jul 2008 21:48:00 +0200 by phpDocumentor 1.4.1