Example #1
0
 function testUrl()
 {
     $url = new Url(self::TEST_URL);
     $this->assertEquals($url->getFull(), self::TEST_URL);
     $this->assertEquals($url->getScheme(), 'https');
     $this->assertEquals($url->getHost(), 'www.google.com');
     $this->assertEquals($url->getPort(), '80');
     $this->assertEquals($url->getPath(), '/some_path');
     // The HTML entities remain intact
     $this->assertEquals($url->getQuery(), 'some=query&something=%20weird');
     // The HTML entities are resolved
     $this->assertEquals($url->getParam('some'), 'query');
     $this->assertEquals($url->getParam('something'), ' weird');
     $this->assertEquals($url->getParams(), ['some' => 'query', 'something' => ' weird']);
     $this->assertEquals($url->getFragment(), 'some_fragment');
     $this->assertEquals($url->getUser(), 'user');
     $this->assertEquals($url->getPass(), 'pass');
 }
Example #2
0
 public function __construct($rows, $max = 10)
 {
     $this->_records = $rows;
     $this->_numb_of_records = count($this->_records);
     $this->_max_pp = $max;
     $this->_url = Url::getCurrentUrl(self::$_key);
     $current = Url::getParam(self::$_key);
     $this->_current = !empty($current) ? $current : 1;
     $this->numberOfPages();
     $this->getOffset();
 }
Example #3
0
 public static function getActive($page = null)
 {
     if (!empty($page)) {
         if (is_array($page)) {
             $error = array();
             foreach ($page as $key => $value) {
                 if (Url::getParam($key) != $value) {
                     array_push($error, $key);
                 }
             }
             return empty($error) ? "class=\"act\"" : null;
         }
     }
     return $page == Url::cPage() ? "class=\"act\"" : null;
 }
Example #4
0
 function testParsingAndSerializing()
 {
     $href = "http://*****:*****@elgg.org/path?query=fun+times#fragment";
     $url = new Url($href);
     $this->assertEquals('http', $url->scheme);
     $this->assertEquals('user', $url->user);
     $this->assertEquals('pass', $url->pass);
     $this->assertEquals('elgg.org', $url->host);
     $this->assertEquals('/path', $url->path);
     $this->assertEquals('fun times', $url->getParam('query'));
     $this->assertEquals('fragment', $url->fragment);
     // Ensure non-existent params were initialized to null.
     $this->assertNull($url->port);
     // Ensure toString re-encodes exactly correctly.
     $this->assertEquals($href, "{$url}");
 }
Example #5
0
<?php

$id = Url::getParam('id');
if (!empty($id)) {
    $objUser = new User();
    $user = $objUser->getUser($id);
    if (!empty($user)) {
        $objOrder = new Order();
        $orders = $objOrder->getClientOrders($id);
        if (empty($orders)) {
            $yes = '/admin' . Url::getCurrentUrl() . '&amp;remove=1';
            $no = 'javascript:history.go(-1)';
            $remove = Url::getParam('remove');
            if (!empty($remove)) {
                $objUser->removeUser($id);
                Helper::redirect('/admin' . Url::getCurrentUrl(array('action', 'id', 'remove', 'srch', Paging::$_key)));
            }
            require_once 'template/_header.php';
            ?>
<h1>Clients :: Remove</h1>
<p>Are you sure you want to remove this client (<?php 
            echo $user['first_name'] . " " . $user['last_name'];
            ?>
)?<br />
There is no undo!<br />
<a href="<?php 
            echo $yes;
            ?>
">Yes</a> | <a href="<?php 
            echo $no;
            ?>
Example #6
0
<?php

$objCatalogue = new Catalogue();
$srch = Url::getParam('srch');
if (!empty($srch)) {
    $products = $objCatalogue->getAllProducts($srch);
    $empty = 'There are no results matching your searching criteria.';
} else {
    $products = $objCatalogue->getAllProducts();
    $empty = 'There are currently no records.';
}
$objPaging = new Paging($products, 5);
$rows = $objPaging->getRecords();
$objPaging->_url = '/admin' . $objPaging->_url;
require_once 'template/_header.php';
?>

<h1>Products</h1>

<form action="" method="get">
	<?php 
echo Url::getParams4Search(array('srch', Paging::$_key));
?>
	<table cellpadding="0" cellspacing="0" border="0" class="tbl_insert">
	
		<tr>
			<th><label for="srch">Product:</label></th>
			<td>
				<input type="text" name="srch" id="srch" 
					value="<?php 
echo stripslashes($srch);
Example #7
0
<?php

$code = Url::getParam('code');
if (!empty($code)) {
    $objUser = new User();
    $user = $objUser->getUserByHash($code);
    if (!empty($user)) {
        if ($user['active'] == 0) {
            if ($objUser->makeActive($user['id'])) {
                $mess = "<h1>Thank you</h1>";
                $mess .= "<p>Your account has now been successfully activated.<br />";
                $mess .= "You can now log in and continue with your order.</p>";
            } else {
                $mess = "<h1>Activation unsuccessful</h1>";
                $mess .= "<p>There has been a problem activating your account.<br />";
                $mess .= "Please contact administrator.</p>";
            }
        } else {
            $mess = "<h1>Account already activated</h1>";
            $mess .= "<p>This account has already been activated.</p>";
        }
    } else {
        Helper::redirect("/?page=error");
    }
    require_once "_header.php";
    echo $mess;
    require_once "_footer.php";
} else {
    Helper::redirect("/?page=error");
}
Example #8
0
<?php

Login::restrictAdmin();
$action = Url::getParam('action');
switch ($action) {
    case 'add':
        require_once 'products/add.php';
        break;
    case 'added':
        require_once 'products/added.php';
        break;
    case 'added-failed':
        require_once 'products/added-failed.php';
        break;
    case 'added-no-upload':
        require_once 'products/added-no-upload.php';
        break;
    case 'edit':
        require_once 'products/edit.php';
        break;
    case 'edited':
        require_once 'products/edited.php';
        break;
    case 'edited-failed':
        require_once 'products/edited-failed.php';
        break;
    case 'edited-no-upload':
        require_once 'products/edited-no-upload.php';
        break;
    case 'remove':
        require_once 'products/remove.php';
Example #9
0
<?php

$id = Url::getParam('id');
if (!empty($id)) {
    $objOrder = new Order();
    $order = $objOrder->getOrder($id);
    if (!empty($order)) {
        $items = $objOrder->getOrderItems($id);
        $objCatalogue = new Catalogue();
        $objUser = new User();
        $user = $objUser->getUser($order['client']);
        $objCountry = new Country();
        $objBusiness = new Business();
        $business = $objBusiness->getBusiness();
        $objBasket = new Basket();
        ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Invoice</title>
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta http-equiv="imagetoolbar" content="no" />
<link href="/css/invoice.css" rel="stylesheet" type="text/css" />
</head>
<body>

<div id="wrapper">
	
Example #10
0
<?php

$cat = Url::getParam('category');
if (empty($cat)) {
    require_once "error.php";
} else {
    $objCatalogue = new Catalogue();
    $category = $objCatalogue->getCategory($cat);
    if (empty($category)) {
        require_once "error.php";
    } else {
        $rows = $objCatalogue->getProducts($cat);
        // instantiate paging class
        $objPaging = new Paging($rows, 3);
        $rows = $objPaging->getRecords();
        require_once "_header.php";
        ?>

<h1>Catalogue :: <?php 
        echo $category['name'];
        ?>
</h1>

<?php 
        if (!empty($rows)) {
            foreach ($rows as $row) {
                ?>

<div class="catalogue_wrapper">
	<div class="catalogue_wrapper_left">
		<?php