function showStart($sLinkContinue, $sWebsite) { $sStartLabel = AnwUtils::xQuote($this->t_("start_go")); $HTML = <<<EOF <div class="explain"> \t{$this->t_("start_explain_p1")}<br/> \t{$this->t_("start_explain_p2")}<br/><br/> \t{$this->t_("start_explain_p3", array('website' => $sWebsite))}<br/><br/> \t<input type="button" class="insubmit inbuttonbig" value="{$sStartLabel} >>" onclick="window.location.href='{$this->escapeQuoteApostrophe($sLinkContinue)}'"/> </div> EOF; return $HTML; }
function alreadyInstalled($sLinkHome, $sLinkForce, $sFileLock, $sFileStatus) { $sGoHomeLabel = AnwUtils::xQuote($this->t_("alreadyinstalled_go_home")); $sGoForceLabel = AnwUtils::xQuote($this->t_("alreadyinstalled_go_force")); $HTML = <<<EOF <h1>{$this->t_('alreadyinstalled_t')}</h1> <div class="explain"> \t{$this->t_('alreadyinstalled_explain_p1')}<br/><br/> \t{$this->t_('alreadyinstalled_explain_p2')}<br/> \t<ul> \t\t<li>{$sFileLock}</li> \t</ul> \t<br/> \t{$this->t_('alreadyinstalled_explain_p3')}<br/><br/> \t<input type="button" class="inabort inbuttonbig" value="<< {$sGoHomeLabel}" onclick="window.location.href='{$this->escapeQuoteApostrophe($sLinkHome)}'"/> \t<input type="button" class="insubmit inbuttonbig" value="{$sGoForceLabel} >>" onclick="window.location.href='{$this->escapeQuoteApostrophe($sLinkForce)}'"/> </div> EOF; return $HTML; }
function pingInfo($sTarget) { $sPingYesLabel = AnwUtils::xQuote($this->t_("ping_yes_go")); $sPingNoLabel = AnwUtils::xQuote($this->t_("ping_no_go")); $HTML = <<<EOF <div class="explain"> \t{$this->t_("ping_explain")}<br/> </div> <table style="width:100%"> <tr> <td style="width:50%; padding:2em; vertical-align:top;"> <h2>{$this->t_("ping_yes_t")}</h2> \t<form method="post" action="{$sTarget}"> \t\t<div style="text-align:center"> \t\t\t<input type="hidden" name="ping" value="yes"/> \t\t\t<input type="checkbox" name="countincr" value="1" id="countincr" checked="checked" disabled="disabled"/><label for="countincr">{$this->t_("ping_yes_countincr_checkbox")} <span style="font-size:0.8em">({$this->t_("ping_yes_countincr_checkbox_info")})</span></label><br/> \t\t\t<input type="checkbox" name="addindirectory" value="1" id="addindirectory"/><label for="addindirectory">{$this->t_("ping_yes_directory_checkbox")} <span style="font-size:0.8em">({$this->t_("ping_yes_directory_checkbox_info")})</span></label><br/> \t\t\t<input type="submit" class="insubmit inbuttonbig" value="{$sPingYesLabel} >>"/> \t\t</div> \t</form> </td> <td style="width:50%; padding:1em; vertical-align:top;"> <h2>{$this->t_("ping_no_t")}</h2> \t<form method="post" action="{$sTarget}"> \t\t<div style="text-align:center"> \t\t\t<input type="hidden" name="ping" value="no"/> \t\t\t<input type="submit" class="inbutton inbuttonbig" value="{$sPingNoLabel} >>"/> \t\t</div> \t</form> </td> </tr> </table> EOF; return $HTML; }
function managementHome($aoManagementNavEntries) { $HTML = <<<EOF \t<h1>{$this->t_('title')}</h1> \t<div class="explain"> \t\t{$this->t_('explain')} \t</div> EOF; foreach ($aoManagementNavEntries as $oEntry) { $sLink = $oEntry->getLink(); $sTitle = $oEntry->getTitle(); $sDescription = $oEntry->getDescription(); $sImg = $oEntry->getImg() ? '<img src="' . AnwUtils::xQuote($sImg) . '"/>' : ''; $HTML .= <<<EOF \t<div style="float:left;width:45%; margin:2%;"> \t\t<h2><a href="{$this->xQuote($sLink)}" style="color:#000; text-decoration:none;">{$sImg}{$this->xText($sTitle)}</a></h2> \t\t<p>{$this->xText($sDescription)}</p> \t</div> EOF; } return $HTML; }
* @package Anwiki * @version $Id: index.php 350 2010-12-12 22:12:07Z anw $ * @copyright 2007-2009 Antoine Walter * @license http://www.gnu.org/copyleft/gpl.html GNU Public License 3 */ try { //should we load minimal mode? if (in_array(@$_GET['a'], array('install')) || isset($_GET['anwiki_mode_minimal'])) { define('ANWIKI_MODE_MINIMAL', true); } require_once "engine.inc.php"; //install redirect if (!file_exists(ANWIKI_INSTALL_LOCK) && AnwEnv::_GET('a') != 'install') { $sUrlInstall = AnwEnv::_SERVER('SCRIPT_URI') . '?a=install'; header("Location: " . $sUrlInstall); print '<a href="' . AnwUtils::xQuote($sUrlInstall) . '">' . AnwUtils::xQuote($sUrlInstall) . '</a>'; exit; } AnwDebug::startbench("preparing action", true); //load action code try { $sAction = strtolower(AnwEnv::_GET(AnwAction::GET_ACTIONNAME, "view")); $oAction = AnwAction::loadComponent($sAction); } catch (AnwException $e) { $sAction = "view"; $oAction = AnwAction::loadComponent($sAction); } //security check if (ANWIKI_MODE_MINIMAL && !$oAction instanceof AnwActionMinimal) { AnwDieCriticalError("Unauthorized mode / bad URL"); }
private function showFormRevert($oPageGroup, $aaRevertPlan, $nRevToChangeId) { $aoChanges = array(); $aoChangesUnfiltered = AnwStorage::getLastChanges(false, 0, null, null, null, null, $oPageGroup); foreach ($aoChangesUnfiltered as $oChange) { // only keep "revertable" changes if ($oChange->isRevertAvailable()) { $aoChanges[] = $oChange; } } $sHistoryPageGroupLink = false; if (AnwCurrentSession::isActionGlobalAllowed("lastchanges")) { $sHistoryPageGroupLink = AnwUtils::aLink("lastchanges", array("pagegroup" => $oPageGroup->getId())); } $this->out .= $this->tpl()->formRevert($this->linkMe(array("pagegroup" => $oPageGroup->getId())), $aoChanges, $nRevToChangeId, $sHistoryPageGroupLink); foreach ($aaRevertPlan['DELETE'] as $oPageForDelete) { $this->out .= $this->tpl()->simulateDelete($oPageForDelete->getLang(), $oPageForDelete->getName()); } foreach ($aaRevertPlan['REVERT'] as $aoRevertPages) { $oPageCurrent = $aoRevertPages[0]; $oPageForRevert = $aoRevertPages[1]; if ($oPageCurrent->isGlobalAndViewActionAllowed('diff')) { $sImgDiff = AnwUtils::xQuote(AnwUtils::pathImg("diff.gif")); $sAltDiff = AnwUtils::xQuote(self::g_("change_diff_link")); $sLnkDiff = AnwUtils::xQuote(AnwUtils::link($oPageCurrent, "diff", array("page" => $oPageCurrent->getId(), "revfrom" => $oPageCurrent->getChangeId(), "revto" => $oPageForRevert->getChangeId()))); $sLnkDiff = <<<EOF <a href="{$sLnkDiff}" title="{$sAltDiff}" target="_blank"><img src="{$sImgDiff}" alt="{$sAltDiff}"/></a> EOF; } else { $sLnkDiff = ''; } $this->out .= $this->tpl()->simulateRevert($oPageCurrent->getLang(), $oPageCurrent->getName(), $oPageForRevert, $sLnkDiff); } foreach ($aaRevertPlan['RESTORE'] as $oPageForRestore) { $this->out .= $this->tpl()->simulateCreate($oPageForRestore); } foreach ($aaRevertPlan['KEEP'] as $oPageForKeep) { $this->out .= $this->tpl()->simulateKeep($oPageForKeep->getLang(), $oPageForKeep->getName()); } $this->out .= $this->tpl()->end(); }
function showHtml($aoChanges, $amAllChangeTypes, $amDisplayChangeTypes, $asAllLangs, $asDisplayLangs, $asAllClasses, $asDisplayClasses, $nStartPrev, $nStartNext, $sTitle, $bGrouped, $oPage, $oPageGroup) { $this->out .= $this->tpl()->lastchangesHeader($sTitle); $sUrl = AnwEnv::_SERVER('REQUEST_URI'); $sUrl = preg_replace("/&s=([0-9]*)/", "", $sUrl); //rss link $sRssLink = $sUrl; $sRssLink .= '&feed=rss2'; //without start $this->head($this->tpl()->headRss($sRssLink)); $this->out .= $this->tpl()->filterBefore($this->linkMe()); $nPageId = $oPage ? $oPage->getId() : null; $nPageGroupId = $oPageGroup ? $oPageGroup->getId() : null; $bShowHistoryColumn = $oPage ? false : true; //disable filters if a page is selected if (!$nPageId) { //filter lang $this->out .= $this->tpl()->filterLangs($asAllLangs, $asDisplayLangs); } if (!$nPageId && !$nPageGroupId) { //filter contentclass $this->out .= $this->tpl()->filterClass($asAllClasses, $asDisplayClasses); } //filter changes types $this->out .= $this->tpl()->filterChangeTypes($amAllChangeTypes, $amDisplayChangeTypes); //display mode $sHistoryPageGroupLink = false; if ($oPage && AnwCurrentSession::isActionGlobalAllowed($this->getName())) { $sHistoryPageGroupLink = AnwEnv::_SERVER('REQUEST_URI'); $sHistoryPageGroupLink = preg_replace("\$&page=([0-9]*)\$", "", $sHistoryPageGroupLink); $sHistoryPageGroupLink = preg_replace("\$&pagegroup=([0-9]*)\$", "", $sHistoryPageGroupLink); $sHistoryPageGroupLink .= '&pagegroup=' . $oPage->getPageGroup()->getId(); } $this->out .= $this->tpl()->filterAfter($bGrouped, $nPageId, $nPageGroupId, $sRssLink, $sHistoryPageGroupLink); //nav $sLatestLink = ""; $sPrevLink = ""; if ($nStartPrev >= 0) { $sPrevLink = $sUrl . '&s=' . $nStartPrev; if ($nStartPrev > 0) { $sLatestLink = $sUrl . '&s=0'; } } $sNextLink = $sUrl . '&s=' . $nStartNext; $this->out .= $this->tpl()->nav($sLatestLink, $sPrevLink, $sNextLink, $bShowHistoryColumn); foreach ($aoChanges as $i => $oChange) { $sType = AnwChange::changeTypei18n($oChange->getType()); //links $sLnkPage = '<span class="pageid">#' . $oChange->getPageId() . '</span>'; $sLnkDiff = '-'; if ($oChange->activePageExists()) { $sLnkPage = $oChange->getActivePage()->link(); //active link, if it exists } //diffs link if ($oChange->isGlobalAndViewActionAllowed('diff')) { if ($oChange->isDiffAvailable()) { $sImgDiff = AnwUtils::xQuote(AnwUtils::pathImg("diff.gif")); $sAltDiff = AnwUtils::xQuote(self::g_("change_diff_link")); $sLnkDiff = AnwUtils::xQuote(AnwUtils::alink("diff", array("page" => $oChange->getPageId(), "revto" => $oChange->getChangeId()))); $sLnkDiff = <<<EOF <a href="{$sLnkDiff}" title="{$sAltDiff}"><img src="{$sImgDiff}" alt="{$sAltDiff}"/></a> EOF; } } //history link $sLnkHistory = false; if ($bShowHistoryColumn) { $sLnkHistory = " - "; if ($oChange->isActionAllowed('history')) { $sImgHistory = AnwUtils::xQuote(AnwUtils::pathImg("history.gif")); $sAltHistory = AnwUtils::xQuote($this->t_("change_history_link")); $sLnkHistory = AnwUtils::xQuote(AnwUtils::alink("lastchanges", array("page" => $oChange->getPageId()))); $sLnkHistory = <<<EOF <a href="{$sLnkHistory}" title="{$sAltHistory}"><img src="{$sImgHistory}" alt="{$sAltHistory}"/></a> EOF; } } //revert link $sLnkRevert = " - "; if ($oChange->isGlobalAndViewActionAllowed('revert')) { if ($oChange->isRevertAvailable()) { $sImgRevert = AnwUtils::xQuote(AnwUtils::pathImg("revert.gif")); $sAltRevert = AnwUtils::xQuote(self::t_("change_revert_link")); $sLnkRevert = AnwUtils::xQuote(AnwUtils::alink("revert", array("page" => $oChange->getPageId(), "revto" => $oChange->getChangeId()))); //we pass pageid instead of pagegroupid for better performances... $sLnkRevert = <<<EOF <a href="{$sLnkRevert}" title="{$sAltRevert}"><img src="{$sImgRevert}" alt="{$sAltRevert}"/></a> EOF; } } //output $this->out .= $this->tpl()->lastchangesLine(Anwi18n::dateTime($oChange->getTime()), $sType, $oChange->getComment(), $oChange->getInfo(), $oChange->getUser()->getDisplayName(), $sLnkPage, $sLnkDiff, $sLnkHistory, $sLnkRevert, $oChange->getPageName(), $oChange->getPageLang()); } $this->out .= $this->tpl()->lastchangesFooter(); }
protected function xQuote($sString) { return AnwUtils::xQuote($sString); }
function link($action = 'view') { $sSrcFlag = Anwi18n::srcFlag($this->getLang()); if ($action) { $sLink = AnwUtils::link($this, $action); $HTML = "<a href=\"" . AnwUtils::xQuote($sLink) . "\" style=\"background:url('{$sSrcFlag}') no-repeat left;padding-left:18px;\">" . AnwUtils::xText($this->getName()) . "</a>"; } else { $HTML = "<span style=\"background:url('{$sSrcFlag}') no-repeat left;padding-left:18px;\">" . AnwUtils::xText($this->getName()) . "</span>"; } return $HTML; }
function renderInput($sInputName, $asInputValues, $sInputId, $asInputParameters = array()) { $sCssClass = $sInputName; $sInputName .= '[]'; $sInputName = AnwUtils::xQuote($sInputName); $sInputParameters = $this->inputParametersToHtml($sInputId, $asInputParameters); $sChkAll = AnwComponent::g_('in_chkall'); $sChkNone = AnwComponent::g_('in_chknone'); $HTML = <<<EOF \t<fieldset class="contentfield_checkboxgroup"> \t\t<legend> \t\t\t<a href="#" onclick="AnwUtils.chkall('{$sCssClass}',\$(this).up().up()); return false;">{$sChkAll}</a> \t\t\t<a href="#" onclick="AnwUtils.chknone('{$sCssClass}',\$(this).up().up()); return false;">{$sChkNone}</a> \t\t</legend> EOF; $asEnumValues = $this->getEnumValues(); $nEnumId = 0; foreach ($asEnumValues as $mEnumValue => $sEnumLegend) { $mEnumValue = AnwUtils::xQuote($mEnumValue); $sSelected = in_array($mEnumValue, $asInputValues) ? ' checked="checked"' : ''; $sEnumId = $sInputId . $nEnumId; $HTML .= <<<EOF \t\t<div class="checkboxgroup_item"> \t\t<input type="checkbox" id="{$sEnumId}" name="{$sInputName}" class="{$sCssClass}" value="{$mEnumValue}"{$sSelected}/><label for="{$sEnumId}">{$sEnumLegend}</label> \t\t</div> EOF; $nEnumId++; } $HTML .= <<<EOF \t</fieldset> EOF; return $HTML; }
static function escapeQuoteApostrophe($sString) { return AnwUtils::xQuote(AnwUtils::escapeApostrophe($sString)); }