Example #1
0
<?php

namespace w34u\ssp;

require 'includeheader.php';
$session = new Protect("user");
$pageTitle = "SSP - Lister Help";
$SSP_template = new Template($pageTitle, "sspgeneraltemplate.tpl");
$SSP_template->includeTill("menu");
echo '<a href="' . $SSP_Config->userLister . '">Back to Lister</a>';
$SSP_template->includeTill("content");
?>
<h1>Lister Help</h1>
<p>How to use the results lister.</p>
<h2>List Options </h2>
<p>To view information on an artist simply click on their name.</p>
<p>The alphabetical list at the top adds an additional filter on the family name of the member, example: if you click on &quot;c&quot; only artists who's family names start with &quot;c&quot; will be displayed, clicking on &quot;all&quot; displays the complete list again.</p>
<?php 
if ($session->admin) {
    ?>
<p>Clicking on the button "New Members" will display the latest members who have joined, and replied to their emails but need to be checked by admin.</p>
<?php 
}
?>
<h2>Side Menu</h2>
<h3>My Details</h3>
<p>View and modify your own information. </p>
<h3>New Search</h3>
<p>Change the search criteria for the list, allows searches on various fields to find the members for which you are looking.</p>
<?php 
if ($session->admin) {
Example #2
0
 /**
  * Process a command tag
  * @param type $tag
  * @param type $braceClose
  */
 private function processCommand($tag, $braceClose)
 {
     $this->skipOutput = true;
     // don't display this and possibly other lines
     // found a command, format :command:tag
     $endColon = mb_strpos($tag, ':', 1);
     $command = mb_substr($tag, 1, $endColon - 1);
     $commandTag = trim(mb_substr($tag, $endColon + 1));
     // echo "Command Tag '". $command. "' '". $commandTag. "'";
     switch ($command) {
         case 'if':
             // check for tag exists
         // check for tag exists
         case 'ifnot':
             // chack for tag not exisiting
             if ($command == "if" and !array_key_exists($commandTag, $this->replaces) or $command == "ifnot" and array_key_exists($commandTag, $this->replaces)) {
                 // 'if' tag does not exist in content array, fast forward to {:endif:tag}
                 // 'ifnot' tag exists in content array, fast forward to {:endif:tag}
                 $endLoop = '{:endif:' . $commandTag . '}';
                 $searchPos = $this->contentPosition;
                 do {
                     $searchPos++;
                     if ($searchPos >= $this->arrayLength) {
                         trigger_error("SSP_Template: Conditional endif for {$commandTag} not found", E_USER_ERROR);
                     }
                     $value = $this->templateArray[$searchPos];
                 } while (!mb_strpos(" " . $value, $endLoop));
                 $this->contentPosition = $searchPos + 1;
             } else {
                 // remove line with if command
                 $this->contentPosition++;
             }
             break;
         case 'endif':
             // found endif flag during if execution
             // remove endif line
             $this->contentPosition++;
             break;
         case 'ne':
             // don't encode the specified tag
             $this->repFunctions[$commandTag] = "";
             $this->contentPosition++;
             break;
         case 'notne':
             // encode the specified tag
             if (isset($this->repFunctions[$commandTag])) {
                 unset($this->repFunctions[$commandTag]);
             }
             $this->contentPosition++;
             break;
         case 'nl2br':
             // encode for special characters and then do nl2br
             $this->repFunctions[$commandTag] = "nl2br";
             $this->contentPosition++;
             break;
         case 'include':
             // include a text file at this position
             $this->skipOutput = false;
             $includePath = $this->tplExists($commandTag);
             if ($handle = fopen($includePath, "r")) {
                 if ($includeContents = fread($handle, filesize($commandTag))) {
                     $this->valuePos = $this->valuePos + mb_strlen($includeContents);
                     $value = $this->replace('{:include:' . $commandTag . '}', $includeContents, $value);
                 } else {
                     trigger_error("SSP_Template: Failed to read {$commandTag} to include", E_USER_ERROR);
                 }
                 fclose($handle);
             } else {
                 trigger_error("SSP_Template: Failed to open {$commandTag} to include", E_USER_ERROR);
             }
             break;
         case 'includet':
             // include a template file using supplied data
             $this->skipOutput = false;
             $includeTpl = new Template($this->replaces, $commandTag, false);
             $includeContents = $includeTpl->includeTill();
             $value = $this->replace('{:includet:' . $commandTag . '}', $includeContents, $value);
             $this->valuePos = $this->valuePos + mb_strlen($includeContents);
             break;
         case 'includeti':
             // use the supplied template object with internal data
             $this->skipOutput = false;
             if (isset($this->replaces[$commandTag]) and is_object($this->replaces[$commandTag]) and get_class($this->replaces[$commandTag]) === "w34u\\ssp\\Template") {
                 $includeTpl = $this->replaces[$commandTag];
                 $includeTpl->display = false;
                 $includeTpl->restart($this->replaces);
                 $includeContents = $includeTpl->output();
                 $value = $this->replace('{:includeti:' . $commandTag . '}', $includeContents, $value);
                 $this->valuePos = $this->valuePos + mb_strlen($includeContents);
             } else {
                 trigger_error("SSP_Template: Invalide template object supplied for {$commandTag}", E_USER_ERROR);
             }
             break;
         default:
             // found no valid command, continue output
             $this->valuePos = $braceClose;
             $this->skipOutput = false;
     }
 }