Ejemplo n.º 1
0
function save_note($action, $data)
{
    $nt = new DataBaseTable('notes', true, DATACONF);
    if ($action == 'edit' && !empty($_GET['nid'])) {
        $data['nid'] = $_GET['nid'];
        if ($nid = $nt->updateData($data)) {
            return $nid;
        } else {
            return false;
        }
    } elseif ($action != "remove") {
        if ($nid = $nt->putData($data)) {
            return $nid;
        } else {
            return false;
        }
    } else {
        if ($nid = $nt->deleteData($data)) {
            return $nid;
        } else {
            return false;
        }
    }
}
Ejemplo n.º 2
0
function save_asset($action, $data)
{
    $con = new DataBaseTable('content', true, DATACONF);
    $tags = new MCTags();
    if (!empty($_GET['cid'])) {
        if (empty($data['tags'])) {
            $tags->delAllByCon($_GET['cid']);
        } else {
            $tarr = explode(",", $data['tags']);
            $tags->changeAssoc($_GET['cid'], $tarr);
        }
    }
    //file uploads should be handled elsewhere...
    if ($action == 'drop') {
        $tags->delAllByCon($_GET['cid']);
        if ($cid = $con->deleteData($data)) {
            return $cid . " dropped";
        } else {
            return $cid . "could not be removed!";
        }
    } elseif (!empty($_GET['cid'])) {
        $data['cid'] = $_GET['cid'];
        if ($cid = $con->updateData($data)) {
            return $cid;
        } else {
            return false;
        }
    } else {
        if ($cid = $con->putData($data)) {
            return $cid;
        } else {
            return false;
        }
    }
}