Example #1
0
function error($code, $msg)
{
    global $background_log, $task_id, $instance, $status_path;
    $log_line = date("Y-m-d h:i:s") . " - {$task_id} - {$instance} - {$code} - {$msg}\n";
    file_put_contents($background_log, $log_line, FILE_APPEND);
    if ($status_path !== "") {
        update_status($code, $msg);
    }
    done();
}
Example #2
0
function roster_resource_set($user, $resource, $status = '', $message = '')
{
    global $roster;
    if (!isset($roster[$user])) {
        roster_add($user);
    }
    if ($status) {
        $roster[$user][$resource] = array('status' => $status, 'message' => $message);
    } else {
        unset($roster[$user][$resource]);
    }
    $status = status_aggregate($user);
    update_status($user, $status);
}
    update_status(gettext("Cleaning up..."));
    exec("/bin/rm -r /root/snort_rules_up");
    //	apc_clear_cache();
}
/* php code to flush out cache some people are reportting missing files this might help  */
sleep(2);
apc_clear_cache();
exec("/bin/sync ;/bin/sync ;/bin/sync ;/bin/sync ;/bin/sync ;/bin/sync ;/bin/sync ;/bin/sync");
/* if snort is running hardrestart, if snort is not running do nothing */
if (file_exists("/tmp/snort_download_halt.pid")) {
    start_service("snort");
    update_status(gettext("The Rules update finished..."));
    update_output_window(gettext("Snort has restarted with your new set of rules..."));
    exec("/bin/rm /tmp/snort_download_halt.pid");
} else {
    update_status(gettext("The Rules update finished..."));
    update_output_window(gettext("You may start snort now..."));
}
/* hide progress bar and lets end this party */
hide_progress_bar_status();
conf_mount_ro();
?>

<?php 
function read_body_firmware($ch, $string)
{
    global $fout, $file_size, $downloaded, $counter, $version, $latest_version, $current_installed_pfsense_version;
    $length = strlen($string);
    $downloaded += intval($length);
    $downloadProgress = round(100 * (1 - $downloaded / $file_size), 0);
    $downloadProgress = 100 - $downloadProgress;
     }
     break;
 case 'update_order':
     $status = zen_db_scrub_in($_POST['status'], true);
     $comments = $_POST['comments'];
     $comments = stripslashes($comments);
     $comments = trim($comments);
     $comments = mysql_escape_string($comments);
     $comments = htmlspecialchars($comments);
     $check_status = $db->Execute("select customers_id, customers_name, customers_email_address, orders_status,\r\n                                      date_purchased from " . TABLE_ORDERS . "\r\n                                      where orders_id = '" . (int) $oID . "'");
     if ($check_status->fields['orders_status'] != $status || zen_not_null($comments)) {
         $customer_notified = '0';
         if (isset($_POST['notify']) && $_POST['notify'] == 'on') {
             $customer_notified = '1';
         }
         update_status($oID, $status, $customer_notified, $comments);
         if ($customer_notified == '1') {
             email_latest_status($oID, $customer_notified);
         }
         if ($status == DOWNLOADS_ORDERS_STATUS_UPDATED_VALUE) {
             // adjust download_maxdays based on current date
             $zc_max_days = date_diff($check_status->fields['date_purchased'], date('Y-m-d H:i:s', time())) + DOWNLOAD_MAX_DAYS;
             $update_downloads_query = "update " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " set download_maxdays='" . $zc_max_days . "', download_count='" . DOWNLOAD_MAX_COUNT . "' where orders_id='" . (int) $oID . "'";
             $db->Execute($update_downloads_query);
         }
         $messageStack->add_session(SUCCESS_ORDER_UPDATED, 'success');
     } else {
         $messageStack->add_session(WARNING_ORDER_NOT_UPDATED, 'warning');
     }
     zen_redirect(zen_href_link(FILENAME_SUPER_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', $request_type));
     break;
function suricata_fetch_new_rules($file_url, $file_dst, $file_md5, $desc = "")
{
    /**********************************************************/
    /* This function downloads the passed rules file and      */
    /* compares its computed md5 hash to the passed md5 hash  */
    /* to verify the file's integrity.                        */
    /*                                                        */
    /* On Entry: $file_url = URL of rules file                */
    /*           $file_dst = Temp destination to store the    */
    /*                       downloaded rules file            */
    /*           $file_md5 = Expected md5 hash for the new    */
    /*                       downloaded rules file            */
    /*           $desc     = Short text string for use in     */
    /*                       log messages                     */
    /*                                                        */
    /*  Returns: TRUE if download was successful.             */
    /*           FALSE if download was not successful.        */
    /**********************************************************/
    global $pkg_interface, $last_curl_error, $update_errors;
    $suricatadir = SURICATADIR;
    $filename = basename($file_dst);
    if ($pkg_interface != "console") {
        update_status(gettext("There is a new set of {$desc} posted. Downloading..."));
    }
    log_error(gettext("[Suricata] There is a new set of {$desc} posted. Downloading {$filename}..."));
    error_log(gettext("\tThere is a new set of {$desc} posted.\n"), 3, SURICATA_RULES_UPD_LOGFILE);
    error_log(gettext("\tDownloading file '{$filename}'...\n"), 3, SURICATA_RULES_UPD_LOGFILE);
    $rc = suricata_download_file_url($file_url, $file_dst);
    // See if the download from the URL was successful
    if ($rc === true) {
        if ($pkg_interface != "console") {
            update_status(gettext("Done downloading {$desc} file."));
        }
        log_error("[Suricata] {$desc} file update downloaded successfully");
        error_log(gettext("\tDone downloading rules file.\n"), 3, SURICATA_RULES_UPD_LOGFILE);
        // Test integrity of the rules file.  Turn off update if file has wrong md5 hash
        if ($file_md5 != trim(md5_file($file_dst))) {
            if ($pkg_interface != "console") {
                update_output_window(gettext("{$desc} file MD5 checksum failed..."));
            }
            log_error(gettext("[Suricata] {$desc} file download failed.  Bad MD5 checksum..."));
            log_error(gettext("[Suricata] Downloaded File MD5: " . md5_file($file_dst)));
            log_error(gettext("[Suricata] Expected File MD5: {$file_md5}"));
            error_log(gettext("\t{$desc} file download failed.  Bad MD5 checksum.\n"), 3, SURICATA_RULES_UPD_LOGFILE);
            error_log(gettext("\tDownloaded {$desc} file MD5: " . md5_file($file_dst) . "\n"), 3, SURICATA_RULES_UPD_LOGFILE);
            error_log(gettext("\tExpected {$desc} file MD5: {$file_md5}\n"), 3, SURICATA_RULES_UPD_LOGFILE);
            error_log(gettext("\t{$desc} file download failed.  {$desc} will not be updated.\n"), 3, SURICATA_RULES_UPD_LOGFILE);
            $update_errors = true;
            return false;
        }
        return true;
    } else {
        if ($pkg_interface != "console") {
            update_output_window(gettext("{$desc} file download failed..."));
        }
        log_error(gettext("[Suricata] {$desc} file download failed... server returned error '{$rc}'..."));
        error_log(gettext("\t{$desc} file download failed.  Server returned error {$rc}.\n"), 3, SURICATA_RULES_UPD_LOGFILE);
        if ($pkg_interface == "console") {
            error_log(gettext("\tThe error text was: {$last_curl_error}\n"), 3, SURICATA_RULES_UPD_LOGFILE);
        }
        error_log(gettext("\t{$desc} will not be updated.\n"), 3, SURICATA_RULES_UPD_LOGFILE);
        $update_errors = true;
        return false;
    }
}
                delete_package($pkgtodo['name'] . '-' . $pkgtodo['version'], $pkg_id);
                delete_package_xml($pkgtodo['name']);
                install_package($pkgtodo['name']);
                $pkg_id++;
            }
        }
        update_status("All packages reinstalled.");
        $static_output .= "\n\nAll packages reinstalled.";
        start_service(htmlspecialchars($_GET['pkg']));
        update_output_window($static_output);
        break;
    default:
        $status = install_package(htmlspecialchars($_GET['id']));
        if ($status == -1) {
            update_status("Installation of " . htmlspecialchars($_GET['id']) . " FAILED!");
            $static_output .= "\n\nInstallation halted.";
        } else {
            update_status("Installation of " . $_GET['id'] . " completed.");
            $static_output .= "\n\nInstallation completed.   Please check to make sure that the package is configured from the respective menu then start the package.";
        }
        update_output_window($static_output);
}
// Delete all temporary package tarballs and staging areas.
unlink_if_exists("/tmp/apkg_*");
rmdir_recursive("/var/tmp/instmp*");
/* read only fs */
conf_mount_ro();
// close log
if ($fd_log) {
    fclose($fd_log);
}
function snort_apply_customizations($snortcfg, $if_real)
{
    global $config, $g, $snortdir;
    if (empty($snortcfg['rulesets'])) {
        return;
    } else {
        update_status(gettext("Your set of configured rules are being copied..."));
        log_error("Your set of configured rules are being copied...");
        $enabled_rulesets_array = explode("||", $snortcfg['rulesets']);
        foreach ($enabled_rulesets_array as $enabled_item) {
            @copy("{$snortdir}/rules/{$enabled_item}", "{$snortdir}/snort_{$snortcfg['uuid']}_{$if_real}/rules/{$enabled_item}");
            if (substr($enabled_item, 0, 5) == "snort" && substr($enabled_item, -9) == ".so.rules") {
                $slib = substr($enabled_item, 6, -6);
                if (file_exists("/usr/local/lib/snort/dynamicrules/{$slib}")) {
                    @copy("/usr/local/lib/snort/dynamicrules/{$slib}", "{$snortdir}/snort_{$snortcfg['uuid']}_{$if_real}/dynamicrules/{$slib}");
                }
            }
        }
        @copy("{$snortdir}/classification.config", "{$snortdir}/snort_{$snortcfg['uuid']}_{$if_real}/classification.config");
        @copy("{$snortdir}/gen-msg.map", "{$snortdir}/snort_{$snortcfg['uuid']}_{$if_real}/gen-msg.map");
        if (is_dir("{$snortdir}/generators")) {
            exec("/bin/cp -r {$snortdir}/generators {$snortdir}/snort_{$snortcfg['uuid']}_{$if_real}");
        }
        @copy("{$snortdir}/reference.config", "{$snortdir}/snort_{$snortcfg['uuid']}_{$if_real}/reference.config");
        @copy("{$snortdir}/sid", "{$snortdir}/snort_{$snortcfg['uuid']}_{$if_real}/sid");
        @copy("{$snortdir}/sid-msg.map", "{$snortdir}/snort_{$snortcfg['uuid']}_{$if_real}/sid-msg.map");
        @copy("{$snortdir}/unicode.map", "{$snortdir}/snort_{$snortcfg['uuid']}_{$if_real}/unicode.map");
    }
    if (!empty($snortcfg['rule_sid_on']) || !empty($snortcfg['rule_sid_off'])) {
        if (!empty($snortcfg['rule_sid_on'])) {
            $enabled_sid_on_array = explode("||", trim($snortcfg['rule_sid_on']));
            $enabled_sids = array_flip($enabled_sid_on_array);
        }
        if (!empty($snortcfg['rule_sid_off'])) {
            $enabled_sid_off_array = explode("||", trim($snortcfg['rule_sid_off']));
            $disabled_sids = array_flip($enabled_sid_off_array);
        }
        $files = glob("{$snortdir}/snort_{$snortcfg}_{$if_real}/rules/*.rules");
        foreach ($files as $file) {
            $splitcontents = file($file);
            $changed = false;
            foreach ($splitcontents as $counter => $value) {
                $sid = snort_get_rule_part($value, 'sid:', ';', 0);
                if (!is_numeric($sid)) {
                    continue;
                }
                if (isset($enabled_sids["enablesid {$sid}"])) {
                    if (substr($value, 0, 5) == "alert") {
                        /* Rule is already enabled */
                        continue;
                    }
                    if (substr($value, 0, 7) == "# alert") {
                        /* Rule is disabled, change */
                        $splitcontents[$counter] = substr($value, 2);
                        $changed = true;
                    } else {
                        if (substr($splitcontents[$counter - 1], 0, 5) == "alert") {
                            /* Rule is already enabled */
                            continue;
                        } else {
                            if (substr($splitcontents[$counter - 1], 0, 7) == "# alert") {
                                /* Rule is disabled, change */
                                $splitcontents[$counter - 1] = substr($value, 2);
                                $changed = true;
                            }
                        }
                    }
                } else {
                    if (isset($disabled_sids["disablesid {$sid}"])) {
                        if (substr($value, 0, 7) == "# alert") {
                            /* Rule is already disabled */
                            continue;
                        }
                        if (substr($value, 0, 5) == "alert") {
                            /* Rule is enabled, change */
                            $splitcontents[$counter] = "# {$value}";
                            $changed = true;
                        } else {
                            if (substr($splitcontents[$counter - 1], 0, 7) == "# alert") {
                                /* Rule is already disabled */
                                continue;
                            } else {
                                if (substr($splitcontents[$counter - 1], 0, 5) == "alert") {
                                    /* Rule is enabled, change */
                                    $splitcontents[$counter - 1] = "# {$value}";
                                    $changed = true;
                                }
                            }
                        }
                    }
                }
            }
            if ($changed == true) {
                @file_put_contents($file, implode("\n", $splitcontents));
            }
        }
    }
}
Example #8
0
$result = $db->query("SELECT qid, command FROM queue WHERE status = 0");
if ($result->num_rows == 0) {
	if ($debug) logger("No queue found!");	
} else {
	while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
		$qid = $row['qid'];
		$command = $row['command'];
		update_status(1, $qid);
		logger("Going to run $command");
		$output = shell_exec($command);
		if (is_null($output)) {
			logger("Failed to run $command");
		} else {
			logger("Finished command $command");
			update_status(2, $qid);
		}
	}
}

function update_status($status, $qid) {
	global $db;
	$result = $db->query("UPDATE queue SET status = '$status' WHERE qid = '$qid'");
	if ($result) {
		logger("Updated status to $status for queue $qid");
	} else {
		logger("Failed to update queue $qid");
	}
}

// Log to logfile
function batch_status($oID, $status, $comments, $notify = 0, $notify_comments = 0)
{
    global $db, $messageStack;
    require DIR_WS_LANGUAGES . 'english/super_orders.php';
    $order_updated = false;
    $check_status = $db->Execute("select customers_name, customers_email_address, orders_status,\r\n                                date_purchased from " . TABLE_ORDERS . "\r\n                                where orders_id = '" . (int) $oID . "'");
    if ($check_status->fields['orders_status'] != $status || zen_not_null($comments)) {
        $customer_notified = '0';
        if (isset($_POST['notify']) && $_POST['notify'] == 'on') {
            $customer_notified = '1';
        }
        update_status($oID, $status, $customer_notified, $comments);
        if ($customer_notified == '1') {
            email_latest_status($oID, $notify_comments);
        }
        $messageStack->add_session(SUCCESS_ORDER_UPDATED, 'success');
    } else {
        $messageStack->add_session(WARNING_ORDER_NOT_UPDATED, 'warning');
    }
}
Example #10
0
include_once 'includes/init.php';
require_valide_referring_url();
send_no_cache_header();
if (empty($user)) {
    $user = $login;
}
if (!empty($_POST)) {
    $process_action = getPostValue('process_action');
    $process_user = getPostValue('process_user');
    if (!empty($process_action)) {
        foreach ($_POST as $tid => $app_user) {
            if (substr($tid, 0, 5) == 'entry') {
                $type = substr($tid, 5, 1);
                $id = substr($tid, 6);
                if (empty($error) && $id > 0) {
                    update_status($process_action, $app_user, $id, $type);
                }
            }
        }
    }
}
// Only admin user or assistant can specify a username other than his own.
if (!$is_admin && $user != $login && !$is_assistant && !access_is_enabled()) {
    $user = $login;
}
// Make sure we return after editing an event via this page.
remember_this_view();
$key = 0;
$eventinfo = $noret = '';
/* List all unapproved events for the specified user.
 * Exclude "extension" events (used when an event goes past midnight).
<p>

<?php 
/* Define necessary variables. */
$firmware_version = trim(file_get_contents('/etc/version'));
$static_text = "Downloading current version information... ";
update_output_window($static_text);
$static_text .= "done.\n";
update_output_window($static_text);
if (isset($curcfg['alturl']['enable'])) {
    $updater_url = "{$config['system']['firmware']['alturl']['firmwareurl']}";
} else {
    $updater_url = $g['update_url'];
}
update_status("Downloading current version information...");
$latest_version = download_file_with_progress_bar("{$updater_url}/version", "/tmp/{$g['product_name']}_version");
if (strstr($latest_version, "404")) {
    update_output_window("Could not download version information file {$updater_url}/version");
    include "fend.inc";
    exit;
}
$current_installed_pfsense_version = str_replace("\n", "", file_get_contents("/etc/version"));
$latest_version = str_replace("\n", "", file_get_contents("/tmp/{$g['product_name']}_version"));
$needs_system_upgrade = false;
if ($current_installed_pfsense_version != $latest_version) {
    $needs_system_upgrade = true;
}
if (!$latest_version) {
    if (isset($curcfg['alturl']['enable'])) {
        update_output_window("Could not contact custom update server.");
            $OUTPUT = scan();
            break;
        case "enter":
            $OUTPUT = enter();
            break;
        case "write":
            $OUTPUT = write();
            break;
        case "select":
            $OUTPUT = select_view();
            break;
        case "view":
            $OUTPUT = view();
            break;
        case "status":
            $OUTPUT = update_status();
            break;
    }
} else {
    $OUTPUT = scan();
}
require "../template.php";
function scan()
{
    $invoice = array("invoice" => "Scan Invoice");
    $barcode = flashRed($invoice);
    $barcode = $barcode["invoice"];
    $sorder_num = decrypt_barcode($barcode);
    if (empty($sorder_num) || !is_numeric($sorder_num)) {
        $sorder_num = 0;
    }
';
        exit;
    }
}
$user = getValue('user');
$type = getValue('type');
$id = getValue('id');
// Allow administrators to approve public events.
$app_user = $PUBLIC_ACCESS == 'Y' && !empty($public) && $is_admin ? '__public__' : ($is_assistant || $is_nonuser_admin ? $user : $login);
// If User Access Control is enabled, we check to see if they are
// allowed to approve for the specified user.
if (access_is_enabled() && !empty($user) && $user != $login && access_user_calendar('approve', $user)) {
    $app_user = $user;
}
if (empty($error) && $id > 0) {
    update_status('A', $app_user, $id, $type);
}
if (!empty($comments) && empty($cancel)) {
    $mail = new WebCalMailer();
    // Email event creator to notify that it was approved with comments.
    // Get the name of the event.
    $res = dbi_execute('SELECT cal_name, cal_description, cal_date, cal_time,
    cal_create_by FROM webcal_entry WHERE cal_id = ?', array($id));
    if ($res) {
        $row = dbi_fetch_row($res);
        $name = $row[0];
        $description = $row[1];
        $fmtdate = $row[2];
        $time = sprintf("%06d", $row[3]);
        $creator = $row[4];
        dbi_free_result($res);
Example #14
0
function sync($id, $nopid = false)
{
    $unix = new unix();
    $users = new usersMenus();
    system_admin_events("Mail synchronization: Running task {$id}", __FUNCTION__, __FILE__, __LINE__);
    $GLOBALS["unique_id"] = $id;
    $ASOfflineImap = false;
    $sql = "SELECT * FROM imapsync WHERE ID='{$id}'";
    $q = new mysql();
    $took1 = time();
    $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
    if (!$q->ok) {
        system_admin_events("Mysql error {$q->mysql_error}", __FUNCTION__, __FILE__, __LINE__);
        die;
    }
    $pid = $ligne["pid"];
    if (!$nopid) {
        if ($unix->process_exists($pid)) {
            return;
        }
    }
    update_pid(getmypid());
    if (!is_file($unix->find_program("imapsync"))) {
        if (!is_file($unix->find_program("offlineimap"))) {
            update_status(-1, "Could not find imapsync/offlineimap program");
            return;
        }
    }
    update_status(1, "Executed");
    include_once dirname(__FILE__) . '/ressources/class.user.inc';
    $ct = new user($ligne["uid"]);
    $parameters = unserialize(base64_decode($ligne["parameters"]));
    $parameters["sep"] = trim($parameters["sep"]);
    $parameters["sep2"] = trim($parameters["sep2"]);
    $parameters["maxage"] = trim($parameters["maxage"]);
    if ($parameters["maxage"] == null) {
        $parameters["maxage"] = 0;
    }
    if ($parameters["UseOfflineImap"] == 1) {
        $ASOfflineImap = true;
    }
    $offlineImapConf[] = "[general]";
    $offlineImapConf[] = "metadata = /var/lib/offlineimap/{$ligne["uid"]}";
    if ($ASOfflineImap) {
        @mkdir("/var/lib/offlineimap/{$ligne["uid"]}", null, true);
    }
    $offlineImapConf[] = "accounts = Myaccount";
    $offlineImapConf[] = "maxsyncaccounts = 1";
    $offlineImapConf[] = "ui =Noninteractive.Basic, Noninteractive.Quiet";
    $offlineImapConf[] = "ignore-readonly = no";
    $offlineImapConf[] = "socktimeout = 60";
    $offlineImapConf[] = "fsync = true";
    $offlineImapConf[] = "";
    $offlineImapConf[] = "[ui.Curses.Blinkenlights]";
    $offlineImapConf[] = "statuschar = .";
    $offlineImapConf[] = "";
    $offlineImapConf[] = "[Account Myaccount]";
    $offlineImapConf[] = "localrepository = TargetServer";
    $offlineImapConf[] = "remoterepository = SourceServer";
    $offlineImapConf[] = "# autorefresh = 5";
    $offlineImapConf[] = "# quick = 10";
    $offlineImapConf[] = "# presynchook = imapfilter";
    $offlineImapConf[] = "# postsynchook = notifysync.sh";
    $offlineImapConf[] = "# presynchook = imapfilter -c someotherconfig.lua";
    $offlineImapConf[] = "# maxsize = 2000000";
    if ($parameters["maxage"] > 0) {
        $offlineImapConf[] = "maxage = {$parameters["maxage"]}";
    }
    $array_folders = unserialize(base64_decode($ligne["folders"]));
    if ($users->cyrus_imapd_installed) {
        $local_mailbox = true;
    }
    if ($users->ZARAFA_INSTALLED) {
        $local_mailbox = true;
    }
    if ($local_mailbox) {
        if ($parameters["local_mailbox"] == null) {
            $parameters["local_mailbox"] = 1;
        }
        if ($parameters["local_mailbox_source"] == null) {
            $parameters["local_mailbox_source"] = 1;
        }
    } else {
        $parameters["local_mailbox"] = 0;
        $parameters["local_mailbox_source"] = 0;
    }
    if ($parameters["dest_imap_server"] == null) {
        if ($parameters["local_mailbox"] == 1) {
            $parameters["dest_imap_server"] = "127.0.0.1";
        }
    }
    if (!$local_mailbox) {
        if ($parameters["remote_imap_server"] == null) {
            if ($GLOBALS["VERBOSE"]) {
                echo "unable to get SOURCE imap server\n";
            }
            update_status(-1, "unable to get SOURCE imap server");
            return;
        }
        if ($parameters["dest_imap_server"] == null) {
            if ($GLOBALS["VERBOSE"]) {
                echo "Cyrus: {$user->cyrus_imapd_installed}; Zarafa:{$user->ZARAFA_INSTALLED}\n";
            }
            if ($GLOBALS["VERBOSE"]) {
                echo "unable to get DESTINATION imap server Local server:{$local_mailbox}; Parms:local_mailbox={$parameters["local_mailbox"]}\n";
            }
            update_status(-1, "unable to get DESTINATION imap server");
            return;
        }
    }
    if ($parameters["local_mailbox_source"] == 0) {
        if ($parameters["remote_imap_server"] == null) {
            if ($GLOBALS["VERBOSE"]) {
                echo "unable to get SOURCE imap server\n";
            }
            update_status(-1, "unable to get SOURCE imap server");
            return;
        }
    }
    if ($parameters["local_mailbox"] == 0) {
        if ($parameters["dest_imap_server"] == null) {
            if ($GLOBALS["VERBOSE"]) {
                echo "unable to get DESTINATION imap server\n";
            }
            update_status(-1, "unable to get destination DESTINATION server");
            return;
        }
    }
    if ($parameters["local_mailbox"] == 1) {
        if ($parameters["local_mailbox_source"] == 1) {
            if ($GLOBALS["VERBOSE"]) {
                echo "DESTINATION imap mailbox cannot be the same has SOURCE imap mailbox\n";
            }
            update_status(-1, "DESTINATION imap mailbox cannot be the same has SOURCE imap mailbox");
            return;
        }
    }
    if ($parameters["local_mailbox"] == 1) {
        $host2 = "127.0.0.1";
        $user2 = $ct->uid;
        $password2 = $ct->password;
        $md52 = md5("{$host2}{$user2}{$password2}");
    } else {
        $host2 = $parameters["dest_imap_server"];
        $user2 = $parameters["dest_imap_username"];
        $password2 = $parameters["dest_imap_password"];
        $md52 = md5("{$host2}{$user2}{$password2}");
    }
    if ($parameters["local_mailbox_source"] == 1) {
        $host1 = "127.0.0.1";
        $user1 = $ct->uid;
        $password1 = $ct->password;
        $md51 = md5("{$host1}{$user1}{$password1}");
    } else {
        $host1 = $ligne["imap_server"];
        $user1 = $ligne["username"];
        $password1 = $ligne["password"];
        $md51 = md5("{$host1}{$user1}{$password1}");
    }
    if ($md51 == $md52) {
        if ($GLOBALS["VERBOSE"]) {
            echo "DESTINATION imap mailbox cannot be the same has SOURCE imap mailbox\n";
        }
        update_status(-1, "DESTINATION imap mailbox cannot be the same has SOURCE imap mailbox");
        return;
    }
    $offlineImapUseSSL1 = "no";
    $offlineImapUseSSL1port = "143";
    $offlineImapUseSSL2 = "no";
    $offlineImapUseSSL2port = "143";
    $expunge1 = "no";
    if ($parameters["use_ssl"] == 1) {
        $ssl1 = " --ssl1";
        $offlineImapUseSSL1 = "yes";
        $offlineImapUseSSL1port = "993";
    }
    if ($parameters["dest_use_ssl"] == 1) {
        $ssl2 = " --ssl2";
        $offlineImapUseSSL2 = "yes";
        $offlineImapUseSSL2port = "993";
    }
    if ($parameters["syncinternaldates"] == null) {
        $parameters["syncinternaldates"] = 1;
    }
    if ($parameters["noauthmd5"] == null) {
        $parameters["noauthmd5"] = 1;
    }
    if ($parameters["allowsizemismatch"] == null) {
        $parameters["allowsizemismatch"] = 1;
    }
    if ($parameters["nosyncacls"] == null) {
        $parameters["nosyncacls"] = 1;
    }
    if ($parameters["skipsize"] == null) {
        $parameters["skipsize"] = 0;
    }
    if ($parameters["nofoldersizes"] == null) {
        $parameters["nofoldersizes"] = 1;
    }
    if ($parameters["useSep1"] == null) {
        $parameters["useSep1"] = 0;
    }
    if ($parameters["useSep2"] == null) {
        $parameters["useSep2"] = 0;
    }
    if ($parameters["usePrefix1"] == null) {
        $parameters["usePrefix1"] = 0;
    }
    if ($parameters["usePrefix2"] == null) {
        $parameters["usePrefix2"] = 0;
    }
    if ($parameters["delete_messages"] == 1) {
        $delete = " --delete --expunge1";
        $expunge1 = "yes";
    }
    if ($parameters["syncinternaldates"] == 1) {
        $syncinternaldates = " --syncinternaldate";
    }
    if ($parameters["noauthmd5"] == 1) {
        $noauthmd5 = " --noauthmd5";
    }
    if ($parameters["allowsizemismatch"] == 1) {
        $allowsizemismatch = " --allowsizemismatch";
    }
    if ($parameters["nosyncacls"] == 1) {
        $nosyncacls = " --nosyncacls";
    }
    if ($parameters["skipsize"] == 1) {
        $skipsize = " --skipsize";
    }
    if ($parameters["nofoldersizes"] == 1) {
        $nofoldersizes = " --nofoldersizes";
    }
    if ($parameters["useSep1"] == 1) {
        $sep = " --sep1 \"{$parameters["sep"]}\"";
    }
    if ($parameters["useSep2"] == 1) {
        $sep2 = " --sep2 \"{$parameters["sep2"]}\"";
    }
    if ($parameters["usePrefix1"] == 1) {
        $prefix1 = " --prefix1 \"{$parameters["prefix1"]}\"";
    }
    if ($parameters["usePrefix2"] == 1) {
        $prefix2 = " --prefix2 \"{$parameters["prefix2"]}\"";
    }
    if ($parameters["maxage"] > 0) {
        $maxage = " --maxage {$parameters["maxage"]}";
    }
    if (count($array_folders["FOLDERS"]) > 0) {
        while (list($num, $folder) = each($array_folders["FOLDERS"])) {
            if (trim($folder) == null) {
                continue;
            }
            $cleaned[trim($folder)] = trim($folder);
        }
        while (list($num, $folder) = each($cleaned)) {
            $foldersr[] = $folder;
            $offlineImapFolders[] = "'{$folder}'";
        }
        $folders_replicate = @implode(" --folder ", $foldersr);
    }
    $offlineImapConf[] = "";
    $offlineImapConf[] = "[Repository SourceServer]";
    $offlineImapConf[] = "type = IMAP";
    $offlineImapConf[] = "remotehost = {$host1}";
    $offlineImapConf[] = "ssl = {$offlineImapUseSSL1}";
    $offlineImapConf[] = "remoteport = {$offlineImapUseSSL1port}";
    $offlineImapConf[] = "remoteuser = {$user1}";
    $offlineImapConf[] = "remotepass = {$password1}";
    $offlineImapConf[] = "# reference = Mail";
    $offlineImapConf[] = "maxconnections = 1";
    $offlineImapConf[] = "holdconnectionopen = no";
    $offlineImapConf[] = "# keepalive = 60";
    $offlineImapConf[] = "expunge = {$expunge1}";
    $offlineImapConf[] = "subscribedonly = no";
    if ($parameters["useSep1"] == 1) {
        $offlineImapConf[] = "sep = {$parameters["sep"]}";
    }
    $offlineImapConf[] = "nametrans = lambda foldername: re.sub('^INBOX\\.*', '.', foldername)";
    if (count($offlineImapFolders) > 0) {
        $offlineImapConf[] = "folderincludes = [" . @implode(",", $offlineImapFolders) . "]";
    }
    $offlineImapConf[] = "";
    $offlineImapConf[] = "[Repository TargetServer]";
    $offlineImapConf[] = "type = IMAP";
    $offlineImapConf[] = "remotehost = {$host2}";
    $offlineImapConf[] = "ssl = {$offlineImapUseSSL2}";
    $offlineImapConf[] = "remoteport = {$offlineImapUseSSL2port}";
    $offlineImapConf[] = "remoteuser = {$user2}";
    $offlineImapConf[] = "remotepass = {$password2}";
    $offlineImapConf[] = "# reference = Mail";
    $offlineImapConf[] = "maxconnections = 1";
    $offlineImapConf[] = "holdconnectionopen = no";
    $offlineImapConf[] = "# keepalive = 60";
    $offlineImapConf[] = "expunge = no";
    $offlineImapConf[] = "subscribedonly = no";
    if ($parameters["useSep2"] == 1) {
        $offlineImapConf[] = "sep = {$parameters["sep2"]}";
    }
    $offlineImapConf[] = "nametrans = lambda foldername: re.sub('^INBOX\\.*', '.', foldername)";
    if (count($offlineImapFolders) > 0) {
        $offlineImapConf[] = "folderincludes = [" . @implode(",", $offlineImapFolders) . "]";
    }
    $file_temp = "/usr/share/artica-postfix/ressources/logs/imapsync.{$id}.logs";
    $imapsyncbin = $unix->find_program("imapsync");
    $offlineimap = $unix->find_program("offlineimap");
    $cmd = "{$imapsyncbin} --buffersize 8192000{$nosyncacls} --subscribe{$syncinternaldates}";
    $cmd = $cmd . " --host1 {$host1} --user1 \"{$user1}\" --password1 \"{$password1}\"{$ssl1}{$prefix1}{$sep} --host2 {$host2} --user2 \"{$user2}\"";
    $cmd = $cmd . " --password2 \"{$password2}\"{$ssl2}{$prefix2}{$sep2}{$folders_replicate}{$delete}{$noauthmd5}{$allowsizemismatch}{$skipsize}{$nofoldersizes}{$maxage} >{$file_temp} 2>&1";
    if ($ASOfflineImap) {
        if (is_file($file_temp)) {
            @unlink($file_temp);
        }
        if (!is_file($offlineimap)) {
            update_status(-1, "Could not find offlineimap program");
            return;
        }
        $cmd = "{$offlineimap} -o -u Noninteractive.Basic -c /tmp/offlineimap-{$ligne["uid"]} -l {$file_temp}";
        @file_put_contents("/tmp/offlineimap-{$ligne["uid"]}", @implode("\n", $offlineImapConf));
        if ($GLOBALS["VERBOSE"]) {
            $cmd_show = $cmd . "\n";
            $datas = @implode("\n", $offlineImapConf);
            $datas = str_replace("remotepass = {$password2}", "remotepass = MASKED", $datas);
            $datas = str_replace("remotepass = {$password1}", "remotepass = MASKED", $datas);
            echo "{$cmd_show}\nConfiguration file:\n---------------------------\n\n{$datas}";
            return;
        }
    } else {
        if (!is_file($imapsyncbin)) {
            update_status(-1, "Could not find imapsunc program");
            return;
        }
    }
    if ($GLOBALS["VERBOSE"]) {
        $cmd_show = $cmd;
        $cmd_show = str_replace("--password1 {$password1}", "--password1 MASKED", $cmd_show);
        $cmd_show = str_replace("--password2 {$password2}", "--password2 MASKED", $cmd_show);
        echo "{$cmd_show}\n";
        return;
    }
    shell_exec($cmd);
    update_status(0, addslashes(@file_get_contents($file_temp)));
    $took = $unix->distanceOfTimeInWords($took1, time(), true);
    system_admin_events("Task id {$id} done took {$took}", __FUNCTION__, __FILE__, __LINE__);
}
Example #15
0
$user_custom = $_POST['custom'];
if (strcmp($res, "VERIFIED") == 0) {
    // check the payment_status is Completed
    // check that txn_id has not been previously processed
    // check that receiver_email is your Primary PayPal email
    // check that payment_amount/payment_currency are correct
    // process payment
    if ($payment_status == 'Completed') {
        $query = "SELECT 'txn_id' FROM membership_ipn WHERE txn_id ='" . $txn_id . "'";
        $result = mysql_query($query);
        if (mysql_num_rows($result) == 0) {
            if ($receiver_email == '*****@*****.**') {
                if ($payment_amount == '15.75' || ($payment_amount = '26.50' && $payment_currency == 'USD')) {
                    $type = type_of_member($payment_amount);
                    $expired_date = get_expired_date($type);
                    update_status($txn_id, $expired_date, $user_custom, $type);
                    //add information into database
                    //email also
                    //update premium
                } else {
                    //payment balance is not right!
                }
            } else {
                //receover_email is not right
            }
        } else {
        }
        //check for txn_id
    }
    //check for payment status
} else {
Example #16
0
}
// Only admin users can modify events on the public calendar.
if (empty($error) && $PUBLIC_ACCESS == 'Y' && $user == '__public__' && !$is_admin) {
    // translate ( 'not admin' )
    $error = translate('Not authorized (not admin).');
}
if (empty($error) && !$is_admin && $user != $login) {
    // Non-admin user has request to modify event on someone else's calendar.
    if (access_is_enabled()) {
        if (!access_user_calendar('approve', $user)) {
            $error = translate('Not authorized');
        }
    } else {
        // TODO: Support boss/assistant when UAC is not enabled.
        $error = translate('Not authorized');
    }
}
if (strpos(' approvedeletereject', $action)) {
    update_status(ucfirst($action), $user, $id);
}
$out .= (empty($error) ? '
  <success/>' : '
  <error>' . ws_escape_xml($error) . '</error>') . '
</result>
';
// If web service debugging is on...
if (!empty($WS_DEBUG) && $WS_DEBUG) {
    ws_log_message($out);
}
// Send output now...
echo $out;
function import_users($id)
{
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $pid = trim(@file_get_contents($pidfile));
    if ($unix->process_exists($pid)) {
        echo "[" . getmypid() . "]:: Process {$pid} already running...\n";
        die;
    }
    $pid = getmypid();
    @file_put_contents($pidfile, $pid);
    $emailing = new emailings($id);
    if ($emailing->error) {
        echo __FUNCTION__ . " class error: {$emailing->mysql_error}\n";
        exit;
    }
    $sql = "SELECT * FROM {$emailing->tablename}";
    $q = new mysql();
    $results = $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        echo __FUNCTION__ . " {$q->mysql_error}\n";
        exit;
    }
    $max = mysql_num_rows($results);
    $ldap = new clladp();
    $domains = $ldap->Hash_domains_table($ou);
    while (list($domain, $no) = each($domains)) {
        $DOMAINS_ARRAY[$domain] = true;
    }
    if ($emailing->array_options["export_domain"] == null) {
        update_export_status($id, 110, "No default domain set");
        return;
    }
    if ($emailing->array_options["gpid"] == null) {
        update_export_status($id, 110, "No default group set");
        return;
    }
    $gpid = $emailing->array_options["gpid"];
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $count = $count + 1;
        $tw = $tw + 1;
        $firstname = $ligne["firstname"];
        $lastname = $ligne["lastname"];
        $email = $ligne["email"];
        $phone = $ligne["phone"];
        $city = $ligne["city"];
        $cp = $ligne["cp"];
        $postaladdress = $ligne["postaladdress"];
        if (!preg_match("#(.+?)@#", $email, $re)) {
            continue;
        }
        $uid = $re[1];
        $new_email = "{$uid}@{$emailing->array_options["export_domain"]}";
        $ct = new user($uid);
        if (!$ct->DoesNotExists) {
            $GLOBALS["SUCCESS_CONTACTS"] = $GLOBALS["SUCCESS_CONTACTS"] + 1;
            echo "{$emailing->ou}/{$uid}::{$new_email} {$firstname} {$lastname} already exists [SUCCESS]\n";
        }
        $ct->mail = $new_email;
        $ct->postalCode = $cp;
        $ct->postalAddress = $postaladdress;
        $ct->town = $city;
        $ct->telephoneNumber = $phone;
        $ct->DisplayName = "{$firstname} {$lastname}";
        $ct->sn = $lastname;
        $ct->givenName = $firstname;
        $ct->group_id = $gpid;
        $ct->ou = $emailing->ou;
        $ct->password = $emailing->array_options["export_default_password"];
        if ($tw > 2) {
            $purc = $count / $max;
            $purc = $purc * 100;
            $purc = round($purc, 0);
            update_export_status($id, $purc);
            $tw = 0;
        }
        if (!$ct->add_user()) {
            writeevent("{$emailing->ou}/{$uid}::{$new_email} {$firstname} {$lastname} [FAILED]");
            $GLOBALS["FAILED_CONTACTS"] = $GLOBALS["FAILED_CONTACTS"] + 1;
            continue;
        }
        $GLOBALS["SUCCESS_CONTACTS"] = $GLOBALS["SUCCESS_CONTACTS"] + 1;
        writeevent("{$emailing->ou}/{$uid}::{$new_email} {$firstname} {$lastname} [SUCCESS]");
        if ($new_email != $email) {
            $user = new user($uid);
            $user->add_alias($email);
        }
    }
    writeevent("Failed.:{$GLOBALS["FAILED_CONTACTS"]}", $id);
    writeevent("Success:{$GLOBALS["SUCCESS_CONTACTS"]}", $id);
    update_status($id, 100, 1, null);
}
Example #18
0
<?php

require_once "include.php";
if (empty($VAR['wo_id'])) {
    force_page('core', 'error&error_msg=No Work Order ID');
    exit;
}
if (isset($VAR['submit'])) {
    if (!update_status($db, $VAR)) {
        force_page('core', 'error&error_msg=Falied to update work order status');
        exit;
    } else {
        force_page('workorder', 'view&wo_id=' . $VAR['wo_id'] . '&page_title=Work%20Order%20ID%20' . $VAR['wo_id']);
        exit;
    }
} else {
    $smarty->assign('wo_id', $VAR['wo_id']);
    $smarty->display('workorder' . SEP . 'new_status.tpl');
}
Example #19
0
             filter_configure();
             send_event("service restart packages");
         } else {
             update_output_window(gettext("No packages are installed."));
         }
         break;
     case 'installed':
     default:
         $status = install_package($pkgid);
         if ($status != 0) {
             update_status(gettext("Installation of") . " {$pkgid} " . gettext("FAILED!"));
             $static_output .= "\n" . gettext("Installation halted.");
             update_output_window($static_output);
         } else {
             $status_a = gettext(sprintf("Installation of %s completed.", $pkgid));
             update_status($status_a);
             $status = get_after_install_info($pkgid);
             if ($status) {
                 $static_output .= "\n" . gettext("Installation completed.") . "\n{$pkgid} " . gettext("setup instructions") . ":\n{$status}";
             } else {
                 $static_output .= "\n" . gettext("Installation completed.   Please check to make sure that the package is configured from the respective menu then start the package.");
             }
             @file_put_contents("/tmp/{$pkgid}.info", $static_output);
             echo "<script type='text/javascript'>document.location=\"pkg_mgr_install.php?mode=installedinfo&pkg={$pkgid}\";</script>";
         }
         filter_configure();
         break;
 }
 // Delete all temporary package tarballs and staging areas.
 unlink_if_exists("/tmp/apkg_*");
 rmdir_recursive("/var/tmp/instmp*");
Example #20
0
            break;
        case 'projects':
            if ($func == 'update_projects') {
                update_projects($_POST['Sel']);
            }
            edit_projects();
            break;
        case 'priorities':
            if ($func == 'update_priorities') {
                update_priorities($_POST['Sel']);
            }
            edit_priorities();
            break;
        case 'status':
            if ($func == 'update_status') {
                update_status($_POST['Sel']);
            }
            edit_status();
            break;
        case 'edit_globals':
            if ($func == 'mod_globals') {
                mod_globals($_POST['mod_varname'], $_POST['mod_definition'], $_POST['mod_action']);
            }
            edit_globals();
            break;
    }
}
$tabtable->print_foot();
function edit_agents()
{
    global $admin_tabtable, $prefix, $hlpdsk_prefix, $name, $hlpdsk_theme, $nuke_user_id_fieldname, $nuke_username_fieldname, $action, $button_submit, $button_left, $button_right, $GO_THEME, $GO_LANGUAGE, $strUser, $strGroups;
function oinkmaster_run($id, $if_real, $iface_uuid)
{
    global $config, $g, $snortdir_wan, $snortdir, $snort_md5_check_ok, $emerg_md5_check_ok, $pfsense_md5_check_ok;
    if ($snort_md5_check_ok != 'on' || $emerg_md5_check_ok != 'on' || $pfsense_md5_check_ok != 'on') {
        if (empty($config['installedpackages']['snortglobal']['rule'][$id]['rule_sid_on']) && empty($config['installedpackages']['snortglobal']['rule'][$id]['rule_sid_off'])) {
            update_status(gettext("Your first set of rules are being copied..."));
            update_output_window(gettext("May take a while..."));
            exec("/bin/cp {$snortdir}/rules/* {$snortdir_wan}/snort_{$iface_uuid}_{$if_real}/rules/");
            exec("/bin/cp {$snortdir}/classification.config {$snortdir_wan}/snort_{$iface_uuid}_{$if_real}");
            exec("/bin/cp {$snortdir}/gen-msg.map {$snortdir_wan}/snort_{$iface_uuid}_{$if_real}");
            exec("/bin/cp {$snortdir}/generators {$snortdir_wan}/snort_{$iface_uuid}_{$if_real}");
            exec("/bin/cp {$snortdir}/reference.config {$snortdir_wan}/snort_{$iface_uuid}_{$if_real}");
            exec("/bin/cp {$snortdir}/sid {$snortdir_wan}/snort_{$iface_uuid}_{$if_real}");
            exec("/bin/cp {$snortdir}/sid-msg.map {$snortdir_wan}/snort_{$iface_uuid}_{$if_real}");
            exec("/bin/cp {$snortdir}/unicode.map {$snortdir_wan}/snort_{$iface_uuid}_{$if_real}");
        } else {
            update_status(gettext("Your enable and disable changes are being applied to your fresh set of rules..."));
            update_output_window(gettext("May take a while..."));
            exec("/bin/cp {$snortdir}/rules/* {$snortdir_wan}/snort_{$iface_uuid}_{$if_real}/rules/");
            exec("/bin/cp {$snortdir}/classification.config {$snortdir_wan}/snort_{$iface_uuid}_{$if_real}");
            exec("/bin/cp {$snortdir}/gen-msg.map {$snortdir_wan}/snort_{$iface_uuid}_{$if_real}");
            exec("/bin/cp {$snortdir}/generators {$snortdir_wan}/snort_{$iface_uuid}_{$if_real}");
            exec("/bin/cp {$snortdir}/reference.config {$snortdir_wan}/snort_{$iface_uuid}_{$if_real}");
            exec("/bin/cp {$snortdir}/sid {$snortdir_wan}/snort_{$iface_uuid}_{$if_real}");
            exec("/bin/cp {$snortdir}/sid-msg.map {$snortdir_wan}/snort_{$iface_uuid}_{$if_real}");
            exec("/bin/cp {$snortdir}/unicode.map {$snortdir_wan}/snort_{$iface_uuid}_{$if_real}");
            /*  might have to add a sleep for 3sec for flash drives or old drives */
            exec("/usr/local/bin/perl /usr/local/bin/oinkmaster.pl -C /usr/local/etc/snort/snort_{$iface_uuid}_{$if_real}/oinkmaster_{$iface_uuid}_{$if_real}.conf -o /usr/local/etc/snort/snort_{$iface_uuid}_{$if_real}/rules > /usr/local/etc/snort/oinkmaster_{$iface_uuid}_{$if_real}.log");
        }
    }
}
Example #22
0
		    } 
			); 
	
</script>

<?php 
$action = $_GET['action'];
$orderid = $_GET['orderid'];
if ($action == 'Edit') {
    global $wpdb;
    $query = 'SELECT * FROM wp_order WHERE ID = ' . $orderid;
    $member = $wpdb->get_row($query, ARRAY_A);
    if (!empty($_POST) && wp_verify_nonce($_POST['act_update_member'], 'update_member')) {
        $status = $_POST['order_status'];
        global $wpdb;
        update_status($status, $orderid);
        $link = admin_url() . 'admin.php?page=hoa-don';
        echo "<script>setTimeout(function(){window.location.href = '" . $link . "';},10);</script>";
    }
    ?>
	<h2 style="text-transform: uppercase;">Cập nhật trạng thái đơn hàng</h2>
	<form action="" method="post">
		<h3>Số HĐ: <b><?php 
    echo $orderid;
    ?>
</b></h3>
		<p>
			Trạng thái:
			<select name="order_status">
		        <option value="0" <?php 
    if ($member['status'] == 0) {
Example #23
0
 function view_notification($notification_id)
 {
     $query = $this->Query_reader->get_query_by_code('notification_detail', array('id' => $notification_id));
     $result = $this->db->query($query)->result_array();
     $userid = $this->session->userdata('userid');
     update_status($userid, $result[0]['id'], 'R');
     return $result;
 }
         case 'purchase_order':
             $new_index = $so->add_purchase_order($_GET['po_number']);
             if ($update_status) {
                 update_status($oID, AUTO_STATUS_PO, $notify_customer, sprintf(AUTO_COMMENTS_PO, $_GET['po_number']));
             }
             // notify the customer
             if ($notify_customer) {
                 $_POST['notify_comments'] = 'on';
                 email_latest_status($oID);
             }
             zen_redirect(zen_href_link(FILENAME_SUPER_PAYMENTS, 'oID=' . $so->oID . '&payment_mode=' . $payment_mode . '&index=' . $new_index . '&action=confirm', 'NONSSL'));
             break;
         case 'refund':
             $new_index = $so->add_refund($_GET['payment_id'], $_GET['refund_number'], $_GET['refund_name'], $_GET['refund_amount'], $_GET['refund_type']);
             if ($update_status) {
                 update_status($oID, AUTO_STATUS_REFUND, $notify_customer, sprintf(AUTO_COMMENTS_REFUND, $_GET['refund_number']));
             }
             // notify the customer
             if ($notify_customer) {
                 $_POST['notify_comments'] = 'on';
                 email_latest_status($oID);
             }
             zen_redirect(zen_href_link(FILENAME_SUPER_PAYMENTS, 'oID=' . $so->oID . '&payment_mode=' . $payment_mode . '&index=' . $new_index . '&action=confirm', 'NONSSL'));
             break;
     }
     // END switch ($payment_mode)
     break;
     // END case 'add'
     // update an existing payment entry
 // END case 'add'
 // update an existing payment entry
    }
    log_error(gettext("[Suricata] Finished rebuilding installation from saved settings..."));
    // Only try to start Suricata if not in reboot
    if (!$g['booting']) {
        if ($pkg_interface != "console") {
            update_status(gettext("Starting Suricata using rebuilt configuration..."));
            $static_output .= gettext("Starting Suricata using the rebuilt configuration...");
            update_output_window($static_output);
            mwexec_bg("{$rcdir}suricata.sh start");
            $static_output .= gettext(" done.\n");
            update_output_window($static_output);
        } else {
            mwexec_bg("{$rcdir}suricata.sh start");
        }
    }
}
// If this is first install and "forcekeepsettings" is empty,
// then default it to 'on'.
if (empty($config['installedpackages']['suricata']['config'][0]['forcekeepsettings'])) {
    $config['installedpackages']['suricata']['config'][0]['forcekeepsettings'] = 'on';
}
// Finished with file system mods, so remount it read-only
conf_mount_ro();
// Update Suricata package version in configuration
$config['installedpackages']['suricata']['config'][0]['suricata_config_ver'] = $config['installedpackages']['package'][get_pkg_id("suricata")]['version'];
write_config("Suricata pkg v{$config['installedpackages']['package'][get_pkg_id("suricata")]['version']}: post-install configuration saved.");
// Done with post-install, so clear flag
unset($g['suricata_postinstall']);
log_error(gettext("[Suricata] Package post-installation tasks completed..."));
update_status("");
return true;
    snort_snortloglimit_install_cron(true);
    snort_rm_blocked_install_cron($config['installedpackages']['snortglobal']['rm_blocked'] != "never_b" ? true : false);
    snort_rules_up_install_cron($config['installedpackages']['snortglobal']['autorulesupdate7'] != "never_up" ? true : false);
    /* Restore the last Snort Dashboard Widget setting if none is set */
    if (!empty($config['installedpackages']['snortglobal']['dashboard_widget']) && stristr($config['widgets']['sequence'], "snort_alerts-container") === FALSE) {
        $config['widgets']['sequence'] .= "," . $config['installedpackages']['snortglobal']['dashboard_widget'];
    }
    $rebuild_rules = false;
    if ($pkg_interface != "console") {
        update_output_window(gettext("Finished rebuilding Snort configuration files..."));
    }
    log_error(gettext("[Snort] Finished rebuilding installation from saved settings..."));
    /* Only try to start Snort if not in reboot */
    if (!$g['booting']) {
        if ($pkg_interface != "console") {
            update_status(gettext("Starting Snort using rebuilt configuration..."));
            mwexec_bg("{$rcdir}snort.sh start");
            update_output_window(gettext("Snort is starting as a background task using the rebuilt configuration..."));
        } else {
            mwexec_bg("{$rcdir}snort.sh start");
        }
    }
}
/* We're finished with conf partition mods, return to read-only */
conf_mount_ro();
/* If an existing Snort Dashboard Widget container is not found, */
/* then insert our default Widget Dashboard container.           */
if (stristr($config['widgets']['sequence'], "snort_alerts-container") === FALSE) {
    $config['widgets']['sequence'] .= ",{$snort_widget_container}";
}
/* Update Snort package version in configuration */
        update_output_window("\n" . gettext("Upgrade Image does not contain a signature but the system has been configured to allow unsigned images. One moment please...") . "\n");
    }
}
if (!verify_gzip_file("{$g['upload_path']}/latest.tgz")) {
    update_status(gettext("The image file is corrupt."));
    update_output_window(gettext("Update cannot continue"));
    if (file_exists("{$g['upload_path']}/latest.tgz")) {
        conf_mount_rw();
        unlink("{$g['upload_path']}/latest.tgz");
        conf_mount_ro();
    }
    require "fend.inc";
    exit;
}
if ($downloaded_latest_tgz_sha256 != $upgrade_latest_tgz_sha256) {
    update_status(gettext("Downloading complete but sha256 does not match."));
    update_output_window(gettext("Auto upgrade aborted.") . "  \n\n" . gettext("Downloaded SHA256") . ": " . $downloaded_latest_tgz_sha256 . "\n\n" . gettext("Needed SHA256") . ": " . $upgrade_latest_tgz_sha256);
} else {
    update_output_window($g['product_name'] . " " . gettext("is now upgrading.") . "\\n\\n" . gettext("The firewall will reboot once the operation is completed."));
    echo "\n<script type=\"text/javascript\">";
    echo "\n//<![CDATA[";
    echo "\ndocument.progressbar.style.visibility='hidden';";
    echo "\n//]]>";
    echo "\n</script>";
    mwexec_bg($external_upgrade_helper_text);
}
/*
	Helper functions
*/
function read_body_firmware($ch, $string)
{
Example #28
0
    switch ($_GET['mode']) {
        case 'showlog':
            if (strpos($pkgname, ".")) {
                update_output_window(gettext("Something is wrong on the request."));
            } else {
                if (file_exists("/tmp/pkg_mgr_{$pkgname}.log")) {
                    update_output_window(@file_get_contents("/tmp/pkg_mgr_{$pkgname}.log"));
                } else {
                    update_output_window(gettext("Log was not retrievable."));
                }
            }
            break;
        case 'installedinfo':
            if (file_exists("/tmp/{$pkgname}.info")) {
                $status = @file_get_contents("/tmp/{$pkgname}.info");
                update_status("{$pkgname} " . gettext("installation completed."));
                update_output_window($status);
            } else {
                update_output_window(sprintf(gettext("Could not find %s."), $pkgname));
            }
            break;
        default:
            break;
    }
} else {
    if ($_POST) {
        $pkgid = str_replace(array("<", ">", ";", "&", "'", '"', '.', '/'), "", htmlspecialchars_decode($_POST['id'], ENT_QUOTES | ENT_HTML401));
        /* All other cases make changes, so mount rw fs */
        conf_mount_rw();
        /* Write out configuration to create a backup prior to pkg install. */
        write_config(gettext("Creating restore point before package installation."));
Example #29
0
 function reopen()
 {
     global $db;
     $db->Execute("update " . TABLE_ORDERS . " set\n                  date_completed = NULL, date_cancelled = NULL\n                  where orders_id = '" . $this->oID . "' limit 1");
     if (STATUS_ORDER_REOPEN != 0) {
         update_status($this->oID, STATUS_ORDER_REOPEN);
     }
     $this->status = false;
     $this->status_date = false;
 }
Example #30
0
 <i class="fa fa-bell"></i></a>
					</li>
					<li>
						<a href="#panel-250888" data-toggle="tab"></a>
					</li>
				</ul>
				<div class="tab-content">
					<div class="tab-pane active" id="panel-757130">
					     <?php 
switch ($switch) {
    case 'single_notification':
        # print_r($rslt[0]['id']); exit();
        $userid = $this->session->userdata('userid');
        $notification = $rslt[0]['id'];
        $status = "R";
        update_status($userid, $notification, $status);
        ?>
<div class="accordion in collapse" >
         <div class="accordion-group">
						<div class="accordion-heading">
							 <a class="accordion-toggle" href="#procurement_record" data-toggle="collapse" data-parent="#accordion-562508"><?php 
        echo $rslt[0]['title'];
        ?>
 </a>
						</div>
						<div id="procurement_record" class="accordion-body   in">
							<div class="accordion-inner">
								 
								 <div class="row-fluid">
									<?php 
        echo $rslt[0]['body'];