http://atutor.ca/atutor/mantis/view.php?id=4506
authorharris wong <hwong@ocad.ca>
Fri, 8 Oct 2010 20:43:03 +0000 (20:43 -0000)
committerharris wong <hwong@ocad.ca>
Fri, 8 Oct 2010 20:43:03 +0000 (20:43 -0000)
- shorten the ims import path with 6 hex characters instead of the whole url.

docs/include/vitals.inc.php
docs/mods/_core/imscp/ims_import.php

index 7dec804..47afb4b 100644 (file)
@@ -1375,6 +1375,8 @@ function htmlentities_utf8($str, $use_nl2br=true){
  * Convert all '&' to '&amp;' from the input
  * @param   string  any string input, mainly URLs.
  * @return  input with & replaced to '&amp;'
+ * @author  Harris Wong
+ * @date    Oct 7, 2010
  */
 function convert_amp($input){
     $input = str_replace('&amp;', '&', $input); //convert everything to '&' first
index 48351f7..0285ccb 100644 (file)
@@ -747,8 +747,9 @@ if (isset($_POST['url']) && ($_POST['url'] != 'http://') ) {
        $_FILES['file']['tmp_name'] = $full_filename;
        $_FILES['file']['size']     = strlen($content);
        unset($content);
-       $url_parts = pathinfo($_POST['url']);
-       $package_base_name_url = $url_parts['basename'];
+       //$url_parts = pathinfo($_POST['url']);
+       //$package_base_name_url = $url_parts['basename'];
+    $package_base_name_url = md5(time());
 }
 $ext = pathinfo($_FILES['file']['name']);
 $ext = $ext['extension'];
@@ -963,7 +964,7 @@ if ($msg->containsErrors()) {
 /* the 'content_path' field in the content table will be set to this path. */
 /* $package_base_name_url comes from the URL file name (NOT the file name of the actual file we open)*/
 if (!$package_base_name && $package_base_name_url) {
-       $package_base_name = substr($package_base_name_url, 0, -4);
+       $package_base_name = substr($package_base_name_url, -6);
 } else if (!$package_base_name) {
        $package_base_name = substr($_FILES['file']['name'], 0, -4);
 }