Changeset 724 for trunk/common
- Timestamp:
- 12/09/07 17:11:01 (13 months ago)
- Location:
- trunk/common
- Files:
-
- 2 added
- 2 modified
-
mvblog_admin.php (modified) (2 diffs)
-
mvblog_common.php (modified) (1 diff)
-
mvblog_import.php (added)
-
mvblog_import_wordpress.php (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/common/mvblog_admin.php
r695 r724 361 361 <a class="if_menu_item<?php if ($this->_selected_menuitem == "settings") { echo "_act"; } ?>" href="./index.php?action=show_settings"><?php echo gettext("Settings"); ?></a> 362 362 <a class="if_menu_item<?php if ($this->_selected_menuitem == "plugins") { echo "_act"; } ?>" href="./index.php?action=show_plugins"><?php echo gettext("Plugins"); ?></a> 363 <a class="if_menu_item<?php if ($this->_selected_menuitem == "import") { echo "_act"; } ?>" href="./index.php?action=show_import"><?php echo gettext("Import"); ?></a> 363 364 <a class="if_menu_item" href="./index.php?action=logout"><?php echo gettext("Logout"); ?></a> 364 365 </div> … … 1959 1960 } 1960 1961 /* }}} */ 1962 /* show_import {{{ */ 1963 /** 1964 * Show the import module screen with links to all the supported blogtools 1965 */ 1966 public function show_import() { 1967 $import = new MvBlog_import(); 1968 $import->show_options(); 1969 } 1970 /* }}} */ 1971 /* import {{{ */ 1972 /** 1973 * Run the blogtool import routine. 1974 * 1975 * @param string $type The blogtool to import from. Can only be 'wordpress' right now 1976 * @param array $options The additional parameters to pass to the specific import plugin called by run_module() 1977 */ 1978 public function import($type, $options = array()) { 1979 $import = new MvBlog_import(); 1980 $import->run_module($type, $options); 1981 } 1982 /* }}} */ 1961 1983 } 1962 1984 ?> -
trunk/common/mvblog_common.php
r682 r724 806 806 } 807 807 /* }}} */ 808 808 /* filesystem methods */ 809 /* copy_files {{{ */ 810 /** 811 * Copies files and directories recursive to dirs under site_images 812 * 813 * @param string $src The sourcefile or dir 814 * @param string $dst The dir inside site_images where the files/folders should be copied to 815 * @param int $overwrite_dest if set will overwrite the destination if it already exists 816 */ 817 public function copy_files($srcbase, $src, $dest, $overwrite_dest = 0) { 818 // calculate where the site_images dir is 819 $basepath = realpath(dirname(__FILE__)."/../site_images/"); 820 $dst = sprintf("%s/%s", $basepath, $dest); 821 //check if the dst dir is there 822 if (!is_dir($dst)) 823 if (!mkdir($dst)) 824 die("could not create directory $dst"); 825 if ($handle = opendir(sprintf("%s/%s", $srcbase, $src))) { //open source directory 826 while (false !== ($file = readdir($handle))) { //loop through all items in the opened source dir 827 if ($file != "." && $file != "..") { //we wont copy the special 'current dir' and 'one dir up' items 828 if ($src) 829 $path = sprintf("%s/%s", $src, $file); 830 else 831 $path = $file; 832 $s = sprintf("%s/%s", $srcbase, $path); 833 $d = sprintf("%s/%s", $dst, $path); 834 if (is_file($s)) { 835 if (is_file($d) || $overwrite_dest) { 836 if (!copy($s, $d)) 837 echo "Something went wrong while trying to copy $s to $d<br>"; 838 } 839 } elseif (is_dir($s)) { 840 if (!is_dir($d)) 841 if (!mkdir($d)) 842 echo "Something went wrong while trying to create dir $d<br>\n"; 843 $this->copy_files($srcbase, $path, $dest, 1); 844 } 845 } 846 } 847 closedir($handle); 848 } 849 } 850 /* }}} */ 809 851 /* output methods */ 810 852 /* html_header: {{{ */
