当前位置: 首页>>代码示例>>PHP>>正文


PHP UserUtil::getVars方法代码示例

本文整理汇总了PHP中UserUtil::getVars方法的典型用法代码示例。如果您正苦于以下问题:PHP UserUtil::getVars方法的具体用法?PHP UserUtil::getVars怎么用?PHP UserUtil::getVars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserUtil的用法示例。


在下文中一共展示了UserUtil::getVars方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: main

    /**
     * Show a form for some user configurable parameters
     * @author Albert Pérez Monfort (aperezm@xtec.cat)
     * @return: Show the form with the configurable parameters
     */
    public function main() {
        // Security check
        if (!SecurityUtil::checkPermission('IWmain::', "::", ACCESS_READ) || !UserUtil::isLoggedIn()) {
            throw new Zikula_Exception_Forbidden();
        }
        $uid = UserUtil::getVar('uid');
        $crAc_UserReports =$this->getVar('crAc_UserReports');
        $everybodySubscribed = $this->getVar('everybodySubscribed');
        
        $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
        $blockFlaggedDetails = ModUtil::apiFunc('IWmain', 'user', 'userVarExists', array('name' => 'blockFlaggedDetails',
                    'module' => 'IWmain_block_news',
                    'uid' => $uid,
                    'sv' => $sv));

        //get the headlines saved in the user vars. It is renovate every 10 minutes
        $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
        $subscribeNews = ModUtil::apiFunc('IWmain', 'user', 'userVarExists', array('name' => 'subscribeNews',
                    'module' => 'IWmain_cron',
                    'uid' => $uid,
                    'sv' => $sv));

        //get user mail
        $userInfo = UserUtil::getVars($uid);
        $userMail = $userInfo['email'];
        return $this->view->assign('cronNotWorks', $cronNotWorks)
                        ->assign('blockFlaggedDetails', $blockFlaggedDetails)
                        ->assign('subscribeNews', $subscribeNews)
                        ->assign('userMail', $userMail)
                        ->assign('everybodySubscribed', $everybodySubscribed)
                        ->assign('crAc_UserReports', $crAc_UserReports)
                        ->fetch('IWmain_user_main.tpl');
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:38,代码来源:User.php

示例2: getResponse

 public function getResponse(Request $request)
 {
     $admin = \UserUtil::getVars(2);
     if ($this->sendEmailToAdmin($request, $admin)) {
         $request->getSession()->getFlashBag()->add('success', __('Congratulations! Zikula has been successfully installed.'));
         return new RedirectResponse($this->container->get('router')->generate('zikulaadminmodule_admin_adminpanel', array(), RouterInterface::ABSOLUTE_URL));
     } else {
         $request->getSession()->getFlashBag()->add('warning', __('Email settings are not yet configured. Please configure them below.'));
         return new RedirectResponse($this->container->get('router')->generate('zikulamailermodule_admin_modifyconfig', array(), RouterInterface::ABSOLUTE_URL));
     }
 }
开发者ID:rmaiwald,项目名称:core,代码行数:11,代码来源:CompleteStage.php

示例3: phpBBupdateAccountById

 /**
  * Update phpBB user account from Zikula account by given Id
  * @return boolean
  */
 public static function phpBBupdateAccountById($user_id)
 {
     $dom = ZLanguage::getModuleDomain('ZphpBB2');
     $userObj = UserUtil::getVars($user_id);
     if ($userObj) {
         $class = 'ZphpBB2_Listener_UsersSynch';
         if (!class_exists($class)) {
             include_once 'modules/ZphpBB2/lib/ZphpBB2/Listener/UsersSynch.php';
         }
         return ZphpBB2_Listener_UsersSynch::updateAccount($userObj);
     } else {
         return LogUtil::registerError(__('Error: Could not obtain user information, Id ' . $user_id, $dom));
     }
 }
开发者ID:nmpetkov,项目名称:ZphpBB2,代码行数:18,代码来源:Util.php

示例4: addContact

    public function addContact($args) {

        if (!SecurityUtil::checkPermission('IWusers::', '::', ACCESS_READ)) {
            throw new Zikula_Exception_Forbidden();
        }
        $gid = FormUtil::getPassedValue('gid', -2, 'GET');
        if ($gid == -2) {
            AjaxUtil::error('no group id');
        }
        $fuid = FormUtil::getPassedValue('fuid', -1, 'GET');
        if ($fuid == -1) {
            AjaxUtil::error('no user id');
        }
        $action = FormUtil::getPassedValue('action', -1, 'GET');
        if ($action == -1) {
            AjaxUtil::error('no action defined');
        }
        $view = Zikula_View::getInstance('IWusers', false);
        if ($action == 'add') {
            if (!ModUtil::apiFunc('IWusers', 'user', 'addContant', array('fuid' => $fuid))) {
                AjaxUtil::error('error');
            }
            $view->assign('add', true);
        }
        if ($action == 'delete') {
            if (!ModUtil::apiFunc('IWusers', 'user', 'deleteContant', array('fuid' => $fuid))) {
                AjaxUtil::error('error');
            }
            $view->assign('add', false);
        }
        $view->assign('fuid', $fuid);
        $view->assign('gid', $gid);
        $vars = UserUtil::getVars($fuid);
        $view->assign('uname', $vars['uname']);
        $content = $view->fetch('IWusers_user_members_optionsContent.htm');
        AjaxUtil::output(array('fuid' => $fuid,
            'content' => $content,
            'gid' => $gid));
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:39,代码来源:Ajax.php

示例5: online_offline_status

    //
    // Again this will be handled by the templating
    // code at some point
    //
    // Begin PNphpBB2 Module
    //	$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
    //	$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
    $row_color = !($i % 2) ? $phpbb_theme['td_color1'] : $phpbb_theme['td_color2'];
    $row_class = !($i % 2) ? $phpbb_theme['td_class1'] : $phpbb_theme['td_class2'];
    // End PNphpBB2 Module
    // Begin PNphpBB2 Module (Online/Offline user status)
    $status = online_offline_status($postrow[$i], in_array($postrow[$i]['user_id'], $forum_mods));
    // End PNphpBB2 Module (Online/Offline user status)
    // RNG
    if ($poster_id) {
        $userVars = UserUtil::getVars($poster_id);
        $location = $userVars['_YLOCATION'];
    }
    // RNG End
    $template->assign_block_vars('postrow', array('POSTER_STATUS' => $status['text'], 'POSTER_STATUS_IMG' => $status['image'], 'ROW_COLOR' => '#' . $row_color, 'ROW_CLASS' => $row_class, 'POSTER_NAME' => $poster_profile, 'POSTER_RANK' => $poster_rank, 'RANK_IMAGE' => $rank_image, 'POSTER_FIRSTLASTNAMES' => $poster_firstlastnames, 'POSTER_JOINED' => $poster_joined, 'POSTER_POSTS' => $poster_posts, 'POSTER_FROM' => $poster_from, 'POSTER_AVATAR' => $poster_avatar, 'POST_DATE' => $post_date, 'POST_SUBJECT' => $post_subject, 'MESSAGE' => $message, 'SIGNATURE' => $user_sig, 'EDITED_MESSAGE' => $l_edited_by, 'MINI_POST_IMG' => $mini_post_img, 'PROFILE_IMG' => $profile_img, 'PROFILE' => $profile, 'SEARCH_IMG' => $search_img, 'SEARCH' => $search, 'PM_IMG' => $pm_img, 'PM' => $pm, 'EMAIL_IMG' => $email_img, 'EMAIL' => $email, 'WWW_IMG' => $www_img, 'WWW' => $www, 'ICQ_STATUS_IMG' => $icq_status_img, 'ICQ_IMG' => $icq_img, 'ICQ' => $icq, 'AIM_IMG' => $aim_img, 'AIM' => $aim, 'MSN_IMG' => $msn_img, 'MSN' => $msn, 'YIM_IMG' => $yim_img, 'YIM' => $yim, 'EDIT_IMG' => $edit_img, 'EDIT' => $edit, 'QUOTE_IMG' => $quote_img, 'QUOTE' => $quote, 'IP_IMG' => $ip_img, 'IP' => $ip, 'DELETE_IMG' => $delpost_img, 'ICON_UP' => $images['icon_up'], 'DELETE' => $delpost, 'L_MINI_POST_ALT' => $mini_post_alt, 'U_MINI_POST' => $mini_post_url, 'U_POST_ID' => $postrow[$i]['post_id'], 'LOCATION' => $location));
    // Begin PNphpBB2 Module
    if ($postrow[$i]['post_icon'] > 0) {
        $template->assign_block_vars('postrow.posticon', array('ICON' => "<img " . $board_config['posticons_size'] . " src=\"" . $board_config['path_posticons'] . "/image_" . $postrow[$i]['post_icon'] . ".gif\" alt=\"" . $postrow[$i]['post_icon'] . "\" border=\"0\">"));
    }
    // End PNphpBB2 Module
    /* -- mod : File Attachment Mod v2 Version 2.4.3 ---------------------------------------------------- */
    if (!intval($attach_config['disable_mod'])) {
        display_post_attachments($postrow[$i]['post_id'], $postrow[$i]['post_attachment']);
    }
    /* -- fin : File Attachment Mod v2 Version 2.4.3 ---------------------------------------------------- */
}
开发者ID:nmpetkov,项目名称:ZphpBB2,代码行数:31,代码来源:viewtopic.php

示例6: deleteUsers

    /**
     * Display a form to confirm the deletion of one user, and then process the deletion.
     *
     * Parameters passed via GET:
     * --------------------------
     * numeric userid The user id of the user to be deleted.
     * string  uname  The user name of the user to be deleted.
     *
     * Parameters passed via POST:
     * ---------------------------
     * array   userid         The array of user ids of the users to be deleted.
     * boolean process_delete True to process the posted userid list, and delete the corresponding accounts; false or null to confirm first.
     *
     * Parameters passed via SESSION:
     * ------------------------------
     * None.
     *
     * @return string HTML string containing the rendered template.
     *
     * @throws Zikula_Exception_Forbidden Thrown if the current user does not have delete access, or if the method of accessing this function is improper.
     */
        
    public function deleteUsers()
    {
        // check permissions
        $this->throwForbiddenUnless(SecurityUtil::checkPermission('IWusers::', '::', ACCESS_DELETE));

        $proceedToForm = false;
        $processDelete = false;

        if ($this->request->isPost()) {
            $userid = $this->request->request->get('userId', null);
            $processDelete = $this->request->request->get('process_delete', false);            
            $proceedToForm = !$processDelete;            
        } elseif ($this->request->isGet()) {
            $userid = $this->request->query->get('uid', null);
            $uname  = $this->request->query->get('uname', null);

            // retreive userid from uname
            if (empty($userid) && !empty($uname)) {
                $userid = UserUtil::getIdFromName($users);
            }

            $proceedToForm = true;
        } else {
            throw new Zikula_Exception_Forbidden();
        }

        if (empty($userid)) {            
            $this->registerError($this->__('No users have chosen'));
            $proceedToForm = false;
            $userid = array();
        } elseif (!is_array($userid)) {
            $userid = array($userid);
        } 
                    
        $currentUser = UserUtil::getVar('uid');
        $users = array();  
        foreach ($userid as $key => $uid) {
            if ($uid == 1) {
                $this->registerError($this->__("Error! You can't delete the guest account."));
                $proceedToForm = false;
                $processDelete = false;
            } elseif ($uid == 2) {
                $this->registerError($this->__("Error! You can't delete the primary administrator account."));
                $proceedToForm = false;
                $processDelete = false;
            } elseif ($uid == $currentUser) {
                $this->registerError($this->__("Error! You can't delete the account you are currently logged into."));
                $proceedToForm = false;
                $processDelete = false;
            }

            // get the user vars
            $users[$key] = UserUtil::getVars($uid);

            if (empty($users[$key])) {
                $this->registerError($this->__('Sorry! No such user found.'));
                $proceedToForm = false;
                $processDelete = false;
            }
        }

        if ($processDelete) {      
            $this->checkCsrfToken();
            $valid = true;
            foreach ($userid as $uid) {
                $event = new Zikula_Event('module.users.ui.validate_delete', null, array('id' => $uid), new Zikula_Hook_ValidationProviders());
                $validators = $this->eventManager->notify($event)->getData();

                $hook = new Zikula_ValidationHook('users.ui_hooks.user.validate_delete', $validators);
                $this->notifyHooks($hook);
                $validators = $hook->getValidators();

                if ($validators->hasErrors()) {
                    $valid = false;
                }
            }

            $proceedToForm = false;
//.........这里部分代码省略.........
开发者ID:projectesIF,项目名称:Sirius,代码行数:101,代码来源:Admin.php

示例7: add_core_data

 /**
  * Add core data to the template.
  *
  * This function adds some basic data to the template depending on the
  * current user and the Zikula settings.  There is no need to call this as it's
  * invoked automatically on instanciation.
  *
  * In legacy mode 'coredata' will contain the module vars, but not when disabled.
  * This is just for BC legacy - to access module vars there is a 'modvars' property
  * assigned to all templates.
  *
  * @return Zikula_View
  */
 public function add_core_data()
 {
     if (!isset($this->serviceManager['zikula_view.coredata'])) {
         $this->serviceManager['zikula_view.coredata'] = new ArrayObject(array());
     }
     $core = $this->serviceManager['zikula_view.coredata'];
     $core['version_num'] = Zikula_Core::VERSION_NUM;
     $core['version_id'] = Zikula_Core::VERSION_ID;
     $core['version_sub'] = Zikula_Core::VERSION_SUB;
     $core['logged_in'] = UserUtil::isLoggedIn();
     $core['language'] = $this->language;
     // add userdata
     $core['user'] = UserUtil::getVars(SessionUtil::getVar('uid'));
     if (System::isLegacyMode()) {
         // add modvars of current modules
         foreach ($this->module as $module => $dummy) {
             if (!empty($module)) {
                 $core[$module] = ModUtil::getVar($module);
             }
         }
         // add mod vars of all modules supplied as parameter
         $modulenames = func_get_args();
         foreach ($modulenames as $modulename) {
             // if the modulename is empty do nothing
             if (!empty($modulename) && !is_array($modulename) && !array_key_exists($modulename, $this->module)) {
                 // check if user wants to have config
                 if ($modulename == ModUtil::CONFIG_MODULE) {
                     $ZConfig = ModUtil::getVar(ModUtil::CONFIG_MODULE);
                     foreach ($ZConfig as $key => $value) {
                         // gather all config vars
                         $core['ZConfig'][$key] = $value;
                     }
                 } else {
                     $core[$modulename] = ModUtil::getVar($modulename);
                 }
             }
         }
         $this->assign('pncore', $core);
     }
     // Module vars
     parent::assign('coredata', $core);
     return $this;
 }
开发者ID:Silwereth,项目名称:core,代码行数:56,代码来源:View.php

示例8: toggleForcedPasswordChange

    /**
     * Sets or resets a user's need to changed his password on his next attempt at logging ing.
     *
     * Parameters passed via GET:
     * --------------------------
     * numeric userid The uid of the user for whom a change of password should be forced (or canceled).
     *
     * Parameters passed via POST:
     * ---------------------------
     * numeric userid                    The uid of the user for whom a change of password should be forced (or canceled).
     * boolean user_must_change_password True to force the user to change his password at his next log-in attempt, otherwise false.
     *
     * Parameters passed via SESSION:
     * ------------------------------
     * None.
     *
     * @return string The rendered output from either the template for confirmation.
     *
     * @throws Zikula_Exception_Fatal Thrown if a user id is not specified, is invalid, or does not point to a valid account record,
     *                                      or the account record is not in a consistent state.
     * @throws Zikula_Exception_Forbidden Thrown if the current user does not have edit access for the account record.
     */
    public function toggleForcedPasswordChange()
    {
        if ($this->request->isGet()) {
            $uid = $this->request->query->get('userid', false);

            if (!$uid || !is_numeric($uid) || ((int)$uid != $uid)) {
                throw new Zikula_Exception_Fatal(LogUtil::getErrorMsgArgs());
            }

            $userObj = UserUtil::getVars($uid);

            if (!isset($userObj) || !$userObj || !is_array($userObj) || empty($userObj)) {
                throw new Zikula_Exception_Fatal(LogUtil::getErrorMsgArgs());
            }

            if (!SecurityUtil::checkPermission('Users::', "{$userObj['uname']}::{$uid}", ACCESS_EDIT)) {
                throw new Zikula_Exception_Forbidden();
            }

            $userMustChangePassword = UserUtil::getVar('_Users_mustChangePassword', $uid, false);

            return $this->view->assign('user_obj', $userObj)
                ->assign('user_must_change_password', $userMustChangePassword)
                ->fetch('users_admin_toggleforcedpasswordchange.tpl');
        } elseif ($this->request->isPost()) {
            $this->checkCsrfToken();

            $uid = $this->request->request->get('userid', false);
            $userMustChangePassword = $this->request->request->get('user_must_change_password', false);

            if (!$uid || !is_numeric($uid) || ((int)$uid != $uid)) {
                throw new Zikula_Exception_Fatal(LogUtil::getErrorMsgArgs());
            }

            // Force reload of User object into cache.
            $userObj = UserUtil::getVars($uid);

            if (!SecurityUtil::checkPermission('Users::', "{$userObj['uname']}::{$uid}", ACCESS_EDIT)) {
                throw new Zikula_Exception_Forbidden();
            }

            if ($userMustChangePassword) {
                UserUtil::setVar('_Users_mustChangePassword', $userMustChangePassword, $uid);
            } else {
                UserUtil::delVar('_Users_mustChangePassword', $uid);
            }

            // Force reload of User object into cache.
            $userObj = UserUtil::getVars($uid, true);

            if ($userMustChangePassword) {
                if (isset($userObj['__ATTRIBUTES__']) && isset($userObj['__ATTRIBUTES__']['_Users_mustChangePassword'])) {
                    $this->registerStatus($this->__f('Done! A password change will be required the next time %1$s logs in.', array($userObj['uname'])));
                } else {
                    throw new Zikula_Exception_Fatal();
                }
            } else {
                if (isset($userObj['__ATTRIBUTES__']) && isset($userObj['__ATTRIBUTES__']['_Users_mustChangePassword'])) {
                    throw new Zikula_Exception_Fatal();
                } else {
                    $this->registerStatus($this->__f('Done! A password change will no longer be required for %1$s.', array($userObj['uname'])));
                }
            }

            $this->redirect(ModUtil::url($this->name, 'admin', 'view'));
        } else {
            throw new Zikula_Exception_Forbidden();
        }
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:91,代码来源:Admin.php

示例9: memberslist

    /**
     * display the membership of a group
     *
     */
    public function memberslist()
    {
        $gid = (int)FormUtil::getPassedValue('gid', null, 'GET');
        $startnum = (int)FormUtil::getPassedValue('startnum', 1, 'GET');

        if (!is_numeric($startnum)) {
            return LogUtil::registerArgsError();
        }

        $itemsperpage = $this->getVar('itemsperpage');

        $this->throwForbiddenUnless(SecurityUtil::checkPermission('Groups::memberslist', '::', ACCESS_OVERVIEW));

        $group = ModUtil::apiFunc('Groups', 'user', 'get', array('gid'      => $gid,
                'numitems' => $itemsperpage,
                'startnum' => $startnum));

        if (!$group) {
            return DataUtil::formatForDisplay($this->__('Error! Could not load data.'));
        }

        $uid = UserUtil::getVar('uid');

        $typelabel  = array();
        $statelabel = array();

        $groupsCommon = new Groups_Helper_Common();
        $typelabel = $groupsCommon->gtypeLabels();
        $statelabel = $groupsCommon->stateLabels();

        $group['typelbl']  = $typelabel[$group['gtype']];
        $group['statelbl'] = $statelabel[$group['state']];

        $this->view->assign('mainpage', false);

        $this->view->assign('group', $group);

        if ($group['members']) {
            $onlines = ModUtil::apiFunc('Groups', 'user', 'whosonline', array());
            $members = array();
            foreach ($group['members'] as $userid) {
                $userinfo = UserUtil::getVars($userid['uid']);

                $isonline = false;
                if (is_array($onlines)) {
                    foreach ($onlines as $online) {
                        if ($online['uid'] == $userid['uid']) {
                            $isonline = true;
                        }
                    }
                }

                if ($isonline) {
                    $userinfo['isonline']    = 'greenled.png';
                    $userinfo['isonlinelbl'] = $this->__('on-line');
                } else {
                    $userinfo['isonline']     = 'redled.png';
                    $userinfo['isonlinelbl'] = $this->__('off-line');
                }

                $members[] = $userinfo;
            }

            // test of sorting data
            if (!empty($members)) {
                foreach ($members as $res) {
                    $sortAarr[] = strtolower($res['uname']);
                }
                array_multisort($sortAarr, SORT_ASC, $members);
            }
            $this->view->assign('members', $members);
        } else {
            $this->view->assign('members', false);
        }

        if (UserUtil::isLoggedIn()) {
            $this->view->assign('ismember', ModUtil::apiFunc('Groups', 'user', 'isgroupmember', array('gid' => $gid, 'uid' => $uid)));
        } else {
            $this->view->assign('ismember', false);
        }

        $this->view->assign('pager', array('numitems'     => ModUtil::apiFunc('Groups', 'user', 'countgroupmembers', array('gid' => $gid)),
                                           'itemsperpage' => $itemsperpage));

        $profileModule = System::getVar('profilemodule', '');
        $this->view->assign('useProfileModule', (!empty($profileModule) && $profileModule == 'Profile' && ModUtil::available($profileModule)));

        return $this->view->fetch('groups_user_memberslist.tpl');
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:93,代码来源:User.php

示例10: add_core_data

 /**
  * Add core data to the template.
  *
  * This function adds some basic data to the template depending on the
  * current user and the Zikula settings.  There is no need to call this as it's
  * invoked automatically on instanciation.
  *
  * @return Zikula_View
  */
 public function add_core_data()
 {
     if (!isset($this->container['zikula_view.coredata'])) {
         $this->container['zikula_view.coredata'] = new ArrayObject(array());
     }
     $core = $this->container['zikula_view.coredata'];
     $core['version_num'] = \Zikula\Core\Core::VERSION_NUM;
     $core['version_id'] = \Zikula\Core\Core::VERSION_ID;
     $core['version_sub'] = \Zikula\Core\Core::VERSION_SUB;
     $core['logged_in'] = UserUtil::isLoggedIn();
     $core['language'] = $this->language;
     // add userdata
     $core['user'] = UserUtil::getVars($this->request->getSession()->get('uid'));
     // Module vars
     parent::assign('coredata', $core);
     return $this;
 }
开发者ID:rtznprmpftl,项目名称:Zikulacore,代码行数:26,代码来源:View.php

示例11: display

    /**
     * Display the block.
     *
     * @param array $blockinfo A blockinfo structure.
     * 
     * @return string The rendered block.
     */
    public function display($blockinfo)
    {
        // Check if the Profile module is available.
        if (!ModUtil::available('Profile')) {
            return false;
        }

        // Security check
        if (!SecurityUtil::checkPermission('Profile:FeaturedUserblock:', "$blockinfo[bid]::", ACCESS_READ)) {
            return false;
        }

        // Get variables from content block
        $vars = BlockUtil::varsFromContent($blockinfo['content']);

        // If there's no user to show, nothing to do
        if (!isset($vars['username']) || empty($vars['username'])) {
            return false;
        }

        // Defaults
        if (!isset($vars['fieldstoshow']) || !is_array($vars['fieldstoshow']) || empty($vars['fieldstoshow'])) {
            $vars['fieldstoshow'] = array();
        }

        if (!isset($vars['showregdate']) || empty($vars['showregdate'])) {
            $vars['showregdate'] = '';
        }

        $userinfo = UserUtil::getVars(UserUtil::getIdFromName($vars['username']));

        // Check if the user is watching its own profile or if he is admin
        $currentuser = UserUtil::getVar('uid');
        $ismember    = ($currentuser >= 2);
        $sameuser    = ($currentuser == $userinfo['uid']);

        $isadmin     = false;
        if (SecurityUtil::checkPermission('Profile::', '::', ACCESS_ADMIN)) {
            $isadmin = true;
        }

        // get all active profile fields
        $activeduds = ModUtil::apiFunc('Profile', 'user', 'getallactive', array('index' => 'prop_label'));

        foreach ($activeduds as $dudlabel => $activedud) {
            // check if the attribute is set to be shown in the block
            if (!in_array($activedud['prop_attribute_name'], $vars['fieldstoshow'])) {
                continue;
            }

            // discard empty fields
            if (empty($userinfo['__ATTRIBUTES__'][$activedud['prop_attribute_name']])) {
                continue;
            }

            // check the access to this field
            if ($activedud['prop_viewby'] != 0) {
                // not to everyone, checks members only or higher
                if (!($activedud['prop_viewby'] == 1 && $ismember)) {
                    // lastly check for the same user or admin
                    if (!($activedud['prop_viewby'] == 2 && ($sameuser || $isadmin))) {
                        continue;
                    }
                }
            }

            // add it to the viewable properties
            $dudarray[$dudlabel] = $userinfo['__ATTRIBUTES__'][$activedud['prop_attribute_name']];
        }
        unset($activeduds);

        // build the output
        $this->view->setCacheId('featured'.$vars['username']);

        $this->view->assign('userinfo',    $userinfo);
        $this->view->assign('showregdate', $vars['showregdate']);
        $this->view->assign('dudarray',    $dudarray);

        $blockinfo['content'] = $this->view->fetch('profile_block_featureduser.tpl');

        return BlockUtil::themeBlock($blockinfo);
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:89,代码来源:Featureduser.php

示例12: checkConfirmationCode

    /**
     * Check a lost password confirmation code.
     *
     * Parameters passed in the $args array:
     * -------------------------------------
     * string $args['idfield'] Either 'uname' or 'email'.
     * string $args['id']      The user's user name or e-mail address, depending on the value of idfield.
     * string $args['code']    The confirmation code.
     *
     * @param array $args All parameters passed to this function.
     *
     * @return bool True if the new password was sent; otherwise false.
     */
    public function checkConfirmationCode($args)
    {
        $codeIsGood = false;

        if (!isset($args['id']) || empty($args['id']) || !isset($args['idfield']) || empty($args['idfield']) || !isset($args['code'])
                || empty($args['code']) || (($args['idfield'] != 'uname') && ($args['idfield'] != 'email'))) {
            $this->registerError(LogUtil::getErrorMsgArgs());

            return false;
        }

        $user = UserUtil::getVars($args['id'], true, $args['idfield']);

        if (!$user) {
            $this->registerError(LogUtil::getErrorMsgArgs());

            return false;
        } else {
            // delete all the records for password reset confirmation that have expired
            $tables = DBUtil::getTables();
            $verifychgColumn = $tables['users_verifychg_column'];
            $chgPassExpireDays = $this->getVar(Users_Constant::MODVAR_EXPIRE_DAYS_CHANGE_PASSWORD, Users_Constant::DEFAULT_EXPIRE_DAYS_CHANGE_PASSWORD);
            if ($chgPassExpireDays > 0) {
                $staleRecordUTC = new DateTime(null, new DateTimeZone('UTC'));
                $staleRecordUTC->modify("-{$chgPassExpireDays} days");
                $staleRecordUTCStr = $staleRecordUTC->format(Users_Constant::DATETIME_FORMAT);
                $where = "({$verifychgColumn['created_dt']} < '{$staleRecordUTCStr}') AND ({$verifychgColumn['changetype']} = " . Users_Constant::VERIFYCHGTYPE_PWD . ")";
                DBUtil::deleteWhere ('users_verifychg', $where);
            }
            $verifychgObj = DBUtil::selectObject('users_verifychg',
                "({$verifychgColumn['uid']} = {$user['uid']}) AND ({$verifychgColumn['changetype']} = " . Users_Constant::VERIFYCHGTYPE_PWD . ")");
            if ($verifychgObj) {
                $codeIsGood = UserUtil::passwordsMatch($args['code'], $verifychgObj['verifycode']);
            } else {
                $this->registerError('Sorry! Could not retrieve a confirmation code for that account.');
            }
        }

        return $codeIsGood;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:53,代码来源:User.php

示例13: getAccountRecoveryInfoForUid

    /**
     * Retrieve the account recovery information for the specified user.
     *
     * The array returned by this function should be an empty array (not null) if the specified user does not have any
     * authentication methods registered with the authentication module that are enabled for log-in.
     *
     * If the specified user does have one or more authentication methods, then the array should contain one or more elements
     * indexed numerically. Each element should be an associative array containing the following:
     *
     * - 'modname' The authentication module name.
     * - 'short_description' A brief (a few words) description or name of the authentication method.
     * - 'long_description' A longer description or name of the authentication method.
     * - 'uname' The user name _equivalent_ for the authentication method (e.g., the claimed OpenID).
     * - 'link' If the authentication method is for an external service, then a link to the user's account on that service, or a general link to the service,
     *            otherwise, an empty string (not null).
     *
     * For example:
     *
     * <code>
     * $accountRecoveryInfo[] = array(
     *     'modname'           => $this->name,
     *     'short_description' => $this->__('E-mail Address'),
     *     'long_description'  => $this->__('E-mail Address'),
     *     'uname'             => $userObj['email'],
     *     'link'              => '',
     * )
     * </code>
     *
     * Parameters passed in the $arg array:
     * ------------------------------------
     * numeric 'uid' The user id of the user for which account recovery information should be retrieved.
     *
     * @param array $args All parameters passed to this function.
     *
     * @return An array of account recovery information.
     *
     * @throws Zikula_Exception_Fatal Thrown if an invalid arguments array or an invalid user id is received by the method.
     */
    public function getAccountRecoveryInfoForUid(array $args)
    {
        if (!isset($args) || empty($args)) {
            throw new Zikula_Exception_Fatal($this->__('An invalid parameter array was received.'));
        }

        $uid = isset($args['uid']) ? $args['uid'] : false;
        if (!isset($uid) || !is_numeric($uid) || ((string)((int)$uid) != $uid)) {
            throw new Zikula_Exception_Fatal($this->__('An invalid user id was received.'));
        }

        $userObj = UserUtil::getVars($uid);

        $lostUserNames = array();
        if ($userObj) {
            if (!empty($userObj['pass']) && ($userObj['pass'] != Users_Constant::PWD_NO_USERS_AUTHENTICATION)) {
                $loginOption = $this->getVar(Users_Constant::MODVAR_LOGIN_METHOD, Users_Constant::DEFAULT_LOGIN_METHOD);

                if (($loginOption == Users_Constant::LOGIN_METHOD_UNAME) || ($loginOption == Users_Constant::LOGIN_METHOD_ANY)) {
                    $lostUserNames[] = array(
                        'modname'           => $this->name,
                        'short_description' => $this->__('User name'),
                        'long_description'  => $this->__('User name'),
                        'uname'             => $userObj['uname'],
                        'link'              => '',
                    );
                }

                if (($loginOption == Users_Constant::LOGIN_METHOD_EMAIL) || ($loginOption == Users_Constant::LOGIN_METHOD_ANY)) {
                    $lostUserNames[] = array(
                        'modname'           => $this->name,
                        'short_description' => $this->__('E-mail Address'),
                        'long_description'  => $this->__('E-mail Address'),
                        'uname'             => $userObj['email'],
                        'link'              => '',
                    );
                }
            }
        }

        return $lostUserNames;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:80,代码来源:Authentication.php

示例14: updatePassword

    /**
     * Update the user's password.
     *
     * Parameters passed via GET:
     * --------------------------
     * None.
     *
     * Parameters passed via POST:
     * ---------------------------
     * string oldpassword        The original password.
     * string newpassword        The new password to be stored for the user.
     * string newpasswordconfirm Verification of the new password to be stored for the user.
     *
     * Parameters passed via SESSION:
     * ------------------------------
     * Namespace: Zikula_Users
     * Variable:  Users_Controller_User_updatePassword
     * Type:      array
     * Contents:  An array containing the information saved from the log-in attempt in order to re-enter it, including:
     *              'authentication_method', an array containing the selected authentication module name and method name,
     *              'authentication_info', an array containing the authentication information entered by the user,
     *              'user_obj', a user record containing the user information found during the log-in attempt,
     *              'password_errors', errors that have occurred during a previous pass through this function.
     *
     * @return bool True on success, otherwise false.
     */
    public function updatePassword()
    {
        $sessionVars = $this->request->getSession()->get('Users_Controller_User_updatePassword', null, 'Zikula_Users');
        $this->request->getSession()->del('Users_Controller_User_updatePassword', 'Zikula_Users');

        if (!$this->request->isPost()) {
            throw new Zikula_Exception_Forbidden();
        }

        $this->checkCsrfToken();

        if (isset($sessionVars) && !empty($sessionVars)) {
            $login = true;
            $userObj = $sessionVars['user_obj'];
        } else {
            $login = false;
            $userObj = UserUtil::getVars(UserUtil::getVar('uid'), true);
        }
        $uid = $userObj['uid'];

        if (!$login && !UserUtil::isLoggedIn()) {
            throw new Zikula_Exception_Forbidden();
        } elseif ($login && UserUtil::isLoggedIn()) {
            throw new Zikula_Exception_Fatal();
        }

        $passwordChanged    = false;
        $currentPassword    = $this->request->request->get('oldpassword', '');
        $newPassword        = $this->request->request->get('newpassword', '');
        $newPasswordAgain   = $this->request->request->get('newpasswordconfirm', '');
        $newPasswordReminder= $this->request->request->get('passreminder', '');
        $passwordErrors     = array();

        if (empty($currentPassword) || !UserUtil::passwordsMatch($currentPassword, $userObj['pass'])) {
            $passwordErrors['oldpass'][] = $this->__('The current password you entered is not correct. Please correct your entry and try again.');
        } else {
            $passwordErrors = ModUtil::apiFunc($this->name, 'registration', 'getPasswordErrors', array(
                'uname'         => $userObj['uname'],
                'pass'          => $newPassword,
                'passagain'     => $newPasswordAgain,
                'passreminder'  => $newPasswordReminder
            ));

            if ($login && ($currentPassword == $newPassword)) {
                $passwordErrors['reginfo_pass'][] = $this->__('Your new password cannot match your current password.');
            }
        }

        if (empty($passwordErrors)) {
            if (UserUtil::setPassword($newPassword, $uid)) {
                // no user.update event for password chagnes.

                $passwordChanged = true;

                // Clear the forced change of password flag, if it exists.
                UserUtil::delVar('_Users_mustChangePassword', $uid);

                if (!UserUtil::setVar('passreminder', $newPasswordReminder, $uid)) {
                    $this->registerError($this->__('Warning! Your new password was saved, however there was a problem saving your new password reminder.'));
                } else {
                    $this->registerStatus($this->__('Done! Saved your new password.'));
                }

                $userObj = UserUtil::getVars(UserUtil::getVar('uid'), true);
                if ($login) {
                    $sessionVars['user_obj'] = $userObj;
                    if ($sessionVars['authentication_method']['modname'] == $this->name) {
                        // The password for Users module authentication was just changed.
                        // In order to successfully log in the user, we need to change it on the authentication_info.
                        $sessionVars['authentication_info']['pass'] = $newPassword;
                    }
                }
            } else {
                throw new Zikula_Exception_Fatal($this->__('Sorry! There was a problem saving your new password.'));
//.........这里部分代码省略.........
开发者ID:projectesIF,项目名称:Sirius,代码行数:101,代码来源:User.php

示例15: whosonline

    /**
     * Return registered users online.
     *
     * @return array Registered users who are online.
     */
    public function whosonline()
    {
        // Get database setup
        $dbtable = DBUtil::getTables();

        // define the array to hold the resultant items
        $items = array();
        // It's good practice to name the table and column definitions you are
        // getting - $table and $column don't cut it in more complex modules
        $sessioninfocolumn = $dbtable['session_info_column'];
        $sessioninfotable  = $dbtable['session_info'];

        // get active time based on security settings
        $activetime = date('Y-m-d H:i:s', time() - (System::getVar('secinactivemins') * 60));

        $where = "WHERE {$sessioninfocolumn['uid']} != 1 AND {$sessioninfocolumn['lastused']} > '{$activetime}' ";
        
        $result = DBUtil::selectObjectArray('session_info', $where, '', -1, -1, '', null, null, array('uid'), true);

        if ($result === false) {
            return LogUtil::registerError($this->__('Error! Could not load data.'));
        }

        foreach ($result as $key => $user) {
            $result[$key] = UserUtil::getVars($user['uid']);
        }

        // Return the items
        return $result;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:35,代码来源:Memberslist.php


注:本文中的UserUtil::getVars方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。