public function Update(SplSubject $Subject)
 {
     $Status = $Subject->getStatus();
     //retrieve status array
     $Results = $Status['Results'];
     $Sender = $Status['Sender'];
     if (isset($Results[$this->Name])) {
         if (isset($Results[$this->Name]['matches'])) {
             $Sanitized = $this->ValidateInputs();
             //get offset
             $Matches = $this->GetSQLData($Sanitized['ResultFormat'], $Results[$this->Name]['matches']);
             // $Matches = $this->HighLightResults($Matches, $Results[$this->Name]['query'], $this->Settings['Admin']->BuildExcerptsTitleEnable, $this->Settings['Admin']->BuildExcerptsBodyEnable);
             $Matches = $this->HighLightResults($Matches, $Results[$this->Name]['query'], true, true);
             // Highlighting is ALWAYS enabled
             $Results[$this->Name]['matches'] = $Matches;
         }
         $Sender->SetData($this->Name, $Results[$this->Name]);
         //still set the data even if no total found
         if (!isset($Results[$this->Name]['total_found'])) {
             $Total = 0;
         } else {
             $Total = $Results[$this->Name]['total_found'];
         }
         if ($Total > $this->Settings['Admin']->MaxMatches) {
             $Total = $this->Settings['Admin']->MaxMatches;
         }
         //total_found is applied BEFORE setLimits and maxmatches take affect. We want to limit
         //pagination results to the max matches that sphinx will return...or else some pages will have a blank result set
         $this->BuildPager($Sender, $Total);
     }
 }
Example #2
0
 public function update(\SplSubject $subject)
 {
     $status = $subject->getStatus();
     if (!in_array(gettype($status), array("object", "resource"))) {
         $this->write($status);
     }
     if (is_a($status, 'Devtools\\Assertion')) {
         $this->write($status->message, $status->test);
     }
 }
 public function Update(SplSubject $Subject)
 {
     $Status = $Subject->getStatus();
     //retrieve status array
     $Results = $Status['Results'];
     $Sender = $Status['Sender'];
     if (isset($Results[$this->Name])) {
         if (isset($Results[$this->Name]['matches'])) {
             // print_r($Results[$this->Name]['matches']); die;
             $Formatted = $this->ToString($Results[$this->Name]['matches']);
             $Module = new MemberModule($Formatted);
             $Sender->AddModule($Module);
         }
     }
 }
 public function Update(SplSubject $Subject)
 {
     $Status = $Subject->getStatus();
     //retrieve status array
     $Results = $Status['Results'];
     $Sender = $Status['Sender'];
     //store stats ...perform this after the search since we grab the indivdual search words
     //that sphinx has search against. This saves us processing time of each and seperating other things
     if ($Sender->ControllerName == 'searchcontroller') {
         if (isset($Results['MainSearch']['words'])) {
             $this->InsertStats($Results['MainSearch']['words']);
         }
         if (isset($Results[$this->NameTKeywords]['matches'])) {
             $SingleKeywords = $this->SingleKeywords($Results[$this->NameTKeywords], $this->Settings['Admin']->LimitTopKeywords);
             //single keywords (apple, vanilla, cool)
             foreach ($SingleKeywords as $Row) {
                 $KeywordsArray[] = $Row->keywords;
             }
             if (isset($KeywordsArray)) {
                 $Module = new KeywordsCloudModule($KeywordsArray);
                 $Sender->AddModule($Module);
             }
         }
         if (isset($Results[$this->NameTSearches]['matches'])) {
             $TopSearches = $this->FullSearches($Results[$this->NameTSearches], $this->Settings['Admin']->LimitTopSearches);
             $Module = new TopSearchesModule($TopSearches);
             $Sender->AddModule($Module);
         }
         if (isset($Results[$this->NameRSearches]['matches'])) {
             $RelatedSearches = $this->FullSearches($Results[$this->NameRSearches], $this->Settings['Admin']->LimitRelatedSearches);
             // full search ("vanllia is cool")
             $Module = new RelatedSearchesModule($RelatedSearches);
             $Sender->AddModule($Module);
         }
     } else {
         if (isset($Results[$this->NameTMainSearches]['matches'])) {
             SaveToConfig('Plugin.SphinxSearch.IndexerMainTotal', $Results[$this->NameTMainSearches]['total_found']);
         } else {
             if (isset($Results[$this->NameTDeltaSearches]['matches'])) {
                 SaveToConfig('Plugin.SphinxSearch.IndexerDeltaTotal', $Results[$this->NameTDeltaSearches]['total_found']);
             } else {
                 if (isset($Results[$this->NameTStatsSearches]['matches'])) {
                     SaveToConfig('Plugin.SphinxSearch.IndexerStatsTotal', $Results[$this->NameTStatsSearches]['total_found']);
                 }
             }
         }
     }
 }
 public function Update(SplSubject $Subject)
 {
     $Status = $Subject->getStatus();
     //retrieve status array
     $Results = $Status['Results'];
     $Sender = $Status['Sender'];
     if (isset($Results[$this->Name])) {
         if ($this->Settings['Admin']->LimitRelatedThreadsMain > 0) {
             if (isset($Results[$this->Name]['matches'])) {
                 $Matches = $this->GetSQLData('simple', $Results[$this->Name]['matches']);
                 $Module = new RelatedThreadsModule($Matches);
                 $Sender->AddModule($Module);
             }
         }
     }
 }
 public function Update(SplSubject $Subject)
 {
     $Status = $Subject->getStatus();
     //retrieve status array
     $Results = $Status['Results'];
     $Sender = $Status['Sender'];
     if ($Sender->ControllerName == 'searchcontroller' && isset($Results['MainSearch']['words']) && !(empty($_GET) || isset($_GET['tar']))) {
         if ($this->Settings['Admin']->MainHitBoxEnable > 0) {
             //is the hitbox enabled?
             if (sizeof($Results['MainSearch']['words']) > 0) {
                 $Module = new HitBoxModule($Results['MainSearch']['words']);
                 $Sender->AddModule($Module);
             }
         }
     }
 }
 public function Update(SplSubject $Subject)
 {
     $Status = $Subject->getStatus();
     //retrieve status array
     $Latest = $Status[sizeof($Status) - 1];
     $ClassName = GetValue('Name', $Latest);
     $Priority = GetValue('Priority', $Latest);
     $Name = GetValue('SettingsName', $Latest);
     $Value = GetValue('Value', $Latest);
     //echo SPHINX_PREFIX.$Name.$Value.',  ';
     switch ($ClassName) {
         case 'Service':
             //class.sphinxsearchinstall.php
         //class.sphinxsearchinstall.php
         case 'Install':
         default:
             if ($Priority != SS_FATAL_ERROR) {
                 SaveToConfig('Plugin.SphinxSearch.' . $Name, $Value);
             } else {
                 if ($Name) {
                     //if this is given, assume that the value will be FALSE
                     SaveToConfig('Plugin.SphinxSearch.' . $Name, FALSE);
                 }
                 //non recoverable error has occured
             }
             break;
     }
     // @todo if the logger is not created with a valid sender and view file for error messages, simply don't display them
     if ($Priority == SS_FATAL_ERROR && ($this->Sender != null && $this->View != null)) {
         $Msg = GetValue('Message', $Latest);
         //If an error, must handle this immidiatl to stop program flow from continuing
         if (isset($Msg)) {
             $this->Sender->Form->AddError($Msg, $Name);
         } else {
             $this->Sender->Form->AddError('An error has occured in ' . $ClassName);
         }
         if (is_null($this->Sender)) {
             throw new Exception($Msg);
         } else {
             $this->Sender->Render($this->View);
             die;
             //this is important
         }
     }
 }
 public function Update(SplSubject $Subject)
 {
     $Status = $Subject->getStatus();
     //retrieve status array
     $Results = $Status['Results'];
     $Sender = $Status['Sender'];
     if ($Sender->ControllerName == 'discussioncontroller') {
         //this is here since 'Update' will be called in 'base_render_before' as well as any handlers
         //that wish to use the results somewhere on the page. This line makes sure to not display the
         //related threads on each 'discussioncontroller' page. Base_redner_before -> Update will pass
         //the results in an assocated result with the name being the key. Handlers should NOT do this, but
         //rather pass in the result directly
         //@todo this only works right now because only use one event handler - FIX THIS
         if (!isset($Results[$this->Name])) {
             // the '!' is important here
             if ($this->Settings['Admin']->LimitRelatedThreadsBottomDiscussion > 0) {
                 //put it on the bottom
                 // Since Bottom threads and sidebar thread widgets both execute the same query, they share the same query LIMIT.
                 // The query limit will use the largest of the two LIMIT settings and then adjust accordingly here. If one is larger
                 // than the other, the smaller request will simply "slice" the array into a smaller chunk.
                 $AllMatches = $this->GetSQLData($this->Settings['Admin']->RelatedThreadsBottomDiscussionFormat, GetValue('matches', $Results));
                 $Matches = array_slice($AllMatches, 0, $this->Settings['Admin']->LimitRelatedThreadsBottomDiscussion, $preserve_keys = true);
                 $String = $this->ToString($Matches);
                 echo $String;
             }
         } else {
             if ($this->Settings['Admin']->LimitRelatedThreadsSidebarDiscussion > 0) {
                 //put it on the sidebar
                 // See above for explanation on the array_slice reasoning
                 $AllMatches = $this->GetSQLData('simple', GetValue('matches', $Results[$this->Name]));
                 $Matches = array_slice($AllMatches, 0, $this->Settings['Admin']->LimitRelatedThreadsSidebarDiscussion, $preserve_keys = true);
                 $Module = new RelatedDiscussionModule($this->ToString($Matches, TRUE));
                 $Sender->AddModule($Module);
             }
             //first time seeing this after 'base_render_before'...must set the data on the view
             $Sender->SetData($this->Name, $Results[$this->Name]);
         }
     }
 }
Example #9
0
 public function update(\SplSubject $subject)
 {
     $this->write($subject->getStatus());
 }
Example #10
0
 public function update(\SplSubject $subject)
 {
     $subject->getStatus();
 }