function siteexport_sendfile(&$event, $args)
 {
     global $conf;
     if (empty($_REQUEST['siteexport'])) {
         return;
     }
     $functions = new siteexport_functions();
     $functions->settings->pattern = $_REQUEST['siteexport'];
     // Try injecting another name ... can't do, because sendFile sets this right after me and right before sending the actual data.
     // header('Content-Disposition: attachment; filename="'. basename($functions->settings->zipFile) .'";');
     // Try getting the cached file ...
     $event->data['file'] = $functions->getCacheFileNameForPattern();
     $functions->debug->message("fetching cached file from pattern '{$functions->settings->pattern}' with name '{$event->data['file']}'", null, 2);
     $functions->checkIfCacheFileExistsForFileWithPattern($event->data['file'], $_REQUEST['siteexport']);
 }
Exemple #2
0
 /**
  * let the plugin run!
  */
 public function run()
 {
     global $ID;
     global $INFO;
     $originalREquest = $_REQUEST;
     foreach ($this->cronPlugin->configuration as $name => $config) {
         // retrieve parameters
         list($id, $parameters) = explode('?', $config, 2);
         $function = new siteexport_functions(false);
         $_REQUEST = $function->parseStringToRequestArray($parameters, true);
         unset($function);
         $ID = $_REQUEST['id'] = cleanID($id);
         // re-set the ID
         // $ID = getID();
         // Lets start over!
         $this->siteexportAjax->__init_functions();
         $this->siteexportAjax->functions->settings->isCLI = true;
         $this->siteexportAjax->functions->settings->isAuthed = true;
         $INFO['perm'] = AUTH_DELETE;
         // Fake authentication
         // Fake security Token if none given
         if (empty($_REQUEST['sectok'])) {
             $_REQUEST['sectok'] = getSecurityToken();
         }
         $data = $this->siteexportAjax->__get_siteexport_list_and_init_tocs($ID);
         // If there is nothing in there - ignore. This may mean we have a valid cache
         if (count($data) == 0) {
             continue;
         }
         foreach ($data as $site) {
             // We want to create a specific file! - have to reset it every time in here
             // $_REQUEST['pattern'] = $name;
             $status = $this->siteexportAjax->__siteexport_add_site($site['id']);
         }
         $this->siteexportAjax->functions->checkIfCacheFileExistsForFileWithPattern($this->siteexportAjax->functions->getCacheFileNameForPattern(), $name);
         // Wat zum geier?
         $this->siteexportAjax->cleanCacheFiles();
     }
 }