function delete_folder($folder) { global $BASE_DIR, $refresh_dirs; //var_dump($BASE_DIR); $del_folder = dir_name($BASE_DIR) . $folder; //echo $del_folder; if (is_dir($del_folder) && num_files($del_folder) <= 0) { //echo $del_folder.'<br>'; rm_all_dir($del_folder); $refresh_dirs = true; } }
function show_image($img, $file, $info, $size) { global $BASE_DIR, $BASE_URL, $newPath; $img_path = dir_name($img); $img_file = basename($img); $thumb_image = 'thumbs.php?img=' . urlencode($img); $img_url = $BASE_URL . $img_path . '/' . $img_file; $filesize = parse_size($size); ?> <td> <table width="102" border="0" cellpadding="0" cellspacing="2"> <tr> <td align="center" class="imgBorder" onMouseOver="pviiClassNew(this,'imgBorderHover')" onMouseOut="pviiClassNew(this,'imgBorder')"> <a href="javascript:;" onClick="javascript:imageSelected('<?php echo $img_url; ?> ', <?php echo $info[0]; ?> , <?php echo $info[1]; ?> ,'<?php echo $file; ?> ');"><img src="<?php echo $thumb_image; ?> " alt="<?php echo $file; ?> - <?php echo $filesize; ?> " border="0"></a></td> </tr> <tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="2"> <tr> <td width="1%" class="buttonOut" onMouseOver="pviiClassNew(this,'buttonHover')" onMouseOut="pviiClassNew(this,'buttonOut')"> <a href="javascript:;" onClick="javascript:preview('<?php echo $img_url; ?> ', '<?php echo $file; ?> ', ' <?php echo $filesize; ?> ',<?php echo $info[0] . ',' . $info[1]; ?> );"><img src="edit_pencil.gif" width="15" height="15" border="0"></a></td> <td width="1%" class="buttonOut" onMouseOver="pviiClassNew(this,'buttonHover')" onMouseOut="pviiClassNew(this,'buttonOut')"> <a href="images.php?delFile=<?php echo $img_url; ?> &dir=<?php echo $newPath; ?> " onClick="return deleteImage('<?php echo $file; ?> ');"><img src="edit_trash.gif" width="15" height="15" border="0"></a></td> <td width="98%" class="imgCaption"><?php echo $info[0] . 'x' . $info[1]; ?> </td> </tr> </table></td> </tr> </table> </td> <?php }
function Delete_response($target, $show_message = 3) { //************************* global $_, $ipath, $param1, $filename, $param2, $page, $message, $EX; if ($target == "") { return 0; } //Prevent accidental delete of entire website. $target = Check_path($target, $show_message); //Make sure $target is within $WEB_ROOT $target = trim($target, '/'); $page = "index"; //Return to index //If came from admin page, return there. if ($_SESSION['admin_page']) { $page = 'admin'; } $err_msg = ''; //On error, set this message. $scs_msg = ''; //On success, set this message. if (rDel($target)) { $scs_msg .= '<b>' . hsc($_['Deleted']) . ':</b> '; $scs_msg .= '<span class="filename">' . hte(basename($target)) . '</span></br>'; $ipath = dir_name($target); //Return to parent dir. $param1 = '?i=' . URLencode_path($ipath); $filename = ""; $param2 = ""; $error = 0; //0= no error, 1 = an error. } else { //Error $err_msg .= $EX . '<b>' . hsc($_['delete_msg_03']) . '</b> <span class="filename">' . hte($target) . '</span><br>'; $page = $_SESSION['recent_pages'][1]; if ($page == "edit") { $filename = $target; $param2 = '&f=' . basename($filename); } $error = 1; } if ($show_message & 1) { $message .= $err_msg; } //Show error message. if ($show_message & 2) { $message .= $scs_msg; } //Show success message. return $error; }
function file_image($file) { global $error_flag; $flag_copy = $_POST['image_copy']; $flag_test = $_POST['test']; $dir_image = $_POST['dir_image']; if (!$flag_copy) { echo "$file: none<br>\n"; return; } $dir_image_full = XOOPS_ROOT_PATH . dir_name($dir_image); $file_dest = $dir_image_full.'/'.basename($file); // file exist check if( file_exists($file_dest) ) { echo "$file: <font color=red>already existed</font><br>\n"; return; } // make dir if not exist if ( !file_exists($dir_image_full) ) { // test mode if ($flag_test) { echo "mkdir $dir_image_full: test<br>\n"; } else { // make dir if ( mkdir($dir_image_full,0707) ) { echo "mkdir $dir_image_full <br>\n"; } else { echo "<font color=red>mkdir failed $dir_image_full</font><br>\n"; $error_flag = true; } } } // test mode if ($flag_test) { $time = filemtime($file); $date = date("Y/m/d H:i:s",$time); echo "$file: $date <br> -> $file_dest <br>\n"; return; } // file copy if (copy($file, $file_dest)) { echo "$file <br> -> $file_dest <br>\n"; } else { echo "$file: <font color=red>copy failed</font><br>\n"; $error_flag = true; } }