Example #1
0
function unpack_zip_show_files($zipfile) {
    global $langEndFileUnzip, $langLesFound, $langRestore, $langLesFiles;

    $retArr = unpack_zip_inner($zipfile, FALSE);
    $retString = '';

    if (count($retArr) > 0) {
        $retString .= "<br />$langEndFileUnzip<br /><br />$langLesFound
                           <form action='$_SERVER[SCRIPT_NAME]' method='post'>
                             <ol>";
        $checked = ' checked';

        foreach ($retArr as $entry) {
            $path = $entry['path'];
            $file = q($entry['file']);
            $course = q($entry['course']);

            $retString .= "<li>$langLesFiles <input type='radio' name='restoreThis' value='" . q(getIndirectReference($path)) . "'$checked>
                            <b>$course</b> ($file)</li>\n";
            $checked = '';
        }

        $retString .= "</ol><br /><input class='btn btn-primary' type='submit' name='do_restore' value='$langRestore' />
                      ".generate_csrf_token_form_field()."
                      </form>";
    }

    return $retString;
}
Example #2
0
$require_current_course = true;
$require_course_admin = true;
require_once '../../include/baseTheme.php';
require_once 'include/lib/hierarchy.class.php';
require_once 'archive_functions.php';
require_once 'restore_functions.php';
$toolName = $langCloneCourse;
$treeObj = new Hierarchy();
$_POST['restoreThis'] = null;
// satisfy course_details_form()
if (isset($_POST['create_restored_course'])) {
    $tool_content = "posted";
    $currentCourseCode = $course_code;
    $success = doArchive($course_id, $course_code);
    if ($success !== 0) {
        $retArr = unpack_zip_inner($webDir . "/courses/archive/{$course_code}/{$course_code}-" . date('Ymd') . ".zip");
        $restoreEntry = null;
        foreach ($retArr as $entry) {
            if ($entry['course'] === $course_code) {
                $restoreEntry = $entry;
            }
        }
        if ($restoreEntry !== null) {
            $_POST['restoreThis'] = $restoreEntry['path'];
            // assign the real value to the variable, but no real essence here
            register_posted_variables(array('restoreThis' => true, 'course_code' => true, 'course_lang' => true, 'course_title' => true, 'course_desc' => true, 'course_vis' => true, 'course_prof' => true), 'all', 'autounquote');
            create_restored_course($tool_content, $restoreThis, $course_code, $course_lang, $course_title, $course_vis, $course_prof);
            $tool_content .= "</p><br /><center><p><a href='index.php?course={$currentCourseCode}'>{$langBack}</a></p></center>";
            $course_code = $currentCourseCode;
            // revert course code to the correct value
        }