http://www.atutor.ca/atutor/mantis/view.php?id=4289
authorharris wong <hwong@ocad.ca>
Thu, 13 May 2010 16:11:42 +0000 (16:11 -0000)
committerharris wong <hwong@ocad.ca>
Thu, 13 May 2010 16:11:42 +0000 (16:11 -0000)
http://www.atutor.ca/atutor/mantis/view.php?id=3720
http://www.atutor.ca/atutor/mantis/view.php?id=3981
http://www.atutor.ca/atutor/mantis/view.php?id=4272

35 files changed:
docs/admin/error_logging_reset.php
docs/include/classes/pclzipfile.class.php [deleted file]
docs/include/classes/zipfile.class.php
docs/include/classes/zipfile.class.php.bak [new file with mode: 0644]
docs/include/lib/themes.inc.php
docs/mods/_core/backups/admin/index.php
docs/mods/_core/backups/admin/restore.php
docs/mods/_core/backups/index.php
docs/mods/_core/backups/restore.php
docs/mods/_core/editor/edit_content.php
docs/mods/_core/file_manager/delete.php
docs/mods/_core/file_manager/edit.php
docs/mods/_core/file_manager/index.php
docs/mods/_core/file_manager/move.php
docs/mods/_core/file_manager/new.php
docs/mods/_core/file_manager/rename.php
docs/mods/_core/file_manager/upload.php
docs/mods/_core/file_manager/zip.php
docs/mods/_core/imscp/ims_import.php
docs/mods/_core/modules/classes/Module.class.php
docs/mods/_core/modules/index.php
docs/mods/_core/modules/install_modules.php
docs/mods/_core/modules/module_install_step_2.php
docs/mods/_core/properties/admin/delete_course.php
docs/mods/_core/properties/delete_course.php
docs/mods/_core/properties/lib/course.inc.php
docs/mods/_core/themes/import.php
docs/mods/_core/themes/install_themes.php
docs/mods/_core/themes/lib/themes.inc.php
docs/mods/_core/themes/theme_install_step_2.php
docs/mods/_standard/file_storage/index.php
docs/mods/_standard/file_storage/revisions.php
docs/mods/_standard/patcher/include/common.inc.php
docs/mods/_standard/tests/import_test.php
docs/mods/_standard/tests/question_import.php

index 0e83204..0add4b8 100644 (file)
@@ -24,7 +24,7 @@ if (isset($_POST['submit_no'])) {
 } else if (isset($_POST['submit_yes'])) {\r
        \r
        //clean up the db\r
-       require(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');\r
+       require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');\r
        \r
        if (($result = clr_dir(AT_CONTENT_DIR . 'logs/'))) {\r
                $msg->addFeedback('ERROR_LOG_RESET');\r
diff --git a/docs/include/classes/pclzipfile.class.php b/docs/include/classes/pclzipfile.class.php
deleted file mode 100644 (file)
index 504c3df..0000000
+++ /dev/null
@@ -1,246 +0,0 @@
-<?php
-/****************************************************************/
-/* ATutor                                                                                                              */
-/****************************************************************/
-/* Copyright (c) 2002-2008 by Greg Gay & Joel Kronenberg        */
-/* Adaptive Technology Resource Centre / University of Toronto  */
-/* http://atutor.ca                                                                                            */
-/*                                                              */
-/* This program is free software. You can redistribute it and/or*/
-/* modify it under the terms of the GNU General Public License  */
-/* as published by the Free Software Foundation.                               */
-/****************************************************************/
-// $Id: zipfile.class.php 7208 2008-01-09 16:07:24Z greg $
-
-//loads the pclzip library.
-define('PCLZIP_TEMPORARY_DIR', AT_CONTENT_DIR.'export'.DIRECTORY_SEPARATOR);
-include(AT_INCLUDE_PATH.'/classes/pclzip.lib.php');
-include(AT_INCLUDE_PATH.'..//mods/_core/file_manager/filemanager.inc.php');    //copy/delete folder
-
-/**
-* Class for creating and accessing an archive zip file
-* @access      public
-* @link                http://www.pkware.com/products/enterprise/white_papers/appnote.html     for the specs
-* @author      Joel Kronenberg
-*/
-class zipfile {
-
-
-       /**
-        *
-        */
-       var $zipfile_dir;
-
-       /**
-       * boolean $is_closed - flag set to true if file is closed, false if still open
-       * @access  private
-       */
-       var $is_closed; 
-
-       /** File name */
-       var $filename; 
-
-
-       /**
-       * Constructor method.  Initialises variables.
-       * @access       public
-       * @author       Joel Kronenberg
-       */
-       function zipfile() {
-               //create the 
-               if (!is_dir(PCLZIP_TEMPORARY_DIR)){
-                       mkdir(PCLZIP_TEMPORARY_DIR);
-                       copy(PCLZIP_TEMPORARY_DIR.'../index.html', PCLZIP_TEMPORARY_DIR.'index.html');
-               }
-
-               //generate a random hash 
-               $this->filename = substr(md5(rand()), 0, 5);
-
-               $this->zipfile_dir = PCLZIP_TEMPORARY_DIR.$this->filename.DIRECTORY_SEPARATOR;
-               mkdir($this->zipfile_dir);
-               $this->is_closed = false;
-       }
-
-
-       /**
-       * Public interface for adding a dir and its contents recursively to zip file
-       * @access  public
-       * @param   string $dir                          the real system directory that contains the files to add to the zip              
-       * @param   string $zip_prefix_dir       the zip dir where the contents of $dir will be put in
-       * @param   string $pre_pend_dir         used during the recursion to keep track of the path, default=''
-       * @see     $_base_path                          in include/vitals.inc.php
-       * @see     priv_add_dir()                       in include/classes/zipfile.class.php
-       * @see     add_file()                           in include/classes/zipfile.class.php
-       * @author  Joel Kronenberg
-       */
-       function add_dir($dir, $zip_prefix_dir, $pre_pend_dir='') {
-               if (!($dh = @opendir($dir.$pre_pend_dir))) {
-                       echo 'cant open dir: '.$dir.$pre_pend_dir;
-                       exit;           
-               }
-debug($dir, 'add dir');
-               //copy folder recursively
-               copys($dir, $this->zipfile_dir.DIRECTORY_SEPARATOR.$zip_prefix_dir);
-       }
-
-       /**
-       * Adding a dir to the archive 
-       * @access  private
-       * @param   string $name                         directory name
-       * @param   string $timestamp            time, default=''
-       * @author  Joel Kronenberg
-       */
-    function priv_add_dir($name, $timestamp = '') {   
-               //deprecated.
-    } 
-       
-       /**
-       * Public interface to create a directory in the archive.
-       * @access  public
-       * @param   string $name                         directory name
-       * @param   string $timestamp            time of creation, default=''
-       * @see     $_base_path                          in include/vitals.inc.php
-       * @see     priv_add_dir()                       in include/zipfile.class.php
-       * @author  Joel Kronenberg
-       */
-       function create_dir($name, $timestamp='') {
-               $name = trim($name);
-
-               if(is_dir(dirname($this->zipfile_dir.$name)) && $name != '.'){
-                       $this->create_dir(dirname($name));
-               } elseif ($name == '' || $name ='.') {
-                       return;
-               }
-
-               //mkdir 
-
-debug($this->zipfile_dir.$name, 'create dir');
-               mkdir($this->zipfile_dir.$name);
-       }
-
-
-       /**
-       * Adds a file to the archive.
-       * @access  public
-       * @param   string $file_data            file contents
-       * @param   string $name                         name of file in archive (add path if your want)
-       * @param   string $timestamp            time of creation, default=''
-       * @see     $_base_path                          in include/vitals.inc.php
-       * @see     priv_add_dir()                       in include/zipfile.class.php
-       * @author  Joel Kronenberg
-       */
-    function add_file($file_data, $name, $timestamp = '') {
-        $name = str_replace("\\", "/", $name);
-
-               //check if folder exists, if not, create it.
-debug($name);
-               if (!is_dir(dirname($this->zipfile_dir.$name))){
-                       $this->create_dir(dirname($this->zipfile_dir.$name));
-               }
-
-               $fp = fopen($this->zipfile_dir.$name, 'w');
-               fwrite($fp, $file_data);
-               fclose($fp);            
-    } 
-
-       /**
-       * Closes archive, sets $is_closed to true
-       * @access  public
-       * @param   none
-       * @author  Joel Kronenberg
-       */
-       function close() {
-               //save file 
-
-               $archive = new PclZip($this->zipfile_dir.$this->filename.'.zip');
-               $v_list = $archive->create($this->zipfile_dir, 
-                                                       PCLZIP_OPT_REMOVE_PATH, $this->zipfile_dir);
-
-               //error info
-               if ($v_list == 0) {
-               die ("Error: " . $archive->errorInfo(true));
-               }
-
-//             debug($v_list);         
-               $this->is_closed = true;
-       }
-
-    /**
-       * Gets size of new archive
-       * Only call this after calling close() - will return false if the zip wasn't close()d yet
-       * @access  public
-       * @return  int  size of file in byte.
-       * @author  Joel Kronenberg
-       */
-       function get_size() {
-               if (!$this->is_closed) {
-                       return false;
-               }
-
-               //file path
-               $filepath = $this->zipfile_dir.$this->filename.'.zip';
-               if (file_exists($filepath)){
-                       return filesize($filepath);
-               } 
-
-               return false;
-       }
-
-
-    /**
-       * Returns binary file
-       * @access       public
-       * @see          get_size()              in include/classes/zipfile.class.php
-       * @author  Joel Kronenberg
-       */      
-       function get_file() {
-               if (!$this->is_closed) {
-                       $this->close();
-               }
-               return file_get_contents($this->zipfile_dir.$this->filename.'.zip');
-    }
-
-       /**
-       * Writes the file to disk.
-       * Similar to get_file(), but instead of returning the file, it saves it to disk.
-       * @access  public
-       * @author  Joel Kronenberg
-       * @param  $file The full path and file name of the destination file.
-       */
-       function write_file($file) {
-               if (!$this->is_closed) {
-                       $this->close();
-               }               
-               copy($this->zipfile_dir.$this->filename.'.zip', $file);
-       }
-
-
-    /**
-       * Outputs the file - sends headers to browser to force download
-       * Only call this after calling close() - will return false if the zip wasn't close()d yet
-       * @access       public
-       * @see          get_size()              in include/classes/zipfile.class.php
-       * @author  Joel Kronenberg
-       */
-       function send_file($file_name) {
-return;
-               if (!$this->is_closed) {
-                       $this->close();
-               }
-               $file_name = str_replace(array('"', '<', '>', '|', '?', '*', ':', '/', '\\'), '', $file_name);
-
-               header("Content-type: application/octet-stream");
-               header("Content-disposition: attachment; filename=$file_name.zip");
-               readfile($this->zipfile_dir.$this->filename.'.zip');
-               exit;
-       }
-
-       /**
-        * Destructor - removes temporary folder and its content.
-        */
-       function __destruct(){
-//             clr_dir($this->zipfile_dir);
-       }
-}
-
-?>
\ No newline at end of file
index 34da624..7219a2e 100644 (file)
@@ -1,33 +1,37 @@
 <?php
-/****************************************************************/
-/* ATutor                                                                                                              */
-/****************************************************************/
-/* Copyright (c) 2002-2008 by Greg Gay & Joel Kronenberg        */
-/* Adaptive Technology Resource Centre / University of Toronto  */
-/* http://atutor.ca                                                                                            */
-/*                                                              */
-/* This program is free software. You can redistribute it and/or*/
-/* modify it under the terms of the GNU General Public License  */
-/* as published by the Free Software Foundation.                               */
-/****************************************************************/
+/***********************************************************************/
+/* ATutor                                                                                                                         */
+/***********************************************************************/
+/* Copyright (c) 2002-2009                                                                                        */
+/* Adaptive Technology Resource Centre / Inclusive Design Institute       */
+/* http://atutor.ca                                                                                                       */
+/*                                                                                                                                        */
+/* This program is free software. You can redistribute it and/or          */
+/* modify it under the terms of the GNU General Public License            */
+/* as published by the Free Software Foundation.                                          */
+/***********************************************************************/
 // $Id$
 
-//loads the pclzip library.
-define('PCLZIP_TEMPORARY_DIR', AT_CONTENT_DIR.'export'.DIRECTORY_SEPARATOR);
-include(AT_INCLUDE_PATH.'/classes/pclzip.lib.php');
-include(AT_INCLUDE_PATH.'..//mods/_core/file_manager/filemanager.inc.php');    //copy/delete folder
+define('PCLZIP_TEMPORARY_DIR', AT_CONTENT_DIR.'export'.DIRECTORY_SEPARATOR);  //constant for the temp folder.
+include(AT_INCLUDE_PATH.'/classes/pclzip.lib.php');     //loads the pclzip library.
+include_once(AT_INCLUDE_PATH.'..//mods/_core/file_manager/filemanager.inc.php');       //copy/delete folder
 
 /**
-* Class for creating and accessing an archive zip file
+* Class for creating and accessing an archive zip file.  Originally written by Joel Kronenberg,
+* edited by Harris Wong to use the PCLZIP library (http://www.phpconcept.net)
+*
+* As of ATutor 2.0, this file will extend the pclzip library functions instead of using Joel's.  
+* The function preconditions and postconditions will remain the same however. 
+*
 * @access      public
-* @link                http://www.pkware.com/products/enterprise/white_papers/appnote.html     for the specs
+* @link                http://www.pkware.com/documents/casestudies/APPNOTE.TXT for the specs
 * @author      Joel Kronenberg
 */
 class zipfile {
 
-
        /**
-        *
+        * string $zipfile_dir - the actual system directory that stores the temporary files for archiving.
+        * @access      private
         */
        var $zipfile_dir;
 
@@ -37,7 +41,10 @@ class zipfile {
        */
        var $is_closed; 
 
-       /** File name */
+       /** 
+        * string $filename -   randomized filename of this zip instance.  It also shares the same name
+        *                                              as the folder under the export/ folder.  
+        */
        var $filename; 
 
 
@@ -47,7 +54,7 @@ class zipfile {
        * @author       Joel Kronenberg
        */
        function zipfile() {
-               //create the 
+               //create the temp folder for export if it hasn't been created.
                if (!is_dir(PCLZIP_TEMPORARY_DIR)){
                        mkdir(PCLZIP_TEMPORARY_DIR);
                        copy(PCLZIP_TEMPORARY_DIR.'../index.html', PCLZIP_TEMPORARY_DIR.'index.html');
@@ -56,6 +63,7 @@ class zipfile {
                //generate a random hash 
                $this->filename = substr(md5(rand()), 0, 5);
 
+               //create a temporary folder for this zip instance
                $this->zipfile_dir = PCLZIP_TEMPORARY_DIR.$this->filename.DIRECTORY_SEPARATOR;
                mkdir($this->zipfile_dir);
                $this->is_closed = false;
@@ -78,8 +86,7 @@ class zipfile {
                        echo 'cant open dir: '.$dir.$pre_pend_dir;
                        exit;           
                }
-debug($dir, 'add dir');
-               //copy folder recursively
+               //copy folder recursively into the temp folder.
                copys($dir, $this->zipfile_dir.DIRECTORY_SEPARATOR.$zip_prefix_dir);
        }
 
@@ -91,7 +98,7 @@ debug($dir, 'add dir');
        * @author  Joel Kronenberg
        */
     function priv_add_dir($name, $timestamp = '') {   
-               //deprecated.
+               //deprecated as of ATutor 2.0
     } 
        
        /**
@@ -105,7 +112,7 @@ debug($dir, 'add dir');
        */
        function create_dir($name, $timestamp='') {
                $name = trim($name);
-               //don't create folder if it is itself
+               //don't create folder if it is itself
                if ($name=='' || $name=='.'){
                        return;
                }
@@ -120,9 +127,9 @@ debug($dir, 'add dir');
                        $this->create_dir(dirname($name));
                }
 
-               //returned stack. continue from where it left off.  
-               //Now, the parent folder is created, so it should be able to create its folder.
+               //returned stack. continue from where it left off.              
                if (!is_dir($this->zipfile_dir.$name)){
+                       //the parent folder should be created at this point, create itself
                        mkdir($this->zipfile_dir.$name);
                }
        }
@@ -146,6 +153,7 @@ debug($dir, 'add dir');
                        $this->create_dir(dirname($name));
                }
 
+               //write to file
                $fp = fopen($this->zipfile_dir.$name, 'w');
                fwrite($fp, $file_data);
                fclose($fp);            
@@ -158,8 +166,7 @@ debug($dir, 'add dir');
        * @author  Joel Kronenberg
        */
        function close() {
-               //save file 
-
+               //use pclzip to compress the file, and save it in the temp folder.
                $archive = new PclZip($this->zipfile_dir.$this->filename.'.zip');
                $v_list = $archive->create($this->zipfile_dir, 
                                                        PCLZIP_OPT_REMOVE_PATH, $this->zipfile_dir);
@@ -168,8 +175,7 @@ debug($dir, 'add dir');
                if ($v_list == 0) {
                die ("Error: " . $archive->errorInfo(true));
                }
-
-//             debug($v_list);         
+               
                $this->is_closed = true;
        }
 
@@ -244,6 +250,10 @@ debug($dir, 'add dir');
 
        /**
         * Destructor - removes temporary folder and its content.
+        * Should self-destruct automatically for PHP 5.0+; otherwise developers should call this function
+        * to clean up.
+        * @access      public
+        * @author      Harris Wong
         */
        function __destruct(){
                clr_dir($this->zipfile_dir);
diff --git a/docs/include/classes/zipfile.class.php.bak b/docs/include/classes/zipfile.class.php.bak
new file mode 100644 (file)
index 0000000..690cdcb
--- /dev/null
@@ -0,0 +1,368 @@
+<?php
+/****************************************************************/
+/* ATutor                                                                                                              */
+/****************************************************************/
+/* Copyright (c) 2002-2008 by Greg Gay & Joel Kronenberg        */
+/* Adaptive Technology Resource Centre / University of Toronto  */
+/* http://atutor.ca                                                                                            */
+/*                                                              */
+/* This program is free software. You can redistribute it and/or*/
+/* modify it under the terms of the GNU General Public License  */
+/* as published by the Free Software Foundation.                               */
+/****************************************************************/
+// $Id: zipfile.class.php 7208 2008-01-09 16:07:24Z greg $
+
+
+/**
+* Class for creating and accessing an archive zip file
+* @access      public
+* @link                http://www.pkware.com/products/enterprise/white_papers/appnote.html     for the specs
+* @author      Joel Kronenberg
+*/
+class zipfile {
+
+       /**
+       * string $files_data - stores file information like the header and description 
+       * @access  public 
+       */
+       var $files_data;
+
+       /**
+       * string $central_directory_headers - headers necessary for including file in central record
+       * @access  public 
+       */
+       var $central_directory_headers; 
+
+       /**
+       * int $num_entries - a counter for the number of entries in the archive
+       * @access  public 
+       */
+       var $num_entries = 0;
+
+       /**
+       * string $zip_file - complete contents of file
+       * @access  public 
+       */
+       var $zip_file;
+
+       /**
+       * boolean $is_closed - flag set to true if file is closed, false if still open
+       * @access  private
+       */
+       var $is_closed; 
+
+
+       /**
+       * Constructor method.  Initialises variables.
+       * @access       public
+       * @author       Joel Kronenberg
+       */
+       function zipfile() {
+               $this->files_data = '';
+               $this->central_directory_headers = '';
+               $this->num_entries = 0;
+               $this->is_closed = false;
+       }
+
+       /**
+       * Public interface for adding a dir and its contents recursively to zip file
+       * @access  public
+       * @param   string $dir                          the real system directory that contains the files to add to the zip              
+       * @param   string $zip_prefix_dir       the zip dir where the contents of $dir will be put in
+       * @param   string $pre_pend_dir         used during the recursion to keep track of the path, default=''
+       * @see     $_base_path                          in include/vitals.inc.php
+       * @see     priv_add_dir()                       in include/classes/zipfile.class.php
+       * @see     add_file()                           in include/classes/zipfile.class.php
+       * @author  Joel Kronenberg
+       */
+       function add_dir($dir, $zip_prefix_dir, $pre_pend_dir='') {
+               if (!($dh = @opendir($dir.$pre_pend_dir))) {
+                       echo 'cant open dir: '.$dir.$pre_pend_dir;
+                       exit;
+               }
+
+               while (($file = readdir($dh)) !== false) {
+                       /* skip directories */
+                       if ($file == '.' || $file == '..') {
+                               continue;
+                       }
+                       /* skip potential harmful files/directories */
+                       if ( (strpos($file, '..') !== false) || (strpos($file, '/') !== false)) {
+                               continue;
+                       }
+
+                       $file_info = stat( $dir . $pre_pend_dir . $file );
+
+                       if (is_dir( $dir . $pre_pend_dir . $file )) {
+                               /* create this dir in the zip */
+                               $this->priv_add_dir( $zip_prefix_dir . $pre_pend_dir . $file . '/',
+                                                                        $file_info['mtime'] );
+
+                               /* continue recursion, going down this dir */
+                               $this->add_dir( $dir,
+                                                               $zip_prefix_dir,
+                                                               $pre_pend_dir . $file . '/' );
+
+                       } else {
+                               /* add this file to the zip */
+                               $this-> add_file( file_get_contents($dir . $pre_pend_dir . $file),
+                                                                 $zip_prefix_dir . $pre_pend_dir . $file,
+                                                                 $file_info['mtime'] );
+                       }
+               }
+               closedir($dh);
+       }
+
+       /**
+       * Adding a dir to the archive 
+       * @access  private
+       * @param   string $name                         directory name
+       * @param   string $timestamp            time, default=''
+       * @author  Joel Kronenberg
+       */
+    function priv_add_dir($name, $timestamp = '') {   
+        $name = str_replace("\\", "/", $name);   
+               $old_offset = strlen($this->files_data);
+
+        $local_file_header  = "\x50\x4b\x03\x04";                                                                                              // local file header signature 4 bytes (0x04034b50) 
+        $local_file_header .= "\x0a\x00";    // ver needed to extract                                                  // version needed to extract 2 bytes
+        $local_file_header .= "\x00\x00";    // gen purpose bit flag                                                   // general purpose bit flag 2 bytes
+        $local_file_header .= "\x00\x00";    // compression method                                                             // compression method 2 bytes
+        $local_file_header .= "\x00\x00\x00\x00"; // last mod time and date                                    // last mod file time 2 bytes & last mod file date 2 bytes 
+        $local_file_header .= pack("V",0); // crc32                                                                                    // crc-32 4 bytes
+        $local_file_header .= pack("V",0); //compressed filesize                                                               // compressed size 4 bytes 
+        $local_file_header .= pack("V",0); //uncompressed filesize                                                             // uncompressed size 4 bytes
+        $local_file_header .= pack("v", strlen($name) ); //length of pathname                                  // file name length 2 bytes 
+        $local_file_header .= pack("v", 0 ); //extra field length                                                              // extra field length 2 bytes           
+        $local_file_header .= $name;                                                                                                                   // file name (variable size)  & extra field (variable size)
+        // end of "local file header" segment 
+
+        // no "file data" segment for path 
+
+        // add this entry to array 
+        $this->files_data .= $local_file_header;
+
+        // ext. file attributes mirrors MS-DOS directory attr byte, detailed 
+        // at http://support.microsoft.com/support/kb/articles/Q125/0/19.asp 
+
+               if ($timestamp) {
+                       $v_date = getdate($timestamp);
+               } else {
+                       $v_date = getdate();
+               }
+               $time = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
+               $date = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];
+
+        // now add to central record 
+        $central_directory = "\x50\x4b\x01\x02";                                                                                       // central file header signature 4 bytes (0x02014b50)
+        $central_directory .="\x14\x00";    // version made by                                                         // version made by 2 bytes
+        $central_directory .="\x14\x00";    // version needed to extract                                       // version needed to extract 2 bytes
+        $central_directory .="\x00\x00";    // gen purpose bit flag                                                    // general purpose bit flag 2 bytes
+        $central_directory .="\x00\x00";    // compression method                                                      // compression method 2 bytes
+               $central_directory .= pack("v",$time); // time                                                                          // last mod file time 2 bytes
+        $central_directory .= pack("v",$date); // date                                                                         // last mod file date 2 bytes
+        $central_directory .= pack("V", 0); // crc32                                                                           // crc-32 4 bytes
+        $central_directory .= pack("V", 0); // compressed filesize                                                     // compressed size 4 bytes
+        $central_directory .= pack("V", 0); // uncompressed filesize                                           // uncompressed size 4 bytes
+        $central_directory .= pack("v", strlen($name) ); //length of filename                          // file name length 2 bytes
+        $central_directory .= pack("v", 0); // extra field length                                                      // extra field length 2 bytes
+        $central_directory .= pack("v", 0); // file comment length                                                     // file comment length 2 bytes 
+        $central_directory .= pack("v", 0); // disk number start                                                       // disk number start 2 bytes
+        $central_directory .= pack("v", 0); // internal file attributes                                                // internal file attributes 2 bytes
+        $central_directory .= pack("V", 16+32); //external file attributes  - 'directory' 'archive' bit set // external file attributes 4 bytes
+        $central_directory .= pack("V", $old_offset); //relative offset of local header // relative offset of local header 4 bytes
+        $central_directory .= $name;                                                                                                           // file name (variable size)
+
+       $this->central_directory_headers .= $central_directory;
+
+               $this->num_entries++;
+    } 
+       
+       /**
+       * Public interface to create a directory in the archive.
+       * @access  public
+       * @param   string $name                         directory name
+       * @param   string $timestamp            time of creation, default=''
+       * @see     $_base_path                          in include/vitals.inc.php
+       * @see     priv_add_dir()                       in include/zipfile.class.php
+       * @author  Joel Kronenberg
+       */
+       function create_dir($name, $timestamp='') {
+               $name = trim($name);
+
+               if (substr($name, -1) != '/') {
+                       /* add the trailing slash */
+                       $name .= '/';
+               }
+
+               $this->priv_add_dir($name, $timestamp = '');
+       }
+
+       /**
+       * Adds a file to the archive.
+       * @access  public
+       * @param   string $file_data            file contents
+       * @param   string $name                         name of file in archive (add path if your want)
+       * @param   string $timestamp            time of creation, default=''
+       * @see     $_base_path                          in include/vitals.inc.php
+       * @see     priv_add_dir()                       in include/zipfile.class.php
+       * @author  Joel Kronenberg
+       */
+    function add_file($file_data, $name, $timestamp = '') {
+        $name = str_replace("\\", "/", $name);   
+        $crc = crc32($file_data);
+        $uncompressed_size = strlen($file_data);
+               $file_data = substr(gzcompress($file_data, 9), 2, -4);
+        $compressed_size = strlen($file_data);
+               $old_offset = strlen($this->files_data);
+
+               /* local file header */
+        $local_file_header = "\x50\x4b\x03\x04";                                                               // local file header signature 4 bytes (0x04034b50) 
+        $local_file_header .= "\x14\x00";    // ver needed to extract                  // version needed to extract 2 bytes 
+        $local_file_header .= "\x00\x00";    // gen purpose bit flag                   // general purpose bit flag 2 bytes 
+        $local_file_header .= "\x08\x00";    // compression method                             // compression method 2 bytes 
+        $local_file_header .= "\x00\x00\x00\x00"; // last mod time and date    // last mod file time 2 bytes & last mod file date 2 bytes 
+        $local_file_header .= pack("V",$crc); // crc32                                                 // crc-32 4 bytes 
+        $local_file_header .= pack("V",$compressed_size); //compressed filesize                        // compressed size 4 bytes 
+        $local_file_header .= pack("V",$uncompressed_size); //uncompressed filesize            // uncompressed size 4 bytes 
+        $local_file_header .= pack("v", strlen($name) ); //length of filename  // file name length 2 bytes 
+        $local_file_header .= "\x00\x00"; //extra field length                         // extra field length 2 bytes 
+        $local_file_header .= $name;                                                                                   // file name (variable size)  & extra field (variable size) 
+               /* end of local file header */
+          
+               $this->files_data .= $local_file_header . $file_data; // . $data_descriptor;;
+
+               /* create the central directory */
+               $central_directory = '';
+               if ($timestamp) {
+                       $v_date = getdate($timestamp);
+               } else {
+                       $v_date = getdate();
+               }
+               $time = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
+               $date = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];
+
+        // now add to central directory record 
+        $central_directory = "\x50\x4b\x01\x02";                                                                                       // central file header signature 4 bytes (0x02014b50)
+        $central_directory .="\x14\x00";    // version made by                                                         // version made by 2 bytes 
+        $central_directory .="\x14\x00";    // version needed to extract                                       // version needed to extract 2 bytes 
+        $central_directory .="\x00\x00";    // gen purpose bit flag                                                    // general purpose bit flag 2 bytes 
+        $central_directory .="\x08\x00";    // compression method                                                      // compression method 2 bytes         
+        $central_directory .= pack("v",$time); // time                                                                         // last mod file time 2 bytes 
+               $central_directory .= pack("v",$date); // date                                                                          // last mod file date 2 bytes 
+               $central_directory .= pack("V",$crc); // crc32                                                                          // crc-32 4 bytes 
+        $central_directory .= pack("V",$compressed_size); //compressed filesize                                                // compressed size 4 bytes 
+        $central_directory .= pack("V",$uncompressed_size); //uncompressed filesize                                    // uncompressed size 4 bytes 
+        $central_directory .= pack("v", strlen($name) ); //length of filename                          // file name length 2 bytes 
+        $central_directory .= "\x00\x00"; //extra field length                                                 // extra field length 2 bytes 
+        $central_directory .= "\x00\x00"; //file comment length                                                        // file comment length 2 bytes 
+        $central_directory .= "\x00\x00"; //disk number start                                                  // disk number start 2 bytes 
+        $central_directory .= "\x00\x00"; //internal file attributes                                           // internal file attributes 2 bytes 
+        $central_directory .= pack("V", 32); //external file attributes - 'archive' bit set // external file attributes 4 bytes 
+               $central_directory .= pack("V", $old_offset);
+
+        $central_directory .= $name;                                                                                                           // file name (variable size)
+
+               $this->central_directory_headers .= $central_directory;
+       
+               $this->num_entries++;
+    } 
+
+       /**
+       * Closes archive, sets $is_closed to true
+       * @access  public
+       * @param   none
+       * @author  Joel Kronenberg
+       */
+       function close() {
+               $this->files_data .= $this->central_directory_headers . "\x50\x4b\x05\x06\x00\x00\x00\x00" .   
+            pack("v", $this->num_entries).     // total # of entries "on this disk" 
+            pack("v", $this->num_entries).     // total # of entries overall 
+            pack("V", strlen($this->central_directory_headers)).             // size of central dir 
+            pack("V", strlen($this->files_data)).                 // offset to start of central dir 
+            "\x00\x00"; 
+
+               unset($this->central_directory_headers);
+               unset($this->num_entries);
+
+               $this->zip_file =& $this->files_data;
+               $this->is_closed = true;
+       }
+
+    /**
+       * Gets size of new archive
+       * Only call this after calling close() - will return false if the zip wasn't close()d yet
+       * @access  public
+       * @return  int  size of file
+       * @author  Joel Kronenberg
+       */
+       function get_size() {
+               if (!$this->is_closed) {
+                       return false;
+               }
+               return strlen($this->zip_file);
+       }
+
+
+    /**
+       * Returns binary file
+       * @access       public
+       * @see          get_size()              in include/classes/zipfile.class.php
+       * @author  Joel Kronenberg
+       */      
+       function get_file() {
+               if (!$this->is_closed) {
+                       $this->close();
+               }
+               return $this->zip_file;
+    }
+
+       /**
+       * Writes the file to disk.
+       * Similar to get_file(), but instead of returning the file, it saves it to disk.
+       * @access  public
+       * @author  Joel Kronenberg
+       * @param  $file The full path and file name of the destination file.
+       */
+       function write_file($file) {
+               if (!$this->is_closed) {
+                       $this->close();
+               }
+               if (function_exists('file_put_contents')) {
+                       file_put_contents($file, $this->zip_file);
+               } else {
+                       $fp = fopen($file, 'wb+');
+                       fwrite($fp, $this->zip_file);
+                       fclose($fp);
+               }
+       }
+
+
+    /**
+       * Outputs the file - sends headers to browser to force download
+       * Only call this after calling close() - will return false if the zip wasn't close()d yet
+       * @access       public
+       * @see          get_size()              in include/classes/zipfile.class.php
+       * @author  Joel Kronenberg
+       */
+       function send_file($file_name) {
+               if (!$this->is_closed) {
+                       $this->close();
+               }
+               $file_name = str_replace(array('"', '<', '>', '|', '?', '*', ':', '/', '\\'), '', $file_name);
+
+               header('Content-Type: application/x-zip');
+               header('Content-transfer-encoding: binary'); 
+               header('Content-Disposition: attachment; filename="'.htmlspecialchars($file_name).'.zip"');
+               header('Expires: 0');
+               header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
+               header('Pragma: public');
+               header('Content-Length: '.$this->get_size());
+
+               echo $this->get_file();
+
+               exit;
+       }
+}
+
+?>
\ No newline at end of file
index 42fc8aa..9d17717 100644 (file)
@@ -230,7 +230,7 @@ function delete_theme ($theme_dir) {
 \r
        } else {        //disable, clear directory and delete theme from db\r
 \r
-               require(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php'); /* for clr_dir() */\r
+               require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php'); /* for clr_dir() */\r
                if ($status != 0) {\r
                        disable_theme($theme_dir);\r
                        $msg->deleteFeedback('THEME_DISABLED');\r
index 44c7db7..309a7c9 100644 (file)
@@ -17,7 +17,7 @@ require(AT_INCLUDE_PATH.'vitals.inc.php');
 admin_authenticate(AT_ADMIN_PRIV_BACKUPS);
 
 require(AT_INCLUDE_PATH.'../mods/_core/backups/classes/Backup.class.php');
-require(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
+require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
 
 if (isset($_POST['backup_id'])) {
        $ids = explode('_', $_POST['backup_id']);
index 3b48742..f3e9f48 100644 (file)
@@ -16,7 +16,7 @@ define('AT_INCLUDE_PATH', '../../../../include/');
 require(AT_INCLUDE_PATH.'vitals.inc.php');
 admin_authenticate(AT_ADMIN_PRIV_BACKUPS);
 
-require(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
+require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
 require(AT_INCLUDE_PATH.'../mods/_core/backups/classes/Backup.class.php');
 
 $page = 'backups';
index 41c8530..ba30dfa 100644 (file)
@@ -19,7 +19,7 @@ require(AT_INCLUDE_PATH.'vitals.inc.php');
 authenticate(AT_PRIV_ADMIN);
 
 require(AT_INCLUDE_PATH.'../mods/_core/backups/classes/Backup.class.php');
-require(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
+require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
 
 if (isset($_POST['restore'], $_POST['backup_id'])) {
        header('Location: restore.php?backup_id=' . $_POST['backup_id']);
index 09570f5..4f7b38c 100644 (file)
@@ -17,7 +17,7 @@ require(AT_INCLUDE_PATH.'vitals.inc.php');
 
 authenticate(AT_PRIV_ADMIN); 
 require(AT_INCLUDE_PATH.'../mods/_core/backups/classes/Backup.class.php');
-require(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
+require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
 
 $Backup = new Backup($db, $_SESSION['course_id']);
 
index 4e19849..cf5722e 100644 (file)
@@ -19,7 +19,7 @@ global $db, $associated_forum;
 $get_related_glossary = true;
 require(AT_INCLUDE_PATH.'vitals.inc.php');
 require(AT_INCLUDE_PATH.'lib/tinymce.inc.php');
-require(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
+require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
 
 $cid = intval($_REQUEST['cid']);
 
@@ -294,7 +294,7 @@ $pid = intval($_REQUEST['pid']);
        if (is_array($word)) {
                /* update $_POST['glossary_defs'] with any new/changed terms */
                for($i=0; $i<$num_terms; $i++) {
-                       $word[$i] = $word[$i];
+                       $word[$i] = htmlentities_utf8($word[$i]);
                        if (!isset($_POST['glossary_defs'][$word[$i]])) {
                                $_POST['glossary_defs'][$word[$i]] = $glossary[$word[$i]];
                        }
@@ -303,6 +303,7 @@ $pid = intval($_REQUEST['pid']);
 
        if (is_array($_POST['glossary_defs']) && ($current_tab != 2)) {
                foreach($_POST['glossary_defs'] as $w => $d) {
+
                        /* this term still exists in the content */
                        if (!in_array($w, $word)) {
                                unset($_POST['glossary_defs'][$w]);
index c4161fd..a6ad25c 100644 (file)
@@ -13,7 +13,7 @@
 
 define('AT_INCLUDE_PATH', '../../../include/');
 require(AT_INCLUDE_PATH.'vitals.inc.php');
-require(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
+require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
 
 global $db;
 
index cd3323b..99e703f 100644 (file)
@@ -14,7 +14,7 @@
 \r
 define('AT_INCLUDE_PATH', '../../../include/');\r
 require(AT_INCLUDE_PATH.'vitals.inc.php');\r
-require(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');\r
+require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');\r
 \r
 \r
 if (!authenticate(AT_PRIV_FILES,AT_PRIV_RETURN)) {\r
index d2c2668..611c625 100644 (file)
@@ -14,7 +14,7 @@
 
 define('AT_INCLUDE_PATH', '../../../include/');
 require(AT_INCLUDE_PATH.'vitals.inc.php');
-require(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
+require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
 
 if ((isset($_REQUEST['popup']) && $_REQUEST['popup']) && 
        (!isset($_REQUEST['framed']) || !$_REQUEST['framed'])) {
index 90a145a..a59c1fa 100644 (file)
@@ -14,7 +14,7 @@
 
 define('AT_INCLUDE_PATH', '../../../include/');
 require(AT_INCLUDE_PATH.'vitals.inc.php');
-require(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
+require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
 
 if (!authenticate(AT_PRIV_FILES,AT_PRIV_RETURN)) {
        authenticate(AT_PRIV_CONTENT);
index 151b952..95fa8cc 100644 (file)
@@ -14,7 +14,7 @@
 
 define('AT_INCLUDE_PATH', '../../../include/');
 require(AT_INCLUDE_PATH.'vitals.inc.php');
-require(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
+require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
 
 if (!authenticate(AT_PRIV_FILES,AT_PRIV_RETURN)) {
        authenticate(AT_PRIV_CONTENT);
index e196e16..1cb48c2 100644 (file)
@@ -13,7 +13,7 @@
 
 define('AT_INCLUDE_PATH', '../../../include/');
 require(AT_INCLUDE_PATH.'vitals.inc.php');
-require(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
+require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
 
 if (!authenticate(AT_PRIV_FILES,AT_PRIV_RETURN)) {
        authenticate(AT_PRIV_CONTENT);
index 406c0ec..d5c6e5f 100644 (file)
@@ -14,7 +14,7 @@
 
 define('AT_INCLUDE_PATH', '../../../include/');
 require(AT_INCLUDE_PATH.'vitals.inc.php');
-require(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
+require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
 
 if (!authenticate(AT_PRIV_FILES,AT_PRIV_RETURN)) {
        authenticate(AT_PRIV_CONTENT);
index 5851ed1..e9b9b7d 100644 (file)
@@ -17,7 +17,7 @@ $page = 'file_manager';
 define('AT_INCLUDE_PATH', '../../../include/');
 require(AT_INCLUDE_PATH.'vitals.inc.php');
 require(AT_INCLUDE_PATH.'classes/pclzip.lib.php');
-require(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
+require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
 
 if (!authenticate(AT_PRIV_FILES,AT_PRIV_RETURN)) {
        authenticate(AT_PRIV_CONTENT);
index 0c75507..8b47970 100644 (file)
@@ -13,7 +13,7 @@
 define('AT_INCLUDE_PATH', '../../../include/');
 require(AT_INCLUDE_PATH.'vitals.inc.php');
 
-require(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php'); /* for clr_dir() and preImportCallBack and dirsize() */
+require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php'); /* for clr_dir() and preImportCallBack and dirsize() */
 require(AT_INCLUDE_PATH.'classes/pclzip.lib.php');
 require(AT_INCLUDE_PATH.'../mods/_core/imsqti/lib/qti.inc.php'); 
 require(AT_INCLUDE_PATH.'../mods/_core/imsqti/classes/QTIImport.class.php');
index 8024f1e..ce6d9cd 100644 (file)
@@ -607,7 +607,7 @@ class Module {
 
                if (!$msg->containsErrors()) 
                {
-                       require(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
+                       require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
                                                
                        if (!clr_dir(AT_MODULE_PATH . $this->_directoryName))
                                $msg->addError(array('MODULE_UNINSTALL', '<li>'.AT_MODULE_PATH . $this->_directoryName.' can not be removed. Please manually remove it.</li>'));
index 41b384f..58e1478 100644 (file)
@@ -16,7 +16,7 @@ define('AT_INCLUDE_PATH', '../../../include/');
 require(AT_INCLUDE_PATH.'vitals.inc.php');
 admin_authenticate(AT_ADMIN_PRIV_ADMIN);
 
-require(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
+require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
 
 $dir_name = str_replace(array('.','..'), '', $_GET['mod_dir']);
 
index c645dab..6de9135 100644 (file)
@@ -16,7 +16,7 @@ define('AT_INCLUDE_PATH', '../../../include/');
 require (AT_INCLUDE_PATH.'vitals.inc.php');
 admin_authenticate(AT_ADMIN_PRIV_ADMIN);
 require(AT_INCLUDE_PATH.'../mods/_core/modules/classes/ModuleListParser.class.php');
-require(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
+require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
 
 // delete all folders and files in $dir
 function clear_dir($dir)
index 1659381..45d644c 100644 (file)
@@ -17,7 +17,7 @@ require(AT_INCLUDE_PATH.'vitals.inc.php');
 admin_authenticate(AT_ADMIN_PRIV_ADMIN);
 
 require(AT_INCLUDE_PATH.'../mods/_core/modules/classes/ModuleParser.class.php');
-require(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
+require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
 
 // module content folder
 $module_content_folder = AT_CONTENT_DIR . "module/";
index 138350f..574f93e 100644 (file)
@@ -23,7 +23,7 @@ if (isset($_POST['submit_no'])) {
        header('Location: ../../courses/admin/courses.php');
        exit;
 } else if (isset($_POST['step']) && ($_POST['step'] == 2) && isset($_POST['submit_yes'])) {
-       require(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
+       require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
        require(AT_INCLUDE_PATH.'../mods/_core/properties/lib/delete_course.inc.php');
 
        delete_course($course, $entire_course = true, $rel_path = '../'); // delete the course
index a4c44a8..7afb2a4 100644 (file)
@@ -23,7 +23,7 @@ if (isset($_POST['submit_no'])) {
        header('Location: '.AT_BASE_HREF.'mods/_core/properties/course_properties.php');
        exit;
 } else if (isset($_POST['step']) && ($_POST['step'] == 2) && isset($_POST['submit_yes'])) {
-       require(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
+       require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
        require(AT_INCLUDE_PATH.'../mods/_core/properties/lib/delete_course.inc.php');
 
        delete_course($_SESSION['course_id'], $entire_course = true); // delete the course
index 668b726..fe1c59f 100644 (file)
@@ -47,7 +47,7 @@ function resize_image($src, $dest, $src_h, $src_w, $dest_h, $dest_w, $type) {
 }
 
 function add_update_course($_POST, $isadmin = FALSE) {
-       require(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
+       require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
 
        global $addslashes;
        global $db;
index e44273c..78a1993 100644 (file)
@@ -16,7 +16,7 @@ $_user_location = 'admin';
 // 1. define relative path to `include` directory:\r
 define('AT_INCLUDE_PATH', '../../../include/');\r
 require (AT_INCLUDE_PATH . 'vitals.inc.php');\r
-require(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');\r
+require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');\r
 require (AT_INCLUDE_PATH . 'classes/pclzip.lib.php');\r
 require (AT_INCLUDE_PATH . '../mods/_core/themes/classes/ThemeParser.class.php');\r
 admin_authenticate(AT_ADMIN_PRIV_THEMES);\r
index d547347..5413b13 100644 (file)
@@ -16,7 +16,7 @@ define('AT_INCLUDE_PATH', '../../../include/');
 require (AT_INCLUDE_PATH.'vitals.inc.php');
 admin_authenticate(AT_ADMIN_PRIV_ADMIN);
 require(AT_INCLUDE_PATH.'../mods/_core/themes/classes/ThemeListParser.class.php');
-require(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
+require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
 
 // delete all folders and files in $dir
 function clear_dir($dir)
index 5b5d64b..f222bb0 100644 (file)
@@ -230,7 +230,7 @@ function delete_theme ($theme_dir) {
 \r
        } else {        //disable, clear directory and delete theme from db\r
 \r
-               require(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php'); /* for clr_dir() */\r
+               require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php'); /* for clr_dir() */\r
                if ($status != 0) {\r
                        disable_theme($theme_dir);\r
                        $msg->deleteFeedback('THEME_DISABLED');\r
index 16b6336..b26f4f2 100644 (file)
@@ -16,7 +16,7 @@ define('AT_INCLUDE_PATH', '../../../include/');
 require(AT_INCLUDE_PATH.'vitals.inc.php');
 admin_authenticate(AT_ADMIN_PRIV_ADMIN);
 
-require(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
+require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
 require(AT_INCLUDE_PATH . '../mods/_core/themes/classes/ThemeParser.class.php');
 
 // theme content folder
index 620be83..5bc9e3d 100644 (file)
@@ -14,7 +14,7 @@
 
 define('AT_INCLUDE_PATH', '../../../include/');
 require(AT_INCLUDE_PATH.'vitals.inc.php');
-require(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php'); // for get_human_size()
+require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php'); // for get_human_size()
 require(AT_INCLUDE_PATH.'../mods/_standard/file_storage/file_storage.inc.php');
 
 // check folders and files id
index 01ae779..b83f653 100644 (file)
@@ -14,7 +14,7 @@
 \r
 define('AT_INCLUDE_PATH', '../../../include/');\r
 require(AT_INCLUDE_PATH.'vitals.inc.php');\r
-require(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php'); // for get_human_size()\r
+require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php'); // for get_human_size()\r
 require(AT_INCLUDE_PATH.'../mods/_standard/file_storage/file_storage.inc.php');\r
 \r
 $owner_type = abs($_REQUEST['ot']);\r
index e4bf882..937331d 100644 (file)
@@ -92,7 +92,7 @@ function updatePatchesRecord($patch_id, $updateInfo)
 * @author  Cindy Qi Li\r
 */\r
 function clear_dir($dir) {\r
-       require(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');\r
+       require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');\r
                \r
        if(!$opendir = @opendir($dir)) {\r
                return false;\r
index 72016e2..90329ed 100644 (file)
@@ -13,7 +13,7 @@
 // $Id: import_test.php 9081 2010-01-13 20:26:03Z cindy $
 define('AT_INCLUDE_PATH', '../../../include/');
 require(AT_INCLUDE_PATH.'vitals.inc.php');
-require(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php'); /* for clr_dir() and preImportCallBack and dirsize() */
+require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php'); /* for clr_dir() and preImportCallBack and dirsize() */
 require(AT_INCLUDE_PATH.'../mods/_core/imsqti/lib/qti.inc.php'); 
 require(AT_INCLUDE_PATH.'classes/pclzip.lib.php');
 //require(AT_INCLUDE_PATH.'classes/QTI/QTIParser.class.php');  
index 887905e..2436d9b 100644 (file)
@@ -14,7 +14,7 @@
 
 define('AT_INCLUDE_PATH', '../../../include/');
 require(AT_INCLUDE_PATH.'vitals.inc.php');
-require(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php'); /* for clr_dir() and preImportCallBack and dirsize() */
+require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php'); /* for clr_dir() and preImportCallBack and dirsize() */
 require(AT_INCLUDE_PATH.'../mods/_core/imsqti/lib/qti.inc.php');
 require(AT_INCLUDE_PATH.'classes/pclzip.lib.php');
 //require(AT_INCLUDE_PATH.'classes/QTI/QTIParser.class.php');