function write_lang() { global $path_to_root, $installed_languages; include_once $path_to_root . "/lang/installed_languages.inc"; $conn = array_natsort($installed_languages, 'code', 'code'); $installed_languages = $conn; //reset($installed_languages); $n = count($installed_languages); $msg = "<?php\n\n"; $msg .= "/* How to make new entries here\n\n"; $msg .= "-- if adding languages at the beginning of the list, make sure it's index is set to 0 (it has ' 0 => ')\n"; $msg .= "-- 'code' should match the name of the directory for the language under \\lang\n"; $msg .= "-- 'name' is the name that will be displayed in the language selection list (in Users and Display Setup)\n"; $msg .= "-- 'rtl' only needs to be set for right-to-left languages like Arabic and Hebrew\n\n"; $msg .= "*/\n\n\n"; $msg .= "\$installed_languages = array (\n"; $msg .= "\t0 => "; for ($i = 0; $i < $n; $i++) { if ($i > 0) { $msg .= "\t\tarray "; } else { $msg .= "array "; } $msg .= "('code' => '" . $installed_languages[$i]['code'] . "', "; $msg .= "'name' => '" . $installed_languages[$i]['name'] . "', "; $msg .= "'encoding' => '" . $installed_languages[$i]['encoding'] . "'"; if (isset($installed_languages[$i]['rtl']) && $installed_languages[$i]['rtl']) { $msg .= ", 'rtl' => true),\n"; } else { $msg .= "),\n"; } } $msg .= "\t);\n?>"; $filename = $path_to_root . "/lang/installed_languages.inc"; // Check if the file exists and is writable first. if (file_exists($filename) && is_writable($filename)) { if (!($zp = fopen($filename, 'w'))) { display_error(tr("Cannot open the languages file - ") . $filename); return false; } else { if (!fwrite($zp, $msg)) { display_error(tr("Cannot write to the language file - ") . $filename); fclose($zp); return false; } // Close file fclose($zp); } } else { display_error(tr("The language file ") . $filename . tr(" is not writable. Change its permissions so it is, then re-run the operation.")); return false; } return true; }
// checking to see if there is any information in the array if not display a message (located after this if statment) $anypats = count($ret); $old_pid = -1; $first_time = 1; // $iter has encounter information // this loop gathers the user numbers foreach ($ret as $iter) { $catch_user[] = $iter['user']; } //This statment uniques the array removing duplicates $user_list = array_unique($catch_user); // reorder the list starting with array element zero $final_list = array_values($user_list); // sort array in assending order sort($final_list); $all4 = array_natsort($ret, pid, fulname, asc); if ($_POST['end_of_day_totals_only'] == 1) { $totals_only = 1; } foreach ($all4 as $iter) { // Case statment to tally information by user switch ($iter['user']) { case $iter['user'] = $final_list[0]: $us0_user = $iter['user']; $us0_fee = $us0_fee + $iter['fee']; $us0_inspay = $us0_inspay + $iter['ins_code']; $us0_insadj = $us0_insadj + $iter['ins_adjust_dollar']; $us0_patadj = $us0_patadj + $iter['pat_adjust_dollar']; $us0_patpay = $us0_patpay + $iter['pat_code']; break; case $iter['user'] = $final_list[1]:
function company_extensions($id) { start_table(TABLESTYLE); $th = array(_("Extension"), _("Modules provided"), _("Options provided"), _("Active")); $mods = get_company_extensions(); $exts = get_company_extensions($id); foreach ($mods as $key => $ins) { foreach ($exts as $ext) { if ($ext['name'] == $ins['name']) { $mods[$key]['active'] = @$ext['active']; continue 2; } } } $mods = array_natsort($mods, null, 'name'); table_header($th); $k = 0; foreach ($mods as $i => $mod) { if ($mod['type'] != 'extension') { continue; } alt_table_row_color($k); label_cell($mod['name']); $entries = fmt_titles(@$mod['entries']); $tabs = fmt_titles(@$mod['tabs']); label_cell($tabs); label_cell($entries); check_cells(null, 'Active' . $i, @$mod['active'] ? 1 : 0, false, false, "align='center'"); end_row(); } end_table(1); submit_center('Refresh', _('Update'), true, false, 'default'); }
$pcl_select .= "<input type='radio' name='pcl' value=''> allow unknown-clients (Beliebige Clients)"; } else { $pcl_select .= "<input type='radio' name='pcl' value='' checked> <b>allow unknown-clients (Beliebige Clients - default)</b><br>"; $pcl_select .= "<input type='radio' name='pcl' value='deny unknown-clients'> deny unknown-clients (Nur im DHCP eingetragene Clients)"; } ################# $template->assign(array("DHCPDN" => $dhcpsv_data['dn'], "DHCPDN" => $DHCP_SERVICE, "CN" => $dhcpcn, "PRIMARY" => $dhcpsv_data['dhcpprimarydn'], "SECONDARY" => $dhcpsv_data['dhcpsecondarydn'], "DESCRIPTION" => $dhcpsv_data['description'], "STATEMENTS" => $dhcpsv_data['dhcpstatements'], "FAILOVERPEER" => $dhcpsv_data['dhcpfailoverpeer'], "PCLSELECT" => $pcl_select, "PCL" => $pcl, "ALLOW" => $dhcpsv_data['dhcpoptallow'], "DENY" => $dhcpsv_data['dhcpoptdeny'], "IGNORE" => $dhcpsv_data['dhcpoptignore'], "DDNSUPDATE" => $dhcpsv_data['dhcpoptddns-update-style'], "DEFAULTLEASE" => $defaultlease_select, "MAXLEASE" => $maxlease_select, "USEHOSTDCL" => $dhcpsv_data['dhcpoptuse-host-decl-names'], "MAXMESSIZE" => $dhcpsv_data['dhcpoptdhcp-max-message-size'], "DOMAINNAME" => $dhcpsv_data['dhcpoptdomain-name'], "DOMAINNAMESERVERS" => $dhcpsv_data['dhcpoptdomain-name-servers'], "NEXTSERVER" => $dhcpsv_data['dhcpoptnext-server'], "FILENAME" => $dhcpsv_data['dhcpoptfilename'], "NTPSERVERS" => $dhcpsv_data['dhcpoptntp-servers'], "DHCPOFFERNOWDN" => $dhcpsv_data['dhcpofferdn'], "DHCPOFFERNOW" => $dhcpoffernow, "OPTDEF" => $optdef, "MNR" => $mnr, "SBMNR" => $sbmnr)); $template->define_dynamic("Dhcpoffers", "Webseite"); foreach ($dhcpoffers as $offer) { $template->assign(array("DHCPOFFER" => $offer['dn'], "DHCPOFFEROU" => $offer['ou'])); $template->parse("DHCPOFFERS_LIST", ".Dhcpoffers"); } # Subnetze und Hosts des Dienstes $dhcpobjects = get_service_subnets($dhcpserviceDN, array("dn", "cn", "dhcpoptnetmask", "description")); #print_r($dhcpobjects); $dhcpobjects = array_natsort($dhcpobjects, "cn", "cn"); $template->define_dynamic("Dhcpsubnets", "Webseite"); foreach ($dhcpobjects as $subnet) { $template->assign(array("SUBNET" => $subnet['cn'], "NETMASK" => $subnet['dhcpoptnetmask'], "SUBNETAU" => $subnet['auDN'], "SUBNETDESC" => $subnet['description'])); $template->parse("DHCPSUBNETS_LIST", ".Dhcpsubnets"); } # alle DHCP Objekte auf sich als DHCP Service setzen $altdhcpservices = alternative_dhcpservices($DHCP_SERVICE); $template->define_dynamic("Altdhcpsrv", "Webseite"); $dhcp_selectbox = ""; foreach ($altdhcpservices as $altsrv) { $dhcp_selectbox .= "\n \t\t <option value='" . $altsrv['dn'] . "'>" . $altsrv['cn'] . " </option>"; $template->assign(array("ALTDHCPSRV" => $dhcp_selectbox)); } ################################################ # DHCP Generator Skript Config
include 'computers_header.inc.php'; ############################################################################# $mnr = 1; $sbmnr = -1; $mcnr = -1; # Menuleiste erstellen createMainMenu($rollen, $mainnr); createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr); ############################################################################# $sort = "hostname"; $sort = $_GET['sort']; $template->assign(array("IP" => "", "OLDIP" => "", "DHCPCONT" => "", "RBSCONT" => "", "DNSCONT" => "", "FIXADD" => "", "HOSTNAME" => "Noch keine Rechner angelegt", "HOSTDN" => "")); $host_array = get_hosts($auDN, array("dn", "hostname", "hwaddress", "ipaddress", "dhcphlpcont", "dhcpoptfixed-address", "hlprbservice"), $sort); # print_r ($host_array); if ($sort == "ipaddress") { $host_array = array_natsort($host_array, "ipaddress", "ipaddress"); } $template->define_dynamic("Hosts", "Webseite"); $i = 0; foreach ($host_array as $host) { $hostip = explode('_', $host['ipaddress']); $fixadd = ""; if ($host['hwaddress']) { if ($host['ipaddress']) { if (count($host['dhcphlpcont']) != 0 && $host['dhcpoptfixed-address'] == "ip") { $dhcp_radio = "\n\t\t\t\t\t<input type='radio' name='dhcp[{$i}]' value='fix' checked> fix \t\t\t\n\t\t\t\t\t<input type='radio' name='dhcp[{$i}]' value=''> kein <br>\n\t\t\t\t\t<input type='radio' name='dhcp[{$i}]' value='fixdns'> fix DNS\n\t\t\t\t\t<input type='hidden' name='olddhcp[]' value='fix'>"; $fixadd = $host['dhcpoptfixed-address']; } elseif (count($host['dhcphlpcont']) != 0 && $host['dhcpoptfixed-address'] == "hostname") { $dhcp_radio = "\t\t\t\t\t\n\t\t\t\t\t<input type='radio' name='dhcp[{$i}]' value='fix'> fix \t\t\t\n\t\t\t\t\t<input type='radio' name='dhcp[{$i}]' value=''> kein <br>\n\t\t\t\t\t<input type='radio' name='dhcp[{$i}]' value='fixdns' checked> fix DNS \n\t\t\t\t\t<input type='hidden' name='olddhcp[]' value='fixdns'>"; $fixadd = $host['dhcpoptfixed-address']; } else {
function write_modules() { global $path_to_root, $installed_modules; $mods = array_natsort($installed_modules, 'tab', 'tab'); $installed_modules = $mods; //reset($installed_languages); $n = count($installed_modules); $msg = "<?php\n\n"; $msg .= "/*****************************************************************\n"; $msg .= "External modules for ArchivistaERP\n"; $msg .= "******************************************************************/\n"; $msg .= "\n\n"; $msg .= "\$installed_modules = array (\n"; $msg .= "\t0 => "; for ($i = 0; $i < $n; $i++) { if ($i > 0) { $msg .= "\t\tarray "; } else { $msg .= "array "; } $msg .= "('tab' => '" . $installed_modules[$i]['tab'] . "', "; $msg .= "'name' => '" . $installed_modules[$i]['name'] . "', "; $msg .= "'path' => '" . $installed_modules[$i]['path'] . "', "; $msg .= "'filename' => '" . $installed_modules[$i]['filename'] . "'"; $msg .= "),\n"; } $msg .= "\t);\n?>"; $filename = $path_to_root . "/modules/installed_modules.php"; // Check if the file exists and is writable first. if (file_exists($filename) && is_writable($filename)) { if (!($zp = fopen($filename, 'w'))) { display_error(tr("Cannot open the modules file - ") . $filename); return false; } else { if (!fwrite($zp, $msg)) { display_error(tr("Cannot write to the modules file - ") . $filename); fclose($zp); return false; } // Close file fclose($zp); } } else { display_error(tr("The modules file ") . $filename . tr(" is not writable. Change its permissions so it is, then re-run the operation.")); return false; } return true; }
createMainMenu($rollen, $mainnr); createDhcpMenu($rollen, $mnr, $auDN, $sbmnr); ################################################################################### # DHCP Pools Daten holen $attributes = array("dn", "cn", "dhcphlpcont", "dhcprange", "description", "dhcpstatements", "dhcpoptallow", "dhcpoptdefault-lease-time", "dhcpoptdeny", "dhcpoptignore", "dhcpoptmax-lease-time", "dhcpoptgeneric", "hlprbservice", "dhcpoptfilename", "dhcpoptnext-server", "dhcppermittedclients"); $pools = get_dhcppools($auDN, $attributes); $scope_attributes = array("dn", "cn", "dhcphlpcont", "dhcpstatements", "dhcpoptallow", "dhcpoptdeny", "dhcpoptignore", "dhcpoptdefault-lease-time", "dhcpoptmax-lease-time", "dhcpoptgeneric", "hlprbservice", "dhcpoptfilename", "dhcpoptnext-server", "dhcppermittedclients"); $global_data = get_node_data($DHCP_SERVICE, $scope_attributes); #print_r($pools); if (count($pools) == 0) { redirect(0, "dhcpnopool.php?mnr=" . $mnr, "", $addSessionId = TRUE); die; } $template->assign(array("POOLDN" => "", "CN" => "", "SUBNETDN" => "", "SUBNET" => "", "IPRANGES" => "", "DESCRIPTION" => "", "STATEMENTS" => "", "ALLOW" => "", "DENY" => "", "IGNORE" => "", "RBS" => "", "RBSRV" => "", "RBSSELECT" => "", "DEFAULTLEASE" => "", "MAXLEASE" => "", "MNR" => $mnr)); $template->define_dynamic("Dhcppools", "Webseite"); $pools = array_natsort($pools, "dhcphlpcont", "dhcphlpcont"); # Für jeden Pool ... foreach ($pools as $pool) { $subnet_data = get_node_data($pool['dhcphlpcont'], $scope_attributes); # DHCP Subnet des Pools if ($pool['dhcphlpcont']) { $subnetexp = ldap_explode_dn($pool['dhcphlpcont'], 1); $subnetdnexp = ldap_explode_dn($pool['dhcphlpcont'], 0); $subnetauexp = array_slice($subnetdnexp, 3); $subnetau = implode(',', $subnetauexp); $subnet = $subnetexp[0]; } else { $subnet = "<b>Pool nicht aktiv!</b>"; } $poollink = "<a href='dhcppool_one.php?dn=" . $pool[dn] . "&mnr=" . $mnr . "&url=dhcppools.php' class='headerlink'><b>>> Pool verwalten</b></a> "; # DHCP Ranges
function get_subnet_childaus($all_childs, $subnetcn) { $childs = array(); $subnetip = explode(".", $subnetcn); foreach ($all_childs as $childau) { # AUs die Subnet administrieren in rot $red = ""; $red_end = ""; if ($childau['maxipblock']) { if (is_array($childau['maxipblock'])) { $ipblocks = ""; foreach ($childau['maxipblock'] as $mipb) { $expmipb = explode("_", $mipb); $mipb1 = explode(".", $expmipb[0]); $mipb2 = explode(".", $expmipb[1]); if ($subnetip[0] == $mipb1[0] && $subnetip[1] == $mipb1[1] && $subnetip[2] == $mipb1[2]) { #$ipblocks [] = "$mipb1[2].$mipb1[3] - $mipb2[2].$mipb2[3]"; $netadmin = ""; if ($mipb1[3] == "0") { $netadmin = 1; $red = "<code class='red_font_object'>"; $red_end = "</code>"; } $ip_string = "<td align='right' width='30%'>{$red} {$mipb1['3']} {$red_end}</td>"; if ($mipb1[3] != $mipb2[3]) { $ip_string .= "<td align='center' width='15%'> - </td>\n\t\t\t\t\t\t\t\t\t\t\t<td align='right' width='30%'>{$red} {$mipb2['3']} {$red_end}</td>\n\t\t\t\t\t\t\t\t\t\t\t<td> </td>"; } else { $ip_string .= "<td align='center' width='15%'> </td>\n\t\t\t\t\t\t\t\t\t\t\t<td align='right' width='30%'> </td>\n\t\t\t\t\t\t\t\t\t\t\t<td> </td>"; } $ipblocks[] = $ip_string; #$ipblocks [] = "<td align='right' width='30%'>$red $mipb1[3] $red_end</td> # <td align='center' width='15%'> - </td> # <td align='right' width='30%'>$red $mipb2[3] $red_end</td> # <td> </td>"; $ipblocks = array_natsort($ipblocks, "", ""); } } if ($ipblocks) { $childs[] = array('au' => $childau['ou'], 'dn' => $childau['dn'], 'zone' => $childau['associateddomain'], 'mipb' => $ipblocks, 'netadmin' => $netadmin); } } else { $expmipb = explode("_", $childau['maxipblock']); $mipb1 = explode(".", $expmipb[0]); $mipb2 = explode(".", $expmipb[1]); if ($subnetip[0] == $mipb1[0] && $subnetip[1] == $mipb1[1] && $subnetip[2] == $mipb1[2]) { $netadmin = ""; if ($mipb1[3] == "0") { $netadmin = 1; $red = "<code class='red_font_object'>"; $red_end = "</code>"; } $childs[] = array('au' => $childau['ou'], 'dn' => $childau['dn'], 'zone' => $childau['associateddomain'], 'mipb' => "<td align='right' width='30%'>{$red} {$mipb1['3']} {$red_end}</td>\n\t\t\t\t\t\t\t\t\t\t\t \t\t\t\t<td align='center' width='15%'> - </td>\n\t\t\t\t\t\t\t\t\t\t\t \t\t\t\t<td align='right' width='30%'>{$red} {$mipb2['3']} {$red_end}</td>\n\t\t\t\t\t\t\t\t\t\t\t \t\t\t\t<td> </td>", 'netadmin' => $netadmin); } } } } #$childs = array_natsort($childs, "mipb", "mipb"); return $childs; }
$subnet_array = array_merge($admin_subnets, $ro_subnets); } else { $subnet_array = $admin_subnets; } ############## # Global DHCP Data $global_options = array("dhcpoptdefault-lease-time", "dhcpoptmax-lease-time", "dhcpoptdomain-name", "dhcpoptdomain-name-servers", "dhcpoptgeneric", "dhcppermittedclients"); $global_data = get_node_data($DHCP_SERVICE, $global_options); if ($global_data['dhcppermittedclients']) { $global_pcl = $global_data['dhcppermittedclients']; } else { $global_pcl = "Beliebige Clients"; } $template->assign(array("GLOBALPCL" => $global_pcl)); ############### $subnet_array = array_natsort($subnet_array, "cn", "cn"); $template->define_dynamic("Subnets", "Webseite"); $template->define_dynamic("Pools", "Webseite"); $i = 0; foreach ($subnet_array as $subnet) { $subnetcn = "<a href='dhcpsubnet.php?dn=" . $subnet['dn'] . "&mnr=" . $mnr . "' class='headerlink'><b>" . $subnet['cn'] . "<br>{$subnet['access']}</b></a>"; # Dienstzuordnung des Subnetzes $dhcpservice = " "; if ($subnet['dhcphlpcont'] != "") { #$dhcpservice = "<code class='red_font_object'>X</code>"; #$dhcpservice = "<code class='red_font_object'>@</code>"; $dhcpservice = "<code class='red_font_object'>aktiv</code>"; #$dhcpservice = "<input type='checkbox' readonly name='dhcpsrv[]' value='".$subnet['dn']."' checked> # <input type='hidden' name='olddhcpsrv[]' value='".$subnet['dn']."'>"; #}else{ #$dhcpservice = "<input type='checkbox' name='dhcpsrv[]' value='".$subnet['dn']."'>
################################################################################### $mnr = 1; # Menuleisten erstellen createMainMenu($rollen, $mainnr); createDNSMenu($rollen, $mnr); ################################################################################### $template->assign(array("AUOU" => "Noch keine untergordnete AU angelegt", "AUCN" => "", "AUDN" => "", "AUZONE" => "", "AUIPS" => "")); $attributes = array("dn", "ou", "associateddomain"); #$aunits = get_all_aus($attributes); $backbone_nodes = get_childau($auDN, $attributes); $template->define_dynamic("Aus", "Webseite"); foreach ($backbone_nodes as $bn) { $aulist = ""; $aunits = get_childau_sub($bn['dn'], $attributes); #print_r($aunits);echo "<br><br>"; $aunits = array_slice($aunits, 1); $aunits = array_natsort($aunits, "ou", "ou"); if ($aunits) { $aulist .= "<table cellpadding='2' cellspacing='0' border='1' align='left' width='100%' style='border-width: 0 0 0 0;'>"; foreach ($aunits as $au) { $aulist .= "\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class='tab_dgrey' width='50%'>{$au['ou']} </td>\n\t\t\t\t\t\t\t<td class='tab_dgrey'>\n\t\t\t\t\t\t\t\t<input type='Text' name='auzone[]' value='{$au['associateddomain']}' size='23' class='medium_form_field'>\n\t\t\t\t\t\t\t\t<input type='hidden' name='oldauzone[]' value='{$au['associateddomain']}'>\n\t\t\t\t\t\t\t\t<input type='hidden' name='audn[]' value='{$au['dn']}'></td>\n\t\t\t\t\t\t</tr>"; } $aulist .= "</table>"; } else { $aulist = "Keine untergeordneten AUs"; } $template->assign(array("AUOU" => $bn['ou'], "AUCN" => $bn['cn'], "AUDN" => $bn['dn'], "AUZONE" => $bn['associateddomain'], "AUIPS" => "", "AULIST" => $aulist)); $template->parse("AUS_LIST", ".Aus"); } ################################################################################### include "dns_footer.inc.php";
$host_array = array_natsort($host_array, "ipaddress", "ipaddress"); break; case "hwaddress": $host_array = array_sort($host_array, "hwaddress", "hwaddress"); break; case "description": $host_array = array_natsort($host_array, "description", "description"); break; case "geolocation": $host_array = array_sort($host_array, "geolocation", "geolocation"); break; case "inventarnr": $host_array = array_natsort($host_array, "inventarnr", "inventarnr"); break; default: $host_array = array_natsort($host_array, "hostname", "hostname"); break; } // print_r($host_array); echo "<br>"; ## SESSION Variable fuer Hosts der AU (nach der Sortierung) -> PDF Print, Clients-Kopieren $_SESSION['hosts_array'] = $host_array; // echo "<pre>"; // var_dump($_SESSION['hosts_array']); // echo "</pre>"; // echo "<pre>"; // var_dump($_POST["choice"]); // var_dump($_POST["ip"]); // var_dump($_POST["host"]); // echo "</pre>"; $template->define_dynamic("Rechner", "Webseite"); $modentry['domainname'] = $assocdom;