@@ 209-242 (lines=34) @@ | ||
206 | * |
|
207 | * @return mixed |
|
208 | */ |
|
209 | function deleteData(&$input) |
|
210 | { |
|
211 | global $xoopsDB, $uploadpath, $wikiPage; |
|
212 | ||
213 | $q_file_id = (int)$input['file_id']; |
|
214 | // use keyword in delete so we know id and edit authority are connected |
|
215 | $q_keyword = $wikiPage->escapeForDB($input['page']); |
|
216 | ||
217 | // look up the name and delete the image file |
|
218 | $sql = 'SELECT file_path FROM ' . $xoopsDB->prefix('gwiki_page_files') . " where file_id='{$q_file_id}' AND keyword = '{$q_keyword}' "; |
|
219 | ||
220 | $result = $xoopsDB->query($sql); |
|
221 | if ($result) { |
|
222 | $rows = $xoopsDB->getRowsNum($result); |
|
223 | if ($rows) { |
|
224 | $myrow = $xoopsDB->fetchArray($result); |
|
225 | if (!empty($myrow['file_path'])) { |
|
226 | $oldfilename = $uploadpath . '/' . $myrow['file_path']; |
|
227 | unlink($oldfilename); |
|
228 | } |
|
229 | } |
|
230 | } |
|
231 | ||
232 | // delete the row |
|
233 | $sql = 'DELETE FROM ' . $xoopsDB->prefix('gwiki_page_files') . " where file_id='{$q_file_id}' AND keyword = '{$q_keyword}' "; |
|
234 | ||
235 | $result = $xoopsDB->queryF($sql); |
|
236 | $cnt = $xoopsDB->getAffectedRows(); |
|
237 | if ($cnt) { |
|
238 | $input['message'] = _MD_GWIKI_AJAX_FILEEDIT_DEL_OK; |
|
239 | } |
|
240 | ||
241 | return $result; |
|
242 | } |
|
243 | ||
244 | /** |
|
245 | * @param $input |
@@ 54-86 (lines=33) @@ | ||
51 | * |
|
52 | * @return mixed |
|
53 | */ |
|
54 | function deleteData(&$input) |
|
55 | { |
|
56 | global $xoopsDB, $uploadpath, $wikiPage; |
|
57 | ||
58 | $q_image_id = (int)$input['image_id']; |
|
59 | $q_keyword = $wikiPage->escapeForDB($input['page']); // use keyword in delete so we know id and edit authority are connected |
|
60 | ||
61 | // look up the name and delete the image file |
|
62 | $sql = 'SELECT image_file FROM ' . $xoopsDB->prefix('gwiki_page_images') . " where image_id='{$q_image_id}' AND keyword = '{$q_keyword}' "; |
|
63 | ||
64 | $result = $xoopsDB->query($sql); |
|
65 | if ($result) { |
|
66 | $rows = $xoopsDB->getRowsNum($result); |
|
67 | if ($rows) { |
|
68 | $myrow = $xoopsDB->fetchArray($result); |
|
69 | if (!empty($myrow['image_file'])) { |
|
70 | $oldfilename = $uploadpath . $myrow['image_file']; |
|
71 | unlink($oldfilename); |
|
72 | } |
|
73 | } |
|
74 | } |
|
75 | ||
76 | // delete the row |
|
77 | $sql = 'DELETE FROM ' . $xoopsDB->prefix('gwiki_page_images') . " where image_id='{$q_image_id}' AND keyword = '{$q_keyword}' "; |
|
78 | ||
79 | $result = $xoopsDB->queryF($sql); |
|
80 | $cnt = $xoopsDB->getAffectedRows(); |
|
81 | if ($cnt) { |
|
82 | $input['message'] = _MD_GWIKI_AJAX_IMGEDIT_DEL_OK; |
|
83 | } |
|
84 | ||
85 | return $result; |
|
86 | } |
|
87 | ||
88 | /** |
|
89 | * @param $input |