checkCsrf()) { if (substr($_POST['w_use_dir'], -1) != '\\' && substr($_POST['w_use_dir'], -1) != '/') { //TODO don't change $_POST values directly $_POST['w_use_dir'] .= '/'; } simple_set_value('w_use_dir'); } if (! empty($_POST['moveWikiUp']) && $access->checkCsrf()) { $filegallib = TikiLib::lib('filegal'); $errorsWikiUp = []; $info = $filegallib->get_file_gallery_info($prefs['home_file_gallery']); if (empty($info)) { Feedback::error(tr('You must set a home file gallery')); } else { $filegallib->moveAllWikiUpToFgal($prefs['home_file_gallery']); } } // Included for the forum dropdown if (isset($_POST['createtag']) && $access->checkCsrf()) { // Check existence if ($adminlib->tag_exists($_POST['newtagname'])) { Feedback::error(tra('Tag already exists')); } $adminlib->create_tag($_POST['newtagname']); Feedback::success(tr('Tag %0 created.', '' . $_POST['newtagname'] . '')); } if (isset($_POST['restoretag']) && $access->checkCsrf()) { // Check existance if (! $adminlib->tag_exists($_POST['tagname'])) { Feedback::error(tr('Tag %0 not found', '' . $_POST['tagname'] . '')); } $result = $adminlib->restore_tag($_POST['tagname']); if ($result) { Feedback::success(tr('Tag %0 restored.', '' . $_POST['tagname'] . '')); } else { Feedback::error(tr('Tag %0 not restored.', '' . $_POST['tagname'] . '')); } } if (isset($_POST['removetag']) && $access->checkCsrf()) { $result = $adminlib->remove_tag($_POST['tagname']); if ($result) { Feedback::success(tr('Tag %0 removed.', '' . $_POST['tagname'] . '')); } else { Feedback::error(tr('Tag %0 not removed.', '' . $_POST['tagname'] . '')); } } if (isset($_POST['rmvunusedpic']) && $access->checkCsrf()) { $adminlib->remove_unused_pictures(); Feedback::success(tr('Process to remove pictures has completed.')); } //*** end state-changing actions if (isset($_REQUEST['createdump'])) { include('lib/tar.class.php'); error_reporting(E_ERROR | E_WARNING); $adminlib->dump(); if (is_file($path)) { Feedback::success(tr('Dump created at %0', '' . $path . '')); } else { Feedback::error(tra('Dump was not created. Please check permissions for the storage/ directory.')); } } if (isset($_REQUEST['removedump'])) { @unlink($path); if (! is_file($path)) { Feedback::success(tr('Dump file %0 removed.', '' . $path . '')); } else { Feedback::error(tr('Dump file %0 was not removed.', '' . $path . '')); } } if (isset($_REQUEST['downloaddump'])) { global $tikidomain; // Check existence if ($tikidomain) { $file = "storage/$tikidomain/dump_wiki.tar"; } else { $file = "storage/dump_wiki.tar"; } if (is_file($file)) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . basename($file) . '"'); header('Expires: 0'); header('Cache-Control: must-revalidate'); header('Pragma: public'); header('Content-Length: ' . filesize($file)); readfile($file); exit; } } $smarty->assign('isDump', is_file($path)); $smarty->assign('dumpPath', $path); $tags = $adminlib->get_tags(); $smarty->assign_by_ref('tags', $tags);