public function Render() { include_once 'libs/smartylibs/Smarty.class.php'; $smarty = new Smarty(); $smarty->template_dir = 'components/templates'; $smarty->assign_by_ref('Page', $this); $users = $this->tableBasedGrantsManager->GetAllUsersAsJson(); $smarty->assign_by_ref('Users', $users); $localizerCaptions = $this->GetLocalizerCaptions(); $smarty->assign_by_ref('Captions', $localizerCaptions); /* $roles = $this->tableBasedGrantsManager->GetAllRolesAsJson(); $smarty->assign_by_ref('Roles', $roles); */ $headerString = 'Content-Type: text/html'; if ($this->GetContentEncoding() != null) { StringUtils::AddStr($headerString, 'charset=' . $this->GetContentEncoding(), ';'); } header($headerString); $pageInfos = GetPageInfos(); $pageListViewData = array('Pages' => array(), 'CurrentPageOptions' => array()); foreach ($pageInfos as $pageInfo) { $pageListViewData['Pages'][] = array('Caption' => $this->RenderText($pageInfo['caption']), 'Hint' => $this->RenderText($pageInfo['short_caption']), 'Href' => $pageInfo['filename'], 'GroupName' => $this->RenderText($pageInfo['group_name']), 'BeginNewGroup' => $pageInfo['add_separator']); } $pageGroups = GetPageGroups(); foreach ($pageGroups as &$pageGroup) { $pageGroup = $this->RenderText($pageGroup); } $pageListViewData['Groups'] = $pageGroups; $smarty->assign_by_ref('PageList', $pageListViewData); $authenticationViewData = $this->GetAuthenticationViewData(); $smarty->assign_by_ref('Authentication', $authenticationViewData); $smarty->display('admin_panel.tpl'); }
public static function createForPage(CommonPage $page) { $currentPageFilename = $page->GetPageFileName(); $pageList = new PageList($page); $pageGroups = GetPageGroups(); foreach ($pageGroups as $group) { $pageList->AddGroup($page->RenderText($group)); } $pageInfos = GetPageInfos(); foreach ($pageInfos as $pageInfo) { if (!GetCurrentUserGrantForDataSource($pageInfo['name'])->HasViewGrant()) { continue; } $shortCaption = $page->RenderText($pageInfo['short_caption']); $pageList->AddPage(new PageLink($page->RenderText($pageInfo['caption']), $pageInfo['filename'], $shortCaption, $currentPageFilename == $pageInfo['filename'], $pageInfo['add_separator'], $page->RenderText($pageInfo['group_name']))); } return $pageList; }
private function GetUrlToRedirectAfterLogin() { $pageInfos = GetPageInfos(); foreach ($pageInfos as $pageInfo) { if (GetCurrentUserGrantForDataSource($pageInfo['name'])->HasViewGrant()) { return $pageInfo['filename']; } } return $this->urlToRedirectAfterLogin; }
private function GetUrlToRedirectAfterLogin() { if (GetApplication()->GetSuperGlobals()->IsGetValueSet('redirect')) { return GetApplication()->GetSuperGlobals()->GetGetValue('redirect'); } $pageInfos = GetPageInfos(); foreach ($pageInfos as $pageInfo) { if (GetCurrentUserGrantForDataSource($pageInfo['name'])->HasViewGrant()) { return $pageInfo['filename']; } } return $this->urlToRedirectAfterLogin; }
function GetPageInfos($sitename) { include_once dirname(__FILE__) . "/ressources/class.html2text.inc"; if (strpos(" {$sitename}", "http") == 0) { $sitename = "http://{$sitename}"; } echo "{$sitename}\n"; $curl = new ccurl("{$sitename}"); $curl->NoHTTP_POST = true; if (!$curl->get()) { echo "{$sitename} -> error: \n" . $curl->error . "\n"; return; } $datas = explode("\n", $curl->data); while (list($num, $ligne) = each($datas)) { if (preg_match("#^Location:\\s+(.+)#", $ligne, $re)) { return GetPageInfos($re[1]); } } if (preg_match("#<head>(.*?)</head>#is", $curl->data, $re)) { $HEAD = utf8_encode($re[1]); } if (preg_match("#<body.*?>(.*?)</body>#is", $curl->data, $re)) { $BODY = utf8_encode($re[1]); } if (preg_match("#<title>(.*?)</title>#is", $HEAD, $re)) { $TITLE = $re[1]; } if (preg_match_all("#http.*?:\\/\\/(.+?)[\\/\\s\"]+#is", $curl->data, $re)) { while (list($num, $ligne) = each($re[1])) { if (preg_match("#^www\\.(.*)#", $ligne, $Z)) { $ligne = $Z[1]; } $SUBSITES[$ligne] = true; } while (list($num, $ligne) = each($SUBSITES)) { $sitenames[] = $num; } } if (preg_match("#<meta name=.*?description.*?content=(.+?)>#is", $HEAD, $re)) { $re[1] = str_replace('"', "", $re[1]); $array["DESCRIPTION"] = $re[1]; } if (preg_match("#<meta name=.*?keywords.*?content=(.+?)>#is", $HEAD, $re)) { $re[1] = str_replace('"', "", $re[1]); $array["KEYWORDS"] = $re[1]; } $array["TITLE"] = $TITLE; while (list($num, $ligne) = each($sitenames)) { $array["SITENAMES"][$ligne] = $ligne; } // http://www.chuggnutt.com/html2text $h2t = new html2text($BODY); $text = $h2t->get_text(); while (list($num, $ligne) = each($h2t->_link_array)) { if (trim($ligne) == null) { continue; } $array["URIS"][] = $ligne; } $array["TEXT"] = $h2t->_TEXT; include_once dirname(__FILE__) . '/ressources/whois/whois.main.php'; $whois = new Whois(); $array["WHOIS"] = $whois->Lookup($sitename); return unserialize($array); }