示例#1
0
 /**
  * Tests the delete of a link
  */
 public function testDeleteLink()
 {
     global $AppUI;
     $this->obj->bind($this->post_data);
     $result = $this->obj->store($AppUI);
     $this->assertTrue($result);
     $original_id = $this->obj->link_id;
     $result = $this->obj->delete($AppUI);
     $this->assertTrue($result);
     $link = new CLink();
     $link->load($original_id);
     $this->assertEquals('', $link->link_name);
     $this->assertEquals('', $link->link_url);
 }
示例#2
0
 /**
  * Tests the delete of a link
  */
 public function testDelete()
 {
     $this->obj->bind($this->post_data);
     $result = $this->obj->store();
     $this->assertTrue($result);
     $original_id = $this->obj->link_id;
     $result = $this->obj->delete();
     $item = new CLink();
     $item->overrideDatabase($this->mockDB);
     $this->mockDB->stageHash(array('link_name' => '', 'link_url' => ''));
     $item->load($original_id);
     $this->assertTrue(is_a($item, 'CLink'));
     $this->assertEquals('', $item->link_name);
     $this->assertEquals('', $item->link_url);
 }
示例#3
0
if ($link_id) {
    $obj->_message = 'updated';
} else {
    $obj->_message = 'added';
}
$obj->link_date = date('Y-m-d H:i:s');
$obj->link_category = intval(dPgetParam($_POST, 'link_category', 0));
if (!$obj->bind($_POST)) {
    $AppUI->setMsg($obj->getError(), UI_MSG_ERROR);
    $AppUI->redirect();
}
// prepare (and translate) the module name ready for the suffix
$AppUI->setMsg('Link');
// delete the link
if ($del) {
    $obj->load($link_id);
    if ($msg = $obj->delete()) {
        $AppUI->setMsg($msg, UI_MSG_ERROR);
        $AppUI->redirect();
    } else {
        if ($not == '1') {
            $obj->notify();
        }
        $AppUI->setMsg("deleted", UI_MSG_ALERT, true);
        $AppUI->redirect("m=links");
    }
}
if (!$link_id) {
    $obj->link_owner = $AppUI->user_id;
}
if ($msg = $obj->store()) {
示例#4
0
<?php

if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
$link_id = (int) w2PgetParam($_GET, 'link_id', 0);
$link = new CLink();
if (!$link->load($link_id)) {
    $AppUI->redirect(ACCESS_DENIED);
}
header("Location: " . $link->link_url);