Example #1
0
function edit()
{
    global $sess, $title, $level, $description, $int_node, $thisnode, $glob_language;
    if (is_trail($title)) {
        $title = $title . "/";
    }
    if (level_count($title) > 0) {
        include "directory/edit/err_invalidslash.html";
    } else {
        $obj['name'] = parent_path($thisnode['path']) . $title;
        $obj['name'] = str_replace(' ', '_', $obj['name']);
        $obj['level'] = $level;
        $obj['description'] = $description;
        $obj['useraccess'] = 0;
        $obj['friendaccess'] = 0;
        $obj['owner'] = '';
        $obj['language'] = $glob_language;
        $intid = path2id_ex($int_node, 1);
        $obj['intnode'] = $intid != -1 ? $intid : "";
        if ($obj['name'] != $thisnode['path']) {
            sub_rename($thisnode['path'], $obj['name']);
        }
        edit_object($thisnode['id'], $obj);
        // die("Fertig: ".$obj['name']);
        header("Location: " . $sess->url($obj['name']));
    }
}
Example #2
0
function edit(&$nodeinfo, $description, $title, $pass_lang_check = false, $act_as_admin = false)
{
    global $sess, $auth, $glob_language_name, $glob_language;
    $testnode = get_node_info((string) parent_path($nodeinfo['path']) . $title);
    if (!defined("SPELLING_INC")) {
        include "commonapi/spelling.inc";
    }
    if (!defined("DIRECTORY_NOTIFICATION_INC")) {
    }
    include "messages/directory_notification.inc";
    $predef['title'] = $title;
    $title = str_replace(' ', '_', $title);
    $predef['description'] = $description;
    if (strstr($title, '/')) {
        editform($predef, "err_invalidslash.html");
        exit;
    } elseif ($title == "") {
        editform($predef, "err_notitle.html");
        exit;
    } elseif ($description == "") {
        editform($predef, "err_nodesc.html");
        exit;
    } elseif ($testnode != -1 and $nodeinfo['id'] != $testnode['id']) {
        editform($predef, "err_object_exists.html");
        exit;
    } elseif (!check_language($description, $glob_language_name) and !$pass_lang_check) {
        lang_query($kat, $title, $description, $nodeinfo['id'], $act_as_admin);
    } else {
        $obj['name'] = parent_path($nodeinfo['path']) . $title;
        $obj['description'] = $description;
        $obj['useraccess'] = $nodeinfo['useraccess'];
        $obj['friendaccess'] = $nodeinfo['friendaccess'];
        $obj['userid'] = $nodeinfo['userid'];
        $obj['level'] = level_count($obj['name']);
        $obj['language'] = $glob_language;
        edit_object($nodeinfo['id'], $obj);
        $obj['id'] = $nodeinfo['id'];
        if ($act_as_admin) {
            send_admin_notification($obj, LTMSG_TRAILCHG);
        }
        //TODO: add reason
        //else
        // send_notification($obj, $auth->auth['uname'], LTMSG_TRAILCHG, !($auth->auth['uid'] == $obj['owner']));
        //don't send if I delete my own trail
        Header("Location: " . $sess->url(build_good_url($obj['name']) . "?reloadparent=1"));
        exit;
    }
}