Changeset 1021481
- Timestamp:
- 11/07/2014 12:18:39 PM (11 years ago)
- Location:
- media-file-manager/trunk
- Files:
-
- 2 edited
-
media-relocator.js (modified) (3 diffs)
-
media-relocator.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
media-file-manager/trunk/media-relocator.js
r1011291 r1021481 596 596 } 597 597 if (that.check_invalid_chr(result)) { 598 alert(" The name is not valid.");598 alert("You cannot use the following characters and whitespace: " + that.invalid_chr_msg()); 599 599 return; 600 600 } … … 639 639 } 640 640 641 642 var invalid_chr = ["\\", "/", ":", "*", "?", "+", "\"", "<", ">", "|", "%", "&", "'", " ", "!", "#", "$", "(", ")", "{", "}"]; 643 641 644 // function name: MrlInputTextClass::invalid_chr 642 645 // description : check if invalid character exists in the name. … … 645 648 MrlInputTextClass.prototype.check_invalid_chr = function(str) 646 649 { 647 var chr = ["\\", "/", ":", "*", "?", "\"", "<", ">", "|", "%", "&"];648 650 var i; 649 for (i=0; i< chr.length; i++) {650 if (str.indexOf( chr[i]) >= 0) {651 for (i=0; i<invalid_chr.length; i++) { 652 if (str.indexOf(invalid_chr[i]) >= 0) { 651 653 return true; 652 654 } 653 655 } 654 656 return false; 657 } 658 659 MrlInputTextClass.prototype.invalid_chr_msg = function() 660 { 661 var msg = ""; 662 for (i=0; i<invalid_chr.length; i++) { 663 msg += invalid_chr[i] + " "; 664 } 665 return msg; 655 666 } 656 667 -
media-file-manager/trunk/media-relocator.php
r1011291 r1021481 4 4 Plugin URI: http://tempspace.net/plugins/?page_id=111 5 5 Description: You can make sub-directories in the upload directory, and move files into them. At the same time, this plugin modifies the URLs/path names in the database. Also an alternative file-selector is added in the editing post/page screen, so you can pick up media files from the subfolders easily. 6 Version: 1.3.1pre 6 Version: 1.3.1pre2 7 7 Author: Atsushi Ueda 8 8 Author URI: http://tempspace.net/plugins/ … … 158 158 global $mrelocator_uploaddir; 159 159 160 $local_post_dir = stripslashes($_POST['dir']); 160 161 $errflg = false; 161 162 162 $dir = mrl_adjpath($mrelocator_uploaddir . "/" . $ _POST['dir'], true);163 $dir = mrl_adjpath($mrelocator_uploaddir . "/" . $local_post_dir, true); 163 164 $dir0=array(); 164 165 mrelocator_getdir($dir, $dir0); … … 318 319 global $wpdb; 319 320 global $mrelocator_uploaddir; 321 322 $local_post_dir = stripslashes($_POST['dir']); 323 $local_post_newdir = stripslashes($_POST['newdir']); 324 320 325 ini_set("track_errors",true); 321 326 322 $dir = mrl_adjpath($mrelocator_uploaddir."/".$ _POST['dir'], true);323 $newdir = $ _POST['newdir'];324 327 $dir = mrl_adjpath($mrelocator_uploaddir."/".$local_post_dir, true); 328 $newdir = $local_post_newdir; 329 325 330 $res = chdir($dir); 326 331 if (!$res) die($php_errormsg); … … 371 376 372 377 $wpdb->show_errors(); 373 374 $dir = mrl_adjpath($mrelocator_uploaddir."/".$_POST['dir'], true); 378 379 $local_post_dir = stripslashes($_POST['dir']); 380 $local_post_from = stripslashes($_POST['from']); 381 $local_post_to = stripslashes($_POST['to']); 382 383 $dir = mrl_adjpath($mrelocator_uploaddir."/".$local_post_dir, true); 375 384 $subdir = substr($dir, strlen($mrelocator_uploaddir)); 376 385 377 $old[0] = $ _POST['from'];378 $new[0] = $ _POST['to'];386 $old[0] = $local_post_from; 387 $new[0] = $local_post_to; 379 388 if ($old[0] == $new[0]) die("Success"); 380 389 … … 425 434 $newp .= "/"; 426 435 } 427 $oldu = $mrelocator_uploadurl . ltrim($ _POST['dir'],"/") . $old[$i].(is_dir($newp)?"/":""); //old url428 $newu = $mrelocator_uploadurl . ltrim($ _POST['dir'],"/") . $new[$i].(is_dir($newp)?"/":""); //new url436 $oldu = $mrelocator_uploadurl . ltrim($local_post_dir,"/") . $old[$i].(is_dir($newp)?"/":""); //old url 437 $newu = $mrelocator_uploadurl . ltrim($local_post_dir,"/") . $new[$i].(is_dir($newp)?"/":""); //new url 429 438 $olda = $subdir.$old[$i]; //old attachment file name (subdir+basename) 430 439 $newa = $subdir.$new[$i]; //new attachment file name (subdir+basename) … … 487 496 ini_set("track_errors",true); 488 497 498 489 499 global $mrelocator_uploaddir; 490 500 global $mrelocator_uploadurl; 491 $dir_from = mrl_adjpath($mrelocator_uploaddir."/".$_POST['dir_from'], true); 492 $dir_to = mrl_adjpath($mrelocator_uploaddir."/".$_POST['dir_to'], true); 501 502 $local_post_dir_from = stripslashes($_POST['dir_from']); 503 $local_post_dir_to = stripslashes($_POST['dir_to']); 504 $local_post_items = stripslashes($_POST['items']); 505 506 507 $dir_from = mrl_adjpath($mrelocator_uploaddir."/".$local_post_dir_from, true); 508 $dir_to = mrl_adjpath($mrelocator_uploaddir."/".$local_post_dir_to, true); 493 509 $dir_to_list = array(); 494 510 mrelocator_getdir($dir_to, $dir_to_list); 495 511 496 $items0 = $ _POST['items'];512 $items0 = $local_post_items; 497 513 $items = explode("/",$items0); 498 514 … … 539 555 $isdir=true; 540 556 } 541 $oldu = mrl_adjpath( $mrelocator_uploadurl."/".$ _POST['dir_from']."/".$items[$i] ); //old url542 $newu = mrl_adjpath( $mrelocator_uploadurl."/".$ _POST['dir_to']."/".$items[$i] ); //new url557 $oldu = mrl_adjpath( $mrelocator_uploadurl."/".$local_post_dir_from."/".$items[$i] ); //old url 558 $newu = mrl_adjpath( $mrelocator_uploadurl."/".$local_post_dir_to."/".$items[$i] ); //new url 543 559 544 560 if ($wpdb->query("update $wpdb->posts set post_content=replace(post_content, '" . $oldu . "','" . $newu . "') where post_content like '%".$oldu."%'")===FALSE) {throw new Exception('1');} … … 588 604 { 589 605 global $mrelocator_uploaddir; 590 $dir = mrl_adjpath($mrelocator_uploaddir."/".$_POST['dir']."/".$_POST['name'], true); 606 607 $local_post_dir = stripslashes($_POST['dir']); 608 $local_post_name = stripslashes($_POST['name']); 609 610 $dir = mrl_adjpath($mrelocator_uploaddir."/".$local_post_dir."/".$local_post_name, true); 611 612 if (strstr($local_post_name,"\\")) { 613 $dir = substr($dir,0,strlen($dir)-strlen($local_post_name)-1).$local_post_name."/"; 614 } 615 591 616 if (!@rmdir($dir)) { 592 617 $error = error_get_last();
Note: See TracChangeset
for help on using the changeset viewer.