Ejemplo n.º 1
0
function file_unlink($path)
{
    global $config, $debug;
    if ($config['debug']) {
        if (!isset($debug['unlink'])) {
            $debug['unlink'] = array();
        }
        $debug['unlink'][] = $path;
    }
    $ret = @unlink($path);
    if ($config['gzip_static']) {
        $gzpath = "{$path}.gz";
        @unlink($gzpath);
    }
    if (isset($config['purge']) && $path[0] != '/' && isset($_SERVER['HTTP_HOST'])) {
        // Purge cache
        if (basename($path) == $config['file_index']) {
            // Index file (/index.html); purge "/" as well
            $uri = dirname($path);
            // root
            if ($uri == '.') {
                $uri = '';
            } else {
                $uri .= '/';
            }
            purge($uri);
        }
        purge($path);
    }
    event('unlink', $path);
    return $ret;
}
Ejemplo n.º 2
0
}
include_once dirname(__FILE__) . '/framework/class.unix.inc';
include_once dirname(__FILE__) . '/framework/frame.class.inc';
include_once dirname(__FILE__) . "/ressources/class.postgres.inc";
include_once dirname(__FILE__) . '/ressources/class.users.menus.inc';
include_once dirname(__FILE__) . '/ressources/class.mysql.inc';
include_once dirname(__FILE__) . '/ressources/class.os.system.inc';
$GLOBALS["DEBUG"] = false;
$GLOBALS["FORCE"] = false;
$GLOBALS["VERBOSE"] = false;
if ($argv[1] == "--migrate") {
    migrate();
    exit;
}
if ($argv[1] == "--purge") {
    purge();
    exit;
}
function migrate()
{
    $q = new mysql();
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $pidtime = "/etc/artica-postfix/pids/exec.suricata.hourly.migrate.time";
    $pid = $unix->get_pid_from_file($pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        $time = $unix->PROCCESS_TIME_MIN($pid);
        echo "Starting......: " . date("H:i:s") . " [INIT]: Already Artica task running PID {$pid} since {$time}mn\n";
        return;
    }
    @file_put_contents($pidfile, getmypid());
Ejemplo n.º 3
0
function processPlugin()
{
    global $roster, $installer;
    $addon_name = $_POST['addon'];
    $addon_parent = $_POST['addonparent'];
    $addon_file = $_POST['addonfile'];
    if (preg_match('/[^a-zA-Z0-9_]/', $addon_name)) {
        $installer->seterrors($roster->locale->act['invalid_char_module'], $roster->locale->act['installer_error']);
        return;
    }
    if (false === $roster->db->query("CREATE TEMPORARY TABLE `test` (id int);")) {
        $installer->temp_tables = false;
        $roster->db->query("UPDATE `" . $roster->db->table('config') . "` SET `config_value` = '0' WHERE `id` = 1180;");
    } else {
        $installer->temp_tables = true;
    }
    $addonDir = ROSTER_PLUGINS . $addon_name . DIR_SEP;
    $addon_install_file = $addonDir . 'install.def.php';
    $install_class = $addon_name . 'Install';
    if (!file_exists($addon_install_file)) {
        $installer->seterrors(sprintf($roster->locale->act['installer_no_installdef'], $addon_name), $roster->locale->act['installer_error']);
        return;
    }
    require $addon_install_file;
    $addon = new $install_class();
    $addata = escape_array((array) $addon);
    $addata['basename'] = $addon_name;
    if ($addata['basename'] == '') {
        $installer->seterrors($roster->locale->act['installer_no_empty'], $roster->locale->act['installer_error']);
        return;
    }
    // Get existing addon record if available
    $query = 'SELECT * FROM `' . $roster->db->table('plugin') . '` WHERE `basename` = "' . $addata['basename'] . '";';
    $result = $roster->db->query($query);
    if (!$result) {
        $installer->seterrors(sprintf($roster->locale->act['installer_fetch_failed'], $addata['basename']) . '.<br />MySQL said: ' . $roster->db->error(), $roster->locale->act['installer_error']);
        return;
    }
    $previous = $roster->db->fetch($result);
    $roster->db->free_result($result);
    // Give the installer the addon data
    $installer->addata = $addata;
    $success = false;
    // Collect data for this install type
    switch ($_POST['type']) {
        case 'install':
            if ($previous) {
                $installer->seterrors(sprintf($roster->locale->act['installer_addon_exist'], $installer->addata['basename'], $previous['fullname']));
                break;
            }
            // check to see if any requred addons if so and not enabled disable addon after install and give a message
            if (isset($installer->addata['requires'])) {
                if (!active_addon($installer->addata['requires'])) {
                    $installer->addata['active'] = false;
                    $installer->setmessages('Addon Dependency "' . $installer->addata['requires'] . '" not active or installed, "' . $installer->addata['fullname'] . '" has been disabled');
                    break;
                }
            }
            $query = 'INSERT INTO `' . $roster->db->table('plugin') . '` VALUES 
				(NULL,"' . $installer->addata['basename'] . '",
				"' . $installer->addata['parent'] . '",
				"' . $installer->addata['scope'] . '",
				"' . $installer->addata['version'] . '",
				"' . (int) $installer->addata['active'] . '",
				0,
				"' . $installer->addata['fullname'] . '",
				"' . $installer->addata['description'] . '",
				"' . $roster->db->escape(serialize($installer->addata['credits'])) . '",
				"' . $installer->addata['icon'] . '",
				"' . $installer->addata['wrnet_id'] . '",NULL);';
            $result = $roster->db->query($query);
            if (!$result) {
                $installer->seterrors('DB error while creating new addon record. <br /> MySQL said:' . $roster->db->error(), $roster->locale->act['installer_error']);
                break;
            }
            $installer->addata['addon_id'] = $roster->db->insert_id();
            // We backup the addon config table to prevent damage
            $installer->add_backup($roster->db->table('plugin_config'));
            $success = $addon->install();
            // Delete the addon record if there is an error
            if (!$success) {
                $query = 'DELETE FROM `' . $roster->db->table('plugin') . "` WHERE `addon_id` = '" . $installer->addata['addon_id'] . "';";
                $result = $roster->db->query($query);
            } else {
                $installer->sql[] = 'UPDATE `' . $roster->db->table('plugin') . '` SET `active` = ' . (int) $installer->addata['active'] . " WHERE `addon_id` = '" . $installer->addata['addon_id'] . "';";
            }
            break;
        case 'upgrade':
            if (!$previous) {
                $installer->seterrors(sprintf($roster->locale->act['installer_no_upgrade'], $installer->addata['basename']));
                break;
            }
            $query = "UPDATE `" . $roster->db->table('plugin') . "` SET `basename`='" . $installer->addata['basename'] . "', `version`='" . $installer->addata['version'] . "', `active`=" . (int) $installer->addata['active'] . ", `fullname`='" . $installer->addata['fullname'] . "', `description`='" . $installer->addata['description'] . "', `credits`='" . serialize($installer->addata['credits']) . "', `icon`='" . $installer->addata['icon'] . "', `wrnet_id`='" . $installer->addata['wrnet_id'] . "' WHERE `addon_id`=" . $previous['addon_id'] . ';';
            $result = $roster->db->query($query);
            if (!$result) {
                $installer->seterrors('DB error while updating the addon record. <br /> MySQL said:' . $roster->db->error(), $roster->locale->act['installer_error']);
                break;
            }
            $installer->addata['addon_id'] = $previous['addon_id'];
            // We backup the addon config table to prevent damage
            $installer->add_backup($roster->db->table('plugin_config'));
            $success = $addon->upgrade($previous['version']);
            break;
        case 'uninstall':
            if (!$previous) {
                $installer->seterrors(sprintf($roster->locale->act['installer_no_uninstall'], $installer->addata['basename']));
                break;
            }
            if ($previous['basename'] != $installer->addata['basename']) {
                $installer->seterrors(sprintf($roster->locale->act['installer_not_uninstallable'], $installer->addata['basename'], $previous['fullname']));
                break;
            }
            $query = 'DELETE FROM `' . $roster->db->table('plugin') . '` WHERE `addon_id`=' . $previous['addon_id'] . ';';
            $result = $roster->db->query($query);
            if (!$result) {
                $installer->seterrors('DB error while deleting the addon record. <br /> MySQL said:' . $roster->db->error(), $roster->locale->act['installer_error']);
                break;
            }
            $installer->addata['addon_id'] = $previous['addon_id'];
            // We backup the addon config table to prevent damage
            $installer->add_backup($roster->db->table('plugin_config'));
            $success = $addon->uninstall();
            break;
        case 'purge':
            $success = purge($installer->addata['basename']);
            break;
        default:
            $installer->seterrors($roster->locale->act['installer_invalid_type']);
            $success = false;
            break;
    }
    if (!$success) {
        $installer->seterrors($roster->locale->act['installer_no_success_sql']);
        return false;
    } else {
        $success = $installer->install();
        $installer->setmessages(sprintf($roster->locale->act['installer_' . $_POST['type'] . '_' . $success], $installer->addata['basename']));
    }
    unset($addon);
    // Restore our locale array
    return true;
}
Ejemplo n.º 4
0
$GLOBALS["posix_getuid"]=0;
include_once(dirname(__FILE__) . '/ressources/class.users.menus.inc');
include_once(dirname(__FILE__) . '/ressources/class.mysql.inc');
include_once(dirname(__FILE__) . '/ressources/class.user.inc');
include_once(dirname(__FILE__) . '/ressources/class.ini.inc');
include_once(dirname(__FILE__) . '/ressources/class.mysql.inc');
include_once(dirname(__FILE__) . '/framework/class.unix.inc');
include_once(dirname(__FILE__) . '/framework/frame.class.inc');


if($argv[1]=='--build'){build();die();}
if($argv[1]=='--checks'){TestConfig();die();}
if($argv[1]=='--mysql'){dumpdb();die();}
if($argv[1]=='--start'){start_service();die();}
if($argv[1]=='--networks'){snort_NetWorks();die();}
if($argv[1]=='--purge'){purge();die();}




function start_service(){
	@mkdir("/var/log/snort");
	$sock=new sockets();
	$snortInterfaces=unserialize(base64_decode($sock->GET_INFO("SnortNics")));
	if(count($snortInterfaces)==0){
		echo "Starting......: Snort Daemon version No interfaces to listen set...\n";
		return;
	}	
	echo "Starting......: Snort Daemon building configuration...\n";
	build();
	echo "Starting......: Snort Daemon building configuration done...\n";
Ejemplo n.º 5
0
/**
 * Addon installer/upgrader/uninstaller
 *
 */
function processAddon()
{
    global $roster, $installer;
    $addon_name = $_POST['addon'];
    if (preg_match('/[^a-zA-Z0-9_]/', $addon_name)) {
        $installer->seterrors($roster->locale->act['invalid_char_module'], $roster->locale->act['installer_error']);
        return;
    }
    // Check for temp tables
    //$old_error_die = $roster->db->error_die(false);
    if (false === $roster->db->query("CREATE TEMPORARY TABLE `test` (id int);")) {
        $installer->temp_tables = false;
        $roster->db->query("UPDATE `" . $roster->db->table('config') . "` SET `config_value` = '0' WHERE `id` = 1180;");
    } else {
        $installer->temp_tables = true;
    }
    //$roster->db->error_die($old_error_die);
    // Include addon install definitions
    $addonDir = ROSTER_ADDONS . $addon_name . DIR_SEP;
    $addon_install_file = $addonDir . 'inc' . DIR_SEP . 'install.def.php';
    $install_class = $addon_name . 'Install';
    if (!file_exists($addon_install_file)) {
        $installer->seterrors(sprintf($roster->locale->act['installer_no_installdef'], $addon_name), $roster->locale->act['installer_error']);
        return;
    }
    require $addon_install_file;
    $addon = new $install_class();
    $addata = escape_array((array) $addon);
    $addata['basename'] = $addon_name;
    if ($addata['basename'] == '') {
        $installer->seterrors($roster->locale->act['installer_no_empty'], $roster->locale->act['installer_error']);
        return;
    }
    // Get existing addon record if available
    $query = 'SELECT * FROM `' . $roster->db->table('addon') . '` WHERE `basename` = "' . $addata['basename'] . '";';
    $result = $roster->db->query($query);
    if (!$result) {
        $installer->seterrors(sprintf($roster->locale->act['installer_fetch_failed'], $addata['basename']) . '.<br />MySQL said: ' . $roster->db->error(), $roster->locale->act['installer_error']);
        return;
    }
    $previous = $roster->db->fetch($result);
    $roster->db->free_result($result);
    // Give the installer the addon data
    $installer->addata = $addata;
    $success = false;
    // Save current locale array
    // Since we add all locales for localization, we save the current locale array
    // This is in case one addon has the same locale strings as another, and keeps them from overwritting one another
    $localetemp = $roster->locale->wordings;
    foreach ($roster->multilanguages as $lang) {
        $roster->locale->add_locale_file(ROSTER_ADDONS . $addata['basename'] . DIR_SEP . 'locale' . DIR_SEP . $lang . '.php', $lang);
    }
    // Collect data for this install type
    switch ($_POST['type']) {
        case 'install':
            if ($previous) {
                $installer->seterrors(sprintf($roster->locale->act['installer_addon_exist'], $installer->addata['basename'], $previous['fullname']));
                break;
            }
            // check to see if any requred addons if so and not enabled disable addon after install and give a message
            if (isset($installer->addata['requires'])) {
                if (!active_addon($installer->addata['requires'])) {
                    $installer->addata['active'] = false;
                    $installer->setmessages('Addon Dependency "' . $installer->addata['requires'] . '" not active or installed, "' . $installer->addata['fullname'] . '" has been disabled');
                    break;
                }
            }
            $query = 'INSERT INTO `' . $roster->db->table('addon') . '` VALUES (NULL,"' . $installer->addata['basename'] . '","' . $installer->addata['version'] . '","' . (int) $installer->addata['active'] . '",0,"' . $installer->addata['fullname'] . '","' . $installer->addata['description'] . '","' . $roster->db->escape(serialize($installer->addata['credits'])) . '","' . $installer->addata['icon'] . '","' . $installer->addata['wrnet_id'] . '",NULL);';
            $result = $roster->db->query($query);
            if (!$result) {
                $installer->seterrors('DB error while creating new addon record. <br /> MySQL said:' . $roster->db->error(), $roster->locale->act['installer_error']);
                break;
            }
            $installer->addata['addon_id'] = $roster->db->insert_id();
            // We backup the addon config table to prevent damage
            $installer->add_backup($roster->db->table('addon_config'));
            $success = $addon->install();
            // Delete the addon record if there is an error
            if (!$success) {
                $query = 'DELETE FROM `' . $roster->db->table('addon') . "` WHERE `addon_id` = '" . $installer->addata['addon_id'] . "';";
                $result = $roster->db->query($query);
            } else {
                $installer->sql[] = 'UPDATE `' . $roster->db->table('addon') . '` SET `active` = ' . (int) $installer->addata['active'] . " WHERE `addon_id` = '" . $installer->addata['addon_id'] . "';";
                $installer->sql[] = "INSERT INTO `" . $roster->db->table('permissions') . "` VALUES ('', 'roster', '" . $installer->addata['addon_id'] . "', 'addon', '" . $installer->addata['fullname'] . "', 'addon_access_desc' , '" . $installer->addata['basename'] . "_access');";
            }
            break;
        case 'upgrade':
            if (!$previous) {
                $installer->seterrors(sprintf($roster->locale->act['installer_no_upgrade'], $installer->addata['basename']));
                break;
            }
            /* Carry Over from AP branch
            			if( !in_array($previous['basename'],$addon->upgrades) )
            			{
            				$installer->seterrors(sprintf($roster->locale->act['installer_not_upgradable'],$addon->fullname,$previous['fullname'],$previous['basename']));
            				break;
            			}
            			*/
            $query = "UPDATE `" . $roster->db->table('addon') . "` SET `basename`='" . $installer->addata['basename'] . "', `version`='" . $installer->addata['version'] . "', `active`=" . (int) $installer->addata['active'] . ", `fullname`='" . $installer->addata['fullname'] . "', `description`='" . $installer->addata['description'] . "', `credits`='" . serialize($installer->addata['credits']) . "', `icon`='" . $installer->addata['icon'] . "', `wrnet_id`='" . $installer->addata['wrnet_id'] . "' WHERE `addon_id`=" . $previous['addon_id'] . ';';
            $result = $roster->db->query($query);
            if (!$result) {
                $installer->seterrors('DB error while updating the addon record. <br /> MySQL said:' . $roster->db->error(), $roster->locale->act['installer_error']);
                break;
            }
            $installer->addata['addon_id'] = $previous['addon_id'];
            // We backup the addon config table to prevent damage
            $installer->add_backup($roster->db->table('addon_config'));
            $success = $addon->upgrade($previous['version']);
            break;
        case 'uninstall':
            if (!$previous) {
                $installer->seterrors(sprintf($roster->locale->act['installer_no_uninstall'], $installer->addata['basename']));
                break;
            }
            if ($previous['basename'] != $installer->addata['basename']) {
                $installer->seterrors(sprintf($roster->locale->act['installer_not_uninstallable'], $installer->addata['basename'], $previous['fullname']));
                break;
            }
            $query = 'DELETE FROM `' . $roster->db->table('addon') . '` WHERE `addon_id`=' . $previous['addon_id'] . ';';
            $result = $roster->db->query($query);
            if (!$result) {
                $installer->seterrors('DB error while deleting the addon record. <br /> MySQL said:' . $roster->db->error(), $roster->locale->act['installer_error']);
                break;
            }
            $installer->addata['addon_id'] = $previous['addon_id'];
            // We backup the addon config table to prevent damage
            $installer->add_backup($roster->db->table('addon_config'));
            $success = $addon->uninstall();
            if ($success) {
                $installer->remove_permissions($previous['addon_id']);
            }
            break;
        case 'purge':
            $success = purge($installer->addata['basename']);
            break;
        default:
            $installer->seterrors($roster->locale->act['installer_invalid_type']);
            $success = false;
            break;
    }
    if (!$success) {
        $installer->seterrors($roster->locale->act['installer_no_success_sql']);
        return false;
    } else {
        $success = $installer->install();
        $installer->setmessages(sprintf($roster->locale->act['installer_' . $_POST['type'] . '_' . $success], $installer->addata['basename']));
    }
    // Restore our locale array
    $roster->locale->wordings = $localetemp;
    unset($localetemp);
    return true;
}
Ejemplo n.º 6
0
function installation()
{
    $source = "update/Hargassner-master";
    $dest = ".";
    if (copyr($source, $dest)) {
        echo "Installation OK<br>";
    } else {
        echo "Erreur d'installation : annulation de l'installation";
    }
}
/************enchainement des actions **************************/
if (!is_dir("update")) {
    mkdir("update");
}
if (!is_dir("update/backup")) {
    mkdir("update/backup");
}
unlinkRecursive("update/Hargassner-master", true);
unlink("update/master.zip");
if (download($github)) {
    if (unzip()) {
        if (purge()) {
            if (backup()) {
                installation();
            }
        }
    }
}
echo '<a href="index.php">Recharger le site</a> ';
?>
  
Ejemplo n.º 7
0
function build_days()
{
    $tableT = date("YmdH") . "_bwmrt";
    $tableR = date("YmdH") . "_bwmrh";
    $tables = LIST_TABLES_TOTAL_HOUR();
    $q = new mysql();
    while (list($tablename, $arrz) = each($tables)) {
        if ($tableT == $tablename) {
            continue;
        }
        if (!_build_days_total($tablename)) {
            continue;
        }
        $q->QUERY_SQL("DROP TABLE {$tablename}", "bwmng");
    }
    $tables = LIST_TABLES_NIC_HOUR();
    $q = new mysql();
    while (list($tablename, $arrz) = each($tables)) {
        if ($tableT == $tablename) {
            continue;
        }
        if (!_build_days_hours($tablename)) {
            continue;
        }
        $q->QUERY_SQL("DROP TABLE {$tablename}", "bwmng");
    }
    purge();
}
Ejemplo n.º 8
0
function mod_8_assets($b)
{
    global $config, $mod, $board;
    require_once 'inc/image.php';
    if (!hasPermission($config['mod']['edit_assets'], $b)) {
        error($config['error']['noaccess']);
    }
    if (!openBoard($b)) {
        error("Could not open board!");
    }
    $dir = 'static/assets/' . $b;
    if (!is_dir($dir)) {
        mkdir($dir, 0777, true);
        symlink(getcwd() . '/' . $config['image_deleted'], "{$dir}/deleted.png");
        symlink(getcwd() . '/' . $config['spoiler_image'], "{$dir}/spoiler.png");
        symlink(getcwd() . '/' . $config['no_file_image'], "{$dir}/no-file.png");
    }
    // "File deleted"
    if (isset($_FILES['deleted_file']) && !empty($_FILES['deleted_file']['tmp_name'])) {
        $upload = $_FILES['deleted_file']['tmp_name'];
        $extension = strtolower(mb_substr($_FILES['deleted_file']['name'], mb_strrpos($_FILES['deleted_file']['name'], '.') + 1));
        if (!is_readable($upload)) {
            error($config['error']['nomove']);
        }
        if (filesize($upload) > 512000) {
            error('File too large!');
        }
        if (!in_array($extension, array('png', 'gif'))) {
            error('File must be PNG or GIF format.');
        }
        if (!($size = @getimagesize($upload))) {
            error($config['error']['invalidimg']);
        }
        if ($size[0] != 140 or $size[1] != 50) {
            error('Image wrong size!');
        }
        unlink("{$dir}/deleted.png");
        copy($upload, "{$dir}/deleted.png");
        purge("{$dir}/deleted.png", true);
    }
    // Spoiler file
    if (isset($_FILES['spoiler_file']) && !empty($_FILES['spoiler_file']['tmp_name'])) {
        $upload = $_FILES['spoiler_file']['tmp_name'];
        $extension = strtolower(mb_substr($_FILES['spoiler_file']['name'], mb_strrpos($_FILES['spoiler_file']['name'], '.') + 1));
        if (!is_readable($upload)) {
            error($config['error']['nomove']);
        }
        if (filesize($upload) > 512000) {
            error('File too large!');
        }
        if (!in_array($extension, array('png', 'gif'))) {
            error('File must be PNG or GIF format.');
        }
        if (!($size = @getimagesize($upload))) {
            error($config['error']['invalidimg']);
        }
        if ($size[0] != 128 or $size[1] != 128) {
            error('Image wrong size!');
        }
        unlink("{$dir}/spoiler.png");
        copy($upload, "{$dir}/spoiler.png");
        purge("{$dir}/spoiler.png", true);
    }
    // No file
    if (isset($_FILES['nofile_file']) && !empty($_FILES['nofile_file']['tmp_name'])) {
        $upload = $_FILES['nofile_file']['tmp_name'];
        $extension = strtolower(mb_substr($_FILES['nofile_file']['name'], mb_strrpos($_FILES['nofile_file']['name'], '.') + 1));
        if (!is_readable($upload)) {
            error($config['error']['nomove']);
        }
        if (filesize($upload) > 512000) {
            error('File too large!');
        }
        if (!in_array($extension, array('png', 'gif'))) {
            error('File must be PNG or GIF format.');
        }
        if (!($size = @getimagesize($upload))) {
            error($config['error']['invalidimg']);
        }
        if ($size[0] != 500 or $size[1] != 500) {
            error('Image wrong size!');
        }
        unlink("{$dir}/no-file.png");
        copy($upload, "{$dir}/no-file.png");
        purge("{$dir}/no-file.png", true);
    }
    mod_page(_('Edit board assets'), 'mod/assets.html', array('board' => $board, 'token' => make_secure_link_token('assets/' . $board['uri'])));
}
Ejemplo n.º 9
0
function purge($dir)
{
    $handle = opendir($dir);
    while (false !== ($file = readdir($handle))) {
        if ($file != "." && $file != "..") {
            if (is_dir($dir . $file)) {
                purge($dir . $file . "/");
                rmdir($dir . $file);
            } else {
                unlink($dir . $file);
            }
        }
    }
    closedir($handle);
}
Ejemplo n.º 10
0
{
    $purged_str = preg_replace("/\\W/", "", $str);
    return $purged_str;
}
if (isset($_COOKIE["username"])) {
    $host = "fall-2015.cs.utexas.edu";
    $user = "******";
    $dbs = "cs329e_pjobrien";
    $port = "3306";
    $pwd = "wVwmZDXU8h";
    $connect = mysqli_connect($host, $user, $pwd, $dbs, $port);
    if (empty($connect)) {
        die("mysql_connect failed " . mysqli_connect_error());
    }
    $name = purge($_POST["nam"]);
    $item = purge($_POST["item"]);
    $name = trim($name);
    $item = trim($item);
    if ($name != "" && $item != "") {
        $stmt = mysqli_prepare($connect, "INSERT INTO dinner VALUES (?, ?)");
        mysqli_stmt_bind_param($stmt, 'ss', $name, $item) or die("Failed: " . mysqli_error($connect));
        mysqli_stmt_execute($stmt);
        mysqli_stmt_close($stmt);
    }
    setcookie("username", "", time() - 3600);
    header('Location: http://zweb.cs.utexas.edu/users/cs329e-fa15/pjobrien/test3/thanks.html');
} else {
    print <<<ERRR
  <html>
  <head>
  <title>Assignment 13</title>
Ejemplo n.º 11
0
extract($_POST);
switch ($action) {
    case "Add":
        insertCourse($schedule, $sem, $crs, $lec, $tut, $pra);
        break;
    case "Edit":
        editCourse($schedule, $sem, $crs, $lec, $tut, $pra);
        break;
    case "Remove":
        removeCourse($schedule, $crs);
        break;
    case "AddNew":
        addNewCourse($schedule, $dept, $code, $type, $section, $day, $start, $end);
        break;
    case "Purge":
        purge($schedule, $sem);
        break;
    case "QuickAdd":
        quickAdd($schedule, $sem, $toadd);
        break;
    default:
        break;
}
// Get list of departments (APS, CSC, etc...)
$depts = deptList($sem);
// Decide whether to turn on the conflict filter or not
if ($_GET["filter"]) {
    $_SESSION["filter"] = $_GET["filter"];
}
$filter = $_SESSION["filter"];
?>
Ejemplo n.º 12
0
if ($uri[count($uri)] !== 'index.html') {
    $uri[count($uri)] = 'index.html';
}
define('URI', '/' . implode('/', $uri));
define('URL', 'http' . SSL . '://' . $_SERVER['HTTP_HOST'] . URI);
define('ARCHIVES_FOLDER', REALPATH . 'archives/');
define('EXPORT_FOLDER', REALPATH . 'exports/');
define('BKP_TIME', time());
define('BKP_FILE', date('Y-m-d', BKP_TIME) . '_' . date('H', BKP_TIME) . 'h' . date('i', BKP_TIME) . '_backup.zip');
/**
 * Suppression des sauvegardes de EXPORT_FOLDER
 */
if ($_SESSION['CONNECT'] && $_POST['launch'] !== 'base_de_donnees' && $_POST['launch'] !== 'repertoires' && $_POST['launch'] !== 'generation' && !isset($_POST['download'])) {
    purge(EXPORT_FOLDER);
    purge(EXPORT_FOLDER . 'base_de_donnees/');
    purge(EXPORT_FOLDER . 'repertoires/');
}
/**
 * Inclusion du fichier de configuration
 */
if ($_SERVER['HTTP_HOST'] === 'www.mbackuper.dev') {
    require_once REALPATH . 'config_localhost.inc.php';
} else {
    require_once REALPATH . 'config.inc.php';
}
/**
 * Actions spécifique aux tâches CRON
 */
$_TOKEN = hash('sha256', REALPATH . $_SERVER['HTTP_HOST'], false);
if (isset($_GET['token'])) {
    if ($_CRON['actif'] === true) {
Ejemplo n.º 13
0
function file_unlink($path)
{
    global $config, $debug;
    //echo "file_unlink($path)<br>\n";
    $useCache = true;
    if ($path == 'main.js') {
        $useCache = false;
    }
    if ($useCache) {
        if ($config['gzip_static']) {
            Cache::delete('vichan_filecache_' . $path);
        } else {
            Cache::delete('vichan_filecache_' . $path . '.gz');
        }
    }
    if ($config['debug']) {
        if (!isset($debug['unlink'])) {
            $debug['unlink'] = array();
        }
        $debug['unlink'][] = $path;
    }
    if ($useCache) {
        $ret = true;
    } else {
        $ret = @unlink($path);
        if ($config['gzip_static']) {
            $gzpath = "{$path}.gz";
            @unlink($gzpath);
        }
    }
    if (isset($config['purge']) && $path[0] != '/' && isset($_SERVER['HTTP_HOST'])) {
        // Purge cache
        if (basename($path) == $config['file_index']) {
            // Index file (/index.html); purge "/" as well
            $uri = dirname($path);
            // root
            if ($uri == '.') {
                $uri = '';
            } else {
                $uri .= '/';
            }
            purge($uri);
        }
        purge($path);
    }
    event('unlink', $path);
    return $ret;
}
Ejemplo n.º 14
0
			$tpl=new templates();
			echo "alert('". $tpl->javascript_parse_text("{ERROR_NO_PRIVS}")."');";
			die();exit();
		}
	}
	
	if($user->AsSquidAdministrator==false){
		$tpl=new templates();
		echo "alert('". $tpl->javascript_parse_text("{ERROR_NO_PRIVS}")."');";
		die();exit();
	}	
	
	if(isset($_GET["purge-js"])){purge_js();exit;}
	if(isset($_GET["dns-servers"])){dns_servers();exit;}
	if(isset($_GET["items"])){items();exit;}
	if(isset($_POST["purge-popup"])){purge();exit;}

	
page();

function purge_js(){
	header("content-type: application/x-javascript");
	$page=CurrentPageName();
	$tpl=new templates();
	$explain=$tpl->javascript_parse_text("{squid_purge_dns_explain}");
	$dev=$_GET["unlink-disk-js"];
	$t=time();
	$thml="
	var xSave$t= function (obj) {
	var results=obj.responseText;
	if(results.length>0){alert(results);}
Ejemplo n.º 15
0
function ParseMailbox_task($account)
{
    $GLOBALS["ACCOUNT_IMAP"] = $account;
    $q = new mysql();
    $sql = "SELECT parameters FROM emailing_campain_imap WHERE account_name='{$account}'";
    $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, 'artica_backup'));
    $PARAMS = unserialize(base64_decode($ligne["parameters"]));
    if (!$q->ok) {
        events("Unable to get informations", $q->mysql_error, $account, __LINE__);
        return;
    }
    if ($PARAMS["enabled"] != 1) {
        events("This account is disabled", $q->mysql_error, $account, __LINE__);
        return;
    }
    if ($PARAMS["use_ssl"] == 1) {
        $server_pattern = "{{$PARAMS["servername"]}:993/imap/ssl/novalidate-cert}";
    } else {
        $server_pattern = "{{$PARAMS["servername"]}:143/novalidate-cert}";
    }
    $GLOBALS["SERVER_IMAP_PATTERN"] = $server_pattern;
    $GLOBALS["MBXCON"] = imap_open("{$server_pattern}INBOX", $PARAMS["username"], $PARAMS["password"]);
    if (!$GLOBALS["MBXCON"]) {
        events("Unable to connect to imap server ", imap_last_error(), $account, __LINE__);
        @imap_close($mbox);
        return;
    }
    if (!imap_createmailbox($GLOBALS["MBXCON"], imap_utf7_encode("{$server_pattern}INBOX/emailing_read"))) {
        $error = imap_last_error();
        if (!preg_match("#already exists#", $error)) {
            events("{$server_pattern}INBOX/emailing_read failed to create mbox ", $error, $account, __LINE__);
            @imap_close($GLOBALS["MBXCON"]);
            return;
        }
    }
    $status = imap_status($GLOBALS["MBXCON"], "{$server_pattern}INBOX", SA_ALL);
    if ($status) {
        $messages_number = $status->messages;
    } else {
        events("imap_status failed ", imap_last_error(), $account, __LINE__);
        @imap_close($GLOBALS["MBXCON"]);
        return;
    }
    if ($messages_number == 0) {
        events("No messages, aborting", imap_last_error(), $account, __LINE__);
        @imap_close($GLOBALS["MBXCON"]);
        return;
    }
    $TOSEARCH = array("Returned mail: see transcript for details", "Undelivered Mail Returned to Sender", "Delivery Status Notification", "failure notice", "DELIVERY FAILURE:", "Returned mail:", "Delivery Notification", "Mail delivery failed", "Non remis", "Undeliverable", "Notification", "Mail could not be delivered", "Delivery Final Failure Notice", "Unzustellbar", "Mail System Error", "Error sending message", "Permanent Delivery Failure", "Mail routing error", "Delivery failure", "Mail could not be delivered", "Your message can not be delivered", "auto-reply concerning", "Delivery Status", "User unknown", "Rapport de Non-Remise", "Undeliverable", "Automatically rejected mail", "NDN:", "Delivery Final Failure Notice");
    $i = 0;
    foreach ($TOSEARCH as $findstr) {
        $result = @imap_search($GLOBALS["MBXCON"], 'SUBJECT "' . $findstr . '"');
        if (is_array($result)) {
            foreach ($result as $msgno) {
                CheckMessage($msgno, $findstr);
                purge(false);
                $i++;
            }
        }
        if ($i > 0) {
            events("{$findstr}: {$i} message(s)", null, $account, __LINE__);
            @imap_expunge($GLOBALS["MBXCON"]);
            $i = 0;
        }
    }
    if ($GLOBALS["MUSTCLEAN"]) {
        CleanAllDatabases();
        $GLOBALS["MUSTCLEAN"] = false;
    }
    $TOSEARCH = array("Absence du bureau", "Warning: could not send message for past", "Out of Office AutoReply", "Read: ", "Out of Office", "Message d\\'absence", "Réponse automatique", "R=E9ponse_automatique", "R=E9ponse_automatique", "Lu :", "Lu:", "Lu : ", "Message you sent blocked", "out of the office", "absence", "Auto:", "est absent", "Accusé de réception", "Lu :", "Your message to support awaits moderator approval", "Auto Reply:", "Delivery Delayed", "delayed 48 hours", "delayed 24 hours", "delayed 72 hours", "autoconfirm");
    $i = 0;
    foreach ($TOSEARCH as $findstr) {
        $result = @imap_search($GLOBALS["MBXCON"], 'SUBJECT "' . $findstr . '"');
        if (is_array($result)) {
            foreach ($result as $msgno) {
                @imap_delete($GLOBALS["MBXCON"], "{$msgno}:{$msgno}");
                $i++;
            }
        }
        if ($i > 0) {
            events("{$findstr}: {$i} message(s)", null, $account, __LINE__);
            @imap_expunge($GLOBALS["MBXCON"]);
            $i = 0;
        }
    }
    if ($i > 0) {
        events("{$findstr}: {$i} message(s)", null, $account, __LINE__);
        @imap_expunge($GLOBALS["MBXCON"]);
        $i = 0;
    }
    $check = imap_check($GLOBALS["MBXCON"]);
    if (!$check) {
        events("imap_check failed ", imap_last_error(), $account, __LINE__);
        @imap_close($GLOBALS["MBXCON"]);
        return;
    }
    events("Parsing {$check->Nmsgs} message(s)", imap_last_error(), $account, __LINE__);
    if ($check->Nmsgs > 500) {
        $max = 500;
    } else {
        $max = $check->Nmsgs;
    }
    $overviews = imap_fetch_overview($GLOBALS["MBXCON"], "1:{$max}");
    $i = 0;
    foreach ($overviews as $overview) {
        $i++;
        if (preg_match("#Mail delivery failed#", $overview->subject)) {
            CheckMessage($overview->uid, $overview->subject);
            continue;
        }
        if (preg_match("#Undelivered Mail Returned to Sender#", $overview->subject)) {
            CheckMessage($overview->uid, $overview->subject);
            continue;
        }
        if (preg_match("#Undeliverable mail:#", $overview->subject)) {
            CheckMessage($overview->uid, $overview->subject);
            continue;
        }
        if (preg_match("#Delivery Status Notification#", $overview->subject)) {
            CheckMessage($overview->uid, $overview->subject);
            continue;
        }
        if (preg_match("#Returned mail: see transcript for details#", $overview->subject)) {
            CheckMessage($overview->uid, $overview->subject);
            continue;
        }
        if (preg_match("#DELIVERY FAILURE#", $overview->subject)) {
            CheckMessage($overview->uid, $overview->subject);
            continue;
        }
        if (preg_match("#Delivery Final Failure Notice#", $overview->subject)) {
            CheckMessage($overview->uid, $overview->subject);
            continue;
        }
        if (preg_match("#R=E9ponse_automatique=A0#", $overview->subject)) {
            @imap_delete($GLOBALS["MBXCON"], "{$overview->uid}:{$overview->uid}");
            continue;
        }
        if (preg_match("#Out of Office#", $overview->subject)) {
            @imap_delete($GLOBALS["MBXCON"], "{$overview->uid}:{$overview->uid}");
            continue;
        }
        if (preg_match("#Diffusion des messages#", $overview->subject)) {
            @imap_delete($GLOBALS["MBXCON"], "{$overview->uid}:{$overview->uid}");
            continue;
        }
        if (preg_match("#Warning: could not send message for past#", $overview->subject)) {
            @imap_delete($GLOBALS["MBXCON"], "{$overview->uid}:{$overview->uid}");
            continue;
        }
        if (preg_match("#Company=20Vacancy=20#", $overview->subject)) {
            @imap_delete($GLOBALS["MBXCON"], "{$overview->uid}:{$overview->uid}");
            continue;
        }
        if (preg_match("#R=E9ponse_automatique_d'absence_du_bureau#", $overview->subject)) {
            @imap_delete($GLOBALS["MBXCON"], "{$overview->uid}:{$overview->uid}");
            continue;
        }
        if (preg_match("#Automated Reply#", $overview->subject)) {
            @imap_delete($GLOBALS["MBXCON"], "{$overview->uid}:{$overview->uid}");
            continue;
        }
        if (preg_match("#R=E9ponse_automatique_d=27absence_du_bureau#", $overview->subject)) {
            @imap_delete($GLOBALS["MBXCON"], "{$overview->uid}:{$overview->uid}");
            continue;
        }
        if (preg_match("#est absent\\(e\\)\\.#", $overview->subject)) {
            @imap_delete($GLOBALS["MBXCON"], "{$overview->uid}:{$overview->uid}");
            continue;
        }
        if (preg_match("#OUT OF OFFICE#", $overview->subject)) {
            @imap_delete($GLOBALS["MBXCON"], "{$overview->uid}:{$overview->uid}");
            continue;
        }
        if (preg_match("#Absence du bureau#", $overview->subject)) {
            @imap_delete($GLOBALS["MBXCON"], "{$overview->uid}:{$overview->uid}");
            continue;
        }
        if (preg_match("#failure notice#", $overview->subject)) {
            CheckMessage($overview->uid, $overview->subject);
            continue;
        }
        if (preg_match("#Validation de votre mail a destination#", $overview->subject)) {
            CheckMessage($overview->uid, $overview->subject);
            continue;
        }
        if (preg_match("#Non remis#", $overview->subject)) {
            CheckMessage($overview->uid, $overview->subject);
            continue;
        }
        if (preg_match("#Mail delivery failure#", $overview->subject)) {
            CheckMessage($overview->uid, $overview->subject);
            continue;
        }
        if (preg_match("#Notification\\s+d'.+?AOk-tat\\s+de\\s+remise#", $overview->subject)) {
            CheckMessage($overview->uid, $overview->subject);
            continue;
        }
        if (preg_match("#Message you sent blocked#", $overview->subject)) {
            CheckMessage($overview->uid, $overview->subject);
            continue;
        }
        if (preg_match("#Delivery Status Notification#", $overview->subject)) {
            CheckMessage($overview->uid, $overview->subject);
            continue;
        }
        if (preg_match("#Notifications Mail Delivery System#", $overview->from)) {
            CheckMessage($overview->uid, $overview->subject);
            continue;
        }
        if (preg_match("#Delivery Notification: Delivery has failed#", $overview->subject)) {
            CheckMessage($overview->uid, $overview->subject);
            continue;
        }
        if (preg_match("#Envoi du message impossible#", $overview->subject)) {
            CheckMessage($overview->uid, $overview->subject);
            continue;
        }
        if (preg_match("#Notification__d'+AOk-tat__de__remise__=28+AOk-chec#", $overview->subject)) {
            CheckMessage($overview->uid, $overview->subject);
            continue;
        }
        if (preg_match("#Delivery status notification#", $overview->subject)) {
            CheckMessage($overview->uid, $overview->subject);
            continue;
        }
        if (preg_match("#Returned mail: User unknown#", $overview->subject)) {
            CheckMessage($overview->uid, $overview->subject);
            continue;
        }
        if (preg_match("#Delivery Status#", $overview->subject)) {
            CheckMessage($overview->uid, $overview->subject);
            continue;
        }
        if (preg_match("#Undeliverable:#", $overview->subject)) {
            CheckMessage($overview->uid, $overview->subject);
            continue;
        }
        if (preg_match("#Delivery failure#", $overview->subject)) {
            CheckMessage($overview->uid, $overview->subject);
            continue;
        }
        if (preg_match("#Message Notification#", $overview->subject)) {
            CheckMessage($overview->uid, $overview->subject);
            continue;
        }
        if (preg_match("#Votre message.+?a ete rejete#", $overview->subject)) {
            CheckMessage($overview->uid, $overview->subject);
            continue;
        }
        if (preg_match("#Warning: could not send message for past#", $overview->subject)) {
            CheckMessage($overview->uid, $overview->subject);
            continue;
        }
        if (preg_match("#Undeliverable mail#", $overview->subject)) {
            CheckMessage($overview->uid, $overview->subject);
            continue;
        }
        if (preg_match("#Changement adresse email#", $overview->subject)) {
            @unlink($file);
            if (imap_mail_move($GLOBALS["MBXCON"], "{$uid}:{$uid}", "INBOX/emailing_read")) {
                continue;
            } else {
                events("INBOX/emailing_read: unable to mode message {$uid}:{$uid} ", imap_last_error(), $GLOBALS["ACCOUNT_IMAP"], __LINE__);
            }
            continue;
        }
        if (preg_match("#protected against spam by SpamWars#", $overview->subject)) {
            @unlink($file);
            if (imap_mail_move($GLOBALS["MBXCON"], "{$uid}:{$uid}", "INBOX/emailing_read")) {
                continue;
            } else {
                events("INBOX/emailing_read: unable to mode message {$uid}:{$uid} ", imap_last_error(), $GLOBALS["ACCOUNT_IMAP"], __LINE__);
            }
            continue;
        }
        if (preg_match("#Validation de votre mail a destination de#", $overview->subject)) {
            @unlink($file);
            if (imap_mail_move($GLOBALS["MBXCON"], "{$uid}:{$uid}", "INBOX/emailing_read")) {
                continue;
            } else {
                events("INBOX/emailing_read: unable to mode message {$uid}:{$uid} ", imap_last_error(), $GLOBALS["ACCOUNT_IMAP"], __LINE__);
            }
            continue;
        }
        if (preg_match("#is blocked in my spam folder awaiting your authentication#", $overview->subject)) {
            @unlink($file);
            if (imap_mail_move($GLOBALS["MBXCON"], "{$uid}:{$uid}", "INBOX/emailing_read")) {
                continue;
            } else {
                events("INBOX/emailing_read: unable to mode message {$uid}:{$uid} ", imap_last_error(), $GLOBALS["ACCOUNT_IMAP"], __LINE__);
            }
            continue;
        }
        if (preg_match("#Merci de me retirer de votre liste de distribution#", $overview->subject)) {
            @unlink($file);
            if (imap_mail_move($GLOBALS["MBXCON"], "{$uid}:{$uid}", "INBOX/emailing_read")) {
                continue;
            } else {
                events("INBOX/emailing_read: unable to mode message {$uid}:{$uid} ", imap_last_error(), $GLOBALS["ACCOUNT_IMAP"], __LINE__);
            }
            continue;
        }
        if (preg_match("#Notre nom de domaine .+? a chang#", $overview->subject)) {
            @unlink($file);
            if (imap_mail_move($GLOBALS["MBXCON"], "{$uid}:{$uid}", "INBOX/emailing_read")) {
                continue;
            } else {
                events("INBOX/emailing_read: unable to mode message {$uid}:{$uid} ", imap_last_error(), $GLOBALS["ACCOUNT_IMAP"], __LINE__);
            }
            continue;
        }
        if (preg_match("#METTRE A JOUR VOTRE CARNET D'ADRESSES#", $overview->subject)) {
            @unlink($file);
            if (imap_mail_move($GLOBALS["MBXCON"], "{$uid}:{$uid}", "INBOX/emailing_read")) {
                continue;
            } else {
                events("INBOX/emailing_read: unable to mode message {$uid}:{$uid} ", imap_last_error(), $GLOBALS["ACCOUNT_IMAP"], __LINE__);
            }
            continue;
        }
        if (preg_match("#Demande de support#", $overview->subject)) {
            @unlink($file);
            if (imap_mail_move($GLOBALS["MBXCON"], "{$uid}:{$uid}", "INBOX/emailing_read")) {
                continue;
            } else {
                events("INBOX/emailing_read: unable to mode message {$uid}:{$uid} ", imap_last_error(), $GLOBALS["ACCOUNT_IMAP"], __LINE__);
            }
            continue;
        }
        if (preg_match("#Returned mail:#", $overview->subject)) {
            CheckMessage($overview->uid, $overview->subject);
            continue;
        }
        if (preg_match("#Delivery Notification#", $overview->subject)) {
            CheckMessage($overview->uid, $overview->subject);
            continue;
        }
        if (preg_match("#Mail Notification#", $overview->subject)) {
            CheckMessage($overview->uid, $overview->subject);
            continue;
        }
        if (preg_match("#Mail System Error#", $overview->subject)) {
            CheckMessage($overview->uid, $overview->subject);
            continue;
        }
        if (preg_match("#DELIVERY_FAILURE#", $overview->subject)) {
            CheckMessage($overview->uid, $overview->subject);
            continue;
        }
        echo "{$overview->date}: From: {$overview->from} uid:{$overview->uid} \"{$overview->subject}\"\n";
        if ($i > $max) {
            break;
        }
    }
    purge();
    if ($GLOBALS["MUSTCLEAN"]) {
        CleanAllDatabases();
        $GLOBALS["MUSTCLEAN"] = false;
    }
    @imap_close($GLOBALS["MBXCON"]);
}
Ejemplo n.º 16
0
function stop($aspid = false)
{
    $unix = new unix();
    if (!$aspid) {
        $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
        $pid = $unix->get_pid_from_file($pidfile);
        if ($unix->process_exists($pid, basename(__FILE__))) {
            $time = $unix->PROCCESS_TIME_MIN($pid);
            if ($GLOBALS["OUTPUT"]) {
                echo "Starting......: " . date("H:i:s") . " [INIT]: c-icap service Already Artica task running PID {$pid} since {$time}mn\n";
            }
            return;
        }
        @file_put_contents($pidfile, getmypid());
    }
    $pid = PID_NUM();
    if (!$unix->process_exists($pid)) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Stopping......: " . date("H:i:s") . " [INIT]: c-icap service already stopped...\n";
        }
        return;
    }
    $pid = PID_NUM();
    $nohup = $unix->find_program("nohup");
    $php5 = $unix->LOCATE_PHP5_BIN();
    $echo = $unix->find_program("echo");
    $kill = $unix->find_program("kill");
    shell_exec("{$echo} -n \"stop\"  > /var/run/c-icap/c-icap.ctl");
    for ($i = 0; $i < 3; $i++) {
        $pid = PID_NUM();
        if (!$unix->process_exists($pid)) {
            break;
        }
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: c-icap service waiting pid:{$pid} {$i}/3...\n";
        }
        sleep(1);
    }
    if ($GLOBALS["OUTPUT"]) {
        echo "Stopping......: " . date("H:i:s") . " [INIT]: c-icap service Shutdown pid {$pid}...\n";
    }
    unix_system_kill($pid);
    for ($i = 0; $i < 5; $i++) {
        $pid = PID_NUM();
        if (!$unix->process_exists($pid)) {
            break;
        }
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: c-icap service waiting pid:{$pid} {$i}/5...\n";
        }
        sleep(1);
    }
    unix_system_kill($pid);
    for ($i = 0; $i < 5; $i++) {
        $pid = PID_NUM();
        if (!$unix->process_exists($pid)) {
            break;
        }
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: c-icap service waiting pid:{$pid} {$i}/5...\n";
        }
        sleep(1);
    }
    $pid = PID_NUM();
    if (!$unix->process_exists($pid)) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Stopping......: " . date("H:i:s") . " [INIT]: c-icap service success...\n";
        }
        return;
    }
    if ($GLOBALS["OUTPUT"]) {
        echo "Stopping......: " . date("H:i:s") . " [INIT]: c-icap service shutdown - force - pid {$pid}...\n";
    }
    unix_system_kill_force($pid);
    for ($i = 0; $i < 5; $i++) {
        $pid = PID_NUM();
        if (!$unix->process_exists($pid)) {
            break;
        }
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: c-icap service waiting pid:{$pid} {$i}/5...\n";
        }
        sleep(1);
    }
    if (!$unix->process_exists($pid)) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Stopping......: " . date("H:i:s") . " [INIT]: c-icap service success...\n";
        }
        $GLOBALS["ALL"] = true;
        purge(true);
        return;
    }
    if ($GLOBALS["OUTPUT"]) {
        echo "Stopping......: " . date("H:i:s") . " [INIT]: c-icap service failed...\n";
    }
}