function ProcessDeal($D, $SID, $SName, $SRID, $LID, $CID, $Lat, $Lng) { //Remove HTML from all text strings foreach ($D as &$DItem) { if (!(is_numeric($DItem) || is_array($DItem))) { $DItem = StringAdjust(CleanHTML($DItem)); } } //Remove broken or incomplete addresses foreach ($D['Locations'] as &$DLoc) { if (strlen($DLoc[0]) < 10 || substr_count($DLoc[0], ' ') < 3) { $DLoc[0] = null; } } if (strlen($D['Title']) < 15) { return SysLogIt('Title appears too short. Check parser.', StatusError); } if ($D['Price'] > $D['Value']) { return SysLogIt('Prices appear invalid. Check parser.', StatusError); } if (time() + 30 * 24 * 60 * 60 < $D['EDate']) { return SysLogIt('End date too far into future. Check parser.', StatusError); } if (trim($D['DRID']) == '') { return SysLogIt('ID is invalid. Check parser.', StatusError); } if (trim($D['StoreName']) == '') { return SysLogIt('Store name is invalid. Check parser.', StatusError); } //Match category $TypeID = (int) GetTypeFromKeywords($D['StoreName'] . ' ' . $D['Title'] . ' ' . $D['Descr']); $DoHist = false; if ($StoreID = GetStoreID($SID, $TypeID, $D['StoreName'], $D['Website'], $D['Locations'], $CID, $Lat, $Lng, $DoHist)) { if ($DealID = GetDealID($SID, $LID, $CID, $StoreID, $D, $DoHist)) { SysLogIt('Successfully parsed a deal for division with ID of ' . $SRID . '.'); } } }
$login_disp->Dispatch(); } if ($GLOBALS['gEnv']['core']['config']->Value('ONLY_HTTPS_SITE_ACCESS') == '1') { if (!isset($_SERVER['HTTPS']) or $_SERVER['HTTPS'] != 'on') { DoAuth(true, 'only_https_allowed'); } } if (!isset($_SESSION['AMP_AUTH_USER'])) { DoAuth(); } $sitesquery = $gEnv['root']['db']->Execute('SELECT id FROM sites WHERE siteid=' . $gEnv['root']['db']->Format_Text(GetStoreID($gEnv['root']['db'], $_SESSION['AMP_AUTH_USER']))); if ($sitesquery->NumRows() == 0) { DoAuth(); } else { $sitesquery->Free(); $amp->startSite(GetStoreID($gEnv['root']['db'], $_SESSION['AMP_AUTH_USER']), $_SESSION['AMP_AUTH_USER']); } if (isset($_SESSION['site_login_attempts'])) { unset($_SESSION['site_login_attempts']); } // Check if the site is enabled // if ($gEnv['site']['data']['siteactive'] != $gEnv['root']['db']->fmttrue) { DoAuth(true, 'sitedisabled'); } // Must exit if the user called a page for which he isn't enabled // Carthag::import('com.solarix.ampoliros.site.user.Permissions'); $perm = new Permissions($gEnv['site']['db'], $gEnv['user']['group']); // :KLUDGE: evil 20020503: strpos() instead of strrpos() // Use strrpos() instead of strpos().