Hello John,

On Tue, 7 Aug 2012 20:27:19 +1000, John Kenyon wrote:
Hi Janos,

I am also getting the exact same errors in my logs as Oleg…


just to spare you from typing I attached a debug version of
bulkrestore.php.

I'd like both of you to do the following:

1. overwrite controller/message/bulkrestore.php with the attached file.
2. login as an auditor user then hit the search button to have some results
3. click on the blue download icon. You'll get a raw page with some php
messages. View the page source, select everything, then send me the results

Then login as an ordinary user, and repeat steps 3. Both of you should send
me 2 attached files with the results.

Janos
<?php


class ControllerMessageBulkrestore extends Controller {

   public function index(){

      $this->id = "content";
      $this->template = "message/bulkrestore.tpl";
      $this->layout = "common/layout-empty";

      $request = Registry::get('request');
      $db = Registry::get('db');

      $this->load->model('search/search');
      $this->load->model('search/message');
      $this->load->model('message/restore');

      $this->load->model('user/user');
      $this->load->model('mail/mail');

      $this->document->title = $this->data['text_message'];

      if(!isset($this->request->post['idlist']) || $this->request->post['idlist'] == '') { die("no idlist parameter given"); }

print "idlist: " . $this->request->post['idlist'] . "\n";

      list($a, $idlist) = $this->model_search_search->check_your_permission_by_id_list(explode(",", $this->request->post['idlist']));

      $download = $this->request->post['download'];


      if($download == 1) {
print_r($idlist); exit;
         $this->model_message_restore->download_files_as_zip($idlist);
         exit;
      }


      $this->data['username'] = Registry::get('username');

      $rcpt = array();


      /* send the email to all the recipients of the original email if we are admin or auditor users */

      if(Registry::get('admin_user') == 1 || Registry::get('auditor_user') == 1) {
         $rcpt = $this->model_search_search->get_message_recipients($this->data['id']);
      }
      else {
         array_push($rcpt, $_SESSION['email']);
      }


      $this->data['restored'] = 0;

      foreach($idlist as $id) {

         AUDIT(ACTION_RESTORE_MESSAGE, '', '', $id, '');

         $x = $this->model_mail_mail->send_smtp_email(SMARTHOST, SMARTHOST_PORT, SMTP_DOMAIN, SMTP_FROMADDR, $rcpt, 
               "Received: by piler" . EOL . PILER_HEADER_FIELD . $id . EOL . $this->model_search_message->get_raw_message($id) );

         if($x == 1) { $this->data['restored']++; }
      }


      $this->render();
   }


}

?>

Reply via email to