Example #1
0
function mso_remote_f_deletepost($post)
{
    if ($post = mso_check_post(array('remote_page_id'))) {
        $page_id = (int) $post['remote_page_id'];
        $data = array('page_id' => $page_id);
        require_once getinfo('common_dir') . 'functions-edit.php';
        // функции редактирования
        $result = mso_delete_page($data);
        if (isset($result['result']) and $result['result']) {
            mso_flush_cache();
            // сбросим кэш
            $out = 'OK: ' . $result['description'];
            return $out;
        } else {
            $out = 'ERROR: ' . $result['description'];
            return $out;
        }
    }
}
Example #2
0
if ($post = mso_check_post(array('f_session_id', 'f_submit', 'f_page_delete'))) {
    mso_checkreferer();
    // pr($post);
    $page_id = (int) $post['f_page_delete'];
    if (!is_numeric($page_id)) {
        $page_id = false;
    } else {
        $page_id = (int) $page_id;
    }
    if (!$page_id) {
        echo '<div class="error">' . t('Ошибка удаления') . '</div>';
    } else {
        $data = array('user_login' => $MSO->data['session']['users_login'], 'password' => $MSO->data['session']['users_password'], 'page_id' => $page_id);
        require_once getinfo('common_dir') . 'functions-edit.php';
        // функции редактирования
        $result = mso_delete_page($data);
        if (isset($result['result']) and $result['result']) {
            if ($result['result']) {
                # mso_flush_cache(); // сбросим кэш перенес в mso_delete_page
                echo '<div class="update">' . t('Страница удалена') . '</div>';
            } else {
                echo '<div class="error">' . t('Ошибка при удалении') . ' (' . $result['description'] . ')</div>';
            }
        } else {
            echo '<div class="error">' . t('Ошибка при удалении') . ' (' . $result['description'] . ')</div>';
        }
        /*
        $CI->db->select('page_id');
        $CI->db->where(array('page_id'=>$page_id));
        $query = $CI->db->get('page');
        if ($query->num_rows() == 0) // нет такого