public function fieldsFormSubmit($rid) { global $_W, $_GPC; $id = intval($_GPC['replyid']); $data = array('rid' => $rid, 'weid' => $_W['weid'], 'sn' => $_GPC['sn'], 'token' => $_GPC['apitoken'], 'maxuse' => intval($_GPC['maxuse']), 'maxtotal' => intval($_GPC['maxtotal']), 'adtype' => intval($_GPC['adtype']), 'adurlv' => $_GPC['adurlv'], 'adurlh' => $_GPC['adurlh'], 'admsg' => $_GPC['admsg'], 'leavemsg' => $_GPC['leavemsg'], 'fontfamily' => $_GPC['fontfamily'], 'fontcolor' => $_GPC['fontcolor'], 'qrcode' => $_GPC['qrcode'], 'mainpic' => $_GPC['mainpic'], 'adpics' => '', 'width' => $_GPC['width'], 'height' => $_GPC['height'], 'size' => intval($_GPC['photosize']), 'status' => intval($_GPC['status']), 'enableauthcode' => intval($_GPC['enableauthcode']), 'enablemsg' => intval($_GPC['enablemsg']), 'content' => $_GPC['content'], 'tipsentry' => $_GPC['tipsentry'], 'tipssuccess' => $_GPC['tipssuccess'], 'tipserror' => $_GPC['tipserror']); if (!empty($_GPC['sort'])) { asort($_GPC['sort']); foreach ($_GPC['sort'] as $key => $value) { $data['adpics'][] = $_GPC['adpics'][$key]; } $data['adpics'] = iserializer($data['adpics']); } else { $data['adpics'] = iserializer($_GPC['adpics']); } if (empty($id)) { pdo_insert('we7_photomaker', $data); } else { if (!empty($_GPC['qrcode'])) { file_delete($_GPC['qrcode-old']); } if (!empty($_GPC['mainpic'])) { file_delete($_GPC['mainpic-old']); } pdo_update('we7_photomaker', $data, array('id' => $id)); } }
public function doWebSetting() { global $_W, $_GPC; checklogin(); load()->func('tpl'); $item = pdo_fetch("SELECT * FROM " . tablename($this->modulename . '_setting') . " WHERE weid = :weid", array(':weid' => $_W['uniacid'])); if (!empty($item)) { if (!empty($item['share_image'])) { $share_image = tomedia($item['share_image']); } } if (checksubmit('submit')) { $data = array('weid' => $_W['weid'], 'share_title' => trim($_GPC['share_title']), 'share_desc' => trim($_GPC['share_desc']), 'share_cancel' => trim($_GPC['share_cancel']), 'share_url' => trim($_GPC['share_url']), 'follow_url' => trim($_GPC['follow_url'])); if (!empty($_GPC['share_image'])) { $data['share_image'] = $_GPC['share_image']; load()->func('file'); file_delete($_GPC['share_image-old']); } if (!empty($item)) { pdo_update($this->modulename . '_setting', $data, array('weid' => $_W['uniacid'])); } else { pdo_insert($this->modulename . '_setting', $data); } message('更新成功!', $this->createWebUrl('setting'), 'success'); } include $this->template('setting'); }
public function doWebList($ischeck = 1) { global $_GPC, $_W; // AJAX if ($_W['isajax']) { $op = $_GPC['op']; $id = intval($_GPC['id']); $result = array('state' => -1, 'message' => ''); if ($op == 'delete') { $item = $this->item_fetch($id); if ($item['id']) { load()->func('file'); file_delete($item['photo']); pdo_delete('qiyue_canvas', array('id' => $item['id'])); $result['state'] = 0; } } elseif ($op == 'check') { if ($this->item_check($id)) { $result['state'] = 0; } } message($result, '', 'ajax'); } $title = '图片管理'; $result = $this->all_list(array('ischeck' => $ischeck)); include $this->template('manage'); }
public function fieldsFormSubmit($rid) { global $_GPC, $_W; $id = intval($_GPC['reply_id']); $insert = array('rid' => $rid, 'weid' => $_W['weid'], 'title' => $_GPC['title'], 'content' => $_GPC['content'], 'ticket_information' => $_GPC['ticket_information'], 'description' => $_GPC['description'], 'repeat_lottery_reply' => $_GPC['repeat_lottery_reply'], 'end_theme' => $_GPC['end_theme'], 'end_instruction' => $_GPC['end_instruction'], 'probability' => $_GPC['probability'], 'c_type_one' => $_GPC['c_type_one'], 'c_name_one' => $_GPC['c_name_one'], 'c_num_one' => $_GPC['c_num_one'], 'c_type_two' => $_GPC['c_type_two'], 'c_name_two' => $_GPC['c_name_two'], 'c_num_two' => $_GPC['c_num_two'], 'c_type_three' => $_GPC['c_type_three'], 'c_name_three' => $_GPC['c_name_three'], 'c_num_three' => $_GPC['c_num_three'], 'c_type_four' => $_GPC['c_type_four'], 'c_name_four' => $_GPC['c_name_four'], 'c_num_four' => $_GPC['c_num_four'], 'c_type_five' => $_GPC['c_type_five'], 'c_name_five' => $_GPC['c_name_five'], 'c_num_five' => $_GPC['c_num_five'], 'c_type_six' => $_GPC['c_type_six'], 'c_name_six' => $_GPC['c_name_six'], 'c_num_six' => $_GPC['c_num_six'], 'award_times' => $_GPC['award_times'], 'number_times' => $_GPC['number_times'], 'most_num_times' => $_GPC['most_num_times'], 'sn_code' => $_GPC['sn_code'], 'sn_rename' => $_GPC['sn_rename'], 'tel_rename' => $_GPC['tel_rename'], 'show_num' => $_GPC['show_num'], 'createtime' => time(), 'copyright' => $_GPC['copyright'], 'share_title' => $_GPC['share_title'], 'share_desc' => $_GPC['share_desc'], 'share_url' => $_GPC['share_url'], 'share_txt' => $_GPC['share_txt'], 'starttime' => strtotime($_GPC['datelimit-start']), 'endtime' => strtotime($_GPC['datelimit-end']), 'c_rate_one' => $_GPC['c_rate_one'], 'c_rate_two' => $_GPC['c_rate_two'], 'c_rate_three' => $_GPC['c_rate_three'], 'c_rate_four' => $_GPC['c_rate_four'], 'c_rate_five' => $_GPC['c_rate_five'], 'c_rate_six' => $_GPC['c_rate_six']); if (!empty($_GPC['start_picurl'])) { $insert['start_picurl'] = $_GPC['start_picurl']; file_delete($_GPC['start_picurl-old']); } if (!empty($_GPC['end_picurl'])) { $insert['end_picurl'] = $_GPC['end_picurl']; file_delete($_GPC['end_picurl-old']); } $insert['total_num'] = intval($_GPC['c_num_one']) + intval($_GPC['c_num_two']) + intval($_GPC['c_num_three']) + intval($_GPC['c_num_four']) + intval($_GPC['c_num_five']) + intval($_GPC['c_num_six']); if (empty($id)) { if ($insert['starttime'] <= time()) { $insert['isshow'] = 1; } else { $insert['isshow'] = 0; } $id = pdo_insert($this->tablename, $insert); } else { pdo_update($this->tablename, $insert, array('id' => $id)); } return true; }
function addStreamFormSubmit($form_id, $form_values) { module_load_include('inc', 'Fedora_Repository', 'api/fedora_utils'); module_load_include('inc', 'Fedora_Repository', 'api/fedora_item'); module_load_include('php', 'Fedora_Repository', 'ObjectHelper'); $types = array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.wordperfect', 'application/wordperfect', 'application/vnd.oasis.opendocument.text', 'text/rtf', 'application/rtf', 'application/msword', 'application/vnd.ms-powerpoint', 'application/pdf'); global $user; /* TODO Modify the validators array to suit your needs. This array is used in the revised file_save_upload */ $fileObject = file_save_upload('file_uploaded'); if (!in_array($fileObject->filemime, $types)) { drupal_set_message(t('The detected mimetype %s is not supported', array('%s' => $fileObject->filemime)), 'error'); return false; } file_move($fileObject->filepath, 0, 'FILE_EXISTS_RENAME'); $objectHelper = new ObjectHelper(); $pid = $form_values['pid']; $fedora_item = new Fedora_Item($pid); $test = NULL; $test = $fedora_item->add_datastream_from_file($fileObject->filepath, 'OBJ'); if ($test) { $this->updateMODSStream($form_values['pid'], $form_values['version'], $form_values['usage']); } file_delete($fileObject->filepath); return true; }
public function fieldsFormSubmit($rid) { //规则验证无误保存入库时执行,这里应该进行自定义字段的保存。这里 $rid 为对应的规则编号 global $_GPC, $_W; $id = intval($_GPC['reply_id']); $insert = array('rid' => $rid, 'weid' => $_W['weid'], 'title' => $_GPC['title'], 'ticket_information' => $_GPC['ticket_information'], 'description' => $_GPC['description'], 'end_theme' => $_GPC['end_theme'], 'end_instruction' => $_GPC['end_instruction'], 'createtime' => time(), 'copyright' => $_GPC['copyright'], 'isshow' => intval($_GPC['isshow']), 'isdes' => intval($_GPC['isdes']), 'sendtimes' => intval($_GPC['sendtimes']), 'daysendtimes' => intval($_GPC['daysendtimes']), 'starttime' => strtotime($_GPC['datelimit-start']), 'endtime' => strtotime($_GPC['datelimit-end'])); if (!empty($_GPC['start_picurl'])) { $insert['start_picurl'] = $_GPC['start_picurl']; file_delete($_GPC['start_picurl-old']); } if (!empty($_GPC['end_picurl'])) { $insert['end_picurl'] = $_GPC['end_picurl']; file_delete($_GPC['end_picurl-old']); } if (empty($id)) { if ($insert['starttime'] <= time()) { $insert['status'] = 1; } else { $insert['status'] = 0; } $id = pdo_insert($this->tablename, $insert); } else { pdo_update($this->tablename, $insert, array('id' => $id)); } return true; }
public function fieldsFormSubmit($rid = 0) { global $_GPC, $_W; $id = intval($_GPC['reply_id']); $credit = intval($_GPC['credit']); $insert = array('rid' => $rid, 'start_time' => strtotime($_GPC['start_time']), 'end_time' => strtotime($_GPC['end_time']), 'awardrules' => $_GPC['awardrules'], 'awardinfo' => $_GPC['awardinfo'], 'days' => $_GPC['days'], 'credit' => $credit); if (!empty($_FILES['thumb']['tmp_name'])) { file_delete($_GPC['thumb_old']); $upload = file_upload($_FILES['thumb']); if (is_error($upload)) { message($upload['message'], '', 'error'); } $insert['thumb'] = $upload['path']; } else { $tmp_file = array(name => "registration_top.jpg", tmp_name => "{$_SERVER['DOCUMENT_ROOT']}/source/modules/cgtsignin/template/style/images/registration_top.jpg"); $upload = file_upload($tmp_file); if (is_error($upload)) { message($upload['message'], '', 'error'); } $insert['thumb'] = $upload['path']; } if (empty($id)) { pdo_insert($this->tablename, $insert); } else { pdo_update($this->tablename, $insert, array('id' => $id)); } }
public function settingsDisplay($settings) { global $_W, $_GPC; load()->func('file'); $_W['page']['title'] = '签文参数设置'; if ($_W['isajax'] && $_GPC['op'] == 'delete' && $_GPC['filename']) { file_delete($_GPC['filename']); exit('ok'); } if (checksubmit()) { // 配置 $dat = $_GPC['add']; $dat['imgUrl'] = $_GPC['imgUrl']; $this->saveSettings($dat); // 签文 $qian = $_GPC['qian']; $f_exp = "::::::"; $r_exp = PHP_EOL; $morepic = ""; for ($i = 0; $i < count($qian['filename']); $i++) { //替换非法字符 $name = str_replace($f_exp, "", $qian['title'][$i]); $name = str_replace($r_exp, "", $name); $pic = str_replace($f_exp, "", $qian['filename'][$i]); $pic = str_replace($r_exp, "", $pic); if ($pic) { $morepic .= $pic . $f_exp . $name . $r_exp; } } // 去掉最后的字符 // $morepic = substr($morepic,0,strlen($morepic)-2); $morepic = trim($morepic); $check = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('qiyue_qiuqian') . " WHERE uniacid=:uniacid", array(':uniacid' => $_W['uniacid'])); if ($check) { pdo_update('qiyue_qiuqian', array('morepic' => $morepic), array('uniacid' => $_W['uniacid'])); } else { $add['uniacid'] = $_W['uniacid']; $add['morepic'] = $morepic; pdo_insert('qiyue_qiuqian', $add); } message('设置成功', 'referer', 'success'); } if (empty($settings)) { $settings = array('title' => '新年祈福签', 'desc' => '我在' . $_W['account']['name'] . '求了一支新年签,你也来吧!', 'imgUrl' => tomedia('./addons/qiuqian/icon.jpg')); } $qian_r = pdo_fetch("SELECT * FROM " . tablename('qiyue_qiuqian') . " WHERE uniacid=:uniacid", array(':uniacid' => $_W['uniacid'])); $morepic = array(); if ($qian_r['morepic']) { $f_exp = "::::::"; $r_exp = PHP_EOL; $rr = explode($r_exp, $qian_r['morepic']); for ($i = 0; $i < count($rr); $i++) { $fr = explode($f_exp, $rr[$i]); $morepic[] = array('title' => $fr['1'], 'filename' => $fr['0']); } unset($qian_r['morepic']); } include $this->template('setting'); }
public function delete($filename) { if (file_delete('./Public/upload/' . $filename) && file_delete('./Public/upload/thumb_' . $filename)) { $this->success('删除成功'); } else { $this->error('删除失败'); } }
function submitForm(array &$form, FormStateInterface $form_state) { $result = ManageStorage::fetchRowFields('id', $this->id, array('fid')); file_delete($result['fid']); ManageStorage::delete($this->id); drupal_set_message('CSV deleted successfully.'); $form_state->setRedirect('node_csv_uploader.admin'); }
private static function removeFile($imageFileId, $moduleName, $fieldName) { $file = $imageFileId ? file_load($imageFileId) : FALSE; if ($file) { file_usage_delete($file, $moduleName, $fieldName, $file->fid); file_delete($file); } return $file; }
function removePicture($FID, $moduleName) { $f = file_load($FID); if ($f != null) { file_usage_delete($f, "CROMA - {$moduleName}"); file_delete($f); } else { drupal_set_message('File does not exist!', 'error'); } }
public function doMobileAjaxdelete() { global $_GPC; $delurl = $_GPC['pic']; if (file_delete($delurl)) { echo 1; } else { echo 0; } }
public function doWebList() { global $_GPC, $_W; load()->func('tpl'); $operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display'; if ($operation == 'display') { if (!empty($_GPC['displayorder'])) { foreach ($_GPC['displayorder'] as $id => $displayorder) { pdo_update('meepomailattachment', array('displayorder' => $displayorder), array('id' => $id)); } message('分类排序更新成功!', $this->createWebUrl('List', array('op' => 'display')), 'success'); } $list = pdo_fetchall("SELECT * FROM " . tablename('meepomailattachment') . " WHERE weid = '{$_W['weid']}' ORDER BY id ASC, displayorder DESC"); include $this->template('list'); } elseif ($operation == 'post') { $id = intval($_GPC['id']); if (!empty($id)) { $list = pdo_fetch("SELECT * FROM " . tablename('meepomailattachment') . " WHERE id = '{$id}'"); } else { $list = array('displayorder' => 0); } if (checksubmit('submit')) { if (empty($_GPC['attachmentname']) || empty($_GPC['description'])) { message('文件名称以及文件描述是必填项!', $this->createWebUrl('list'), 'error'); } $data = array('weid' => $_W['weid'], 'attachmentname' => $_GPC['attachmentname'], 'isshow' => intval($_GPC['isshow']), 'displayorder' => intval($_GPC['displayorder']), 'description' => $_GPC['description']); if (!empty($_FILES['thumb']['tmp_name'])) { load()->func('file'); file_delete($_GPC['thumb_old']); $upload = $this->file_upload($data['attachmentname'], $_FILES['thumb']); if (is_error($upload)) { message($upload['message'], '', 'error'); } $data['thumb'] = $upload['path']; } if (!empty($id)) { unset($data['id']); pdo_update('meepomailattachment', $data, array('id' => $id)); } else { pdo_insert('meepomailattachment', $data); $id = pdo_insertid(); } message('更新附件成功!', $this->createWebUrl('list', array('op' => 'display')), 'success'); } include $this->template('list'); } elseif ($operation == 'delete') { $id = intval($_GPC['id']); $category = pdo_fetch("SELECT id FROM " . tablename('meepomailattachment') . " WHERE id = '{$id}'"); if (empty($category)) { message('抱歉,附件不存在或是已经被删除!', $this->createWebUrl('list', array('op' => 'display')), 'error'); } pdo_delete('meepomailattachment', array('id' => $id), 'OR'); message('附件信息删除成功!', $this->createWebUrl('list', array('op' => 'display')), 'success'); } }
public function fieldsFormSubmit($rid = 0) { global $_GPC, $_W; $id = intval($_GPC['reply_id']); $insert = array('rid' => $rid, 'weid' => $_W['weid'], 'title' => $_GPC['title'], 'description' => $_GPC['description'], 'votetype' => $_GPC['votetype'], 'votelimit' => $_GPC['votelimit'], 'votetimes' => $_GPC['votetimes'], 'votetotal' => $_GPC['votetotal'], 'isimg' => $_GPC['isimg'], 'share_title' => $_GPC['share_title'], 'share_desc' => $_GPC['share_desc'], 'share_url' => $_GPC['share_url'], 'share_txt' => $_GPC['share_txt'], 'starttime' => strtotime($_GPC['datelimit-start']), 'endtime' => strtotime($_GPC['datelimit-end'])); if (!empty($_GPC['thumb'])) { $insert['thumb'] = $_GPC['thumb']; file_delete($_GPC['thumb-old']); } if (empty($id)) { if ($insert['starttime'] <= time()) { $insert['isshow'] = 1; } else { $insert['isshow'] = 0; } $id = pdo_insert($this->tablename, $insert); } else { pdo_update($this->tablename, $insert, array('id' => $id)); } $options = array(); $option_ids = $_POST['option_id']; $option_titles = $_POST['option_title']; $option_thumb_olds = $_POST['option_thumb_old']; $files = $_FILES; $len = count($option_ids); $ids = array(); for ($i = 0; $i < $len; $i++) { $item_id = $option_ids[$i]; $a = array("title" => $option_titles[$i], "rid" => $rid); $f = 'option_thumb_' . $item_id; $old = $_GPC['option_thumb_' . $item_id]; if (!empty($files[$f]['tmp_name'])) { $upload = file_upload($files[$f]); if (is_error($upload)) { message($upload['message'], '', 'error'); } $a['thumb'] = $upload['path']; } else { if (!empty($old)) { $a['thumb'] = $old; } } if ((int) $item_id == 0) { pdo_insert("vote_option", $a); $item_id = pdo_insertid(); } else { pdo_update("vote_option", $a, array('id' => $item_id)); } $ids[] = $item_id; } if (!empty($ids)) { pdo_query("delete from " . tablename('vote_option') . " where id not in ( " . implode(',', $ids) . ") and rid = " . $rid); } return true; }
/** * Delete an issue attachment given its id. * * @param string $p_username The name of the user trying to add an attachment to an issue. * @param string $p_password The password of the user. * @param integer $p_issue_attachment_id The id of the attachment to be deleted. * @return true: success, false: failure */ function mc_issue_attachment_delete( $p_username, $p_password, $p_issue_attachment_id ) { $t_user_id = mci_check_login( $p_username, $p_password ); if( $t_user_id === false ) { return mci_soap_fault_login_failed(); } $t_bug_id = file_get_field( $p_issue_attachment_id, 'bug_id' ); if( !access_has_bug_level( config_get( 'update_bug_threshold' ), $t_bug_id, $t_user_id ) ) { return mci_soap_fault_access_denied( $t_user_id ); } return file_delete( $p_issue_attachment_id, 'bug' ); }
public function index($debug = '') { if ($debug) { file_delete(UPLOAD_PATH . 'install.lock'); } $status = array('status' => 1, 'url' => U('Index/step1')); if (file_exist(UPLOAD_PATH . 'install.lock')) { $status = array('status' => 0, 'url' => U('/'), 'msg' => '已经成功安装了,请不要重复安装!'); } $this->assign('status', $status); $this->display(); }
/** * Delete a project attachment given its id. * * @param string $p_username The name of the user trying to add an attachment to an issue. * @param string $p_password The password of the user. * @param integer $p_project_attachment_id The id of the attachment to be deleted. * @return true: success, false: failure */ function mc_project_attachment_delete($p_username, $p_password, $p_project_attachment_id) { $t_user_id = mci_check_login($p_username, $p_password); if ($t_user_id === false) { return new soap_fault('Client', '', 'Access Denied'); } $t_project_id = file_get_field($p_project_attachment_id, 'project_id', 'project'); if (!access_has_project_level(config_get('upload_project_file_threshold'), $t_project_id, $t_user_id)) { return new soap_fault('Client', '', 'Access Denied'); } return file_delete($p_project_attachment_id, 'project'); }
public function fieldsFormSubmit($rid = 0) { global $_GPC, $_W; if (!empty($_GPC['title'])) { $data = array('title' => $_GPC['title'], 'description' => $_GPC['description'], 'picurl' => $_GPC['thumb-old'], 'url' => create_url('mobile/module/list', array('name' => 'shopping', 'weid' => $_W['weid']))); if (!empty($_GPC['thumb'])) { $data['picurl'] = $_GPC['thumb']; file_delete($_GPC['thumb-old']); } $this->saveSettings($data); } return true; }
public function ruleDeleted($rid = 0) { global $_W; $replies = pdo_fetchall("SELECT id, picture FROM " . tablename($this->tablename) . " WHERE rid = '{$rid}'"); $deleteid = array(); if (!empty($replies)) { foreach ($replies as $index => $row) { file_delete($row['picture']); $deleteid[] = $row['id']; } } pdo_delete($this->tablename, "id IN ('" . implode("','", $deleteid) . "')"); }
public function fieldsFormSubmit($rid = 0) { global $_GPC, $_W; if (!empty($_GPC['title'])) { $data = array('title' => $_GPC['title'], 'description' => $_GPC['description'], 'picurl' => $_GPC['thumb-old'], 'url' => $this->createMoblieUrl('list', array('name' => 'eso_sale', 'uniacid' => $_W['uniacid']))); if (!empty($_GPC['thumb'])) { $data['picurl'] = $_GPC['thumb']; file_delete($_GPC['thumb-old']); } $this->saveSettings($data); } return true; }
public function doWebDelete() { global $_GPC; $id = intval($_GPC['id']); $item = pdo_fetch("SELECT * FROM " . tablename($this->headtable) . " WHERE id = :id", array(':id' => $id)); if (empty($item)) { message('抱歉,楼盘不存在或是已经删除!', '', 'error'); } if (!empty($item['thumb'])) { file_delete($item['thumb']); } pdo_delete($this->headtable, array('id' => $item['id'])); message('删除成功!', referer(), 'success'); }
public function doDeleteImage() { global $_GPC; $id = intval($_GPC['id']); $sql = "SELECT id, picture FROM " . tablename($this->tablename) . " WHERE `id`=:id"; $row = pdo_fetch($sql, array(':id' => $id)); if (empty($row)) { message('抱歉,回复不存在或是已经被删除!', '', 'error'); } if (pdo_update($this->tablename, array('picture' => ''), array('id' => $id))) { file_delete($row['picture']); } message('删除图片成功!', '', 'success'); }
/** * 删除文件 */ public function delete($filename) { $filename = urldecode($filename); $filename = ltrim($filename, '/'); $filename = preg_replace("/\\.+/", '.', $filename); //屏蔽非法路径 $filename = UPLOAD_PATH . $filename; if (file_exist($filename)) { if (file_delete($filename)) { $this->success('操作成功'); } } $this->error('操作失败'); }
public function fieldsFormSubmit($rid) { global $_GPC, $_W; load()->func('file'); if (!empty($_GPC['title'])) { $data = array('title' => $_GPC['title'], 'description' => $_GPC['description'], 'picurl' => $_GPC['thumb-old'], 'url' => $this->createMobileUrl('list')); if (!empty($_GPC['thumb'])) { $data['picurl'] = $_GPC['thumb']; file_delete($_GPC['thumb-old']); } $this->saveSettings($data); } return true; }
function migrate() { global $term_dir; $completed = array(); $names = $_POST['edit']['migrate']; foreach ($names as $name => $status) { $files = file_scan_directory($term_dir, $name); if (count($files) != 1) { print count($files) . " files match the name: {$name}"; exit; } $image = array_pop($files); $image->filename_orig = $image->filename; if ($status == 1) { $image->tid = migrate_term_image_get_tid($image->name); if (!taxonomy_get_term($image->tid)) { print "cant find the tid: {$tid}"; exit; } $t_i_image = db_fetch_object(db_query('SELECT path FROM {term_image} WHERE tid = %d', $image->tid)); if ($t_i_image) { $term->has_image = true; } if ($term->has_image) { taxonomy_image_delete($image->tid); } if (file_copy($image->filename) != 1) { print "couldnt copy file: {$image->filename} to new location"; exit; } db_query("INSERT INTO {term_image} (tid, path) VALUES (%d, '%s')", $image->tid, $image->filename); $completed[] = $image; } if ($_POST['edit']['delete'][$name] == 1) { file_delete($image->filename_orig); $deleted[] = $image; } } if ($c = count($completed)) { print "Updated {$c} terms"; } else { print "No terms updated"; } if ($c = count($deleted)) { print "Deleted {$c} node_image(s)"; } else { print "No images deleted"; } }
public function ruleDeleted($rid) { $sql = 'SELECT `id`, `pic` FROM ' . tablename('fance_reply') . ' WHERE `rid` = :rid'; $replies = pdo_fetchall($sql, array(':rid' => $rid)); load()->func('file'); if (!empty($replies)) { foreach ($replies as $index => $row) { file_delete($row['pic']); } } $params = array('rid' => $rid); pdo_delete('fance_reply', $params); pdo_delete($this->tablename, $params); return true; }
public function ruleDeleted($rid) { global $_W; load()->func('file'); $replies = pdo_fetchall("SELECT id, picture FROM " . tablename('nsign_reply') . " WHERE rid = '{$rid}'"); $deleteid = array(); if (!empty($replies)) { foreach ($replies as $index => $row) { file_delete($row['picture']); $deleteid[] = $row['id']; } } pdo_delete('nsign_reply', "id IN ('" . implode("','", $deleteid) . "')"); return true; }
public function settingsDisplay($settings) { global $_GPC, $_W; if (checksubmit()) { $cfg = array('noticeemail' => $_GPC['noticeemail'], 'shopname' => $_GPC['shopname'], 'address' => $_GPC['address'], 'phone' => $_GPC['phone'], 'officialweb' => $_GPC['officialweb'], 'description' => htmlspecialchars_decode($_GPC['description'])); if (!empty($_GPC['logo'])) { $cfg['logo'] = $_GPC['logo']; file_delete($_GPC['logo-old']); } if ($this->saveSettings($cfg)) { message('保存成功', 'refresh'); } } include $this->template('setting'); }
public function ruleDeleted($rid) { global $_W; load()->func('file'); $replies = pdo_fetchall("SELECT id, avatar FROM " . tablename($this->table_reply) . " WHERE rid = :rid", array(':rid' => $rid)); $deleteid = array(); if (!empty($replies)) { foreach ($replies as $index => $row) { file_delete($row['avatar']); $deleteid[] = $row['id']; } } pdo_delete($this->table_reply, "id IN ('" . implode("','", $deleteid) . "')"); return true; }