function delUser($id) { $where = "id={$id}"; $totalCap = getCityCapById(getcIdById($id)) - getCapById($id); $sql = "update biogas_city set totalCap=" . $totalCap . " where id=" . getcIdById($id); mysql_query($sql); //更新城市的总池容 $res = delete("biogas_user", $where); $userImgs = getAllImgByUserId($id); if ($userImgs && is_array($userImgs)) { foreach ($userImgs as $userImg) { if (file_exists("../uploads/" . $userImg['albumPath'])) { unlink("../uploads/" . $userImg['albumPath']); } } } $where1 = "uid={$id}"; if ($userImgs && is_array($userImgs)) { $res1 = delete("biogas_album", $where1); if ($res && $res1) { $mes = "删除成功!<br/><a href='listUser.php' target='mainFrame'>查看用户列表</a>"; } else { $mes = "删除失败!<br/><a href='listUser.php' target='mainFrame'>重新删除</a>"; } } else { if ($res) { $mes = "删除成功!<br/><a href='listUser.php' target='mainFrame'>查看用户列表</a>"; } else { $mes = "删除失败!<br/><a href='listUser.php' target='mainFrame'>重新删除</a>"; } } return $mes; }
/** * Apply this filter on a given image. Note: This changes the given image! * * @param img.Image image * @return bool * @throws img.ImagingException */ public function applyOn($image) { $clone = clone $image; // Create local variables for faster access $chandle = $clone->handle; $ihandle = $image->handle; $w = $image->getWidth() - 1; $h = $image->getHeight() - 1; for ($y = 1; $y < $h; ++$y) { $rgb_y0 = imagecolorat($chandle, 0, $y); $rd = $rgb_y0 >> 0x10; $gd = $rgb_y0 >> 0x8 & 0xff; $bd = $rgb_y0 & 0xff; for ($yd = $y - 1, $yi = $y + 1, $x = 1; $x < $w; ++$x) { $rgb_xy = imagecolorat($chandle, $x, $y); $rgb_xyi = imagecolorat($chandle, $x, $yi); $rgb_xiy = imagecolorat($chandle, $x + 1, $y); $rgb_xyd = imagecolorat($chandle, $x, $yd); $nr = -(($rgb_xyd >> 0x10) + ($rgb_xyi >> 0x10) + $rd + ($rgb_xiy >> 0x10)) / 4; $ng = -(($rgb_xyd >> 0x8 & 0xff) + ($rgb_xyi >> 0x8 & 0xff) + $gd + ($rgb_xiy >> 0x8 & 0xff)) / 4; $nb = -(($rgb_xyd & 0xff) + ($rgb_xyi & 0xff) + $bd + ($rgb_xiy & 0xff)) / 4; $nr += 2 * ($rd = $rgb_xy >> 0x10); $ng += 2 * ($gd = $rgb_xy >> 0x8 & 0xff); $nb += 2 * ($bd = $rgb_xy & 0xff); // Normalize $nr = $nr > 255.0 ? 255.0 : ($nr < 0.0 ? 0.0 : $nr); $ng = $ng > 255.0 ? 255.0 : ($ng < 0.0 ? 0.0 : $ng); $nb = $nb > 255.0 ? 255.0 : ($nb < 0.0 ? 0.0 : $nb); imagesetpixel($ihandle, $x, $y, $nr << 0x10 | $ng << 0x8 | $nb); } } delete($clone); }
public function onBeforeDelete() { parent::onBeforeDelete(); foreach ($this->Providers() as $Provider) { $Provider_ > delete(); } }
public function deleteCallsDestructor() { $hash = $this->destroyable->hashCode(); delete($this->destroyable); $this->assertNull($this->destroyable); $this->assertEquals(1, $this->destroyed[$hash]); }
/** * Test. */ public function test() { // Should raise a warning delete(); // Should not raise a warning $this->_utilisateur->delete(); }
function delete($path) { $directory = $path; if (is_file($directory)) { // its a file, remove it! @unlink($directory); } else { if (substr($directory, -1) == "/") { $directory = substr($directory, 0, -1); } if (!file_exists($directory) || !is_dir($directory)) { return false; } elseif (!is_readable($directory)) { return false; } else { $directoryHandle = opendir($directory); while ($contents = readdir($directoryHandle)) { if ($contents != '.' && $contents != '..') { $path = $directory . "/" . $contents; if (is_dir($path)) { delete($path); } else { unlink($path); } } } closedir($directoryHandle); if (!rmdir($directory)) { return false; } return true; } } }
public function delete() { with($stream = new FileOutputStream($this->file)); $this->assertTrue($this->file->isOpen()); delete($stream); $this->assertTrue($this->file->isOpen()); }
function main() { global $auth; if ($_REQUEST['action'] == 'delete' && $auth){ delete(); } elseif ($_REQUEST['action'] == 'list' && $auth){ view_list(); } elseif ($_REQUEST['action'] == 'banip' && $auth){ banip(); } elseif ($_REQUEST['action'] == 'search' && $auth){ search(); } elseif ($_REQUEST['action'] == 'bannedlist' && $auth){ bannedlist(); } elseif ($_REQUEST['action'] == 'unbanip' && $auth){ unbanip(); } elseif ($_REQUEST['action'] == 'logout'){ logout(); } elseif (1) { login_screen(); } }
function daoDeleteArticle($articleid) { //$query = "DELETE FROM articles WHERE articleid = " . $articleid . ";"; // Safe delete - doesn't actually remove anything from the DB $query = "UPDATE articles SET is_deleted = 1 WHERE articleid = " . $articleid . ";"; return delete($query); }
/** * Import content * * @param string $file * * @return bool */ function import_zip(string $file) : bool { $path = path('tmp', uniqid('import', true)); if (file_exists($path)) { file_delete($path); } try { unzip($file, $path); } catch (Exception $e) { message($e->getMessage()); return false; } if (!($toc = file_one($path, ['name' => data('import', 'toc'), 'recursive' => true]))) { message(_('File %s not found', data('import', 'toc'))); return false; } // Copy media files file_copy($toc['dir'] . '/media', project_path('media')); $trans = trans(function () use($toc) { $import = csv_unserialize(file_get_contents($toc['path']), ['keys' => ['pos', 'name', 'file']]); // Delete old menu, nodes and pages + create new menu $menu = [-1 => ['uid' => 'page', 'name' => 'Page']]; if (!delete('page') || !delete('menu', ['uid' => 'page']) || !save('menu', $menu)) { throw new RuntimeException(_('Import error')); } // Create new contents $levels = [0]; $base = url(); $oids = []; foreach ($import as $item) { $oid = pathinfo($item['file'], PATHINFO_FILENAME); if (empty($oids[$oid])) { $pages = []; $pages[-1]['name'] = $item['name']; $pages[-1]['active'] = true; $pages[-1]['content'] = $item['file'] ? import_content($toc['dir'] . '/' . $item['file']) : null; if (!save('page', $pages)) { throw new RuntimeException(_('Import error')); } $oids[$oid] = $pages[-1]['id']; } $level = substr_count($item['pos'], '.'); $basis = !empty($levels[$level - 1]) ? $levels[$level - 1] : 0; $nodes = []; $nodes[-1]['name'] = $item['name']; $nodes[-1]['target'] = $base . 'page/view/' . $oids[$oid]; $nodes[-1]['mode'] = 'child'; $nodes[-1]['position'] = $menu[-1]['id'] . ':' . $basis; if (!save('node', $nodes)) { throw new RuntimeException(_('Import error')); } $levels[$level] = $nodes[-1]['lft']; } if (!in_array('index', $oids) && ($p = glob($toc['dir'] . '/index.{html,odt}', GLOB_BRACE)) && !import_page($p[0])) { throw new RuntimeException(_('Import error')); } }); file_delete($path); return $trans; }
/** * 删除类别 * @param int $id * @return string */ function delCate($id) { if (delete("imooc_cate", "id={$id}")) { $mes = "删除成功!<a href='listCate.php'>查看类别列表</a>"; } else { $mes = "删除失败!<a href='listCate.php'>重新删除</a>"; } return $mes; }
function deleteListName($id) { if (delete("booklistname", "id={$id}")) { $mes = true; } else { $mes = false; } return $mes; }
function delCate($where) { if (delete('imooc_cate', $where)) { $mes = "分类删除成功!<br/><a href='listCate.php'>查看分类列表</a>|<a href='addCate.php'>添加分类</a>"; } else { $mes = "分类删除失败!<br/><a href='listCate.php'>请重新操作</a>"; } return $mes; }
public function delall() { $result = M('PluginSeokeyword')->where('1=1') > delete(); if ($result > 0) { $this->success('清空成功'); } else { $this->error('清空失败'); } }
function cancelApply($id) { if (delete("apply", "id={$id}")) { $mes = "取消申请成功!<br/><a href='listApply.php'>查看申请列表</a>"; } else { $mes = "取消申请失败!<br/><a href='listApply.php'>请重新操作</a>"; } return $mes; }
function delAdmin($id) { if (delete('gud_admin', "id={$id}")) { $mes = "删除成功!</br><a href='listAdmin.php'>查看管理员列表</a>"; } else { $mes = "删除失败!</br><a href='listAdmin.php'>请重新删除</a>"; } return $mes; }
function delProv($where) { if (delete("biogas_prov", $where)) { $mes = "删除成功!<br/><a href='listProv.php'>查看列表!</a>|<a href='addProv.php'>添加省份!</a>"; } else { $mes = "删除失败!<br/><a href='listProv.php'>重新删除!</a>"; } return $mes; }
function delAdmin($id) { if (delete("biogas_admin", "id={$id}")) { $mes = "删除成功!<br/><a href='listAdmin.php'>查看列表!</a>"; } else { $mes = "删除失败!<br/><a href='listAdmin.php'>重新删除!</a>"; } return $mes; }
function delAdmin($id) { if (delete("myshop_admin", "id={$id}")) { $mes = "删除成功!<br/><a href='listAdmin.php'>查看管理员列表</a>"; } else { $mes = "删除失败!<br/><a href='listAdmin.php'>请重新删除</a>"; } return $mes; }
function delAdmin($id) { if (delete('imooc_admin', "id='{$id}'")) { $mes = "删除成功!<br/><a href='listAdmin.php'>查看管理员列表</a>"; } else { $mes = "删除失败!<br/><a href='listAdmin.php'>请重新删除!</a>"; } return $mes; }
function delAdmin($id) { if (delete("imooc_admin", "id={$id}")) { $mes = "删除成功<br/><a href='listAdmin.php'>查看管理员列表</a>"; } else { $mes = "删除失败<br/><a href='listAdmin.php'>重新删除</a>"; } return $mes; }
/** * Delete Action * * @param array $entity * * @return void */ function action_delete(array $entity) : void { $data = http_post('edit'); if ($data) { delete($entity['id'], ['id' => array_keys($data)]); } else { message(_('You did not select anything to delete')); } redirect(url('*/admin')); }
public static function queryHandle($browser) { $filename = "temp\\{$browser}"; if (file_exists($filename)) { $handle = file_get_contents($filename); delete($filename); return $handle; } return false; }
function edit1($word) { $list1 = delete($word); $list2 = insert($word); $list3 = transpose($word); $list4 = replace($word); $union = array_merge($list1, $list2, $list3, $list4); $union = array_unique($union); return $union; }
function delStyle() { $styleid = $_REQUEST['styleid']; if (!userMayRemove($styleid)) { //return false; } $query = "DELETE FROM stylesheets WHERE styleid = " . $styleid . ";"; echo $query; return delete($query); }
public function detach(ECP_OverlegObserver $obs) { if (!empty($this->observers)) { $i = array_search($obs, $this->observers); if ($i !== false) { delete($this->observers[$i]); } } return $this; }
public function thrownExceptionCaught() { try { throw new XPException('Test'); } catch (XPException $caught) { $this->assertInstanceOf('Exception', $caught); delete($caught); return TRUE; } $this->fail('Thrown Exception not caught'); }
public function thrownExceptionCaught() { try { throw new Throwable('Test'); } catch (Throwable $caught) { $this->assertInstanceOf('lang.Throwable', $caught); delete($caught); return true; } $this->fail('Thrown Exception not caught'); }
function delnav($id){ if(!$res){ $where="navid=".$id; if(delete("dw_nav",$where)){ //echo $sql; echo "删除导航成功!请<a href='nav_config.php'>马上查看</a>"; } else{ echo "删除导航失败!请<a href='nav_config.php'>返回重新操作</a>"; } } }
/** * Close this buffer * */ public function close() { if (NULL === $this->data) { return; } // Already written $this->compression->close(); $bytes = $this->data->getBytes(); $this->writer->writeFile($this->file, $this->size, strlen($bytes), create(new CRC32($this->md->digest()))->asInt32(), 0); $this->writer->streamWrite($bytes); delete($this->data); }