diff --git a/app/device_vendors/app_config.php b/app/device_vendors/app_config.php new file mode 100644 index 0000000000..e885a1d143 --- /dev/null +++ b/app/device_vendors/app_config.php @@ -0,0 +1,807 @@ +\n"; + foreach ($vendors as $vendor) { + //print_r($vendor); + $vendor = $vendor['name']; + echo "

$vendor

\n"; + $functions = $vendor['functions']; + foreach ($vendor['functions'] as $type) { + echo "
\n"; + echo "label: ".$type['label']."\n"; + echo "name: ".$type['name']."\n"; + echo "value: ".$type['value']."\n"; + } + } + echo "\n"; + */ + + /* + //select + $device_vendor = 'yealink'; + $device_key_type = '16'; + echo "\n"; + */ + +?> \ No newline at end of file diff --git a/app/device_vendors/app_defaults.php b/app/device_vendors/app_defaults.php new file mode 100644 index 0000000000..b2df8bdb03 --- /dev/null +++ b/app/device_vendors/app_defaults.php @@ -0,0 +1,95 @@ + + Portions created by the Initial Developer are Copyright (C) 2016 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ + + if ($domains_processed == 1) { + + //add the music_on_hold list to the database + $sql = "select count(*) as num_rows from v_device_vendors; "; + $prep_statement = $db->prepare($sql); + if ($prep_statement) { + $prep_statement->execute(); + $row = $prep_statement->fetch(PDO::FETCH_ASSOC); + if ($row['num_rows'] == 0) { + + //get the vendor array + require_once $_SERVER["DOCUMENT_ROOT"].'/'.PROJECT_PATH.'/app/device_vendors/app_config.php'; + + //process the array + foreach ($vendors as $vendor) { + + //insert the data into the database + $device_vendor_uuid = uuid(); + $sql = "insert into v_device_vendors "; + $sql .= "("; + $sql .= "device_vendor_uuid, "; + $sql .= "name, "; + $sql .= "enabled "; + $sql .= ") "; + $sql .= "values "; + $sql .= "( "; + $sql .= "'".$device_vendor_uuid."', "; + $sql .= "'".$vendor['name']."', "; + $sql .= "'true' "; + $sql .= ");"; + //echo $sql."\n"; + $db->exec(check_sql($sql)); + unset($sql); + + //add the vendor functions + foreach ($vendor['functions'] as $function) { + + //add the coference profile params + $device_vendor_function_uuid = uuid(); + $sql = "insert into v_device_vendor_functions "; + $sql .= "("; + $sql .= "device_vendor_uuid, "; + $sql .= "device_vendor_function_uuid, "; + $sql .= "name, "; + $sql .= "value, "; + $sql .= "enabled, "; + $sql .= "description "; + $sql .= ") "; + $sql .= "values "; + $sql .= "( "; + $sql .= "'".$device_vendor_uuid."', "; + $sql .= "'".$device_vendor_function_uuid."', "; + $sql .= "'".$function['name']."', "; + $sql .= "'".$function['value']."', "; + $sql .= "'true', "; + $sql .= "'".$function['description']."' "; + $sql .= ");"; + //echo $sql."\n"; + $db->exec(check_sql($sql)); + unset($sql); + } + + } + } //if num_rows + } //if prep_statement + + } + +?> \ No newline at end of file diff --git a/app/device_vendors/app_languages.php b/app/device_vendors/app_languages.php new file mode 100644 index 0000000000..ecc15a41dc --- /dev/null +++ b/app/device_vendors/app_languages.php @@ -0,0 +1,224 @@ + \ No newline at end of file diff --git a/app/device_vendors/device_vendor_delete.php b/app/device_vendors/device_vendor_delete.php new file mode 100644 index 0000000000..e155dd48c6 --- /dev/null +++ b/app/device_vendors/device_vendor_delete.php @@ -0,0 +1,64 @@ + + Portions created by the Initial Developer are Copyright (C) 2016 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ + +//includes + require_once "root.php"; + require_once "resources/require.php"; + +//check permissions + require_once "resources/check_auth.php"; + if (permission_exists('device_vendor_delete')) { + //access granted + } + else { + echo "access denied"; + exit; + } + +//add multi-lingual support + $language = new text; + $text = $language->get(); + +//get the id + if (count($_GET)>0) { + $id = check_str($_GET["id"]); + } + +//delete the data + if (strlen($id)>0) { + //delete device_vendor + $sql = "delete from v_device_vendors "; + $sql .= "where device_vendor_uuid = '$id' "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + unset($sql); + } + +//redirect the user + $_SESSION['message'] = $text['message-delete']; + header('Location: device_vendors.php'); + +?> \ No newline at end of file diff --git a/app/device_vendors/device_vendor_edit.php b/app/device_vendors/device_vendor_edit.php new file mode 100644 index 0000000000..d17097b69f --- /dev/null +++ b/app/device_vendors/device_vendor_edit.php @@ -0,0 +1,223 @@ + + Portions created by the Initial Developer are Copyright (C) 2016 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ + +//includes + require_once "root.php"; + require_once "resources/require.php"; + +//check permissions + require_once "resources/check_auth.php"; + if (permission_exists('device_vendor_add') || permission_exists('device_vendor_edit')) { + //access granted + } + else { + echo "access denied"; + exit; + } + +//add multi-lingual support + $language = new text; + $text = $language->get(); + +//action add or update + if (isset($_REQUEST["id"])) { + $action = "update"; + $device_vendor_uuid = check_str($_REQUEST["id"]); + } + else { + $action = "add"; + } + +//get http post variables and set them to php variables + if (count($_POST)>0) { + $name = check_str($_POST["name"]); + $enabled = check_str($_POST["enabled"]); + $description = check_str($_POST["description"]); + } + +if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { + + $msg = ''; + if ($action == "update") { + $device_vendor_uuid = check_str($_POST["device_vendor_uuid"]); + } + + //check for all required data + if (strlen($name) == 0) { $msg .= $text['message-required']." ".$text['label-name']."
\n"; } + if (strlen($enabled) == 0) { $msg .= $text['message-required']." ".$text['label-enabled']."
\n"; } + //if (strlen($description) == 0) { $msg .= $text['message-required']." ".$text['label-description']."
\n"; } + if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + require_once "resources/header.php"; + require_once "resources/persist_form_var.php"; + echo "
\n"; + echo "
\n"; + echo $msg."
"; + echo "
\n"; + persistformvar($_POST); + echo "
\n"; + require_once "resources/footer.php"; + return; + } + + //add or update the database + if ($_POST["persistformvar"] != "true") { + if ($action == "add" && permission_exists('device_vendor_add')) { + $sql = "insert into v_device_vendors "; + $sql .= "("; + $sql .= "device_vendor_uuid, "; + $sql .= "name, "; + $sql .= "enabled, "; + $sql .= "description "; + $sql .= ")"; + $sql .= "values "; + $sql .= "("; + $sql .= "'".uuid()."', "; + $sql .= "'$name', "; + $sql .= "'$enabled', "; + $sql .= "'$description' "; + $sql .= ")"; + $db->exec(check_sql($sql)); + unset($sql); + + $_SESSION["message"] = $text['message-add']; + header("Location: device_vendors.php"); + return; + + } //if ($action == "add") + + if ($action == "update" && permission_exists('device_vendor_edit')) { + $sql = "update v_device_vendors set "; + $sql .= "name = '$name', "; + $sql .= "enabled = '$enabled', "; + $sql .= "description = '$description' "; + $sql .= "where device_vendor_uuid = '$device_vendor_uuid'"; + $db->exec(check_sql($sql)); + unset($sql); + + $_SESSION["message"] = $text['message-update']; + header("Location: device_vendors.php"); + return; + + } //if ($action == "update") + } //if ($_POST["persistformvar"] != "true") +} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) + +//pre-populate the form + if (count($_GET) > 0 && $_POST["persistformvar"] != "true") { + $device_vendor_uuid = check_str($_GET["id"]); + $sql = "select * from v_device_vendors "; + $sql .= "where device_vendor_uuid = '$device_vendor_uuid' "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); + foreach ($result as &$row) { + $name = $row["name"]; + $enabled = $row["enabled"]; + $description = $row["description"]; + } + unset ($prep_statement); + } + +//show the header + require_once "resources/header.php"; + +//show the content + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo " \n"; + echo " "; + echo "
".$text['title-device_vendor']."

\n"; + echo " "; + echo " "; + echo "
\n"; + echo " ".$text['label-name']."\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-name']."\n"; + echo "
\n"; + echo " ".$text['label-enabled']."\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-enabled']."\n"; + echo "
\n"; + echo " ".$text['label-description']."\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-description']."\n"; + echo "
\n"; + if ($action == "update") { + echo " \n"; + } + echo " \n"; + echo "
"; + echo "
"; + echo "

"; + + if ($action == "update") { + require "device_vendor_functions.php"; + } + +//include the footer + require_once "resources/footer.php"; + +?> \ No newline at end of file diff --git a/app/device_vendors/device_vendor_function_delete.php b/app/device_vendors/device_vendor_function_delete.php new file mode 100644 index 0000000000..c2ebe159cb --- /dev/null +++ b/app/device_vendors/device_vendor_function_delete.php @@ -0,0 +1,65 @@ + + Portions created by the Initial Developer are Copyright (C) 2016 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ + +//includes + require_once "root.php"; + require_once "resources/require.php"; + +//check permissions + require_once "resources/check_auth.php"; + if (permission_exists('device_vendor_function_delete')) { + //access granted + } + else { + echo "access denied"; + exit; + } + +//add multi-lingual support + $language = new text; + $text = $language->get(); + +//get the id + if (count($_GET)>0) { + $id = check_str($_GET["id"]); + $device_vendor_uuid = check_str($_GET["device_vendor_uuid"]); + } + +//delete the data + if (strlen($id)>0) { + //delete device_vendor_function + $sql = "delete from v_device_vendor_functions "; + $sql .= "where device_vendor_function_uuid = '$id' "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + unset($sql); + } + +//redirect the user + $_SESSION['message'] = $text['message-delete']; + header('Location: device_vendor_function_edit.php?id='.$device_vendor_uuid); + +?> \ No newline at end of file diff --git a/app/device_vendors/device_vendor_function_edit.php b/app/device_vendors/device_vendor_function_edit.php new file mode 100644 index 0000000000..71d55ab097 --- /dev/null +++ b/app/device_vendors/device_vendor_function_edit.php @@ -0,0 +1,262 @@ + + Portions created by the Initial Developer are Copyright (C) 2016 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ + +//includes + require_once "root.php"; + require_once "resources/require.php"; + +//check permissions + require_once "resources/check_auth.php"; + if (permission_exists('device_vendor_function_add') || permission_exists('device_vendor_function_edit')) { + //access granted + } + else { + echo "access denied"; + exit; + } + +//add multi-lingual support + $language = new text; + $text = $language->get(); + +//action add or update + if (isset($_REQUEST["id"])) { + $action = "update"; + $device_vendor_function_uuid = check_str($_REQUEST["id"]); + } + else { + $action = "add"; + } + +//set the parent uuid + if (strlen($_GET["device_vendor_uuid"]) > 0) { + $device_vendor_uuid = check_str($_GET["device_vendor_uuid"]); + } + +//get http post variables and set them to php variables + if (count($_POST)>0) { + $label = check_str($_POST["label"]); + $name = check_str($_POST["name"]); + $value = check_str($_POST["value"]); + $enabled = check_str($_POST["enabled"]); + $description = check_str($_POST["description"]); + } + +if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { + + $msg = ''; + if ($action == "update") { + $device_vendor_function_uuid = check_str($_POST["device_vendor_function_uuid"]); + } + + //check for all required data + if (strlen($label) == 0) { $msg .= $text['message-required']." ".$text['label-label']."
\n"; } + if (strlen($name) == 0) { $msg .= $text['message-required']." ".$text['label-name']."
\n"; } + if (strlen($value) == 0) { $msg .= $text['message-required']." ".$text['label-value']."
\n"; } + if (strlen($enabled) == 0) { $msg .= $text['message-required']." ".$text['label-enabled']."
\n"; } + //if (strlen($description) == 0) { $msg .= $text['message-required']." ".$text['label-description']."
\n"; } + if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + require_once "resources/header.php"; + require_once "resources/persist_form_var.php"; + echo "
\n"; + echo "
\n"; + echo $msg."
"; + echo "
\n"; + persistformvar($_POST); + echo "
\n"; + require_once "resources/footer.php"; + return; + } + + //add or update the database + if ($_POST["persistformvar"] != "true") { + if ($action == "add" && permission_exists('device_vendor_function_add')) { + $sql = "insert into v_device_vendor_functions "; + $sql .= "("; + $sql .= "device_vendor_function_uuid, "; + $sql .= "device_vendor_uuid, "; + $sql .= "label, "; + $sql .= "name, "; + $sql .= "value, "; + $sql .= "enabled, "; + $sql .= "description "; + $sql .= ")"; + $sql .= "values "; + $sql .= "("; + $sql .= "'".uuid()."', "; + $sql .= "'$device_vendor_uuid', "; + $sql .= "'$label', "; + $sql .= "'$name', "; + $sql .= "'$value', "; + $sql .= "'$enabled', "; + $sql .= "'$description' "; + $sql .= ")"; + $db->exec(check_sql($sql)); + unset($sql); + + $_SESSION["message"] = $text['message-add']; + header('Location: device_vendor_edit.php?id='.$device_vendor_uuid); + return; + + } //if ($action == "add") + + if ($action == "update" && permission_exists('device_vendor_function_edit')) { + $sql = "update v_device_vendor_functions set "; + $sql .= "device_vendor_uuid = '$device_vendor_uuid', "; + $sql .= "label = '$label', "; + $sql .= "name = '$name', "; + $sql .= "value = '$value', "; + $sql .= "enabled = '$enabled', "; + $sql .= "description = '$description' "; + $sql .= "where device_vendor_function_uuid = '$device_vendor_function_uuid'"; + $db->exec(check_sql($sql)); + unset($sql); + + $_SESSION["message"] = $text['message-update']; + header('Location: device_vendor_edit.php?id='.$device_vendor_uuid); + return; + + } //if ($action == "update") + } //if ($_POST["persistformvar"] != "true") +} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) + +//pre-populate the form + if (count($_GET) > 0 && $_POST["persistformvar"] != "true") { + $device_vendor_function_uuid = check_str($_GET["id"]); + $sql = "select * from v_device_vendor_functions "; + $sql .= "where device_vendor_function_uuid = '$device_vendor_function_uuid' "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); + foreach ($result as &$row) { + $label = $row["label"]; + $name = $row["name"]; + $value = $row["value"]; + $enabled = $row["enabled"]; + $description = $row["description"]; + } + unset ($prep_statement); + } + +//show the header + require_once "resources/header.php"; + +//show the content + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo " \n"; + echo " "; + echo "
".$text['title-device_vendor_function']."

\n"; + echo " "; + echo " "; + echo "
\n"; + echo " ".$text['label-label']."\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-label']."\n"; + echo "
\n"; + echo " ".$text['label-name']."\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-name']."\n"; + echo "
\n"; + echo " ".$text['label-value']."\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-value']."\n"; + echo "
\n"; + echo " ".$text['label-enabled']."\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-enabled']."\n"; + echo "
\n"; + echo " ".$text['label-description']."\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-description']."\n"; + echo "
\n"; + echo " \n"; + if ($action == "update") { + echo " \n"; + } + echo " \n"; + echo "
"; + echo "
"; + echo "

"; + +//include the footer + require_once "resources/footer.php"; + +?> \ No newline at end of file diff --git a/app/device_vendors/device_vendor_functions.php b/app/device_vendors/device_vendor_functions.php new file mode 100644 index 0000000000..790a930075 --- /dev/null +++ b/app/device_vendors/device_vendor_functions.php @@ -0,0 +1,160 @@ +get(); + +//get variables used to control the order + $order_by = check_str($_GET["order_by"]); + $order = check_str($_GET["order"]); + +//add the search term + $search = check_str($_GET["search"]); + if (strlen($search) > 0) { + $sql_search = "and ("; + $sql_search .= "label like '%".$search."%'"; + $sql_search .= "or name like '%".$search."%'"; + $sql_search .= "or value like '%".$search."%'"; + $sql_search .= "or enabled like '%".$search."%'"; + $sql_search .= "or description like '%".$search."%'"; + $sql_search .= ")"; + } +//additional includes + require_once "resources/header.php"; + require_once "resources/paging.php"; + +//prepare to page the results + $sql = "select count(*) as num_rows from v_device_vendor_functions "; + $sql .= "where device_vendor_uuid = '$device_vendor_uuid' "; + $sql .= $sql_search; + if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } + $prep_statement = $db->prepare($sql); + if ($prep_statement) { + $prep_statement->execute(); + $row = $prep_statement->fetch(PDO::FETCH_ASSOC); + if ($row['num_rows'] > 0) { + $num_rows = $row['num_rows']; + } + else { + $num_rows = '0'; + } + } + +//prepare to page the results + $rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50; + $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); + $offset = $rows_per_page * $page; + +//get the list + $sql = "select * from v_device_vendor_functions "; + $sql .= "where device_vendor_uuid = '$device_vendor_uuid' "; + $sql .= $sql_search; + 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(); + $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); + unset ($prep_statement, $sql); + +//alternate the row style + $c = 0; + $row_style["0"] = "row_style0"; + $row_style["1"] = "row_style1"; + +//show the content + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
".$text['title-device_vendor_functions']."
\n"; + echo " \n"; + echo " \n"; + echo "
\n"; + + echo "\n"; + echo "\n"; + echo th_order_by('label', $text['label-label'], $order_by, $order); + echo th_order_by('name', $text['label-name'], $order_by, $order); + echo th_order_by('value', $text['label-value'], $order_by, $order); + echo th_order_by('enabled', $text['label-enabled'], $order_by, $order); + echo th_order_by('description', $text['label-description'], $order_by, $order); + echo "\n"; + echo "\n"; + + if (is_array($result)) { + foreach($result as $row) { + if (permission_exists('device_vendor_function_edit')) { + $tr_link = "href='device_vendor_function_edit.php?device_vendor_uuid=".$row['device_vendor_uuid']."&id=".$row['device_vendor_function_uuid']."'"; + } + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "\n"; + if ($c==0) { $c=1; } else { $c=0; } + } //end foreach + unset($sql, $result, $row_count); + } //end if results + + echo "\n"; + echo "\n"; + echo "\n"; + echo "
"; + if (permission_exists('device_vendor_function_add')) { + echo "$v_link_label_add"; + } + else { + echo " \n"; + } + echo "
".$row['label']." ".$row['name']." ".$row['value']." ".$row['enabled']." ".$row['description']." "; + if (permission_exists('device_vendor_function_edit')) { + echo "$v_link_label_edit"; + } + if (permission_exists('device_vendor_function_delete')) { + echo "$v_link_label_delete"; + } + echo "
\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
 $paging_controls"; + if (permission_exists('device_vendor_function_add')) { + echo "$v_link_label_add"; + } + else { + echo " "; + } + echo "
\n"; + echo "
"; + echo "

"; + +//include the footer + require_once "resources/footer.php"; + +?> \ No newline at end of file diff --git a/app/device_vendors/device_vendors.php b/app/device_vendors/device_vendors.php new file mode 100644 index 0000000000..3e5befd9e7 --- /dev/null +++ b/app/device_vendors/device_vendors.php @@ -0,0 +1,181 @@ + + Portions created by the Initial Developer are Copyright (C) 2016 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ + +//includes + require_once "root.php"; + require_once "resources/require.php"; + +//check permissions + require_once "resources/check_auth.php"; + if (permission_exists('device_vendor_view')) { + //access granted + } + else { + echo "access denied"; + exit; + } + +//add multi-lingual support + $language = new text; + $text = $language->get(); + +//get variables used to control the order + $order_by = check_str($_GET["order_by"]); + $order = check_str($_GET["order"]); + +//add the search term + $search = check_str($_GET["search"]); + if (strlen($search) > 0) { + $sql_search = "where ("; + $sql_search .= "name like '%".$search."%'"; + $sql_search .= "or enabled like '%".$search."%'"; + $sql_search .= "or description like '%".$search."%'"; + $sql_search .= ")"; + } +//additional includes + require_once "resources/header.php"; + require_once "resources/paging.php"; + +//prepare to page the results + $sql = "select count(*) as num_rows from v_device_vendors "; + $sql .= $sql_search; + if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } + $prep_statement = $db->prepare($sql); + if ($prep_statement) { + $prep_statement->execute(); + $row = $prep_statement->fetch(PDO::FETCH_ASSOC); + if ($row['num_rows'] > 0) { + $num_rows = $row['num_rows']; + } + else { + $num_rows = '0'; + } + } + +//prepare to page the results + $rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50; + $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); + $offset = $rows_per_page * $page; + +//get the list + $sql = "select * from v_device_vendors "; + $sql .= $sql_search; + 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(); + $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); + unset ($prep_statement, $sql); + +//alternate the row style + $c = 0; + $row_style["0"] = "row_style0"; + $row_style["1"] = "row_style1"; + +//show the content + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
".$text['title-device_vendors']."
\n"; + echo " \n"; + echo " \n"; + echo "
\n"; + echo " ".$text['title_description-device_vendor']."

\n"; + echo "
\n"; + + echo "\n"; + echo "\n"; + echo th_order_by('name', $text['label-name'], $order_by, $order); + echo th_order_by('enabled', $text['label-enabled'], $order_by, $order); + echo th_order_by('description', $text['label-description'], $order_by, $order); + echo "\n"; + echo "\n"; + + if (is_array($result)) { + foreach($result as $row) { + if (permission_exists('device_vendor_edit')) { + $tr_link = "href='device_vendor_edit.php?id=".$row['device_vendor_uuid']."'"; + } + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "\n"; + if ($c==0) { $c=1; } else { $c=0; } + } //end foreach + unset($sql, $result, $row_count); + } //end if results + + echo "\n"; + echo "\n"; + echo "\n"; + echo "
"; + if (permission_exists('device_vendor_add')) { + echo "$v_link_label_add"; + } + else { + echo " \n"; + } + echo "
".$row['name']." ".$row['enabled']." ".$row['description']." "; + if (permission_exists('device_vendor_edit')) { + echo "$v_link_label_edit"; + } + if (permission_exists('device_vendor_delete')) { + echo "$v_link_label_delete"; + } + echo "
\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
 $paging_controls"; + if (permission_exists('device_vendor_add')) { + echo "$v_link_label_add"; + } + else { + echo " "; + } + echo "
\n"; + echo "
"; + echo "

"; + +//include the footer + require_once "resources/footer.php"; + +?> \ No newline at end of file diff --git a/app/device_vendors/root.php b/app/device_vendors/root.php new file mode 100644 index 0000000000..62fbe1b2e2 --- /dev/null +++ b/app/device_vendors/root.php @@ -0,0 +1,91 @@ + + Portions created by the Initial Developer are Copyright (C) 2008-2012 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ + +// make sure the PATH_SEPARATOR is defined + umask(2); + if (!defined("PATH_SEPARATOR")) { + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } + } + + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + +// make sure the document_root is set + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + chdir(pathinfo(realpath($_SERVER["PHP_SELF"]), PATHINFO_DIRNAME)); + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/project_root.php')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/project_root.php')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); + +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/project_root.php')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/project_root.php')) { + break; + } + $i++; + } + if(!file_exists($path. '/project_root.php')){ + die("Failed to locate the Project Root by searching for project_root.php please contact support for assistance"); + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); + } + +?> \ No newline at end of file diff --git a/app/devices/app_config.php b/app/devices/app_config.php index aa048352b0..26127b6eb1 100644 --- a/app/devices/app_config.php +++ b/app/devices/app_config.php @@ -546,4 +546,4 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; -?> +?> \ No newline at end of file