function send_pictures() { global $xoopsLogger; $xoopsLogger->renderingEnabled = false; error_reporting(0); $xoopsLogger->activated = false; $db = Database::getInstance(); $limit = rmc_server_var($_GET, 'limit', 5); // recent pictures $sql = "SELECT * FROM " . $db->prefix("gs_images") . " ORDER BY `created` DESC LIMIT 0,{$limit}"; $result = $db->query($sql); $recents = GSFunctions::process_image_data($result); ob_start(); ?> <?php foreach ($recents as $pic) { ?> <a href="<?php echo $pic['link']; ?> " target="_blank" title="<?php echo $pic['title']; ?> "><img src="<?php echo $pic['thumbnail']; ?> " alt="<?php echo $pic['title']; ?> " /></a> <?php } ?> <?php $recents = ob_get_clean(); echo $recents; die; }
function showUserPics() { global $usr, $db, $xoopsModule, $mc, $xoopsModuleConfig, $xoopsConfig, $xoopsUser, $xoopsOption, $tpl; global $page, $set; $user = new GSUser($usr); if ($user->isNew()) { redirect_header(XOOPS_URL . '/modules/galleries', 0, __('Specified user does not exists', 'galleries')); die; } $xoopsOption['template_main'] = 'gs_userpics.html'; $xoopsOption['module_subpage'] = 'userpics'; include 'header.php'; GSFunctions::makeHeader(); // Información del Usuario $tpl->assign('lang_picsof', sprintf(__('Pictures of %s'), $user->uname())); $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())); // Lenguaje $tpl->assign('lang_bmark', __('Favorites', 'galleries')); $tpl->assign('lang_pics', __('Pictures', 'galleries')); $tpl->assign('sets_link', GSFunctions::get_url() . ($xoopsModuleConfig['urlmode'] ? "explore/sets/usr/" . $user->uname() . '/' : "?explore=sets&usr="******"explore/tags/usr/" . $user->uname() . '/' : "?explore=tags&usr="******"cp/booksmarks/" : "?cpanel=bookmarks")); $tpl->assign('xoops_pagetitle', sprintf(__('Pictures of %s', 'galleries'), $user->uname()) . ' » ' . $mc['section_title']); //Verificamos si el usuario es dueño o amigo if ($xoopsUser && $xoopsUser->uid() == $user->uid()) { $public = ''; } else { if ($xoopsUser && $user->isFriend($xoopsUser->uid())) { $public = " AND public<>'0'"; } else { $public = " AND public='2'"; } } $sql = "SELECT COUNT(*) FROM " . $db->prefix("gs_images") . " WHERE owner='" . $user->uid() . "' {$public}"; /** * @desc Formato para el manejo de las imágenes */ if ($mc['user_format_mode']) { $format = $mc['user_format_values']; $crop = $format[0]; // 0 = Redimensionar, 1 = Cortar $width = $format[1]; $height = $format[2]; $limit = $format[3]; $cols = $format[4]; $showdesc = $format[5]; } 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 ? ($tpages - 1) * $limit : -1; } $urlnav = ''; if ($tpages > 1) { $urlnav .= $mc['urlmode'] ? 'usr/' . $user->uname() . '/' : '?usr='******'urlmode'] ? 'pag/{PAGE_NUM}/' : '&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 from %u', 'galleries'), $start + 1, $showmax, $num)); $tpl->assign('limit', $limit); $tpl->assign('pag', $pactual); $tpl->assign('show_desc', $showdesc); //Fin de barra de navegación $sql = str_replace("COUNT(*)", '*', $sql); $sql .= " ORDER BY created DESC, modified DESC LIMIT {$start}, {$limit}"; $result = $db->query($sql); $tpl->assign('images', GSFunctions::process_image_data($result)); // Datos para el formato $tpl->assign('gs_user_format', 1); include 'footer.php'; }
$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']; $result = $db->query("SELECT * FROM " . $db->prefix("gs_images") . " WHERE public=2 ORDER BY created DESC LIMIT 0,{$mc['last_num']}"); $tpl->assign('last_images', GSFunctions::process_image_data($result)); // Álbumes Recientes $result = $db->query("SELECT * FROM " . $db->prefix("gs_sets") . " WHERE public='2' ORDER BY date DESC LIMIT 0," . ($mc['sets_num'] > 0 ? $mc['sets_num'] : 5)); while ($row = $db->fetchArray($result)) { $set = new GSSet(); $set->assignVars($row); $pics = $set->getPics('RAND()'); $imgs = @array_slice($pics, 0, $xoopsModuleConfig['sets_num_images']); if (!isset($users[$set->owner()])) { $users[$set->owner()] = new GSUser($set->owner(), 1); } $images = array(); if (!empty($imgs)) { // Obtenemos las primeras 4 imágenes foreach ($imgs as $k) { $img = new GSImage($k);
/** * @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&tag=' . $tag->getVar('nameid'); $urlnav .= $usr ? '&usr='******''; } $nav = new RMPageNav($num, $limit, $pactual, 5); $nav->target_url(GSFunctions::get_url() . $urlnav . ($mc['urlmode'] ? 'pag/{PAGE_NUM}/' : '&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'; }
/** * @desc Visualiza todas las imágenes pertenecientes del usuario **/ function showImages() { global $xoopsOption, $tpl, $db, $xoopsUser, $xoopsModuleConfig, $set, $xoopsConfig, $cp; $mc =& $xoopsModuleConfig; $xoopsOption['template_main'] = 'gs_panel.html'; include 'header.php'; GSFunctions::makeHeader(); if ($set) { //Verificamos si el album es válido if ($set <= 0) { redirect_header(GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/sets/' : '?cp=sets'), 1, __('Specified album is not valid!', 'galleries')); die; } //Verificamos que el album exista $album = new GSSet($set); if ($album->isNew()) { redirect_header(GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/sets/' : '?cp=sets'), 1, __('Specified album does not exists!', 'galleries')); die; } } //Barra de Navegación $sql = "SELECT COUNT(*) FROM " . $db->prefix('gs_images') . " a "; $sql .= $set ? " INNER JOIN " . $db->prefix('gs_setsimages') . " b ON (a.id_image=b.id_image AND b.id_set='" . $set . "' AND a.owner='" . $xoopsUser->uid() . "') " : " WHERE a.owner=" . $xoopsUser->uid(); global $page; $page = $page <= 0 ? 1 : $page; $limit = isset($_REQUEST['limit']) ? intval($_REQUEST['limit']) : 10; $limit = $limit <= 0 ? 10 : $limit; $user = new GSUser($xoopsUser->uid(), 1); 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) { $nav = new RMPageNav($num, $limit, $pactual, 5); $nav->target_url(GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/' . $cp . '/pag/{PAGE_NUM}/' : '?cp=' . $cp . '&pag={PAGE_NUM}')); $tpl->assign('picsNavPage', $nav->render(false)); } $showmax = $start + $limit; $showmax = $showmax > $num ? $num : $showmax; $tpl->assign('lang_showing', sprintf(__('Showing images %u to %u of %u'), $start + 1, $showmax, $num)); $tpl->assign('limit', $limit); $tpl->assign('pag', $pactual); //Fin de barra de navegación $sql = "SELECT a.* FROM " . $db->prefix('gs_images') . " a "; $sql .= $set ? " INNER JOIN " . $db->prefix('gs_setsimages') . " b ON (a.id_image=b.id_image AND b.id_set='" . $set . "' AND a.owner='" . $xoopsUser->uid() . "') GROUP BY a.id_image" : " WHERE a.owner=" . $xoopsUser->uid(); $sql .= " ORDER BY created DESC LIMIT {$start},{$limit}"; $result = $db->query($sql); $tpl->assign('images', GSFunctions::process_image_data($result)); $tpl->assign('lang_exists', $set ? sprintf(__('Existing images for user "%s" in album "%s"', 'galleries'), $xoopsUser->uname(), $album->title()) : sprintf(__('Existing images for user "%s"', 'galleries'), $xoopsUser->uname())); $tpl->assign('lang_id', __('ID', 'galleries')); $tpl->assign('lang_title', __('Title', 'galleries')); $tpl->assign('lang_image', __('Image', 'galleries')); $tpl->assign('lang_public', __('Public', 'galleries')); $tpl->assign('lang_created', __('Created', 'galleries')); $tpl->assign('lang_edit', __('Edit', 'galleries')); $tpl->assign('lang_del', __('Delete', 'galleries')); $tpl->assign('lang_options', __('Options', 'galleries')); $tpl->assign('lang_set', __('Add to Album...', 'galleries')); $tpl->assign('lang_confirm', __('Do you really wish to delete specified picture?', 'galleries')); $tpl->assign('lang_confirms', __('Do you really wish to deleted selected pictures?', 'galleries')); $tpl->assign('lang_save', __('Save Changes', 'galleries')); $tpl->assign('lang_changename', __('Change name', 'galleries')); $tpl->assign('lang_changedesc', __('Change description', 'galleries')); $tpl->assign('lang_adddesc', __('Add Description', 'galleries')); //Links de menu $tpl->assign('link_sets', GSFunctions::get_url() . ($mc['urlmode'] ? "cp/sets" : "?cp=sets")); $tpl->assign('edit_link', GSFunctions::get_url() . ($mc['urlmode'] ? "cp/edit/pag/{$pactual}/id/" : "?cp=edit&pag={$page}&id=")); $tpl->assign('delete_link', GSFunctions::get_url() . ($mc['urlmode'] ? "cp/delete/pag/{$pactual}/ids/" : "?cp=delete&pag={$page}&ids=")); RMTemplate::get()->add_local_script('panel.js', 'galleries'); RMTemplate::get()->add_local_script('jquery.checkboxes.js', 'rmcommon', 'include'); RMTemplate::get()->add_style('panel.css', 'galleries'); createLinks(); include 'footer.php'; }
} list($num) = $db->fetchRow($db->query($sql)); $limit = 15; $ptotal = ceil($num / $limit); $start = $page == 1 ? 0 : $page * $limit - $limit; $nav = new RMPageNav($num, $limit, $page); $nav->set_template(RMTemplate::get()->get_template("other/gs_navpage.php", 'module', 'galleries')); $sql = str_replace("COUNT(*)", "*", $sql); $sql .= " ORDER BY created DESC LIMIT {$start},{$limit}"; $result = $db->query($sql); include_once XOOPS_ROOT_PATH . '/modules/galleries/class/gsfunctions.class.php'; include_once XOOPS_ROOT_PATH . '/modules/galleries/class/gsset.class.php'; include_once XOOPS_ROOT_PATH . '/modules/galleries/class/gsuser.class.php'; include_once XOOPS_ROOT_PATH . '/modules/galleries/class/gsimage.class.php'; include_once XOOPS_ROOT_PATH . '/modules/galleries/class/gstag.class.php'; $images = GSFunctions::process_image_data($result); include RMTemplate::get()->get_template('other/gs_ajax_images.php', 'module', 'galleries'); die; } elseif ($action == 'load_structure') { include RMTemplate::get()->get_template('other/gs_for_editor.php', 'module', 'galleries'); die; } elseif ($action == 'load_included') { if (!$xoopsSecurity->checkReferer()) { die; } $set = rmc_server_var($_POST, 'set', 0); $page = rmc_server_var($_POST, 'page', 1); $limit = rmc_server_var($_POST, 'limit', 0); $full = true; if ($set <= 0 || $limit <= 0) { die;