示例#1
0
 function HandleAuthor()
 {
     $db = JFactory::getDBO();
     $mainframe = JFactory::getApplication();
     if (!FSS_Permission::auth("core.edit.state", $this->getAsset())) {
         exit;
     }
     $asset = $this->getAsset();
     $users = SupportUsers::usersWithPerm($asset, "core.edit.own");
     $users2 = SupportUsers::usersWithPerm($asset, "core.edit");
     $uids = array();
     foreach ($users as $uid => $user) {
         $uids[$uid] = (int) $uid;
     }
     foreach ($users2 as $uid => $user) {
         $uids[$uid] = (int) $uid;
     }
     // build query
     $qry = "SELECT * FROM #__users";
     $where = array();
     $where[] = "id IN (" . implode(", ", $uids) . ")";
     $limitstart = FSS_Input::getInt('limitstart', 0);
     $mainframe = JFactory::getApplication();
     $limit = $mainframe->getUserStateFromRequest('users.limit', 'limit', 10, 'int');
     $search = FSS_Input::getString('search', '');
     $db = JFactory::getDBO();
     if ($search != "") {
         $where[] = "(username LIKE '%" . FSSJ3Helper::getEscaped($db, $search) . "%' OR name LIKE '%" . FSSJ3Helper::getEscaped($db, $search) . "%' OR email LIKE '%" . FSSJ3Helper::getEscaped($db, $search) . "%')";
     }
     if (count($where) > 0) {
         $qry .= " WHERE " . implode(" AND ", $where);
     }
     // Sort ordering
     $qry .= " ORDER BY name ";
     // get max items
     //echo $qry."<br>";
     $db->setQuery($qry);
     $db->query();
     $maxitems = $db->getNumRows();
     // select picked items
     $db->setQuery($qry, $limitstart, $limit);
     $this->users = $db->loadObjectList();
     // build pagination
     $this->pagination = new JPaginationEx($maxitems, $limitstart, $limit);
     $this->search = $search;
     include $this->tmplpath . DS . "user.php";
 }