<title>Deployment process</title> <LINK REL=STYLESHEET HREF="skm.css" TYPE="text/css"> </head> <body> <?php start_main_frame(); start_left_pane(); display_menu(); end_left_pane(); start_right_pane(); ?> <?php $hostname = get_host_name($id); $account_name = get_account_name($id_account); echo "<fieldset><legend>Constructing securities for {$account_name} on host {$hostname}</legend>\n"; $output = prepare_authorizedkey_file($id, $id_account); ?> <table class="detail"> <tr> <td class="deployment"> <?php echo "{$output}\n"; ?> </td> </tr> </table>
function module_Chart($user_id, $date_start = "2000-01-01", $end_date = "2017-01-01", $query, $graph_for, $title, $added_qry = "", $module = "", $graph_type) { global $adb, $current_user, $mod_strings, $default_charset; global $days, $date_array, $period_type; if ($added_qry != "") { $query .= $added_qry; } $result = $adb->query($query); $no_of_rows = $adb->num_rows($result); $mod_count_array = array(); $search_str_array = array(); $mod_name_array = array(); $count_by_date[] = array(); $mod_tot_cnt_array = array(); $mod_name_val = ""; $mod_cnt_crtd_date = ""; $target_val = ""; $bar_target_val = ""; $test_target_val = ""; if ($no_of_rows != 0) { while ($row = $adb->fetch_array($result)) { if ($graph_for == 'sostatus' || $graph_for == 'leadsource' || $graph_for == 'leadstatus' || $graph_for == 'industry' || $graph_for == 'productcategory' || $graph_for == 'postatus' || $graph_for == 'invoicestatus' || $graph_for == 'ticketstatus' || $graph_for == 'priority' || $graph_for == 'category' || $graph_for == 'quotestage' || $graph_for == 'salesstage') { $mod_name = getTranslatedString($row[$graph_for]); $search_str = $row[$graph_for]; } else { $mod_name = $row[$graph_for]; $search_str = $row[$graph_for]; } if ($mod_name == "") { $mod_name = $mod_strings["Un Assigned"]; $search_str = " "; } $crtd_time = $row['createdtime']; $crtd_time_array = explode(" ", $crtd_time); $crtd_date = $crtd_time_array[0]; if (!isset($mod_tot_cnt_array[$crtd_date])) { $mod_tot_cnt_array[$crtd_date] = 0; } $mod_tot_cnt_array[$crtd_date] += 1; if (in_array($mod_name, $mod_name_array) == false) { $uniqueid[$mod_name] = '0'; array_push($mod_name_array, $mod_name); // getting all the unique Names into the array if ($graph_for == "productname") { if ($row['qtyinstock'] == '') { $mod_count_array[$mod_name] = 1; } else { $mod_count_array[$mod_name] = $row['qtyinstock']; } } } else { if ($graph_for == "productname") { $uniqueid[$mod_name] = $uniqueid[$mod_name] + 1; $mod_name = $mod_name . '[' . $uniqueid[$mod_name] . ']'; array_push($mod_name_array, $mod_name); // getting all the unique Names into the array if ($row['qtyinstock'] == '') { $mod_count_array[$mod_name] = 1; } else { $mod_count_array[$mod_name] = $row['qtyinstock']; } } } if (in_array($search_str, $search_str_array) == false) { array_push($search_str_array, $search_str); } //Counting the number of values for a type of graph if ($graph_for == "productname") { if ($row['qtyinstock'] == '') { $mod_count_array[$mod_name] = 1; } else { $mod_count_array[$mod_name] = $row['qtyinstock']; } } else { if (!isset($mod_count_array[$mod_name])) { $mod_count_array[$mod_name] = 0; } $mod_count_array[$mod_name]++; } //Counting the number of values for a type of graph for a particular date if (!isset($count_by_date[$mod_name][$crtd_date])) { $count_by_date[$mod_name][$crtd_date] = 0; } $count_by_date[$mod_name][$crtd_date] += 1; } $mod_by_mod_cnt = count($mod_name_array); if ($mod_by_mod_cnt != 0) { $url_string = ""; $mod_cnt_table = "<table border=0 cellspacing=1 cellpadding=3><tr>\r\n\t\t\t\t<th> Status </th>"; //Assigning the Header values to the vtiger_table and giving the dates as graphformat for ($i = 0; $i < $days; $i++) { $tdate = $date_array[$i]; $values = Graph_n_table_format($period_type, $tdate); $graph_format = $values[0]; $table_format = $values[1]; $mod_cnt_table .= "<th>{$table_format}</th>"; } $mod_cnt_table .= "<th>Total</th></tr>"; //For all type of the array for ($i = 0; $i < count($mod_name_array); $i++) { $search_str = $search_str_array[$i]; $mod_name = $mod_name_array[$i]; $id_name = ""; if ($mod_name == "Un Assigned") { $mod_name = $mod_strings["Un Assigned"]; $search_str = " "; } if ($graph_for == "accountid") { $name_val_table = get_account_name($mod_name); } else { $name_val_table = $mod_name; } $mod_cnt_table .= "<tr><td>{$name_val_table}</td>"; $mod_cnt_crtd_date = ""; //For all the days for ($j = 0; $j < $days; $j++) { $tdate = $date_array[$j]; if (!isset($count_by_date[$mod_name][$tdate])) { $count_by_date[$mod_name][$tdate] = "0"; } $cnt_by_date = $count_by_date[$mod_name][$tdate]; $mod_cnt_table .= "<td>{$cnt_by_date} </td>"; if ($i == 0) { $values = Graph_n_table_format($period_type, $tdate); $graph_format = $values[0]; $table_format = $values[1]; //passing the created dates to graph if ($mod_graph_date != "") { $mod_graph_date = "{$mod_graph_date},{$graph_format}"; } else { $mod_graph_date = "{$graph_format}"; } } //passing the name count by date to graph if ($mod_cnt_crtd_date != "") { $mod_cnt_crtd_date .= ",{$cnt_by_date}"; } else { $mod_cnt_crtd_date = "{$cnt_by_date}"; } } $mod_count_val = $mod_count_array[$mod_name]; $tot_mod_cnt = array_sum($count_by_date[$mod_name]); $mod_cnt_table .= "<td align=center>{$tot_mod_cnt}</td></tr>"; if ($graph_for == "accountid") { $name_val = get_account_name($mod_name); if ($name_val != "") { $mod_name = $name_val; $search_str = $name_val; } } if ($graph_for == "smownerid") { $name_val = getOwnerName($mod_name); if ($name_val != "") { $mod_name = $name_val; $search_str = $name_val; } } if ($graph_for == "product_id" || $graph_for == "productid") { $query = "SELECT productname FROM vtiger_products WHERE productid=?"; $result = $adb->pquery($query, array($mod_name)); $name_val = $adb->query_result($result, 0, "productname"); if ($name_val != "") { $mod_name = $name_val; $search_str = $name_val; } } if ($graph_for == "purchaseorderid") { $query = "SELECT subject FROM vtiger_purchaseorder WHERE purchaseorderid=?"; $result = $adb->pquery($query, array($mod_name)); $name_val = $adb->query_result($result, 0, "subject"); $id_name = $mod_name; if ($name_val != "") { $mod_name = $name_val; $search_str = $name_val; } } if ($graph_for == "quoteid") { $query = "SELECT subject FROM vtiger_quotes WHERE quoteid=?"; $result = $adb->pquery($query, array($mod_name)); $name_val = $adb->query_result($result, 0, "subject"); $id_name = $mod_name; if ($name_val != "") { $mod_name = $name_val; $search_str = $name_val; } } if ($graph_for == "invoiceid") { $query = "SELECT subject FROM vtiger_invoice WHERE invoiceid=?"; $result = $adb->pquery($query, array($mod_name)); $name_val = $adb->query_result($result, 0, "subject"); $id_name = $mod_name; if ($name_val != "") { $mod_name = $name_val; $search_str = $name_val; } } if ($graph_for == "campaignid") { //this will return the list of the names of the campaign``:w for the y-axis $query = "SELECT campaignname FROM vtiger_campaign WHERE campaignid=?"; $result = $adb->pquery($query, array($mod_name)); $name_val = $adb->query_result($result, 0, "campaignname"); $id_name = $mod_name; if ($name_val != "") { $mod_name = $name_val; $search_str = $name_val; } } if ($graph_for == "parent_id" || $graph_for == "related_to") { $seType = getSalesEntityType($mod_name); if ($seType == 'Contacts') { $query = "SELECT lastname, firstname FROM vtiger_contactdetails\r\n\t\t\t\t\t\t\tWHERE contactid=?"; $result = $adb->pquery($query, array($mod_name)); $name_val = $adb->query_result($result, 0, "lastname"); if ($name_val != "") { if (getFieldVisibilityPermission('Contacts', $current_user->id, 'firstname') == '0') { $first_name = $adb->query_result($result, 0, "firstname"); if ($first_name != '') { $name_val .= " " . $first_name; } } } } else { $query = "SELECT accountname FROM vtiger_account WHERE accountid=?"; $result = $adb->pquery($query, array($mod_name)); $name_val = $adb->query_result($result, 0, "accountname"); } $mod_name = $name_val; $search_str = $name_val; } //Passing name to graph $mod_name = str_replace(":", ":", $mod_name); if ($mod_name_val != "") { $mod_name_val .= "::{$mod_name}"; } else { $mod_name_val = "{$mod_name}"; } //Passing count to graph if ($mod_cnt_val != "") { $mod_cnt_val .= "::{$mod_count_val}"; } else { $mod_cnt_val = "{$mod_count_val}"; } if ($module != "") { //Check for Ticket Priority if ($graph_type == "ticketsbypriority") { $graph_for = "ticketpriorities"; } //added to get valid url in dashbord for tickets by team if ($graph_for == "smownerid") { $searchField = "assigned_user_id"; } elseif ($graph_for == 'category') { $searchField = 'ticketcategories'; } elseif ($graph_for == 'priority') { $searchField = 'ticketpriorities'; } elseif ($graph_for == "accountid") { $searchField = "account_id"; } else { $searchField = $graph_for; } $cvid = getCvIdOfAll($module); if ($module == "Home") { $cvid = getCvIdOfAll($mod_name); $link_val = "index.php?module=" . $mod_name . "&action=ListView&from_homepagedb=true&type=dbrd&query=true&owner=" . $current_user->user_name . "&viewname=" . $cvid; } else { if ($module == "Contacts" || $module == "Products" && ($graph_for == "quoteid" || $graph_for == "invoiceid" || $graph_for == "purchaseorderid")) { $link_val = "index.php?module=" . $module . "&action=ListView&from_dashboard=true&type=dbrd&query=true&" . $searchField . "=" . $id_name . "&viewname=" . $cvid; } else { $esc_search_str = urlencode($search_str); //$esc_search_str = htmlentities($search_str, ENT_QUOTES, $default_charset); $link_val = "index.php?module=" . $module . "&action=index&from_dashboard=true&search_text=" . $esc_search_str . "&search_field=" . $searchField . "&searchtype=BasicSearch&query=true&type=entchar&operator=e&viewname=" . $cvid; } } //Adding the links to the graph $link_val = str_replace(':', ':', $link_val); if ($i == 0) { $bar_target_val .= $link_val; } else { $bar_target_val .= "::" . $link_val; } } //The data as per given date if ($i == 0) { $urlstring .= $mod_cnt_crtd_date; } else { $urlstring .= "K" . $mod_cnt_crtd_date; } if ($i == 0) { $test_target_val .= $link_val; } else { $test_target_val .= "K" . $link_val; } } $mod_cnt_table .= "</tr><tr><td class=\"{$class}\">Total</td>"; //For all Days getting the vtiger_table for ($k = 0; $k < $days; $k++) { $tdate = $date_array[$k]; if (!isset($mod_tot_cnt_array[$tdate])) { $mod_tot_cnt_array[$tdate] = "0"; } $tot = $mod_tot_cnt_array[$tdate]; if ($period_type != "yday") { $mod_cnt_table .= "<td>{$tot}</td>"; } } if ($graph_for == "productname") { $cnt_total = array_sum($mod_count_array); } else { $cnt_total = array_sum($mod_tot_cnt_array); } $mod_cnt_table .= "<td align=\"center\" class=\"{$class}\">{$cnt_total}</td></tr></table>"; $mod_cnt_table .= "</table>"; $title_of_graph = "{$title} : {$cnt_total}"; $bar_target_val = urlencode($bar_target_val); $test_target_val = urlencode($test_target_val); $Prod_mod_val = array($mod_name_val, $mod_cnt_val, $title_of_graph, $bar_target_val, $mod_graph_date, $urlstring, $mod_cnt_table, $test_target_val); return $Prod_mod_val; } else { $data = 0; } } else { $data = 0; return "<h3> The data is not available with the specified time period</h3>"; } return $data; }
} // We get the list of keyrings /* $result = mysql_query( "SELECT * FROM `keyrings`" ); */ if ($step != '1') { ?> <html> <HEAD> <TITLE>Hosts - accounts - Key Association</TITLE> <LINK REL=STYLESHEET HREF="skm.css" TYPE="text/css"> </HEAD> <BODY> <?php $name_account = get_account_name($id_account); $name = get_host_name($id); ?> <?php start_main_frame("<a href=\"show_all_hosts.php\"> SKM </a> > <a href=\"hosts-view.php?hostgroup={$hostgroup}\">{$hostgroup}</a> > <a href=\"host-view.php?id={$id}&hostgroup={$hostgroup}\"> {$name} </a> > <a href=\"account-view.php?id={$id}&hostgroup={$hostgroup}&id_account={$id_account}\">{$name_account} </a> > Add Key"); start_left_pane(); display_menu(); end_left_pane(); start_right_pane(); ?> <center> <form name="setup_hak" action="hakk_setup.php" method="post"> <fieldset><legend>Adding key(s) to account <?php echo "{$account_name}";
' . NEW_TABLE_LEDGER . ' LEFT JOIN ' . NEW_TABLE_MESSAGES . ' ON (referenced_key1 = transaction_id) LEFT JOIN ' . NEW_TABLE_MESSAGE_TYPES . ' USING(message_type_id) WHERE transaction_id = "' . mysql_real_escape_string($_REQUEST['transaction_id']) . '" AND ( key1_target = "ledger.transaction_id" OR key1_target IS NULL) LIMIT 1'; $result_ledger = mysql_query($query_ledger, $connection) or die(debug_print("ERROR: 893021 ", array($query_ledger, mysql_error()), basename(__FILE__) . ' LINE ' . __LINE__)); if (!($row_ledger = mysql_fetch_array($result_ledger))) { return "error 102: unexpected result"; } // Get the name for each of the accounts $row_ledger['source_name'] = get_account_name($row_ledger['source_type'], $row_ledger['source_key']); $row_ledger['target_name'] = get_account_name($row_ledger['target_type'], $row_ledger['target_key']); // Get information from the basket (if there is one) if ($_REQUEST['bpid'] > 0) { $show_basket_form = true; $query_basket_items = ' SELECT ' . NEW_TABLE_BASKET_ITEMS . '.*, ' . NEW_TABLE_BASKETS . '.delivery_id, ' . NEW_TABLE_BASKETS . '.member_id, ' . NEW_TABLE_PRODUCTS . '.product_name, ' . NEW_TABLE_PRODUCTS . '.random_weight, ' . NEW_TABLE_MESSAGES . '.message FROM ' . NEW_TABLE_BASKET_ITEMS . ' LEFT JOIN ' . NEW_TABLE_PRODUCTS . ' USING(product_id,product_version) LEFT JOIN ' . NEW_TABLE_BASKETS . ' USING(basket_id) LEFT JOIN ' . NEW_TABLE_MESSAGES . ' ON (referenced_key1 = bpid)
} else { if (strlen($fm_initials) < 2) { display_errorbox("You must enter your initials in order to verify compliance with Senate guidelines."); print_verify_form($fm_sessionid, $fm_msgid, $fm_listids, $fm_segids, $fm_year, $fm_month, $fm_day, $fm_district, $fm_fromaddr, $fm_fromname, $fm_replyaddr, $fm_iscc, $fm_ccemail, $fm_notes, $fm_initials); } else { $dbh = open_db(); $session_rec = db_get_session($dbh, $fm_sessionid); if ($session_rec) { $got_error = false; $username = $session_rec['username']; $reviewer = DEFAULT_REVIEWER; $requserinfo = db_get_user($dbh, $username); $revuserinfo = db_get_user($dbh, $reviewer); if ($requserinfo && $revuserinfo && $requserinfo['email'] && $revuserinfo['email']) { $account_id = $session_rec['account_id']; $account_name = get_account_name($bapi, $account_id); $msg_name = get_message_name($bapi, $fm_msgid); $list_names = get_list_names($bapi, $fm_listids); $seg_names = get_segment_names($bapi, $fm_segids); $req_uuid = generate_request_uuid($account_id); $reqinfo = create_request_info(null, $req_uuid, 0, $username, $reviewer, $fm_sessionid, $account_id, $fm_msgid, $account_name, $msg_name, "{$fm_year}-{$fm_month}-{$fm_day}", $fm_district, $fm_fromaddr, $fm_fromname, $fm_replyaddr, $fm_iscc, $fm_ccemail, null, null, null, null, "AWAITING_REVIEW", $fm_notes, null, $fm_listids, $list_names, $fm_segids, $seg_names, null, null); $rc = db_save_request($dbh, $reqinfo); if ($rc === true) { if (send_request_to_reviewer($reqinfo, $requserinfo, $revuserinfo) == true) { print_send_form($reqinfo); } else { display_errorbox("Your request for approval could not be sent to a reviewer."); $got_error = true; } } else { display_errorbox("Unable to save request parameters; request not sent.");
function view_authorizedkey_file($id, $id_account) { // Initialising variables $hostname = get_host_name($id); $account_name = get_account_name($id_account); $now = date("Ymd-His"); $message = ""; $authorized_keys = ""; // ----------------------------------------------- // We get all keys associated with current keyring // ----------------------------------------------- $keyrings = mysql_query("SELECT * FROM `hak` WHERE `id_host` = '{$id}' and `id_account` ='{$id_account}'\n and `id_keyring` != '0'") or die(mysql_error() . "<br>Couldn't execute query: {$query}"); $nr_keyrings = mysql_num_rows($keyrings); if (!empty($nr_keyrings)) { while ($keyringrow = mysql_fetch_array($keyrings)) { $id_keyring = $keyringrow['id_keyring']; $name_keyring = get_keyring_name($id_keyring); //$message.="Deploying keyring $name_keyring with id $id_keyring<br>\n"; // Getting the keys associated to current keyring //echo("Select from keyrings-keys id_keyring=$id_keyring\n"); $keys = mysql_query("SELECT * FROM `keyrings-keys` WHERE `id_keyring` = '{$id_keyring}'") or die(mysql_error() . "<br>Couldn't execute query: {$query}"); $nr_keys = mysql_num_rows($keys); if (!empty($nr_keys)) { while ($keyrow = mysql_fetch_array($keys)) { $key_id = $keyrow['id_key']; $key_name = get_key_name($key_id); $message .= " <img src='images/ok.gif'>adding key {$key_name} (id {$key_id})<br>\n"; // Getting key value of current key $keyvalue = mysql_query("SELECT * FROM `keys` WHERE `id` = '{$key_id}'") or die(mysql_error() . "<br>Couldn't execute query: {$query}"); $nr_keyvalue = mysql_num_rows($keyvalue); if (!empty($nr_keyvalue)) { while ($keyvaluerow = mysql_fetch_array($keyvalue)) { $singlekey = $keyvaluerow['key']; $authorized_keys .= "{$singlekey}<br>\n"; } } // end if } // end while keyrow mysql_free_result($keys); } //end if } // end while keyringrow mysql_free_result($keyrings); } // end if // ----------------------------------------------- // We get all keys associated with current account/host // ----------------------------------------------- $keys = mysql_query("SELECT * FROM `hak` WHERE `id_host` = '{$id}' and `id_account` ='{$id_account}'\n and `id_key` != '0'") or die(mysql_error() . "<br>Couldn't execute query: {$query}"); $nr_keys = mysql_num_rows($keys); if (!empty($nr_keys)) { while ($keyrow = mysql_fetch_array($keys)) { $key_id = $keyrow['id_key']; $key_name = get_key_name($key_id); $message .= " <img src='images/ok.gif'>adding key {$key_name} (id {$key_id})<br>\n"; // Getting key value of current key $keyvalue = mysql_query("SELECT * FROM `keys` WHERE `id` = '{$key_id}'") or die(mysql_error() . "<br>Couldn't execute query: {$query}"); $nr_keyvalue = mysql_num_rows($keyvalue); if (!empty($nr_keyvalue)) { while ($keyvaluerow = mysql_fetch_array($keyvalue)) { $singlekey = $keyvaluerow['key']; $authorized_keys .= "{$singlekey}\n"; } } // end if } // end while keyrow mysql_free_result($keys); } //end if $handle = fopen("/tmp/authorized_keys", "w"); fputs($handle, $authorized_keys); fclose($handle); return $authorized_keys; }