unset($pth[$i], $pth[$i + 1]); $delFlag = false; } if ($delFlag == true) { unset($pth[$i]); } } $rand = cu3er__getRand($uploadsDir['baseurl'] . '/' . $pth[5] . '/' . $pth[6] . '/'); $pthOld = $pth; unset($pth[9], $pth[10], $pth[11], $pth[12]); unset($pthOld[9], $pthOld[10], $pthOld[11], $pthOld[12]); $oldDir = $uploadsDir['basedir'] . '/' . implode("/", $pthOld); if (is_user_logged_in()) { if (current_user_can('delete_posts')) { if (file_exists($oldDir . '/CU3ER.txt')) { cu3er__cleanDir($oldDir . '/', true); @rmdir($oldDir); } } } $wpdb->query("DELETE FROM `" . $wpdb->prefix . "cu3er__slideshows` WHERE `id`='" . intval($_GET['id']) . "' LIMIT 1"); $wpdb->query("DELETE FROM `" . $wpdb->prefix . "cu3er__slides` WHERE `slideshow_id`='" . intval($_GET['id']) . "'"); $wpdb->query("DELETE FROM `" . $wpdb->prefix . "cu3er__defaults` WHERE `slideshow_id`='" . intval($_GET['id']) . "'"); echo '{"error": "false"}'; die; } } elseif ($_GET['act'] == 'old_import_info') { echo '<h3>Great News</h3><p>We have released the JavaScript version of CU3ER. However, projects that have been exported from cManager before this release will not be available in wpCU3ER for JavaScript version before you re export them from cManager again, and import them to wpCU3ER.</p>'; } elseif ($_GET['act'] == 'copyImage') { $ret = false; if ($_POST['path'] != '') {
function cu3er__cleanDir($dir, $all = false) { if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if (!$all) { if ($file != "." && $file != ".." && !is_dir($dir . $file)) { if (preg_match("/_1\\.png/", $file)) { @unlink($dir . $file); } } } else { if ($file != "." && $file != "..") { if (is_file($dir . $file)) { @chmod($dir . $file, 0777); @unlink($dir . $file); } else { cu3er__cleanDir($dir . $file . '/', true); @rmdir($dir . $file . '/'); } } } } closedir($dh); } } }