function do_package_install() { global $package_installer_console; global $edit_domain; global $adm_login; global $pkg_info; global $dtcpkg_db_login; $package_installer_console .= "=> Starting nuked-klan Installer for nuked-klan sp 4.4<br>"; $admin_path = getAdminPath($adm_login); $vhost_path = $admin_path . "/" . $edit_domain . "/subdomains/" . $_REQUEST["subdomain"] . "/html"; $hostname = $_REQUEST["subdomain"] . "." . $edit_domain; $vhost_url = "http://{$hostname}/"; $cmd = "mv " . $vhost_path . "/" . $pkg_info["directory"] . " " . $vhost_path . "/" . $_REQUEST["dtcpkg_directory"]; $data = array(); $data['board_email'] = $_REQUEST['dtcpkg_email']; $data['install_pseudo'] = $_REQUEST['dtcpkg_login']; $data['install_pass'] = $_REQUEST['dtcpkg_pass']; $data['db_name'] = $_REQUEST['database_name']; $data['db_user'] = $dtcpkg_db_login; $data['db_passwd'] = $_REQUEST['dtcpkg_db_pass']; $url = $vhost_url . $_REQUEST["dtcpkg_directory"] . "/" . $pkg_info["post_script_url"]; // print_r($data); $package_installer_console .= "=> Calling {$url}<br>"; $ret = HTTP_Post($url, $data, $url); $weblines = explode("\n", $ret); // HTTP/1.1 200 OK $package_installer_console .= "=> Script returns: " . $weblines[0]; return 0; // Ok, no problem ! :) }
function do_package_install() { global $package_installer_console; global $edit_domain; global $adm_login; global $pkg_info; global $dtcpkg_db_login; global $conf_mysql_db; $package_installer_console .= "=> Starting phpBB Installer for wanewsletter 2.3.0<br>"; $admin_path = getAdminPath($adm_login); $vhost_path = $admin_path . "/" . $edit_domain . "/subdomains/" . $_REQUEST["subdomain"] . "/html"; $hostname = $_REQUEST["subdomain"] . "." . $edit_domain; $vhost_url = "http://{$hostname}/"; $vhost_url2 = "http://{$hostname}"; if ($_REQUEST["dtcpkg_directory"] == "") { $dest_dir = $vhost_path; } else { $dest_dir = $vhost_path . "/" . $_REQUEST["dtcpkg_directory"]; } $url = $vhost_url2 . $_REQUEST["dtcpkg_directory"] . "/" . $pkg_info["post_script_url"]; /*Todo: uncomment and make the following work: $data = array(); $data["admin_email"] = $_REQUEST["dtcpkg_email"]; $data["admin_login"] = $_REQUEST["dtcpkg_login"]; $data["admin_pass"] = $_REQUEST["dtcpkg_pass"]; $data["confirm_pass"] = $_REQUEST["dtcpkg_pass"]; $data["dbname"] = $_REQUEST["database_name"]; $data["driver"] = "mysql"; $data["host"] = "localhost"; $data["language"] = "francais"; $data["pass"] = $_REQUEST["dtcpkg_db_pass"]; $data["prefix"] = "wa_"; $data["prev_language"] = "francais"; $data["start"] = "Démarrer l'installation"; $data["urlscript"] = $_REQUEST["dtcpkg_directory"]."/"; $data["urlsite"] = $vhost_url; $data["user"] = $dtcpkg_db_login; $data[""] = ""; echo "<pre>"; print_r($data); echo "</pre>"; $package_installer_console .= "=> Calling $url<br>"; $ret = HTTP_Post($url,$data, $url); $weblines = explode("\n",$ret); $package_installer_console .= "=> Script returns: ".$weblines[0]; */ $package_installer_console .= "Please finish the installation here:<br><a href=\"{$url}\">{$url}</a><br>"; return 0; // Ok, no problem ! :) }
function do_package_install() { global $package_installer_console; global $edit_domain; global $adm_login; global $pkg_info; global $dtcpkg_db_login; $package_installer_console .= "=> Starting installer for osCommere 2.2ms2<br>"; $admin_path = getAdminPath($adm_login); $vhost_path = $admin_path . "/" . $edit_domain . "/subdomains/" . $_REQUEST["subdomain"] . "/html"; $pkg_dest = $vhost_path . "/" . $_REQUEST["dtcpkg_directory"]; $hostname = $_REQUEST["subdomain"] . "." . $edit_domain; $vhost_url = "http://{$hostname}/"; $cmd = "mv {$pkg_dest}/catalog/* {$pkg_dest}"; exec($cmd, $exec_out, $return_val); $package_installer_console .= "Please go to <a target=\"_blank\" href=\"{$vhost_url}" . $_REQUEST["dtcpkg_directory"] . "/install/\">the package original installer</a> to finish your installation<br>"; $cmd = "mv " . $vhost_path . "/" . $pkg_info["directory"] . " " . $vhost_path . "/" . $_REQUEST["dtcpkg_directory"]; /* $data = array(); $data["lang"] = "english"; $data["dbms"] = "mysql4"; $data["upgrade"] = "0"; $data["dbhost"] = "localhost"; $data["dbname"] = $_REQUEST["database_name"]; $data["dbuser"] = $dtcpkg_db_login; $data["dbpasswd"] = $_REQUEST["dtcpkg_db_pass"]; $data["prefix"] = "phpbb_"; $data["board_email"] = $_REQUEST["dtcpkg_email"]; $data["server_name"] = $hostname; $data["server_port"] = "80"; $data["admin_name"] = $_REQUEST["dtcpkg_login"]; $data["admin_pass1"] = $_REQUEST["dtcpkg_pass"]; $data["admin_pass2"] = $_REQUEST["dtcpkg_pass"]; $data["install_step"] = "1"; $data["cur_lang"] = "english"; $url = $vhost_url.$_REQUEST["dtcpkg_directory"]."/".$pkg_info["post_script_url"]; // print_r($data); $package_installer_console .= "=> Calling $url<br>"; $ret = HTTP_Post($url,$data, $url); $weblines = explode("\n",$ret); // HTTP/1.1 200 OK $package_installer_console .= "=> Script returns: ".$weblines[0]; */ return 0; // Ok, no problem ! :) }
function subdomainDeleteDirsCallBack($id) { global $adm_login; global $pro_mysql_subdomain_table; setZoneToGenerate($id); $adm_path = getAdminPath($adm_login); $doms = explode("/", $_REQUEST["addrlink"]); $domain = $doms[0]; $q = "SELECT * FROM {$pro_mysql_subdomain_table} WHERE id='{$id}';"; $r = mysql_query($q) or die("Cannot query \"{$q}\" line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n = mysql_num_rows($r); if ($n != 1) { echo "<font color=\"red\">" . _("Could not found subdomain in table for folder deletion") . "</font>"; } else { $a = mysql_fetch_array($r); $subdom_name = $a["subdomain_name"]; $subdomain_dirpath = $adm_path . "/" . $domain . "/subdomains/{$subdom_name}"; system("rm -rf {$subdomain_dirpath}"); } updateUsingCron("gen_vhosts='yes',restart_apache='yes',gen_named='yes',reload_named ='yes',gen_backup='yes'"); }
function do_package_install() { global $package_installer_console; global $edit_domain; global $adm_login; global $pkg_info; global $dtcpkg_db_login; $package_installer_console .= "=> Starting phpSurveyor Installer <br>"; $admin_path = getAdminPath($adm_login); $vhost_path = $admin_path . "/" . $edit_domain . "/subdomains/" . $_REQUEST["subdomain"] . "/html"; $hostname = $_REQUEST["subdomain"] . "." . $edit_domain; $vhost_url = "http://{$hostname}/"; $cmd = "mv " . $vhost_path . "/" . $pkg_info["directory"] . " " . $vhost_path . "/" . $_REQUEST["dtcpkg_directory"]; $data = array(); $data["lang"] = "english"; $data["dbms"] = "mysql4"; $data["upgrade"] = "0"; $data["dbhost"] = "localhost"; $data["dbname"] = $_REQUEST["database_name"]; $data["dbuser"] = $dtcpkg_db_login; $data["dbpasswd"] = $_REQUEST["dtcpkg_db_pass"]; $data["prefix"] = "svy_"; $data["board_email"] = $_REQUEST["dtcpkg_email"]; $data["server_name"] = $hostname; $data["server_port"] = "80"; $data["admin_name"] = $_REQUEST["dtcpkg_login"]; $data["admin_pass1"] = $_REQUEST["dtcpkg_pass"]; $data["admin_pass2"] = $_REQUEST["dtcpkg_pass"]; $data["install_step"] = "1"; $data["cur_lang"] = "english"; $url = $vhost_url . $_REQUEST["dtcpkg_directory"] . "/" . $pkg_info["post_script_url"]; // print_r($data); $package_installer_console .= "=> Calling {$url}<br>"; $ret = HTTP_Post($url, $data, $url); $weblines = explode("\n", $ret); // HTTP/1.1 200 OK $package_installer_console .= "=> Script returns: " . $weblines[0]; return 0; // Ok, no problem ! :) }
function mail_account_generate_postfix() { global $pro_mysql_domain_table; global $pro_mysql_admin_table; global $pro_mysql_subdomain_table; global $console; global $conf_generated_file_path; global $conf_addr_mail_server; global $conf_dtcadmin_path; global $conf_unix_type; global $conf_nobody_user_id; global $conf_dtc_system_uid; global $conf_dtc_system_username; global $conf_use_cyrus; global $conf_use_mail_alias_group; global $conf_support_ticket_email; global $conf_support_ticket_fw_email; global $conf_support_ticket_domain; global $conf_main_domain; global $adm_realpass; global $adm_pass; global $adm_random_pass; //global $conf_postfix_virtual_mailbox_domains_path; //global $conf_postfix_virtual_path; //global $conf_postfix_vmailbox_path; //global $conf_postfix_virtual_uid_mapping_path; // prepend the configured path here $conf_postfix_virtual_mailbox_domains_path = $conf_generated_file_path . "/postfix_virtual_mailbox_domains"; $conf_local_domains_path = $conf_generated_file_path . "/local_domains"; $conf_postfix_virtual_path = $conf_generated_file_path . "/postfix_virtual"; $conf_postfix_aliases_path = $conf_generated_file_path . "/postfix_aliases"; $conf_postfix_vmailbox_path = $conf_generated_file_path . "/postfix_vmailbox"; $conf_postfix_virtual_uid_mapping_path = $conf_generated_file_path . "/postfix_virtual_uid_mapping"; $conf_postfix_relay_domains_path = $conf_generated_file_path . "/postfix_relay_domains"; $conf_postfix_relay_recipients_path = $conf_generated_file_path . "/postfix_relay_recipients"; $conf_postfix_recipient_lists_path = $conf_generated_file_path . "/recipientlists"; // now for our variables to write out the db info to $domains_file = ""; $local_domains_file = ""; $domains_postmasters_file = ""; $aliases_file = ""; $vmailboxes_file = ""; $uid_mappings_file = ""; $relay_domains_file = ""; $relay_recipients_file = ""; //store ALL of the domains we know about //if we manage to get better information later, don't worry about the entry on this one $relay_recipients_all_domains = ""; $data = ""; // init var for use later on #CL: Don create sasldb password when using cyrus. if ($conf_use_cyrus != "yes") { genSasl2PasswdDBStart(); } // go through each admin login and find the domains associated $query = "SELECT * FROM {$pro_mysql_admin_table} ORDER BY adm_login;"; $result = mysql_query($query) or die("Cannot execute query : \"{$query}\""); $num_rows = mysql_num_rows($result); if ($num_rows < 1) { die("No account to generate"); } for ($i = 0; $i < $num_rows; $i++) { $row = mysql_fetch_array($result) or die("Cannot fetch user-admin"); $user_admin_name = $row["adm_login"]; $user_admin_pass = $row["adm_pass"]; $adm_realpass = $row["adm_pass"]; $adm_pass = $row["adm_pass"]; $adm_random_pass = $row["adm_pass"]; $admin = fetchAdmin($user_admin_name, $user_admin_pass); if (($error = $admin["err"]) != 0) { die("Error fetching admin : {$error}"); } //Path of user's mailing lists $admin_path = getAdminPath($user_admin_name); $info = $admin["info"]; $nbr_domain = 0; if (isset($admin["data"])) { $data = $admin["data"]; $nbr_domain = sizeof($data); } for ($j = 0; $j < $nbr_domain; $j++) { $domain = $data[$j]; $domain_full_name = $domain["name"]; //$console .= "Processing $domain_full_name ...\n"; //if we are primary mx, add to domains //else add to relay $primary_mx = 0; if ($domain["primary_mx"] == "" || $domain["primary_mx"] == "default") { $primary_mx = 1; $domains_file .= "{$domain_full_name} virtual\n"; $local_domains_file .= "{$domain_full_name}\n"; } else { $relay_domains_file .= "{$domain_full_name}\n"; $relay_recipients_all_domains .= "{$domain_full_name}\n"; } $store_catch_all = ""; //$store_catch_all_md = ""; $catch_all_id = $domain["catchall_email"]; $abuse_address = 0; $postmaster_address = 0; // This should handle domain parking without a lot of code! :) if ($domain["domain_parking"] != "no-parking") { for ($b = 0; $b < $nbr_domain; $b++) { if ($data[$b]["name"] == $domain["domain_parking"]) { if (isset($data[$b]["emails"])) { $domain["emails"] = $data[$b]["emails"]; } else { unset($domain["emails"]); } } } } //Mail Group Aliases Start if ($conf_use_mail_alias_group == "yes") { if ($primary_mx && $domain["domain_parking"] != "no-parking") { // @domain1 -> @domain2 $domains_postmasters_file .= "# Mail Alias Groups for " . $domain["name"] . "\n"; $domains_postmasters_file .= "@" . $domain["name"] . " @" . $domain["domain_parking"] . "\n"; $domains_postmasters_file .= "#\n"; } elseif ($primary_mx && isset($domain["aliases"])) { // name@domain1 -> othername@domain1,user@domain2,etc. $aliases = $domain["aliases"]; $nbr_boites = sizeof($aliases); // go through each of these emails and build the vmailbox file //also create our sasldb2 if we have a saslpasswd2 exe for ($k = 0; $k < $nbr_boites; $k++) { $alias = $aliases[$k]; $id = $alias["id"]; $domain_parent = $alias["domain_parent"]; $ainc = $alias["autoinc"]; $mailbox_cleanup1 = str_replace("\r\n", "\n", $alias["delivery_group"]); $mailbox_cleanup2 = split("\n", $mailbox_cleanup1); $deliver_mailbox = ''; if ($k == 0) { $domains_postmasters_file .= "# Mail Alias Groups for : " . $domain_parent . "\n"; } for ($x = 0; $x < count($mailbox_cleanup2); $x++) { if ($x < count($mailbox_cleanup2) - 1) { $deliver_mailbox .= trim($mailbox_cleanup2[$x]) . ","; } else { $deliver_mailbox .= trim($mailbox_cleanup2[$x]); } } $domains_postmasters_file .= $id . "@" . $domain_parent . " " . $deliver_mailbox . "\n"; if ($k == $nbr_boites - 1) { $domains_postmasters_file .= "#\n"; } } } } //Mail Group Aliases End if (isset($domain["emails"]) && $primary_mx && $domain["domain_parking"] == "no-parking") { $emails = $domain["emails"]; $nbr_boites = sizeof($emails); // go through each of these emails and build the vmailbox file //also create our sasldb2 if we have a saslpasswd2 exe for ($k = 0; $k < $nbr_boites; $k++) { $email = $emails[$k]; $id = $email["id"]; $uid = $email["uid"]; // if our uid is 65534, make sure it's the correct uid as per the OS (99 for redhat) /* if ($uid == 65534){ $uid = $conf_nobody_user_id; }*/ $localdeliver = $email["localdeliver"]; $redirect1 = $email["redirect1"]; $redirect2 = $email["redirect2"]; $_id = strtr($id, ".", ":"); $home = $email["home"]; $passwdtemp = $email["passwd"]; $passwd = crypt($passwdtemp, dtc_makesalt()); $spam_mailbox = $email["spam_mailbox"]; $spam_mailbox_enable = $email["spam_mailbox_enable"]; $vacation_flag = $email["vacation_flag"]; $vacation_text = stripslashes($email["vacation_text"]); if ($k == 0) { $domains_postmasters_file .= "# Mailboxes for : " . $domain_full_name . "\n"; } $spam_stuff_done = 0; $homedir_created = 0; if (!isset($home) || $home == "" && $conf_use_cyrus != "yes") { $console .= "Missing home variable for {$id}"; } if (!is_dir($home) && $conf_use_cyrus != "yes" && strlen($home) > 0 && $id != "cyrus" && $id != "cyradm") { $PATH = getenv('PATH'); putenv("PATH=/usr/lib/courier-imap/bin:{$PATH}"); system("/bin/mkdir -p {$home} && maildirmake {$home}"); putenv("PATH={$PATH}"); $homedir_created = 1; } // if we have a $id equal to abuse if ($id == "abuse") { $abuse_address++; } if ($id == "postmaster") { $postmaster_address++; } // Previously: only generate sasl logins for local accounts // In fact, there is no reason to do so. We might want to create a mail account ONLY for sending // some mail, and not receiving. #CL: Not needed for cyrus if ($conf_use_cyrus != "yes") { genSasl2PasswdDBEntry($domain_full_name, $id, $passwdtemp, $conf_addr_mail_server); } // setup a postfix mapping for local delivery or vacation flags if ($localdeliver == "yes" || $localdeliver == "true" || $vacation_flag == "yes") { // setup the catch_all for locally delivered email addresses if ($id == $catch_all_id) { //$store_catch_all_md .= "@$domain_full_name $home/Maildir/\n"; $store_catch_all .= "@{$domain_full_name}\t{$id}@{$domain_full_name}\n"; } $vmailboxes_file .= "{$id}@{$domain_full_name} {$home}/Maildir/\n"; $uid_mappings_file .= "{$id}@{$domain_full_name} {$uid}\n"; if (isset($catch_all_id) || $catch_all_id != "") { //just so we can deliver to our vmailboxs if we have set a catch-all (otherwise postfix gets confused, and delivers all mail to the catch all) $domains_postmasters_file .= "{$id}@{$domain_full_name} {$id}@{$domain_full_name}\n"; } } if (isset($redirect1) && $redirect1 != "") { unset($extra_redirects); if ($localdeliver == "yes" || $localdeliver == "true" || $vacation_flag == "yes") { // need to generate .mailfilter file with "cc" and also local delivery if ($conf_use_cyrus != "yes" && (!isset($redirect2) || $redirect2 == "")) { genDotMailfilterFile($home, $id, $domain_full_name, $spam_mailbox_enable, $spam_mailbox, $localdeliver, $vacation_flag, $vacation_text, $redirect1); } $spam_stuff_done = 1; } else { $extra_redirects = " {$redirect1} "; } if ($redirect2 != "" && isset($redirect2)) { if ($localdeliver == "yes" || $localdeliver == "true" || $vacation_flag == "yes") { //need to generate .mailfilter file with "cc" and also local delivery if ($conf_use_cyrus != "yes") { genDotMailfilterFile($home, $id, $domain_full_name, $spam_mailbox_enable, $spam_mailbox, $localdeliver, $vacation_flag, $vacation_text, $redirect1, $redirect2); } $spam_stuff_done = 1; } else { if (isset($extra_redirects)) { $extra_redirects .= " , {$redirect2}"; } } } if ($store_catch_all == "" && ($id == "*" || $id == $catch_all_id)) { if (isset($extra_redirects)) { $store_catch_all .= "@{$domain_full_name} {$extra_redirects}\n"; } } else { if (isset($extra_redirects)) { $domains_postmasters_file .= "{$id}@{$domain_full_name}\t{$extra_redirects}\n"; } } unset($extra_redirects); } //if we haven't added the spam mailbox yet, do it here if ($spam_stuff_done == 0) { if ($conf_use_cyrus != "yes") { genDotMailfilterFile($home, $id, $domain_full_name, $spam_mailbox_enable, $spam_mailbox, $localdeliver, $vacation_flag, $vacation_text, $redirect1, $redirect2); } } if (is_dir($home) && $homedir_created == 1 && $id != "cyrus" && $id != "cyradm") { system("chown -R {$conf_dtc_system_username} {$home}"); } if ($k == $nbr_boites - 1) { $domains_postmasters_file .= "#\n"; } } } //add support for creation of mailing lists if (isset($domain["mailinglists"]) && $primary_mx) { $lists = $domain["mailinglists"]; $nbr_boites = sizeof($lists); // go through each of these lists and add to virtual maps and normal aliases for ($k = 0; $k < $nbr_boites; $k++) { $list = $lists[$k]; $list_id = $list["id"]; $list_name = $list["name"]; if ($list_name == "abuse") { $abuse_address++; } else { if ($list_name == "postmaster") { $postmaster_address++; } } $list_owner = $list["owner"]; $list_domain = $list["domain"]; $list_path = "{$admin_path}/{$list_domain}/lists"; $name = $list_domain . "_" . $list_name; if (!preg_match("/\\@/", $list_owner)) { $owner = $list_owner . "@" . $list_domain; } else { $owner = $list_owner; } $modified_name = str_replace("-", "_", $name); $domains_postmasters_file .= $list_name . "@" . $list_domain . " " . $modified_name . "\n"; $aliases_file .= $modified_name . ': "|/usr/bin/mlmmj-recieve -L ' . $list_path . '/' . $name . '/"' . "\n"; } } // if an abuse@ email hasn't been set, set one here to go to postmaster if ($abuse_address == 0 && $primary_mx) { $domains_postmasters_file .= "abuse@{$domain_full_name} postmaster\n"; } if ($postmaster_address == 0 && $primary_mx) { $domains_postmasters_file .= "postmaster@{$domain_full_name} postmaster\n"; } //always store catch all last... :) if (isset($store_catch_all) && $store_catch_all != "") { $domains_postmasters_file .= $store_catch_all; } //now store the Maildir version if (isset($store_catch_all_md) && $store_catch_all_md != "") { $vmailboxes_file .= $store_catch_all_md; } } } //check to see if the domain is in our local recipients first before adding to allowed relay domains $relay_domains_file_temp_list = explode("\n", get_remote_mail_domains()); foreach ($relay_domains_file_temp_list as $domain) { if (isset($domain) && strlen($domain) > 0) { if (!preg_match("/^{$domain}\\s/", $domains_file)) { $relay_domains_file .= "{$domain}\n"; } } } $relay_recipients_list = explode("\n", get_remote_mail_recipients()); foreach ($relay_recipients_list as $email) { if (isset($email) && strlen($email) > 0) { // echo "Stage 1 - adding $email"; $relay_recipients_file .= $email . " OK\n"; } } // if we haven't added the following domains to the $relay_recipients_file, then we need to add a wildcard, bad, but necessary for domains we don't have email lists for $relay_recipients_all_domains_list = explode("\n", $relay_recipients_all_domains); foreach ($relay_recipients_all_domains_list as $domain) { // if the $domain isn't set here, keep going if (!(isset($domain) && strlen($domain) > 0)) { continue; } //$console .= "$domain is being backed up\n"; //try and read a file here, and see if we have a list already created if (is_file("{$conf_postfix_recipient_lists_path}/{$domain}")) { //$console .= "File found with domain info - $conf_postfix_recipient_lists_path/$domain\n"; //check to see if we have already got this domain... //if we do, then it means that we have a rogue $domain file, and it should be deleted! :) if (preg_match("/\\@{$domain}\\s+OK/", $relay_recipients_file)) { unlink("{$conf_postfix_recipient_lists_path}/{$domain}"); } else { // echo "Reading $domain from recip file..."; $fp = fopen("{$conf_postfix_recipient_lists_path}/{$domain}", "r"); $contents = fread($fp, filesize("{$conf_postfix_recipient_lists_path}/{$domain}")); fclose($fp); //now we have found some domain email list, append it here $relay_recipients_file .= $contents; // echo "Stage 2 - adding $contents"; } } //finally check to see if we haven't got any entries for this domain if (!preg_match("/\\@{$domain}\\s+OK/", $relay_recipients_file)) { //$console .= "Faking domain entry for $domain...\n"; $relay_recipients_file .= "@{$domain} OK\n"; // echo "Stage 3 - adding $domain OK"; //write this to a file, so admin/users can edit later if (!file_exists("{$conf_postfix_recipient_lists_path}")) { //make a directory here if it doesn't exist yet mkdir("{$conf_postfix_recipient_lists_path}"); } $fp = fopen("{$conf_postfix_recipient_lists_path}/{$domain}", "w"); fwrite($fp, "@{$domain} OK\n"); fclose($fp); } } // Add the support@ email $aliases_file .= "dtc_support_ticket_messages: \"| " . $conf_dtcadmin_path . "/support-receive.php\"\n"; $domains_postmasters_file .= $conf_support_ticket_email . "@" . $conf_support_ticket_domain . " dtc_support_ticket_messages\n"; // Add the supportforward@ email $aliases_file .= "dtc_support_forward_ticket_messages: \"| reformime -e -s 1.2 | " . $conf_dtcadmin_path . "/support-receive.php\"\n"; $domains_postmasters_file .= $conf_support_ticket_fw_email . "@" . $conf_support_ticket_domain . " dtc_support_ticket_messages\n"; //write out our config files $fp = fopen("{$conf_postfix_virtual_mailbox_domains_path}", "w"); fwrite($fp, $domains_file); fclose($fp); $fp = fopen("{$conf_local_domains_path}", "w"); fwrite($fp, $local_domains_file); fclose($fp); $fp = fopen("{$conf_postfix_virtual_path}", "w"); fwrite($fp, $domains_postmasters_file); fclose($fp); $fp = fopen("{$conf_postfix_aliases_path}", "w"); fwrite($fp, $aliases_file); fclose($fp); $fp = fopen("{$conf_postfix_vmailbox_path}", "w"); fwrite($fp, $vmailboxes_file); fclose($fp); $fp = fopen("{$conf_postfix_virtual_uid_mapping_path}", "w"); fwrite($fp, $uid_mappings_file); fclose($fp); $fp = fopen("{$conf_postfix_relay_domains_path}", "w"); fwrite($fp, $relay_domains_file); fclose($fp); $fp = fopen("{$conf_postfix_relay_recipients_path}", "w"); fwrite($fp, $relay_recipients_file); fclose($fp); //now that we have our base files, go and rebuild the db's if ($conf_unix_type == "bsd") { $POSTMAP_BIN = "/usr/local/sbin/postmap -r"; $POSTALIAS_BIN = "/usr/local/sbin/postalias -r"; } else { $POSTMAP_BIN = "/usr/sbin/postmap -r"; $POSTALIAS_BIN = "/usr/sbin/postalias -r"; } system("{$POSTMAP_BIN} {$conf_postfix_virtual_mailbox_domains_path}"); system("{$POSTMAP_BIN} {$conf_postfix_virtual_path}"); system("{$POSTALIAS_BIN} {$conf_postfix_aliases_path}"); system("{$POSTMAP_BIN} {$conf_postfix_vmailbox_path}"); system("{$POSTMAP_BIN} {$conf_postfix_virtual_uid_mapping_path}"); system("{$POSTMAP_BIN} {$conf_postfix_relay_recipients_path}"); genSaslFinishConfigAndRights(); system("chown " . $conf_dtc_system_username . ":postfix " . $conf_generated_file_path . "/postfix_*"); //in case our relay_domains file hasn't been created correctly, we should touch it system("touch {$conf_postfix_relay_domains_path}"); }
function list_options() { global $edit_domain; global $adm_login; global $conf_use_advanced_lists_tunables; $admin_path = getAdminPath($adm_login); $list_path = $admin_path . "/" . $edit_domain . "/lists/" . $edit_domain . "_" . $_REQUEST["edit_mailbox"]; $output = ""; $output .= "<tr><td colspan=\"2\"><b>" . _("Rights") . "</b></td></tr>"; $output .= getListOptionsBoolean($list_path, "subonlypost", _("Subscribers only post:")); $output .= getListOptionsBoolean($list_path, "closedlist", _("Closed list:")); $output .= getListOptionsList($list_path, "owner", _("Owner:")); $output .= getListOptionsBoolean($list_path, "moderated", _("Moderated:")); $output .= getListOptionsList($list_path, "moderators", _("Moderators:")); $output .= getListOptionsBoolean($list_path, "nosubconfirm", _("No subscribtion confirmation:")); $output .= "<tr><td colspan=\"2\"><b>" . _("Header") . "</b></td></tr>"; $output .= getListOptionsValue($list_path, "prefix", _("Subject prefix:")); $output .= getListOptionsList($list_path, "delheaders", _("Delete headers:")); $output .= getListOptionsBoolean($list_path, "addtohdr", _("Add To: header:")); $output .= getListOptionsBoolean($list_path, "tocc", _("To: or Cc: not mandatory:")); $output .= getListOptionsTextarea($list_path, "customheaders", _("Custom headers:")); $output .= getListOptionsTextarea($list_path, "footer", _("Added footer:")); $output .= "<tr><td colspan=\"2\"><b>" . _("Archive") . "</b></td></tr>"; $output .= getListOptionsBoolean($list_path, "noarchive", _("No archives:")); $output .= getListOptionsBoolean($list_path, "noget", _("No get-N function:")); $output .= getListOptionsBoolean($list_path, "subonlyget", _("get-N function only for subscribers:")); $output .= "<tr><td colspan=\"2\"><b>" . _("Digest") . "</b></td></tr>"; $output .= getListOptionsValue($list_path, "digestinterval", _("Digest interval:")); $output .= getListOptionsValue($list_path, "digestmaxmails", _("Digest max mails:")); $output .= "<tr><td colspan=\"2\"><b>" . _("Notifications") . "</b></td></tr>"; $output .= getListOptionsBoolean($list_path, "notifysub", _("Notify new subscribtions:")); $output .= getListOptionsBoolean($list_path, "nosubonlydenymails", _("Notify when post and not subscribed:")); $output .= getListOptionsBoolean($list_path, "notoccdenymails", _("Deny if no To: or Cc::")); $output .= getListOptionsBoolean($list_path, "noaccessdenymails", _("Notify when post and no access:")); $output .= "<tr><td colspan=\"2\"><b>" . _("SMTP configuration") . "</b></td></tr>"; $output .= getListOptionsValue($list_path, "memorymailsize", _("Max mail memory size:")); if ($conf_use_advanced_lists_tunables == "yes") { $output .= getListOptionsValue($list_path, "relayhost", _("SMTP relay server:")); $output .= getListOptionsValue($list_path, "verp", _("VERP:")); $output .= getListOptionsValue($list_path, "maxverprecips", _("Max VERP recipients:")); $output .= getListOptionsValue($list_path, "delimiter", _("Delimiter:")); $output .= getListOptionsValue($list_path, "bouncelife", _("Bounce life:")); $output .= getListOptionsTextarea($list_path, "access", _("Access list:")); } $output .= "<tr><td colspan=\"2\"><b>" . _("Subscribe/Unsubscribe an email address") . "</b></td></tr>"; $output .= "<tr><td onmouseover=\"Tip('" . _("Insert here an email address to subscribe it.") . "',STICKY,true,CLICKCLOSE,true,FADEIN,600)\" valign=\"top\" align=\"right\">" . _("Subscribe:") . "</td>\n <td><input size=\"40\" type=\"text\" value=\"\" name=\"sub\"></td></tr>"; $output .= "<tr><td onmouseover=\"Tip('" . _("Insert here an email address to unsubscribe it.") . "',STICKY,true,CLICKCLOSE,true,FADEIN,600)\" valign=\"top\" align=\"right\">" . _("Unsubscribe:") . "</td>\n <td><input size=\"40\" type=\"text\" value=\"\" name=\"unsub\"></td></tr>"; $output .= "<tr><td colspan=\"2\"><b>" . _("Web archive") . "</b></td></tr>"; $output .= getListOptionsWABoolean("webarchive", _("Enable webarchive:")); $output .= getListOptionsWATextarea($list_path, "rcfile", _("Own template:")); $output .= getListOptionsWABooleanActions("recreatewa", _("Recreate:")); $output .= getListOptionsWABooleanActions("deletewa", _("Delete:")); $output .= getListOptionsWABoolean("spammode", _("Anti-spam mode:")); return $output; }
function mail_account_generate_qmail() { global $pro_mysql_domain_table; global $pro_mysql_admin_table; global $pro_mysql_subdomain_table; global $pro_mysql_backup_table; global $console; global $conf_generated_file_path; global $conf_qmail_rcpthost_path; global $conf_qmail_virtualdomains_path; global $conf_qmail_assign_path; global $conf_qmail_poppasswd_path; global $conf_nobody_user_id; global $conf_nobody_group_id; global $conf_dtc_system_gid; global $conf_dtc_system_uid; global $conf_dtc_system_username; $rcpthosts_file = ""; $local_domains_file = ""; $virtualdomains_file = ""; $poppasswd_file = ""; $assign_file = ""; $more_rcpt = ""; $query = "SELECT * FROM {$pro_mysql_admin_table} ORDER BY adm_login;"; $result = mysql_query($query) or die("Cannot execute query : \"{$query}\""); $num_rows = mysql_num_rows($result); if ($num_rows < 1) { die("No account to generate"); } for ($i = 0; $i < $num_rows; $i++) { $row = mysql_fetch_array($result) or die("Cannot fetch user-admin"); $user_admin_name = $row["adm_login"]; $user_admin_pass = $row["adm_pass"]; $admin = fetchAdmin($user_admin_name, $user_admin_pass); $admin_path = getAdminPath($user_admin_name); if (($error = $admin["err"]) != 0) { die("Error fetching admin : {$error}"); } $info = $admin["info"]; if (isset($admin["data"])) { $data = $admin["data"]; $nbr_domain = sizeof($data); } else { $nbr_domain = 0; } for ($j = 0; $j < $nbr_domain; $j++) { $domain = $data[$j]; $domain_full_name = $domain["name"]; $domain_qmail_name = strtr($domain_full_name, ".", "-"); $rcpthosts_file .= "{$domain_full_name}\n"; $local_domains_file .= "{$domain_full_name}\n"; $more_rcpt .= "{$domain_full_name}\n"; if ($domain["primary_mx"] == "" || $domain["primary_mx"] == "default") { $virtualdomains_file .= "{$domain_full_name}:{$domain_qmail_name}\n"; $primary_mx = 1; } else { $primary_mx = 0; } if (isset($domain["mailinglists"]) && $primary_mx) { $lists = $domain["mailinglists"]; $nbr_boites = sizeof($lists); // go through each of these lists and add accounts to it for ($k = 0; $k < $nbr_boites; $k++) { $list = $lists[$k]; $list_id = $list["id"]; $list_name = $list["name"]; $list_owner = $list["owner"]; $list_domain = $list["domain"]; // add the missing domain to the list owner if (!preg_match("/\\@/", $list_owner)) { $list_owner .= "@" . $list_domain; } $list_path = "{$admin_path}/{$list_domain}/lists/{$list_domain}" . "_" . "{$list_name}"; writeMlmmjQmailFile($admin_path); $assign_file .= "+{$domain_qmail_name}-{$list_name}:{$conf_dtc_system_username}:{$conf_dtc_system_uid}:{$conf_dtc_system_gid}:{$list_path}:::\n"; } } if ($primary_mx && isset($domain["emails"])) { $emails = $domain["emails"]; $catch_all = $domain["catchall_email"]; $nbr_boites = sizeof($emails); $catch_all_flag = "no"; // Handles all domain parking nicely if ($domain["domain_parking"] != "no-parking") { for ($b = 0; $b < $nbr_domain; $b++) { if ($data[$b]["name"] == $domain["domain_parking"]) { $domain["emails"] = $data[$b]["emails"]; } } } // Loop for all mailboxes for ($k = 0; $k < $nbr_boites; $k++) { $email = $emails[$k]; $id = $email["id"]; $home = $email["home"]; // $box_path = "$admin_path/Mailboxs/$id"; $qmail_id = strtr($id, ".", ":"); $passwdtemp = $email["passwd"]; $passwd = crypt($passwdtemp, dtc_makesalt()); // This one is if you use the jedi's checkpassword programm // $poppasswd_file .= "$id@$domain_full_name:$passwd:nobody:$home\n"; // This one is for cmd5checkpw $poppasswd_file .= "{$id}@{$domain_full_name}:{$passwdtemp}\n"; if ($catch_all == $id) { $catch_all_flag = "yes"; $catchall_home = $home; } else { $assign_file .= "={$domain_qmail_name}-{$id}:{$conf_dtc_system_username}:{$conf_dtc_system_uid}:{$conf_dtc_system_gid}:{$home}:::\n"; } } // Gen the catchall if there is a box like that if ($catch_all_flag == "yes") { $assign_file .= "+{$domain_qmail_name}:{$conf_dtc_system_username}:{$conf_dtc_system_ui}:{$conf_dtc_system_gid}:" . getAdminPath($user_admin_name) . "/" . $domain["name"] . "/Mailboxs:::\n"; } } } } $rcpthosts_file .= get_remote_mail_domains(); $assign_file .= ".\n"; $fp = fopen("{$conf_generated_file_path}/{$conf_qmail_rcpthost_path}", "w"); fwrite($fp, $rcpthosts_file); fclose($fp); $fp = fopen("{$conf_generated_file_path}/local_domains", "w"); fwrite($fp, $local_domains_file); fclose($fp); $fp = fopen("{$conf_generated_file_path}/{$conf_qmail_virtualdomains_path}", "w"); fwrite($fp, $virtualdomains_file); fclose($fp); $fp = fopen("{$conf_generated_file_path}/{$conf_qmail_poppasswd_path}", "w"); fwrite($fp, $poppasswd_file); fclose($fp); $fp = fopen("{$conf_generated_file_path}/{$conf_qmail_assign_path}", "w"); fwrite($fp, $assign_file); fclose($fp); $fp = fopen("{$conf_generated_file_path}/morercpthosts", "w"); fwrite($fp, $more_rcpt); fclose($fp); }
function emailAccountsCreateCallback($id) { global $pro_mysql_pop_table; global $pro_mysql_list_table; global $conf_dtc_system_uid; global $conf_dtc_system_gid; global $adm_login; global $edit_domain; global $cyrus_used; global $pro_mysql_mailaliasgroup_table; global $CYRUS; $q = "SELECT * FROM {$pro_mysql_pop_table} WHERE autoinc='{$id}';"; $r = mysql_query($q) or die("Cannot query {$q} line: " . __LINE__ . " file " . __FILE__ . " sql said:" . mysql_error()); $n = mysql_num_rows($r); if ($n != 1) { die("Cannot find created email line " . __LINE__ . " file " . __FILE__); } $a = mysql_fetch_array($r); $test_query = "SELECT * FROM {$pro_mysql_list_table} WHERE name='" . $a["id"] . "' AND domain='{$edit_domain}'"; $test_result = mysql_query($test_query) or die("Cannot execute query \"{$test_query}\" line " . __LINE__ . " file " . __FILE__ . " sql said " . mysql_error()); $testnum_rows = mysql_num_rows($test_result); if ($testnum_rows >= 1) { $q = "DELETE FROM {$pro_mysql_pop_table} WHERE autoinc='{$id}';"; $r = mysql_query($q) or die("Cannot query {$q} line: " . __LINE__ . " file " . __FILE__ . " sql said:" . mysql_error()); return "<font color=\"red\">" . _("Error: a mailing list already exists with this name!") . "</font>"; } $test_query = "SELECT * FROM {$pro_mysql_mailaliasgroup_table} WHERE id='" . $a["id"] . "' AND domain_parent='{$edit_domain}'"; $test_result = mysql_query($test_query) or die("Cannot execute query \"{$test_query}\" line " . __LINE__ . " file " . __FILE__ . " sql said " . mysql_error()); $testnum_rows = mysql_num_rows($test_result); if ($testnum_rows >= 1) { $q = "DELETE FROM {$pro_mysql_pop_table} WHERE autoinc='{$id}';"; $r = mysql_query($q) or die("Cannot query {$q} line: " . __LINE__ . " file " . __FILE__ . " sql said:" . mysql_error()); return "<font color=\"red\">" . _("Error: Email group alias already exists with this name!") . "</font><br />"; } $crypted_pass = crypt($a["passwd"], dtc_makesalt()); if (!$cyrus_used) { writeDotQmailFile($a["id"], $a["mbox_host"]); } $admin_path = getAdminPath($adm_login); $box_path = "{$admin_path}/{$edit_domain}/Mailboxs/" . $a["id"]; $q = "UPDATE {$pro_mysql_pop_table} SET crypt='{$crypted_pass}',home='{$box_path}',uid='{$conf_dtc_system_uid}',gid='{$conf_dtc_system_gid}',fullemail='" . $a["id"] . '@' . $a["mbox_host"] . "',quota_couriermaildrop=CONCAT(1024000*quota_size,'S,',quota_files,'C') WHERE autoinc='{$id}';"; $r2 = mysql_query($q) or die("Cannot query {$q} line: " . __LINE__ . " file " . __FILE__ . " sql said:" . mysql_error()); triggerMXListUpdate(); if ($cyrus_used) { # login to cyradm $cyr_conn = new cyradm(); $error = $cyr_conn->imap_login(); if ($error != 0) { die("imap_login Error {$error}"); } $result = $cyr_conn->createmb("user/" . $a["id"] . "@" . $edit_domain); $result = $cyr_conn->createmb("user/" . $a["id"] . "/" . $a["spam_mailbox"] . "@" . $edit_domain); $result = $cyr_conn->setacl("user/" . $a["id"] . "@" . $edit_domain, $CYRUS['ADMIN'], "lrswipcda"); $result = $cyr_conn->setmbquota("user/" . $a["id"] . "@" . $edit_domain, $a["quota_size"]); } updateUsingCron("gen_qmail='yes', qmail_newu='yes'"); return ""; }
function do_package_install() { global $package_installer_console; global $edit_domain; global $adm_login; global $pkg_info; global $dtcpkg_db_login; $package_installer_console .= "=> Installer Preparing Configuration for WordPress 2.5.1<br>"; $admin_path = getAdminPath($adm_login); $vhost_path = $admin_path . "/" . $edit_domain . "/subdomains/" . $_REQUEST["subdomain"] . "/html"; $hostname = $_REQUEST["subdomain"] . "." . $edit_domain; $vhost_url = "http://{$hostname}/"; $cmd = "mv " . $vhost_path . "/" . $pkg_info["directory"] . " " . $vhost_path . "/" . $_REQUEST["dtcpkg_directory"]; $data = array(); $data["lang"] = "english"; $data["dbms"] = "mysql4"; $data["upgrade"] = "0"; $data["dbhost"] = "localhost"; $data["dbname"] = $_REQUEST["database_name"]; $data["dbuser"] = $dtcpkg_db_login; $data["dbpasswd"] = $_REQUEST["dtcpkg_db_pass"]; $data["prefix"] = "wordpress_"; $data["server_name"] = $hostname; $data["server_port"] = "80"; $data["admin_name"] = $_REQUEST["dtcpkg_login"]; $data["admin_pass1"] = $_REQUEST["dtcpkg_pass"]; $data["admin_pass2"] = $_REQUEST["dtcpkg_pass"]; $data["install_step"] = "1"; $data["cur_lang"] = "english"; //Prepare WordPress Configuration function keygen($length) { $key = ''; for ($i = 0; $i < $length; $i++) { $key .= chr(rand(40, 127)); } return $key; } $wpconfig = array(); $wpconfig["gophp"] = "<?php"; $wpconfig["dbname"] = "define('DB_NAME','" . $data["dbname"] . "');"; $wpconfig["dbuser"] = "******" . $data["dbuser"] . "');"; $wpconfig["dbpasswd"] = "define('DB_PASSWORD','" . $data["dbpasswd"] . "');"; $wpconfig["dbhost"] = "define('DB_HOST','localhost');"; $wpconfig["dbcharset"] = "define('DB_CHARSET','utf8');"; $wpconfig["dbcollate"] = "define('DB_COLLATE','');"; $wpconfig["seckey"] = "define('SECRET_KEY','" . keygen(25) . "');"; $wpconfig["tblpfx"] = "\$" . "table_prefix = 'wp_';"; $wpconfig["wplang"] = "define('WPLANG','');"; $wpconfig["abspath"] = "define('ABSPATH',dirname(__FILE__).'/');"; $wpconfig["req_once"] = "require_once(ABSPATH.'wp-settings.php');"; $wpconfig["nophp"] = "?>"; $wpconf_str = implode("\n", $wpconfig); //Write WordPress Config File if (!file_put_contents($vhost_path . "/" . $_REQUEST["dtcpkg_directory"] . "/wp-config.php", $wpconf_str)) { $package_installer_console .= "=> Error Writing WordPress Configuration 'wp-config.php'<br>"; } else { $package_installer_console .= "=> WordPress Configuration 'wp-config.php' written<br>"; } //Set url for post install script, currently not used, //but returns HTTP/1.1 200 OK on WordPress install success. $url = $vhost_url . $_REQUEST["dtcpkg_directory"] . "/" . $pkg_info["post_script_url"]; // print_r($data); $package_installer_console .= "=> Calling {$url}<br>"; $ret = HTTP_Post($url, $data, $url); $weblines = explode("\n", $ret); // HTTP/1.1 200 OK $package_installer_console .= "=> Script returns: " . $weblines[0] . "\n\n"; $package_installer_console .= "WordPress will ask for a blog name and admin email address the first time you run it.\n\n WordPress will then show your admin login and password. Write it down to avoid trouble!\n\n"; return 0; // Ok, no problem ! :) }
function drawTicketConfig() { global $pro_mysql_tik_admins_table; global $pro_mysql_tik_cats_table; global $pro_mysql_domain_table; global $rub; global $sousrub; global $conf_all_customers_list_domain; global $conf_all_customers_list_email; global $pro_mysql_list_table; global $pro_mysql_domain_table; global $pro_mysql_client_table; $out = ""; $domains = array(); $domains[] = "default"; $q = "SELECT name FROM {$pro_mysql_domain_table};"; $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " mysql said " . mysql_error()); $n = mysql_num_rows($r); for ($i = 0; $i < $n; $i++) { $a = mysql_fetch_array($r); $domains[] = $a["name"]; } $all_lists = array(); $domains[] = _("no list selected"); $q = "SELECT * FROM {$pro_mysql_list_table} WHERE domain='{$conf_all_customers_list_domain}';"; $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " mysql said " . mysql_error()); $n = mysql_num_rows($r); for ($i = 0; $i < $n; $i++) { $a = mysql_fetch_array($r); $all_lists[] = $a["name"]; } $dsc = array("title" => _("Mailing list for sending email to all customers"), "action" => "tik_global_param_list", "forward" => array("rub", "sousrub"), "cols" => array("all_customers_list_email" => array("legend" => _("All customers list address: "), "type" => "popup", "values" => $all_lists), "all_customers_list_domain" => array("legend" => "@", "type" => "popup", "values" => $domains))); $out .= configEditorTemplate($dsc); if (isset($_REQUEST["action"]) && $_REQUEST["action"] == "resubscript_all_users") { $q = "SELECT owner FROM {$pro_mysql_domain_table} WHERE name='{$conf_all_customers_list_domain}';"; $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n = mysql_num_rows($r); if ($n != 1) { die("No domain by this name: {$conf_all_customers_list_domain} line " . __LINE__ . " file " . __FILE__); } $a = mysql_fetch_array($r); $admpath = getAdminPath($a["owner"]); $subs_path = $admpath . "/{$conf_all_customers_list_domain}/lists/" . $conf_all_customers_list_domain . "_" . $conf_all_customers_list_email . "/subscribers.d"; if (!is_dir($subs_path)) { $out .= "<font color=\"red\">" . _("Could not find the folder") . " " . $subs_path . " " . _("when resubscribing all users.") . "</font>"; } else { // First we list all files in the subscriber.d folder $file_list = array(); if ($dh = opendir($subs_path)) { while (($file = readdir($dh)) !== false) { $fullpath = $subs_path . "/" . $file; if (filetype($fullpath) != "dir") { $file_list[] = $fullpath; } } } // Then we delete them all $n = sizeof($file_list); for ($i = 0; $i < $n; $i++) { unlink($file_list[$i]); } // Then we get a list of all the users and we subscribe them $old_file = ""; $addr_list = ""; $q = "SELECT DISTINCT email FROM {$pro_mysql_client_table} ORDER BY email"; $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n = mysql_num_rows($r); for ($i = 0; $i < $n; $i++) { $a = mysql_fetch_array($r); $fname = strtolower(substr($a["email"], 0, 1)); if ($fname == $old_file || $old_file == "") { $addr_list .= $a["email"] . "\n"; } else { $fullpath = $subs_path . "/" . $old_file; $fp = fopen($fullpath, "w+"); fwrite($fp, $addr_list); fclose($fp); $addr_list = $a["email"] . "\n"; } $old_file = $fname; } if ($n > 0) { $fullpath = $subs_path . "/" . substr($a["email"], 0, 1); $fp = fopen($fullpath, "w+"); fwrite($fp, $addr_list); fclose($fp); } } } $out .= "<form action=\"" . $_SERVER["PHP_SELF"] . "\">\n<input type=\"hidden\" name=\"rub\" value=\"{$rub}\">\n<input type=\"hidden\" name=\"sousrub\" value=\"" . $_REQUEST["sousrub"] . "\">\n<input type=\"hidden\" name=\"action\" value=\"resubscript_all_users\">\n<div class=\"input_btn_container\" onMouseOver=\"this.className='input_btn_container-hover';\" onMouseOut=\"this.className='input_btn_container';\">\n<div class=\"input_btn_left\"></div>\n<div class=\"input_btn_mid\"><input class=\"input_btn\" type=\"submit\" value=\"" . _("Resubscribe all users") . "\"></div>\n<div class=\"input_btn_right\"></div></div></form><br><br>\n" . _("Note that you should always click on the above button to resubscribe all of your users before sending an email to the list") . "<br>\n"; $out .= "<h3>" . _("Support ticket configuration") . "</h3>"; $dsc = array("title" => _("Ticket global parameters"), "action" => "tik_global_param", "forward" => array("rub", "sousrub"), "cols" => array("support_ticket_email" => array("legend" => _("Support ticket email address: "), "type" => "text", "size" => "32"), "support_ticket_fw_email" => array("legend" => _("Support ticket forward email address:"), "type" => "text", "size" => "32"), "support_ticket_domain" => array("legend" => "@", "type" => "popup", "values" => $domains))); $out .= configEditorTemplate($dsc); $dsc = array("table_name" => $pro_mysql_tik_admins_table, "title" => _("List of the administrators receiving request for support messages:"), "action" => "tik_admins", "forward" => array("rub", "sousrub"), "cols" => array("id" => array("type" => "id", "display" => "no", "legend" => "id"), "pseudo" => array("type" => "text", "legend" => _("Nick name")), "realname" => array("type" => "text", "legend" => _("Real name")), "email" => array("type" => "text", "legend" => _("Email addr")), "tikadm_pass" => array("type" => "password", "legend" => _("Password")), "available" => array("type" => "radio", "legend" => _("Available"), "values" => array("yes", "no"), "display_replace" => array(_("Yes"), _("No"))))); $out .= dtcDatagrid($dsc); $dsc = array("table_name" => $pro_mysql_tik_cats_table, "title" => _("Ticket categories:"), "action" => "tik_cats", "forward" => array("rub", "sousrub"), "cols" => array("id" => array("type" => "id", "display" => "no", "legend" => "id"), "catname" => array("type" => "text", "legend" => _("Category")), "catdescript" => array("type" => "text", "size" => "50", "legend" => _("Category description")))); $out .= dtcDatagrid($dsc); return $out; }
function updateAllListWebArchive() { global $pro_mysql_list_table; global $pro_mysql_domain_table; $query = "SELECT * FROM {$pro_mysql_list_table} WHERE webarchive='yes'"; $result = mysql_query($query) or die("Cannot execute query \"{$query}\" line " . __LINE__ . " file " . __FILE__ . " sql said " . mysql_error()); $number = mysql_num_rows($result); // $row = mysql_fetch_array($result); echo "Update of {$number} webarchive:\n"; for ($j = 0; $j < $number; $j++) { $row = mysql_fetch_array($result); $list_domain = $row["domain"]; $list_name = $row["name"]; $query2 = "SELECT owner FROM {$pro_mysql_domain_table} WHERE name='{$list_domain}' LIMIT 1"; $result2 = mysql_query($query2) or die("Cannot execute query \"{$query2}\" line " . __LINE__ . " file " . __FILE__ . " sql said " . mysql_error()); $row2 = mysql_fetch_array($result2); $list_admin = $row2["owner"]; echo "...webarchive updating of {$list_name} on {$list_domain}\n"; $admin_path = getAdminPath($list_admin); $list_dir = $admin_path . "/" . $list_domain . "/lists/" . $list_domain . "_" . $list_name; $web_path = $admin_path . "/" . $list_domain . "/subdomains/www/html/lists/" . $list_name; $archive_dir = $list_dir . "/archive"; $list_rcfile = $list_dir . "/rcfile"; if (file_exists($list_rcfile)) { $rcfile = " -rcfile " . $list_rcfile . " "; } else { $rcfile = " "; } if ($row["spammode"] == "yes") { $spammode = " -spammode "; } else { $spammode = " -nospammode "; } $updatewa = "mhonarc" . $rcfile . "-outdir " . $web_path . " -add " . $spammode . $archive_dir; exec($updatewa); } }
function tunablesWABooleanActionsRequestCheck($list_dir) { global $adm_login; global $pro_mysql_list_table; global $edit_domain; $name = $_REQUEST["edit_mailbox"]; $admin_path = getAdminPath($adm_login); $this_list_web_path = $admin_path . "/" . $edit_domain . "/subdomains/www/html/lists/" . $name; $test_query = "SELECT webarchive FROM {$pro_mysql_list_table}\tWHERE domain='{$edit_domain}' AND name='{$name}' LIMIT 1"; $test_result = mysql_query($test_query) or die("Cannot execute query \"{$test_query}\" line " . __LINE__ . " file " . __FILE__ . " sql said " . mysql_error()); $test = mysql_fetch_array($test_result); if ($test[0] == "no") { if (isset($_REQUEST["deletewa"])) { if (file_exists($this_list_web_path)) { $delete_this_web_path = "rm -rf " . $this_list_web_path; exec($delete_this_web_path); } } } if ($test[0] == "yes") { if (isset($_REQUEST["recreatewa"])) { if (file_exists($this_list_web_path)) { $delete_this_web_path = "rm -rf " . $this_list_web_path; exec($delete_this_web_path); } if (!file_exists($this_list_web_path)) { $create_this_web_path = "mkdir " . $this_list_web_path; exec($create_this_web_path); } $this_list_rcfile = $list_dir . "/rcfile"; if (file_exists($this_list_rcfile)) { $rcfile = " -rcfile " . $this_list_rcfile . " "; } else { $rcfile = " "; } $archive_dir = $list_dir . "/archive"; $createwa = "mhonarc" . $rcfile . "-outdir " . $this_list_web_path . " " . $archive_dir; exec($createwa); } } }
function drawAdminTools_PackageInstaller($domain, $adm_path) { global $adm_login; global $adm_pass; global $edit_domain; global $addrlink; global $dtcshared_path; global $pro_mysql_subdomain_table; global $conf_mysql_db; global $conf_user_mysql_type; global $conf_user_mysql_host; global $conf_user_mysql_root_login; global $conf_user_mysql_root_pass; global $package_installer_console; global $dtcpkg_db_login; global $pkg_info; $txt = ""; $dir = $dtcshared_path . "/package-installer"; if (isset($_REQUEST["action"]) && ($_REQUEST["action"] == "do_install" || $_REQUEST["action"] == "prepareinstall")) { $pkg_path = $dir . "/" . $_REQUEST["pkg"]; $dtc_pkg_info = $pkg_path . "/dtc-pkg-info.php"; if (!file_exists($dtc_pkg_info)) { die("Package {$dtc_pkg_info} not found line " . __LINE__ . " file " . __FILE__); } include $dtc_pkg_info; } if (isset($_REQUEST["action"]) && $_REQUEST["action"] == "do_install") { $pkg_path = $dir . "/" . $_REQUEST["pkg"]; $dtc_pkg_install = $pkg_path . "/dtc-pkg-install.php"; if (file_exists($dtc_pkg_install)) { include $dtc_pkg_install; } // Check if user has enough rights checkLoginPassAndDomain($adm_login, $adm_pass, $edit_domain); checkSubdomainFormat($_REQUEST["subdomain"]); $admin_path = getAdminPath($adm_login); $target = "{$admin_path}/{$edit_domain}/subdomains/" . $_REQUEST["subdomain"] . "/html"; if (!is_dir($target)) { die("Destination directory does not exists line " . __LINE__ . " file " . __FILE__); } // Unpack the distribution package in target folder if ($pkg_info["unpack_type"] == "tar.gz") { $cmd = "tar -C {$target} -xvzf {$pkg_path}/" . $pkg_info["file"]; $x = "=> tar -C {$target} -xvzf {$pkg_path}/" . $pkg_info["file"] . "\n"; exec($cmd, $exec_out, $return_val); } else { if ($pkg_info["unpack_type"] == "tar.bz2") { $cmd = "tar -C {$target} -xvjf {$pkg_path}/" . $pkg_info["file"]; $x = "=> tar -xvjf " . $pkg_info["file"] . "\n"; exec($cmd, $exec_out, $return_val); } else { die("Package methode not supported yet"); } } // Rename folder to the destination folder name (eg remove version out of package.X.X.X folder name if exists) if (isset($pkg_info["renamedir_to"]) && isset($pkg_info["resulting_dir"]) && $pkg_info["resulting_dir"] != $pkg_info["renamedir_to"]) { $cmd = "mv {$target}/" . $pkg_info["resulting_dir"] . " {$target}/" . $pkg_info["renamedir_to"]; $x .= "=> Moving " . $pkg_info["resulting_dir"] . " to " . $pkg_info["renamedir_to"] . "<br>"; exec($cmd, $exec_out, $return_val); } // https://dtc.gpl-host.com/dtc/index.php?adm_login=zigo&adm_pass=toto&addrlink=gpl-host.com/package-installer&action=prepareinstall&pkg=phpbb // Move the folder to the requested name dtcpkg_directory=bla if ($pkg_info["can_select_directory"] == "yes") { if ($_REQUEST["dtcpkg_directory"] == "") { $cmd = "mv {$target}/" . $pkg_info["renamedir_to"] . "/* {$target}/"; $x .= "=> Moving " . $pkg_info["renamedir_to"] . " to folder /<br>"; exec($cmd, $exec_out, $return_val); $realtarget = "{$target}"; } else { $cmd = "mv {$target}/" . $pkg_info["renamedir_to"] . " {$target}/" . $_REQUEST["dtcpkg_directory"]; $x .= "=> Moving " . $pkg_info["renamedir_to"] . " to " . $_REQUEST["dtcpkg_directory"] . "<br>"; exec($cmd, $exec_out, $return_val); $realtarget = "{$target}/" . $_REQUEST["dtcpkg_directory"]; } } if ($conf_user_mysql_type == "distant") { $newid = mysql_connect($conf_user_mysql_host, $conf_user_mysql_root_login, $conf_user_mysql_root_pass) or die("Cannot connect to user host"); } // Get the database infos beffore calling the custom package installer $q = "SELECT DISTINCT db.Db,db.User FROM mysql.user,mysql.db WHERE user.dtcowner='{$adm_login}' AND db.User=user.User AND db.Db='" . $_REQUEST["database_name"] . "';"; $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n = mysql_num_rows($r); if ($n != 1) { die("Cannot find database line " . __LINE__ . " file " . __FILE__); } $a = mysql_fetch_array($r); $dtcpkg_db_login = $a["User"]; if ($conf_user_mysql_type == "distant") { mysql_close($newid) or die("Cannot disconnect to user database"); connect2base(); } // Call the package specific installer php script $install_ret = do_package_install(); // reselect the current dtc db in case another have been set mysql_select_db($conf_mysql_db); if ($install_ret == 0) { $package_installer_console .= "Install successful !<br>"; } $nbr_remove = sizeof($pkg_info["remove_folder_path"]); if ($nbr_remove > 0) { // print_r($pkg_info["remove_folder_path"]); $nbr_remove = sizeof($pkg_info["remove_folder_path"]); $package_installer_console .= "Removing install folders...<br>"; for ($i = 0; $i < $nbr_remove; $i++) { $cmd = "rm -r {$realtarget}/" . $pkg_info["remove_folder_path"][$i]; // $package_installer_console .= $cmd."<br>"; exec($cmd, $exec_out, $return_val); } } // Print the results $txt .= "<h3>Installation of " . $pkg_info["name"] . ":</h3><br><pre>" . $x . $package_installer_console . "</pre>"; return $txt; } if (isset($_REQUEST["action"]) && $_REQUEST["action"] == "prepareinstall") { $txt = "<h3>You are about to install " . $pkg_info["name"] . ":</h3><br>\n\t\t<u>Description:</u> " . $pkg_info["long_desc"] . "<br>\n\t\t<u>Version:</u> " . $pkg_info["version"] . "<br><br>"; $txt .= "<form action=\"" . $_SERVER["PHP_SELF"] . "\">\n\t\t<input type=\"hidden\" name=\"adm_login\" value=\"{$adm_login}\">\n\t\t<input type=\"hidden\" name=\"adm_pass\" value=\"{$adm_pass}\">\n\t\t<input type=\"hidden\" name=\"addrlink\" value=\"{$addrlink}\">"; if ($pkg_info["need_database"] == "yes") { $txt .= "<h3>Choose a database name for setup:</h3><br>"; if ($conf_user_mysql_type == "distant") { $newid = mysql_connect($conf_user_mysql_host, $conf_user_mysql_root_login, $conf_user_mysql_root_pass) or die("Cannot connect to user SQL host"); } mysql_select_db("mysql") or die("Cannot select db: mysql"); $q = "SELECT db.Db,db.User FROM user,db\n\t\t\tWHERE user.dtcowner='{$adm_login}'\n\t\t\tAND db.User=user.User"; $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n = mysql_num_rows($r); if ($n < 1) { $txt .= "You don't have any database yet. Please create one using the database tool\n\t\t\t\t(click database in the menu, then create a user and a database for this user)."; if ($conf_user_mysql_type == "distant") { mysql_close($newid) or die("Cannot disconnect to user database"); connect2base(); } mysql_select_db($conf_mysql_db); return $txt; } $txt .= "Database name: <select name=\"database_name\">"; for ($i = 0; $i < $n; $i++) { $a = mysql_fetch_array($r); $txt .= "<option value=\"" . $a["Db"] . "\">" . $a["Db"] . " (login: "******"User"] . ")" . "</option>"; } $txt .= "</select><br>\n\t\t\t\tDatabase password: <input type=\"password\" name=\"dtcpkg_db_pass\" value=\"\"><br><br>"; if ($conf_user_mysql_type == "distant") { mysql_close($newid) or die("Cannot disconnect to user database"); connect2base(); } mysql_select_db($conf_mysql_db) or die("Cannot select db: {$conf_mysql_db} line " . __LINE__ . " file " . __FILE__); } if ($pkg_info["need_admin_email"] == "yes") { $txt .= "<h3>Enter email for the admin of this package:</h3><br>"; $txt .= "Email: <input type=\"text\" name=\"dtcpkg_email\" value=\"\"><br><br>"; } if ($pkg_info["need_admin_login"] == "yes") { $txt .= "<h3>Enter login informations for the admin of this package:</h3><br>"; $txt .= "Login: <input type=\"text\" name=\"dtcpkg_login\" value=\"\"><br>"; if ($pkg_info["need_admin_pass"] == "yes") { $txt .= "Pass: <input type=\"text\" name=\"dtcpkg_pass\" value=\"\"><br>"; } $txt .= "<br>"; } $txt .= "<h3>Choose the subdomain and install :</h3><br>"; $txt .= "<input type=\"hidden\" name=\"action\" value=\"do_install\">\n\t\t<input type=\"hidden\" name=\"pkg\" value=\"" . $_REQUEST["pkg"] . "\">\n\t\tSubdomain: <select name=\"subdomain\">"; // echo "<pre>"; // print_r($domain); // echo "</pre>"; $n = sizeof($domain["subdomains"]); for ($i = 0; $i < $n; $i++) { $txt .= "<option value=\"" . $domain["subdomains"][$i]["name"] . "\">" . $domain["subdomains"][$i]["name"] . "</option>"; } $txt .= "</select><br><br>"; if ($pkg_info["can_select_directory"] == "yes") { $txt .= "<h3>Enter the directory where you want to install this package:</h3><br>"; $txt .= "Directory (blank for /): <input type=\"text\" name=\"dtcpkg_directory\" value=\"\"><br><br>"; } $txt .= "<input type=\"submit\" value=\"Install\">"; $txt .= "</form>"; return $txt; } $txt = "<h3>" . _("Choose a package to install") . ":</h3>"; $txt .= "<table cellspacing=\"0\" cellpadding=\"4\" border=\"1\">"; $txt .= "<tr><td>" . _("Package name") . "</td><td>" . _("Description") . "</td><td>" . _("Package version") . "</td><td>" . _("Need a database") . "</td><td>" . _("Unpack size") . "</td><td>" . _("Install") . "</td></tr>"; $packages = array(); if (is_dir($dir) && ($dh = opendir($dir))) { while (($file = readdir($dh)) !== false) { if (is_dir($dir . "/" . $file) && $file != "." && $file != "..") { $packages[] = $file; } } closedir($dh); } sort($packages); foreach ($packages as $package) { if (file_exists($dir . "/" . $package . "/dtc-pkg-info.php")) { include $dir . "/" . $package . "/dtc-pkg-info.php"; $txt .= "<tr><td>" . $pkg_info["name"] . "</td>\n\t\t\t\t<td>" . $pkg_info["short_desc"] . "</td>\n\t\t\t\t<td>" . $pkg_info["version"] . "</td>\n\t\t\t\t<td>" . $pkg_info["need_database"] . "</td>\n\t\t\t\t<td style=\"white-space:nowrap;text-align=right\" nowrap>" . smartByte($pkg_info["unpack_disk_usage"]) . "</td>\n\t\t\t\t<td><a href=\"" . $_SERVER["PHP_SELF"] . "?adm_login={$adm_login}&adm_pass={$adm_pass}&addrlink={$addrlink}&action=prepareinstall&pkg={$package}\">" . _("Install") . "</a></td></tr>"; } } $txt .= "</table>"; return $txt; }
function do_package_install() { global $package_installer_console; global $edit_domain; global $adm_login; global $pkg_info; global $dtcpkg_db_login; $package_installer_console .= "=> Starting Drupal Installer for Drupal 5.1<br />"; $admin_path = getAdminPath($adm_login); $vhost_path = $admin_path . "/" . $edit_domain . "/subdomains/" . $_REQUEST["subdomain"] . "/html"; $hostname = $_REQUEST["subdomain"] . "." . $edit_domain; $vhost_url = "http://{$hostname}/"; $cmd = "mv " . $vhost_path . "/" . $pkg_info["directory"] . " " . $vhost_path . "/" . $_REQUEST["dtcpkg_directory"]; //inserting the database dump $mysql_ver = mysql_get_server_info(); //i must add different db schemas for different mysql version $package_installer_console .= "=> Inserting the Drupal 5.1 database schemas for you MySQL: " . $mysql_ver . "<br />"; if (ereg('^4.0', $mysql_ver)) { $db_driver = 'mysql'; } else { $db_driver = 'mysqli'; } //update the drupal config file $package_installer_console .= "=> Changing Drupal Drupal 5.1 configuration file...<br />"; if ($_REQUEST["dtcpkg_directory"] == "") { $dest_dir = $vhost_path; } else { $dest_dir = $vhost_path . "/" . $_REQUEST["dtcpkg_directory"]; } $fname = $dest_dir . "/sites/default/settings.php"; $ar = file($fname); for ($k = 0; $k < count($ar); $k++) { if (ereg('^\\$db_url.+', $ar[$k])) { $ar[$k] = '$db_url = \'' . $db_driver . '://' . $dtcpkg_db_login . ':' . $_REQUEST["dtcpkg_db_pass"] . '@localhost/' . $_REQUEST["database_name"] . "';\n"; } } $fp = fopen($fname, "w"); if ($fp == FALSE) { $package_installer_console .= "<font color=\"red\">Cannot open Drupal config file!</font><br />"; return 1; } fwrite($fp, join("", $ar)); fclose($fp); if ($_REQUEST["dtcpkg_directory"] == "") { $dest_dir = $vhost_url; } else { $dest_dir = $vhost_url . $_REQUEST["dtcpkg_directory"]; } $data = array(); $data['profile'] = 'default'; $url = $dest_dir . "/" . $pkg_info["install_script_url"]; $package_installer_console .= "=> Calling {$url}<br />"; $ret = HTTP_Get($url, $data, $url); if (is_numeric(strpos($ret, "Drupal already installed"))) { $package_installer_console .= "=> Warning: Drupal database tables already exist!<br />"; $package_installer_console .= "=> (You must manually drop the tables if desired.)<br />"; } elseif (!is_numeric(strpos($ret, 'Congratulations, Drupal has been successfully installed.'))) { $package_installer_console .= "=> Installation Failed! Check your parameters.<br />"; $package_installer_console .= $ret; return 1; } $package_installer_console .= "=> Installation Success.<br />"; $package_installer_console .= "=> You need to go to <a href=\"" . $dest_dir . "\" target=\"blank\">your new Drupal site</a> to create the first account and complete the setup!<br />"; return 0; // Ok, no problem ! :) }
function do_package_install() { global $package_installer_console; global $edit_domain; global $adm_login; global $pkg_info; global $dtcpkg_db_login; global $conf_mysql_db; $package_installer_console .= "=> Starting phpBB Installer for PHPBB 2.0.17<br>"; $admin_path = getAdminPath($adm_login); $vhost_path = $admin_path . "/" . $edit_domain . "/subdomains/" . $_REQUEST["subdomain"] . "/html"; $hostname = $_REQUEST["subdomain"] . "." . $edit_domain; $vhost_url = "http://{$hostname}/"; if ($_REQUEST["dtcpkg_directory"] == "") { $dest_dir = $vhost_path; } else { $dest_dir = $vhost_path . "/" . $_REQUEST["dtcpkg_directory"]; } $config_php_file = '<?php $dbhost = "localhost"; $dbuname = "' . $dtcpkg_db_login . '"; $dbpass = "******"dtcpkg_db_pass"] . '"; $dbname = "' . $_REQUEST["database_name"] . '"; $prefix = "nuke"; $user_prefix = "nuke"; $dbtype = "MySQL"; $sitekey = "S·kQSd5%W@Y62-dm29-.-39.3a8sUf+W9"; $gfx_chk = 0; $subscription_url = ""; $admin_file = "admin"; $advanced_editor = 0; $reasons = array("As Is","Offtopic","Flamebait","Troll","Redundant","Insighful","Interesting","Informative","Funny","Overrated","Underrated"); $badreasons = 4; $AllowableHTML = array("b"=>1,"i"=>1,"u"=>1,"div"=>2,"a"=>2,"em"=>1,"br"=>1,"strong"=>1,"blockquote"=>1,"tt"=>1,"li"=>1,"ol"=>1,"ul"=>1); $CensorList = array("f**k","c**t","f****r","f*****g","pussy","c**k","c0ck","cum","twat","c**t","bitch","fuk","fuking","m**********r"); $tipath = "images/topics/"; $commercial_license = 0; if (eregi("config.php",$_SERVER[\'PHP_SELF\'])) { Header("Location: index.php"); die(); } ?>'; $fp = fopen($dest_dir . "/config.php", "w+"); if ($fp == FALSE) { $package_installer_console .= "<font color=\"red\">Cannot open config file!</font><br>"; return 1; } fwrite($fp, $config_php_file); fclose($fp); $file = $dest_dir . "/nuke.sql"; $cmd = "mysql -u{$dtcpkg_db_login} -D" . $_REQUEST["database_name"] . " -p" . $_REQUEST["dtcpkg_db_pass"] . " <{$file}"; exec($cmd, $exec_out2, $return_val); $n = sizeof($exec_out2); $exec_out = ""; for ($i = 0; $i < $n; $i++) { $exec_out .= $exec_out2[$i] . "\n"; } $package_installer_console .= "<pre>{$exec_out}</pre>"; /* echo $file; $fp = fopen($file,"r"); $sql_init_script = fread($fp,filesize ( $file )); fclose($fp); mysql_select_db($_REQUEST["database_name"])or die ("Cannot select db: ".$_REQUEST["database_name"]." line ".__LINE__." file ".__FILE__); $r = mysql_query($sql_init_script)or die("Cannot query $sql_init_script line ".__LINE__." file ".__FILE__." sql said ".mysql_error()); mysql_select_db($conf_mysql_db)or die ("Cannot select db: $conf_mysql_db line ".__LINE__." file ".__FILE__); */ /* $data["board_email"] = $_REQUEST["dtcpkg_email"]; $data["admin_name"] = $_REQUEST["dtcpkg_login"]; $data["admin_pass1"] = $_REQUEST["dtcpkg_pass"]; $data["admin_pass2"] = $_REQUEST["dtcpkg_pass"]; $url = $vhost_url.$_REQUEST["dtcpkg_directory"]."/".$pkg_info["post_script_url"];*/ return 0; // Ok, no problem ! :) }
if ($_REQUEST["physical_setup"] == "yes") { $soap_client = connectToVPSServer($a["vps_server_hostname"]); if ($soap_client == false) { echo "Could not connect to the VPS server for doing the setup: please contact the administrator!"; } else { $image_type = "lvm"; if (isVPSNodeLVMEnabled($a["vps_server_hostname"]) == "no") { $image_type = "vbd"; } $r = $soap_client->call("setupLVMDisks", array("vpsname" => $a["vps_xen_name"], "hddsize" => $prod["quota_disk"], "swapsize" => $prod["memory_size"], "imagetype" => $image_type), "", "", ""); } } } // Import of domain config if (isset($_REQUEST["action"]) && $_REQUEST["action"] == "import_domain") { $adm_path = getAdminPath($adm_login); $uploaded_file = basename($_FILES['domain_import_file']['name']); $uploaded_full_path = $adm_path . "/" . $uploaded_file; // echo "Importing domain file: ".$_FILES["domain_import_file"]["name"]." for user $adm_login"; move_uploaded_file($_FILES["domain_import_file"]["tmp_name"], $uploaded_full_path); domainImport($uploaded_full_path, $adm_login, $adm_pass); unlink($uploaded_full_path); // Tell the cron job to activate the changes $adm_query = "UPDATE {$pro_mysql_cronjob_table} SET qmail_newu='yes',restart_qmail='yes',reload_named='yes',\n\trestart_apache='yes',gen_vhosts='yes',gen_named='yes',gen_qmail='yes',gen_webalizer='yes',gen_backup='yes',gen_ssh='yes' WHERE 1;"; mysql_query($adm_query); triggerDomainListUpdate(); } /////////////////////////////////////////////////////////////// // Mark all named zone file for generation and serial update // /////////////////////////////////////////////////////////////// if (isset($_REQUEST["reinit_named_zones"]) && $_REQUEST["reinit_named_zones"] == "1") {
function do_package_install() { global $package_installer_console; global $edit_domain; global $adm_login; global $pkg_info; global $dtcpkg_db_login; global $joomla_lang; $package_installer_console .= "=> Starting Joomla Install for <br>"; $admin_path = getAdminPath($adm_login); $vhost_path = $admin_path . "/" . $edit_domain . "/subdomains/" . $_REQUEST["subdomain"] . "/html"; $hostname = $_REQUEST["subdomain"] . "." . $edit_domain; $vhost_url = "http://{$hostname}/"; $cmd = "mv " . $vhost_path . "/" . $pkg_info["directory"] . " " . $vhost_path . "/" . $_REQUEST["dtcpkg_directory"]; $url = $vhost_url . $_REQUEST["dtcpkg_directory"] . "/" . $pkg_info["post_script_url"]; $pkg_url = $vhost_url . $_REQUEST["dtcpkg_directory"] . "/"; $rootdir = $vhost_path . "/" . $_REQUEST["dtcpkg_directory"] . "/"; $installer_url = $pkg_url . "installation/index.php"; install_joomla($pkg_url, $_REQUEST["dtcpkg_email"], $_REQUEST["dtcpkg_pass"], $dtcpkg_db_login, $_REQUEST["dtcpkg_db_pass"], $_REQUEST["database_name"]); $package_installer_console .= "<script type='text/javascript'>alert('Congratulations! Installation complete - please see the messages below for more details');</script>"; $package_installer_console .= "<br/><b>Your new system details are</b><br/>"; $package_installer_console .= "Site address: <a href='{$pkg_url}' target='_blank'>{$pkg_url}</a> <br/>"; $package_installer_console .= "Administrator Address: <a href='{$pkg_url}/administrator/'>{$pkg_url}/administrator/</a><br/>"; $package_installer_console .= "Administrator Username: admin<br/>"; $admin_passdisplay = $_REQUEST["dtcpkg_pass"]; $package_installer_console .= "Administrator Password: {$admin_passdisplay} <br/>"; $package_installer_console .= "Thank you for using the package installer!"; return 0; // Ok, no problem ! :) }
function domainImport($path_from, $adm_login, $adm_pass) { global $pro_mysql_domain_table; global $pro_mysql_pop_table; global $pro_mysql_subdomain_table; global $pro_mysql_pop_table; global $pro_mysql_mailaliasgroup_table; global $pro_mysql_list_table; global $pro_mysql_ftp_table; global $pro_mysql_ssh_table; global $conf_dtc_system_uid; global $conf_dtc_system_gid; // Read the file $fp = fopen($path_from, "r+"); $xml_content = fread($fp, filesize($path_from)); fclose($fp); // Unserialize $options = array('tagMap' => array('util' => 'XML_Util'), 'classAttribute' => '_classname'); $unserializer = new XML_Unserializer($options); $result = $unserializer->unserialize($xml_content); if (PEAR::isError($result)) { echo _("Method unserialize() failed, could not import your domain configuration: ") . $result->getMessage(); return; } $dom_ar = $unserializer->getUnserializedData(); if (PEAR::isError($dom_ar)) { echo _("Method getUnserializedData() failed, could not import your domain configuration: ") . $dom_ar->getMessage(); return; } // Because of an issue of the programming of older versions of DTC, // if there was multiple domains in the XLM file, then we have things like this, // as PHP assotiative array, once Unserialize() is done: // <dtc-export-file version="0.1"> // <domains> // <item> // <example.com> // ........ // </example.com> // </item> // </domains // </dtc-export-file> // the below code will remove the <item> thing that is on the way, // and quite annoying for using array_keys(). if (isset($dom_ar["domains"]["item"])) { $nbr_domains = sizeof($dom_ar["domains"]["item"]); $my_domains = array(); for ($doms = 0; $doms < $nbr_domains; $doms++) { $mykey = array_keys($dom_ar["domains"]["item"][$doms]); $my_domains["domains"][$mykey[0]] = $dom_ar["domains"]["item"][$doms][$mykey[0]]; } $dom_ar = $my_domains; $all_domains = array_keys($dom_ar["domains"]); } else { $all_domains = array_keys($dom_ar["domains"]); $nbr_domains = sizeof($all_domains); } // Iterate on all domains of the file (if there's only one, it's fine too...) for ($doms = 0; $doms < $nbr_domains; $doms++) { // We will work on each domains one by one $dom_name = $all_domains[$doms]; if ($dom_name == "" || $dom_name == "Array") { echo _("Domain name is empty in your export file: could not import domain number ") . $doms; return; } $console .= "Importing domain: {$dom_name}<br>"; $cur_dom = $dom_ar["domains"][$dom_name]; $dom_name = $cur_dom["domain_config"]["name"]; // Check if the domain exists, if not, add it to the user $q = "SELECT * FROM {$pro_mysql_domain_table} WHERE name='{$dom_name}';"; $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n = mysql_num_rows($r); if ($n == 0) { addDomainToUser($adm_login, $adm_pass, $dom_name); } // Add owner path to ftp & ssh accounts $adm_path = getAdminPath($adm_login); $cur_dom = addOwnerPathToArray($cur_dom, $adm_path, "ftp", "homedir"); $cur_dom = addOwnerPathToArray($cur_dom, $adm_path, "ssh", "homedir"); $cur_dom = addOwnerPathToArray($cur_dom, $adm_path, "mailboxes", "home"); // Reimport all the stuff updateRowValue($pro_mysql_domain_table, "name='{$dom_name}'", $cur_dom["domain_config"], "safe_mode,sbox_protect,default_subdomain,quota,max_email,max_lists,max_ftp,max_subdomain,max_ssh,primary_dns,other_dns,primary_mx,other_mx,whois,hosting,gen_unresolved_domain_alias,txt_root_entry,txt_root_entry2,catchall_email,domain_parking,registrar_password,ttl,stats_login,stats_pass,stats_subdomain,wildcard_dns,domain_parking_type"); recreateAllRows($pro_mysql_subdomain_table, "domain_name='{$dom_name}'", $cur_dom["subdomains"], "safe_mode,sbox_protect,subdomain_name,ip,register_globals,associated_txt_record,generate_vhost,ssl_ip,nameserver_for,ttl,srv_record,add_default_charset,customize_vhost", ",domain_name", ",'{$dom_name}'"); recreateAllRows($pro_mysql_pop_table, "mbox_host='{$dom_name}'", $cur_dom["mailboxes"], "id,home,passwd,crypt,redirect1,redirect2,localdeliver,vacation_flag,bounce_msg,vacation_text,spam_mailbox_enable,quota_size,quota_files,quota_couriermaildrop", ",mbox_host", ",'{$dom_name}'"); recreateAllRows($pro_mysql_mailaliasgroup_table, "domain_parent='{$dom_name}'", $cur_dom["alias_group"], "id,delivery_group", ",domain_parent", ",'{$dom_name}'"); recreateAllRows($pro_mysql_list_table, "domain='{$dom_name}'", $cur_dom["lists"], "name,owner,spammode,webarchive", ",domain", ",'{$dom_name}'"); recreateAllRows($pro_mysql_ftp_table, "hostname='{$dom_name}'", $cur_dom["ftp"], "login,password,homedir", ",hostname", ",'{$dom_name}'"); recreateAllRows($pro_mysql_ssh_table, "hostname='{$dom_name}'", $cur_dom["ssh"], "login,crypt,password,homedir", ",hostname", ",'{$dom_name}'"); // Fixes the UID / GID for ssh, ftp and email accounts $q = "UPDATE {$pro_mysql_pop_table} SET uid='{$conf_dtc_system_uid}',gid='{$conf_dtc_system_gid}' WHERE mbox_host='{$dom_name}';"; $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $q = "UPDATE {$pro_mysql_ftp_table} SET uid='{$conf_dtc_system_uid}',gid='{$conf_dtc_system_gid}' WHERE hostname='{$dom_name}';"; $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $q = "UPDATE {$pro_mysql_ssh_table} SET uid='{$conf_dtc_system_uid}',gid='{$conf_dtc_system_gid}' WHERE hostname='{$dom_name}';"; $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); } if (isset($dom_ar["mysql"])) { $n_user = sizeof($dom_ar["mysql"]); $console .= _("Number of database users in this import: ") . $n_user . "<br>"; $musers = array_keys($dom_ar["mysql"]); for ($i = 0; $i < $n_user; $i++) { $username = $musers[$i]; $console .= _("Importing database username: "******"<br>"; unset($user); $user = $dom_ar["mysql"][$musers[$i]]; $password = $user["password"]; $q = "INSERT IGNORE INTO mysql.user\n\t\t\t(Host,User,Password,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Reload_priv,Shutdown_priv,Process_priv,File_priv,\n\t\t\tGrant_priv,References_priv,Index_priv,Alter_priv,Show_db_priv,Super_priv,Create_tmp_table_priv,Lock_tables_priv,\n\t\t\tExecute_priv,Repl_slave_priv,Repl_client_priv,Create_view_priv,Show_view_priv,Create_routine_priv,\n\t\t\tAlter_routine_priv,Create_user_priv,dtcowner)\n\t\t\tVALUES ('%','{$username}','{$password}','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N',\n\t\t\t'N','N','N','N','N','N','N','N','{$adm_login}');"; $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $q = "INSERT IGNORE INTO mysql.user\n\t\t\t(Host,User,Password,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Reload_priv,Shutdown_priv,Process_priv,File_priv,\n\t\t\tGrant_priv,References_priv,Index_priv,Alter_priv,Show_db_priv,Super_priv,Create_tmp_table_priv,Lock_tables_priv,\n\t\t\tExecute_priv,Repl_slave_priv,Repl_client_priv,Create_view_priv,Show_view_priv,Create_routine_priv,\n\t\t\tAlter_routine_priv,Create_user_priv,dtcowner)\n\t\t\tVALUES ('localhost','{$username}','{$password}','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N',\n\t\t\t'N','N','N','N','N','N','N','N','{$adm_login}');"; $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); if (isset($user["dbs"])) { $n_db = sizeof($user["dbs"]); $console .= _("Number of database owned by user") . " " . $username . ": " . $n_db . "<br>"; $mdbs = array_keys($user["dbs"]); for ($j = 0; $j < $n_db; $j++) { $db = $mdbs[$j]; $q = "INSERT IGNORE INTO mysql.db (Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Grant_priv,\n\t\t\t\t\tReferences_priv,Index_priv,Alter_priv,Create_tmp_table_priv,Lock_tables_priv,Create_view_priv,\n\t\t\t\t\tShow_view_priv,Create_routine_priv,Alter_routine_priv,Execute_priv)\n\t\t\t\t\tVALUES('%','{$db}','{$username}','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');"; $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $q = "INSERT IGNORE INTO mysql.db (Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Grant_priv,\n\t\t\t\t\tReferences_priv,Index_priv,Alter_priv,Create_tmp_table_priv,Lock_tables_priv,Create_view_priv,\n\t\t\t\t\tShow_view_priv,Create_routine_priv,Alter_routine_priv,Execute_priv)\n\t\t\t\t\tVALUES('localhost','{$db}','{$username}','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');"; $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); } } } $q = "FLUSH PRIVILEGES;"; $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); } return; }