本文整理汇总了PHP中purge函数的典型用法代码示例。如果您正苦于以下问题:PHP purge函数的具体用法?PHP purge怎么用?PHP purge使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了purge函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: file_unlink
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;
}
示例2: dirname
}
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());
示例3: processPlugin
//.........这里部分代码省略.........
$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;
}
示例4: include_once
$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";
示例5: processAddon
//.........这里部分代码省略.........
// 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;
}
示例6: installation
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> ';
?>
示例7: build_days
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();
}
示例8: mod_8_assets
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'])));
}
示例9: purge
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);
}
示例10: preg_replace
{
$purged_str = preg_replace("/\\W/", "", $str);
return $purged_str;
}
if (isset($_COOKIE["username"])) {
$host = "fall-2015.cs.utexas.edu";
$user = "pjobrien";
$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>
示例11: extract
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"];
?>
示例12: define
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) {
示例13: file_unlink
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;
}
示例14: templates
$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);}
示例15: ParseMailbox_task
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 {
//.........这里部分代码省略.........