diff --git a/app/schemas/app_config.php b/app/schemas/app_config.php deleted file mode 100644 index 8b362506c0..0000000000 --- a/app/schemas/app_config.php +++ /dev/null @@ -1,443 +0,0 @@ - \ No newline at end of file diff --git a/app/schemas/app_languages.php b/app/schemas/app_languages.php deleted file mode 100644 index c85565ba78..0000000000 --- a/app/schemas/app_languages.php +++ /dev/null @@ -1,536 +0,0 @@ - diff --git a/app/schemas/app_menu.php b/app/schemas/app_menu.php deleted file mode 100644 index 6d3a708189..0000000000 --- a/app/schemas/app_menu.php +++ /dev/null @@ -1,20 +0,0 @@ - \ No newline at end of file diff --git a/app/schemas/root.php b/app/schemas/root.php deleted file mode 100644 index 7b882438ea..0000000000 --- a/app/schemas/root.php +++ /dev/null @@ -1,50 +0,0 @@ - - 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 - if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } - } - -// make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; - -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); - } - -?> \ No newline at end of file diff --git a/app/schemas/schema_data_delete.php b/app/schemas/schema_data_delete.php deleted file mode 100644 index 4e1e112491..0000000000 --- a/app/schemas/schema_data_delete.php +++ /dev/null @@ -1,102 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ -require_once "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (permission_exists('schema_delete')) { - //access granted -} -else { - echo "access denied"; - exit; -} - -//add multi-lingual support - $language = new text; - $text = $language->get(); - -if (count($_GET)>0) { - - //declare variable(s) - $schema_parent_id = ''; - - //get the http get and set them as php variables - $data_row_uuid = check_str($_GET["data_row_uuid"]); - $data_parent_row_uuid = check_str($_GET["data_parent_row_uuid"]); - $schema_uuid = check_str($_GET["schema_uuid"]); - - //show the results and redirect - require_once "resources/header.php"; - - //get the schema_parent_id from the child table - if (strlen($schema_parent_id) == 0) { - $sql = "select * from v_schemas "; - $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and schema_uuid = '$schema_uuid' "; - $prep_statement = $db->prepare($sql); - $prep_statement->execute(); - $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); - foreach ($result as &$row) { - $schema_parent_id = $row["schema_parent_id"]; - } - } - - //delete the child data - $sql = "delete from v_schema_data "; - $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and data_parent_row_uuid = '$data_row_uuid' "; - $db->exec(check_sql($sql)); - unset($sql); - - //delete the data - $sql = "delete from v_schema_data "; - $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and data_row_uuid = '$data_row_uuid' "; - $db->exec(check_sql($sql)); - unset($sql); - - //mark the the item as deleted and who deleted it - //$sql = "update v_schema_data set "; - //$sql .= "data_del_date = now(), "; - //$sql .= "data_del_user = '".$_SESSION["username"]."' "; - //$sql .= "where domain_uuid = '$domain_uuid' "; - //$sql .= "and data_row_uuid = '$data_row_uuid' "; - //$db->exec(check_sql($sql)); - //$lastinsertid = $db->lastInsertId($id); - //unset($sql); - - //redirect user - $_SESSION["message"] = $text['message-delete']; - if (strlen($data_parent_row_uuid) == 0) { - header("Location: schema_data_view.php?id=".$schema_uuid."&data_row_uuid=".$data_row_uuid); - } - else { - header("Location: schema_data_edit.php?schema_uuid=".$schema_parent_id."&data_row_uuid=".$data_parent_row_uuid); - } - return; -} - -?> \ No newline at end of file diff --git a/app/schemas/schema_data_edit.php b/app/schemas/schema_data_edit.php deleted file mode 100644 index 737a3b0368..0000000000 --- a/app/schemas/schema_data_edit.php +++ /dev/null @@ -1,975 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ -include "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (permission_exists('schema_data_add') || permission_exists('schema_data_edit')) { - //access granted -} -else { - echo "access denied"; - exit; -} - -//add multi-lingual support - $language = new text; - $text = $language->get(); - -//set http get variables to php variables - $search_all = strtolower(check_str($_GET["search_all"])); - $schema_uuid = check_str($_GET["schema_uuid"]); - if (strlen($_GET["data_row_uuid"])>0) { //update - $data_row_uuid = check_str($_GET["data_row_uuid"]); - $action = "update"; - } - else { - if (strlen($search_all) > 0) { - $action = "update"; - } - else { - $action = "add"; - } - } - if (strlen($_GET["id"]) > 0) { - $schema_uuid = check_str($_GET["id"]); - } - if (strlen($_GET["data_parent_row_uuid"])>0) { - $data_parent_row_uuid = check_str($_GET["data_parent_row_uuid"]); - } - -//get schema information - $sql = "select * from v_schemas "; - $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and schema_uuid = '$schema_uuid' "; - $prep_statement = $db->prepare(check_sql($sql)); - $prep_statement->execute(); - $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); - foreach ($result as &$row) { - $schema_category = $row["schema_category"]; - $schema_label = $row["schema_label"]; - $schema_name = $row["schema_name"]; - $schema_auth = $row["schema_auth"]; - $schema_captcha = $row["schema_captcha"]; - $schema_parent_id = $row["schema_parent_id"]; - $schema_description = $row["schema_description"]; - break; //limit to 1 row - } - unset ($prep_statement); - -//process the data submitted to by the html form - if (count($_POST)>0) { //add - $schema_uuid = check_str($_POST["schema_uuid"]); - $schema_name = check_str($_POST["schema_name"]); - $rcount = check_str($_POST["rcount"]); - - //get the field information - $db_field_name_array = array(); - $db_value_array = array(); - $db_names .= "\n"; - $sql = "select * from v_schema_fields "; - $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and schema_uuid = '$schema_uuid' "; - $sql .= "order by field_order asc "; - $prep_statement = $db->prepare($sql); - $prep_statement->execute(); - $result_names = $prep_statement->fetchAll(PDO::FETCH_ASSOC); - $result_count = count($result); - foreach($result_names as $row) { - $field_label = $row["field_label"]; - $field_name = $row["field_name"]; - $field_type = $row["field_type"]; - $field_value = $row["field_value"]; - $field_list_hidden = $row["field_list_hidden"]; - $field_column = $row["field_column"]; - $field_required = $row["field_required"]; - $field_order = $row["field_order"]; - $field_order_tab = $row["field_order_tab"]; - $field_description = $row["field_description"]; - - $name_array[$field_name]['field_label'] = $row["field_label"]; - $name_array[$field_name]['field_type'] = $row["field_type"]; - $name_array[$field_name]['field_list_hidden'] = $row["field_list_hidden"]; - $name_array[$field_name]['field_column'] = $row["field_column"]; - $name_array[$field_name]['field_required'] = $row["field_required"]; - $name_array[$field_name]['field_order'] = $row["field_order"]; - $name_array[$field_name]['field_order_tab'] = $row["field_order_tab"]; - $name_array[$field_name]['field_description'] = $row["field_description"]; - } - unset($sql, $prep_statement, $row); - $fieldcount = count($name_array); - - $i = 1; - while($i <= $rcount){ - $field_name = check_str($_POST[$i."field_name"]); - $data_field_value = check_str($_POST[$i."field_value"]); - if ($i==1) { - $unique_temp_id = md5('7k3j2m'.date('r')); //used to find the first item - $data_row_uuid = $unique_temp_id; - } - $sql = "select field_type, field_name from v_schema_fields "; - $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and schema_uuid = '$schema_uuid' "; - $sql .= "and field_name = '$field_name' "; - $prep_statement = $db->prepare($sql); - $prep_statement->execute(); - while($row = $prep_statement->fetch()){ - $field_type = $row['field_type']; - } - - if ($field_type == "upload_file" || $field_type == "uploadimage") { - //print_r($_FILES); - $upload_temp_dir = $_ENV["TEMP"]."\\"; - ini_set('upload_tmp_dir', $upload_temp_dir); - //$uploaddir = ""; - if ($field_type == "upload_file") { - $upload_file = $filedir . $_FILES[$i.'field_value']['name']; - } - if ($field_type == "uploadimage") { - $upload_file = $imagedir . $_FILES[$i.'field_value']['name']; - } - // $_POST[$i."field_name"] - //print_r($_FILES); - //echo "upload_file $upload_file
\n"; - //echo "upload_temp_dir $upload_temp_dir
\n"; - - $data_field_value = $_FILES[$i.'field_value']['name']; - //echo "name $data_field_value
\n"; - //echo "field_name $field_name
\n"; - //$i."field_value" - //echo "if (move_uploaded_file(\$_FILES[$i.'field_value']['tmp_name'], $upload_file)) "; - //if (strlen($_FILES[$i.'field_value']['name'])>0) { //only do the following if there is a file name - //foreach($_FILES as $file) - //{ - //[$i.'field_value'] - //print_r($file); - if($_FILES[$i.'field_value']['error'] == 0 && $_FILES[$i.'field_value']['size'] > 0) { - if (move_uploaded_file($_FILES[$i.'field_value']['tmp_name'], $upload_file)) { - //echo $_FILES['userfile']['name'] ."
"; - //echo "was successfully uploaded. "; - //echo "

"; - //print "
";
-									//print_r($_FILES);
-									//print "
"; - } - else { - //echo "Upload Error. Here's some debugging info:\n"; - //print "
\n";
-									//print_r($_FILES);
-									//print "
\n"; - //exit; - } - } - //} - //} - } //end if file or image - - if ($action == "add" && permission_exists('schema_data_add')) { - //get a unique id for the data_row_uuid - if ($i==1) { - $data_row_uuid = uuid(); - } - - //insert the field data - $sql = "insert into v_schema_data "; - $sql .= "("; - $sql .= "schema_data_uuid, "; - $sql .= "domain_uuid, "; - $sql .= "data_row_uuid, "; - if(strlen($data_parent_row_uuid)>0) { - $sql .= "data_parent_row_uuid, "; - } - $sql .= "schema_uuid, "; - if (strlen($schema_parent_id) > 0) { - $sql .= "schema_parent_id, "; - } - $sql .= "field_name, "; - $sql .= "data_field_value, "; - $sql .= "data_add_user, "; - $sql .= "data_add_date "; - $sql .= ")"; - $sql .= "values "; - $sql .= "("; - $sql .= "'".uuid()."', "; - $sql .= "'$domain_uuid', "; - $sql .= "'$data_row_uuid', "; - if(strlen($data_parent_row_uuid)>0) { - $sql .= "'$data_parent_row_uuid', "; - } - $sql .= "'$schema_uuid', "; - if (strlen($schema_parent_id) > 0) { - $sql .= "'$schema_parent_id', "; - } - $sql .= "'$field_name', "; - switch ($name_array[$field_name]['field_type']) { - case "phone": - $tmp_phone = preg_replace('{\D}', '', $data_field_value); - $sql .= "'$tmp_phone', "; - break; - case "add_user": - $sql .= "'".$_SESSION["username"]."', "; - break; - case "add_date": - $sql .= "now(), "; - break; - case "mod_user": - $sql .= "'".$_SESSION["username"]."', "; - break; - case "mod_date": - $sql .= "now(), "; - break; - default: - $sql .= "'$data_field_value', "; - } - $sql .= "'".$_SESSION["username"]."', "; - $sql .= "now() "; - $sql .= ")"; - $db->exec(check_sql($sql)); - $lastinsertid = $db->lastInsertId($id); - unset($sql); - } //end action add - - if ($action == "update" && permission_exists('schema_data_edit')) { - $data_row_uuid = $_POST["data_row_uuid"]; - - $sql_update = "update v_schema_data set "; - switch ($name_array[$field_name]['field_type']) { - case "phone": - $tmp_phone = preg_replace('{\D}', '', $data_field_value); - $sql_update .= "data_field_value = '$tmp_phone' "; - break; - case "add_user": - $sql_update .= "data_field_value = '".$_SESSION["username"]."' "; - break; - case "add_date": - $sql_update .= "data_field_value = now() "; - break; - case "mod_user": - $sql_update .= "data_field_value = '".$_SESSION["username"]."' "; - break; - case "mod_date": - $sql_update .= "data_field_value = now() "; - break; - default: - $sql_update .= "data_field_value = '$data_field_value' "; - } - $sql_update .= "where domain_uuid = '$domain_uuid' "; - $sql_update .= "and schema_uuid = '$schema_uuid' "; - if (strlen($schema_parent_id) > 0) { - $sql_update .= "and schema_parent_id = '$schema_parent_id' "; - } - $sql_update .= "and data_row_uuid = '$data_row_uuid' "; - if(strlen($data_parent_row_uuid)>0) { - $sql_update .= "and data_parent_row_uuid = '$data_parent_row_uuid' "; - } - $sql_update .= "and field_name = '$field_name' "; - $count = $db->exec(check_sql($sql_update)); - unset ($sql_update); - if ($count > 0) { - //do nothing the update was successfull - } - else { - //no value to update so insert new value - $sql = "insert into v_schema_data "; - $sql .= "("; - $sql .= "domain_uuid, "; - $sql .= "data_row_uuid, "; - if(strlen($data_parent_row_uuid)>0) { - $sql .= "data_parent_row_uuid, "; - } - $sql .= "schema_uuid, "; - $sql .= "schema_parent_id, "; - $sql .= "field_name, "; - $sql .= "data_field_value, "; - $sql .= "data_add_user, "; - $sql .= "data_add_date "; - $sql .= ")"; - $sql .= "values "; - $sql .= "("; - $sql .= "'$domain_uuid', "; - $sql .= "'$data_row_uuid', "; - if(strlen($data_parent_row_uuid)>0) { - $sql .= "'$data_parent_row_uuid', "; - } - $sql .= "'$schema_uuid', "; - $sql .= "'$schema_parent_id', "; - $sql .= "'$field_name', "; - switch ($name_array[$field_name]['field_type']) { - case "phone": - $tmp_phone = preg_replace('{\D}', '', $data_field_value); - $sql .= "'$tmp_phone', "; - break; - case "add_user": - $sql .= "'".$_SESSION["username"]."', "; - break; - case "add_date": - $sql .= "now(), "; - break; - case "mod_user": - $sql .= "'".$_SESSION["username"]."', "; - break; - case "mod_date": - $sql .= "now(), "; - break; - default: - $sql .= "'$data_field_value', "; - } - $sql .= "'".$_SESSION["username"]."', "; - $sql .= "now() "; - $sql .= ")"; - - $db->exec(check_sql($sql)); - $lastinsertid = $db->lastInsertId($id); - unset($sql); - } - } - $i++; - } - - //redirect user - if ($action == "add") { - $_SESSION["message"] = $text['message-add']; - } - else if ($action == "update") { - $_SESSION["message"] = $text['message-update']; - } - - if (strlen($data_parent_row_uuid) == 0) { - header("Location: schema_data_edit.php?id=".$schema_uuid."&data_row_uuid=".$data_row_uuid); - } - else { - header("Location: schema_data_edit.php?schema_uuid=".$schema_parent_id."&data_row_uuid=".$data_parent_row_uuid); - } - return; - } - -//show the header - require_once "resources/header.php"; - $document['title'] = $text['title-data']; - -//pre-populate the form - if ($action == "update") { - //get the field values - $sql = ""; - $sql .= "select * from v_schema_data "; - $sql .= "where domain_uuid = '".$domain_uuid."' "; - if (strlen($search_all) == 0) { - $sql .= "and schema_uuid = '$schema_uuid' "; - if (strlen($data_parent_row_uuid) > 0) { - $sql .= " and data_parent_row_uuid = '$data_parent_row_uuid' "; - } - } - else { - $sql .= "and data_row_uuid in ("; - $sql .= "select data_row_uuid from v_schema_data \n"; - $sql .= "where domain_uuid = '".$domain_uuid."' "; - $sql .= "and schema_uuid = '$schema_uuid' "; - if (strlen($data_parent_row_uuid) > 0) { - $sql .= " and data_parent_row_uuid = '$data_parent_row_uuid' "; - } - else { - //$sql .= "and data_field_value like '%$search_all%' )\n"; - $tmp_digits = preg_replace('{\D}', '', $search_all); - if (is_numeric($tmp_digits) && strlen($tmp_digits) > 5) { - if (strlen($tmp_digits) == '11' ) { - $sql .= "and data_field_value like '%".substr($tmp_digits, -10)."%' )\n"; - } - else { - $sql .= "and data_field_value like '%$tmp_digits%' )\n"; - } - } - else { - $sql .= "and lower(data_field_value) like '%$search_all%' )\n"; - } - } - } - $sql .= "order by data_row_uuid asc "; - - $row_id = ''; - $row_id_found = false; - $next_row_id_found = false; - $prep_statement = $db->prepare($sql); - $prep_statement->execute(); - $x=0; - while($row = $prep_statement->fetch()) { - //set the last last row id - if ($x==0) { - if (strlen($data_row_uuid) == 0) { - $data_row_uuid = $row['data_row_uuid']; - } - $first_data_row_uuid = $row['data_row_uuid']; - } - //get the data for the specific row id - if ($data_row_uuid == $row['data_row_uuid']) { - //set the data and save it to an array - $data_row[$row['field_name']] = $row['data_field_value']; - //set the previous row id - if ($previous_row_id != $row['data_row_uuid']) { - $previous_data_row_uuid = $previous_row_id; - $row_id_found = true; - } - } - //detect a new row id - if ($previous_row_id != $row['data_row_uuid']) { - if ($row_id_found) { - if (!$next_row_id_found) { - //make sure it is not the current row id - if ($data_row_uuid != $row['data_row_uuid']) { - $next_data_row_uuid = $row['data_row_uuid']; - $next_row_id_found = true; - } - } - } - - //set the last last row id - $last_data_row_uuid = $row['data_row_uuid']; - - //set the temporary previous row id - $previous_row_id = $row['data_row_uuid']; - - //set the record number array - $record_number_array[$row['data_row_uuid']] = $x+1; - - $x++; - } - } - - //save the total number of records - $total_records = $x; - - //set record number - if (strlen($_GET["n"]) == 0) { - $n = 1; - } - else { - $n = $_GET["n"]; - } - unset($sql, $prep_statement, $row); - } - -//use this when the calendar is needed - //echo "\n"; - //echo "\n"; - //echo ""; - -//begin creating the content - echo "
"; - -//get the title and description of the schema - echo "\n"; - echo " \n"; - echo " \n"; - - if (strlen($data_parent_row_uuid) == 0) { - echo "\n"; - - echo "\n"; - } - else { - echo " \n"; - } - echo " \n"; - echo "
\n"; - echo " $schema_label "; - if ($action == "add") { - echo $text['button-add']."\n"; - } - else { - echo $text['button-edit']."\n"; - } - echo " \n"; - echo "      \n"; - if ($action == "update" && permission_exists('schema_data_edit')) { - echo " \n"; - } - echo "
\n"; - echo " $schema_description\n"; - echo "
\n"; - echo "
\n"; - echo "
\n"; - - if ($action == "update" && permission_exists('schema_data_edit')) { - if (strlen($previous_data_row_uuid) == 0) { - echo " \n"; - } - else { - echo " \n"; - } - echo " \n"; - if (strlen($next_data_row_uuid) == 0) { - echo " \n"; - } - else { - echo " \n"; - } - } - echo "    "; - echo "    "; - echo "    "; - 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"; - -//begin the table that will hold the html form - echo "\n"; - -//determine if a file should be uploaded - $sql = "SELECT * FROM v_schema_fields "; - $sql .= "where domain_uuid = '$domain_uuid ' "; - $sql .= "and schema_uuid = '$schema_uuid ' "; - $sql .= "and field_type = 'uploadimage' "; - $sql .= "or domain_uuid = '$domain_uuid ' "; - $sql .= "and schema_uuid = '$schema_uuid ' "; - $sql .= "and field_type = 'upload_file' "; - $prep_statement = $db->prepare($sql); - $prep_statement->execute(); - if (count($prep_statement->fetchAll(PDO::FETCH_NAMED)) > 0) { - echo "\n"; - echo "\n"; - } - else { - echo "\n"; - } - -//get the fields and then display them - $sql = "select * from v_schema_fields "; - $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and schema_uuid = '$schema_uuid' "; - $sql .= "order by field_column asc, field_order asc "; - $prep_statement = $db->prepare($sql); - $prep_statement->execute(); - $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); - $result_count = count($result); - - echo "\n"; - echo "\n"; - - if ($result_count == 0) { //no results - echo "\n"; - } - else { //received results - $x=1; - $field_column_previous = ''; - $column_schema_cell_status = ''; - foreach($result as $row) { - //handle more than one column - $field_column = $row[field_column]; - //echo "\n"; - if ($field_column != $field_column_previous) { - $column_schema_cell_status = 'open'; - //do the following except for the first time through the loop - if ($x != 1) { - //close the table - echo "\n"; - echo "\n"; - echo "
 
\n"; - //close the row - echo "\n"; - } - //open a new row - echo "\n"; - //start a table in the new row - echo "\n"; - } - - //display the fields - if ($row['field_type'] != "hidden"){ - switch ($row['field_type']) { - case "add_user": - break; - case "add_date": - break; - case "mod_user": - break; - case "mod_date": - break; - default: - echo "\n"; - if ($row['field_type'] == "label") { - echo "\n"; - } - else { - if ($row['field_required'] == "yes") { - echo "\n"; - } - } - } - switch ($row['field_type']) { - case "checkbox": - echo "\n"; - break; - case "text": - echo "\n"; - break; - case "email": - echo "\n"; - break; - case "label": - break; - case "password": - echo "\n"; - break; - case "pin_number": - echo "\n"; - break; - case "hidden": - echo "\n"; - echo "\n"; - break; - case "url": - echo "\n"; - break; - case "date": - echo "\n"; - break; - case "truefalse": - //checkbox - echo "\n"; - break; - case "textarea": - echo "\n"; - break; - case "radiobutton": - echo "\n"; - break; - case "select": - echo "\n"; - break; - case "ipv4": - //max 15 - echo "\n"; - break; - case "ipv6": - //maximum number of characters 39 - echo "\n"; - break; - case "phone": - $tmp_phone = $data_row[$row['field_name']]; - $tmp_phone = format_phone($tmp_phone); - echo "\n"; - break; - case "money": - echo "\n"; - break; - case "add_user": - //echo "\n"; - break; - case "add_date": - //echo "\n"; - break; - case "mod_user": - //echo "\n"; - break; - case "mod_date": - //echo "\n"; - break; - case "uploadimage": - if (strlen($data_row[$row['field_name']]) > 0) { - echo "\n"; - } - else { - echo "\n"; - } - break; - case "upload_file": - if (strlen($data_row[$row['field_name']]) > 0) { - echo "\n"; - } - else { - echo "\n"; - } - - break; - default: - echo "\n"; - } - if ($row['field_type'] != "hidden"){ - echo "\n"; - } - - //set the current value to the previous value - $field_column_previous = $field_column; - - $x++; - - } //end foreach - unset($sql, $result, $row_count); - - if ($column_schema_cell_status == 'open') { - $column_schema_cell_status = 'closed'; - } - } //end if results - - echo " \n"; - echo " \n"; - echo " \n"; - echo "
\n"; - echo " ".$row['field_label']."\n"; - echo "\n"; - } - else { - echo "\n"; - } - echo "".$row['field_label']."\n"; - echo "\n"; - echo "\n"; - if (strlen($data_row[$row['field_name']])>0) { - echo "\n"; - } - else { - 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 ""; - //echo "\n"; - //echo " \n"; - //echo ""; - //echo "
"; - //echo "\n"; - echo "
\n"; - echo "\n"; - echo "\n"; - echo "\n"; - switch ($row['field_name']) { - case "true": - echo "\n"; - echo "\n"; - break; - case "false": - echo "\n"; - echo "\n"; - break; - default: - echo "\n"; - echo "\n"; - } - - echo "\n"; - echo "
".$text['option-true']."".$text['option-false']."".$text['option-true']."".$text['option-false']."".$text['option-true']."".$text['option-false']."
\n"; - echo "
\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - $sqlselect = "SELECT data_types_name, data_types_value "; - $sqlselect .= "FROM v_schema_name_values "; - $sqlselect .= "where domain_uuid = '".$domain_uuid."' "; - $sqlselect .= "and schema_field_uuid = '".$row["schema_field_uuid"]."' "; - $prep_statement_2 = $db->prepare($sqlselect); - $prep_statement_2->execute(); - $result2 = $prep_statement_2->fetchAll(PDO::FETCH_NAMED); - $result_count2 = count($result2); - - echo ""; - if ($result_count > 0) { - foreach($result2 as $row2) { - echo ""; - } //end foreach - } //end if results - unset($sqlselect, $result2, $result_count2); - echo "
".$row2["data_types_name"].""; } else { echo ">"; } - echo "
"; - //echo "\n"; - echo "
\n"; - echo "\n"; - - $sqlselect = "SELECT data_types_name, data_types_value "; - $sqlselect .= "FROM v_schema_name_values "; - $sqlselect .= "where domain_uuid = '".$domain_uuid."' "; - $sqlselect .= "and schema_field_uuid = '".$row["schema_field_uuid"]."' "; - $prep_statement_2 = $db->prepare($sqlselect); - $prep_statement_2->execute(); - $result2 = $prep_statement_2->fetchAll(PDO::FETCH_NAMED); - $result_count2 = count($result2); - - 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 ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - - echo "
"; - echo "".$data_row[$row['field_name']].""; - echo ""; - echo "\n"; - //echo "\n"; - echo "
"; - if (file_exists($imagetempdir.$data_row[$row['field_name']])) { - echo ""; - } - else { - echo ""; - } - echo "
"; - echo "
"; - echo "
\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo "
"; - echo "".$data_row[$row['field_name']].""; - echo ""; - echo "\n"; - echo "
"; - echo ""; - echo "
\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "
\n"; - if ($action == "add" && permission_exists('schema_data_add')) { - echo " \n"; - } - if ($action == "update" && permission_exists('schema_data_edit')) { - echo " \n"; - echo " \n"; - } - echo "
\n"; - - echo " \n"; - echo " \n"; - echo "\n"; - - if ($action == "update" && permission_exists('schema_data_edit')) { - //get the child schema_uuid and use it to show the list of data - $sql = "select * from v_schemas "; - $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and schema_parent_uuid = '$schema_uuid' "; - $prep_statement = $db->prepare($sql); - $prep_statement->execute(); - $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); - foreach ($result as &$row) { - echo "\n"; - echo " \n"; - echo "
"; - $_GET["id"] = $row["schema_uuid"]; - $schema_label = $row["schema_label"]; - $_GET["data_parent_row_uuid"] = $data_row_uuid; - - //show button - //echo "\n"; - - //show list - require_once "schema_data_view.php"; - echo " "; - echo " "; - } - } - echo "\n"; - -require_once "resources/footer.php"; -?> diff --git a/app/schemas/schema_data_view.php b/app/schemas/schema_data_view.php deleted file mode 100644 index 858c52e69e..0000000000 --- a/app/schemas/schema_data_view.php +++ /dev/null @@ -1,399 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ -require_once "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (permission_exists('schema_data_view')) { - //access granted -} -else { - echo "access denied"; - exit; -} - -//add multi-lingual support - $language = new text; - $text = $language->get(); - -if (strlen($_GET["id"]) > 0) { - $schema_uuid = check_str($_GET["id"]); - if (strlen($_GET["data_parent_row_uuid"])>0) { - $data_parent_row_uuid = $_GET["data_parent_row_uuid"]; - } - $search_all = strtolower(check_str($_GET["search_all"])); -} - -//used for changing the order - $order_by = $_GET["order_by"]; - $order = $_GET["order"]; - -//used to alternate colors when paging - $c = 0; - $row_style["0"] = "row_style0"; - $row_style["1"] = "row_style1"; - -//show the header - require_once "resources/header.php"; - $document['title'] = $text['title-data_view']; - -//get the information about the schema by using the id - $sql = "select * from v_schemas "; - $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and schema_uuid = '$schema_uuid' "; - $prep_statement = $db->prepare(check_sql($sql)); - $prep_statement->execute(); - $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC); - foreach ($result as &$row) { - $schema_category = $row["schema_category"]; - $schema_label = $row["schema_label"]; - $schema_name = $row["schema_name"]; - $schema_auth = $row["schema_auth"]; - $schema_captcha = $row["schema_captcha"]; - $schema_parent_uuid = $row["schema_parent_uuid"]; - $schema_description = $row["schema_description"]; - break; //limit to 1 row - } - unset ($prep_statement); - -//get the field information - $db_field_name_array = array(); - $db_value_array = array(); - $db_names .= "\n"; - $sql = "select * from v_schema_fields "; - $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and schema_uuid = '$schema_uuid' "; - $sql .= "order by field_order asc "; - $prep_statement = $db->prepare($sql); - $prep_statement->execute(); - $result_names = $prep_statement->fetchAll(PDO::FETCH_ASSOC); - $result_count = count($result); - foreach($result_names as $row) { - $field_label = $row["field_label"]; - $field_name = $row["field_name"]; - $field_type = $row["field_type"]; - $field_value = $row["field_value"]; - $field_list_hidden = $row["field_list_hidden"]; - $field_column = $row["field_column"]; - $field_required = $row["field_required"]; - $field_order = $row["field_order"]; - $field_order_tab = $row["field_order_tab"]; - $field_description = $row["field_description"]; - - $name_array[$field_name]['field_label'] = $row["field_label"]; - $name_array[$field_name]['field_type'] = $row["field_type"]; - $name_array[$field_name]['field_list_hidden'] = $row["field_list_hidden"]; - $name_array[$field_name]['field_column'] = $row["field_column"]; - $name_array[$field_name]['field_required'] = $row["field_required"]; - $name_array[$field_name]['field_order'] = $row["field_order"]; - $name_array[$field_name]['field_order_tab'] = $row["field_order_tab"]; - $name_array[$field_name]['field_description'] = $row["field_description"]; - } - unset($sql, $prep_statement, $row); - $fieldcount = count($name_array); - -//get the data - $sql = ""; - $sql .= "select * from v_schema_data "; - $sql .= "where domain_uuid = '".$domain_uuid."' "; - if (strlen($search_all) == 0) { - $sql .= "and schema_uuid = '$schema_uuid' "; - if (strlen($data_parent_row_uuid) > 0) { - $sql .= "and data_parent_row_uuid = '$data_parent_row_uuid' "; - } - } - else { - $sql .= "and data_row_uuid in ("; - $sql .= "select data_row_uuid from v_schema_data \n"; - $sql .= "where domain_uuid = '".$domain_uuid."' "; - $sql .= "and schema_uuid = '$schema_uuid' "; - if (strlen($data_parent_row_uuid) == 0) { - $tmp_digits = preg_replace('{\D}', '', $search_all); - if (is_numeric($tmp_digits) && strlen($tmp_digits) > 5) { - if (strlen($tmp_digits) == '11' ) { - $sql .= "and data_field_value like '%".substr($tmp_digits, -10)."%' \n"; - } - else { - $sql .= "and data_field_value like '%$tmp_digits%' \n"; - } - } - else { - $sql .= "and lower(data_field_value) like '%$search_all%' \n"; - } - } - else { - $sql .= "and data_parent_row_uuid = '$data_parent_row_uuid' "; - } - $sql .= ")\n"; - } - $sql .= "limit 20000\n"; - $prep_statement = $db->prepare($sql); - $prep_statement->execute(); - $result_values = $prep_statement->fetchAll(PDO::FETCH_ASSOC); - foreach($result_values as $row) { - //set a php variable - $field_name = $row[field_name]; - $data_row_uuid = $row[data_row_uuid]; - - //restructure the data by setting it the value_array - $value_array[$data_row_uuid][$field_name] = $row[data_field_value]; - $value_array[$data_row_uuid]['schema_uuid'] = $row["schema_uuid"]; - $value_array[$data_row_uuid]['data_row_uuid'] = $row[data_row_uuid]; - $value_array[$data_row_uuid]['schema_parent_uuid'] = $row[schema_parent_uuid]; - $value_array[$data_row_uuid]['data_parent_row_uuid'] = $row[data_parent_row_uuid]; - } - $num_rows = count($value_array); - -//create the connection to the memory dbase_add_record - try { - $db_memory = new PDO('sqlite::memory:'); //sqlite 3 - } - catch (PDOException $error) { - print "error: " . $error->getMessage() . "
"; - die(); - } - -//create a memory database and add the fields to the table - $sql = "CREATE TABLE memory_table "; - $sql .= "("; - $sql .= "'id' INTEGER PRIMARY KEY, "; - $sql .= "'schema_uuid' TEXT, "; - $sql .= "'data_row_uuid' TEXT, "; - $sql .= "'schema_parent_uuid' TEXT, "; - $sql .= "'data_parent_row_uuid' TEXT, "; - foreach($result_names as $row) { - if ($row["field_type"] != "label") { - if ($row["field_name"] != "domain_uuid") { - //$row["field_label"]; - //$row["field_name"]; - //$row["field_type"]; - if ($row["field_name"] == "number") { - $sql .= "'".$row["field_name"]."' NUMERIC, "; - } - else { - $sql .= "'".$row["field_name"]."' TEXT, "; - } - } - } - } - $sql .= "'domain_uuid' TEXT "; - $sql .= ");"; - $prep_statement = $db_memory->prepare($sql); - $prep_statement->execute(); - unset ($prep_statement, $sql); - -//list the values from the array - $x = 0; - foreach($value_array as $array) { - //insert the data into the memory table - $sql = "insert into memory_table "; - $sql .= "("; - $sql .= "'schema_uuid', "; - $sql .= "'data_row_uuid', "; - $sql .= "'schema_parent_uuid', "; - $sql .= "'data_parent_row_uuid', "; - //foreach($array as $key => $value) { - // $sql .= "'$key', "; - foreach($result_names as $row) { - $field_name = $row["field_name"]; - $sql .= "'$field_name', "; - } - $sql .= "'domain_uuid' "; - $sql .= ")"; - $sql .= "values "; - $sql .= "("; - $sql .= "'".$array['schema_uuid']."', "; - $sql .= "'".$array['data_row_uuid']."', "; - $sql .= "'".$array['schema_parent_uuid']."', "; - $sql .= "'".$array['data_parent_row_uuid']."', "; - //foreach($array as $key => $value) { - // $sql .= "'$value', "; - foreach($result_names as $row) { - $field_name = $row["field_name"]; - $sql .= "'".check_str($array[$field_name])."', "; - } - $sql .= "'$domain_uuid' "; - $sql .= ");"; - //echo "$sql

\n"; - $db_memory->exec(check_sql($sql)); - unset($sql); - unset($array); - //unset the row of data - unset($value_array[$x]); - //increment the value - $x++; - } - -//set the title and description of the table - echo "
\n"; - echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
$schema_label
\n"; - echo " $schema_description\n"; - echo "
\n"; - if (strlen($data_parent_row_uuid) == 0) { - $search_all = str_replace("''", "'", $search_all); - echo "
\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
\n"; - } - echo "
\n"; - echo "
"; - -//prepare for paging the results - require_once "resources/paging.php"; - $rows_per_page = 100; - $param = ""; - $page = $_GET['page']; - if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } - if (strlen($schema_parent_uuid) > 0) { - $param = "&id=$schema_parent_uuid&data_row_uuid=$data_row_uuid"; - } - else { - $param = "&id=$schema_uuid&data_row_uuid=$data_row_uuid"; - } - list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page); - $offset = $rows_per_page * $page; - -//list the data in the database - $sql = "select * from memory_table \n"; - $sql .= "where domain_uuid = '$domain_uuid' \n"; - $sql .= "limit $rows_per_page offset $offset \n"; - //$sql .= "order by field_order asc \n"; - $prep_statement = $db_memory->prepare($sql); - $prep_statement->execute(); - $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC); - -//begin the list - echo "\n"; - echo "\n"; - foreach($result_names as $row) { - if ($row['field_list_hidden'] != "hide") { - echo "\n"; - } - } - echo "\n"; - echo "\n"; - - $db_values = ''; - $x = 0; - foreach ($result as &$row) { - echo "\n"; - foreach($result_names as $row2) { - $field_name = $row2[field_name]; - - //get the values from the array and set as php variables - $field_label = $name_array[$field_name]['field_label']; - $field_type = $name_array[$field_name]['field_type']; - $field_list_hidden = $name_array[$field_name]['field_list_hidden']; - $field_column = $name_array[$field_name]['field_column']; - $field_required = $name_array[$field_name]['field_required']; - $field_order = $name_array[$field_name]['field_order']; - $field_order_tab = $name_array[$field_name]['field_order_tab']; - $field_description = $name_array[$field_name]['field_description']; - - if ($field_list_hidden != "hide") { - switch ($field_type) { - case "textarea": - $tmp_value = str_replace("\n", "
\n", $row[$field_name]); - echo "\n"; - unset($tmp_value); - break; - case "email": - echo "\n"; - break; - case "phone": - $tmp_phone = $row[$field_name]; - $tmp_phone = format_phone($tmp_phone); - echo "\n"; - break; - case "url": - $url = $row[$field_name]; - if (substr($url,0,4) != "http") { - $url = 'http://'.$url; - } - echo "\n"; - break; - default: - echo "\n"; - break; - } - } - } - - echo "\n"; - - echo "\n"; - if ($c==0) { $c=1; } else { $c=0; } - } - -//show the paging tools and final add button - echo "\n"; - echo "\n"; - echo "\n"; - - echo "
  ".$row['field_label']."  "; - if (permission_exists('schema_data_add')) { - echo "$v_link_label_add"; - } - echo "
".$tmp_value." ".$row[$field_name]." ".$tmp_phone." ".$row[$field_name]." ".$row[$field_name]." "; - if (permission_exists('schema_data_edit')) { - if (strlen($data_parent_row_uuid) == 0) { - echo "$v_link_label_edit"; - } - else { - echo "$v_link_label_edit"; - } - } - if (permission_exists('schema_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('schema_data_add')) { - echo "$v_link_label_add"; - } - echo "
\n"; - echo "
\n"; - echo "

\n"; - echo ""; - -//show the header - echo "

"; - require_once "resources/footer.php"; - -?> diff --git a/app/schemas/schema_delete.php b/app/schemas/schema_delete.php deleted file mode 100644 index 10e66da9f6..0000000000 --- a/app/schemas/schema_delete.php +++ /dev/null @@ -1,60 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ -require_once "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (permission_exists('schema_delete')) { - //access granted -} -else { - echo "access denied"; - exit; -} - -//add multi-lingual support - $language = new text; - $text = $language->get(); - -//get the http get variable - if (count($_GET)>0) { - $id = check_str($_GET["id"]); - } - -if (strlen($id) > 0) { - $sql = "delete from v_schemas "; - $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and schema_uuid = '$id' "; - $prep_statement = $db->prepare(check_sql($sql)); - $prep_statement->execute(); - unset($sql); -} - -//redirect the user - $_SESSION["message"] = $text['message-delete']; - header("Location: schemas.php"); - return; - -?> diff --git a/app/schemas/schema_edit.php b/app/schemas/schema_edit.php deleted file mode 100644 index e0b5c3ba8d..0000000000 --- a/app/schemas/schema_edit.php +++ /dev/null @@ -1,318 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ -require_once "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (permission_exists('schema_add') || permission_exists('schema_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"; - $schema_uuid = check_str($_REQUEST["id"]); - } - else { - $action = "add"; - } - -//get the http post variables - if (count($_POST)>0) { - $schema_category = check_str($_POST["schema_category"]); - $schema_category_other = check_str($_POST["schema_category_other"]); - if (strlen($schema_category_other) > 0) { $schema_category = $schema_category_other; } - $schema_label = check_str($_POST["schema_label"]); - $schema_name = check_str($_POST["schema_name"]); - $schema_auth = check_str($_POST["schema_auth"]); - $schema_captcha = check_str($_POST["schema_captcha"]); - $schema_parent_uuid = check_str($_POST["schema_parent_uuid"]); - $schema_description = check_str($_POST["schema_description"]); - } - -if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { - - $msg = ''; - if ($action == "update") { - $schema_uuid = check_str($_POST["schema_uuid"]); - } - - //check for all required data - if (strlen($schema_name) == 0) { $msg .= $text['message-required'].$text['label-schema_name']."
\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") { - $schema_uuid = uuid(); - $sql = "insert into v_schemas "; - $sql .= "("; - $sql .= "domain_uuid, "; - $sql .= "schema_uuid, "; - $sql .= "schema_category, "; - $sql .= "schema_label, "; - $sql .= "schema_name, "; - $sql .= "schema_auth, "; - $sql .= "schema_captcha, "; - $sql .= "schema_parent_uuid, "; - $sql .= "schema_description "; - $sql .= ")"; - $sql .= "values "; - $sql .= "("; - $sql .= "'$domain_uuid', "; - $sql .= "'$schema_uuid', "; - $sql .= "'$schema_category', "; - $sql .= "'$schema_label', "; - $sql .= "'$schema_name', "; - $sql .= "'$schema_auth', "; - $sql .= "'$schema_captcha', "; - if (strlen($schema_parent_uuid) == 0) { - $sql .= "null, "; - } - else { - $sql .= "'$schema_parent_uuid', "; - } - $sql .= "'$schema_description' "; - $sql .= ")"; - $db->exec(check_sql($sql)); - unset($sql); - - $_SESSION["message"] = $text['message-add']; - header("Location: schemas.php"); - return; - } //if ($action == "add") - - if ($action == "update") { - $sql = "update v_schemas set "; - $sql .= "domain_uuid = '$domain_uuid', "; - $sql .= "schema_category = '$schema_category', "; - $sql .= "schema_label = '$schema_label', "; - $sql .= "schema_name = '$schema_name', "; - $sql .= "schema_auth = '$schema_auth', "; - $sql .= "schema_captcha = '$schema_captcha', "; - if (strlen($schema_parent_uuid) == 0) { - $sql .= "schema_parent_uuid = null, "; - } - else { - $sql .= "schema_parent_uuid = '$schema_parent_uuid', "; - } - $sql .= "schema_description = '$schema_description' "; - $sql .= "where schema_uuid = '$schema_uuid'"; - $db->exec(check_sql($sql)); - unset($sql); - - $_SESSION["message"] = $text['message-update']; - header("Location: schemas.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") { - $schema_uuid = $_GET["id"]; - $sql = "select * from v_schemas "; - $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and schema_uuid = '$schema_uuid' "; - $prep_statement = $db->prepare(check_sql($sql)); - $prep_statement->execute(); - $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); - foreach ($result as &$row) { - $schema_category = $row["schema_category"]; - $schema_label = $row["schema_label"]; - $schema_name = $row["schema_name"]; - $schema_auth = $row["schema_auth"]; - $schema_captcha = $row["schema_captcha"]; - $schema_parent_uuid = $row["schema_parent_uuid"]; - $schema_description = $row["schema_description"]; - break; //limit to 1 row - } - unset ($prep_statement); - } - -//show the header - require_once "resources/header.php"; - $document['title'] = $text['title-schema']; - -//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 "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo " \n"; - echo " \n"; - echo " "; - echo "
".$text['header-schema']."\n"; - echo " \n"; - if (strlen($schema_uuid) > 0) { - echo " \n"; - echo " \n"; - } - include "export/index.php"; - echo " \n"; - echo "
\n"; - echo $text['description-schema']."

\n"; - echo "
\n"; - echo " ".$text['label-category']."\n"; - echo "\n"; - $select_name = 'v_schemas';$field_name = 'schema_category';$sql_where_optional = "";$field_current_value = $schema_category; - echo html_select_other($db, $select_name, $field_name, $sql_where_optional, $field_current_value); - echo $text['description-category']."\n"; - 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-authentication']."\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo $text['description-authentication']."\n"; - echo "
\n"; - echo " ".$text['label-parent_schema']."\n"; - echo "\n"; - - echo " \n"; - - echo "
\n"; - echo $text['description-parent_schema']."\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 " \n"; - echo "
"; - echo "

"; - echo "
"; - - if ($action == "update") { - require "schema_fields.php"; - } - - -//show the footer - require_once "resources/footer.php"; -?> \ No newline at end of file diff --git a/app/schemas/schema_field_delete.php b/app/schemas/schema_field_delete.php deleted file mode 100644 index c6d15e8c7b..0000000000 --- a/app/schemas/schema_field_delete.php +++ /dev/null @@ -1,62 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ -require_once "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (permission_exists('schema_delete')) { - //access granted -} -else { - echo "access denied"; - exit; -} - -//add multi-lingual support - $language = new text; - $text = $language->get(); - -//get the http values - if (count($_GET) > 0) { - $id = check_str($_GET["id"]); - $schema_uuid = check_str($_GET["schema_uuid"]); - } - -//delete the data - if (strlen($id) > 0) { - $sql = "delete from v_schema_fields "; - $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and schema_field_uuid = '$id' "; - $prep_statement = $db->prepare(check_sql($sql)); - $prep_statement->execute(); - unset($sql); - } - -//redirect the user - $_SESSION["message"] = $text['message-delete']; - header("Location: schema_edit.php?id=".$schema_uuid); - return; - -?> \ No newline at end of file diff --git a/app/schemas/schema_field_edit.php b/app/schemas/schema_field_edit.php deleted file mode 100644 index cf5079ce02..0000000000 --- a/app/schemas/schema_field_edit.php +++ /dev/null @@ -1,514 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ -require_once "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (permission_exists('schema_add') || permission_exists('schema_edit')) { - //access granted -} -else { - echo "access denied"; - exit; -} - -//add multi-lingual support - $language = new text; - $text = $language->get(); - -//set the action as an add or update -if (isset($_REQUEST["id"])) { - $action = "update"; - $schema_field_uuid = check_str($_REQUEST["id"]); -} -else { - $action = "add"; -} - -//get the http variables - if (strlen($_GET["schema_uuid"]) > 0) { - $schema_uuid = check_str($_GET["schema_uuid"]); - } - -//get the http post variables -if (count($_POST)>0) { - $field_label = check_str($_POST["field_label"]); - $field_name = check_str($_POST["field_name"]); - $field_type = check_str($_POST["field_type"]); - $field_value = check_str($_POST["field_value"]); - $field_list_hidden = check_str($_POST["field_list_hidden"]); - $field_search_by = check_str($_POST["field_search_by"]); - $field_column = check_str($_POST["field_column"]); - $field_required = check_str($_POST["field_required"]); - $field_order = check_str($_POST["field_order"]); - $field_order_tab = check_str($_POST["field_order_tab"]); - $field_description = check_str($_POST["field_description"]); -} - -if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { - - $msg = ''; - if ($action == "update") { - $schema_field_uuid = check_str($_POST["schema_field_uuid"]); - } - - //check for all required data - if (strlen($domain_uuid) == 0) { $msg .= $text['message-required']."domain_uuid
\n"; } - if (strlen($field_name) == 0 && $field_type != "label") { $msg .= $text['message-required'].$text['label-field_name']."
\n"; } - if (strlen($field_type) == 0) { $msg .= $text['message-required'].$text['label-field_type']."
\n"; } - if (strlen($field_list_hidden) == 0) { $msg .= $text['message-required'].$text['label-field_visibility']."
\n"; } - if (strlen($field_column) == 0) { $msg .= $text['message-required'].$text['label-field_column']."
\n"; } - if (strlen($field_required) == 0) { $msg .= $text['message-required'].$text['label-field_required']."
\n"; } - if (strlen($field_order) == 0) { $msg .= $text['message-required'].$text['label-field_order']."
\n"; } - if (strlen($field_order_tab) == 0) { $msg .= $text['message-required'].$text['label-field_tab_order']."
\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('schema_add')) { - $schema_field_uuid = uuid(); - $sql = "insert into v_schema_fields "; - $sql .= "("; - $sql .= "domain_uuid, "; - $sql .= "schema_uuid, "; - $sql .= "schema_field_uuid, "; - $sql .= "field_label, "; - $sql .= "field_name, "; - $sql .= "field_type, "; - $sql .= "field_value, "; - $sql .= "field_list_hidden, "; - $sql .= "field_search_by, "; - $sql .= "field_column, "; - $sql .= "field_required, "; - $sql .= "field_order, "; - $sql .= "field_order_tab, "; - $sql .= "field_description "; - $sql .= ")"; - $sql .= "values "; - $sql .= "("; - $sql .= "'$domain_uuid', "; - $sql .= "'$schema_uuid', "; - $sql .= "'$schema_field_uuid', "; - $sql .= "'$field_label', "; - $sql .= "'$field_name', "; - $sql .= "'$field_type', "; - $sql .= "'$field_value', "; - $sql .= "'$field_list_hidden', "; - $sql .= "'$field_search_by', "; - $sql .= "'$field_column', "; - $sql .= "'$field_required', "; - $sql .= "'$field_order', "; - $sql .= "'$field_order_tab', "; - $sql .= "'$field_description' "; - $sql .= ")"; - $db->exec(check_sql($sql)); - unset($sql); - - $_SESSION["message"] = $text['message-add']; - header("Location: schema_edit.php?id=".$schema_uuid); - return; - } //if ($action == "add") - - if ($action == "update" && permission_exists('schema_edit')) { - $sql = "update v_schema_fields set "; - $sql .= "field_label = '$field_label', "; - $sql .= "field_name = '$field_name', "; - $sql .= "field_type = '$field_type', "; - $sql .= "field_value = '$field_value', "; - $sql .= "field_list_hidden = '$field_list_hidden', "; - $sql .= "field_search_by = '$field_search_by', "; - $sql .= "field_column = '$field_column', "; - $sql .= "field_required = '$field_required', "; - $sql .= "field_order = '$field_order', "; - $sql .= "field_order_tab = '$field_order_tab', "; - $sql .= "field_description = '$field_description' "; - $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and schema_uuid = '$schema_uuid'"; - $sql .= "and schema_field_uuid = '$schema_field_uuid' "; - $db->exec(check_sql($sql)); - unset($sql); - - $_SESSION["message"] = $text['message-update']; - header("Location: schema_edit.php?id=".$schema_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") { - $schema_uuid = $_GET["schema_uuid"]; - $schema_field_uuid = $_GET["id"]; - - $sql = "select * from v_schema_fields "; - $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and schema_uuid = '$schema_uuid' "; - $sql .= "and schema_field_uuid = '$schema_field_uuid' "; - $prep_statement = $db->prepare(check_sql($sql)); - $prep_statement->execute(); - $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); - foreach ($result as &$row) { - $field_label = $row["field_label"]; - $field_name = $row["field_name"]; - $field_type = $row["field_type"]; - $field_value = $row["field_value"]; - $field_list_hidden = $row["field_list_hidden"]; - $field_search_by = $row["field_search_by"]; - $field_column = $row["field_column"]; - $field_required = $row["field_required"]; - $field_order = $row["field_order"]; - $field_order_tab = $row["field_order_tab"]; - $field_description = $row["field_description"]; - break; //limit to 1 row - } - unset ($prep_statement); - } - -//show the header - require_once "resources/header.php"; - $document['title'] = $text['title-field']; - -//begin 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 "\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['header-field'].""; - echo " "; - echo " \n"; - echo "
\n"; - echo $text['description-field']."

\n"; - echo "
\n"; - echo " ".$text['label-field_label']."\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo $text['description-field_label']."\n"; - echo "
\n"; - echo " ".$text['label-field_name']."\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo $text['description-field_name']."\n"; - echo "
\n"; - echo " ".$text['label-field_type']."\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo $text['description-field_type']."\n"; - echo "
\n"; - echo " ".$text['label-field_value']."\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo $text['description-field_value']."\n"; - echo "
\n"; - echo " ".$text['label-field_visibility']."\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo $text['description-field_visibility']."\n"; - echo "
\n"; - echo " ".$text['label-field_search_by']."\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo $text['description-field_search_by']."\n"; - echo "
\n"; - echo " ".$text['label-field_column']."\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo $text['description-field_column']."\n"; - echo "
\n"; - echo " ".$text['label-field_required']."\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo $text['description-field_required']."\n"; - echo "
\n"; - echo " ".$text['label-field_order']."\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo $text['description-field_order']."\n"; - echo "
\n"; - echo " ".$text['label-field_tab_order']."\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo $text['description-field_tab_order']."\n"; - echo "
\n"; - echo " ".$text['label-field_description']."\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo $text['description-field_description']."\n"; - echo "
\n"; - echo " \n"; - if ($action == "update") { - echo " \n"; - } - echo "
"; - echo " \n"; - echo "
"; - echo "

"; - echo "
"; - - if ($action == "update") { - if ($field_type == "select") { - require "schema_name_values.php"; - } - } - -//show the footer - require_once "resources/footer.php"; -?> \ No newline at end of file diff --git a/app/schemas/schema_fields.php b/app/schemas/schema_fields.php deleted file mode 100644 index d2dfe42d67..0000000000 --- a/app/schemas/schema_fields.php +++ /dev/null @@ -1,202 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ -require_once "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (permission_exists('schema_view')) { - //access granted -} -else { - echo "access denied"; - exit; -} - -//require_once "resources/header.php"; -require_once "resources/paging.php"; - -$order_by = $_GET["order_by"]; -$order = $_GET["order"]; - -//show the content - echo "\n"; - echo "\n"; - echo " "; - echo ""; - echo "
\n"; - echo "
"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "
".$text['header-fields']." 
\n"; - echo $text['description-fields']."

\n"; - echo "
\n"; - - if (strlen($order_by) == 0) { - $order_by = 'field_order'; - $order = 'asc'; - } - - $sql = "select * from v_schema_fields "; - $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and schema_uuid = '$schema_uuid' "; - 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(PDO::FETCH_NAMED); - $result_count = count($result); - unset ($prep_statement, $sql); - - $c = 0; - $row_style["0"] = "row_style0"; - $row_style["1"] = "row_style1"; - - echo "\n"; - echo "\n"; - echo th_order_by('field_label', $text['label-field_label'], $order_by, $order); - echo th_order_by('field_name', $text['label-field_name'], $order_by, $order); - echo th_order_by('field_type', $text['label-field_type'], $order_by, $order); - echo th_order_by('field_column', $text['label-field_column'], $order_by, $order); - echo th_order_by('field_required', $text['label-field_required'], $order_by, $order); - echo th_order_by('field_list_hidden', $text['label-field_visibility'], $order_by, $order); - echo th_order_by('field_search_by', $text['label-field_search_by'], $order_by, $order); - echo th_order_by('field_order', $text['label-field_order'], $order_by, $order); - echo th_order_by('field_order_tab', $text['label-field_tab_order'], $order_by, $order); - echo th_order_by('field_description', $text['label-field_description'], $order_by, $order); - echo "\n"; - echo "\n"; - - if ($result_count > 0) { - foreach($result as $row) { - $tr_link = (permission_exists('schema_edit')) ? "href='schema_field_edit.php?schema_uuid=".$row['schema_uuid']."&id=".$row['schema_field_uuid']."'" : null; - 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"; - 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('schema_view')) { - echo "$v_link_label_add"; - } - echo "
".$row['field_label']." "; - if (permission_exists('schema_edit')) { - echo "".$row['field_name'].""; - } - else { - echo $row['field_name']; - } - echo " "; - switch ($row['field_type']) { - case "text" : echo $text['option-text']; break; - case "numeric" : echo $text['option-number']; break; - case "date" : echo $text['option-date']; break; - case "email" : echo $text['option-email']; break; - case "label" : echo $text['option-label']; break; - case "phone" : echo $text['option-phone']; break; - case "checkbox" : echo $text['option-check_box']; break; - case "textarea" : echo $text['option-text_area']; break; - case "select" : echo $text['option-select']; break; - case "hidden" : echo $text['option-hidden']; break; - case "uuid" : echo $text['option-uuid']; break; - case "password" : echo $text['option-password']; break; - case "pin_number" : echo $text['option-pin_number']; break; - case "image" : echo $text['option-image_upload']; break; - case "upload_file" : echo $text['option-file_upload']; break; - case "url" : echo $text['option-url']; break; - case "mod_date" : echo $text['option-modified_date']; break; - case "mod_user" : echo $text['option-modified_user']; break; - default : echo $row['field_type']; - } - echo " ".$row['field_column'].""; - if ($row['field_required'] == 'yes') { - echo $text['option-true']; - } - else if ($row['field_required'] == 'no') { - echo $text['option-false']; - } - echo " "; - if ($row['field_list_hidden'] == 'show') { - echo $text['option-visible']; - } - else if ($row['field_list_hidden'] == 'hide') { - echo $text['option-hidden']; - } - echo " "; - if ($row['field_search_by'] == 'yes') { - echo $text['option-true']; - } - else if ($row['field_search_by'] == 'no') { - echo $text['option-false']; - } - echo " ".$row['field_order']."".$row['field_order_tab']."".$row['field_description']." "; - if (permission_exists('schema_edit')) { - echo "$v_link_label_edit"; - } - if (permission_exists('schema_delete')) { - echo "$v_link_label_delete"; - } - echo "
\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
  "; - if (permission_exists('schema_add')) { - echo "$v_link_label_add"; - } - echo "
\n"; - echo "
"; - - echo "
"; - echo "

"; - -//include the footer -// require_once "resources/footer.php"; - -?> \ No newline at end of file diff --git a/app/schemas/schema_import.php b/app/schemas/schema_import.php deleted file mode 100644 index a494c9c467..0000000000 --- a/app/schemas/schema_import.php +++ /dev/null @@ -1,369 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ -include "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (permission_exists('schema_edit')) { - //access granted -} -else { - echo "access denied"; - exit; -} - -//add multi-lingual support - $language = new text; - $text = $language->get(); - -if (count($_POST)>0) { - $schema_uuid = trim($_REQUEST["id"]); - $data = trim($_POST["data"]); - $data_delimiter = trim($_POST["data_delimiter"]); - $data_enclosure = trim($_POST["data_enclosure"]); -} - -//define the php class - class v_schema_fields { - var $domain_uuid; - var $schema_uuid; - var $field_label; - var $field_name; - var $field_type; - var $field_value; - var $field_list_hidden; - var $field_column; - var $field_required; - var $field_order; - var $field_order_tab; - var $field_description; - - function db_field_exists() { - global $db; - $sql = "select count(*) as num_rows from v_schema_fields "; - $sql .= "where domain_uuid = '$this->domain_uuid' "; - $sql .= "and schema_uuid ='$this->schema_uuid' "; - $sql .= "and field_name = '$this->field_name' "; - $prep_statement = $db->prepare($sql); - if ($prep_statement) { - $prep_statement->execute(); - $row = $prep_statement->fetch(PDO::FETCH_ASSOC); - if ($row['num_rows'] > 0) { - return true; - } - else { - return false; - } - } - } - - function db_insert() { - global $db; - $sql = "insert into v_schema_fields "; - $sql .= "("; - $sql .= "schema_field_uuid, "; - $sql .= "domain_uuid, "; - $sql .= "schema_uuid, "; - $sql .= "field_label, "; - $sql .= "field_name, "; - $sql .= "field_type, "; - $sql .= "field_value, "; - $sql .= "field_list_hidden, "; - $sql .= "field_search_by, "; - $sql .= "field_column, "; - $sql .= "field_required, "; - $sql .= "field_order, "; - $sql .= "field_order_tab, "; - $sql .= "field_description "; - $sql .= ")"; - $sql .= "values "; - $sql .= "("; - $sql .= "'".uuid()."', "; - $sql .= "'$this->domain_uuid', "; - $sql .= "'$this->schema_uuid', "; - $sql .= "'$this->field_label', "; - $sql .= "'$this->field_name', "; - $sql .= "'$this->field_type', "; - $sql .= "'$this->field_value', "; - $sql .= "'$this->field_list_hidden', "; - $sql .= "'no', "; - $sql .= "'$this->field_column', "; - $sql .= "'$this->field_required', "; - $sql .= "'$this->field_order', "; - $sql .= "'$this->field_order_tab', "; - $sql .= "'$this->field_description' "; - $sql .= ")"; - if (!$this->db_field_exists()) { - $db->exec(check_sql($sql)); - } - unset($sql); - } - } - - class v_schema_data { - var $domain_uuid; - var $schema_uuid; - var $data_row_uuid; - var $field_name; - var $data_field_value; - var $last_insert_id; - var $schema_data_uuid; - - function db_unique_id() { - global $db; - $sql = "insert into v_schema_data_row_id "; - $sql .= "("; - $sql .= "domain_uuid "; - $sql .= ")"; - $sql .= "values "; - $sql .= "("; - $sql .= "'$this->domain_uuid' "; - $sql .= ")"; - $db->exec($sql); - unset($sql); - return $db->lastInsertId($id); - } - - function db_insert() { - global $db; - $sql = "insert into v_schema_data "; - $sql .= "("; - $sql .= "schema_data_uuid, "; - $sql .= "domain_uuid, "; - $sql .= "data_row_uuid, "; - $sql .= "schema_uuid, "; - $sql .= "field_name, "; - $sql .= "data_field_value, "; - $sql .= "data_add_user, "; - $sql .= "data_add_date "; - $sql .= ")"; - $sql .= "values "; - $sql .= "("; - $sql .= "'".uuid()."', "; - $sql .= "'$this->domain_uuid', "; - $sql .= "'$this->data_row_uuid', "; - $sql .= "'$this->schema_uuid', "; - $sql .= "'$this->field_name', "; - $sql .= "'$this->data_field_value', "; - $sql .= "'".$_SESSION["username"]."', "; - $sql .= "now() "; - $sql .= ")"; - $db->exec($sql); - $this->last_insert_id = $db->lastInsertId($id); - unset($sql); - } - - function db_update() { - global $db; - $sql = "update v_schema_data set "; - $sql .= "data_row_uuid = '$this->data_row_uuid', "; - $sql .= "field_name = '$this->field_name', "; - $sql .= "data_field_value = '$this->data_field_value', "; - $sql .= "data_add_user = '".$_SESSION["username"]."', "; - $sql .= "data_add_date = now() "; - $sql .= "where domain_uuid = '$this->domain_uuid' "; - $sql .= "and schema_data_uuid = '$this->schema_data_uuid' "; - $db->exec($sql); - unset($sql); - } - } - -//built in str_getcsv requires PHP 5.3 or higher, this function can be used to reproduct the functionality but requirs PHP 5.1.0 or higher - if(!function_exists('str_getcsv')) { - function str_getcsv($input, $delimiter = ",", $enclosure = '"', $escape = "\\") { - $fp = fopen("php://memory", 'r+'); - fputs($fp, $input); - rewind($fp); - $data = fgetcsv($fp, null, $delimiter, $enclosure); // $escape only got added in 5.3.0 - fclose($fp); - return $data; - } - } - - //POST to PHP variables - if (count($_POST)>0) { - - //show the header - require_once "resources/header.php"; - $document['title'] = $text['title-import_results']; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo " \n"; - echo " \n"; - echo " "; - echo "
".$text['header-import_results']."\n"; - echo " \n"; - echo "

\n"; - echo "
\n"; - - //import data - if (strlen($data) > 0) { - $line_array = explode("\n",$data); - $name_array = explode(",",$line_array[0]); - $x = 0; - $db->beginTransaction(); - foreach($name_array as $key => $val) { - $field_label = trim($val); - $field_name = trim($val); - $field_name = str_replace(" ", "_", $field_name); - $field_name = str_replace("-", "_", $field_name); - $field_name = strtolower($field_name); - - $fields = new v_schema_fields; - $fields->domain_uuid = $domain_uuid; - $fields->schema_uuid = $schema_uuid; - $fields->field_label = $field_label; - $fields->field_name = $field_name; - $fields->field_type = 'text'; - $fields->field_value = ''; - $fields->field_list_hidden = 'show'; - $fields->field_column = '1'; - $fields->field_required = 'yes'; - $fields->field_order = $x; - $fields->field_order_tab = $x; - $fields->field_description = $field_label; - $fields->db_insert(); - unset($fields); - $x++; - } - - foreach($line_array as $key => $line) { - if ($key > 0) { - $value_array = str_getcsv($line, $data_delimiter, $data_enclosure); - $x=0; - foreach($value_array as $key => $val) { - - $field_label = trim($name_array[$x]); - $field_name = trim($name_array[$x]); - $field_name = str_replace(" ", "_", $field_name); - $field_name = str_replace("-", "_", $field_name); - $field_name = strtolower($field_name); - - $field_value = trim($val); - - $data = new v_schema_data; - $data->domain_uuid = $domain_uuid; - $data->schema_uuid = $schema_uuid; - if ($x == 0) { - $data_row_uuid = uuid(); - //echo "id: ".$data_row_uuid."
\n"; - } - $data->data_row_uuid = $data_row_uuid; - $data->field_name = $field_name; - $data->data_field_value = $field_value; - $data->db_insert(); - unset($data); - - echo "$field_name: $field_value
\n"; - $x++; - } - echo "
\n"; - } - } - $db->commit(); - } //if (strlen($data) > 0) - - echo "
"; - echo "

"; - - //show the footer - require_once "resources/footer.php"; - exit; - } - - -//show the header - require_once "resources/header.php"; - $document['title'] = $text['title-import']; - -//show the content - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "
".$text['header-import']."\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 "
\n"; - echo " ".$text['label-import_data']."\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo $text['description-import_data']."\n"; - echo "
\n"; - echo " ".$text['label-import_delimiter']."\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo $text['description-import_delimiter']."\n"; - echo "
\n"; - echo " ".$text['label-import_enclosure']."\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo $text['description-import_enclosure']."\n"; - echo "
\n"; - echo "
"; - echo " \n"; - echo "
"; - echo "

"; - echo "
"; - -require_once "resources/footer.php"; -?> \ No newline at end of file diff --git a/app/schemas/schema_name_value_delete.php b/app/schemas/schema_name_value_delete.php deleted file mode 100644 index 206d1701c4..0000000000 --- a/app/schemas/schema_name_value_delete.php +++ /dev/null @@ -1,63 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ -require_once "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (permission_exists('schema_delete')) { - //access granted -} -else { - echo "access denied"; - exit; -} - -//add multi-lingual support - $language = new text; - $text = $language->get(); - -//get the http values - if (count($_GET) > 0) { - $id = check_str($_GET["id"]); - $schema_uuid = check_str($_GET["schema_uuid"]); - $schema_field_uuid = check_str($_GET["schema_field_uuid"]); - } - -//delete the data - if (strlen($id) > 0) { - $sql .= "delete from v_schema_name_values "; - $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and schema_name_value_uuid = '$id' "; - $prep_statement = $db->prepare(check_sql($sql)); - $prep_statement->execute(); - unset($sql); - } - -//redirect the user - $_SESSION["message"] = $text['message-delete']; - header("Location: schema_field_edit.php?schema_uuid=".$schema_uuid."&id=".$schema_field_uuid); - return; - -?> \ No newline at end of file diff --git a/app/schemas/schema_name_value_edit.php b/app/schemas/schema_name_value_edit.php deleted file mode 100644 index dc7f026918..0000000000 --- a/app/schemas/schema_name_value_edit.php +++ /dev/null @@ -1,220 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ -require_once "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (permission_exists('schema_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"; - $schema_name_value_uuid = check_str($_REQUEST["id"]); - } - else { - $action = "add"; - } - -if (strlen($_GET["schema_field_uuid"]) > 0) { - $schema_field_uuid = check_str($_GET["schema_field_uuid"]); -} - -//POST to PHP variables - if (count($_POST)>0) { - //$domain_uuid = check_str($_POST["domain_uuid"]); - $data_types_name = check_str($_POST["data_types_name"]); - $data_types_value = check_str($_POST["data_types_value"]); - $schema_uuid = $_REQUEST["schema_uuid"]; - $schema_field_uuid = $_REQUEST["schema_field_uuid"]; - } - -if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { - - $msg = ''; - if ($action == "update") { - $schema_name_value_uuid = check_str($_POST["schema_name_value_uuid"]); - } - - //check for all required data - if (strlen($domain_uuid) == 0) { $msg .= $text['message-required']."domain_uuid
\n"; } - if (strlen($schema_uuid) == 0) { $msg .= $text['message-required']."schema_uuid
\n"; } - if (strlen($schema_field_uuid) == 0) { $msg .= $text['message-required']."schema_field_uuid
\n"; } - if (strlen($data_types_name) == 0) { $msg .= $text['message-required'].$text['label-name_value_name']."
\n"; } - if (strlen($data_types_value) == 0) { $msg .= $text['message-required'].$text['label-name_value_value']."
\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") { - $sql = "insert into v_schema_name_values "; - $sql .= "("; - $sql .= "schema_name_value_uuid, "; - $sql .= "domain_uuid, "; - $sql .= "schema_uuid, "; - $sql .= "schema_field_uuid, "; - $sql .= "data_types_name, "; - $sql .= "data_types_value "; - $sql .= ") "; - $sql .= "values "; - $sql .= "("; - $sql .= "'".uuid()."', "; - $sql .= "'".$_SESSION['domain_uuid']."', "; - $sql .= "'$schema_uuid', "; - $sql .= "'$schema_field_uuid', "; - $sql .= "'$data_types_name', "; - $sql .= "'$data_types_value' "; - $sql .= ")"; - $db->exec(check_sql($sql)); - unset($sql); - - $_SESSION["message"] = $text['message-add']; - header("Location: schema_field_edit.php?schema_uuid=".$schema_uuid."&id=".$schema_field_uuid); - return; - } //if ($action == "add") - - if ($action == "update") { - $sql = "update v_schema_name_values set "; - $sql .= "data_types_name = '$data_types_name', "; - $sql .= "data_types_value = '$data_types_value' "; - $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and schema_uuid = '$schema_uuid' "; - $sql .= "and schema_field_uuid = '$schema_field_uuid' "; - $sql .= "and schema_name_value_uuid = '$schema_name_value_uuid' "; - $db->exec(check_sql($sql)); - unset($sql); - - $_SESSION["message"] = $text['message-update']; - header("Location: schema_field_edit.php?schema_uuid=".$schema_uuid."&id=".$schema_field_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") { - $schema_uuid = $_GET["schema_uuid"]; - $schema_field_uuid = $_GET["schema_field_uuid"]; - $schema_name_value_uuid = $_GET["id"]; - $sql = "select * from v_schema_name_values "; - $sql .= "where domain_uuid = '$domain_uuid' "; - //$sql .= "and schema_uuid = '$schema_uuid' "; - $sql .= "and schema_field_uuid = '$schema_field_uuid' "; - $sql .= "and schema_name_value_uuid = '$schema_name_value_uuid' "; - $prep_statement = $db->prepare(check_sql($sql)); - $prep_statement->execute(); - $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); - foreach ($result as &$row) { - $data_types_name = $row["data_types_name"]; - $data_types_value = $row["data_types_value"]; - break; //limit to 1 row - } - unset ($prep_statement); - } - -//show the header - require_once "resources/header.php"; - $document['title'] = $text['title-name_value']; - -//show the content - echo "
\n"; - echo "\n"; - - echo "\n"; - if ($action == "add") { - echo "\n"; - } - if ($action == "update") { - 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['header-name_value']." ".$text['button-add']."".$text['header-name_value']." ".$text['button-edit'].""; - echo " "; - echo " \n"; - echo "
\n"; - echo $text['description-name_value']."

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

"; - echo "
"; - -require_once "resources/footer.php"; -?> \ No newline at end of file diff --git a/app/schemas/schema_name_values.php b/app/schemas/schema_name_values.php deleted file mode 100644 index 0ca9d2799b..0000000000 --- a/app/schemas/schema_name_values.php +++ /dev/null @@ -1,133 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ -require_once "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (permission_exists('schema_edit')) { - //access granted -} -else { - echo "access denied"; - exit; -} -require_once "resources/header.php"; -require_once "resources/paging.php"; - -//get the http values - $order_by = $_GET["order_by"]; - $order = $_GET["order"]; - -//show the content - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "
".$text['header-name_values']." 
\n"; - echo $text['description-name_values']."

\n"; - echo "
\n"; - - //$sql = "select * from v_schema_name_values "; - //$sql .= "where domain_uuid = '$domain_uuid' "; - //$sql .= "and schema_field_uuid = '$schema_field_uuid' "; - //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(PDO::FETCH_NAMED); - //$num_rows = count($result); - //unset ($prep_statement, $result, $sql); - //$rows_per_page = 10; - //$param = ""; - //$page = $_GET['page']; - //if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } - //list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page); - //$offset = $rows_per_page * $page; - - $sql = "select * from v_schema_name_values "; - $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and schema_field_uuid = '$schema_field_uuid' "; - 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); - $result_count = count($result); - unset ($prep_statement, $sql); - - $c = 0; - $row_style["0"] = "row_style0"; - $row_style["1"] = "row_style1"; - - echo "\n"; - echo "\n"; - echo th_order_by('data_types_name', $text['label-name_value_name'], $order_by, $order); - echo th_order_by('data_types_value', $text['label-name_value_value'], $order_by, $order); - echo "\n"; - echo "\n"; - - if ($result_count > 0) { - foreach($result as $row) { - echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "\n"; - $c = ($c==0) ? 1 : 0; - } //end foreach - unset($sql, $result, $row_count); - } //end if results - - echo "\n"; - echo "\n"; - echo "\n"; - - echo "
\n"; - echo " $v_link_label_add\n"; - echo "
".$row[data_types_name]."".$row[data_types_value]."\n"; - echo " $v_link_label_edit\n"; - echo " $v_link_label_delete\n"; - echo "
\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - //echo " \n"; - echo " \n"; - echo " \n"; - echo "
  $paging_controls\n"; - echo " $v_link_label_add\n"; - echo "
\n"; - echo "
"; - echo "

"; - echo ""; - -//show the footer - require_once "resources/footer.php"; - -?> \ No newline at end of file diff --git a/app/schemas/schemas.php b/app/schemas/schemas.php deleted file mode 100644 index a93fea8933..0000000000 --- a/app/schemas/schemas.php +++ /dev/null @@ -1,172 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ -require_once "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (permission_exists('schema_view')) { - //access granted -} -else { - echo "access denied"; - exit; -} - -//add multi-lingual support - $language = new text; - $text = $language->get(); - -require_once "resources/header.php"; -$document['title'] = $text['title-schemas']; - -require_once "resources/paging.php"; - -//get the http get variables - $order_by = $_GET["order_by"]; - $order = $_GET["order"]; - -//show the content - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "
".$text['header-schemas']." 
\n"; - echo $text['description-schemas']."\n"; - echo "

\n"; - echo "
\n"; - - $sql = " select * from v_schemas "; - $sql .= " where domain_uuid = '$domain_uuid' "; - 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(PDO::FETCH_NAMED); - $num_rows = count($result); - unset ($prep_statement, $result, $sql); - $rows_per_page = 100; - $param = ""; - $page = $_GET['page']; - if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } - list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page); - $offset = $rows_per_page * $page; - - $sql = " select * from v_schemas "; - $sql .= " where domain_uuid = '$domain_uuid' "; - 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); - $result_count = count($result); - unset ($prep_statement, $sql); - - $c = 0; - $row_style["0"] = "row_style0"; - $row_style["1"] = "row_style1"; - - echo "\n"; - echo "\n"; - echo th_order_by('schema_label', $text['label-label'], $order_by, $order); - echo th_order_by('schema_name', $text['label-schema_name'], $order_by, $order); - echo th_order_by('schema_auth', $text['label-authentication'], $order_by, $order); - echo th_order_by('schema_description', $text['label-description'], $order_by, $order); - //echo "\n"; - echo "\n"; - echo "\n"; - - if ($result_count == 0) { - //no results - } - else { //received results - foreach($result as $row) { - $tr_link = (permission_exists('schema_edit')) ? "href='schema_edit.php?id=".$row['schema_uuid']."'" : null; - 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 "
View"; - if (permission_exists('schema_add')) { - echo "$v_link_label_add"; - } - echo "
".$row['schema_label']." "; - if (permission_exists('schema_edit')) { - echo "".$row['schema_name'].""; - } - else { - echo $row['schema_name']; - } - echo " "; - if ($row['schema_auth'] == 'yes') { - echo $text['option-true']; - } - else if ($row['schema_auth'] == 'no') { - echo $text['option-false']; - } - else { - echo " "; - } - echo " ".$row['schema_description']." "; - if (permission_exists('schema_edit')) { - echo "$v_link_label_edit"; - } - if (permission_exists('schema_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('schema_add')) { - echo "$v_link_label_add"; - } - echo "
\n"; - echo "
"; - echo "

"; - -//show the footer - require_once "resources/footer.php"; - -?>