removed mods directory from the ATutor codebase
[atutor.git] / mods / patcher / include / common.inc.php
diff --git a/mods/patcher/include/common.inc.php b/mods/patcher/include/common.inc.php
deleted file mode 100644 (file)
index 4095f48..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-<?php\r
-function print_errors( $errors, $notes='' ) {\r
-       ?>\r
-       <div class="input-form">\r
-       <table border="0" class="errbox" cellpadding="3" cellspacing="2" width="100%" summary="" align="center">\r
-       <tr class="errbox">\r
-               <td>\r
-               <h3 class="err"><img src="images/bad.gif" align="top" alt="" class="img" /> Warning</h3>\r
-               <?php\r
-                       echo '<ul>';\r
-                       foreach ($errors as $p) {\r
-                               echo '<li>'.$p.'</li>';\r
-                       }\r
-                       echo '</ul>';\r
-               ?>\r
-               </td>\r
-       </tr>\r
-       <tr>\r
-               <td>\r
-               <?php echo $notes; ?>\r
-               </td>\r
-       </tr>\r
-       </table>\r
-       </div>\r
-<?php\r
-}\r
-\r
-function print_feedback( $feedback, $notes='' ) {\r
-       ?>\r
-       <div class="input-form">\r
-       <table border="0" class="fbkbox" cellpadding="3" cellspacing="2" width="100%" summary="" align="center">\r
-       <tr class="fbkbox">\r
-       <td><h3 class="feedback2"><img src="images/feedback.gif" align="top" alt="" class="img" /> The patch has been installed successfully!</h3>\r
-               <?php\r
-                       echo '<ul>';\r
-                       foreach ($feedback as $p) {\r
-                               echo '<li>'.$p.'</li>';\r
-                       }\r
-                       echo '</ul>';\r
-               ?></td>\r
-       </tr>\r
-       <tr>\r
-               <td>\r
-               <?php echo $notes; ?>\r
-               </td>\r
-       </tr>\r
-       </table>\r
-       </div>\r
-<?php\r
-}\r
-\r
-\r
-/**\r
-* update patches.remove_permission_files & patches.backup_files\r
-* @access  private\r
-* @author  Cindy Qi Li\r
-*/\r
-function updatePatchesRecord($patch_id, $updateInfo)\r
-{\r
-       global $db;\r
-       \r
-       $sql_prefix = "Update ". TABLE_PREFIX. "patches set ";\r
-       \r
-       foreach ($updateInfo as $key => $value)\r
-       {\r
-               $sql_middle .= $key . "='" . $value . "', ";\r
-       }\r
-       \r
-       $sql = substr($sql_prefix . $sql_middle, 0, -2) . " where patches_id = " . $patch_id;\r
-\r
-       $result = mysql_query($sql, $db) or die(mysql_error());\r
-       \r
-       return true;\r
-}\r
-\r
-/**\r
-* This function deletes $dir recrusively without deleting $dir itself.\r
-* @access  public\r
-* @param   string $charsets_array      The name of the directory where all files and folders under needs to be deleted\r
-* @author  Cindy Qi Li\r
-*/\r
-function clear_dir($dir) {\r
-       include_once(AT_INCLUDE_PATH . '/lib/filemanager.inc.php');\r
-       \r
-       if(!$opendir = @opendir($dir)) {\r
-               return false;\r
-       }\r
-       \r
-       while(($readdir=readdir($opendir)) !== false) {\r
-               if (($readdir !== '..') && ($readdir !== '.')) {\r
-                       $readdir = trim($readdir);\r
-\r
-                       clearstatcache(); /* especially needed for Windows machines: */\r
-\r
-                       if (is_file($dir.'/'.$readdir)) {\r
-                               if(!@unlink($dir.'/'.$readdir)) {\r
-                                       return false;\r
-                               }\r
-                       } else if (is_dir($dir.'/'.$readdir)) {\r
-                               /* calls lib function to clear subdirectories recrusively */\r
-                               if(!clr_dir($dir.'/'.$readdir)) {\r
-                                       return false;\r
-                               }\r
-                       }\r
-               }\r
-       } /* end while */\r
-\r
-       @closedir($opendir);\r
-       \r
-       return true;\r
-}\r
-\r
-/**\r
- * Check if the patch has been installed\r
- */\r
-function is_patch_installed($patch_id)\r
-{\r
-       global $db;\r
-       \r
-       // Only displays the patches that are not installed\r
-       $sql = "select count(*) num_of_installed from ".TABLE_PREFIX."patches " .\r
-              "where atutor_patch_id = '" . $patch_id ."'".\r
-              " and status like '%Installed'";\r
-\r
-       $result = mysql_query($sql, $db) or die(mysql_error());\r
-       $row = mysql_fetch_assoc($result);\r
-       \r
-       if ($row["num_of_installed"] > 0) return true;\r
-       else return false;\r
-}\r
-\r
-?>\r