예제 #1
0
function showForm()
{
    global $db, $xoopsOption, $xoopsUser, $mc, $tpl, $xoopsConfig, $xoopsModuleConfig, $user, $xoopsSecurity;
    $xoopsOption['template_main'] = "gs_submit.html";
    $xoopsOption['module_subpage'] = 'submit';
    include 'header.php';
    GSFunctions::makeHeader();
    $mc =& $xoopsModuleConfig;
    $tpl->assign('lang_uploadyour', __('Upload your Pictures', 'galleries'));
    $tpl->assign('lang_step1', __('Step 1:', 'galleries'));
    $tpl->assign('lang_step2', __('Step 2:', 'galleries'));
    $tpl->assign('lang_step3', __('Step 3:', 'galleries'));
    $tpl->assign('lang_step4', __('Step 4:', 'galleries'));
    $tpl->assign('lang_choose', __('Select Files', 'galleries'));
    $tpl->assign('lang_privacy', __('Set Privacy', 'galleries'));
    $tpl->assign('lang_privateme', __('Private (<em>Only you will seee these pictures</em>)', 'galleries'));
    $tpl->assign('lang_privatef', __('For Friends (<em>Only you and your friends will see these pictures</em>)', 'galleries'));
    $tpl->assign('lang_public', __('Public (<em>Pictures will visible for all</em>)'));
    $tpl->assign('lang_upload', __('Upload Files', 'galleries'));
    $tpl->assign('lang_clicktou', __('Click to Upload', 'galleries'));
    $tpl->assign('lang_tagsesp', __('Specify tags to use', 'galleries'));
    $tpl->assign('lang_tagsdesc', __('Separate each tag with a comma (,).', 'galleries'));
    $tpl->assign('lang_maxsize', sprintf(__('The maximum file size allowed is <strong>%s</strong>.', 'galleries'), RMUtilities::formatBytesSize($mc['size_image'] * 1024)));
    $tpl->assign('used_graph', GSFunctions::makeQuota($user, false));
    $tpl->assign('form_action', GSFunctions::get_url() . ($mc['urlmode'] ? 'submit/' : '?submit=submit'));
    $tpl->assign('token', $xoopsSecurity->getTokenHTML());
    $used = round($user->usedQuota() / $user->quota() * 100) . '%';
    $tpl->assign('lang_used', sprintf(__('You have used <strong>%s</strong> of <strong>%s</strong> available. You left <strong>%s</strong>', 'galleries'), $used, RMUtilities::formatBytesSize($user->quota()), RMUtilities::formatBytesSize($user->usedQuota() >= $user->quota() ? 0 : $user->quota() - $user->usedQuota())));
    RMTemplate::get()->add_xoops_style('submit.css', 'galleries');
    include 'footer.php';
}
예제 #2
0
/**
* @desc Visualiza la lista de amigos del usuario
**/
function showFriends()
{
    global $xoopsOption, $tpl, $db, $xoopsUser, $xoopsModuleConfig, $pag, $xoopsConfig;
    $xoopsOption['template_main'] = 'gs_panel_friends.html';
    include 'header.php';
    $mc =& $xoopsModuleConfig;
    GSFunctions::makeHeader();
    //Barra de Navegación
    $sql = "SELECT COUNT(*) FROM " . $db->prefix('gs_friends') . " WHERE gsuser='******'";
    $page = isset($pag) ? $pag : '';
    $limit = 30;
    list($num) = $db->fetchRow($db->query($sql));
    if ($page > 0) {
        $page -= 1;
    }
    $start = $page * $limit;
    $tpages = (int) ($num / $limit);
    if ($num % $limit > 0) {
        $tpages++;
    }
    $pactual = $page + 1;
    if ($pactual > $tpages) {
        $rest = $pactual - $tpages;
        $pactual = $pactual - $rest + 1;
        $start = ($pactual - 1) * $limit;
    }
    if ($tpages > 1) {
        if ($mc['urlmode']) {
            $urlnav = 'cpanel/friends';
        } else {
            $urlnav = 'cpanel.php?by=cpanel/friends';
        }
        $nav = new GsPageNav($num, $limit, $start, 'pag', $urlnav, 0);
        $tpl->assign('friendsNavPage', $nav->renderNav(4, 1));
    }
    $showmax = $start + $limit;
    $showmax = $showmax > $num ? $num : $showmax;
    $tpl->assign('lang_showing', sprintf(__('Sowing friends %u to %u from %u.', 'galleries'), $start + 1, $showmax, $num));
    $tpl->assign('limit', $limit);
    $tpl->assign('pag', $pactual);
    //Fin de barra de navegación
    $sql = "SELECT * FROM " . $db->prefix('gs_friends') . " WHERE gsuser='******'";
    $sql .= " LIMIT {$start},{$limit}";
    $result = $db->query($sql);
    while ($row = $db->fetchArray($result)) {
        $xu = new XoopsUser($row['uid']);
        $tpl->append('users', array('uid' => $xu->uid(), 'uname' => $xu->uname(), 'link' => XOOPS_URL . "/modules/galleries/" . ($mc['urlmode'] ? "usr/" . $xu->uname() . "/" : "user.php?id=usr/" . $xu->uname()), 'avatar' => RMEvents::get()->run_event('rmcommon.get.avatar', $xu->email(), 0, $xu->user_avatar() != '' ? XOOPS_URL . '/uploads/avatars/' . $xu->user_avatar() : GS_URL . '/images/avatar.png')));
    }
    $tpl->assign('lang_uname', __('User name', 'galleries'));
    $tpl->assign('lang_newfriend', __('New Friend', 'galleries'));
    $tpl->assign('lang_del', __('Delete', 'galleries'));
    $tpl->assign('lang_confirm', __('Do you really wish to delete specified friend?', 'galleries'));
    $tpl->assign('lang_confirms', __('Do you really wish to delete selected friends?', 'galleries'));
    $tpl->assign('form_action_add', GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/add/' : '?cp=add'));
    $tpl->assign('form_action_del', GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/delete/' : '?cp=delete'));
    $tpl->assign('delete_link', GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/deletefriend/pag/' . $pactual . '/id/' : '?cp=deletefriend&amp;page=' . $pactual . '&amp;id='));
    RMTemplate::get()->add_style('panel.css', 'galleries');
    createLinks();
    include 'footer.php';
}
예제 #3
0
/**
* @desc Muestra el formulario para la creación de la postal
*/
function newPostcard()
{
    global $xoopsUser, $xoopsModule, $xoopsModuleConfig, $mc, $tpl, $img, $xoopsOption, $xoopsConfig;
    if (!$xoopsUser) {
        redirect_header(XOOPS_URL . '/user.php#register', 1, __('You must be a registered user in order to send postcards!', 'galleries'));
        die;
    }
    $image = new GSImage($img);
    if ($image->isNew()) {
        redirect_header(GSFunctions::get_url(), 1, __('Specified image does not exists!', 'galleries'));
        die;
    }
    $xoopsOption['template_main'] = "gs_postcard_form.html";
    include 'header.php';
    //Eliminamos las postales que han cumplido si tiempo
    GSFunctions::deletePostcard();
    GSFunctions::makeHeader();
    $tpl->assign('xoops_pagetitle', sprintf(__('Send Postcard', 'galleries'), $image->title()));
    $postlink = GSFunctions::get_url() . ($mc['urlmode'] ? 'postcard/new/img/' . $image->id() . '/' : '?postcard=new&amp;img=' . $image->id());
    $sendlink = str_replace('/new/', '/send/', $postlink);
    $form = new RMForm(__('Send Postcard', 'galleries'), 'frmNewPostcard', $sendlink);
    $form->addElement(new RMFormText(__('Your name', 'galleries'), 'fname', 50, 100, $xoopsUser->getVar('name')), true);
    $form->addElement(new RMFormText(__('Your email', 'galleries'), 'fmail', 50, 150, $xoopsUser->getVar('email')), true, 'email');
    $form->addElement(new RMFormText(__('Friend name', 'galleries'), 'tname', 50, 100, ''), true);
    $form->addElement(new RMFormText(__('Friend email', 'galleries'), 'tmail', 50, 150, ''), true, 'email');
    $form->addElement(new RMFormText(__('Postcard title', 'galleries'), 'title', 50, 150, $image->title(false)), true);
    $form->addElement(new RMFormTextArea(__('Postcard text', 'galleries'), 'msg', 0, 0, '', '90%', '150px'), true);
    $cap = RMEvents::get()->run_event('rmcommon.recaptcha.field');
    if ($cap != '') {
        $form->addElement(new RMFormLabel(__('Please enter the captcha below', 'galleries'), $cap));
    }
    $ele = new RMFormButtonGroup();
    $ele->addButton('sbt', _SUBMIT, 'submit', 'onclick="$(\'op\').value=\'send\';"');
    $previewlink = str_replace('/new/', '/preview/', $postlink);
    $ele->addButton('preview', __('Preview Postcard', 'galleries'), 'button', 'onclick="$(\'#frmNewPostcard\').attr(\'action\', \'' . $previewlink . '\'); $(\'#frmNewPostcard\').submit();"');
    $form->addElement($ele);
    $form->addElement(new RMFormHidden('op', 'send'));
    $form->addElement(new RMFormHidden('img', $image->id()));
    $form->addElement(new RMFormHidden('uid', $xoopsUser->uid()));
    $form->addElement(new RMFormHidden('return', base64_encode($postlink)));
    $tpl->assign('postcard_form', $form->render());
    include 'footer.php';
}
예제 #4
0
/**
* @desc Mostramos el contenido de un Álbum
*/
function showSetContent()
{
    global $usr, $db, $xoopsModule, $mc, $xoopsModuleConfig, $xoopsConfig, $xoopsUser, $xoopsOption, $tpl, $page;
    global $pag, $set;
    $mc =& $xoopsModuleConfig;
    $user = new GSUser($usr);
    if ($user->isNew()) {
        redirect_header(GSFunctions::get_url(), 0, __('Specified users does not exists!', 'galleries'));
        die;
    }
    $set = new GSSet($set);
    if ($set->isNew()) {
        redirect_header(GSFunctions::get_url(), 0, __('Specified album does not exists!', 'galleries'));
        die;
    }
    //Verificamos la privacidad del album
    if (!$set->ispublic()) {
        if (!$xoopsUser || $xoopsUser->uid() != $set->owner()) {
            redirect_header(GSFunctions::get_url(), 1, __('You can not view this private album!', 'galleries'));
            die;
        }
    } else {
        if (!$xoopsUser && $set->isPublic() == 1 && !$user->isFriend($xoopsUser->uid())) {
            redirect_header(GSFunctions::get_url(), 1, sprintf(__('You must be a friend of %s in order to see this album!', 'galleries'), $user->uname()));
            die;
        }
    }
    //Incrementamos el número de hits del album
    if (!isset($_SESSION['vsets'])) {
        $set->addHit();
        $_SESSION['vsets'] = array($set->id());
    } elseif (!in_array($set->id(), $_SESSION['vsets'])) {
        $set->addHit();
        $_SESSION['vsets'][] = $set->id();
    }
    $xoopsOption['template_main'] = $mc['set_format_mode'] ? 'gs_setpics.html' : 'gs_userpics.html';
    $xoopsOption['module_subpage'] = 'userset';
    include 'header.php';
    GSFunctions::makeHeader();
    // Información del Usuario
    $tpl->assign('lang_picsof', sprintf(__('Pictures in %s'), $set->title()));
    $tpl->assign('user', array('id' => $user->uid(), 'uname' => $user->uname(), 'avatar' => RMEvents::get()->run_event('rmcommon.get.avatar', $user->userVar('email'), 0, $user->userVar('user_avatar')), 'link' => $user->userURL()));
    $tpl->assign('set', array('title' => $set->title(), 'description' => $set->getVar('description', 's')));
    // Lenguaje
    $tpl->assign('lang_bmark', __('Favorites', 'galleries'));
    $tpl->assign('lang_pics', __('Pictures', 'galleries'));
    $tpl->assign('sets_link', GSFunctions::get_url() . ($mc['urlmode'] ? "explore/sets/usr/" . $user->uname() . '/' : "?explore=sets&amp;usr="******"explore/tags/usr/" . $user->uname() . '/' : "?explore=tags&amp;usr="******"cp/bookmarks/" : "?cp=bookmarks"));
    $tpl->assign('xoops_pagetitle', sprintf(__('Pictures in %s'), $set->title()) . ' &raquo; ' . $mc['section_title']);
    $tpl->assign('lang_numpics', sprintf(__('Pictures: %s', 'galleries'), $set->pics()));
    $tpl->assign('lang_numviews', sprintf(__('Hits: %s'), $set->hits()));
    global $xoTheme;
    if ($set->getVar('description') != '') {
        $xoTheme->addMeta('meta', 'description', TextCleaner::clean_disabled_tags($set->getVar('description')));
    }
    //Verificamos la privacidad de las imágenes
    if ($xoopsUser && $xoopsUser->uid() == $user->uid()) {
        $public = '';
    } else {
        if ($xoopsUser && $user->isFriend($xoopsUser->uid())) {
            $public = " AND public<>0";
        } else {
            $public = "AND public='2'";
        }
    }
    $tbl1 = $db->prefix("gs_images");
    $tbl2 = $db->prefix("gs_setsimages");
    $sql = "SELECT COUNT(*) FROM {$tbl1} a, {$tbl2} b WHERE b.id_set='" . $set->id() . "' AND a.id_image=b.id_image {$public} AND owner='" . $user->uid() . "'";
    $page = $page > 0 ? $page : 1;
    /**
     * @desc Formato para el manejo de las imágenes
     */
    if ($mc['set_format_mode']) {
        $format = $mc['set_format_values'];
        $crop = $format[0];
        // 0 = Redimensionar, 1 = Cortar
        $width = $format[1];
        $height = $format[2];
        $limit = $format[3];
        $cols = $format[4];
        @($showdesc = $format[5]);
        // Imágenes Grandes
        $format = $mc['setbig_format_values'];
        $bcrop = $format[0];
        $bwidth = $format[1];
        $bheight = $format[2];
        $blimit = $format[3];
        $bcols = $format[4];
        @($bshowdesc = $format[5]);
        // Medidas
        $tpl->assign('big_width', $bwidth + 15);
    } else {
        $limit = $mc['limit_pics'];
        $cols = $mc['cols_pics'];
        $showdesc = 0;
    }
    list($num) = $db->fetchRow($db->query($sql));
    if ($page > 0) {
        $page -= 1;
    }
    $start = $page * $limit;
    $tpages = (int) ($num / $limit);
    if ($num % $limit > 0) {
        $tpages++;
    }
    $pactual = $page + 1;
    if ($pactual > $tpages) {
        $pactual = $tpages;
        $start = ($tpages - 1) * $limit;
    }
    $urlnav = '';
    if ($tpages > 1) {
        $urlnav .= $mc['urlmode'] ? 'usr/' . $user->uname() . '/set/' . $set->id() : '?usr='******'&amp;set=' . $set->id();
        $nav = new RMPageNav($num, $limit, $pactual, 5);
        $nav->target_url(GSFunctions::get_url() . $urlnav . ($mc['urlmode'] ? '/pag/{PAGE_NUM}/' : '&amp;pag={PAGE_NUM}'));
        $tpl->assign('upNavPage', $nav->render(false));
    }
    $showmax = $start + $limit;
    $showmax = $showmax > $num ? $num : $showmax;
    $tpl->assign('lang_showing', sprintf(__('Showing pictures %u to %u out of %u.', 'galleries'), $start + 1, $showmax, $num));
    $tpl->assign('limit', $limit);
    $tpl->assign('pag', $pactual);
    //Fin de barra de navegación
    $sql = str_replace("COUNT(*)", '*', $sql);
    $sql .= " ORDER BY a.id_image ASC, a.modified DESC LIMIT {$start}, {$limit}";
    $result = $db->query($sql);
    while ($row = $db->fetchArray($result)) {
        $img = new GSImage();
        $img->assignVars($row);
        $imglink = $user->userURL() . ($mc['urlmode'] ? 'img/' . $img->id() . '/set/' . $set->id() . '/' : '&amp;img=' . $img->id() . '&amp;set=' . $set->id());
        $imgfile = $user->filesURL() . '/' . ($mc['set_format_mode'] ? 'formats/set_' : 'ths/') . $img->image();
        // Conversion de los formatos
        if (!$img->setFormat() && $mc['set_format_mode']) {
            GSFunctions::resizeImage($crop, $user->filesPath() . '/' . $img->image(), $user->filesPath() . '/formats/set_' . $img->image(), $width, $height);
            $img->setSetFormat(1, 1);
        }
        $tpl->append('images', array('id' => $img->id(), 'title' => $img->title(), 'thumbnail' => $imgfile, 'link' => $imglink, 'bigimage' => $user->filesURL() . '/' . $img->image()));
    }
    // Imagen grande del album
    $sql = "SELECT * FROM {$tbl1} a, {$tbl2} b WHERE b.id_set='" . $set->id() . "' AND a.id_image=b.id_image {$public} AND owner='" . $user->uid() . "' \n\t\t\tORDER BY a.id_image DESC LIMIT 0,{$blimit}";
    $result = $db->query($sql);
    $bi = 0;
    $tf = new RMTimeFormatter(0, __('%m%/%d%/%Y% %h%:%i%', 'galleries'));
    // cremos la imagen grande para los albumes
    while ($row = $db->fetchArray($result)) {
        $img = new GSImage();
        $img->assignVars($row);
        if ($mc['set_format_mode'] && !$img->bigSetFormat()) {
            GSFunctions::resizeImage($bcrop, $user->filesPath() . '/' . $img->image(), $user->filesPath() . '/formats/bigset_' . $img->image(), $bwidth, $bheight);
            $img->setBigSetFormat(1, 1);
        }
        if ($mc['set_format_mode']) {
            list($ancho, $altura, $tipo, $atr) = getimagesize($user->filesPath() . '/formats/bigset_' . $img->image());
            $tpl->assign('big_width', $ancho);
        }
        $imglink = $user->userURL() . 'img/' . $img->id() . '/set/' . $set->id() . '/';
        // ASignamos las imagenes grandes para los albumes
        $imgfile = $user->filesURL() . '/' . ($mc['set_format_mode'] ? 'formats/bigset_' : 'ths/') . $img->image();
        if ($bi == 0) {
            $tpl->assign('lang_updated', sprintf(__('Updated on %s', 'galleries'), $tf->format($img->created())));
        }
        $tpl->append('bigs', array('id' => $img->id(), 'title' => $img->title(), 'image' => $imgfile, 'link' => $imglink));
    }
    RMFunctions::get_comments('galleries', 'set=' . $set->id());
    // Comments form
    RMFunctions::comments_form('galleries', 'set=' . $set->id(), 'module', GS_PATH . '/class/galleriescontroller.php');
    // Datos para el formato
    $tpl->assign('max_cols', $cols);
    include 'footer.php';
}
예제 #5
0
/**
* @desc Visualiza todas la imágenes de favoritos
**/
function showBookMarks()
{
    global $xoopsOption, $tpl, $db, $xoopsUser, $xoopsModuleConfig, $pag, $xoopsConfig;
    $xoopsOption['template_main'] = 'gs_panel_bookmarks.html';
    include 'header.php';
    $mc =& $xoopsModuleConfig;
    GSFunctions::makeHeader();
    //Barra de Navegación
    $sql = "SELECT COUNT(*) FROM " . $db->prefix('gs_favourites') . " a INNER JOIN " . $db->prefix('gs_images') . " b ON (";
    $sql .= " a.id_image=b.id_image AND a.uid='" . $xoopsUser->uid() . "')";
    $page = isset($pag) ? $pag : '';
    $limit = 10;
    list($num) = $db->fetchRow($db->query($sql));
    if ($page > 0) {
        $page -= 1;
    }
    $start = $page * $limit;
    $tpages = (int) ($num / $limit);
    if ($num % $limit > 0) {
        $tpages++;
    }
    $pactual = $page + 1;
    if ($pactual > $tpages) {
        $rest = $pactual - $tpages;
        $pactual = $pactual - $rest + 1;
        $start = ($pactual - 1) * $limit;
    }
    if ($tpages > 1) {
        if ($mc['urlmode']) {
            $urlnav = 'cpanel/bookmarks/';
        } else {
            $urlnav = '?cpanel=bookmarks';
        }
        $nav = new RMPageNav($num, $limit, $pactual, 5);
        $nav->target_url(GSFunctions::get_url() . $urlnav . ($mc['urlmode'] ? 'pag/{PAGE_NUM}/' : '&amp;pag={PAGE_NUM}'));
        $tpl->assign('bookmarksNavPage', $nav->render(false));
    }
    $showmax = $start + $limit;
    $showmax = $showmax > $num ? $num : $showmax;
    if ($num > 0) {
        $tpl->assign('lang_showing', sprintf(__('Showing pictures %u to %u from %u'), $start + 1, $showmax, $num));
    }
    $tpl->assign('limit', $limit);
    $tpl->assign('pag', $pactual);
    //Fin de barra de navegación
    $sql = "SELECT * FROM " . $db->prefix('gs_favourites') . " a INNER JOIN " . $db->prefix('gs_images') . " b ON (";
    $sql .= " a.id_image=b.id_image AND a.uid='" . $xoopsUser->uid() . "')";
    $sql .= " LIMIT {$start},{$limit}";
    $result = $db->query($sql);
    $users = array();
    while ($rows = $db->fetchArray($result)) {
        $img = new GSImage();
        $img->assignVars($rows);
        if (!isset($users[$img->owner()])) {
            $users[$img->owner()] = new GSUser($img->owner(), 1);
        }
        $urlimg = $users[$img->owner()]->filesURL() . '/ths/' . $img->image();
        $link = $users[$img->owner()]->userURL() . 'img/' . $img->id() . '/';
        $tpl->append('images', array('id' => $img->id(), 'title' => $img->title(false), 'desc' => $img->desc(), 'public' => $img->isPublic(), 'image' => $urlimg, 'created' => formatTimeStamp($img->created(), 's'), 'owner' => $img->owner(), 'uname' => $users[$img->owner()]->uname(), 'link' => $link));
    }
    $tpl->assign('lang_exist', __('Existing Bookmarks', 'galleries'));
    $tpl->assign('lang_id', __('ID', 'galleries'));
    $tpl->assign('lang_title', __('Title', 'galleries'));
    $tpl->assign('lang_date', __('Created', 'galleries'));
    $tpl->assign('lang_owner', __('by user', 'galleries'));
    $tpl->assign('lang_image', __('Picture', 'galleries'));
    $tpl->assign('lang_public', __('Public', 'galleries'));
    $tpl->assign('lang_options', __('Options', 'galleries'));
    $tpl->assign('lang_edit', __('Edit', 'galleries'));
    $tpl->assign('lang_del', __('Delete', 'galleries'));
    $tpl->assign('lang_confirm', __('Do you really wish to deleted selected favorite?', 'galleries'));
    $tpl->assign('lang_confirms', __('Do you really wish to deleted selected favorites?', 'galleries'));
    $tpl->assign('delete_link', GSFunctions::get_url() . $xoopsModuleConfig['urlmode'] ? 'cp/delbookmarks/' : '?cp=delbookmarks');
    RMTemplate::get()->add_style('panel.css', 'galleries');
    createLinks();
    include 'footer.php';
}
예제 #6
0
<?php

// $Id: index.php 684 2011-07-27 08:40:00Z i.bitcero $
// --------------------------------------------------------------
// MyGalleries
// Module for advanced image galleries management
// Author: Eduardo Cortés <*****@*****.**>
// Email: i.bitcero@gmail.com
// License: GPL 2.0
// --------------------------------------------------------------
define('GS_LOCATION', 'index');
$xoopsOption['template_main'] = 'gs_index.html';
$xoopsOption['module_subpage'] = 'index';
include 'header.php';
GSFunctions::makeHeader();
$tpl->assign('lang_lastphotos', __('Recent Photos', 'galleries'));
$tpl->assign('last_sets', __('Recent Albums', 'galleries'));
$tpl->assign('lang_created', __('Created on:', 'galleries'));
$tpl->assign('lang_by', __('Created by:', 'galleries'));
$tpl->assign('lang_pics', __('Photos:', 'galleries'));
$tpl->assign('lang_other', __('Other Albums', 'galleries'));
$tpl->assign('lang_view', __('View Photos', 'galleries'));
$tpl->assign('lang_moresets', __('More albums', 'galleries'));
$tpl->assign('explore_sets_link', GSFunctions::get_url() . ($mc['urlmode'] ? 'explore/sets/' : '?explore=sets'));
$tpl->assign('lang_setbrowse', __('Browse albums', 'galleries'));
$tpl->assign('explore_imgs_link', GSFunctions::get_url() . ($mc['urlmode'] ? 'explore/photos/' : '?explore=photos'));
$tpl->assign('lang_imgbrowse', __('Browse photos', 'galleries'));
$tpl->assign('explore_tags_link', GSFunctions::get_url() . ($mc['urlmode'] ? 'explore/tags/' : '?explore=tags'));
$tpl->assign('lang_tagbrowse', __('Browse tags', 'galleries'));
// ültimas Fotos
$mc['last_num'] = $mc['last_num'] <= 0 ? 10 : $mc['last_num'];
예제 #7
0
/**
* @desc Visualiza todos los albumes existentes del usuario
**/
function showSets($edit = 0)
{
    global $xoopsOption, $tpl, $db, $xoopsUser, $xoopsModuleConfig, $page, $xoopsConfig, $id;
    $xoopsOption['template_main'] = 'gs_panel_sets.html';
    include 'header.php';
    $mc =& $xoopsModuleConfig;
    $limit = rmc_server_var($_REQUEST, 'limit', 15);
    GSFunctions::makeHeader();
    $link = GSFunctions::get_url() . ($mc['urlmode'] ? '/cpanel/sets/pag/' . $page : '/cpanel.php?s=cpanel/sets/' . $page);
    if ($edit) {
        //Verificamos que el album sea válido
        if ($id <= 0) {
            redirect_header($link, 1, __('Album ID is not valid!', 'galleries'));
            die;
        }
        //Verificamos que el album exista
        $set = new GSSet($id);
        if ($set->isNew()) {
            redirect_header($link, 1, __('Specified album does not exists!', 'galleries'));
            die;
        }
        $tpl->assign('title', $set->title());
        $tpl->assign('public', $set->isPublic());
        $tpl->assign('edit', $edit);
        $tpl->assign('id', $id);
        $tpl->assign('action_editset', GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/saveeditset/pag/' . $page . '/' : '?cp=saveeditset&amp;pag=' . $page));
    }
    //Barra de Navegación
    $sql = "SELECT COUNT(*) FROM " . $db->prefix('gs_sets') . " WHERE owner='" . $xoopsUser->uid() . "'";
    list($num) = $db->fetchRow($db->query($sql));
    $page = $page <= 0 ? 1 : $page;
    list($num) = $db->fetchRow($db->query($sql));
    $start = $num <= 0 ? 0 : ($page - 1) * $limit;
    $tpages = ceil($num / $limit);
    $nav = new RMPageNav($num, $limit, $page, 5);
    $nav->target_url(GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/sets/pag/{PAGE_NUM}/' : '?cp=sets&amp;pag={PAGE_NUM}'));
    //Fin de barra de navegación
    $sql = "SELECT * FROM " . $db->prefix('gs_sets') . " WHERE owner='" . $xoopsUser->uid() . "'";
    $sql .= " LIMIT {$start},{$limit}";
    $result = $db->query($sql);
    while ($rows = $db->fetchArray($result)) {
        $set = new GSSet();
        $set->assignVars($rows);
        $tpl->append('sets', array('id' => $set->id(), 'name' => $set->title(), 'owner' => $set->owner(), 'uname' => $set->uname(), 'public' => $set->isPublic(), 'date' => formatTimeStamp($set->date(), 's'), 'pics' => $set->pics(), 'link' => $set->url()));
    }
    $tpl->assign('lang_setexists', __('My Albums', 'galleries'));
    $tpl->assign('lang_id', __('ID', 'galleries'));
    $tpl->assign('lang_name', __('Name', 'galleries'));
    $tpl->assign('lang_date', __('Date', 'galleries'));
    $tpl->assign('lang_public', __('Privacy:', 'galleries'));
    $tpl->assign('lang_options', _OPTIONS);
    $tpl->assign('lang_edit', _EDIT);
    $tpl->assign('lang_del', _DELETE);
    $tpl->assign('lang_confirm', __('Do you really wish to delete specified album?', 'galleries'));
    $tpl->assign('lang_confirms', __('Do you really wish to delete selected albums?', 'galleries'));
    $tpl->assign('lang_newset', __('Add Album', 'galleries'));
    $tpl->assign('lang_editset', __('Edit Album', 'galleries'));
    $tpl->assign('lang_yes', __('Yes', 'galleries'));
    $tpl->assign('lang_no', __('No', 'galleries'));
    $tpl->assign('lang_pics', __('Pictures', 'galleries'));
    $tpl->assign('lang_privateme', __('Private', 'galleries'));
    $tpl->assign('lang_privatef', __('Friends', 'galleries'));
    $tpl->assign('lang_publicset', __('Public', 'galleries'));
    RMTemplate::get()->add_style('panel.css', 'galleries');
    $tpl->assign('action_addset', GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/saveset/pag/' . $page . '/' : '?cp=saveset'));
    $tpl->assign('pag', $page);
    $tpl->assign('action_delset', GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/deleteset/pag/' . $page . '/' : '?cp=deleteset'));
    $tpl->assign('edit_link', GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/editset/pag/' . $page . '/id/' : '?cp=editset&amp;pag=' . $page . '&amp;id='));
    createLinks();
    include 'footer.php';
}
예제 #8
0
/**
* @desc Visualiza todas las imágenes de la etiqueta especificada
**/
function imgsTag()
{
    global $tpl, $xoopsOption, $xoopsUser, $xoopsConfig, $xoopsModuleConfig, $db, $page, $tag, $usr, $hits;
    $xoopsOption['template_main'] = 'gs_imagestag.html';
    $xoopsOption['module_subpage'] = 'exploretags';
    include 'header.php';
    $mc =& $xoopsModuleConfig;
    GSFunctions::makeHeader();
    //Verificamos si la etiqueta existe
    $tag = new GSTag($tag);
    if ($tag->isNew()) {
        redirect_header(GSFunctions::get_url(), 1, __('Specified tag does not exists!', 'galleries'));
        die;
    }
    //Incrementamos el número de hits de la etiqueta
    if (!isset($_SESSION['vtags'])) {
        $tag->addHit();
        $_SESSION['vtags'] = array($tag->id());
    } elseif (!in_array($tag->id(), $_SESSION['vtags'])) {
        $tag->addHit();
        $_SESSION['vtags'][] = $tag->id();
    }
    //Verificamos si el usuario existe
    if (isset($usr)) {
        $user = new GSUser($usr);
        if ($user->isNew()) {
            redirect_header(GSFunctions::get_url(), 1, __('Specified user does not exists!', 'galleries'));
            die;
        }
        $users[$user->uid()] = $user;
    }
    //Barra de Navegación
    $sql = "SELECT COUNT(*) FROM " . $db->prefix('gs_tagsimages') . " a INNER JOIN " . $db->prefix('gs_images');
    $sql .= " b ON (a.id_tag=" . $tag->id() . " AND a.id_image=b.id_image  AND b.public=2";
    $sql .= $usr ? " AND b.owner=" . $user->uid() . ") " : ")";
    $limit = $xoopsModuleConfig['num_imgstags'];
    list($num) = $db->fetchRow($db->query($sql));
    if ($page > 0) {
        $page -= 1;
    }
    $start = $page * $limit;
    $tpages = (int) ($num / $limit);
    if ($num % $limit > 0) {
        $tpages++;
    }
    $pactual = $page + 1;
    if ($pactual > $tpages) {
        $rest = $pactual - $tpages;
        $pactual = $pactual - $rest + 1;
        $start = ($pactual - 1) * $limit;
    }
    if ($tpages > 1) {
        if ($mc['urlmode']) {
            $urlnav = 'explore/tags/tag/' . $tag->getVar('nameid') . '/';
            $urlnav .= $usr ? 'usr/' . $user->uname() . '/' : '';
        } else {
            $urlnav = '?xplore=tags&amp;tag=' . $tag->getVar('nameid');
            $urlnav .= $usr ? '&amp;usr='******'';
        }
        $nav = new RMPageNav($num, $limit, $pactual, 5);
        $nav->target_url(GSFunctions::get_url() . $urlnav . ($mc['urlmode'] ? 'pag/{PAGE_NUM}/' : '&amp;pag={PAGE_NUM}'));
        $tpl->assign('tagsNavPage', $nav->render(false));
    }
    $showmax = $start + $limit;
    $showmax = $showmax > $num ? $num : $showmax;
    $tpl->assign('lang_showing', sprintf(__('Showing photos %u to %u from %u.', 'galleries'), $start + 1, $showmax, $num));
    $tpl->assign('limit', $limit);
    $tpl->assign('pag', $pactual);
    //Fin de barra de navegación
    //Obtenemos las imágenes pertenecientes a la etiqueta
    $sql = "SELECT b.* FROM " . $db->prefix('gs_tagsimages') . " a INNER JOIN " . $db->prefix('gs_images');
    $sql .= " b ON (a.id_tag=" . $tag->id() . " AND a.id_image=b.id_image  AND b.public=2";
    $sql .= $usr ? " AND b.owner=" . $user->uid() . ") " : ")";
    $sql .= " GROUP BY b.id_image";
    $sql .= " ORDER BY `created` DESC LIMIT {$start}, {$limit}";
    $result = $db->query($sql);
    $tpl->assign('images', GSFunctions::process_image_data($result));
    $tpl->assign('lang_picstag', $usr ? sprintf(__('%s: tagged as %s', 'galleries'), $user->uname(), $tag->tag()) : sprintf(__('Images tagged as "%s"', 'galleries'), $tag->tag()));
    $tpl->assign('tagname', $tag->tag());
    $tpl->assign('usr', $usr);
    if ($usr) {
        $tpl->assign('pics_link', GS_URL . '/' . ($mc['urlmode'] ? "usr/" . $user->uname() : "user.php?id=usr/" . $user->uname() . "/"));
        $tpl->assign('tags_link', GS_URL . '/' . ($mc['urlmode'] ? "explore/tags/usr/" . $user->uname() . "/" : "explore.php?by=explore/tags/usr/" . $user->uname() . "/"));
        $tpl->assign('sets_link', GS_URL . '/' . ($mc['urlmode'] ? "explore/sets/usr/" . $user->uname() . "/" : "explore.php?by=explore/sets/usr/" . $user->uname() . "/"));
        $tpl->assign('bmark_link', GS_URL . '/' . ($mc['urlmode'] ? "cpanel/booksmarks/" : "cpanel.php?s=cpanel/bookmarks"));
    }
    include 'footer.php';
}
예제 #9
0
/**
* @desc Formulario de albumes
**/
function formSets()
{
    global $xoopsUser, $db, $xoopsConfig, $xoopsOption, $xoopsModuleConfig, $tpl, $ids, $referer;
    $page = rmc_server_var($_REQUEST, 'pag', 1);
    if (!$referer) {
        $referer = GSFunctions::get_url() . ($xoopsModuleConfig['urlmode'] ? 'cp/images/pag/' . $page . '/' : '?cp=images&amp;pag=' . $page);
    } else {
        $referer = base64_decode($referer);
    }
    $ids = empty($ids) ? rmc_server_var($_REQUEST, 'ids', 0) : $ids;
    $xoopsOption['template_main'] = 'gs_formaddsets.html';
    include 'header.php';
    GSFunctions::makeHeader();
    //Verificamos si nos proporcionaron al menos un imagen para actualizar
    if (!is_array($ids) && $ids <= 0) {
        redirect_header('./cpanel.php', 2, __('You must select one image at least!', 'galleries'));
        die;
    }
    if (!is_array($ids)) {
        $ids = array($ids);
    }
    $form = new RMForm(__('Add images to an album', 'galleries'), 'frmset', 'cpanel.php');
    //Obtenemos los albumes del usuario
    $ele = new RMFormCheck(__('Albums', 'galleries'));
    $ele->setDescription(__('Select the albums where you want to assign the selected images.', 'galleries'));
    $sql = "SELECT * FROM " . $db->prefix('gs_sets') . " WHERE owner='" . $xoopsUser->uid() . "'";
    $result = $db->query($sql);
    while ($rows = $db->fetchArray($result)) {
        $ele->addOption($rows['title'], 'albums[]', $rows['id_set']);
    }
    $form->addElement($ele, true);
    $form->addElement(new RMFormHidden('op', 'savesets'));
    foreach ($ids as $k => $v) {
        $form->addElement(new RMFormHidden('ids[' . $k . ']', $v));
    }
    $form->addElement(new RMFormHidden('page', $page));
    $form->addElement(new RMFormHidden('referer', $referer));
    $buttons = new RMFormButtonGroup();
    $buttons->addButton('sbt', _SUBMIT, 'submit');
    $buttons->addButton('cancel', _CANCEL, 'button', 'onclick="window.location=\'' . $referer . '\'"');
    $form->addElement($buttons);
    $tpl->assign('form_sets', $form->render());
    include 'footer.php';
}