[dev] [commit] r917 - log phplib phplib/models wwwbase/elfinder-connector wwwbase/img/visual

automailer at dexonline.ro automailer at dexonline.ro
Mon Jul 29 15:29:17 EEST 2013


Author: cata
Date: Mon Jul 29 15:29:17 2013
New Revision: 917

Log:
Minor fixes for r912.

Added:
   wwwbase/img/visual/   (props changed)
Modified:
   log/   (props changed)
   phplib/SmartyWrap.php
   phplib/models/Visual.php
   wwwbase/elfinder-connector/elFinderModToDB.class.php

Modified: phplib/SmartyWrap.php
==============================================================================
--- phplib/SmartyWrap.php	Sat Jul 27 23:02:19 2013	(r916)
+++ phplib/SmartyWrap.php	Mon Jul 29 15:29:17 2013	(r917)
@@ -193,10 +193,9 @@
       case 'wotd':             self::$jsFiles[15] = 'wotd.js?v=1';
       case 'struct':           self::$jsFiles[16] = 'struct.js?v=3'; break;
       case 'jcrop':            self::$jsFiles[17] = 'jquery.Jcrop.min.js?v=2'; break;
-        
       case 'easyui':           self::$jsFiles[18] = 'jquery.easyui.min.js?v=1'; break;
       case 'select2':          self::$jsFiles[19] = 'select2.min.js?v=2'; break;
-      case 'visualTag':        self::$jsFiles[18] = 'visualTag.js'; break;
+      case 'visualTag':        self::$jsFiles[20] = 'visualTag.js'; break;
       default:
         FlashMessage::add("Cannot load JS script {$id}");
         util_redirect(util_getWwwRoot());

Modified: phplib/models/Visual.php
==============================================================================
--- phplib/models/Visual.php	Sat Jul 27 23:02:19 2013	(r916)
+++ phplib/models/Visual.php	Mon Jul 29 15:29:17 2013	(r917)
@@ -12,11 +12,6 @@
     return $matches[0];
   }
   
-  /** Adds an extra backslash before each slash in the string.
-    * Useful when replacing with regex. */
-  public static function escapeSlashes($string) {
-    return preg_replace('/\//', '\/', $string);
-  }
 }
 
 ?>

Modified: wwwbase/elfinder-connector/elFinderModToDB.class.php
==============================================================================
--- wwwbase/elfinder-connector/elFinderModToDB.class.php	Sat Jul 27 23:02:19 2013	(r916)
+++ wwwbase/elfinder-connector/elFinderModToDB.class.php	Mon Jul 29 15:29:17 2013	(r917)
@@ -31,7 +31,7 @@
       foreach($result['removed'] as $file) {
         $path = Visual::getPath($file['realpath']);
 
-        $line = Model::factory('Visual')->where_like('path', "{$path}")->find_one();
+        $line = Visual::get_by_path($path);
         /** rm command stores its info in $result['removed'] even for folders,
           * thus, it first checks if there were entries in the table that
           * matched the value in $file. */
@@ -52,16 +52,15 @@
         $entries = Model::factory('Visual')->where_like('path', "{$oldPath}/%")->find_many();
 
         if(!empty($entries)) {
-          $escOldPath = Visual::escapeSlashes($oldPath);
-
+          /** Directory was renamed **/
           foreach($entries as $entry) {
-            $entry->path = preg_replace("/{$escOldPath}/", "{$newPath}", $entry->path);
+            $entry->path = str_replace($oldPath, $newPath, $entry->path);
             $entry->save();
           }
 
         } else {
           /** Otherwise it changes the file path within the table */
-          $line = Model::factory('Visual')->where_like('path', "{$oldPath}")->find_one();
+          $line = Visual::get_by_path($oldPath);
 
           if(!empty($line)) {
             $line->path = $newPath;
@@ -77,7 +76,7 @@
         foreach($result['removed'] as $i => $file) {
           $oldPath = Visual::getPath($file['realpath']);
           $newPath = Visual::getPath($elfinder->realpath($result['added'][$i]['hash']));
-          $line = Model::factory('Visual')->where_like('path', "{$oldPath}")->find_one();
+          $line = Visual::get_by_path($oldPath);
 
           if(!empty($line)) {
             $line->path = $newPath;


More information about the Dev mailing list