本文整理汇总了PHP中update_status函数的典型用法代码示例。如果您正苦于以下问题:PHP update_status函数的具体用法?PHP update_status怎么用?PHP update_status使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了update_status函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: error
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();
}
示例2: roster_resource_set
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);
}
示例3: update_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;
示例4: zen_db_scrub_in
}
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;
示例5: suricata_fetch_new_rules
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;
}
}
示例6: delete_package
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);
}
示例7: snort_apply_customizations
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));
}
}
}
}
示例8: shell_exec
$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
示例9: batch_status
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');
}
}
示例10: require_valide_referring_url
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).
示例11: trim
<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.");
示例12: scan
$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;
}
示例13: getValue
';
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);
示例14: sync
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) {
//.........这里部分代码省略.........
示例15: mysql_query
$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 == 'hfglcolin@hotmail.com') {
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 {