Example #1
0
 /**
  * Given a full path (typically from QApplication::PathInfo)
  * this will validate that it is properly sanitized.  If so, it will
  * return null.  If not, it will generate and return a sanitized version
  * of that full path.
  * @param string $strFullPath
  * @return mixed null if valid, or the sanitized full path if not
  */
 public static function ValidateOrGenerateSanitizedFullPath($strFullPath)
 {
     $strPath = WikiItem::SanitizeForPath($strFullPath, $intWikiItemTypeId);
     $strSanitizedFullPath = WikiItem::GenerateFullPath($strPath, $intWikiItemTypeId);
     if ($strFullPath == $strSanitizedFullPath) {
         return null;
     } else {
         return $strSanitizedFullPath;
     }
 }
Example #2
0
    public static function DisplayUploadNewLinkForPath($strPath)
    {
        $strFullPath = WikiItem::GenerateFullPath($strPath, WikiItemType::File);
        $strToReturn = sprintf('
				<div class="wikiFileLeft">
				<a href="/wiki/edit.php%s" title="Create Wiki File"><img src="/images/download_404.png"/></a>
				</div><div class="wikiFileRight">
				<a href="/wiki/edit.php%s" title="Create Wiki File" style="font-size: 18px;">Create Wiki File for <strong>%s</strong></a>
				</div><br clear="all"/>', $strFullPath, $strFullPath, $strPath);
        return $strToReturn;
    }
 protected static function ProcessLinkLocationWikiPage($chrCurrent = null)
 {
     // Pop off LinkLocation
     $objState = self::$objStateStack->Pop();
     $strLocation = $objState->Buffer;
     // Pop off LinkProtocol
     $objState = self::$objStateStack->Pop();
     $strProtocol = $objState->Buffer;
     // Pop off End Quote
     $objState = self::$objStateStack->Pop();
     if ($objState->State != QTextStyle::StateEndQuote) {
         throw new Exception('Could not find In-LinkContent EndQuote State');
     }
     // Cancel everything through the matching start quote
     self::CancelToState(QTextStyle::StateStartQuote);
     // Pop off the Start Quote at the top of the stack
     $objState = self::$objStateStack->Pop();
     $strContent = $objState->Buffer;
     // Clean up the Location string so that it starts with one and exactly one forward slash
     $strLocation = '/' . $strLocation;
     while (strpos($strLocation, '//') === 0) {
         $strLocation = substr($strLocation, 1);
     }
     // Calculate end-of-location
     $strNeedle = '/[A-Za-z0-9\\_\\/\\:]/';
     $intValue = QString::StringReversePosition($strLocation, $strNeedle);
     // Clean Up the URL Path for a Wiki Link
     $strPath = WikiItem::SanitizeForPath(substr($strLocation, 0, $intValue + 1), $intWikiItemTypeId);
     $strSanitizedFullPath = WikiItem::GenerateFullPath($strPath, $intWikiItemTypeId);
     // Process as a URL-based link to the wiki
     $strUrlLink = sprintf('<a href="/wiki%s">%s</a>', $strSanitizedFullPath, $strContent);
     self::$objStateStack->AddToTopBuffer($strUrlLink);
     // Add any tail/unprocessed stuff back to the content stack
     QTextStyleInline::$strInlineContent = substr($strLocation, $intValue + 1) . QTextStyleInline::$strInlineContent;
 }
 protected function btnCancel_Click()
 {
     if ($this->intVersionNumber) {
         QApplication::Redirect('/wiki' . WikiItem::GenerateFullPath($this->strSanitizedPath, $this->intWikiItemTypeId) . '?' . $this->intVersionNumber);
     } else {
         QApplication::Redirect('/wiki' . WikiItem::GenerateFullPath($this->strSanitizedPath, $this->intWikiItemTypeId));
     }
 }