Ejemplo n.º 1
0
/**
* @desc Elimina de la base de datos las postales especificadas
**/
function deletePostCards()
{
    global $util, $xoopsModule, $xoopsSecurity;
    $ids = isset($_REQUEST['ids']) ? $_REQUEST['ids'] : 0;
    $ok = isset($_POST['ok']) ? $_POST['ok'] : 0;
    $page = isset($_REQUEST['page']) ? $_REQUEST['page'] : '';
    $limit = isset($_REQUEST['limit']) ? intval($_REQUEST['limit']) : 15;
    //Verificamos si nos proporcionaron al menos una postal para eliminar
    if (!is_array($ids)) {
        redirectMsg('./postcards.php?pag=' . $page . '&limit=' . $limit, __('You must select one e-card at least!', 'galleries'), 1);
        die;
    }
    if (!$xoopsSecurity->check()) {
        redirectMsg('./postcards.php?pag=' . $page . '&limit=' . $limit, __('Session token expired!', 'galleries'), 1);
        die;
    }
    $errors = '';
    foreach ($ids as $k) {
        //Verificamos si la postal sea válida
        if ($k <= 0) {
            $errors .= sprintf(__('The ID "%s" is not valid!', 'galleries'), $k);
            continue;
        }
        //Verificamos si la postal exista
        $post = new GSPostcard($k);
        if ($post->isNew()) {
            $errors .= sprintf(__('E-Card with id "%s" does not exists!', 'galleries'), $k);
            continue;
        }
        if (!$post->delete()) {
            $errors .= sprintf(__('E-Card "%s" could not be deleted!', 'galleries'), $k);
        }
    }
    if ($errors != '') {
        redirectMsg('./postcards.php?pag=' . $page . '&limit=' . $limit, __('Errors ocurred while trying to delete e-cards', 'galleries') . $errors, 1);
        die;
    } else {
        redirectMsg('./postcards.php?pag=' . $page . '&limit=' . $limit, __('E-Cards deleted successfully!', 'galleries'), 0);
        die;
    }
}
Ejemplo n.º 2
0
/**
* @desc Visualiza la postal
**/
function viewPostcard()
{
    global $tpl, $xoopsModule, $xoopsModuleConfig, $xoopsModuleConfig, $mc, $xoopsUser, $id;
    include_once XOOPS_ROOT_PATH . '/class/template.php';
    $tpl = new XoopsTpl();
    $mc =& $xoopsModuleConfig;
    if (!$xoopsUser) {
        redirect_header(XOOPS_URL . '/user.php#register', 1, _MS_GS_ERRUSR);
        die;
    }
    //Verificamos si la postal existe
    $post = new GSPostcard($id);
    if ($post->isNew()) {
        redirect_header(XOOPS_URL . '/modules/galleries/', 1, _MS_GS_ERRPOSTEXIST);
        die;
    }
    $img = new GSImage($post->image());
    if ($img->isNew()) {
        redirect_header(XOOPS_URL . '/modules/galleries/', 1, _MS_GS_ERRIMG);
        die;
    }
    $user = new GSUser($img->owner(), 1);
    $file = $user->filesPath() . '/' . $img->image();
    list($ancho, $alto) = getimagesize($file);
    $tpl->assign('gs_url', XOOPS_URL . '/modules/galleries');
    $tpl->assign('img', array('id' => $img->id(), 'width' => $ancho, 'height' => $alto, 'url' => $user->filesURL() . '/' . $img->image(), 'link' => $user->userURL() . 'img/' . $img->id() . '/'));
    $tpl->assign('title', $post->title());
    $tpl->assign('message', $post->message());
    $tpl->assign('lang_says', sprintf(_MS_GS_SAYS, $post->name()));
    $tpl->assign('xoops_pagetitle', sprintf(_MS_GS_PTITLE, $post->title()) . ' &raquo; ' . $mc['section_title']);
    $tpl->assign('lang_see', _MS_GS_SEE);
    $tpl->assign('user_link', $user->userURL() . 'browse/' . $img->id() . '/');
    $tpl->assign('lang_seeuser', _MS_GS_SEEUSER);
    $tpl->assign('preview', 0);
    RMTemplate::get()->add_xoops_style('postcard.css', 'galleries');
    //Actualizar datos de postal
    $post->setViewed(1);
    $post->save();
    echo $tpl->fetch("db:gs_postcard.html");
}
Ejemplo n.º 3
0
/**
* @desc Visualiza la postal
**/
function viewPostcard()
{
    global $tpl, $xoopsModule, $xoopsModuleConfig, $xoopsModuleConfig, $mc, $xoopsUser, $id;
    include_once XOOPS_ROOT_PATH . '/class/template.php';
    $tpl = new XoopsTpl();
    $mc =& $xoopsModuleConfig;
    //Verificamos si la postal existe
    $post = new GSPostcard($id);
    if ($post->isNew()) {
        redirect_header(XOOPS_URL . '/modules/galleries/', 1, __('Specified E_Card does not exists!', 'galleries'));
        die;
    }
    $img = new GSImage($post->image());
    if ($img->isNew()) {
        redirect_header(XOOPS_URL . '/modules/galleries/', 1, __('Sorry, there are some problems with this e-card!', 'galleries'));
        die;
    }
    $user = new GSUser($img->owner(), 1);
    $file = $user->filesPath() . '/' . $img->image();
    list($ancho, $alto) = getimagesize($file);
    $tpl->assign('gs_url', XOOPS_URL . '/modules/galleries');
    $tpl->assign('img', array('id' => $img->id(), 'width' => $ancho, 'height' => $alto, 'url' => $user->filesURL() . '/' . $img->image(), 'link' => $user->userURL() . 'img/' . $img->id() . '/'));
    $tpl->assign('title', $post->title());
    $tpl->assign('message', $post->message());
    $tpl->assign('lang_says', sprintf(__('%s says:'), $post->name()));
    $tpl->assign('xoops_pagetitle', sprintf(__('%s, E-Card', 'galleries'), $post->title()) . ' &raquo; ' . $mc['section_title']);
    $tpl->assign('lang_see', __('View Picture', 'galleries'));
    $tpl->assign('user_link', $user->userURL() . 'browse/' . $img->id() . '/');
    $tpl->assign('lang_seeuser', __('View User Pictures', 'galleries'));
    $tpl->assign('preview', 0);
    RMTemplate::get()->add_xoops_style('postcard.css', 'galleries');
    //Actualizar datos de postal
    $post->setViewed(1);
    $post->save();
    echo $tpl->fetch("db:gs_postcard.html");
}