Index: branches/5.2.x/units/link_validation/link_validation_eh.php =================================================================== diff -u -N -r13842 -r14100 --- branches/5.2.x/units/link_validation/link_validation_eh.php (.../link_validation_eh.php) (revision 13842) +++ branches/5.2.x/units/link_validation/link_validation_eh.php (.../link_validation_eh.php) (revision 14100) @@ -1,6 +1,6 @@ status = erPERM_FAIL; + $event->status = kEvent::erPERM_FAIL; } } @@ -222,7 +222,7 @@ if ($from_ajax) { echo $validation_data['processed'] / $validation_data['total'] * 100; - $event->status = erSTOP; + $event->status = kEvent::erSTOP; } return false; @@ -404,7 +404,7 @@ function iterateItems(&$event) { if ($this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1)) { - $event->status = erFAIL; + $event->status = kEvent::erFAIL; return; } @@ -430,7 +430,7 @@ } if (!$ret) { - $event->status = erFAIL; + $event->status = kEvent::erFAIL; $event->redirect = false; break; } @@ -445,7 +445,7 @@ function OnDeleteLinks(&$event) { if ($this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1)) { - $event->status = erFAIL; + $event->status = kEvent::erFAIL; return; } Index: branches/5.2.x/units/listings/listings_event_handler.php =================================================================== diff -u -N -r13842 -r14100 --- branches/5.2.x/units/listings/listings_event_handler.php (.../listings_event_handler.php) (revision 13842) +++ branches/5.2.x/units/listings/listings_event_handler.php (.../listings_event_handler.php) (revision 14100) @@ -1,6 +1,6 @@ Load($resource_id, 'ItemResourceId'); if ($object->isLoaded()) { - $original_values = $object->FieldValues; + $original_values = $object->GetFieldValues(); } else { // set initial fields to listing @@ -359,7 +359,7 @@ $action = $object->isLoaded() ? 'Update' : 'Create'; if ($object->$action()) { - $event->status = erSUCCESS; + $event->status = kEvent::erSUCCESS; switch ($event->Name) { case 'EnhanceLinkAfterOrderApprove': case 'EnhancedLinkOnCompleteOrder': @@ -383,7 +383,7 @@ } else { - $event->status = erFAIL; + $event->status = kEvent::erFAIL; } @@ -477,20 +477,25 @@ WHERE ItemResourceId = '.$item_data['LinkId']; $listing_id = $this->Conn->GetOne($sql); $object->Load($listing_id); - $original_values = $object->FieldValues; + $original_values = $object->GetFieldValues(); $object->SetDBField('Status', 2); if($object->Update()) { - $event->status = erSUCCESS; + $event->status = kEvent::erSUCCESS; $this->ResetLink($original_values); } else { - $event->status = erFAIL; + $event->status = kEvent::erFAIL; } } + /** + * Enter description here... + * + * @param kEvent $event + */ function iterateItems(&$event) { $object =& $event->getObject( Array('skip_autoload' => true) ); @@ -500,7 +505,7 @@ foreach ($ids as $id) { $object->Load($id); if ($object->GetDBField('Status') != STATUS_ACTIVE) { - $original_values = $object->FieldValues; + $original_values = $object->GetFieldValues(); $object->SetDBField('Status', STATUS_ACTIVE); $this->EnhanceLink($object, $original_values); } @@ -511,7 +516,7 @@ foreach ($ids as $id) { $object->Load($id); if ($object->GetDBField('Status') == STATUS_ACTIVE) { - $original_values = $object->FieldValues; + $original_values = $object->GetFieldValues(); $this->ResetLink($original_values); $sql = 'SELECT CreatedById @@ -559,13 +564,13 @@ $object->SetDBField('PendingRenewal', 0); if ($object->Update()) { - $event->status = erSUCCESS; - $event->redirect_params = Array('opener' => 's'); //stay! + $event->status = kEvent::erSUCCESS; + $event->setRedirectParams(Array('opener' => 's'), true); $email_event_user =& $this->Application->EmailEventUser('LINK.ENHANCE.RENEW', $owner_id); $email_event_admin =& $this->Application->EmailEventAdmin('LINK.ENHANCE.RENEW'); } else { - $event->status=erFAIL; + $event->status=kEvent::erFAIL; $event->redirect=false; break; } @@ -609,7 +614,7 @@ $resource_id = $this->Conn->GetOne($sql); if (!$resource_id) { - $event->status = erFAIL; + $event->status = kEvent::erFAIL; return false; } @@ -640,6 +645,11 @@ $email_event_admin =& $this->Application->EmailEventAdmin('LINK.ENHANCE.EXTEND'); } + /** + * Cancels enhancement + * + * @param kEvent $event + */ function OnCancelEnhancement(&$event) { $listing_id = $this->verifyListingOwner($event); @@ -650,7 +660,7 @@ $object =& $event->getObject( Array('skip_autoload' => true) ); $object->Load($listing_id); - $original_values = $object->FieldValues; + $original_values = $object->GetFieldValues(); $original_values['Status'] = 1; $this->ResetLink($original_values); @@ -663,6 +673,11 @@ $event->redirect = $this->Application->GetVar('success_template'); } + /** + * Checks expired paid listings + * + * @param kEvent $event + */ function OnCheckExpiredPaidListings(&$event) { $sql = 'SELECT ListingId FROM '.$this->Application->getUnitOption($event->Prefix, 'TableName').' @@ -671,10 +686,12 @@ if(is_array($expired_listings) && count($expired_listings) > 0) { $object =& $this->Application->recallObject($event->Prefix.'.-item', null, Array('skip_autoload' => true)); + /* @var $object kDBItem */ + foreach($expired_listings as $listing_id) { $object->Load($listing_id); - $original_values = $object->FieldValues; + $original_values = $object->GetFieldValues(); $this->ResetLink($original_values); $object->SetDBField('Status', 2); $object->Update(); @@ -711,6 +728,11 @@ } } + /** + * Removes enhancements on listing delete + * + * @param kEvent $event + */ function OnMassDelete(&$event) { $object =& $event->getObject( Array('skip_autoload' => true) ); @@ -721,7 +743,7 @@ $object->Load($id); if($object->GetDBField('Status') == 1) { - $original_values = $object->FieldValues; + $original_values = $object->GetFieldValues(); $this->ResetLink($original_values); } } Index: branches/5.2.x/install/upgrades.php =================================================================== diff -u -N -r14090 -r14100 --- branches/5.2.x/install/upgrades.php (.../upgrades.php) (revision 14090) +++ branches/5.2.x/install/upgrades.php (.../upgrades.php) (revision 14100) @@ -1,6 +1,6 @@ dependencies = Array ( '4.3.9' => Array ('Core' => '4.3.9'), Index: branches/5.2.x/units/links/links_event_handler.php =================================================================== diff -u -N -r13842 -r14100 --- branches/5.2.x/units/links/links_event_handler.php (.../links_event_handler.php) (revision 13842) +++ branches/5.2.x/units/links/links_event_handler.php (.../links_event_handler.php) (revision 14100) @@ -1,6 +1,6 @@ getObject(); + /* @var $object kDBList */ if (!$this->Application->isAdminUser) { $object->addFilter('expire_filter', '(Expire > '.adodb_mktime().' OR Expire IS NULL)'); @@ -60,7 +61,7 @@ foreach ($grouping as $group_field) { $object->AddGroupByField($object->TableName.'.'.$group_field); } - $object->addFilter('has_dupes_filter', 'DupeCount > 1', AGGREGATE_FILTER, FLT_SYSTEM); + $object->addFilter('has_dupes_filter', 'DupeCount > 1', kDBList::AGGREGATE_FILTER); break; case 'duplicates-sub': @@ -165,7 +166,7 @@ } else { - $event->status = erFAIL; + $event->status = kEvent::erFAIL; $event->redirect = false; $this->Application->SetVar($event->getPrefixSpecial().'_error', 1); } @@ -193,19 +194,19 @@ { parent::OnCreate($event); - if ($event->status == erSUCCESS) { + if ($event->status == kEvent::erSUCCESS) { $object =& $event->getObject(); /* @var $object kDBItem */ // replace 0 id in post with actual created id (used in enhancement process) $items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) ); - array_rename_key($items_info, 0, $object->GetID()); + kUtil::array_rename_key($items_info, 0, $object->GetID()); $this->Application->SetVar($event->getPrefixSpecial(true), $items_info); // listing was created -> enhance it right away $enhancement_event = new kEvent('ls:OnRequestEnhancement'); $this->Application->HandleEvent($enhancement_event); - if (($enhancement_event->status == erSUCCESS) && strlen($enhancement_event->redirect)) { + if (($enhancement_event->status == kEvent::erSUCCESS) && strlen($enhancement_event->redirect)) { $event->SetRedirectParam('next_template', $event->redirect); $event->redirect = $enhancement_event->redirect; } @@ -273,21 +274,21 @@ /* @var $captcha_helper kCaptchaHelper */ $this->Application->StoreVar($event->Prefix . '_captcha_code', $captcha_helper->GenerateCaptchaCode()); - $event->status = erFAIL; + $event->status = kEvent::erFAIL; $event->redirect = false; } } // email validation elseif (!strlen($field_value) || ($field_name == 'ContactFormEmail' && !preg_match('/'.REGEX_EMAIL_USER.'@'.REGEX_EMAIL_DOMAIN.'/', $field_value))) { $this->Application->SetVar('error_'.$field_name, 1); - $event->status = erFAIL; + $event->status = kEvent::erFAIL; $event->redirect = false; } } } - if ($event->status != erSUCCESS) { + if ($event->status != kEvent::erSUCCESS) { // set errors var $this->Application->SetVar('ContactForm_HasErrors', 1); return ; @@ -306,7 +307,7 @@ $email_event =& $this->Application->EmailEventUser('LINK.CONTACTFORM', $object->GetDBField('CreatedById'), $send_params); - if ($email_event->status == erSUCCESS) { + if ($email_event->status == kEvent::erSUCCESS) { $event->redirect = $this->Application->GetVar('success_template'); $redirect_params = Array ( @@ -321,7 +322,7 @@ } else { $this->Application->SetVar('error_ContactFormEmail', 1); - $event->status = erFAIL; + $event->status = kEvent::erFAIL; $event->redirect = false; } } Index: branches/5.2.x/units/links/links_config.php =================================================================== diff -u -N -r14090 -r14100 --- branches/5.2.x/units/links/links_config.php (.../links_config.php) (revision 14090) +++ branches/5.2.x/units/links/links_config.php (.../links_config.php) (revision 14100) @@ -1,6 +1,6 @@ Array ( 'Groups' => Array ( - Array ('mode' => 'AND', 'filters' => Array ('show_new'), 'type' => HAVING_FILTER), - Array ('mode' => 'AND', 'filters' => Array ('show_hot'), 'type' => HAVING_FILTER), - Array ('mode' => 'AND', 'filters' => Array ('show_pop'), 'type' => HAVING_FILTER), - Array ('mode' => 'AND', 'filters' => Array ('show_pick'), 'type' => WHERE_FILTER), + Array ('mode' => 'AND', 'filters' => Array ('show_new'), 'type' => kDBList::HAVING_FILTER), + Array ('mode' => 'AND', 'filters' => Array ('show_hot'), 'type' => kDBList::HAVING_FILTER), + Array ('mode' => 'AND', 'filters' => Array ('show_pop'), 'type' => kDBList::HAVING_FILTER), + Array ('mode' => 'AND', 'filters' => Array ('show_pick'), 'type' => kDBList::WHERE_FILTER), ), 'Filters' => Array ( 'show_new' => Array ('label' => 'la_Text_New', 'on_sql' => '', 'off_sql' => '`IsNew` != 1' ), Index: branches/5.2.x/units/links/link_tag_processor.php =================================================================== diff -u -N -r13842 -r14100 --- branches/5.2.x/units/links/link_tag_processor.php (.../link_tag_processor.php) (revision 13842) +++ branches/5.2.x/units/links/link_tag_processor.php (.../link_tag_processor.php) (revision 14100) @@ -1,6 +1,6 @@ isLoaded()) { - trigger_error('No Link ID for redirect', E_USER_ERROR); + throw new Exception('No Link ID for redirect'); } $object->RegisterHit();