Example #1
0
 public function doAction()
 {
     $isAllTheme = $this->doorGets->getAllThemesName();
     $nameTheme = $this->doorGets->configWeb['theme'];
     $controllerName = 'theme';
     // get Content for edit / delete
     $params = $this->doorGets->Params();
     if (($this->Action === 'edit' || $this->Action === 'delete') && !array_key_exists('name', $params['GET'])) {
         header('Location:./?controller=' . $controllerName);
         exit;
     }
     $fileSelectedTo = '';
     $jsSAAS = $tplSAAS = false;
     if (array_key_exists('name', $params['GET'])) {
         $name = $params['GET']['name'];
         if (!in_array($name, $isAllTheme)) {
             header('Location:./?controller=' . $controllerName);
             exit;
         }
         $themeListe = $this->doorGets->listThemeFiles($name);
         $fileContent = $urlFile = '';
         $fileSelected = $nameTheme . '/css/doorgets.css';
         if (array_key_exists('file', $params['GET'])) {
             $fileSelected = $params['GET']['file'];
         }
         if (array_key_exists($fileSelected, $themeListe['js'])) {
             $fileContent = @file_get_contents(THEME . $fileSelected);
             $jsSAAS = true;
         } elseif (array_key_exists($fileSelected, $themeListe['css'])) {
             $fileContent = @file_get_contents(THEME . $fileSelected);
         } elseif (array_key_exists($fileSelected, $themeListe['tpl'])) {
             $fileContent = @file_get_contents(THEME . $fileSelected);
             $tplSAAS = true;
         }
     }
     if ($this->Action === 'edit' && !is_file(THEME . $fileSelected) || SAAS_ENV && $tplSAAS || SAAS_ENV && !SAAS_THEME_JS && $jsSAAS) {
         header('Location:?controller=theme&action=edit&name=' . $name . '&file=' . $nameTheme . '/css/doorgets.css');
         exit;
     }
     switch ($this->Action) {
         case 'index':
             if (!empty($this->doorGets->Form->i)) {
                 $this->doorGets->checkMode();
                 if (empty($this->doorGets->Form->e)) {
                     $dDefault['theme'] = $this->doorGets->Form->i['theme'];
                     $this->doorGets->dbQU(1, $dDefault, '_website');
                     //$this->doorGets->clearDBCache();
                     FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour"));
                     header("Location:" . $_SERVER['REQUEST_URI']);
                     exit;
                 }
                 FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error");
             }
             break;
         case 'add':
             $form = $this->doorGets->Form;
             if (!empty($form->i)) {
                 $this->doorGets->checkMode();
                 // gestion de l'uri
                 $lenUri = strlen($form->i['titre']);
                 $isUriValide = ctype_alnum($form->i['titre']);
                 if (empty($isUriValide) || $lenUri > 250) {
                     $this->doorGets->Form->e['add_theme_titre'] = 'ok';
                 }
                 if (in_array($form->i['titre'], $isAllTheme)) {
                     $this->doorGets->Form->e['add_theme_titre'] = 'ok';
                 }
                 if (in_array($form->i['theme'], $isAllTheme) && empty($this->doorGets->Form->e)) {
                     $form->i['titre'] = strtolower($form->i['titre']);
                     // add to default theme
                     if (array_key_exists('defaut', $form->i)) {
                         $data['theme'] = $form->i['titre'];
                         $this->doorGets->dbQU(1, $data, '_website');
                         //$this->doorGets->clearDBCache();
                     }
                     // Duplicate theme
                     $this->doorGets->duplicateTheme($form->i['theme'], $form->i['titre']);
                     FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour"));
                     header('Location:./?controller=theme&action=edit&name=' . $form->i['titre']);
                     exit;
                 }
                 FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error");
             }
             break;
         case 'import':
             $form = $this->doorGets->Form;
             // vdump($form->i);
             if (!empty($form->i) && !SAAS_ENV) {
                 $this->doorGets->checkMode();
                 $newname = 'doorgets' . time();
                 $dirTheme = BASE . 'themes/';
                 if (array_key_exists('import_theme_file', $_FILES) && $_FILES["import_theme_file"]["name"]) {
                     $filename = $_FILES["import_theme_file"]["name"];
                     $source = $_FILES["import_theme_file"]["tmp_name"];
                     $type = $_FILES["import_theme_file"]["type"];
                     $name = explode(".", $filename);
                     $accepted_types = array('application/zip', 'application/x-zip-compressed', 'multipart/x-zip', 'application/x-compressed');
                     foreach ($accepted_types as $mime_type) {
                         if ($mime_type == $type) {
                             $okay = true;
                             break;
                         }
                     }
                     $fileName = strtolower($name[0]);
                     $newname = trim(str_replace(array('doorgets', 'cms', ' '), '', $fileName));
                     if (is_dir($dirTheme . $newname)) {
                         $newname = 'doorgets' . uniqid();
                     }
                     $continue = strtolower($name[1]) == 'zip' ? true : false;
                     if (!$continue) {
                         $this->doorGets->Form->e['import_theme_file'] = 'ok';
                     }
                 } else {
                     $this->doorGets->Form->e['import_theme_file'] = 'ok';
                 }
                 if (empty($this->doorGets->Form->e)) {
                     $entries = array();
                     $target_path = $dirTheme . $fileName;
                     if (move_uploaded_file($source, $target_path)) {
                         $zip = new ZipArchive();
                         $x = $zip->open($target_path);
                         if ($x === true) {
                             $dir = trim($zip->getNameIndex(0));
                             for ($i = 0; $i < $zip->numFiles; $i++) {
                                 $entries[] = $zip->getNameIndex($i);
                             }
                             $fo = '';
                             if (array_key_exists(0, $entries)) {
                                 $fo = $entries[0];
                             }
                             $zip->extractTo($dirTheme . '/');
                             $zip->close();
                             @unlink($target_path);
                         }
                     } else {
                         $this->doorGets->Form->e['import_theme_file'] = 'ok';
                     }
                 }
                 if (empty($this->doorGets->Form->e)) {
                     FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour"));
                     header('Location:./?controller=theme&action=edit&name=' . $newname);
                     exit;
                 }
                 FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error");
             }
             break;
         case 'edit':
             $form = $this->doorGets->Form['edit'];
             if (!empty($form->i)) {
                 $this->doorGets->checkMode();
                 $urlFile = THEME . $fileSelected;
                 // NO FILTER BECAUSE SAVED IN FILE :)
                 $fileContent = $_POST['theme_content_nofi'];
                 @file_put_contents($urlFile, $fileContent);
                 $websiteData = array('theme_bootstrap' => $form->i['bootstrap_version']);
                 $this->doorGets->dbQU(Constant::$websiteId, $websiteData, '_website');
                 FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour"));
                 header("Location:" . $_SERVER['REQUEST_URI']);
                 exit;
             }
             $formDownload = $this->doorGets->Form['download'];
             if (!empty($formDownload->i)) {
                 $this->doorGets->checkMode();
                 $archiveFileName = ucfirst($name) . ' doorGets CMS Template.zip';
                 $zip = new ZipDir();
                 $res = $zip->open($archiveFileName, ZipArchive::CREATE);
                 if ($res === TRUE) {
                     $zip->addDir(BASE . "themes/{$name}/", "{$name}/");
                 }
                 $zip->close();
                 header("Content-type: application/zip");
                 header("Content-Disposition: attachment; filename={$archiveFileName}");
                 header("Content-length: " . filesize($archiveFileName));
                 header("Pragma: no-cache");
                 header("Expires: 0");
                 @readfile("{$archiveFileName}");
             }
             break;
         case 'delete':
             $form = $this->doorGets->Form;
             if (!empty($form->i)) {
                 $this->doorGets->checkMode();
                 $this->doorGets->deleteTheme($form->i['theme']);
                 FlashInfo::set($this->doorGets->__("Un thème a été supprimé"));
                 header('Location:./?controller=theme');
             }
             break;
     }
 }
Example #2
0
 private function genExportMatrice()
 {
     $arrayCatInc = array('blog', 'news', 'multipage', 'video', 'image', 'faq', 'partner', 'genform', 'sharedlinks');
     $arrayExclude = array('_dg_translator', '_dg_translator_traduction', '_dg_translator_version');
     include CONFIGURATION . 'tables.php';
     $isAllModule = $this->dbQ("SELECT id,uri,type,extras FROM _modules ORDER BY id DESC LIMIT 200");
     $cAllModule = count($isAllModule);
     if (!empty($isAllModule)) {
         for ($i = 0; $i < $cAllModule; $i++) {
             if (in_array($isAllModule[$i]['type'], $arrayCatInc)) {
                 $isAllModule[$i]['uri'] = $this->getRealUri($isAllModule[$i]['uri']);
                 $table['_m_' . $isAllModule[$i]['uri']]['count'] = 0;
                 $table['_m_' . $isAllModule[$i]['uri']]['type'] = $isAllModule[$i]['type'];
                 switch ($isAllModule[$i]['type']) {
                     case 'faq':
                         $table['_m_' . $isAllModule[$i]['uri']]['sql_create_table'] = $this->createSqlFaq($isAllModule[$i]['uri']);
                         break;
                     case 'partner':
                         $table['_m_' . $isAllModule[$i]['uri']]['sql_create_table'] = $this->createSqlPartner($isAllModule[$i]['uri']);
                         break;
                     case 'image':
                         $table['_m_' . $isAllModule[$i]['uri']]['sql_create_table'] = $this->createSqlImage($isAllModule[$i]['uri']);
                         break;
                     case 'video':
                         $table['_m_' . $isAllModule[$i]['uri']]['sql_create_table'] = $this->createSqlVideo($isAllModule[$i]['uri']);
                         break;
                     case 'multipage':
                         $table['_m_' . $isAllModule[$i]['uri']]['sql_create_table'] = $this->createSqlMultipage($isAllModule[$i]['uri']);
                         break;
                     case 'news':
                         $table['_m_' . $isAllModule[$i]['uri']]['sql_create_table'] = $this->createSqlNews($isAllModule[$i]['uri']);
                         break;
                     case 'sharedlinks':
                         $table['_m_' . $isAllModule[$i]['uri']]['sql_create_table'] = $this->createSqlSharedlinks($isAllModule[$i]['uri']);
                         break;
                     case 'blog':
                         $table['_m_' . $isAllModule[$i]['uri']]['sql_create_table'] = $this->createSqlBlog($isAllModule[$i]['uri']);
                         break;
                     case 'genform':
                         $table['_m_' . $isAllModule[$i]['uri']]['sql_create_table'] = $this->createSqlGenform($isAllModule[$i]['uri'], unserialize($isAllModule[$i]['extras']));
                         break;
                 }
                 if ($isAllModule[$i]['type'] !== 'genform') {
                     $table['_m_' . $isAllModule[$i]['uri'] . '_traduction']['count'] = 0;
                     $table['_m_' . $isAllModule[$i]['uri'] . '_traduction']['type'] = $isAllModule[$i]['type'] . '_traduction';
                     $table['_m_' . $isAllModule[$i]['uri'] . '_traduction']['sql_create_table'] = '';
                     $table['_m_' . $isAllModule[$i]['uri'] . '_version']['count'] = 0;
                     $table['_m_' . $isAllModule[$i]['uri'] . '_version']['type'] = $isAllModule[$i]['type'] . '_version';
                     $table['_m_' . $isAllModule[$i]['uri'] . '_version']['sql_create_table'] = '';
                 }
             }
         }
     }
     $timer = time();
     $tmpCode = uniqid() . "_" . $timer;
     // Création de l'archive zipper
     $filename = "doorGets_backup_{$tmpCode}.zip";
     $zip_file = BASE . "io/{$filename}";
     $json_file = BASE . "io/doorGets_backup_{$tmpCode}.json";
     $zipArchive = new ZipDir();
     $resArchive = $zipArchive->open($zip_file, ZipArchive::CREATE);
     if ($resArchive === TRUE) {
         // Création de la copie de la database
         $zipArchive->addEmptyDir('database/');
         $groupBy = 500;
         // Création des fichiers d'éxportation de la base
         foreach ($table as $name_table => $v) {
             if (!in_array($name_table, $arrayExclude)) {
                 $iTable = $this->dbQ('SELECT COUNT(*) as counter FROM ' . $name_table);
                 $table[$name_table]['count'] = (int) $iTable[0]['counter'];
                 $dirIoFile = 'database/' . $name_table . '/';
                 $zipArchive->addEmptyDir($dirIoFile);
                 $totalPosition = 0;
                 if ($table[$name_table]['count'] > $groupBy) {
                     $totalPosition = ceil($table[$name_table]['count'] / $groupBy);
                 }
                 for ($i = 0; $i < $totalPosition + 1; $i++) {
                     $initPos = $i ? $groupBy * $i : 0;
                     $valContent = $this->dbQA($name_table, " LIMIT {$initPos}, {$groupBy}");
                     $sqlToSave = '';
                     $fileNameSaved = $dirIoFile . $name_table . '-' . $i . '.php';
                     if (!empty($valContent)) {
                         $cValContentcount = count($valContent);
                         for ($j = 0; $j < $cValContentcount; $j++) {
                             $sqlToSave .= $this->dbVQI($valContent[$j], $name_table);
                         }
                         $sqlToSaveSerialized = serialize($sqlToSave);
                         $zipArchive->addFromString($fileNameSaved, $sqlToSaveSerialized);
                     }
                 }
             }
         }
         $tableInfo = serialize($table);
         $zipArchive->addFromString('database/doorgets.php', $tableInfo);
         $zipArchive->addDir(BASE . 'api', 'doorgets/api');
         $zipArchive->addDir(BASE . 'ajax', 'doorgets/ajax');
         $zipArchive->addDir(BASE . 'cache', 'doorgets/cache');
         $zipArchive->addDir(BASE . 'config', 'doorgets/config');
         $zipArchive->addDir(BASE . 'data', 'doorgets/data');
         $zipArchive->addDir(BASE . 'dg-user', 'doorgets/dg-user');
         $zipArchive->addDir(BASE . 'doorgets', 'doorgets/doorgets');
         $zipArchive->addDir(BASE . 'installer', 'doorgets/installer');
         $zipArchive->addDir(BASE . 'io', 'doorgets/io');
         $zipArchive->addDir(BASE . 'rss', 'doorgets/rss');
         $zipArchive->addDir(BASE . 'skin', 'doorgets/skin');
         $zipArchive->addDir(BASE . 't', 'doorgets/t');
         $zipArchive->addDir(BASE . 'oauth2', 'doorgets/oauth2');
         $zipArchive->addDir(BASE . 'themes', 'doorgets/themes');
         $zipArchive->addDir(BASE . 'update', 'doorgets/update');
         $zipArchive->addDir(BASE . 'u', 'doorgets/u');
         $zipArchive->addFile(BASE . 'index.php', 'doorgets/index.php');
         $zipArchive->addFile(BASE . 'favicon.ico', 'doorgets/favicon.ico');
         $zipArchive->close();
     }
     // Create json file for infos
     $this->dataInfo['file'] = $filename;
     if (file_put_contents($json_file, json_encode($this->dataInfo, JSON_PRETTY_PRINT))) {
         return true;
     }
     return false;
 }
Example #3
0
 private function genExportMatrice()
 {
     $arrayCatInc = array('blog', 'news', 'multipage', 'video', 'image', 'faq', 'partner', 'shop', 'genform', 'sharedlinks');
     $arrayExclude = array('_dg_translator', '_dg_translator_traduction', '_dg_translator_version');
     include CONFIGURATION . 'tables.php';
     $isAllModule = $this->dbQ("SELECT id,uri,type,extras FROM _modules ORDER BY id DESC LIMIT 1000");
     $cAllModule = count($isAllModule);
     if (!empty($isAllModule)) {
         for ($i = 0; $i < $cAllModule; $i++) {
             if (in_array($isAllModule[$i]['type'], $arrayCatInc)) {
                 $isAllModule[$i]['uri'] = $this->getRealUri($isAllModule[$i]['uri']);
                 $table['_m_' . $isAllModule[$i]['uri']]['count'] = 0;
                 $table['_m_' . $isAllModule[$i]['uri']]['type'] = $isAllModule[$i]['type'];
                 switch ($isAllModule[$i]['type']) {
                     case 'faq':
                         $table['_m_' . $isAllModule[$i]['uri']]['sql_create_table'] = $this->installDB->createSqlFaq($isAllModule[$i]['uri']);
                         break;
                     case 'partner':
                         $table['_m_' . $isAllModule[$i]['uri']]['sql_create_table'] = $this->installDB->createSqlPartner($isAllModule[$i]['uri']);
                         break;
                     case 'image':
                         $table['_m_' . $isAllModule[$i]['uri']]['sql_create_table'] = $this->installDB->createSqlImage($isAllModule[$i]['uri']);
                         break;
                     case 'video':
                         $table['_m_' . $isAllModule[$i]['uri']]['sql_create_table'] = $this->installDB->createSqlVideo($isAllModule[$i]['uri']);
                         break;
                     case 'multipage':
                         $table['_m_' . $isAllModule[$i]['uri']]['sql_create_table'] = $this->installDB->createSqlMultipage($isAllModule[$i]['uri']);
                         break;
                     case 'news':
                         $table['_m_' . $isAllModule[$i]['uri']]['sql_create_table'] = $this->installDB->createSqlNews($isAllModule[$i]['uri']);
                         break;
                     case 'sharedlinks':
                         $table['_m_' . $isAllModule[$i]['uri']]['sql_create_table'] = $this->installDB->createSqlSharedlinks($isAllModule[$i]['uri']);
                         break;
                     case 'blog':
                         $table['_m_' . $isAllModule[$i]['uri']]['sql_create_table'] = $this->installDB->createSqlBlog($isAllModule[$i]['uri']);
                         break;
                     case 'shop':
                         $table['_m_' . $isAllModule[$i]['uri']]['sql_create_table'] = $this->installDB->createSqlShop($isAllModule[$i]['uri']);
                         break;
                     case 'genform':
                         $table['_m_' . $isAllModule[$i]['uri']]['sql_create_table'] = $this->installDB->createSqlGenform($isAllModule[$i]['uri'], unserialize(base64_decode($isAllModule[$i]['extras'])));
                         break;
                 }
                 if ($isAllModule[$i]['type'] !== 'genform') {
                     $table['_m_' . $isAllModule[$i]['uri'] . '_traduction']['count'] = 0;
                     $table['_m_' . $isAllModule[$i]['uri'] . '_traduction']['type'] = $isAllModule[$i]['type'] . '_traduction';
                     $table['_m_' . $isAllModule[$i]['uri'] . '_traduction']['sql_create_table'] = '';
                     $table['_m_' . $isAllModule[$i]['uri'] . '_version']['count'] = 0;
                     $table['_m_' . $isAllModule[$i]['uri'] . '_version']['type'] = $isAllModule[$i]['type'] . '_version';
                     $table['_m_' . $isAllModule[$i]['uri'] . '_version']['sql_create_table'] = '';
                 }
             }
         }
     }
     $timer = time();
     $tmpCode = uniqid() . "_" . $timer;
     // Création de l'archive zipper
     $filename = "doorGets_CMS_7.0_{$tmpCode}.zip";
     $zip_file = BASE . "installer/{$filename}";
     $json_file = BASE . "installer/doorGets_CMS_7.0_{$tmpCode}.json";
     $zip_file_doorgets = BASE . "installer/doorgets.zip.{$tmpCode}";
     $zip_file_database = BASE . "installer/database.zip.{$tmpCode}";
     $dirCache = BASE . "cache/_tempDatabase/";
     if (!is_dir($dirCache)) {
         @mkdir($dirCache, 0777, true);
     }
     $zipdoorGets = new ZipDir();
     $resdoorGets = $zipdoorGets->open($zip_file_doorgets, ZipArchive::CREATE);
     if ($resdoorGets === TRUE) {
         $zipdoorGets->addDir(BASE . 'api', 'api');
         $zipdoorGets->addDir(BASE . 'ajax', 'ajax');
         $zipdoorGets->addDir(BASE . 'config', 'config');
         $zipdoorGets->addDir(BASE . 'data', 'data');
         //$zipdoorGets->addDir(BASE.'checkout', 'checkout');
         //$zipdoorGets->addDir(BASE.'payment', 'payment');
         $zipdoorGets->addDir(BASE . 'dg-user', 'dg-user');
         $zipdoorGets->addDir(BASE . 'doorgets', 'doorgets');
         $zipdoorGets->addDir(BASE . 'rss', 'rss');
         $zipdoorGets->addDir(BASE . 'skin', 'skin');
         $zipdoorGets->addDir(BASE . 'fileman', 'fileman');
         $zipdoorGets->addDir(BASE . 't', 't');
         $zipdoorGets->addDir(BASE . 'oauth2', 'oauth2');
         $zipdoorGets->addDir(BASE . 'themes', 'themes');
         $zipdoorGets->addDir(BASE . 'update', 'update');
         $zipdoorGets->addDir(BASE . 'u', 'u');
         //$zipdoorGets->addFile(BASE.'Table2Model.php', 'Table2Model.php');
         //$zipdoorGets->addFile(BASE.'cmd.php', 'cmd.php');
         $zipdoorGets->addFile(BASE . '404.php', '404.php');
         $zipdoorGets->addFile(BASE . 'index.php', 'index.php');
         //$zipdoorGets->addFile(BASE.'.htaccess', '.htaccess');
         $zipdoorGets->addFile(BASE . 'favicon.ico', 'favicon.ico');
         $zipdoorGets->addEmptyDir('cache');
         $zipdoorGets->addFile(BASE . 'cache/.htaccess', 'cache/.htaccess');
         $zipdoorGets->addFile(BASE . 'data/index.php', 'cache/index.php');
         $zipdoorGets->addEmptyDir('installer');
         $zipdoorGets->addFile(BASE . 'installer/.htaccess', 'installer/.htaccess');
         $zipdoorGets->addFile(BASE . 'data/index.php', 'installer/index.php');
         $zipdoorGets->addEmptyDir('io');
         $zipdoorGets->addFile(BASE . 'io/.htaccess', 'io/.htaccess');
         $zipdoorGets->addFile(BASE . 'data/index.php', 'io/index.php');
         if (!empty($this->doorGets->configWeb['saas_position'])) {
             $zipdoorGets->addEmptyDir($this->doorGets->configWeb['saas_position']);
             $zipdoorGets->addFile(BASE . 'io/index.php', $this->doorGets->configWeb['saas_position'] . 'index.php');
         } else {
             $zipdoorGets->addEmptyDir('cloud');
             $zipdoorGets->addFile(BASE . 'data/index.php', 'cloud/index.php');
         }
     }
     $zipdoorGets->close();
     $zipDatabase = new ZipDir();
     $resDatabase = $zipDatabase->open($zip_file_database, ZipArchive::CREATE);
     if ($resDatabase === TRUE) {
         // Création de la copie de la database
         $zipDatabase->addEmptyDir('database/');
         $groupBy = 1000;
         // Création des fichiers d'éxportation de la base
         foreach ($table as $name_table => $v) {
             if (!in_array($name_table, $arrayExclude)) {
                 $iTable = $this->dbQ('SELECT COUNT(*) as counter FROM ' . $name_table);
                 $table[$name_table]['count'] = (int) $iTable[0]['counter'];
                 $dirIoFile = 'database/' . $name_table . '/';
                 $zipDatabase->addEmptyDir($dirIoFile);
                 $totalPosition = 0;
                 if ($table[$name_table]['count'] > $groupBy) {
                     $totalPosition = ceil($table[$name_table]['count'] / $groupBy);
                 }
                 for ($i = 0; $i < $totalPosition + 1; $i++) {
                     $initPos = $i ? $groupBy * $i : 0;
                     $valContent = $this->dbQA($name_table, " LIMIT {$initPos}, {$groupBy}");
                     $sqlToSave = '';
                     $fileNameSaved = $dirIoFile . $name_table . '-' . $i . '.php';
                     $fileCache = $dirCache . $name_table . '-' . $i . '.php';
                     if (!empty($valContent)) {
                         $fp = fopen($fileCache, 'w');
                         $cValContentcount = count($valContent);
                         for ($j = 0; $j < $cValContentcount; $j++) {
                             //fwrite($fp, base64_encode(serialize($this->dbVQI($valContent[$j],$name_table))));
                             fwrite($fp, $this->dbVQI($valContent[$j], $name_table));
                         }
                         $zipDatabase->addFile($fileCache, $fileNameSaved);
                         fclose($fp);
                     }
                 }
             }
         }
         $tableInfo = serialize($table);
         file_put_contents($dirCache . 'doorgets.php', $tableInfo);
         $zipDatabase->addFile($dirCache . 'doorgets.php', 'database/doorgets.php');
         $zipDatabase->close();
     }
     $zipArchive = new ZipDir();
     $res = $zipArchive->open($zip_file, ZipArchive::CREATE);
     if ($res === TRUE) {
         $userInformation = serialize(array('user_id' => $this->doorGets->user['id'], 'pseudo' => $this->doorGets->user['pseudo']));
         $zipArchive->addFromString('setup/temp/_fromUser.php', $userInformation);
         $zipArchive->addDir(BASE . 'doorgets/installer/setup/setup/', 'setup');
         $zipArchive->addFile(BASE . 'doorgets/installer/setup/index.php', 'index.php');
         $zipArchive->addFile($zip_file_doorgets, 'setup/data/doorgets.zip');
         $zipArchive->addFile($zip_file_database, 'setup/data/database.zip');
         $zipArchive->close();
     }
     if (is_file($zip_file_doorgets)) {
         unlink($zip_file_doorgets);
     }
     if (is_file($zip_file_database)) {
         unlink($zip_file_database);
     }
     // Create json file for infos
     $this->dataInfo['file'] = $filename;
     $fileJson = json_encode($this->dataInfo);
     if (file_put_contents($json_file, $fileJson)) {
         return true;
     }
     return false;
 }