exit; } /* begin with some constants */ $sDateformat = 'Y-m-d H:i:s'; /* end with some constants */ /* begin db connect */ db_connect(); if ($dblink === false) { echo 'Unable to connect to database'; exit; } /* end db connect */ $rsNotify = sql("\tSELECT `notify_waiting`.`id`, `notify_waiting`.`cache_id`, `notify_waiting`.`type`,\n\t\t\t\t`user`.`username`,\n\t\t\t\t`user2`.`email`, `user2`.`username` as `recpname`, `user2`.`latitude` as `lat1`, `user2`.`longitude` as `lon1`, `user2`.`user_id` as `recid`,\n\t\t\t\t`caches`.`name` as `cachename`, `caches`.`date_hidden`, `caches`.`latitude` as `lat2`, `caches`.`longitude` as `lon2`, `caches`.`wp_oc`,\n\t\t\t\t`cache_type`.`de` as `cachetype`,\n\t\t\t\t`cache_size`.`de` as `cachesize`\n\t\t\tFROM `notify_waiting`, `caches`, `user`, `user` `user2`, `cache_type`, `cache_size`, `cache_status`\n\t\t\tWHERE `notify_waiting`.`cache_id`=`caches`.`cache_id`\n\t\t\t AND `notify_waiting`.`user_id`=`user2`.`user_id`\n\t\t\t AND `caches`.`user_id`=`user`.`user_id`\n\t\t\t AND `caches`.`type`=`cache_type`.`id`\n\t\t\t AND `caches`.`status`=`cache_status`.`id`\n\t\t\t AND `caches`.`size`=`cache_size`.`id`\n\t\t\t AND `cache_status`.`allow_user_view`=1"); while ($rNotify = sql_fetch_array($rsNotify)) { sql("DELETE FROM `notify_waiting` WHERE `id` ='&1'", $rNotify['id']); process_new_cache($rNotify); } mysql_free_result($rsNotify); CleanupAndExit($notifypid); /* end send out everything that has to be sent */ function process_new_cache($notify) { global $notify_text, $mailfrom, $mailsubject, $debug, $debug_mailto, $rootpath; //echo "process_new_cache(".$notify['id'].")\n"; $fehler = false; // mail-template lesen switch ($notify['type']) { case notify_new_cache: // Type: new cache $mailbody = read_file($rootpath . 'util/notification/notify_newcache.email'); break;
// No other instance - do normal processing $db = new dataBase(); $rsNotifyQuery = " SELECT `notify_waiting`.`id`, `notify_waiting`.`cache_id`, `notify_waiting`.`type`,\n `user`.`username`, user.user_id as cache_owner_id,\n user.hidden_count as hidden, user.notfounds_count as dnf, user.founds_count as found,\n `user2`.`email`, `user2`.`username` as `recpname`, `user2`.`latitude` as `lat1`, `user2`.`longitude` as `lon1`, `user2`.`user_id` as `recid`,\n `caches`.`name` as `cachename`, `caches`.`date_hidden`, `caches`.`latitude` as `lat2`, `caches`.`longitude` as `lon2`, `caches`.`wp_oc`,\n `caches`.`type` as `cachetype`,\n `caches`.`size` as `cachesize`\n FROM `notify_waiting`, `caches`, `user`, `user` `user2`\n WHERE `notify_waiting`.`cache_id`=`caches`.`cache_id`\n AND `notify_waiting`.`user_id`=`user2`.`user_id`\n AND `caches`.`user_id`=`user`.`user_id`\n AND `notify_waiting`.`id` > :1\n ORDER BY `notify_waiting`.`id`\n LIMIT 0,100\n"; /* init caches container */ $cacheCntainer = cache::instance(); $cacheTypes = $cacheCntainer->getCacheTypes(); $cacheSizes = $cacheCntainer->getCacheSizes(); $cacheTypeIcons = $cacheCntainer->getCacheTypeIcons(); $id = 0; do { $db->multiVariableQuery($rsNotifyQuery, $id); $rsNotify = $db->dbResultFetchAll(); foreach ($rsNotify as $rNotify) { $id = $rNotify['id']; /* send out everything that has to be sent */ if (process_new_cache($rNotify) == 0) { $db->multiVariableQuery("DELETE FROM `notify_waiting` WHERE `id` =:1", $rNotify['id']); } } if (count($rsNotify) > 0) { sleep(5); } else { break; } } while (true); // Release lock fclose($lock_file); function process_new_cache($notify) { global $mailfrom, $mailsubject, $debug, $debug_mailto, $rootpath, $octeamEmailsSignature, $absolute_server_URI, $site_name, $dateFormat, $cacheTypes, $cacheSizes, $cacheTypeIcons; $fehler = false;