* @license http://www.contenido.org/license/LIZENZ.txt * @link http://www.4fb.de * @link http://www.contenido.org * @since file available since contenido release <= 4.6 * * {@internal * created unknown * modified 2008-06-27, Frederic Schneider, add security fix * * $Id$: * }} * */ if(!defined('CON_FRAMEWORK')) { die('Illegal call'); } $tpl->reset(); $oPage = new cPage; $user = new cApiUser($auth->auth["uid"]); $tpl->set('s', '{SESSID}', $sess->id); /* Set default values */ $oUser = new cApiUser($auth->auth["uid"]); if (!isset($_REQUEST["elemperpage"]) || !is_numeric($_REQUEST['elemperpage']) || $_REQUEST['elemperpage'] <= 0) { $_REQUEST["elemperpage"] = $oUser->getProperty("itemsperpage", $area); } if (!is_numeric($_REQUEST['elemperpage'])) { $_REQUEST['elemperpage'] = 25; } $oUser->setProperty("itemsperpage", $area, $_REQUEST["elemperpage"]); unset ($oUser); if (!isset($_REQUEST["page"]) || !is_numeric($_REQUEST['page']) || $_REQUEST['page'] <= 0 || $_REQUEST["elemperpage"] == 0) { $_REQUEST["page"] = 1; } $aFieldsToSearch = array("--all--" => i18n("-- All fields --"), "username" => i18n("Username")); $aFieldsToSort = array("username" => i18n("Username")); $aFieldSources = array(); $aFieldSources["username"] = "base"; $bUsePlugins = getEffectiveSetting("frontendusers", "pluginsearch", "true"); if ($bUsePlugins == "false") { $bUsePlugins = false; } else { $bUsePlugins = true; } if (is_array($cfg['plugins']['frontendusers'])) { foreach ($cfg['plugins']['frontendusers'] as $plugin) { plugin_include("frontendusers", $plugin."/".$plugin.".php"); } } if ($bUsePlugins == true) { if (is_array($cfg['plugins']['frontendusers'])) { $_sValidPlugins = getEffectiveSetting("frontendusers", "pluginsearch_valid_plugins", ''); $_aValidPlugins = array(); if (strlen($_sValidPlugins)>0) { $_aValidPlugins = explode(',', $_sValidPlugins); } $_iCountValidPlugins = sizeof($_aValidPlugins); foreach ($cfg['plugins']['frontendusers'] as $plugin) { if ($_iCountValidPlugins == 0 || in_array($plugin, $_aValidPlugins)) { if (function_exists("frontendusers_".$plugin."_wantedVariables") && function_exists("frontendusers_".$plugin."_canonicalVariables")) { $aVariableNames = call_user_func("frontendusers_".$plugin."_canonicalVariables"); if (is_array($aVariableNames)) { $aTmp = array_merge($aFieldsToSearch, $aVariableNames); $aFieldsToSearch = $aTmp; $aTmp2 = array_merge($aFieldsToSort, $aVariableNames); $aFieldsToSort = $aTmp2; foreach ($aVariableNames as $sVariableName => $name) { $aFieldSources[$sVariableName] = $plugin; } } } } } } } $aSortOrderOptions = array ("asc" => i18n("Ascending"), "desc" => i18n("Descending")); ########### # Buttons ########### /** * @todo change behavior for links to use cHTML elements */ $userlink = new cHTMLLink; $userlink->setCLink("frontend", 2, ""); $userlink->attachEventDefinition('Help', "onclick", setHelpContext("frontenduser")); $grouplink = new cHTMLLink; $grouplink->setCLink("frontendgroups", 2, ""); $userlink="javascript:execFilter(2);"; $grouplink="javascript:conMultiLink('left_bottom','main.php?area=frontendgroups&frame=2&action=&contenido=".$sess->id."')"; // Init view by javascript (decide which tab is activated) $imgUserId='img_user'; $tpl->set('s', 'IUSER', $imgUserId); $buttonRow .= ''; $buttonRow .= ''; $buttonRow .= ''; // Frontend Groups $imgGroupId='img_group'; $tpl->set('s', 'IGROUP', $imgGroupId); $buttonRow .= ''; $buttonRow .= ''; $buttonRow .= ''; $tpl->set('s', 'BUTTONROW', $buttonRow); if(isset($_GET['view']) && $_GET['view'] == $imgGroupId) { $tpl->set('s', 'IINIT', $imgGroupId); } else { $tpl->set('s', 'IINIT', $imgUserId); } ################ # Users Actions ################ $actionLink="actionlink"; $sActionUuid = '28cf9b31-e6d7-4657-a9a7-db31478e7a5c'; $oActionRow = new cFoldingRow($sActionUuid ,i18n("Actions"), $actionLink); if(isset($_GET['actionrow']) && $_GET['actionrow'] == 'collapsed') { $oActionRow->setExpanded(false); $user->setProperty("expandstate", $sActionUuid, 'false'); } else if (isset($_GET['actionrow']) && $_GET['actionrow'] == 'expanded') { $oActionRow->setExpanded(true); $user->setProperty("expandstate", $sActionUuid, 'true'); } $tpl->set('s', 'ACTIONLINK', $actionLink); $oLink = new cHTMLLink; if ((int) $client > 0) { $oLink->setMultiLink("frontend","","frontend","frontend_create"); $oLink->setContent(i18n("Create user")); } else { $oLink->setLink(''); $oLink->setContent(i18n("No Client selected")); } $oLink->setClass("addfunction"); $oLink->setStyle('margin-left: 17px;margin-top:5px'); $oActionRow->setContentData($oLink->render()); ###################### # Users List Options ###################### $sListOptionId = 'f081b6ab-370d-4fd8-984f-6b38590fe48b'; $listOptionLink="listoptionlink"; $oListOptionRow = new cFoldingRow($sListOptionId, i18n("List options"), $listOptionLink); $oListOptionRow->setExpanded(true); if(isset($_GET['filterrow']) && $_GET['filterrow'] == 'collapsed') { $oActionRow->setExpanded(false); $user->setProperty("expandstate", $sListOptionId, 'false'); } else if (isset($_GET['filterrow']) && $_GET['filterrow'] == 'expanded') { $oActionRow->setExpanded(true); $user->setProperty("expandstate", $sListOptionId, 'true'); } $tpl->set('s', 'LISTOPTIONLINK', $listOptionLink); $oSelectItemsPerPage = new cHTMLSelectElement("elemperpage"); $oSelectItemsPerPage->autoFill(array(25 => 25, 50 => 50, 75 => 75, 100 => 100)); $oSelectItemsPerPage->setDefault($_REQUEST["elemperpage"]); asort($aFieldsToSort); asort($aFieldsToSearch); $oSelectSortBy = new cHTMLSelectElement("sortby"); $oSelectSortBy->autoFill($aFieldsToSort); $oSelectSortBy->setDefault($_REQUEST["sortby"]); $oSelectSortOrder = new cHTMLSelectElement("sortorder"); $oSelectSortOrder->autoFill($aSortOrderOptions); $oSelectSortOrder->setDefault($_REQUEST["sortorder"]); $oSelectSearchIn = new cHTMLSelectElement("searchin"); $oSelectSearchIn->autoFill($aFieldsToSearch); $oSelectSearchIn->setDefault($_REQUEST["searchin"]); $fegroups = new FrontendGroupCollection; $fegroups->setWhere("idclient", $client); $fegroups->query(); $aFEGroups = array("--all--" => i18n("-- All Groups --")); while ($fegroup = $fegroups->next()) { $aFEGroups[$fegroup->get("idfrontendgroup")] = $fegroup->get("groupname"); } $oSelectRestrictGroup = new cHTMLSelectElement("restrictgroup"); $oSelectRestrictGroup->autoFill($aFEGroups); $oSelectRestrictGroup->setDefault($_REQUEST["restrictgroup"]); $oTextboxFilter = new cHTMLTextbox("filter", $_REQUEST["filter"], 20); $content = '