Skip to content

Commit

Permalink
Removing lots of PHP notices
Browse files Browse the repository at this point in the history
  • Loading branch information
jmontoyaa committed Aug 18, 2011
1 parent ecd74fb commit e31fdd8
Show file tree
Hide file tree
Showing 17 changed files with 94 additions and 71 deletions.
30 changes: 18 additions & 12 deletions admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,20 @@ function acp() {
$sidebar_link = "tpl/menu/submenu_main.tpl";
}

$subsidebar = '';
if (isset($content->navtitle) && $content->navtitle) {
$subnav = $content->navtitle;
foreach($content->navlist as $key => $value) {
$array2['IMGURL'] = $value[1];
$array2['LINK'] = "?page=".$admin_nave_item['link']."&sub=".$value[2];
$array2['VISUAL'] = $value[0];
$array3['LINKS'] .= $style->replaceVar($sidebar_link_link, $array2);
$subnav = $content->navtitle;
if (isset($content->navlist)) {
$array3 = array();
$array3['LINKS'] = null;
foreach($content->navlist as $key => $value) {
$array2['IMGURL'] = $value[1];
$array2['LINK'] = "?page=".$admin_nave_item['link']."&sub=".$value[2];
$array2['VISUAL'] = $value[0];
$array3['LINKS'] .= $style->replaceVar($sidebar_link_link, $array2);
}
$subsidebar = $style->replaceVar($sidebar_link, $array3);
}
$subsidebar = $style->replaceVar($sidebar_link, $array3);
}

if (isset($main->getvar['sub']) && $main->getvar['sub'] && $admin_nave_item['link'] != "type") {
Expand Down Expand Up @@ -181,7 +186,8 @@ function acp() {
$main->done();
}
} else {
if(isset($main->getvar['sub'])) {
$html = '';
if (isset($main->getvar['sub'])) {
ob_start();

/**
Expand All @@ -208,7 +214,7 @@ function acp() {
$html .= "<br /><br />"; # Break it up
}
// Now we should prepend some stuff here
$subsidebar2 .= "<strong>Page Submenu</strong><div class='break'></div>";
$subsidebar2 = "<strong>Page Submenu</strong><div class='break'></div>";
$subsidebar2 .= $subsidebar;
// Done, now output it in a sub() table
$html .= $main->sub($subsidebar2, NULL); # Initial implementation, add the SubSidebar(var) into the description, basically append it
Expand All @@ -226,8 +232,8 @@ function acp() {
}

$staffuser = $db->staff($main->getCurrentStaffId());
define("SUB", $header);
define("INFO", '<b>Welcome back, '. strip_tags($staffuser['name']) .'</b><br />'. SUB);

define("INFO", '<b>Welcome back, '. strip_tags($staffuser['name']) .'</b><br />');

echo '<div id="left">';
echo $main->table($nav, $sidebar);
Expand All @@ -248,7 +254,7 @@ function acp() {
}

//If user is NOT log in
if(!$_SESSION['logged']) {
if (!isset($_SESSION['logged'])) {
if ($main->getvar['page'] == "forgotpass") {
define("SUB", "Reset Password");
define("INFO", SUB);
Expand Down
39 changes: 22 additions & 17 deletions admin/pages/logs.php
Original file line number Diff line number Diff line change
@@ -1,27 +1,32 @@
<?php
/* For licensing terms, see /license.txt */


define("PAGE", "Logs");
class page {
public function content() { # Displays the page
global $style, $db, $main;

$l = intval($main->getvar['l']);
$p = intval($main->getvar['p']);
$l = isset($main->getvar['l']) ? intval($main->getvar['l']) : null;
$p = isset($main->getvar['p']) ? intval($main->getvar['p']) : 0;

$show_values = array('all','Approved','Unsuspended','Registered', 'Package created','Approved', 'Declined',
'Suspended', 'Cancelled', 'Terminated','cPanel password', 'Login','Login successful', 'Login failed','STAFF', 'STAFF LOGIN SUCCESSFUL','STAFF LOGIN FAILED');
$show_values = array('all',
'Approved','Unsuspended','Registered', 'Package created','Approved', 'Declined',
'Suspended',
'Cancelled',
'Terminated',
'cPanel password',
'Login',
'Login successful',
'Login failed',
'STAFF',
'STAFF LOGIN SUCCESSFUL',
'STAFF LOGIN FAILED'
);

if (!$main->postvar['show']) {
if (in_array($main->getvar['show'], $show_values)) {
$show = $main->getvar['show'];
} else {
$show = "all";
$show = "all";
if (isset($main->postvar['show'])) {
if (in_array($main->postvar['show'], $show_values)) {
$show = $main->postvar['show'];
}
} else {
$show = $main->postvar['show'];
$p = 0;
}

if (isset($main->postvar['clean'])) {
Expand Down Expand Up @@ -53,8 +58,8 @@ public function content() { # Displays the page
$values = array(
'all' =>'ALL',
'Login' =>'Client Logins (Success/Fail)',
'USER LOGIN SUCCESSFUL' =>'Client Logins (Success)',
'USER LOGIN FAILED' =>'Client Logins (Fail)',
'USER LOGIN SUCCESSFUL' =>'Client Logins (Success)',
'USER LOGIN FAILED' =>'Client Logins (Fail)',
'STAFF' =>'Staff Logins (Success/Fail)',
'STAFF LOGIN SUCCESSFUL' =>'Staff Logins (Success)',
'STAFF LOGIN FAILED' =>'Staff Logins (Fail)',
Expand Down Expand Up @@ -107,7 +112,7 @@ public function content() { # Displays the page
if ($db->num_rows($query) == 0) {
$style->showMessage("No logs found.");
} else {
if ($show != all) {
if ($show != 'all') {
$sql = "SELECT * FROM `<PRE>logs` WHERE `message` LIKE '$show%' ORDER BY `id` DESC LIMIT $p, $l";
} else {
$sql = "SELECT * FROM `<PRE>logs` ORDER BY `id` DESC LIMIT $p, $l";
Expand Down
3 changes: 1 addition & 2 deletions admin/pages/packages.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,7 @@ public function content() { # Displays the page
$style->showMessage('There are no packages to edit', 'warning');
} else {
while($data = $db->fetch_array($query)) {
echo $main->sub("<strong>".$data['name']."</strong>", '<a href="?page=packages&sub=edit&do='.$data['id'].'"><img src="'. URL .'themes/icons/pencil.png"></a>&nbsp;<a href="?page=packages&sub=delete&do='.$data['id'].'"><img src="'. URL .'themes/icons/delete.png"></a>');
$n++;
echo $main->sub("<strong>".$data['name']."</strong>", '<a href="?page=packages&sub=edit&do='.$data['id'].'"><img src="'. URL .'themes/icons/pencil.png"></a>&nbsp;<a href="?page=packages&sub=delete&do='.$data['id'].'"><img src="'. URL .'themes/icons/delete.png"></a>');
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion admin/pages/servers.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function content() { # Displays the page
if($db->num_rows($query) == 0) {
$style->showMessage('There are no Servers');
} else {

$n = 0;
while($data = $db->fetch_array($query)) {
echo $main->sub("<strong>".$data['name']."</strong>", '<a href="?page=servers&sub=view&do='.$data['id'].'"><img src="'. URL .'themes/icons/pencil.png"></a>&nbsp;<a href="?page=servers&sub=delete&do='.$data['id'].'"><img src="'. URL .'themes/icons/delete.png"></a>');
if($n) {
Expand Down
5 changes: 3 additions & 2 deletions admin/pages/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ public function __construct() {
public function description() {
global $db, $main;
$query = $db->query("SELECT * FROM `<PRE>users` ORDER BY `signup` DESC");
if($db->num_rows($query) != 0) {
$newest = '';
if ($db->num_rows($query) != 0) {
$data = $db->fetch_array($query);
$newest = $main->sub("Latest Signup:", $data['user']);
}
Expand Down Expand Up @@ -119,7 +120,7 @@ public function content() { # Displays the page
break;

case 'search':
if($main->getvar['do'] ) {
if(isset($main->getvar['do'])) {

$client = $user->getUserById($main->getvar['do']);
$array2['DATE'] = strftime("%D", $client['signup']);
Expand Down
22 changes: 12 additions & 10 deletions client/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ function client() {
$content = new page();
// Main Side Bar HTML
$nav = "Sidebar";

$array = array();
$array['LINKS'] = null;
foreach($client_navigation as $row) {
if ($row['link'] == 'delete' && !$db->config('delacc')) {
continue;
Expand All @@ -52,8 +53,10 @@ function client() {

//Page Sidebar

if($content->navtitle) {
$subnav = $content->navtitle;
if (isset($content->navtitle)) {
$subnav = $content->navtitle;
$array3 = array();
$array3['LINKS'] = null;
foreach($content->navlist as $key => $value) {
$array2['IMGURL'] = $value[1];
$array2['LINK'] = "?page=".$client_item['link']."&sub=".$value[2];
Expand All @@ -63,14 +66,14 @@ function client() {
$subsidebar = $style->replaceVar("tpl/menu/submenu_main.tpl", $array3);
}

if($main->getvar['sub'] == "delete" && isset($main->getvar['do']) && !$_POST && !$main->getvar['confirm']) {
if (isset($main->getvar['sub']) && $main->getvar['sub'] == "delete" && isset($main->getvar['do']) && !$_POST && !$main->getvar['confirm']) {
foreach($main->postvar as $key => $value) {
$array['HIDDEN'] .= '<input name="'.$key.'" type="hidden" value="'.$value.'" />';
}
$array['HIDDEN'] .= " ";
$html = $style->replaceVar("tpl/warning.tpl", $array);

} elseif($main->getvar['sub'] == "delete" && isset($main->getvar['do']) && $_POST && !$main->getvar['confirm']) {
} elseif(isset($main->getvar['sub']) && $main->getvar['sub'] == "delete" && isset($main->getvar['do']) && $_POST && !$main->getvar['confirm']) {
if($main->postvar['yes']) {
foreach($main->getvar as $key => $value) {
if($i) {
Expand All @@ -93,8 +96,7 @@ function client() {
$content->content();
$html = ob_get_contents(); # Retrieve the HTML
ob_clean(); # Flush the HTML
}
elseif($content->navlist) {
} elseif(isset($content->navlist)) {
//$html = "Select a sub-page from the sidebar.";
ob_start();
$content->content();
Expand All @@ -113,7 +115,7 @@ function client() {
}
}

if($main->getvar['sub'] && $main->getvar['page'] != "type") {
if (isset($main->getvar['sub']) && $main->getvar['sub'] && $main->getvar['page'] != "type") {
if (is_array($content->navlist))
foreach($content->navlist as $key => $value) {
if($value[2] == $main->getvar['sub']) {
Expand All @@ -128,7 +130,7 @@ function client() {

echo '<div id="left">';
echo $main->table($nav, $sidebar);
if($content->navtitle) {
if (isset($content->navtitle)) {
echo "<br />";
echo $main->table($subnav, $subsidebar);
}
Expand Down Expand Up @@ -199,7 +201,7 @@ function client() {
echo $style->get("footer.tpl");
}
} elseif($_SESSION['clogged']) {
if(!$main->getvar['page']) {
if(!isset($main->getvar['page'])) {
$main->getvar['page'] = "home";
} elseif($main->getvar['page'] == 'logout') {
$referer = basename($_SERVER['HTTP_REFERER']);
Expand Down
6 changes: 3 additions & 3 deletions client/pages/details.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ public function content() {
global $style, $db, $main, $user;

$data = $user->getUserById($main->getCurrentUserId());

$array['USER'] = $data['user'];
$array['EMAIL'] = $data['email'];
$array['DOMAIN'] = $data['domain'];
//$array['DOMAIN'] = $data['domain'];
$array['FIRSTNAME'] = $data['firstname'];
$array['LASTNAME'] = $data['lastname'];
$array['COMPANY'] = $data['company'];
Expand All @@ -22,7 +22,7 @@ public function content() {
$array['COUNTRY'] = strtolower($data['country']);
$array['PHONE'] = $data['phone'];

if ($main->getvar['sub'] != 'edit') {
if (isset($main->getvar['sub']) && $main->getvar['sub'] != 'edit') {
echo $style->replaceVar("tpl/user/client_view.tpl", $array);
} else {

Expand Down
4 changes: 3 additions & 1 deletion client/pages/invoices.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ public function description() {
public function content() {
global $style, $db, $main, $invoice, $addon, $billing, $order, $server, $package;

switch($main->getvar['sub']) {
$action = isset($main->getvar['sub']) ? $main->getvar['sub'] : 'all';

switch($action) {
case 'paid':
//this is moved to the paypal/ipn.php file
break;
Expand Down
6 changes: 4 additions & 2 deletions client/pages/orders.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ public function description() {

public function content() {
global $style, $db, $main, $order;

switch($main->getvar['sub']) {

$action = isset($main->getvar['sub']) ? $main->getvar['sub'] : 'all';

switch($action) {
case 'view':
if(isset($main->getvar['do'])) {
$return_array = $order->getOrder($main->getvar['do'], true);
Expand Down
9 changes: 5 additions & 4 deletions client/pages/tickets.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ public function content() { # Displays the page
$ticket_status_list = $main->getTicketStatusList();

$user_id = $main->getCurrentUserId();
switch($main->getvar['sub']) {
$action = isset($main->getvar['sub']) ? $main->getvar['sub'] : 'view';

switch($action) {
case 'add':
$asOption = array(
'rules' => array(
Expand Down Expand Up @@ -68,9 +70,8 @@ public function content() { # Displays the page
echo $style->replaceVar("tpl/support/addticket.tpl", $array);
break;
default:
case 'view':

if(!$main->getvar['do'] && $main->checkToken()) {
case 'view':
if(!isset($main->getvar['do']) && $main->checkToken()) {
$query = $db->query("SELECT * FROM <PRE>tickets WHERE userid = '{$user_id}' AND reply = '0' ORDER BY id DESC");
if(!$db->num_rows($query)) {
$style->showMessage('No open tickets');
Expand Down
3 changes: 2 additions & 1 deletion includes/ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,8 @@ public function search() {
if($db->num_rows($query) == 0) {
echo "No clients found";
} else {
while($data = $db->fetch_array($query)) {
$n = 0;
while($data = $db->fetch_array($query)) {
if($n != $show) {
//$client = $db->client($data['userid']);
$array['ID'] = $data['id'];
Expand Down
Loading

0 comments on commit e31fdd8

Please sign in to comment.