diff --git a/.gitattributes b/.gitattributes
index 10038ac3..2d8a464a 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -10,5 +10,3 @@ git-tools/ export-ignore
.coveralls.yml export-ignore
composer.phar export-ignore
composer.lock export-ignore
-portal/upload/ export-ignore
-includes/functions_upload.php export-ignore
diff --git a/acp/portal_info.php b/acp/portal_info.php
index 527c102e..b29ce3f2 100644
--- a/acp/portal_info.php
+++ b/acp/portal_info.php
@@ -19,11 +19,10 @@ class portal_info
return array(
'filename' => '\board3\portal\acp\portal_module',
'title' => 'ACP_PORTAL',
- 'version' => '2.0.0b2',
+ 'version' => '2.0.1-rc1',
'modes' => array(
'config' => array('title' => 'ACP_PORTAL_GENERAL_INFO', 'auth' => 'acl_a_manage_portal', 'cat' => array('ACP_PORTAL')),
'modules' => array('title' => 'ACP_PORTAL_MODULES', 'auth' => 'acl_a_manage_portal', 'cat' => array('ACP_PORTAL')),
- // 'upload_module' => array('title' => 'ACP_PORTAL_UPLOAD', 'auth' => 'acl_a_manage_portal', 'cat' => array('ACP_PORTAL')),
),
);
}
diff --git a/acp/portal_module.php b/acp/portal_module.php
index c55f2a8c..2fad3989 100644
--- a/acp/portal_module.php
+++ b/acp/portal_module.php
@@ -690,47 +690,7 @@ class portal_module
$this->tpl_name = 'portal/acp_portal_modules';
$this->page_title = 'ACP_PORTAL_MODULES';
break;
- case 'upload_module':
- $error = array();
- if($submit)
- {
- if(!check_form_key('acp_portal_module_upload'))
- {
- trigger_error($this->user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
- }
- include($this->root_path . 'includes/functions_upload.' . $this->php_ext);
- // Default upload path is portal/upload/
- $upload_path = $this->root_path . 'portal/upload/';
- new portal_upload($upload_path, $this->u_action);
-
- $this->tpl_name = 'portal/acp_portal_upload_module';
- $this->page_title = $this->user->lang['ACP_PORTAL_UPLOAD'];
- }
- else
- {
- // start the page
- $this->template->assign_vars(array(
- 'U_UPLOAD' => $this->u_action,
- 'S_FORM_ENCTYPE' => ' enctype="multipart/form-data"',
- ));
-
- add_form_key('acp_portal_module_upload');
-
- $this->tpl_name = 'portal/acp_portal_upload_module';
- $this->page_title = $this->user->lang['ACP_PORTAL_UPLOAD'];
-
- $this->template->assign_vars(array(
- 'L_TITLE' => $this->user->lang['ACP_PORTAL_UPLOAD'],
- 'L_TITLE_EXPLAIN' => '',
-
- 'S_ERROR' => (sizeof($error)) ? true : false,
- 'ERROR_MSG' => implode('
', $error),
-
- 'U_ACTION' => $this->u_action,
- ));
- }
- break;
default:
trigger_error('NO_MODE', E_USER_ERROR);
break;
diff --git a/adm/style/portal/acp_portal_upload_module.html b/adm/style/portal/acp_portal_upload_module.html
deleted file mode 100644
index bf785efa..00000000
--- a/adm/style/portal/acp_portal_upload_module.html
+++ /dev/null
@@ -1,63 +0,0 @@
-
-
-
-
-
{L_TITLE}
-
-{L_TITLE_EXPLAIN}
-
-
-
-
{L_WARNING}
-
{ERROR_MSG}
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/includes/functions_upload.php b/includes/functions_upload.php
deleted file mode 100644
index 69da4dc1..00000000
--- a/includes/functions_upload.php
+++ /dev/null
@@ -1,354 +0,0 @@
-upload_path = $path;
- $this->u_action = $u_action;
-
- $this->upload_file();
- }
- }
-
- /**
- * upload module zip
- */
- private function upload_file()
- {
- global $user, $phpbb_root_path, $phpEx, $phpbb_admin_path, $template;
- // Upload part
- $user->add_lang('posting'); // For error messages
- include($phpbb_root_path . 'includes/functions_upload.' . $phpEx);
- $upload = new fileupload();
- // Only allow ZIP files
- $upload->set_allowed_extensions(array('zip'));
-
- $file = $upload->form_upload('modupload');
-
- // this is for module zips so don't allow anything else
- if (empty($file->filename) || !preg_match('.zip.', $file->get('realname')))
- {
- trigger_error($user->lang['NO_FILE_B3P'] . adm_back_link($this->u_action), E_USER_WARNING);
- }
- else
- {
- if (!$file->init_error && !sizeof($file->error))
- {
- $file->clean_filename('real');
- $file->move_file(str_replace($phpbb_root_path, '', $this->upload_path), true, true);
-
- if (!sizeof($file->error))
- {
- include($phpbb_root_path . 'includes/functions_compress.' . $phpEx);
- $mod_dir = $this->upload_path . str_replace('.zip', '', $file->get('realname'));
- // make sure we don't already have the new folder
- if(is_dir($mod_dir))
- {
- $this->directory_delete($mod_dir);
- }
-
- $compress = new compress_zip('r', $file->destination_file);
- $compress->extract($mod_dir . '_tmp/');
- $compress->close();
- $folder_contents = $this->cut_folder(scandir($mod_dir . '_tmp/', 1)); // This ensures dir is at index 0
-
- // We need to check if there's a main directory inside the temp MOD directory
- if (sizeof($folder_contents) == 1)
- {
- // We need to move that directory then
- $this->directory_move($mod_dir . '_tmp/' . $folder_contents[0], $this->upload_path . $folder_contents[0]);
- $new_mod_dir = $this->upload_path . $folder_contents[0];
-
- }
- else if (!is_dir($mod_dir))
- {
- // Change the name of the directory by moving to directory without _tmp in it
- $this->directory_move($mod_dir . '_tmp/', $mod_dir);
- $new_mod_dir = $mod_dir;
- }
-
- $this->directory_delete($mod_dir . '_tmp/');
-
- // make sure we set $mod_dir to the correct folder after the above step
- $mod_dir = (isset($new_mod_dir)) ? $new_mod_dir : $mod_dir;
-
- // if we got until here set $actions['NEW_FILES']
- $actions['NEW_FILES'] = array();
-
- // Now we need to get the files inside the folders
- //$folder_contents = $this->cut_folder(scandir($mod_dir));
- $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($mod_dir, FilesystemIterator::SKIP_DOTS)); // requires PHP 5
-
- foreach($iterator as $cur_file)
- {
- $cur_path = $cur_file->getPathname();
- $cur_path = str_replace('\\', '/', $cur_path); // we want unix-like paths
- $cur_path = str_replace($mod_dir . '/', '', $cur_path);
- $cut_pos = strpos($cur_path, '/');
-
- // Only allow files in adm, language, portal and styles folder and a license.txt
- if(!in_array(substr($cur_path, 0, $cut_pos), array('adm', 'language', 'portal', 'styles')) && $cur_file->getFilename() != 'license.txt')
- {
- $file->remove();
- $this->directory_delete($mod_dir);
- trigger_error($user->lang['MODULE_CORRUPTED'] . adm_back_link(append_sid("{$phpbb_admin_path}index.$phpEx", 'i=portal&mode=modules')), E_USER_WARNING);
- }
- else
- {
- $actions['NEW_FILES'][$mod_dir . '/' . $cur_path] = $phpbb_root_path . $cur_path;
- }
- }
-
- if (!sizeof($file->error))
- {
- // Let's start moving our files where they belong
- foreach ($actions['NEW_FILES'] as $source => $target)
- {
- /*
- * make sure we don't try to copy folders
- * folders will be created if necessary in copy_content
- */
- if(is_dir($source))
- {
- continue;
- }
- $status = $this->copy_content($source, $target);
-
- if ($status !== true && !is_null($status))
- {
- $module_installed = false;
- }
-
- $template->assign_block_vars('new_files', array(
- 'S_SUCCESS' => ($status === true) ? true : false,
- 'S_NO_COPY_ATTEMPT' => (is_null($status)) ? true : false,
- 'SOURCE' => $source,
- 'TARGET' => $target,
- ));
- }
-
- $template->assign_vars(array(
- 'S_MOD_SUCCESSBOX' => true,
- 'MESSAGE' => $user->lang['MODULE_UPLOADED'],
- 'U_RETURN' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=portal&mode=modules'),
- 'S_INSTALL' => true,
- ));
- }
- }
- }
- $file->remove();
- $this->directory_delete($mod_dir);
- if ($file->init_error || sizeof($file->error))
- {
- trigger_error((sizeof($file->error) ? implode('
', $file->error) : $user->lang['MOD_UPLOAD_INIT_FAIL']) . adm_back_link($this->u_action), E_USER_WARNING);
- }
-
- $this->tpl_name = 'portal/acp_portal_upload_module';
- $this->page_title = $user->lang['ACP_PORTAL_UPLOAD'];
-
- $template->assign_vars(array(
- 'L_TITLE' => $user->lang['ACP_PORTAL_UPLOAD'],
- 'L_TITLE_EXPLAIN' => '',
-
- 'S_ERROR' => false, // if we get here, there was no error or we can ignore it
- 'ERROR_MSG' => '',
-
- 'U_ACTION' => $this->u_action,
- ));
- }
- }
-
- /**
- * Cuts the unneeded '.' and '..' from the folder content info scandir returns
- *
- * @return: cut array
- */
- private function cut_folder($folder_content)
- {
- $cut_array = array('.', '..');
- $folder_content = array_diff($folder_content, $cut_array);
-
- return $folder_content;
- }
-
- private function directory_move($src, $dest)
- {
- $src_contents = scandir($src);
-
- if (!is_dir($dest) && is_dir($src))
- {
- mkdir($dest . '/', 0755);
- }
-
- foreach ($src_contents as $src_entry)
- {
- if ($src_entry != '.' && $src_entry != '..')
- {
- if (is_dir($src . '/' . $src_entry) && !is_dir($dest . '/' . $src_entry))
- {
- $this->directory_move($src . '/' . $src_entry, $dest . '/' . $src_entry);
- }
- else if (is_file($src . '/' . $src_entry) && !is_file($dest . '/' . $src_entry))
- {
- @copy($src . '/' . $src_entry, $dest . '/' . $src_entry);
- @chmod($dest . '/' . $src_entry, 0644);
- }
- }
- }
- }
-
- /**
- * the following functions are from the AutoMOD package
- * @copyright (c) 2008 phpBB Group
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
- */
-
- private function directory_delete($dir)
- {
- if (!file_exists($dir))
- {
- return true;
- }
-
- if (!is_dir($dir) && is_file($dir))
- {
- @chmod($dir, 0644);
- return @unlink($dir);
- }
-
- foreach (scandir($dir) as $item)
- {
- if ($item == '.' || $item == '..')
- {
- continue;
- }
- if (!$this->directory_delete($dir . "/" . $item))
- {
- @chmod($dir . "/" . $item, 0644);
- if (!$this->directory_delete($dir . "/" . $item))
- {
- return false;
- }
- }
- }
-
- return @rmdir($dir);
- }
-
- /**
- * Moves files or complete directories
- *
- * @param $from string Can be a file or a directory. Will move either the file or all files within the directory
- * @param $to string Where to move the file(s) to. If not specified then will get moved to the root folder
- * @param $strip Used for FTP only
- * @return mixed Bool true on success, error string on failure, NULL if no action was taken
- *
- * NOTE: function should preferably not return in case of failure on only one file.
- * The current method makes error handling difficult
- */
- private function copy_content($from, $to = '', $strip = '')
- {
- global $phpbb_root_path, $user, $config;
-
- if (strpos($from, $phpbb_root_path) !== 0)
- {
- $from = $phpbb_root_path . $from;
- }
-
- if (strpos($to, $phpbb_root_path) !== 0)
- {
- $to = $phpbb_root_path . $to;
- }
-
- $dirname_check = dirname($to);
-
- if (!is_dir($dirname_check))
- {
- if ($this->recursive_mkdir($dirname_check) === false)
- {
- return sprintf($user->lang['MODULE_UPLOAD_MKDIR_FAILURE'], $dirname_check);
- }
- }
-
- // leave a backup file if it already exists
- if(file_exists($to))
- {
- // remove old backup file first
- if(file_exists($to . '.bak'))
- {
- @chmod($to . '.bak', 0644);
- unlink($to . '.bak');
- }
- @rename($to, $to . '.bak');
- @chmod($to, 0644);
- }
-
- if (!@copy($from, $to))
- {
- return sprintf($user->lang['MODULE_COPY_FAILURE'], $to);
- }
- @chmod($to, 0644);
-
- return true;
- }
-
- /**
- * @author Michal Nazarewicz (from the php manual)
- * Creates all non-existent directories in a path
- * @param $path - path to create
- * @param $mode - CHMOD the new dir to these permissions
- * @return bool
- */
- private function recursive_mkdir($path, $mode = false)
- {
- if (!$mode)
- {
- $mode = octdec(0777);
- }
-
- $dirs = explode('/', $path);
- $count = sizeof($dirs);
- $path = '.';
- for ($i = 0; $i < $count; $i++)
- {
- $path .= '/' . $dirs[$i];
-
- if (!is_dir($path))
- {
- @mkdir($path, $mode);
- @chmod($path, $mode);
-
- if (!is_dir($path))
- {
- return false;
- }
- }
- }
- return true;
- }
-}
diff --git a/language/de/portal_acp.php b/language/de/portal_acp.php
index c290a1b5..23d15868 100644
--- a/language/de/portal_acp.php
+++ b/language/de/portal_acp.php
@@ -98,23 +98,6 @@ $lang = array_merge($lang, array(
'LINK_ADDED' => 'Der Link wurde erfolgreich eingetragen',
'LINK_UPDATED' => 'Der Link wurde erfolgreich geändert',
- // Upload Module
- 'MODULE_UPLOAD' => 'Lade ein Modul hoch',
- 'MODULE_UPLOAD_EXP' => 'Wähle die ZIP-Datei des Moduls das du hochladen willst:',
- 'MODULE_UPLOAD_GO' => 'Hochladen',
- 'NO_MODULE_UPLOAD' => 'Deine Server-Konfiguration erlaubt das Hochladen von Dateien nicht.',
- 'NO_FILE_B3P' => 'Es wurde keine Zip-Datei ausgewählt.',
- 'MODULE_UPLOADED' => 'Modul erfolgreich hochgeladen.',
- 'MODULE_UPLOAD_MKDIR_FAILURE' => 'Es konnte kein Ordner erstellt werden.',
- 'MODULE_COPY_FAILURE' => 'Die folgende Datei konnte nicht kopiert werden: %1$s',
- 'MODULE_CORRUPTED' => 'Das Modul das du hochladen willst, scheint defekt zu sein.',
- 'PORTAL_NEW_FILES' => 'Neue Dateien',
- 'PORTAL_MODULE_SOURCE' => 'Quelle',
- 'PORTAL_MODULE_TARGET' => 'Ziel',
- 'PORTAL_MODULE_STATUS' => 'Status',
- 'PORTAL_MODULE_SUCCESS' => 'Erfolgreich kopiert.',
- 'PORTAL_MODULE_ERROR' => 'Datei exisitert schon oder konnte nicht kopiert werden.',
-
// Install
'PORTAL_BASIC_INSTALL' => 'Füge Basismodule hinzu',
'PORTAL_BASIC_UNINSTALL' => 'Entferne Module von Datenbank',
diff --git a/language/en/portal_acp.php b/language/en/portal_acp.php
index b2fd1dfc..07e96f28 100644
--- a/language/en/portal_acp.php
+++ b/language/en/portal_acp.php
@@ -97,23 +97,6 @@ $lang = array_merge($lang, array(
'LINK_ADDED' => 'The link has been successfully added',
'LINK_UPDATED' => 'The link has been successfully updated',
- // Upload Module
- 'MODULE_UPLOAD' => 'Upload a module',
- 'MODULE_UPLOAD_EXP' => 'Choose the zip file of the module you want to upload:',
- 'MODULE_UPLOAD_GO' => 'Upload',
- 'NO_MODULE_UPLOAD' => 'Your server configuration does not allow file uploads.',
- 'NO_FILE_B3P' => 'No zip file specified.',
- 'MODULE_UPLOADED' => 'Module uploaded successfully.',
- 'MODULE_UPLOAD_MKDIR_FAILURE' => 'Unable to create a folder.',
- 'MODULE_COPY_FAILURE' => 'Unable to copy the following file: %1$s',
- 'MODULE_CORRUPTED' => 'The module you are trying to upload seems to be corrupted.',
- 'PORTAL_NEW_FILES' => 'New files',
- 'PORTAL_MODULE_SOURCE' => 'Source',
- 'PORTAL_MODULE_TARGET' => 'Target',
- 'PORTAL_MODULE_STATUS' => 'Status',
- 'PORTAL_MODULE_SUCCESS' => 'Success',
- 'PORTAL_MODULE_ERROR' => 'Error',
-
// Install
'PORTAL_BASIC_INSTALL' => 'Adding basic set of modules',
'PORTAL_BASIC_UNINSTALL' => 'Removing modules from database',
diff --git a/language/nl/portal_acp.php b/language/nl/portal_acp.php
index 2698fe0e..1147b7e1 100644
--- a/language/nl/portal_acp.php
+++ b/language/nl/portal_acp.php
@@ -69,6 +69,7 @@ $lang = array_merge($lang, array(
'MODULE_ADD_ONCE' => 'Deze module kan maar één keer worden toegevoegd.',
'MODULE_IMAGE_ERROR' => 'Er is een fout opgetreden tijdens het controleren van de module afbeelding:',
'UNKNOWN_MODULE_METHOD' => 'De methode van de %1$s module kan niet worden gevonden.',
+
// general
'ACP_PORTAL_CONFIG_INFO' => 'Algemene instellingen',
'ACP_PORTAL_GENERAL_TITLE' => 'Portaal beheer',
@@ -89,25 +90,11 @@ $lang = array_merge($lang, array(
'PORTAL_RIGHT_COLUMN_WIDTH_EXP' => 'Verander de breedte van de rechterkolom in pixels; aanbevolen waarde is 180',
'LINK_ADDED' => 'De link is succesvol toegevoegd',
'LINK_UPDATED' => 'De link is succesvol gewijzigd',
- // Upload Module
- 'MODULE_UPLOAD' => 'Een module uploaden',
- 'MODULE_UPLOAD_EXP' => 'Kies het ZIP-bestand van de module die je wilt uploaden:',
- 'MODULE_UPLOAD_GO' => 'Upload',
- 'NO_MODULE_UPLOAD' => 'Je server configuratie staat het uploaden van bestanden niet toe.',
- 'NO_FILE_B3P' => 'Geen zip-bestand gespecificeerd.',
- 'MODULE_UPLOADED' => 'Module succesvol geüpload.',
- 'MODULE_UPLOAD_MKDIR_FAILURE' => 'Niet instaat om een map aan te maken.',
- 'MODULE_COPY_FAILURE' => 'Niet instaat om de map: %1$s te kopiëren',
- 'MODULE_CORRUPTED' => 'De module die je probeert te uploaden lijkt corrupt te zijn.',
- 'PORTAL_NEW_FILES' => 'Nieuwe bestanden',
- 'PORTAL_MODULE_SOURCE' => 'Bron',
- 'PORTAL_MODULE_TARGET' => 'Doel',
- 'PORTAL_MODULE_STATUS' => 'Status',
- 'PORTAL_MODULE_SUCCESS' => 'Succes',
- 'PORTAL_MODULE_ERROR' => 'Fout',
+
// Install
'PORTAL_BASIC_INSTALL' => 'Basisset van modules toevoegen',
'PORTAL_BASIC_UNINSTALL' => 'Modules verwijderen uit de database',
+
/**
* A copy of Handyman` s MOD version check, to view it on the portal overview
*/
diff --git a/portal/upload/index.html b/portal/upload/index.html
deleted file mode 100644
index dc8f7f41..00000000
--- a/portal/upload/index.html
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/tests/functional/portal_acp_test.php b/tests/functional/portal_acp_test.php
index cd182dd4..b5be48ec 100644
--- a/tests/functional/portal_acp_test.php
+++ b/tests/functional/portal_acp_test.php
@@ -25,7 +25,6 @@ class phpbb_functional_portal_acp_test extends \board3\portal\tests\testframewor
return array(
array('config'),
array('modules'),
- // array('upload_module'),
);
}