Esempio n. 1
0
function page_update_neighbours($p_page_id, $p_prev, $p_next, $p_parent)
{
    if (null === $p_prev && null === $p_next && null === $p_parent) {
        return;
    }
    $t_page_info = page_get_info(page_where_id_equals($p_page_id));
    if (false === $t_page_info) {
        return;
    }
    if (null === $p_parent) {
        $t_parent_id = $t_page_info['parent_id'];
    } else {
        $t_parent_id = page_get_id($p_parent);
        if (false === page_valid_id($t_parent_id)) {
            $t_parent_id = 0;
        }
    }
    if (null === $p_prev) {
        $t_prev_id = $t_page_info['prev_id'];
    } else {
        $t_prev_id = page_get_id($p_prev);
        if (false === page_valid_id($t_prev_id)) {
            $t_prev_id = 0;
        }
    }
    if (null === $p_next) {
        $t_next_id = $t_page_info['next_id'];
    } else {
        $t_next_id = page_get_id($p_next);
        if (false === page_valid_id($t_next_id)) {
            $t_next_id = 0;
        }
    }
    # If the information is the same, then don't update/touch.
    if ($t_parent_id == $t_page_info['parent_id'] && $t_prev_id == $t_page_info['prev_id'] && $t_next_id == $t_page_info['next_id']) {
        return;
    }
    $c_page_id = db_prepare_int($p_page_id);
    $query = "UPDATE " . config_get('phpWN_page_table') . "\r\n\t\t\t\tSET parent_id={$t_parent_id}, prev_id={$t_prev_id}, next_id={$t_next_id}\r\n\t\t\t\tWHERE id={$c_page_id} LIMIT 1";
    $result = db_query($query);
    page_touch($p_page_id);
}
Esempio n. 2
0
function note_touch($p_note_id, $p_page_id = null)
{
    if (null === $p_page_id) {
        $p_page_id = note_get_page_id($p_note_id);
    }
    page_touch($p_page_id);
}