本文整理汇总了PHP中Page::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::delete方法的具体用法?PHP Page::delete怎么用?PHP Page::delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Page
的用法示例。
在下文中一共展示了Page::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
function delete($id)
{
$page = new Page($id);
$page->delete();
set_notify('success', lang('delete_data_complete'));
redirect('pages/admin/pages');
}
示例2: delPage
function delPage()
{
//Delete
if ($GLOBALS["action"] == "delete" && $GLOBALS["id"] != null) {
global $database;
$delpage = new Page("pages");
$id = $delpage::$id = "Id=" . $GLOBALS["id"];
$delpage->delete();
if ($database->affectedRows()) {
//delete corresponding image
$imgdirpath = "../";
$image_path = $imgdirpath . PAGEIMG_DIR;
$delimage = new Image("pageimgs");
$getimage = $delimage::findRow("Pageid='{$GLOBALS["id"]}'");
if ($database->getNumofRows() > 0) {
unlink($image_path . $getimage->Imgname . "." . $getimage->Extention);
//delete image
unlink($imgdirpath . TEMP_DIR . $getimage->Imgname . "." . $getimage->Extention);
//delete thumb image
$delimage::$id = "Id=" . $GLOBALS["id"];
$delimage->delete();
}
}
}
header("Location: " . filter_var($_SERVER['PHP_SELF'] . "?action=view&target=managepage"));
}
示例3: delete
/**
* Delete the company
* @return void
*/
function delete()
{
global $DB, $Controller, $USER;
if ($Controller->alias('companyEditor')->may($USER, DELETE)) {
$DB->companies->delete(array('id' => $this->ID));
parent::delete();
}
}
示例4: delete
public function delete()
{
if ($this->show->itemID) {
$oPage = new Page();
$oPage->delete($this->show->itemID);
}
redirect(BASE_PATH . 'admin/page');
}
示例5: delete
public function delete()
{
if ($this->getStackType() == self::ST_TYPE_GLOBAL_AREA) {
GlobalArea::deleteByName($this->getStackName());
}
parent::delete();
$db = Loader::db();
$db->Execute('delete from Stacks where cID = ?', array($this->getCollectionID()));
}
示例6: removePage
public function removePage($pageNumber)
{
if (array_key_exists($pageNumber, $this->_pageKeys)) {
$this->load->model('page');
$page = new Page($this->_DBI);
$pageKey = $this->_pageKeys[$pageNumber];
$page->setKey($pageKey);
if ($page->delete()) {
array_splice($this->_pageKeys, $pageNumber, 1);
return true;
}
}
return false;
}
示例7: testDelete
/**
* delete
*
* @param mixed $id ID of record to delete
* @param array $expected 期待値
* @param string $message テストが失敗した時に表示されるメッセージ
* @dataProvider deleteDataProvider
*/
public function testDelete($id, $expected, $message = null)
{
// 削除したファイルを再生するため内容を取得
$Page = $this->Page->find('first', ['conditions' => ['Page.id' => $id], 'fields' => ['Content.url'], 'recursive' => 0]);
$path = APP . 'View' . DS . 'Pages' . $Page['Content']['url'] . '.php';
$File = new File($path);
$Content = $File->read();
// 削除実行
$this->Page->delete($id);
$this->assertFileNotExists($path, $message);
// 元のファイルを再生成
$File->write($Content);
$File->close();
// 削除できているか確認用にデータ取得
$result = $this->Page->exists($id);
$this->assertEquals($expected, $result, $message);
}
示例8: display
public function display()
{
$page = new Page();
$page->loadProperties(DataBase::Current()->EscapeString($_GET['site']));
$host = Settings::getInstance()->get("host");
if (!isset($_GET['delete'])) {
$template = new Template();
$template->load("site_delete");
$template->assign_var("TITLE", $page->title);
$home = UrlRewriting::GetUrlByAlias("admin/home");
$template->assign_var("SITESURL", $home);
$delete = UrlRewriting::GetUrlByAlias("admin/pagedelete", "site=" . urlencode($_GET['site']) . "&delete=true");
$template->assign_var("DELETEURL", $delete);
$template->output();
} else {
if ($page->delete()) {
$template = new Template();
$template->load("message");
$message = str_ireplace("{VAR:TITLE}", $page->title, Language::GetGlobal()->getString("PAGE_DELETED"));
$template->assign_var("MESSAGE", $message);
$template->output();
}
}
}
示例9: testRevertToLiveFixesBrokenLinks
public function testRevertToLiveFixesBrokenLinks()
{
// Create page and virutal page
$p = new Page();
$p->Title = "source";
$p->write();
$pageID = $p->ID;
$this->assertTrue($p->doPublish());
// Content links are one kind of link to pages
$p2 = new Page();
$p2->Title = "regular link";
$p2->Content = "<a href=\"[sitetree_link,id={$p->ID}]\">test</a>";
$p2->write();
$this->assertTrue($p2->doPublish());
// Virtual pages are another
$vp = new VirtualPage();
$vp->CopyContentFromID = $p->ID;
$vp->write();
// Redirector links are a third
$rp = new RedirectorPage();
$rp->Title = "redirector";
$rp->LinkType = 'Internal';
$rp->LinkToID = $p->ID;
$rp->write();
$this->assertTrue($rp->doPublish());
// Confirm that there are no broken links to begin with
$this->assertFalse($p2->HasBrokenLink);
$this->assertFalse($vp->HasBrokenLink);
$this->assertFalse($rp->HasBrokenLink);
// Delete from draft and confirm that broken links are marked
$pID = $p->ID;
$p->delete();
$vp->flushCache();
$vp = DataObject::get_by_id('SiteTree', $vp->ID);
$p2->flushCache();
$p2 = DataObject::get_by_id('SiteTree', $p2->ID);
$rp->flushCache();
$rp = DataObject::get_by_id('SiteTree', $rp->ID);
$this->assertEquals(1, $p2->HasBrokenLink);
$this->assertEquals(1, $vp->HasBrokenLink);
$this->assertEquals(1, $rp->HasBrokenLink);
// Call doRevertToLive and confirm that broken links are restored
$pLive = Versioned::get_one_by_stage('SiteTree', 'Live', '"SiteTree"."ID" = ' . $pID);
$pLive->doRevertToLive();
$p2->flushCache();
$p2 = DataObject::get_by_id('SiteTree', $p2->ID);
$vp->flushCache();
$vp = DataObject::get_by_id('SiteTree', $vp->ID);
$rp->flushCache();
$rp = DataObject::get_by_id('SiteTree', $rp->ID);
$this->assertFalse((bool) $p2->HasBrokenLink);
$this->assertFalse((bool) $vp->HasBrokenLink);
$this->assertFalse((bool) $rp->HasBrokenLink);
}
示例10: testNormalSiteTreeDeleteWithoutVersionsTableCleaning
public function testNormalSiteTreeDeleteWithoutVersionsTableCleaning() {
$page = new Page();
$page->Title = 'Page';
$page->write();
$pageID = $page->ID;
$page->delete();
$query = "SELECT \"ID\" FROM \"SiteTree_versions\" WHERE \"RecordID\" = {$pageID}";
$this->assertTrue((bool)DB::query($query)->value(),
"No versions found for RecordID {$pageID} even though one should exist");
}
示例11: destroy_user
/**
* Function: destroy_user
* Destroys a user.
*/
public function destroy_user()
{
if (!Visitor::current()->group->can("delete_user")) {
show_403(__("Access Denied"), __("You do not have sufficient privileges to delete users."));
}
if (empty($_POST['id'])) {
error(__("No ID Specified"), __("An ID is required to delete a user."));
}
if ($_POST['destroy'] == "bollocks") {
redirect("/admin/?action=manage_users");
}
if (!isset($_POST['hash']) or $_POST['hash'] != Config::current()->secure_hashkey) {
show_403(__("Access Denied"), __("Invalid security key."));
}
$sql = SQL::current();
$user = new User($_POST['id']);
if (isset($_POST['posts'])) {
if ($_POST['posts'] == "delete") {
foreach ($user->post as $post) {
Post::delete($post->id);
}
} elseif ($_POST['posts'] == "move") {
$sql->update("posts", array("user_id" => $user->id), array("user_id" => $_POST['move_posts']));
}
}
if (isset($_POST['pages'])) {
if ($_POST['pages'] == "delete") {
foreach ($user->page as $page) {
Page::delete($page->id);
}
} elseif ($_POST['pages'] == "move") {
$sql->update("pages", array("user_id" => $user->id), array("user_id" => $_POST['move_pages']));
}
}
User::delete($_POST['id']);
Flash::notice(__("User deleted."), "/admin/?action=manage_users");
}
示例12: getRootPath
<?php
include_once getRootPath() . "/classes/core/Page.php";
$strNode = stripslashes($_REQUEST["node"]);
Page::delete($strNode);
示例13: delete
/**
* Delete the file
* Cascades the call to parent
* @see solidbase/lib/Page#delete()
*/
function delete()
{
global $USER, $DB;
if ($this->may($USER, DELETE)) {
if ($this->Type == 'File') {
unlink($this->path);
}
$DB->files->delete($this->ID);
parent::delete();
}
}
示例14: delete
public function delete()
{
if ($this->canDelete(Member::currentUser())) {
parent::delete();
}
}
示例15: Session
<?php
require_once '../model/paths.php';
$session = new Session();
if (!$session->isLogin) {
redirect("../login.php");
}
$user = new User();
$database = new Database();
$page = new Page();
if (isset($_POST['pageList']) && $_POST['pageList'] != null) {
foreach ($_POST['pageList'] as $pageId) {
$page->setPageId($database->escapeString($pageId));
$page->delete($database);
$path = "../logs";
$dateTime = strftime("%Y-%m-%d %H:%M:%S");
$text = "Deleted page with id:" . $pageId;
$content = $dateTime . " " . $_SESSION['USNM'] . ": " . $text;
$user->setId($_SESSION['USID']);
$user->storeLog($content, $path);
echo "true";
}
} else {
echo "false";
}