} else { if ($DT['water_type'] == 1) { $image = new image(DT_ROOT . '/' . $middle); $image->watertext(); } } } } else { if ($from == 'editor') { if ($_groupid == 1 && !isset($watermark)) { $DT['water_type'] = 0; } if ($DT['water_type']) { $image = new image(DT_ROOT . '/' . $do->saveto); if ($DT['water_type'] == 2) { $image->waterimage(); } else { if ($DT['water_type'] == 1) { $image->watertext(); } } } } } } } $saveto = linkurl($do->saveto); if ($DT['ftp_remote'] && $DT['remote_url']) { require DT_ROOT . '/include/ftp.class.php'; $ftp = new dftp($DT['ftp_host'], $DT['ftp_user'], $DT['ftp_pass'], $DT['ftp_port'], $DT['ftp_path'], $DT['ftp_pasv'], $DT['ftp_ssl']); if ($ftp->connected) {
function save_local($content) { global $DT, $DT_TIME, $_userid; if ($content == '<br type="_moz" />') { return ''; } //FireFox if ($content == ' ') { return ''; } //Chrome $content = preg_replace("/allowScriptAccess=\"always\"/i", "", $content); $content = preg_replace("/allowScriptAccess/i", "allowscr-iptaccess", $content); if (strpos($content, 'data:image') === false) { return $content; } if (!preg_match_all("/src=([\"|']?)([^ \"'>]+)\\1/i", $content, $matches)) { return $content; } require_once DT_ROOT . '/include/image.class.php'; $dftp = false; if ($DT['ftp_remote'] && $DT['remote_url']) { require_once DT_ROOT . '/include/ftp.class.php'; $ftp = new dftp($DT['ftp_host'], $DT['ftp_user'], $DT['ftp_pass'], $DT['ftp_port'], $DT['ftp_path'], $DT['ftp_pasv'], $DT['ftp_ssl']); $dftp = $ftp->connected; } $urls = $oldpath = $newpath = array(); $DT['uploaddir'] or $DT['uploaddir'] = 'Ym/d'; foreach ($matches[2] as $k => $url) { if (in_array($url, $urls)) { continue; } $urls[$url] = $url; if (strpos($url, 'data:image') === false) { continue; } if (strpos($url, ';base64,') === false) { continue; } $t1 = explode(';base64,', $url); $t2 = explode('/', $t1[0]); $file_ext = $t2[1]; in_array($file_ext, array('jpg', 'gif', 'png')) or $file_ext = 'jpg'; $filedir = 'file/upload/' . timetodate($DT_TIME, $DT['uploaddir']) . '/'; $filepath = DT_PATH . $filedir; $fileroot = DT_ROOT . '/' . $filedir; $filename = timetodate($DT_TIME, 'H-i-s') . '-' . rand(10, 99) . '-' . $_userid . '.' . $file_ext; $newfile = $fileroot . $filename; if (!is_image($newfile)) { continue; } if (file_put($newfile, base64_decode($t1[1]))) { if (!@getimagesize($newfile)) { file_del($newfile); continue; } if ($DT['water_type']) { $image = new image($newfile); if ($DT['water_type'] == 2) { $image->waterimage(); } else { if ($DT['water_type'] == 1) { $image->watertext(); } } } $oldpath[] = $url; $newurl = linkurl($filepath . $filename); if ($dftp) { $exp = explode("file/upload/", $newurl); if ($ftp->dftp_put($filedir . $filename, $exp[1])) { $newurl = $DT['remote_url'] . $exp[1]; file_del($newfile); } } $newpath[] = $newurl; } } unset($matches); return str_replace($oldpath, $newpath, $content); }