国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

pirms 2 gadiem
pirms 1 gada
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 1 gada
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. <?php
  2. /**
  3. * 图片修改
  4. *
  5. * @version $id:album_edit.php 8:26 2010年7月12日 tianya $
  6. * @package DedeBIZ.Administrator
  7. * @copyright Copyright (c) 2022 DedeBIZ.COM
  8. * @license https://www.dedebiz.com/license
  9. * @link https://www.dedebiz.com
  10. */
  11. require_once(dirname(__FILE__)."/config.php");
  12. CheckPurview('a_Edit,a_AccEdit,a_MyEdit');
  13. require_once(DEDEINC."/customfields.func.php");
  14. require_once(DEDEADMIN."/inc/inc_archives_functions.php");
  15. if (empty($dopost)) $dopost = '';
  16. if ($dopost != 'save') {
  17. require_once(DEDEADMIN."/inc/inc_catalog_options.php");
  18. require_once(DEDEINC."/dedetag.class.php");
  19. ClearMyAddon();
  20. $aid = intval($aid);
  21. //读取归档信息
  22. $arcQuery = "SELECT ch.typename as channelname,ar.membername as rankname,arc.* FROM `#@__archives` arc LEFT JOIN `#@__channeltype` ch ON ch.id=arc.channel LEFT JOIN `#@__arcrank` ar ON ar.`rank`=arc.arcrank WHERE arc.id='$aid' ";
  23. $arcRow = $dsql->GetOne($arcQuery);
  24. if (!is_array($arcRow)) {
  25. ShowMsg("读取文档基本信息出错", "-1");
  26. exit();
  27. }
  28. $query = "SELECT * FROM `#@__channeltype` WHERE id='".$arcRow['channel']."'";
  29. $cInfos = $dsql->GetOne($query);
  30. if (!is_array($cInfos)) {
  31. ShowMsg("读取栏目配置信息出错", "javascript:;");
  32. exit();
  33. }
  34. $addtable = $cInfos['addtable'];
  35. $addRow = $dsql->GetOne("SELECT * FROM `$addtable` WHERE aid='$aid'");
  36. $channelid = $arcRow['channel'];
  37. $imgurls = $addRow["imgurls"];
  38. $maxwidth = $addRow["maxwidth"];
  39. $pagestyle = $addRow["pagestyle"];
  40. $irow = $addRow["row"];
  41. $icol = $addRow["col"];
  42. $isrm = $addRow["isrm"];
  43. $body = $addRow["body"];
  44. $ddmaxwidth = $addRow["ddmaxwidth"];
  45. $pagepicnum = $addRow["pagepicnum"];
  46. $tags = GetTags($aid);
  47. $arcRow = XSSClean($arcRow);
  48. $addRow = XSSClean($addRow);
  49. include DedeInclude("templets/album_edit.htm");
  50. exit();
  51. }
  52. /*--------------------------------
  53. function __save(){ }
  54. -------------------------------*/
  55. else if ($dopost == 'save') {
  56. require_once(DEDEINC.'/image.func.php');
  57. require_once(DEDEINC.'/libraries/oxwindow.class.php');
  58. $flag = isset($flags) ? join(',', $flags) : '';
  59. $notpost = isset($notpost) && $notpost == 1 ? 1 : 0;
  60. if (empty($typeid2)) $typeid2 = 0;
  61. if (!isset($autokey)) $autokey = 0;
  62. if (!isset($remote)) $remote = 0;
  63. if (!isset($dellink)) $dellink = 0;
  64. if (!isset($autolitpic)) $autolitpic = 0;
  65. if (!isset($formhtml)) $formhtml = 0;
  66. if (!isset($albums)) $albums = "";
  67. if (!isset($formzip)) $formzip = 0;
  68. if (!isset($ddisfirst)) $ddisfirst = 0;
  69. if (!isset($delzip)) $delzip = 0;
  70. if ($typeid == 0) {
  71. ShowMsg("请指定文档的栏目", "-1");
  72. exit();
  73. }
  74. if (empty($channelid)) {
  75. ShowMsg("文档为非指定的类型,请检查您发布文档的表单是否合法", "-1");
  76. exit();
  77. }
  78. if (!CheckChannel($typeid, $channelid)) {
  79. ShowMsg("您所选择的栏目与当前模型不相符,请重新选择", "-1");
  80. exit();
  81. }
  82. if (!TestPurview('a_Edit')) {
  83. CheckCatalog($typeid, "您没有操作栏目<span class='text-primary'>{$typeid}</span>文档权限");
  84. }
  85. //对保存的文档进行处理
  86. $pubdate = GetMkTime($pubdate);
  87. $sortrank = AddDay($pubdate, $sortup);
  88. $ismake = $ishtml == 0 ? -1 : 0;
  89. $title = cn_substrR($title, $cfg_title_maxlen);
  90. $shorttitle = cn_substrR($shorttitle, 36);
  91. $color = cn_substrR($color, 7);
  92. $writer = cn_substrR($writer, 20);
  93. $source = cn_substrR($source, 30);
  94. $description = cn_substrR($description, 250);
  95. $keywords = trim(cn_substrR($keywords, 60));
  96. $filename = trim(cn_substrR($filename, 40));
  97. $isremote = 0;
  98. $serviterm = empty($serviterm) ? "" : $serviterm;
  99. if (!TestPurview('a_Check,a_AccCheck,a_MyCheck')) {
  100. $arcrank = -1;
  101. }
  102. $adminid = $cuserLogin->getUserID();
  103. //处理上传的缩略图
  104. if (empty($ddisremote)) {
  105. $ddisremote = 0;
  106. }
  107. $litpic = GetDDImage('none', $picname, $ddisremote);
  108. //分析body里的文档
  109. $body = AnalyseHtmlBody($body, $description, $litpic, $keywords, 'htmltext');
  110. //处理图片文档的自定义属性
  111. if ($litpic != '' && !preg_match("#p#", $flag)) {
  112. $flag = ($flag == '' ? 'p' : $flag.',p');
  113. }
  114. if ($redirecturl != '' && !preg_match("#j#", $flag)) {
  115. $flag = ($flag == '' ? 'j' : $flag.',j');
  116. }
  117. //跳转网址的文档强制为动态
  118. if (preg_match("#j#", $flag)) $ismake = -1;
  119. //更新数据库的SQL语句
  120. $query = "
  121. UPDATE `#@__archives` SET typeid='$typeid',typeid2='$typeid2',sortrank='$sortrank',flag='$flag',click='$click',ismake='$ismake',arcrank='$arcrank',money='$money',title='$title',color='$color',source='$source',writer='$writer',litpic='$litpic',pubdate='$pubdate',notpost='$notpost',description='$description',keywords='$keywords',shorttitle='$shorttitle',filename='$filename',dutyadmin='$adminid' WHERE id='$id'; ";
  122. if (!$dsql->ExecuteNoneQuery($query)) {
  123. ShowMsg("数据保存到数据库主表`#@__archives`时出错,请检查数据库字段".$dsql->GetError(), "javascript:;");
  124. exit();
  125. }
  126. $imgurls = "{dede:pagestyle maxwidth='$maxwidth' pagepicnum='$pagepicnum' ddmaxwidth='$ddmaxwidth' row='$row' col='$col' value='$pagestyle'/}\r\n";
  127. $hasone = false;
  128. //检查旧的图片是否有更新,并保存
  129. for ($i = 1; $i <= 120; $i++) {
  130. if (!isset(${'imgurl'.$i})) continue;
  131. $info = '';
  132. $iinfo = str_replace("'", "`", stripslashes(${'imgmsg'.$i}));
  133. $iurl = stripslashes(${'imgurl'.$i});
  134. $ddurl = stripslashes(${'imgddurl'.$i});
  135. if (preg_match("#swfupload#i", $ddurl)) $ddurl = '';
  136. $imgfile = $cfg_basedir.$iurl;
  137. $litimgfile = $cfg_basedir.$ddurl;
  138. //有上传文件的情况
  139. if (isset(${'imgfile'.$i}) && is_uploaded_file(${'imgfile'.$i})) {
  140. $tmpFile = ${'imgfile'.$i};
  141. //检测上传的图片,如果类型不对,保留原来图片
  142. $imginfos = @GetImageSize($tmpFile, $info);
  143. if (!is_array($imginfos)) {
  144. $imginfos = @GetImageSize($imgfile, $info);
  145. $imgurls .= "{dede:img ddimg='$ddurl' text='$iinfo' width='".$imginfos[0]."' height='".$imginfos[1]."'} $iurl {/dede:img}\r\n";
  146. continue;
  147. }
  148. $mime = get_mime_type($tmpFile);
  149. if (preg_match("#^unknow#", $mime)) {
  150. ShowMsg("系统不支持fileinfo组件,建议php.ini中开启", -1);
  151. exit;
  152. }
  153. if (!preg_match("#^image#i", $mime)) {
  154. ShowMsg("非图片格式文件,无法正常上传", -1);
  155. exit;
  156. }
  157. move_uploaded_file($tmpFile, $imgfile);
  158. $imginfos = @GetImageSize($imgfile, $info);
  159. if ($ddurl == $iurl) {
  160. $litpicname = $pagestyle > 2 ? GetImageMapDD($iurl, $cfg_ddimg_width) : $iurl;
  161. $litimgfile = $cfg_basedir.$litpicname;
  162. } else {
  163. if ($cfg_ddimg_full == 'Y') ImageResizeNew($imgfile, $cfg_ddimg_width, $cfg_ddimg_height, $litimgfile);
  164. else ImageResize($imgfile, $cfg_ddimg_width, $cfg_ddimg_height, $litimgfile);
  165. $litpicname = $ddurl;
  166. }
  167. $imgurls .= "{dede:img ddimg='$litpicname' text='$iinfo' width='".$imginfos[0]."' height='".$imginfos[1]."'} $iurl {/dede:img}\r\n";
  168. }
  169. //没上传图片(只修改msg信息)
  170. else {
  171. $iinfo = str_replace("'", "`", stripslashes(${'imgmsg'.$i}));
  172. $iurl = stripslashes(${'imgurl'.$i});
  173. $ddurl = stripslashes(${'imgddurl'.$i});
  174. if (preg_match("#swfupload#i", $ddurl)) {
  175. $ddurl = $pagestyle > 2 ? GetImageMapDD($iurl, $cfg_ddimg_width) : $iurl;
  176. }
  177. $imginfos = @GetImageSize($imgfile, $info);
  178. $imgurls .= "{dede:img ddimg='$ddurl' text='$iinfo' width='".$imginfos[0]."' height='".$imginfos[1]."'} $iurl {/dede:img}\r\n";
  179. }
  180. }
  181. //从HTML中获取新图片
  182. if ($formhtml == 1 && !empty($imagebody)) {
  183. $imagebody = stripslashes($imagebody);
  184. $imgurls .= GetCurContentAlbum($imagebody, $copysource, $litpicname);
  185. if ($ddisfirst == 1 && $litpic == "" && !empty($litpicname)) {
  186. $litpic = $litpicname;
  187. $hasone = true;
  188. }
  189. }
  190. /*---------------------
  191. function _getformzip()
  192. 从ZIP文件中获取新图片
  193. ---------------------*/
  194. if ($formzip == 1) {
  195. include_once(DEDEADMIN."/file_class.php");
  196. $zipfile = $cfg_basedir.str_replace($cfg_mainsite, '', $zipfile);
  197. $tmpzipdir = DEDEDATA.'/ziptmp/'.cn_substr(md5(ExecTime()), 16);
  198. $ntime = time();
  199. }
  200. if ($albums !== "") {
  201. $albumsArr = json_decode(stripslashes($albums), true);
  202. //var_dump($albumsArr);exit;
  203. for ($i = 0; $i <= count($albumsArr) - 1; $i++) {
  204. $album = $albumsArr[$i];
  205. $data = explode(',', $album['img']);
  206. $ext = ".png";
  207. if (strpos($data[0], "data:image/jpeg") === 0){
  208. $ext = ".jpg";
  209. } elseif (strpos($data[0], "data:image/gif") === 0) {
  210. $ext = ".gif";
  211. } elseif (strpos($data[0], "data:image/webp") === 0) {
  212. $ext = ".webp";
  213. } elseif (strpos($data[0], "data:image/bmp") === 0) {
  214. $ext = ".bmp";
  215. }
  216. $ntime = time();
  217. $savepath = $cfg_image_dir.'/'.MyDate($cfg_addon_savetype, $ntime);
  218. CreateDir($savepath);
  219. $fullUrl = $savepath.'/'.dd2char(MyDate('mdHis', $ntime).$cuserLogin->getUserID().mt_rand(1000, 9999));
  220. $fullUrl = $fullUrl.$ext;
  221. file_put_contents($cfg_basedir.$fullUrl, base64_decode($data[1]));
  222. $info = '';
  223. $imginfos = GetImageSize($cfg_basedir.$fullUrl, $info);
  224. $v = $fullUrl;
  225. $imginfo = !empty($album['txt']) ? $album['txt'] : '';
  226. $imgurls .= "{dede:img ddimg='$v' text='$imginfo' width='".$imginfos[0]."' height='".$imginfos[1]."'} $v {/dede:img}\r\n";
  227. }
  228. }
  229. $imgurls = addslashes($imgurls);
  230. //分析处理附加表数据
  231. $inadd_f = '';
  232. $inadd_v = '';
  233. if (!empty($dede_addonfields)) {
  234. $addonfields = explode(';', $dede_addonfields);
  235. $inadd_f = '';
  236. $inadd_v = '';
  237. if (is_array($addonfields)) {
  238. foreach ($addonfields as $v) {
  239. if ($v == '') {
  240. continue;
  241. }
  242. $vs = explode(',', $v);
  243. if ($vs[1] == 'htmltext' || $vs[1] == 'textdata') //网页文本特殊处理
  244. {
  245. ${$vs[0]} = AnalyseHtmlBody(${$vs[0]}, $description, $litpic, $keywords, $vs[1]);
  246. } else {
  247. if (!isset(${$vs[0]})) {
  248. ${$vs[0]} = '';
  249. }
  250. ${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $id);
  251. }
  252. $inadd_f .= ",`{$vs[0]}` = '".${$vs[0]}."'";
  253. }
  254. }
  255. }
  256. //更新附加表
  257. $cts = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id='$channelid' ");
  258. $addtable = trim($cts['addtable']);
  259. if ($addtable != '') {
  260. $useip = GetIP();
  261. $query = "UPDATE `$addtable` SET typeid='$typeid',pagestyle='$pagestyle',body='$body',maxwidth='$maxwidth',ddmaxwidth='$ddmaxwidth',pagepicnum='$pagepicnum',imgurls='$imgurls',`row`='$row',col='$col',isrm='$isrm'{$inadd_f},redirecturl='$redirecturl',userip='$useip' WHERE aid='$id'; ";
  262. if (!$dsql->ExecuteNoneQuery($query)) {
  263. ShowMsg("数据保存到数据库附加表时出错,请检查数据库字段".$dsql->GetError(), "javascript:;");
  264. exit();
  265. }
  266. }
  267. //生成网页
  268. UpIndexKey($id, $arcrank, $typeid, $sortrank, $tags);
  269. $arcUrl = MakeArt($id, true, true, $isremote);
  270. if ($arcUrl == '') {
  271. $arcUrl = $cfg_phpurl."/view.php?aid=$id";
  272. }
  273. ClearMyAddon($id, $title);
  274. //自动更新关联文档
  275. if (is_array($automake)) {
  276. foreach ($automake as $key => $value) {
  277. if (isset(${$key}) && !empty(${$key})) {
  278. $ids = explode(",", ${$key});
  279. foreach ($ids as $id) {
  280. MakeArt($id, true, true, $isremote);
  281. }
  282. }
  283. }
  284. }
  285. //返回成功信息
  286. $msg = "请选择您的后续操作:<a href='album_add.php?cid=$typeid' class='btn btn-success btn-sm'>继续发布图片</a><a href='archives_do.php?aid=".$id."&dopost=editArchives' class='btn btn-success btn-sm'>修改图片</a><a href='$arcUrl' target='_blank' class='btn btn-success btn-sm'>预览图片</a><a href='catalog_do.php?cid=$typeid&dopost=listArchives' class='btn btn-success btn-sm'>管理已发布图片</a>$backurl";
  287. $wintitle = "成功修改图片";
  288. $wecome_info = "文档管理::修改图片";
  289. $win = new OxWindow();
  290. $win->AddTitle("成功修改一个图片");
  291. $win->AddMsgItem($msg);
  292. $winform = $win->GetWindow("hand", "&nbsp;", false);
  293. $win->Display();
  294. }
  295. ?>