function _rex_is_writable_info($is_writable, $item = '') { global $I18N; $state = true; $key = ''; switch ($is_writable) { case 1: $key = 'setup_012'; break; case 2: $key = 'setup_014'; break; case 3: $key = 'setup_015'; break; } if ($key != '') { $file = ''; if ($item != '') { $file = '<b>' . $item . '</b>'; } $state = $I18N->msg($key, '<span class="rex-error">', '</span>', rex_absPath($file)); } return $state; }
/** * Prüfen ob ein/e Datei/Ordner beschreibbar ist */ function rex_is_writable($item) { global $I18N; $state = true; // Fehler unterdrücken, falls keine Berechtigung if (@is_dir($item)) { if (!@is_writable($item . "/.")) { $state = $I18N->msg("setup_012", rex_absPath($item)); } } elseif (@is_file($item)) { if (!@is_writable($item)) { $state = $I18N->msg("setup_014", rex_absPath($item)); } } else { $state = $I18N->msg("setup_015", rex_absPath($item)); } return $state; }
/** * Importiert das Tar-Archiv $filename in den Ordner /files * * @param string Pfad + Dateinamen zum Tar-Archiv * * @return array Gibt ein Assoc. Array zurück. * 'state' => boolean (Status ob fehler aufgetreten sind) * 'message' => Evtl. Status/Fehlermeldung */ function rex_a1_import_files($filename) { global $REX, $I18N_IM_EXPORT; $return = array(); $return['state'] = false; if ($filename == '' || substr($filename, -7, 7) != ".tar.gz") { $return['message'] = $I18N_IM_EXPORT->msg("no_import_file_chosen") . "<br>"; return $return; } // Ordner /files komplett leeren rex_deleteDir($REX['INCLUDE_PATH'] . "/../../files"); $tar = new rex_tar(); // ----- EXTENSION POINT $tar = rex_register_extension_point('A1_BEFORE_FILE_IMPORT', $tar); $tar->openTAR($filename); if (!$tar->extractTar()) { $msg = $I18N_IM_EXPORT->msg('problem_when_extracting') . '<br />'; if (count($tar->message) > 0) { $msg .= $I18N_IM_EXPORT->msg('create_dirs_manually') . '<br />'; foreach ($tar->message as $_message) { $msg .= rex_absPath($_message) . '<br />'; } } } else { $msg = $I18N_IM_EXPORT->msg('file_imported') . '<br />'; } // ----- EXTENSION POINT $tar = rex_register_extension_point('A1_AFTER_FILE_IMPORT', $tar); $return['state'] = true; $return['message'] = $msg; return $return; }
/** * Importiert das Tar-Archiv $filename in den Ordner /files * * @param string Pfad + Dateinamen zum Tar-Archiv * * @return array Gibt ein Assoc. Array zurück. * 'state' => boolean (Status ob fehler aufgetreten sind) * 'message' => Evtl. Status/Fehlermeldung */ function rex_a1_import_files($filename) { global $REX, $I18N_IM_EXPORT; $return = array(); $return['state'] = false; if ($filename == '') { $return['message'] = $I18N_IM_EXPORT->msg("no_import_file_chosen") . "<br>"; return $return; } // Ordner /files komplett leeren rex_deleteDir($REX['INCLUDE_PATH'] . "/../../files"); $tar = new tar(); $tar->openTAR($filename); if (!$tar->extractTar()) { $msg = $I18N_IM_EXPORT->msg("problem_when_extracting") . "<br>"; if (count($tar->message) > 0) { $msg .= $I18N_IM_EXPORT->msg("create_dirs_manually") . "<br>"; reset($tar->message); for ($fol = 0; $fol < count($tar->message); $fol++) { $msg .= rex_absPath(str_replace("'", "", key($tar->message))) . "<br>"; next($tar->message); } } } else { $msg = $I18N_IM_EXPORT->msg("file_imported") . "<br>"; } $return['state'] = true; $return['message'] = $msg; return $return; }
/** * Importiert das Tar-Archiv $filename in den Ordner /files * * @param string Pfad + Dateinamen zum Tar-Archiv * * @return array Gibt ein Assoc. Array zurück. * 'state' => boolean (Status ob fehler aufgetreten sind) * 'message' => Evtl. Status/Fehlermeldung */ function rex_a1_import_files($filename) { global $REX, $I18N; $return = array(); $return['state'] = false; if ($filename == '' || substr($filename, -7, 7) != '.tar.gz') { $return['message'] = $I18N->msg('im_export_no_import_file_chosen') . '<br />'; return $return; } // Ordner /files komplett leeren rex_deleteFiles($REX['INCLUDE_PATH'] . '/../../' . $REX['MEDIA_DIR']); $tar = new rex_tar(); // ----- EXTENSION POINT $tar = rex_register_extension_point('A1_BEFORE_FILE_IMPORT', $tar); // require import skript to do some userside-magic rex_a1_import_skript(str_replace('.tar.gz', '.php', $filename), REX_A1_IMPORT_ARCHIVE, REX_A1_IMPORT_EVENT_PRE); $tar->openTAR($filename); if (!$tar->extractTar()) { $msg = $I18N->msg('im_export_problem_when_extracting') . '<br />'; if (count($tar->message) > 0) { $msg .= $I18N->msg('im_export_create_dirs_manually') . '<br />'; foreach ($tar->message as $_message) { $msg .= rex_absPath($_message) . '<br />'; } } } else { $msg = $I18N->msg('im_export_file_imported') . '<br />'; } // ----- EXTENSION POINT $tar = rex_register_extension_point('A1_AFTER_FILE_IMPORT', $tar); // require import skript to do some userside-magic rex_a1_import_skript(str_replace('.tar.gz', '.php', $filename), REX_A1_IMPORT_ARCHIVE, REX_A1_IMPORT_EVENT_POST); $return['state'] = true; $return['message'] = $msg; return $return; }