Index: trunk/kernel/units/general/my_application.php =================================================================== diff -u -r2363 -r2368 --- trunk/kernel/units/general/my_application.php (.../my_application.php) (revision 2363) +++ trunk/kernel/units/general/my_application.php (.../my_application.php) (revision 2368) @@ -40,84 +40,6 @@ $this->SetVar('u_id', $user_id); $this->StoreVar('user_id', $user_id); } - - function RunScheduledEvents() - { - $events = Array('ls:OnCheckExpiredPaidListings', 'u:OnCheckExpiredMembership'); - $run_interval = 60 * 30; // in seconds - - if(rand(0, 100) < 90) - { - return; - } - - $sql = 'SELECT Data FROM '.TABLE_PREFIX.'Cache WHERE VarName = "LastMaintainRun"'; - $last_maintain = $this->DB->GetOne($sql); - if($last_maintain && $last_maintain > mktime() - $run_interval) - { - return; - } - elseif($last_maintain) - { - $sql = 'UPDATE '.TABLE_PREFIX.'Cache SET Data = "'.mktime().'" - WHERE VarName = "LastMaintainRun"'; - } - else - { - $sql = 'INSERT INTO '.TABLE_PREFIX.'Cache (VarName, Data, Cached) - VALUES ("LastMaintainRun", "'.mktime().'", "'.mktime().'")'; - } - $this->DB->Query($sql); - - foreach($events as $scheduled_event) - { - $event = new kEvent($scheduled_event); - $this->HandleEvent($event); - unset($event); - } - } - - /** - * Raise specific events based on non-standard (no described in config files) - * params given in url if no other params are given - * @todo by now is called before $event_manager->ProcessRequrest() method anyway - * @author Alex - */ - function ProcessSpecialURL() - { - $affiliate = $this->GetVar('affiliate'); - if($affiliate) - { - $user_idfield = $this->getUnitOption('u','IDField'); - $user_table = $this->getUnitOption('u','TableName'); - $sql = 'SELECT %s FROM %s WHERE (CRC32(Email) = %s) AND (Status = 1)'; - $user_id = $this->DB->GetOne( sprintf($sql, $user_idfield, $user_table, $this->DB->qstr($affiliate) ) ); - - if($user_id) // user is found with such email - { - $affiliate_user = $this->recallObject('u.affiliate', null, Array('skip_autoload'=>true) ); - $affiliate_user->Load($user_id); - - $user_groups = $affiliate_user->getMembershipGroups(true); - $affiliate_group_id = $this->ConfigValue('Comm_AffiliateGroup'); - if( is_array($user_groups) && in_array($affiliate_group_id, $user_groups) ) // user is really affiliate for a moment - { - $affiliate_storage_method = $this->ConfigValue('Comm_AffiliateStorageMethod'); - switch($affiliate_storage_method) - { - case 1: // per session - $this->StoreVar('affiliate_id', $user_id); - break; - - case 2: // in cookie - setcookie('affiliate_id', $user_id); - break; - } - } - } - $this->Redirect(); - } - } } ?> \ No newline at end of file