Example #1
0
require_once "Database.php";
require_once "SlowTemplate.php";
require_once "WebUtility.php";
require_once "Payment.php";
require_once "PaymentFactory.php";
$slow = new SlowTemplate('template');
$slow->setTemplateFile('home2.tpl');
session_start();
//////////////////////////////////////////////////////////////////////////////
// handle the submission
if ($_SERVER["REQUEST_METHOD"] == 'POST') {
    if ($_POST['__VIEWSTATE'] == $_SESSION['VIEWSTATE']) {
    }
}
//////////////////////////////////////////////////////////////////////////////
// display the page
$view = WebUtility::viewstate(1476);
$_SESSION['VIEWSTATE'] = $view;
// Tariff's
$tariffs = array('MFI Tariff 4', 'Unkown');
// page size
$pagesizes = array(20, 50, 100, 500);
// Search results
$results = PaymentFactory::factoryAll();
foreach ($results as $result) {
    $slow->assign(array("RECEIPT" => $result->getReciept(), "TIME" => date("Y-m-d H:i:s", $result->getTime()), "DESCRIPTION" => "Payment received from " . $result->getPhonenumber() . " - " . $result->getName() . " Acc. " . $result->getAccount(), "STATUS" => "Completed", "AMOUNT" => number_format($result->getAmount(), 2, '.', ''), "BALANCE" => number_format($result->getPostBalance(), 2, '.', ''), "HASH" => "b142222a-59ab-2ef6-8e52-a027ca4edb21"));
    $slow->parse("Result");
}
$slow->assign(array("VIEWSTATE" => $view, "ORGANISATION" => "MpesaPi", "USERNAME" => "Test Testson", "LOGIN_TIME" => date("Y-m-d H:i:s"), "LAST_LOGIN_TIME" => date("Y-m-d H:i:s"), "ACCOUNT_NUMBER" => '32943321-11', "TARIFF" => $tariffs[1], "SEARCH_FROM" => date("Y-m-d H:i:s"), "SEARCH_FROM_DAY" => date("Y-m-d"), "SEARCH_FROM_TIME" => "00:00", "SEARCH_UNTIL" => date("Y-m-d H:i:s"), "SEARCH_UNTIL_DAY" => date("Y-m-d"), "SEARCH_UNTIL_TIME" => "23:59", "PAGE_SIZE_INDEX" => "0", "PAGE_SIZE" => $pagesizes[0], "CHECKED_ALL" => 'checked="checked"', "CHECKED_DECLINED" => '', "CHECKED_CANCELLED" => '', "CHECKED_EXPIRED" => '', "CHECKED_PENDING" => '', "CHECKED_COMPLETED" => '', "BALANCE_UPDATED" => date("Y-m-d H:i:s"), "CURRENT_BALANCE" => "           0.00", "UNCLEARED_FUNDS" => "           0.00", "RESERVED_FUNDS" => "           0.00", "AVAILABLE_FUNDS" => "           0.00"));
$slow->parse();
$slow->slowPrint();
Example #2
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();
 }
Example #3
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();