Пример #1
0
 public function handleRequest()
 {
     //# Confirm that you actually have the required access level for this page.
     if ($this->getRequiredAccessLevel() != "None") {
         $user = $this->getUser();
         if ($user == NULL) {
             //# user not loged in
             WebUtility::redirect($this->getLoginUrl());
             exit;
         } else {
             //# loged in lets check for required accesslevels needed
             if ($this->getRequiredType() != null and $this->getRequiredType() != $user->getType()) {
                 //# user does not have access
                 WebUtility::redirect($this->getLoginUrl());
                 exit;
             }
             if ($this->getRequiredAccessLevel() != "Login") {
                 $access = false;
                 $levels = $user->getAccessLevel();
                 foreach ($levels as $level) {
                     if ($this->getRequiredAccessLevel() == $level->getName()) {
                         $access = true;
                         break;
                     }
                 }
                 if (!$access) {
                     // user does not have access
                     WebUtility::redirect($this->getLoginUrl());
                     exit;
                 }
             }
         }
     }
     if ($this->getCacheable()) {
     }
     $this->generate();
 }
Пример #2
0
		LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
		OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
		SUCH DAMAGE.
 */
namespace PLUSPEOPLE\Pesapi\simulator;

require_once "../include/Configuration.php";
require_once "SlowTemplate.php";
require_once "WebUtility.php";
$slow = new SlowTemplate('template');
$slow->setTemplateFile('index.tpl');
session_start();
//////////////////////////////////////////////////////////////////////////////
// handle the submission
if ($_SERVER["REQUEST_METHOD"] == 'POST') {
    if ($_POST['__VIEWSTATE'] == $_SESSION['VIEWSTATE'] and $_POST['LoginCtrl$UserName'] == 'test' and $_POST['LoginCtrl$Password'] == 'best' and $_POST['LoginCtrl$txtOrganisationName'] == 'PesaPi') {
        if ($_GET['ReturnUrl'] != "") {
            WebUtility::redirect($_GET['ReturnUrl']);
        } else {
            // if no return url we pretend they gave this one - since the simulator does not have the normal "entry" one (yet)
            WebUtility::redirect('/ke/Main/home2.aspx?MenuID=1826');
        }
    }
}
//////////////////////////////////////////////////////////////////////////////
// display the page
$view = WebUtility::viewstate(152);
$_SESSION['VIEWSTATE'] = $view;
$slow->assign(array("VIEWSTATE" => $view));
$slow->parse();
$slow->slowPrint();