Browse Source

Move the code base from auto increment identifiers to universally unique identifiers (uuid). Also improve some code by remove unecessary commented code, line spacing, and adding underscores where between words.

Mark Crane 13 năm trước cách đây
mục cha
commit
51e5d7cd7c

+ 1 - 1
features/root.php

@@ -17,7 +17,7 @@
 
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2010
+	Portions created by the Initial Developer are Copyright (C) 2008-2012
 	the Initial Developer. All Rights Reserved.
 
 	Contributor(s):

+ 1 - 1
features/v_features.php

@@ -17,7 +17,7 @@
 
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2010
+	Portions created by the Initial Developer are Copyright (C) 2008-2012
 	the Initial Developer. All Rights Reserved.
 
 	Contributor(s):

+ 5 - 5
flashphoner/flashphoner.php

@@ -46,18 +46,18 @@ $sql = "";
 $sql .= "select * from v_extensions ";
 $sql .= "where domain_uuid = '$domain_uuid' ";
 $sql .= "and user_list like '%|".$_SESSION["username"]."|%' ";
-$prepstatement = $db->prepare(check_sql($sql));
-$prepstatement->execute();
+$prep_statement = $db->prepare(check_sql($sql));
+$prep_statement->execute();
 
 $x = 0;
-$result = $prepstatement->fetchAll();
+$result = $prep_statement->fetchAll();
 foreach ($result as &$row) {
 	$extension_array[$x]['extension_uuid'] = $row["extension_uuid"];
 	$extension_array[$x]['extension'] = $row["extension"];
 	$x++;
 }
 
-unset ($prepstatement);
+unset ($prep_statement);
 
 if ($x > 0) {
 	$key = uuid();
@@ -81,4 +81,4 @@ if ($x < 1) {
 
 //show the footer
 require_once "includes/footer.php";
-?>
+?>

+ 9 - 9
flashphoner/request_credentials.php

@@ -48,15 +48,15 @@ $sql = sprintf("select * from v_flashphone_auth where auth_key = '%s' and hostad
 		$_SERVER['REMOTE_ADDR'],
 		$username);
 	
-$prepstatement = $db->prepare(check_sql($sql));
-if (!$prepstatement) {
+$prep_statement = $db->prepare(check_sql($sql));
+if (!$prep_statement) {
 	echo "\nPDO::errorInfo():\n";
 	print_r($db->errorInfo());
 }
 
-$prepstatement->execute();
+$prep_statement->execute();
 $x = 0;
-$result = $prepstatement->fetchAll();
+$result = $prep_statement->fetchAll();
 
 // There is probably a better way to do this but this will work on anything
 foreach ($result as &$row) {
@@ -66,15 +66,15 @@ foreach ($result as &$row) {
 if ($x < 1) {
 	die("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<ERROR>UNAUTHORIZED ACCESS</ERROR>");
 }
-unset ($prepstatement);
+unset ($prep_statement);
 
 //get a list of assigned extensions for this user
 $sql = sprintf("select * from v_extensions where extension_uuid = '%s' and user_list like '%%|%s|%%'", $extension_uuid, $username);
 
-$prepstatement = $db->prepare(check_sql($sql));
-$prepstatement->execute();
+$prep_statement = $db->prepare(check_sql($sql));
+$prep_statement->execute();
 $x = 0;
-$result = $prepstatement->fetchAll();
+$result = $prep_statement->fetchAll();
 foreach ($result as &$row) {
 	$extension_array[$x]['extension_uuid'] = $row["extension_uuid"];
 	$extension_array[$x]['extension'] = $row["extension"];
@@ -83,7 +83,7 @@ foreach ($result as &$row) {
 	$x++;
 }
 
-unset ($prepstatement);
+unset ($prep_statement);
 
 if ($x == 1) {
 header('Content-Type: text/xml');

+ 1 - 1
flashphoner/root.php

@@ -17,7 +17,7 @@
 
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2010
+	Portions created by the Initial Developer are Copyright (C) 2008-2012
 	the Initial Developer. All Rights Reserved.
 
 	Contributor(s):

+ 1 - 1
invoices/root.php

@@ -17,7 +17,7 @@
 
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2010
+	Portions created by the Initial Developer are Copyright (C) 2008-2012
 	the Initial Developer. All Rights Reserved.
 
 	Contributor(s):

+ 2 - 0
invoices/v_config.php

@@ -86,10 +86,12 @@
 		$apps[$x]['db'][$y]['fields'][$z]['description'] = '';
 		$z++;
 		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'contact_uuid_from';
+		$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'contact_id_from';
 		$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
 		$apps[$x]['db'][$y]['fields'][$z]['description'] = 'Contact ID invoice is sent from';
 		$z++;
 		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'contact_uuid_to';
+		$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'contact_id_to';
 		$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
 		$apps[$x]['db'][$y]['fields'][$z]['description'] = 'Contact ID invoice is sent to';
 		$z++;

+ 9 - 9
invoices/v_invoice_items.php

@@ -5,7 +5,7 @@ require_once "includes/header.php";
 require_once "includes/paging.php";
 
 //get variables used to control the order
-	$orderby = $_GET["orderby"];
+	$order_by = $_GET["order_by"];
 	$order = $_GET["order"];
 
 //show the content
@@ -27,7 +27,7 @@ require_once "includes/paging.php";
 		$sql .= " select count(*) as num_rows from v_invoice_items ";
 		$sql .= " where domain_uuid = '$domain_uuid' ";
 		$sql .= " and invoice_uuid = '$invoice_uuid' ";
-		if (strlen($orderby)> 0) { $sql .= "order by $orderby $order "; }
+		if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
 		$prep_statement = $db->prepare($sql);
 		if ($prep_statement) {
 			$prep_statement->execute();
@@ -45,7 +45,7 @@ require_once "includes/paging.php";
 		$param = "";
 		$page = $_GET['page'];
 		if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } 
-		list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page); 
+		list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page); 
 		$offset = $rows_per_page * $page; 
 
 	//get the invoice list
@@ -53,7 +53,7 @@ require_once "includes/paging.php";
 		$sql .= " select * from v_invoice_items ";
 		$sql .= " where domain_uuid = '$domain_uuid' ";
 		$sql .= " and invoice_uuid = '$invoice_uuid' ";
-		if (strlen($orderby)> 0) { $sql .= "order by $orderby $order "; }
+		if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
 		$sql .= " limit $rows_per_page offset $offset ";
 		$prep_statement = $db->prepare(check_sql($sql));
 		$prep_statement->execute();
@@ -62,15 +62,15 @@ require_once "includes/paging.php";
 		unset ($prep_statement, $sql);
 
 	$c = 0;
-	$row_style["0"] = "rowstyle0";
-	$row_style["1"] = "rowstyle1";
+	$row_style["0"] = "row_style0";
+	$row_style["1"] = "row_style1";
 
 	echo "<div align='center'>\n";
 	echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
 	echo "<tr>\n";
-	echo thorderby('item_qty', 'Quantity', $orderby, $order);
-	echo thorderby('item_unit_price', 'Unit Price', $orderby, $order);
-	echo thorderby('item_desc', 'Description', $orderby, $order);
+	echo thorder_by('item_qty', 'Quantity', $order_by, $order);
+	echo thorder_by('item_unit_price', 'Unit Price', $order_by, $order);
+	echo thorder_by('item_desc', 'Description', $order_by, $order);
 	echo "<th nowrap='nowrap'>Amount</th>\n";
 	echo "<td align='right' width='42'>\n";
 	echo "	<a href='v_invoice_items_edit.php?invoice_uuid=".$_GET['id']."&contact_uuid=".$contact_uuid."' alt='add'>$v_link_label_add</a>\n";

+ 6 - 6
invoices/v_invoice_items_edit.php

@@ -51,18 +51,21 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
 	//add or update the database
 	if ($_POST["persistformvar"] != "true") {
 		if ($action == "add") {
+			$invoice_item_uuid = uuid();
 			$sql = "insert into v_invoice_items ";
 			$sql .= "(";
-			$sql .= "invoice_uuid, ";
 			$sql .= "domain_uuid, ";
+			$sql .= "invoice_uuid, ";
+			$sql .= "invoice_item_uuid, ";
 			$sql .= "item_qty, ";
 			$sql .= "item_desc, ";
 			$sql .= "item_unit_price ";
 			$sql .= ")";
 			$sql .= "values ";
 			$sql .= "(";
-			$sql .= "'$invoice_uuid', ";
 			$sql .= "'$domain_uuid', ";
+			$sql .= "'$invoice_uuid', ";
+			$sql .= "'$invoice_item_uuid', ";
 			$sql .= "'$item_qty', ";
 			$sql .= "'$item_desc', ";
 			$sql .= "'$item_unit_price' ";
@@ -99,7 +102,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
 			return;
 		} //if ($action == "update")
 	} //if ($_POST["persistformvar"] != "true") 
-
 } //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
 
 //pre-populate the form
@@ -120,14 +122,12 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
 		unset ($prep_statement);
 	}
 
-
 //show the header
 	require_once "includes/header.php";
 
 //show the content
 	echo "<div align='center'>";
 	echo "<table width='100%' border='0' cellpadding='0' cellspacing=''>\n";
-
 	echo "<tr class='border'>\n";
 	echo "	<td align=\"left\">\n";
 	echo "	  <br>";
@@ -200,4 +200,4 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
 
 //include the footer
 	require_once "includes/footer.php";
-?>
+?>

+ 1 - 1
invoices/v_invoice_pdf.php

@@ -17,7 +17,7 @@
 
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2010
+	Portions created by the Initial Developer are Copyright (C) 2008-2012
 	the Initial Developer. All Rights Reserved.
 
 	Contributor(s):

+ 11 - 11
invoices/v_invoices.php

@@ -17,7 +17,7 @@
 
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2010
+	Portions created by the Initial Developer are Copyright (C) 2008-2012
 	the Initial Developer. All Rights Reserved.
 
 	Contributor(s):
@@ -37,7 +37,7 @@ require_once "includes/header.php";
 require_once "includes/paging.php";
 
 //get variables used to control the order
-	$orderby = $_GET["orderby"];
+	$order_by = $_GET["order_by"];
 	$order = $_GET["order"];
 
 //get the contact id
@@ -85,7 +85,7 @@ require_once "includes/paging.php";
 		$param = "";
 		$page = $_GET['page'];
 		if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } 
-		list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page); 
+		list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page); 
 		$offset = $rows_per_page * $page; 
 
 	//get the contact list
@@ -97,7 +97,7 @@ require_once "includes/paging.php";
 		if (strlen($contact_uuid) > 0) {
 			$sql .= "and v_invoices.contact_uuid_to = '$contact_uuid' ";
 		}
-		if (strlen($orderby)> 0) { $sql .= "order by v_invoices.$orderby $order "; }
+		if (strlen($order_by)> 0) { $sql .= "order by v_invoices.$order_by $order "; }
 		$sql .= " limit $rows_per_page offset $offset ";
 		$prep_statement = $db->prepare(check_sql($sql));
 		$prep_statement->execute();
@@ -106,17 +106,17 @@ require_once "includes/paging.php";
 		unset ($prep_statement, $sql);
 
 	$c = 0;
-	$row_style["0"] = "rowstyle0";
-	$row_style["1"] = "rowstyle1";
+	$row_style["0"] = "row_style0";
+	$row_style["1"] = "row_style1";
 
 	echo "<div align='center'>\n";
 	echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
 	echo "<tr>\n";
-	echo thorderby('invoice_number', 'Invoice Number', $orderby, $order);
-	echo thorderby('org', 'Organization', $orderby, $order);
-	echo thorderby('n_given', 'Given Name', $orderby, $order);
-	echo thorderby('n_family', 'Family Name', $orderby, $order);
-	echo thorderby('invoice_date', 'Date', $orderby, $order);
+	echo thorder_by('invoice_number', 'Invoice Number', $order_by, $order);
+	echo thorder_by('org', 'Organization', $order_by, $order);
+	echo thorder_by('n_given', 'Given Name', $order_by, $order);
+	echo thorder_by('n_family', 'Family Name', $order_by, $order);
+	echo thorder_by('invoice_date', 'Date', $order_by, $order);
 	echo "<td align='right' width='42'>\n";
 	echo "	<a href='v_invoices_edit.php?contact_uuid=".$_GET['id']."' alt='add'>$v_link_label_add</a>\n";
 	echo "</td>\n";

+ 15 - 12
invoices/v_invoices_edit.php

@@ -17,7 +17,7 @@
 
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2010
+	Portions created by the Initial Developer are Copyright (C) 2008-2012
 	the Initial Developer. All Rights Reserved.
 
 	Contributor(s):
@@ -77,9 +77,11 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
 	//add or update the database
 		if ($_POST["persistformvar"] != "true") {
 			if ($action == "add") {
+				$invoice_uuid = uuid();
 				$sql = "insert into v_invoices ";
 				$sql .= "(";
 				$sql .= "domain_uuid, ";
+				$sql .= "invoice_uuid, ";
 				$sql .= "invoice_number, ";
 				$sql .= "contact_uuid_from, ";
 				$sql .= "contact_uuid_to, ";
@@ -89,6 +91,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
 				$sql .= "values ";
 				$sql .= "(";
 				$sql .= "'$domain_uuid', ";
+				$sql .= "'$invoice_uuid', ";
 				$sql .= "'$invoice_number', ";
 				$sql .= "'$contact_uuid_from', ";
 				$sql .= "'$contact_uuid_to', ";
@@ -214,10 +217,10 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
 	$sql .= " select contact_uuid, org, n_given, n_family from v_contacts ";
 	$sql .= " where domain_uuid = '$domain_uuid' ";
 	$sql .= " order by org asc ";
-	$prepstatement = $db->prepare(check_sql($sql));
-	$prepstatement->execute();
-	$result = $prepstatement->fetchAll();
-	unset ($prepstatement, $sql);
+	$prep_statement = $db->prepare(check_sql($sql));
+	$prep_statement->execute();
+	$result = $prep_statement->fetchAll();
+	unset ($prep_statement, $sql);
 	echo "<select name=\"contact_uuid_from\" id=\"contact_uuid_from\" class=\"formfld\">\n";
 	echo "<option value=\"\"></option>\n";
 	foreach($result as $row) {
@@ -240,7 +243,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
 			echo "<option value=\"".$row['contact_uuid']."\">".$contact_name."</option>\n";
 		}
 	}
-	unset($sql, $result, $rowcount);
+	unset($sql, $result, $row_count);
 	echo "</select>\n";
 	echo "<br />\n";
 	echo "Select the Contact to send the send the invoice from. \n";
@@ -257,10 +260,10 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
 	$sql .= " select contact_uuid, org, n_given, n_family from v_contacts ";
 	$sql .= " where domain_uuid = '$domain_uuid' ";
 	$sql .= " order by org asc ";
-	$prepstatement = $db->prepare(check_sql($sql));
-	$prepstatement->execute();
-	$result = $prepstatement->fetchAll();
-	unset ($prepstatement, $sql);
+	$prep_statement = $db->prepare(check_sql($sql));
+	$prep_statement->execute();
+	$result = $prep_statement->fetchAll();
+	unset ($prep_statement, $sql);
 	echo "<select name=\"contact_uuid_to\" id=\"contact_uuid_to\" class=\"formfld\">\n";
 	echo "<option value=\"\"></option>\n";
 	foreach($result as $row) {
@@ -283,7 +286,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
 			echo "<option value=\"".$row['contact_uuid']."\">".$contact_name."</option>\n";
 		}
 	}
-	unset($sql, $result, $rowcount);
+	unset($sql, $result, $row_count);
 	echo "</select>\n";
 	echo "<br />\n";
 	echo "Select the Contact to send the send the invoice to. \n";
@@ -338,4 +341,4 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
 
 //include the footer
 	require_once "includes/footer.php";
-?>
+?>

+ 1 - 1
roku/roku.php

@@ -17,7 +17,7 @@
 
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2010
+	Portions created by the Initial Developer are Copyright (C) 2008-2012
 	the Initial Developer. All Rights Reserved.
 
 	Contributor(s):

+ 1 - 1
soft_phone/root.php

@@ -17,7 +17,7 @@
 
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2010
+	Portions created by the Initial Developer are Copyright (C) 2008-2012
 	the Initial Developer. All Rights Reserved.
 
 	Contributor(s):

+ 1 - 1
soft_phone/v_softphone.php

@@ -17,7 +17,7 @@
 
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2010
+	Portions created by the Initial Developer are Copyright (C) 2008-2012
 	the Initial Developer. All Rights Reserved.
 
 	Contributor(s):

+ 1 - 1
tickets/errors.php

@@ -17,7 +17,7 @@
 
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2010
+	Portions created by the Initial Developer are Copyright (C) 2008-2012
 	the Initial Developer. All Rights Reserved.
 
 	Contributor(s):

+ 2 - 2
tickets/manager_main.php

@@ -33,10 +33,10 @@ foreach($profiles_array as $profile){
 	<td><?php echo $profile['description']; ?></td>
 <td align='right' width='42'>
 	<?php if (permission_exists('xmpp_edit')) { ?>
-	<a href='v_profile_edit.php?id=<?php echo $profile['xmpp_profile_id']; ?>' alt='edit'><?php echo $v_link_label_edit; ?></a>
+	<a href='v_profile_edit.php?id=<?php echo $profile['xmpp_profile_uuid']; ?>' alt='edit'><?php echo $v_link_label_edit; ?></a>
 	<?php } ?>
 	<?php if (permission_exists('xmpp_delete')) { ?>
-	<a href='v_profile_delete.php?id=<?php echo $profile['xmpp_profile_id']; ?>' onclick="return confirm('Do you really want to delete this?')" 
+	<a href='v_profile_delete.php?id=<?php echo $profile['xmpp_profile_uuid']; ?>' onclick="return confirm('Do you really want to delete this?')" 
 		alt='delete'><?php echo $v_link_label_delete; ?></a>
 	<?php } ?>
 </td>

+ 1 - 1
tickets/root.php

@@ -17,7 +17,7 @@
 
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2010
+	Portions created by the Initial Developer are Copyright (C) 2008-2012
 	the Initial Developer. All Rights Reserved.
 
 	Contributor(s):

+ 1 - 1
tickets/ticket_create.php

@@ -59,7 +59,7 @@ Please include any addition contact information as may be required for us to wor
 </tr> 
 	<tr> 
 		<td colspan='2' align='right'> 
-				<input type='hidden' name='profile_id' value='<?php echo $profile['xmpp_profile_id']; ?>'> 
+				<input type='hidden' name='profile_id' value='<?php echo $profile['xmpp_profile_uuid']; ?>'> 
 				<input type='submit' name='submit' class='btn' value='Save'> 
 		</td> 
 	</tr></table></form>	</td>	</tr></table></div>

+ 7 - 7
tickets/ticket_list.php

@@ -23,18 +23,18 @@
 </td>
 </tr>
 <?php
-$rowstyle[0] = 'rowstyle0';
-$rowstyle[1] = 'rowstyle1';
+$row_style[0] = 'row_style0';
+$row_style[1] = 'row_style1';
 $rs = 1;
 foreach($tickets as $ticket){
 if ($rs == 1) { $rs = 0; } else { $rs = 1; }
 ?>
 <tr>
-	<td class="<?php echo $rowstyle[$rs]; ?>"><?php echo $ticket['ticket_number']; ?></td>
-	<td class="<?php echo $rowstyle[$rs]; ?>"><?php echo $queues[$ticket['queue_id']]; ?></td>
-        <td class="<?php echo $rowstyle[$rs]; ?>"><?php echo $statuses[$ticket['ticket_status']]; ?></td>
-	<td class="<?php echo $rowstyle[$rs]; ?>"><?php echo $ticket['last_update_stamp']; ?></td>
-	<td class="<?php echo $rowstyle[$rs]; ?>"><?php echo $ticket['subject']; ?></td>
+	<td class="<?php echo $row_style[$rs]; ?>"><?php echo $ticket['ticket_number']; ?></td>
+	<td class="<?php echo $row_style[$rs]; ?>"><?php echo $queues[$ticket['queue_id']]; ?></td>
+        <td class="<?php echo $row_style[$rs]; ?>"><?php echo $statuses[$ticket['ticket_status']]; ?></td>
+	<td class="<?php echo $row_style[$rs]; ?>"><?php echo $ticket['last_update_stamp']; ?></td>
+	<td class="<?php echo $row_style[$rs]; ?>"><?php echo $ticket['subject']; ?></td>
 <td align='right' width='42'>
 	<?php if (permission_exists('ticket_update')) { ?>
 	<a href='v_ticket_update.php?id=<?php echo $ticket['ticket_id']; ?>' alt='Update Ticket'><?php echo $v_link_label_edit; ?></a>

+ 12 - 12
tickets/ticket_manager.php

@@ -28,21 +28,21 @@
 <!-- <tr><td colspan='2'>Queues</td></tr> -->
 <tr><th>ID</th><th>Queue Name</th><th>Queue Email</th><td></td></tr>
 <?php 
-$rowstyle[0] = 'rowstyle0';
-$rowstyle[1] = 'rowstyle1';
+$row_style[0] = 'row_style0';
+$row_style[1] = 'row_style1';
 $rs = 0;
 foreach ($queues as $queue) { 
 if ($rs == 1) { $rs = 0; } else { $rs = 1; }
 ?>
 <form method='post' name='ifrm' action=''>
 <tr>
-<td width="10%" class='<?php echo $rowstyle[$rs]; ?>' align="center"><?php echo $queue['queue_id']; ?>
+<td width="10%" class='<?php echo $row_style[$rs]; ?>' align="center"><?php echo $queue['queue_id']; ?>
 	<input type="hidden" name="queue_id" value="<?php echo $queue['queue_id']; ?>"/>
 </td>
-<td width="20%" class='<?php echo $rowstyle[$rs]; ?>' align='left' nowrap='nowrap'> 
+<td width="20%" class='<?php echo $row_style[$rs]; ?>' align='left' nowrap='nowrap'> 
 	<input class='formfld' style="width:100%" type="text" name="queue_name" value="<?php echo $queue['queue_name']; ?>"/>
 </td> 
-<td width="70%" class='<?php echo $rowstyle[$rs]; ?>' align='left'> 
+<td width="70%" class='<?php echo $row_style[$rs]; ?>' align='left'> 
 	<input class='formfld' style="width:100%" type="text" name="queue_email" value="<?php echo $queue['queue_email']; ?>"/>
 </td>
 <td align='left' nowrap='nowrap'>
@@ -55,12 +55,12 @@ if ($rs == 1) { $rs = 0; } else { $rs = 1; }
 ?>
 <form method='post' name='ifrm' action=''>
 <tr>
-<td width="10%" class='<?php echo $rowstyle[$rs]; ?>' align="center" nowrap='nowrap'>
+<td width="10%" class='<?php echo $row_style[$rs]; ?>' align="center" nowrap='nowrap'>
 </td>
-<td width="20%" class='<?php echo $rowstyle[$rs]; ?>' align='left' nowrap='nowrap'> 
+<td width="20%" class='<?php echo $row_style[$rs]; ?>' align='left' nowrap='nowrap'> 
 	<input class='formfld' style="width:100%" type="text" name="queue_name" />
 </td> 
-<td width="70%" class='<?php echo $rowstyle[$rs]; ?>' align='left'> 
+<td width="70%" class='<?php echo $row_style[$rs]; ?>' align='left'> 
 	<input class='formfld' style="width:100%" type="text" name="queue_email" />
 </td>
 <td align='left' nowrap='nowrap'>
@@ -84,11 +84,11 @@ if ($rs == 1) { $rs = 0; } else { $rs = 1; }
 ?>
 <form method='post' name='ifrm' action=''>
 <tr> 
-<td class='<?php echo $rowstyle[$rs]; ?>' align='left' nowrap='nowrap' width="20%"> 
+<td class='<?php echo $row_style[$rs]; ?>' align='left' nowrap='nowrap' width="20%"> 
 	<input type="hidden" name="status_id" value="<?php echo $status['status_id']; ?>"/>
 	<?php echo $status['status_id']; ?>
 </td> 
-<td class='<?php echo $rowstyle[$rs]; ?>' align='left'> 
+<td class='<?php echo $row_style[$rs]; ?>' align='left'> 
 	<input class='formfld' type="text" style="width:100%" name="status_name" value="<?php echo $status['status_name']; ?>"/>
 </td> 
 <td align='left' nowrap='nowrap'>
@@ -101,9 +101,9 @@ if ($rs == 1) { $rs = 0; } else { $rs = 1; }
 ?>
 <form method='post' name='ifrm' action=''>
 <tr> 
-<td class='<?php echo $rowstyle[$rs]; ?>' align='left' nowrap='nowrap' width="20%"> 
+<td class='<?php echo $row_style[$rs]; ?>' align='left' nowrap='nowrap' width="20%"> 
 </td> 
-<td class='<?php echo $rowstyle[$rs]; ?>' align='left'> 
+<td class='<?php echo $row_style[$rs]; ?>' align='left'> 
 	<input class='formfld' type="text" style="width:100%" name="status_name"/>
 </td> 
 <td align='left' nowrap='nowrap'>

+ 8 - 8
tickets/ticket_update.php

@@ -96,8 +96,8 @@
 	<select name="ticket_owner">
 		<option value=''>--</option>
 		<?php foreach ($queue_members as $qm) {
-			echo "<option value='" . $qm['user_id'] . "' ";
-			if ($qm['user_id'] == $ticket_header['ticket_owner']) echo "selected='selected'";
+			echo "<option value='" . $qm['user_uuid'] . "' ";
+			if ($qm['user_uuid'] == $ticket_header['ticket_owner']) echo "selected='selected'";
 			echo ">" . $qm['username'] . "</option>\n";
 		}
 		?>
@@ -161,28 +161,28 @@
 <tr><td colspan='2'><table width='100%' border="0" cellpadding="0" cellspacing="0">
 	<tr><th colspan='2'>Ticket Notes</th></tr>
 	<tr>
-	<td width="30%" class='rowstyle0' valign='top' align='left' nowrap='nowrap'>
+	<td width="30%" class='row_style0' valign='top' align='left' nowrap='nowrap'>
 			<input type="checkbox" name="alert_user" value="1"/>Alert User<br>
 			Attach File<br />
 			<input type="file" name="file" id="file" />
 	</td>
-	<td class='rowstyle0' align='left'>
+	<td class='row_style0' align='left'>
 		<textarea rows='5' cols='80' class='formfld' type='text' name='new_note'></textarea>
 	</td>
 	</tr>
 	<?php 
-$rowstyle[0] = 'rowstyle0';
-$rowstyle[1] = 'rowstyle1';
+$row_style[0] = 'row_style0';
+$row_style[1] = 'row_style1';
 $rs = 0;
 foreach($ticket_notes as $tn) { 
 if ($rs == 1) { $rs = 0; } else { $rs = 1; }
 ?>
 	<tr>
-		<td width="30%" class="<?php echo $rowstyle[$rs]; ?>" valign='top' align='left' nowrap='nowrap'>
+		<td width="30%" class="<?php echo $row_style[$rs]; ?>" valign='top' align='left' nowrap='nowrap'>
 			Updated: <?php echo $tn['create_stamp']; ?><br/>By: <?php echo $ticket_header['username']; ?>
 			<?php if (strlen($tn['file_pointer']) > 1) echo "<br>File Attachment: " . $tn['file_pointer']; ?>
 		</td>
-		<td class="<?php echo $rowstyle[$rs]; ?>" align='left'>
+		<td class="<?php echo $row_style[$rs]; ?>" align='left'>
 			<?php echo base64_decode($tn['ticket_note']); ?>
 		</td>
 	</tr>

+ 9 - 9
tickets/v_manager.php

@@ -18,7 +18,7 @@
 
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2010
+	Portions created by the Initial Developer are Copyright (C) 2008-2012
 	the Initial Developer. All Rights Reserved.
 
 	Contributor(s):
@@ -79,27 +79,27 @@ $sql = "";
 $sql .= "select * from v_ticket_statuses ";
 $sql .= "where domain_uuid = $domain_uuid ";
 $sql .= "order by status_id ";
-$prepstatement = $db->prepare(check_sql($sql));
-$prepstatement->execute();
+$prep_statement = $db->prepare(check_sql($sql));
+$prep_statement->execute();
 $x = 0;
-$result = $prepstatement->fetchAll();
+$result = $prep_statement->fetchAll();
 foreach ($result as &$row) {
 	$statuses[$row['status_id']] = $row;
 }
-unset ($prepstatement);
+unset ($prep_statement);
 
 $sql = "";
 $sql .= "select * from v_ticket_queues ";
 $sql .= "where domain_uuid = $domain_uuid ";
 $sql .= "order by queue_id ";
-$prepstatement = $db->prepare(check_sql($sql));
-$prepstatement->execute();
+$prep_statement = $db->prepare(check_sql($sql));
+$prep_statement->execute();
 $x = 0;
-$result = $prepstatement->fetchAll();
+$result = $prep_statement->fetchAll();
 foreach ($result as &$row) {
 	$queues[$row['queue_id']] = $row;
 }
-unset ($prepstatement);
+unset ($prep_statement);
 
 //include the view
 include "ticket_manager.php";

+ 7 - 7
tickets/v_profile_delete.php

@@ -18,7 +18,7 @@
 
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2010
+	Portions created by the Initial Developer are Copyright (C) 2008-2012
 	the Initial Developer. All Rights Reserved.
 
 	Contributor(s):
@@ -45,25 +45,25 @@ $profile_id = $_REQUEST['id'];
 $sql = "";
 $sql .= "select * from v_xmpp ";
 $sql .= "where domain_uuid = '$domain_uuid' ";
-$sql .= "and xmpp_profile_id = '$profile_id' ";
+$sql .= "and xmpp_profile_uuid = '$profile_id' ";
 
-$prepstatement = $db->prepare(check_sql($sql));
-$prepstatement->execute();
+$prep_statement = $db->prepare(check_sql($sql));
+$prep_statement->execute();
 
 $x = 0;
-$result = $prepstatement->fetchAll();
+$result = $prep_statement->fetchAll();
 foreach ($result as &$row) {
 	$profiles_array[$x] = $row;
 	$x++;
 }
 
 $profile = $profiles_array[0];
-unset ($prepstatement);
+unset ($prep_statement);
 
 $sql = "";
 $sql .= "delete from v_xmpp ";
 $sql .= "where domain_uuid = '$domain_uuid' ";
-$sql .= "and xmpp_profile_id = '$profile_id' ";
+$sql .= "and xmpp_profile_uuid = '$profile_id' ";
 
 $db->exec(check_sql($sql));
 

+ 18 - 18
tickets/v_ticket_create.php

@@ -18,7 +18,7 @@
 
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2010
+	Portions created by the Initial Developer are Copyright (C) 2008-2012
 	the Initial Developer. All Rights Reserved.
 
 	Contributor(s):
@@ -47,15 +47,15 @@ $sql = "";
 $sql .= "select * from v_ticket_queues ";
 $sql .= "where domain_uuid = '$domain_uuid' ";
 $sql .= "order by queue_name ";
-$prepstatement = $db->prepare(check_sql($sql));
-$prepstatement->execute();
+$prep_statement = $db->prepare(check_sql($sql));
+$prep_statement->execute();
 $x = 0; 
-$result = $prepstatement->fetchAll();
+$result = $prep_statement->fetchAll();
 foreach ($result as &$row) { 
         $queues[$x] = $row;
         $x++;
 }
-unset ($prepstatement);
+unset ($prep_statement);
 
 //add or update the database
 if (isset($_REQUEST["id"])) {
@@ -99,12 +99,12 @@ if ($action == "add" && permission_exists('ticket_add')) {
 	$sql .= "insert into v_tickets (";
  	$sql .= "domain_uuid, ";
  	$sql .= "queue_id, ";
- 	$sql .= "user_id, ";
+ 	$sql .= "user_uuid, ";
  	$sql .= "customer_id, ";
  	$sql .= "subject, ";
  	$sql .= "create_user_id, ";
  	$sql .= "create_stamp, ";
- 	$sql .= "last_update_user_id, ";
+ 	$sql .= "last_update_user_uuid, ";
  	$sql .= "last_update_stamp, ";
  	$sql .= "ticket_uuid, ";
  	$sql .= "ticket_status, ";
@@ -112,12 +112,12 @@ if ($action == "add" && permission_exists('ticket_add')) {
 	$sql .= ") values (";
  	$sql .= "$domain_uuid, ";
  	$sql .= "'" . $request['queue_id'] . "', ";
- 	$sql .= "'" . $_SESSION['user_id'] . "', ";
+ 	$sql .= "'" . $_SESSION['user_uuid'] . "', ";
  	$sql .= "'" . $_SESSION['customer_id'] . "', ";
  	$sql .= "'" . $request['subject'] . "', ";
- 	$sql .= "'" . $_SESSION['user_id'] . "', ";
+ 	$sql .= "'" . $_SESSION['user_uuid'] . "', ";
  	$sql .= "now(), ";
- 	$sql .= "'" . $_SESSION['user_id'] . "', ";
+ 	$sql .= "'" . $_SESSION['user_uuid'] . "', ";
  	$sql .= "now(), ";
  	$sql .= "'" . $ticket_uuid . "', ";
  	$sql .= "'1', ";
@@ -125,9 +125,9 @@ if ($action == "add" && permission_exists('ticket_add')) {
 	$sql .= ") ";
 	if ($db_type == "pgsql") {
 	 	$sql .= "RETURNING ticket_id;";
-		$prepstatement = $db->prepare(check_sql($sql));
-		$prepstatement->execute();
-        	$result = $prepstatement->fetchAll();
+		$prep_statement = $db->prepare(check_sql($sql));
+		$prep_statement->execute();
+        	$result = $prep_statement->fetchAll();
 		$ticket_id = $result[0]['ticket_id'];
 	} elseif ($db_type == "sqlite" || $db_type == "mysql" ) {
                 $db->exec(check_sql($sql));
@@ -147,7 +147,7 @@ if ($action == "add" && permission_exists('ticket_add')) {
 	$sql .= "ticket_note ";
 	$sql .= ") VALUES ( ";
 	$sql .= "$ticket_id, ";
-	$sql .= "'" . $_SESSION['user_id'] . "', ";
+	$sql .= "'" . $_SESSION['user_uuid'] . "', ";
 	$sql .= "now(), ";
 	$sql .= "'" . base64_encode($request['problem_description']) . "' ";
 	$sql .= ") ";
@@ -158,10 +158,10 @@ if ($action == "add" && permission_exists('ticket_add')) {
 	$sql .= "SELECT * from v_ticket_queues ";
 	$sql .= "where queue_id = " . $request['queue_id'] . " ";
 	$sql .= "and domain_uuid = $domain_uuid ";
-	$prepstatement = $db->prepare(check_sql($sql));
-	$prepstatement->execute();
+	$prep_statement = $db->prepare(check_sql($sql));
+	$prep_statement->execute();
 	$x = 0; 
-	$result = $prepstatement->fetchAll();
+	$result = $prep_statement->fetchAll();
 	foreach ($result as &$row) { 
         	$queue = $row;
         	break;
@@ -177,7 +177,7 @@ if ($action == "add" && permission_exists('ticket_add')) {
 	$from = "From: " . $_SESSION['support_email'];
 	mail($to, $subject, $message, $from);
 
-unset ($prepstatement);
+unset ($prep_statement);
 
 
 

+ 39 - 41
tickets/v_ticket_update.php

@@ -18,7 +18,7 @@
 
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2010
+	Portions created by the Initial Developer are Copyright (C) 2008-2012
 	the Initial Developer. All Rights Reserved.
 
 	Contributor(s):
@@ -61,18 +61,17 @@ if (isset($_REQUEST['id']) || isset($_REQUEST['uuid'])) {
 	//Redirect back outta here probably
 }
 
-
 if ($action == "update") {
 
-//get the ticket
+	//get the ticket
 	$sql = "";
-	$sql .= "select a.ticket_id, a.queue_id, a.domain_uuid, a.user_id, a.customer_id, a.subject, ";
+	$sql .= "select a.ticket_id, a.queue_id, a.domain_uuid, a.user_uuid, a.customer_id, a.subject, ";
 	$sql .= "to_char(a.create_stamp, 'MM-DD-YY HH24-MI-SS') as create_stamp, a.create_user_id, ";
 	$sql .= "a.ticket_status, to_char(a.last_update_stamp, 'MM-DD-YY HH24-MI-SS') as last_update_stamp, ";
-	$sql .= "a.last_update_user_id, a.ticket_uuid, a.ticket_number, a.ticket_owner, a.customer_ticket_number, ";
+	$sql .= "a.last_update_user_uuid, a.ticket_uuid, a.ticket_number, a.ticket_owner, a.customer_ticket_number, ";
 	$sql .= "b.username, c.username as create_username, d.username as last_update_username ";
 	$sql .= "from v_tickets as a, v_users as b, v_users as c, v_users as d ";
-	$sql .= "where a.user_id = b.id and a.create_user_id = c.id and a.last_update_user_id = d.id ";
+	$sql .= "where a.user_uuid = b.id and a.create_user_id = c.id and a.last_update_user_uuid = d.id ";
 	$sql .= "and a.domain_uuid = '$domain_uuid' ";
 	if (isset($_REQUEST["id"])) { 
 		$sql .= "and a.ticket_id = '$ticket_id' ";
@@ -81,19 +80,19 @@ if ($action == "update") {
 		$sql .= "and a.ticket_uuid = '$ticket_uuid' ";
 	}
 	if (!$isadmin) {
-		$sql .= "and a.user_id = " . $_SESSION['user_id'] . " ";
+		$sql .= "and a.user_uuid = " . $_SESSION['user_uuid'] . " ";
 	}
 
-	$prepstatement = $db->prepare(check_sql($sql));
-	$prepstatement->execute();
+	$prep_statement = $db->prepare(check_sql($sql));
+	$prep_statement->execute();
 	$x = 0;
-	$result = $prepstatement->fetchAll();
+	$result = $prep_statement->fetchAll();
 	foreach ($result as &$row) {
 		$ticket_header = $row;
 		$x++;
 		break;
 	}
-	unset ($prepstatement);
+	unset ($prep_statement);
 
 	if ($x < 1) {
 		include "bad_ticket_id.php";
@@ -104,58 +103,57 @@ if ($action == "update") {
 	$sql .= "SELECT * from v_ticket_notes ";
 	$sql .= "where ticket_id = " . $ticket_header['ticket_id'] . " ";
 	$sql .= "order by create_stamp ";
-	$prepstatement = $db->prepare(check_sql($sql));
-	$prepstatement->execute();
+	$prep_statement = $db->prepare(check_sql($sql));
+	$prep_statement->execute();
 	$x = 0;
-	$result = $prepstatement->fetchAll();
+	$result = $prep_statement->fetchAll();
 	foreach ($result as &$row) {
 		$ticket_notes[$x] = $row;
 		$x++;
 	}
-	unset ($prepstatement);
+	unset ($prep_statement);
 
 	$sql = "";
 	$sql .= "select a.*, c.username from v_ticket_queue_members as a, v_users as c ";
-	$sql .= "where a.user_id = c.id ";
+	$sql .= "where a.user_uuid = c.id ";
 	$sql .= "and a.queue_id = " . $ticket_header['queue_id'] . " ";
-
-	$prepstatement = $db->prepare(check_sql($sql));
-	$prepstatement->execute();
+	$prep_statement = $db->prepare(check_sql($sql));
+	$prep_statement->execute();
 	$x = 0;
-	$result = $prepstatement->fetchAll();
+	$result = $prep_statement->fetchAll();
 	foreach ($result as &$row) {
 		$queue_members[$x] = $row;
 		$x++;
 	}
-	unset ($prepstatement);
+	unset ($prep_statement);
 
 	$sql = "";
 	$sql .= "SELECT * from v_ticket_statuses ";
 	$sql .= "where domain_uuid = $domain_uuid ";
 	$sql .= "ORDER by status_id ";
-	$prepstatement = $db->prepare(check_sql($sql));
-	$prepstatement->execute();
+	$prep_statement = $db->prepare(check_sql($sql));
+	$prep_statement->execute();
 	$x = 0;
-	$result = $prepstatement->fetchAll();
+	$result = $prep_statement->fetchAll();
 	foreach ($result as &$row) {
 		$ticket_statuses[$x] = $row;
 		$x++;
 	}
-	unset ($prepstatement);
+	unset ($prep_statement);
 
 	$sql = "";
 	$sql .= "SELECT * from v_ticket_queues ";
 	$sql .= "where domain_uuid = $domain_uuid ";
 	$sql .= "ORDER by queue_name ";
-	$prepstatement = $db->prepare(check_sql($sql));
-	$prepstatement->execute();
+	$prep_statement = $db->prepare(check_sql($sql));
+	$prep_statement->execute();
 	$x = 0;
-	$result = $prepstatement->fetchAll();
+	$result = $prep_statement->fetchAll();
 	foreach ($result as &$row) {
 		$ticket_queues[$x] = $row;
 		$x++;
 	}
-	unset ($prepstatement);
+	unset ($prep_statement);
 } 
 
 if ((!isset($_REQUEST['submit'])) || ($_REQUEST['submit'] != 'Save')) {
@@ -179,7 +177,7 @@ if ($action == "update" && permission_exists('ticket_update')) {
 		$sql .= ") values ( ";
 		$sql .= $ticket_header['ticket_id'] . ", ";
 		$sql .= "now(), ";
-		$sql .= $_SESSION['user_id'] . ", ";
+		$sql .= $_SESSION['user_uuid'] . ", ";
 		$sql .= "'" . base64_encode($request['new_note']) . "' ";
 		$sql .= ")";
 		$db->exec(check_sql($sql));
@@ -190,7 +188,7 @@ if ($action == "update" && permission_exists('ticket_update')) {
 	$sql .= "UPDATE v_tickets set ";
 	if ($ticket_header['ticket_owner'] != $request['ticket_owner']) {
 		$sql .= "ticket_owner = " . $request['ticket_owner'] . ", ";
-		if ($_SESSION['user_id'] != $request['ticket_owner']) {
+		if ($_SESSION['user_uuid'] != $request['ticket_owner']) {
 			$alert_new_owner = true;
 		}
 	}
@@ -200,22 +198,22 @@ if ($action == "update" && permission_exists('ticket_update')) {
 	if ($ticket_header['queue_id'] != $request['queue_id']) {
 		$sql .= "queue_id = " . $request['queue_id'] . ", ";
 	}
-	$sql .= "last_update_user_id = " . $_SESSION['user_id'] . ", ";
+	$sql .= "last_update_user_uuid = " . $_SESSION['user_uuid'] . ", ";
 	$sql .= "last_update_stamp = now() ";
 	$sql .= "where ticket_id = " . $ticket_header['ticket_id'] . " ";
 	$db->exec(check_sql($sql));
 
 	if ($note_added && $request['alert_user']) {
-		$sql = "select user_email from v_users where id = . " . $ticket_header['user_id'];
-	        $prepstatement = $db->prepare(check_sql($sql));
-		$prepstatement->execute();
+		$sql = "select user_email from v_users where id = . " . $ticket_header['user_uuid'];
+	        $prep_statement = $db->prepare(check_sql($sql));
+		$prep_statement->execute();
 		$x = 0;
-		$result = $prepstatement->fetchAll();
+		$result = $prep_statement->fetchAll();
 		foreach ($result as &$row) {
 			$user_email = $row['user_email'];
 			break;
 		}
-		unset ($prepstatement);
+		unset ($prep_statement);
 
 		if (strlen($user_email) > 1) {
 			$subject = sprintf("[%s] Ticket %s Updated", $queue['queue_name'], $ticket_header['ticket_number']);
@@ -232,15 +230,15 @@ if ($action == "update" && permission_exists('ticket_update')) {
 	
 	if ($alert_new_owner) {
 		$sql = "select user_email from v_users where id = . " . $request['ticket_owner'];
-	        $prepstatement = $db->prepare(check_sql($sql));
-		$prepstatement->execute();
+	        $prep_statement = $db->prepare(check_sql($sql));
+		$prep_statement->execute();
 		$x = 0;
-		$result = $prepstatement->fetchAll();
+		$result = $prep_statement->fetchAll();
 		foreach ($result as &$row) {
 			$user_email = $row['user_email'];
 			break;
 		}
-		unset ($prepstatement);
+		unset ($prep_statement);
 
 		if (strlen($user_email) > 1) {
 			$subject = sprintf("[%s] Ticket %s Updated", $queue['queue_name'], $ticket_header['ticket_number']);

+ 14 - 14
tickets/v_tickets.php

@@ -18,7 +18,7 @@
 
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2010
+	Portions created by the Initial Developer are Copyright (C) 2008-2012
 	the Initial Developer. All Rights Reserved.
 
 	Contributor(s):
@@ -50,41 +50,41 @@ if (!$show_closed) {
 	$sql .= "and ticket_status < 6 ";
 }
 if (!ifgroup("superadmin") && !ifgroup("admin")){
-	$sql .= "and user_id = " . $_SESSION['user_id'] . " ";
+	$sql .= "and user_uuid = " . $_SESSION['user_uuid'] . " ";
 }
 $sql .= "order by ticket_status, queue_id ";
-$prepstatement = $db->prepare(check_sql($sql));
-$prepstatement->execute();
+$prep_statement = $db->prepare(check_sql($sql));
+$prep_statement->execute();
 $x = 0;
-$result = $prepstatement->fetchAll();
+$result = $prep_statement->fetchAll();
 foreach ($result as &$row) {
 	$tickets[$x] = $row;
 	$x++;
 }
-unset ($prepstatement);
+unset ($prep_statement);
 
 $sql = "";
 $sql .= "select * from v_ticket_statuses ";
-$prepstatement = $db->prepare(check_sql($sql));
-$prepstatement->execute();
+$prep_statement = $db->prepare(check_sql($sql));
+$prep_statement->execute();
 $x = 0;
-$result = $prepstatement->fetchAll();
+$result = $prep_statement->fetchAll();
 foreach ($result as &$row) {
 	$statuses[$row['status_id']] = $row['status_name'];
 }
-unset ($prepstatement);
+unset ($prep_statement);
 
 $sql = "";
 $sql .= "select * from v_ticket_queues ";
 $sql .= "where domain_uuid = $domain_uuid ";
-$prepstatement = $db->prepare(check_sql($sql));
-$prepstatement->execute();
+$prep_statement = $db->prepare(check_sql($sql));
+$prep_statement->execute();
 $x = 0;
-$result = $prepstatement->fetchAll();
+$result = $prep_statement->fetchAll();
 foreach ($result as &$row) {
 	$queues[$row['queue_id']] = $row['queue_name'];
 }
-unset ($prepstatement);
+unset ($prep_statement);
 
 //include the view
 include "ticket_list.php";

+ 1 - 1
user_contacts/root.php

@@ -17,7 +17,7 @@
 
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2010
+	Portions created by the Initial Developer are Copyright (C) 2008-2012
 	the Initial Developer. All Rights Reserved.
 
 	Contributor(s):

+ 42 - 46
user_contacts/users.php

@@ -17,7 +17,7 @@
 
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2010
+	Portions created by the Initial Developer are Copyright (C) 2008-2012
 	the Initial Developer. All Rights Reserved.
 
 	Contributor(s):
@@ -38,7 +38,7 @@ require_once "includes/header.php";
 require_once "includes/paging.php";
 
 //get the http values and set them as php variables
-	$orderby = $_GET["orderby"];
+	$order_by = $_GET["order_by"];
 	$order = $_GET["order"];
 
 //show the content
@@ -57,46 +57,45 @@ require_once "includes/paging.php";
 	$sql = "";
 	$sql .= "select * from v_users ";
 	$sql .= "where domain_uuid = '$domain_uuid' ";
-	if (strlen($orderby)> 0) { $sql .= "order by $orderby $order "; }
-	$prepstatement = $db->prepare(check_sql($sql));
-	$prepstatement->execute();
-	$result = $prepstatement->fetchAll();
-	$numrows = count($result);
-	unset ($prepstatement, $result, $sql);
-
-	$rowsperpage = 150;
+	if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
+	$prep_statement = $db->prepare(check_sql($sql));
+	$prep_statement->execute();
+	$result = $prep_statement->fetchAll();
+	$num_rows = count($result);
+	unset ($prep_statement, $result, $sql);
+
+	$rows_per_page = 150;
 	$param = "";
 	$page = $_GET['page'];
 	if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } 
-	list($pagingcontrols, $rowsperpage, $var3) = paging($numrows, $param, $rowsperpage); 
-	$offset = $rowsperpage * $page; 
+	list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page); 
+	$offset = $rows_per_page * $page; 
 
 	$sql = "";
 	$sql .= "select * from v_users ";
-	if (strlen($orderby)> 0) { $sql .= "order by $orderby $order "; }
+	if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
 	$sql .= "where domain_uuid = '$domain_uuid' ";
-	$sql .= "limit $rowsperpage offset $offset ";
-	$prepstatement = $db->prepare(check_sql($sql));
-	$prepstatement->execute();
-	$result = $prepstatement->fetchAll();
-	$resultcount = count($result);
-	unset ($prepstatement, $sql);
+	$sql .= "limit $rows_per_page offset $offset ";
+	$prep_statement = $db->prepare(check_sql($sql));
+	$prep_statement->execute();
+	$result = $prep_statement->fetchAll();
+	$result_count = count($result);
+	unset ($prep_statement, $sql);
 
 	$c = 0;
-	$rowstyle["0"] = "rowstyle0";
-	$rowstyle["1"] = "rowstyle1";
+	$row_style["0"] = "row_style0";
+	$row_style["1"] = "row_style1";
 
 	echo "<div align='center'>\n";
 	echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
-
 	echo "<tr>\n";
-	echo thorderby('username', 'Username', $orderby, $order);
-	echo thorderby('user_type', 'Type', $orderby, $order);
-	echo thorderby('user_category', 'Category', $orderby, $order);
-	echo thorderby('user_first_name', 'First Name', $orderby, $order);
-	echo thorderby('user_last_name', 'Last Name', $orderby, $order);
-	echo thorderby('user_company_name', 'Organization', $orderby, $order);
-	echo thorderby('user_phone_1', 'Phone', $orderby, $order);
+	echo thorder_by('username', 'Username', $order_by, $order);
+	echo thorder_by('user_type', 'Type', $order_by, $order);
+	echo thorder_by('user_category', 'Category', $order_by, $order);
+	echo thorder_by('user_first_name', 'First Name', $order_by, $order);
+	echo thorder_by('user_last_name', 'Last Name', $order_by, $order);
+	echo thorder_by('user_company_name', 'Organization', $order_by, $order);
+	echo thorder_by('user_phone_1', 'Phone', $order_by, $order);
 	echo "<td align='right' width='42'>\n";
 	if (permission_exists('contacts_add')) {
 		echo "	<a href='users_edit.php' alt='add'>$v_link_label_add</a>\n";
@@ -104,36 +103,33 @@ require_once "includes/paging.php";
 	echo "</td>\n";
 	echo "<tr>\n";
 
-	if ($resultcount == 0) {
-		//no results
-	}
-	else { //received results
+	if ($result_count > 0) {
 		foreach($result as $row) {
 			echo "<tr >\n";
 			if (strlen($row[username]) == 0) {
-				echo "	<td valign='top' class='".$rowstyle[$c]."'>contact&nbsp;</td>\n";
+				echo "	<td valign='top' class='".$row_style[$c]."'>contact&nbsp;</td>\n";
 			}
 			else {
-				echo "	<td valign='top' class='".$rowstyle[$c]."'>".$row[username]."&nbsp;</td>\n";
+				echo "	<td valign='top' class='".$row_style[$c]."'>".$row['username']."&nbsp;</td>\n";
 			}
-			echo "	<td valign='top' class='".$rowstyle[$c]."'>".$row[user_type]."&nbsp;</td>\n";
-			echo "	<td valign='top' class='".$rowstyle[$c]."'>".$row[user_category]."&nbsp;</td>\n";
-			echo "	<td valign='top' class='".$rowstyle[$c]."'>".$row[user_first_name]."&nbsp;</td>\n";
-			echo "	<td valign='top' class='".$rowstyle[$c]."'>".$row[user_last_name]."&nbsp;</td>\n";
-			echo "	<td valign='top' class='".$rowstyle[$c]."'>".$row[user_company_name]."&nbsp;</td>\n";
-			echo "	<td valign='top' class='".$rowstyle[$c]."'>".$row[user_phone_1]."&nbsp;</td>\n";
+			echo "	<td valign='top' class='".$row_style[$c]."'>".$row['user_type']."&nbsp;</td>\n";
+			echo "	<td valign='top' class='".$row_style[$c]."'>".$row['user_category']."&nbsp;</td>\n";
+			echo "	<td valign='top' class='".$row_style[$c]."'>".$row['user_first_name']."&nbsp;</td>\n";
+			echo "	<td valign='top' class='".$row_style[$c]."'>".$row['user_last_name']."&nbsp;</td>\n";
+			echo "	<td valign='top' class='".$row_style[$c]."'>".$row['user_company_name']."&nbsp;</td>\n";
+			echo "	<td valign='top' class='".$row_style[$c]."'>".$row['user_phone_1']."&nbsp;</td>\n";
 			echo "	<td valign='top' align='right'>\n";
 			if (permission_exists('contacts_edit')) {
-				echo "		<a href='users_edit.php?id=".$row[id]."' alt='edit'>$v_link_label_edit</a>\n";
+				echo "		<a href='users_edit.php?id=".$row['user_uuid']."' alt='edit'>$v_link_label_edit</a>\n";
 			}
 			if (permission_exists('contacts_delete')) {
-				echo "		<a href='users_delete.php?id=".$row[id]."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
+				echo "		<a href='users_delete.php?id=".$row['user_uuid']."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
 			}
 			echo "	</td>\n";
 			echo "</tr>\n";
 			if ($c==0) { $c=1; } else { $c=0; }
 		} //end foreach
-		unset($sql, $result, $rowcount);
+		unset($sql, $result);
 	} //end if results
 
 	echo "<tr>\n";
@@ -141,7 +137,7 @@ require_once "includes/paging.php";
 	echo "	<table width='100%' cellpadding='0' cellspacing='0'>\n";
 	echo "	<tr>\n";
 	echo "		<td width='33.3%' nowrap>&nbsp;</td>\n";
-	echo "		<td width='33.3%' align='center' nowrap>$pagingcontrols</td>\n";
+	echo "		<td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
 	echo "		<td width='33.3%' align='right'>\n";
 	if (permission_exists('contacts_add')) {
 		echo "			<a href='users_edit.php' alt='add'>$v_link_label_add</a>\n";
@@ -165,4 +161,4 @@ require_once "includes/paging.php";
 
 //show the footer
 	require_once "includes/footer.php";
-?>
+?>

+ 3 - 3
user_contacts/users_delete.php

@@ -17,7 +17,7 @@
 
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2010
+	Portions created by the Initial Developer are Copyright (C) 2008-2012
 	the Initial Developer. All Rights Reserved.
 
 	Contributor(s):
@@ -45,8 +45,8 @@ else {
 		$sql .= "delete from v_users ";
 		$sql .= "where domain_uuid = '$domain_uuid' ";
 		$sql .= "and id = '$id' ";
-		$prepstatement = $db->prepare(check_sql($sql));
-		$prepstatement->execute();
+		$prep_statement = $db->prepare(check_sql($sql));
+		$prep_statement->execute();
 		unset($sql);
 	}
 

+ 10 - 8
user_contacts/users_edit.php

@@ -17,7 +17,7 @@
 
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2010
+	Portions created by the Initial Developer are Copyright (C) 2008-2012
 	the Initial Developer. All Rights Reserved.
 
 	Contributor(s):
@@ -37,7 +37,7 @@ else {
 //set the action to an add or update
 	if (isset($_REQUEST["id"])) {
 		$action = "update";
-		$id = check_str($_REQUEST["id"]);
+		$user_uuid = check_str($_REQUEST["id"]);
 	}
 	else {
 		$action = "add";
@@ -164,6 +164,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
 					$sql = "insert into v_users ";
 					$sql .= "(";
 					$sql .= "domain_uuid, ";
+					$sql .= "user_uuid, ";
 					//$sql .= "username, ";
 					//$sql .= "password, ";
 					$sql .= "user_type, ";
@@ -213,6 +214,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
 					$sql .= "values ";
 					$sql .= "(";
 					$sql .= "'$domain_uuid', ";
+					$sql .= "'".uuid()."', ";
 					//$sql .= "'$username', ";
 					//$sql .= "'$password', ";
 					$sql .= "'$user_type', ";
@@ -321,7 +323,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
 					//$sql .= "user_add_user = '$user_add_user', ";
 					//$sql .= "user_add_date = '$user_add_date' ";
 					$sql .= "where domain_uuid = '$domain_uuid' ";
-					$sql .= "and id = '$id' ";
+					$sql .= "and user_uuid = '$id' ";
 					$db->exec(check_sql($sql));
 					unset($sql);
 
@@ -343,9 +345,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
 			$sql .= "select * from v_users ";
 			$sql .= "where domain_uuid = '$domain_uuid' ";
 			$sql .= "and id = '$id' ";
-			$prepstatement = $db->prepare(check_sql($sql));
-			$prepstatement->execute();
-			$result = $prepstatement->fetchAll();
+			$prep_statement = $db->prepare(check_sql($sql));
+			$prep_statement->execute();
+			$result = $prep_statement->fetchAll();
 			foreach ($result as &$row) {
 				//$username = $row["username"];
 				//$password = $row["password"];
@@ -394,7 +396,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
 				//$user_add_date = $row["user_add_date"];
 				break; //limit to 1 row
 			}
-			unset ($prepstatement);
+			unset ($prep_statement);
 		}
 
 	//show the header
@@ -1008,7 +1010,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
 			echo "	<tr>\n";
 			echo "		<td colspan='2' align='right'>\n";
 			if ($action == "update") {
-				echo "				<input type='hidden' name='id' value='$id'>\n";
+				echo "				<input type='hidden' name='id' value='$user_uuid'>\n";
 			}
 			echo "				<input type='submit' name='submit' class='btn' value='Save'>\n";
 			echo "		</td>\n";

+ 5 - 5
user_contacts/users_vcard.php

@@ -17,7 +17,7 @@
 
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2010
+	Portions created by the Initial Developer are Copyright (C) 2008-2012
 	the Initial Developer. All Rights Reserved.
 
 	Contributor(s):
@@ -43,9 +43,9 @@ if (count($_GET)>0) {
 	$sql .= "select * from v_users ";
 	$sql .= "where domain_uuid = '$domain_uuid' ";
 	$sql .= "and id = '$id' ";
-	$prepstatement = $db->prepare(check_sql($sql));
-	$prepstatement->execute();
-	$result = $prepstatement->fetchAll();
+	$prep_statement = $db->prepare(check_sql($sql));
+	$prep_statement->execute();
+	$result = $prep_statement->fetchAll();
 	foreach ($result as &$row) {
 
 		$vc->data[display_name] = $row["user_first_name"]." ".$row["user_last_name"];
@@ -127,7 +127,7 @@ if (count($_GET)>0) {
 
 		break; //limit to 1 row
 	}
-	unset ($prepstatement);
+	unset ($prep_statement);
 }
 
 $vc->download();

+ 1 - 1
users_bulk_add/root.php

@@ -17,7 +17,7 @@
 
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2010
+	Portions created by the Initial Developer are Copyright (C) 2008-2012
 	the Initial Developer. All Rights Reserved.
 
 	Contributor(s):

+ 1 - 1
users_bulk_add/v_users_bulk_add.php

@@ -17,7 +17,7 @@
 
  The Initial Developer of the Original Code is
  Mark J Crane <[email protected]>
- Portions created by the Initial Developer are Copyright (C) 2008-2010
+ Portions created by the Initial Developer are Copyright (C) 2008-2012
  the Initial Developer. All Rights Reserved.
 
  Contributor(s):