/** * Función para realizar búsquedas */ function qpages_search($qa, $andor, $limit, $offset, $userid) { global $xoopsUser, $mc; include_once XOOPS_ROOT_PATH . '/modules/qpages/class/qppage.class.php'; $mc = RMUtilities::module_config('qpages'); $db = XoopsDatabaseFactory::getDatabaseConnection(); $sql = "SELECT * FROM " . $db->prefix("qpages_pages"); $adds = ''; if (is_array($qa) && ($count = count($qa))) { $adds = ''; for ($i = 0; $i < $count; $i++) { $adds .= $adds == '' ? "(titulo LIKE '%{$qa[$i]}%' OR titulo_amigo LIKE '%{$qa[$i]}%')" : " {$andor} (titulo LIKE '%{$qa[$i]}%' OR titulo_amigo LIKE '%{$qa[$i]}%')"; } } $sql .= $adds != '' ? " WHERE {$adds}" : ''; if ($userid > 0) { $sql .= ($adds != '' ? " AND " : " WHERE ") . "uid='{$userid}'"; } $sql .= " ORDER BY modificado DESC"; $i = 0; $result = $db->query($sql); $ret = array(); while ($row = $db->fetchArray($result)) { $page = new QPPage(); $page->assignVars($row); $ret[$i]['image'] = "images/page.png"; $ret[$i]['link'] = $mc['links'] == 0 ? 'page.php?page=' . $page->getFriendTitle() : $page->getFriendTitle() . '/'; $ret[$i]['title'] = $page->getTitle(); $ret[$i]['time'] = $page->getDate(); $ret[$i]['uid'] = $page->uid(); $ret[$i]['desc'] = $page->getDescription(); $i++; } return $ret; }
/** * Este archivo permite controlar el bloque o los bloques * Bloques Existentes: * * 1. Publicaciones Recientes * 2. Publicaciones Populares (Mas Leídas) * 3. Publicaciones Mejor Votadas */ function rd_block_resources($options) { global $xoopsModule; include_once XOOPS_ROOT_PATH . '/modules/docs/class/rdresource.class.php'; $db = XoopsDatabaseFactory::getDatabaseConnection(); $mc = RMUtilities::module_config('docs'); $sql = "SELECT * FROM " . $db->prefix("rd_resources") . ' WHERE public=1 AND approved=1'; switch ($options[0]) { case 'recents': $sql .= " ORDER BY created DESC"; break; case 'popular': $sql .= " ORDER BY `reads` DESC"; break; } $sql .= " LIMIT 0, " . ($options[1] > 0 ? $options[1] : 5); $result = $db->query($sql); $block = array(); while ($row = $db->fetchArray($result)) { $res = new RDResource(); $res->assignVars($row); $ret = array(); $ret['id'] = $res->id(); $ret['title'] = $res->getVar('title'); if ($options[2]) { $ret['desc'] = $options[3] == 0 ? $res->getVar('description') : TextCleaner::truncate($res->getVar('description'), $options[3]); } $ret['link'] = $res->permalink(); $ret['author'] = sprintf(__('Created by %s', 'docs'), '<strong>' . $res->getVar('owname') . '</strong>'); $ret['reads'] = sprintf(__('Viewed %s times', 'docs'), '<strong>' . $res->getVar('reads') . '</strong>'); $block['resources'][] = $ret; } RMTemplate::get()->add_style('blocks.css', 'docs'); return $block; }
function pw_categories_show($options) { global $xoopsModule, $xoopsModuleConfig; include_once XOOPS_ROOT_PATH . '/modules/works/class/pwwork.class.php'; include_once XOOPS_ROOT_PATH . '/modules/works/class/pwclient.class.php'; include_once XOOPS_ROOT_PATH . '/modules/works/class/pwcategory.class.php'; $db = XoopsDatabaseFactory::getDatabaseConnection(); if (isset($xoopsModule) && $xoopsModule->dirname() == 'works') { $mc =& $xoopsModuleConfig; } else { $mc =& RMUtilities::module_config('works'); } $db = XoopsDatabaseFactory::getDatabaseConnection(); $result = $db->query("SELECT * FROM " . $db->prefix("pw_categos") . " ORDER BY name"); $block = array(); while ($row = $db->fetchArray($result)) { $cat = new PWCategory(); $cat->assignVars($row); $ret = array(); $ret['name'] = $row['name']; $ret['link'] = $cat->link(); $block['categos'][] = $ret; } return $block; }
/** * @desc Realiza una búsqueda en el módulo desde EXM */ function pwSearch($queryarray, $andor, $limit, $offset, $userid) { global $myts; include_once XOOPS_ROOT_PATH . "/modules/works/class/pwwork.class.php"; $mc = RMUtilities::module_config('works'); $db = XoopsDatabaseFactory::getDatabaseConnection(); $sql = "SELECT a.* FROM " . $db->prefix('pw_works') . " a INNER JOIN " . $db->prefix('pw_clients') . " b ON (a.public=1 AND a.client=b.id_client AND ("; $sql1 = ''; if (is_array($queryarray)) { foreach ($queryarray as $k) { $sql1 .= ($sql1 == '' ? "" : "{$andor}") . " (a.title LIKE '%{$k}%' OR a.short LIKE '%{$k}%' OR b.name LIKE '%{$k}%' OR b.business_name LIKE '%{$k}%') "; } } $sql1 .= "))"; $sql1 .= " GROUP BY a.id_work ORDER BY a.created DESC LIMIT {$offset}, {$limit}"; $result = $db->queryF($sql . $sql1); $ret = array(); while ($row = $db->fetchArray($result)) { $work = new PWWork(); $work->assignVars($row); $rtn = array(); $rtn['image'] = 'images/works.png'; $rtn['title'] = $work->title(); $rtn['time'] = $work->created(); $rtn['uid'] = ''; $rtn['desc'] = $work->descShort(); $rtn['link'] = $work->link(); $ret[] = $rtn; } return $ret; }
/** * Mostramos las página existentes */ function qpagesBlockPages($options) { global $xoopsConfig; include_once XOOPS_ROOT_PATH . '/modules/qpages/class/qppage.class.php'; $db =& XoopsDatabaseFactory::getDatabaseConnection(); $mc =& RMUtilities::module_config('qpages'); if (!defined('QP_URL')) { define('QP_URL', XOOPS_URL . ($mc['links'] ? $mc['basepath'] : '/modules/qpages')); } $sql = "SELECT * FROM " . $db->prefix("qpages_pages"); if ($options[0] > 0) { $sql .= " WHERE cat='{$options['0']}'"; } $sql .= " ORDER BY fecha DESC LIMIT 0,{$options['1']}"; $block = array(); $result = $db->query($sql); while ($row = $db->fetchArray($result)) { $page = new QPPage(); $page->assignVars($row); $rtn = array(); $rtn['id'] = $page->getID(); $rtn['titulo'] = $page->getTitle(); $rtn['link'] = $page->getPermaLink(); $block['pages'][] = $rtn; } return $block; }
/** * Obtiene el enlace a la categor?a */ public function permalink() { $mc = RMUtilities::module_config('shop'); $link = ShopFunctions::get_url(); $link .= $mc['urlmode'] == 0 ? '?cat=' . $this->id() : 'category/' . $this->path(); return $link; }
function pw_comments_show($options) { global $xoopsModule, $xoopsModuleConfig; include_once XOOPS_ROOT_PATH . '/modules/works/class/pwwork.class.php'; include_once XOOPS_ROOT_PATH . '/modules/works/class/pwclient.class.php'; $db = XoopsDatabaseFactory::getDatabaseConnection(); if (isset($xoopsModule) && $xoopsModule->dirname() == 'works') { $mc =& $xoopsModuleConfig; } else { $mc =& RMUtilities::module_config('works'); } $sql = "SELECT * FROM " . $db->prefix('pw_works') . " WHERE comment<>'' ORDER BY " . ($options[1] ? " created DESC " : " RAND() "); $sql .= " LIMIT 0," . $options[0]; $result = $db->query($sql); $clients = array(); while ($row = $db->fetchArray($result)) { $work = new PWWork(); $work->assignVars($row); if (!isset($clients[$work->client()])) { $clients[$work->client()] = new PWClient($work->client(), 1); } $client =& $clients[$work->client()]; $rtn = array(); $rtn['client'] = $client->businessName(); $rtn['link'] = $work->link(); $rtn['comment'] = $work->comment(); $block['works'][] = $rtn; } return $block; }
public function permalink() { $mc = RMUtilities::module_config('shop'); $rtn = ShopFunctions::get_url(); $rtn .= $mc['urlmode'] == 0 ? 'product.php?id=' . $this->id() : $this->getVar('nameid') . '/'; return $rtn; }
function xoops_module_pre_uninstall_galleries($mod) { $dir = RMUtilities::module_config('galleries', 'storedir'); if (is_dir($dir)) { RMUtilities::delete_directory($dir); } return true; }
public function get_main_link() { $mc = RMUtilities::module_config('mywords'); if ($mc['permalinks'] > 1) { return XOOPS_URL . $mc['basepath']; } else { return XOOPS_URL . '/modules/mywords'; } }
public function get_main_link() { $mc = RMUtilities::module_config('works'); if ($mc['urlmode']) { return XOOPS_URL . $mc['htbase']; } else { return XOOPS_URL . '/modules/works'; } }
public function get_main_link() { $mc = RMUtilities::module_config('qpages'); if ($mc['links']) { return XOOPS_URL . $mc['basepath']; } else { return XOOPS_URL . '/modules/qpages'; } }
function bxpress_recents_show($options) { $util = RMUtilities::get(); $tc = TextCleaner::getInstance(); $db = XoopsDatabaseFactory::getDatabaseConnection(); $xoopsModuleConfig = $util->module_config('exmbb'); $mc = RMUtilities::module_config('bxpress'); $tbl1 = $db->prefix('bxpress_posts'); $tbl2 = $db->prefix('bxpress_topics'); $tbl3 = $db->prefix('bxpress_posts_text'); $tbl4 = $db->prefix('bxpress_forums'); $sql = "SELECT MAX(id_post) AS id FROM {$tbl1} WHERE approved=1 GROUP BY id_topic ORDER BY MAX(id_post) DESC LIMIT 0,{$options['0']}"; $result = $db->queryF($sql); $topics = array(); $block = array(); include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxforum.class.php'; include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxpost.class.php'; include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxtopic.class.php'; include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxfunctions.class.php'; $post = new bXPost(); $forum = new bXForum(); $tf = new RMTimeFormatter(0, '%T%-%d%-%Y% at %h%:%i%'); while ($row = $db->fetchArray($result)) { $post = new bXPost($row['id']); $topic = new bXTopic($post->topic()); $forum = new bXForum($post->forum()); $ret = array(); $ret['id'] = $topic->id(); $ret['post'] = $post->id(); $ret['link'] = $post->permalink(); if ($options[2]) { $ret['date'] = $tf->format($post->date()); } if ($options[3]) { $ret['poster'] = sprintf(__('Posted by: %s', 'bxpress'), "<a href='" . $post->permalink() . "'>" . $post->uname() . "</a>"); } $ret['title'] = $topic->title(); if ($options[4]) { $ret['text'] = $tc->clean_disabled_tags($post->text()); } $ret['forum'] = array('id' => $forum->id(), 'name' => $forum->name(), 'link' => $forum->permalink()); $topics[] = $ret; } // Opciones $block['showdates'] = $options[2]; $block['showuname'] = $options[3]; $block['showtext'] = $options[4]; $block['topics'] = $topics; $block['lang_topic'] = __('Topic', 'bxpress'); $block['lang_date'] = __('Date', 'bxpress'); $block['lang_poster'] = __('Poster', 'bxpress'); return $block; }
public function eventRmcommonGetFeedsList($feeds) { load_mod_locale('galleries'); include_once XOOPS_ROOT_PATH . '/modules/galleries/class/gsfunctions.class.php'; $module = RMFunctions::load_module('galleries'); $config = RMUtilities::module_config('galleries'); $data = array('title' => $module->name(), 'url' => GSFunctions::get_url(), 'module' => 'galleries'); $options[] = array('title' => __('All Recent Pictures', 'galleries'), 'params' => 'show=pictures', 'description' => __('Show all recent pictures', 'galleries')); $options[] = array('title' => __('All Recent Albums', 'galleries'), 'params' => 'show=albums', 'description' => __('Show all recent albums', 'galleries')); $feed = array('data' => $data, 'options' => $options); $feeds[] = $feed; return $feeds; }
/** * Get the team link formated */ public function permalink() { global $xoopsModule, $xoopsModuleConfig; if (isset($xoopsModule) && $xoopsModule->dirname() == 'match') { $mc =& $xoopsModuleConfig; } else { $mc = RMUtilities::module_config('match'); } $link = XOOPS_URL . '/'; if ($mc['urlmode']) { $link .= trim($mc['htbase'], '/') . '/player/' . $this->getVar('nameid') . '/'; } else { $link .= 'modules/match/index.php?p=player&id=' . $this->getVar('nameid'); } return $link; }
/** * Get the category link formated */ public function permalink() { global $xoopsModule, $xoopsModuleConfig; if (isset($xoopsModule) && $xoopsModule->dirname() == 'match') { $mc =& $xoopsModuleConfig; } else { $mc = RMUtilities::module_config('match'); } $link = XOOPS_URL . '/'; if ($mc['urlmode']) { $link .= trim($mc['htbase'], '/') . '/?category=' . $this->id(); } else { $link .= 'modules/match/index.php?cat=' . $this->id(); } return $link; }
function mywordsBlockRecent($options) { global $xoopsModuleConfig, $xoopsModule, $xoopsUser; $mc = $xoopsModule && $xoopsModule->getVar('dirname') == 'mywords' ? $xoopsModuleConfig : RMUtilities::module_config('mywords'); $db = XoopsDatabaseFactory::getDatabaseConnection(); $by = ''; switch ($options[1]) { case 'recent': $by = 'pubdate'; break; case 'popular': $by = "`reads`"; break; case 'comm': $by = "`comments`"; break; } $posts = MWFunctions::get_posts_by_cat($options[5], 0, $options[0], $by, 'DESC'); $block = array(); foreach ($posts as $post) { $ret = array(); $ret['id'] = $post->id(); $ret['title'] = $post->getVar('title'); $ret['link'] = $post->permalink(); // Content if ($options[2]) { $ret['content'] = TextCleaner::getInstance()->truncate($post->content(true), $options[3]); } // Pubdate if ($options[4]) { $ret['date'] = formatTimestamp($post->getVar('pubdate'), 'c'); } // Show reads if ($options[1] == 'popular') { $ret['hits'] = sprintf(__('%u Reads', 'mywords'), $post->getVar('reads')); } elseif ($options[1] == 'comm') { $ret['comments'] = sprintf(__('%u Comments', 'mywords'), $post->getVar('comments')); } $ret['time'] = $post->getVar('pubdate'); $block['posts'][] = $ret; } RMTemplate::get()->add_xoops_style('mwblocks.css', 'mywords'); return $block; }
function mch_role_bkshow($options) { include_once XOOPS_ROOT_PATH . '/modules/match/class/mchfunctions.php'; RMTemplate::get()->add_xoops_style('blocks.css', 'match'); $ch = rmc_server_var($_GET, 'champ', $options[0]); $champ = $ch <= 0 ? MCHFunctions::current_championship() : new MCHChampionship($ch); if (!is_object($champ)) { $champ = MCHFunctions::last_championship(); } $ch = rmc_server_var($_GET, 'cat', $options[1]); $category = $ch <= 0 ? MCHFunctions::first_category() : new MCHCategory($ch); // Role $data = MCHFunctions::next_matches($category->id(), $champ->id(), $options[2]); $block = array(); $block['role'] = $data; $mc = RMUtilities::module_config('match'); $block['link'] = $mc['urlmode'] ? XOOPS_URL . '/' . $mc['htbase'] : XOOPS_URL . '/modules/match'; $block['lang_viewrol'] = __('View full roleplay »'); $block['category'] = $category->id(); return $block; }
function shop_bk_products_show($options) { include_once XOOPS_ROOT_PATH . '/modules/shop/class/shopproduct.class.php'; include_once XOOPS_ROOT_PATH . '/modules/shop/class/shopfunctions.php'; $db = XoopsDatabaseFactory::getDatabaseConnection(); $limit = $options[2] > 0 ? $options[2] : 5; $ord = $options[0] <= 0 ? ' `created` DESC' : 'RAND()'; $mc = RMUtilities::module_config('shop', 'format'); if ($options[1] != '') { $tp = $db->prefix("shop_products"); $tc = $db->prefix("shop_categories"); $tcp = $db->prefix("shop_catprods"); $sql = "SELECT p.* FROM {$tp} as p, {$tcp} as r WHERE r.cat={$options['1']} AND p.id_product=r.product GROUP BY r.product"; } else { $sql = "SELECT * FROM " . $db->prefix("shop_products"); } $sql .= " ORDER BY {$ord} LIMIT 0,{$limit}"; $result = $db->query($sql); $products = array(); while ($row = $db->fetchArray($result)) { $prod = new ShopProduct(); $prod->assignVars($row); $products[] = array('id' => $prod->id(), 'name' => $prod->getVar('name'), 'link' => $prod->permalink(), 'price' => sprintf($mc, number_format($prod->getVar('price'), 2)), 'type' => $prod->getVar('type') ? __('Digital', 'shop') : 'Product', 'stock' => $prod->getVar('available'), 'image' => $prod->getVar('image')); } $block['products'] = $products; unset($prod, $products, $sql, $result, $row, $ord, $limit, $db); $block['show_image'] = $options[3]; $block['width'] = $options[4]; $block['height'] = $options[5]; $block['display'] = $options[6]; $block['name'] = in_array("name", $options); $block['price'] = in_array("price", $options); $block['type'] = in_array("type", $options); $block['stock'] = in_array("stock", $options); $block['lang_stock'] = __('In stock', 'shop'); $block['lang_nostock'] = __('Out of stock', 'shop'); // Add styles RMTemplate::get()->add_style('blocks.css', 'shop'); return $block; }
/** * @desc Realiza una búsqueda en el módulo desde EXM */ function ahelpSearch($queryarray, $andor, $limit, $offset, $userid) { global $myts; include_once XOOPS_ROOT_PATH . "/modules/docs/class/rdsection.class.php"; include_once XOOPS_ROOT_PATH . "/modules/docs/class/rdresource.class.php"; $mc = RMUtilities::module_config('docs'); $db = XoopsDatabaseFactory::getDatabaseConnection(); $tbl1 = $db->prefix("rd_resources"); $tbl2 = $db->prefix("rd_sections"); $sql = "SELECT a.id_res,a.title,a.description,a.created,a.modified,a.public,a.nameid,a.owner,a.owname,a.approved,b.id_sec,b.title AS stitle,b.content,b.id_res AS sid_res,\n\tb.nameid AS snameid,b.uid,b.uname,b.created AS screated FROM {$tbl1} a, {$tbl2} b "; $sql1 = ''; foreach ($queryarray as $k) { $sql1 .= ($sql1 == '' ? '' : " {$andor} ") . " (a.id_res=b.id_res) AND (\n \t (b.title LIKE '%{$k}%' AND b.id_res=a.id_res) OR \n \t (b.content LIKE '%{$k}%' AND b.id_res=a.id_res))"; } $sql .= $sql1 != '' ? "WHERE {$sql1}" : ''; $sql .= " AND approved=1 AND public=1 ORDER BY a.modified DESC LIMIT {$offset}, {$limit}"; $result = $db->queryF($sql); $ret = array(); while ($row = $db->fetchArray($result)) { $res = new RDResource(); $res->assignVars($row); $sec = new RDSection(); $sec->assignVars($row); $sec->assignVar('title', $row['stitle']); $sec->assignVar('id_res', $row['sid_res']); $sec->assignVar('nameid', $row['snameid']); $sec->assignVar('created', $row['screated']); $rtn = array(); $rtn['image'] = 'images/result.png'; $rtn['link'] = $sec->permalink(); $rtn['title'] = $sec->getVar('title'); $rtn['time'] = $sec->getVar('created'); $rtn['uid'] = $sec->getVar('uid'); $rtn['desc'] = TextCleaner::getInstance()->truncate($sec->getVar('content'), 150); $ret[] = $rtn; } return $ret; }
function gs_photos_show($options) { include_once XOOPS_ROOT_PATH . '/modules/galleries/class/gsfunctions.class.php'; include_once XOOPS_ROOT_PATH . '/modules/galleries/class/gsuser.class.php'; include_once XOOPS_ROOT_PATH . '/modules/galleries/class/gsimage.class.php'; $options[0] <= 0 ? 4 : $options[0]; $db = XoopsDatabaseFactory::getDatabaseConnection(); $sql = "SELECT * FROM " . $db->prefix("gs_images"); $order = $options[1] == '0' ? "created DESC" : ($options[1] == '1' ? 'RAND()' : 'views DESC'); $sql .= " ORDER BY {$order} LIMIT 0,{$options['0']}"; $result = $db->query($sql); $mc =& RMUtilities::module_config('galleries'); $block = array(); $tf = new RMTimeFormatter(0, '%T% %d%, %Y%'); while ($row = $db->fetchArray($result)) { $pic = new GSImage(); $pic->assignVars($row); if (!isset($users[$pic->owner()])) { $users[$pic->owner()] = new GSUser($pic->owner(), 1); } $user =& $users[$pic->owner()]; $rtn = array(); if ($options[3]) { $rtn['title'] = $pic->title(); } $rtn['created'] = $tf->format($pic->created()); $rtn['views'] = $pic->views(); $rtn['by'] = sprintf(__('by %s', 'galleries'), '<a href="' . $user->userURL() . '">' . $user->uname() . '</a>'); $rtn['link'] = $user->userURL() . ($mc['urlmode'] ? 'img/' . $pic->id() . '/' : '&img=' . $pic->id()); $rtn['file'] = $user->filesURL() . '/ths/' . $pic->image(); $block['pics'][] = $rtn; } RMTemplate::get()->add_xoops_style('blocks.css', 'galleries'); RMTemplate::get()->add_local_script('blocks.js', 'galleries'); $block['item_width'] = $options[2]; return $block; }
/** * Get the category link formated */ public function link() { global $xoopsModule, $xoopsModuleConfig; if (isset($xoopsModule) && $xoopsModule->dirname() == 'works') { $mc =& $xoopsModuleConfig; } else { $mc = RMUtilities::module_config('works'); } $link = XOOPS_URL . '/'; if ($mc['urlmode']) { $link .= trim($mc['htbase'], '/') . '/category/' . $this->nameId() . '/'; } else { $link .= 'modules/works/index.php?p=category&id=' . $this->nameId(); } return $link; }
/** * Permalink for a Document * * Generates a permalink for Document according to configures parameters * in RapidDocs. * * @return string URL for this Document */ public function permalink() { global $standalone; $config = RMUtilities::module_config('docs'); if ($config['permalinks']) { $perma = ($config['subdomain'] != '' ? $config['subdomain'] : XOOPS_URL) . $config['htpath'] . '/' . $this->getVar('nameid') . '/'; $perma .= $standalone ? 'standalone/1/' : ''; } else { $perma = XOOPS_URL . '/modules/docs/?page=resource&id=' . $this->id(); $perma .= $standalone ? '&standalone=1' : ''; } return $perma; }
/** * Make the correct link for a specific page */ public function make_link($page, $params = array()) { $config = RMUtilities::module_config('docs'); if (!$config['permalinks']) { $q = ''; foreach ($params as $k => $v) { $q .= "&{$k}={$v}"; } $link = XOOPS_URL . '/modules/docs/index.php?page=' . ($page == 'explore' ? 'search' : $page) . $q; return $link; } $base_url = ($config['subdomain'] != '' ? $config['subdomain'] : XOOPS_URL) . rtrim($config['htpath'], '/') . '/'; switch ($page) { case 'explore': $link = $base_url . $page . '/' . $params['by'] . '/' . (isset($params['page']) ? 'page/' . $params['page'] . '/' : ''); break; case 'search': $link = $base_url . $page . '/'; break; } return $link; }
/** * Get image data */ public function process_image_data($result) { $mc = RMUtilities::module_config('galleries'); $users = array(); $ret = array(); $tf = new RMTimeFormatter(0, "%M%/%d%/%Y%"); $db = Database::getInstance(); $i = 0; while ($row = $db->fetchArray($result)) { $img = new GSImage(); $img->assignVars($row); if (!isset($users[$img->owner()])) { $users[$img->owner()] = new GSUser($img->owner(), 1); } $imglink = $users[$img->owner()]->userURL() . ($mc['urlmode'] ? 'img/' . $img->id() . '/' : '&img=' . $img->id()); $ret[$i] = array('id' => $img->id(), 'title' => $img->title(), 'thumbnail' => $users[$img->owner()]->filesURL() . '/ths/' . $img->image(), 'thumbuser' => $users[$img->owner()]->filesURL() . '/' . ($mc['user_format_mode'] ? 'formats/user_' : 'ths/') . $img->image(), 'thumbsrh' => $users[$img->owner()]->filesURL() . '/' . ($mc['search_format_mode'] ? 'formats/srh_' : 'ths/') . $img->image(), 'image' => $users[$img->owner()]->filesURL() . '/' . $img->image(), 'by' => sprintf(__('by %s', 'galleries'), '<a href="' . $users[$img->owner()]->userUrl() . '">' . $users[$img->owner()]->uname() . '</a>'), 'link' => $imglink, 'created' => $tf->format($img->created()), 'public' => $img->isPublic(), 'desc' => $img->desc()); // Format resize if (!$img->userFormat() && $mc['user_format_mode']) { $format = $mc['user_format_values']; GSFunctions::resizeImage($format[0], $users[$img->owner()]->filesPath() . '/' . $img->image(), $users[$img->owner()]->filesPath() . '/formats/user_' . $img->image(), $format[1], $format[2]); $img->setUserFormat(1, 1); } if (!$img->searchFormat() && $mc['search_format_mode']) { $format = $mc['search_format_values']; GSFunctions::resizeImage($format[0], $users[$img->owner()]->filesPath() . '/' . $img->image(), $users[$img->owner()]->filesPath() . '/formats/srh_' . $img->image(), $format[1], $format[2]); $img->setSearchFormat(1, 1); } if ($mc['search_format_mode']) { $ret[$i]['viewmore'] = sprintf(__('Ver <a href="%s">más fotos</a>.', 'galleries'), $users[$img->owner()]->userURL()); $ret[$i]['avatar'] = RMEvents::get()->run_event('rmcommon.get.avatar', $users[$img->owner()]->userVar('email'), 0, $users[$img->owner()]->userVar('user_avatar')); $tags = $img->tags(true); $tagurl = self::get_url() . ($mc['urlmode'] ? 'explore/tags/tag/' : '?explore=tags&tag='); $strtag = ''; foreach ($tags as $tag) { $strtag .= $strtag == '' ? "<a href=\"{$tagurl}" . $tag->getVar('nameid') . "\">" . $tag->tag() . "</a>" : ", <a href=\"{$tagurl}" . $tag->getVar('nameid') . "\">" . $tag->tag() . "</a>"; } $ret[$i]['tags'] = $strtag; } $i++; } RMTemplate::get()->add_local_script('photos.js', 'galleries'); if (!$mc['quickview']) { return $ret; } if (RMFunctions::plugin_installed('lightbox')) { RMLightbox::get()->add_element('.pic_qview a'); RMLightbox::get()->render(); } return $ret; }
public function format_time($time) { $day = date('d', $time); $month = date('m', $time); $year = date('Y', $time); $format = __("Published on %s at %s", 'mywords'); $config = RMUtilities::module_config('mywords'); if ($config['permalinks'] > 1) { $url = MWFunctions::get_url() . "{$day}/{$month}/{$year}/"; } else { $url = MWFunctions::get_url() . "?date={$day}/{$month}/{$year}/"; } $date = '<a href="' . $url . '">' . date(__('D d M, Y', 'mywords'), $time) . '</a>'; $hour = date(__('H:i', 'mywords'), $time); $rtn = sprintf($format, $date, $hour); return $rtn; }
<?php // $Id$ // -------------------------------------------------------------- // MyGalleries // Module for advanced image galleries management // Author: Eduardo Cortés // Email: i.bitcero@gmail.com // License: GPL 2.0 // -------------------------------------------------------------- load_mod_locale("galleries"); $show = rmc_server_var($_GET, 'show', 'all'); $xoopsModule = RMFunctions::load_module('galleries'); $config = RMUtilities::module_config('galleries'); include_once XOOPS_ROOT_PATH . '/modules/galleries/class/gsfunctions.class.php'; include_once XOOPS_ROOT_PATH . '/modules/galleries/class/gsimage.class.php'; include_once XOOPS_ROOT_PATH . '/modules/galleries/class/gsset.class.php'; $rss_channel = array(); $db = XoopsDatabaseFactory::getDatabaseConnection(); switch ($show) { case 'pictures': $sql = "SELECT * FROM " . $db->prefix('gs_images') . " WHERE public=2 ORDER BY created DESC LIMIT 0,15"; $result = $db->query($sql); $rss_channel['title'] = $xoopsModule->name(); $rss_channel['link'] = GSFunctions::get_url(); $rss_channel['description'] = __('These are the recent pictures published on our galleries.', 'galleries'); $rss_channel['lastbuild'] = formatTimestamp(time(), 'rss'); $rss_channel['webmaster'] = checkEmail($xoopsConfig['adminmail'], true); $rss_channel['editor'] = checkEmail($xoopsConfig['adminmail'], true); $rss_channel['category'] = __('Pictures', 'galleries'); $rss_channel['generator'] = 'MyGalleries 3';
/** * Get works based on given parameters */ public function get_works($limit, $category = null, $public = 1, $object = true, $order = "created DESC") { global $xoopsModule, $xoopsModuleConfig; include_once XOOPS_ROOT_PATH . '/modules/works/class/pwwork.class.php'; include_once XOOPS_ROOT_PATH . '/modules/works/class/pwcategory.class.php'; include_once XOOPS_ROOT_PATH . '/modules/works/class/pwclient.class.php'; $db = XoopsDatabaseFactory::getDatabaseConnection(); $sql = "SELECT * FROM " . $db->prefix('pw_works') . " WHERE public={$public}"; $sql .= $category > 0 ? " AND catego='{$category}'" : ''; $sql .= $order != '' ? " ORDER BY {$order}" : ''; $sql .= " LIMIT 0,{$limit}"; if ($xoopsModule && $xoopsModule->dirname() == 'works') { $mc =& $xoopsModuleConfig; } else { $mc = RMUtilities::module_config('works'); } $result = $db->query($sql); $works = array(); while ($row = $db->fetchArray($result)) { $work = new PWWork(); $work->assignVars($row); $ret = array(); if (!isset($categos[$work->category()])) { $categos[$work->category()] = new PWCategory($work->category()); } if (!isset($clients[$work->client()])) { $clients[$work->client()] = new PWClient($work->client()); } $ret = array('id' => $work->id(), 'title' => $work->title(), 'desc' => $work->descShort(), 'catego' => $categos[$work->category()]->name(), 'client' => $clients[$work->client()]->name(), 'link' => $work->link(), 'created' => formatTimeStamp($work->created(), 's'), 'created_time' => $work->created(), 'image' => XOOPS_UPLOAD_URL . '/works/ths/' . $work->image(), 'rating' => PWFunctions::rating($work->rating()), 'featured' => $work->mark(), 'linkcat' => $categos[$work->category()]->link(), 'metas' => $work->get_metas()); if ($object) { $w = new stdClass(); foreach ($ret as $var => $value) { $w->{$var} = $value; } $works[] = $w; } else { $works[] = $ret; } } return $works; }
public function permalink() { $mc = RMUtilities::module_config('galleries'); $user = new GSUser($this->owner()); return $user->userURL() . ($mc['urlmode'] ? 'img/' . $this->id() . '/' : '&img=' . $this->id()); }
/** * Return the feed options to show in RSS Center */ public function eventRmcommonGetFeedsList($feeds) { include_once XOOPS_ROOT_PATH . '/modules/mywords/class/mwfunctions.php'; load_mod_locale('mywords'); $module = RMFunctions::load_module('mywords'); $config = RMUtilities::module_config('mywords'); $data = array('title' => $module->name(), 'url' => XOOPS_URL . $config['basepath'], 'module' => 'mywords'); $options[] = array('title' => __('All Recent Posts', 'mywords'), 'params' => 'show=all', 'description' => __('Show all recent posts', 'mywords')); $categories = array(); MWFunctions::categos_list($categories); $table = '<table cellpadding="2" cellspacing="2" width="100%"><tr class="even">'; $count = 0; foreach ($categories as $cat) { if ($count >= 3) { $count = 0; $table .= '</tr><tr class="' . tpl_cycle("odd,even") . '">'; } $table .= '<td width="33%"><a href="' . XOOPS_URL . '/backend.php?action=showfeed&mod=mywords&show=cat&cat=' . $cat['id_cat'] . '">' . $cat['name'] . '</a></td>'; $count++; } $table .= '</tr></table>'; $options[] = array('title' => __('Posts by category', 'mywords'), 'description' => __('Select a category to see the posts published recently.', 'mywords') . ' <a href="javascript:;" onclick="$(\'#categories-feed\').slideToggle(\'slow\');">Show Categories</a> <div id="categories-feed" style="padding: 10px; display: none;">' . $table . '</div>'); unset($categories); $tags = MWFunctions::get_tags("*", '', '', 99); $table = '<table cellpadding="2" cellspacing="2" width="100%"><tr class="even">'; $count = 0; foreach ($tags as $tag) { if ($count >= 3) { $count = 0; $table .= '</tr><tr class="' . tpl_cycle("odd,even") . '">'; } $table .= '<td width="33%"><a href="' . XOOPS_URL . '/backend.php?action=showfeed&mod=mywords&show=tag&tag=' . $tag['id_tag'] . '">' . $tag['tag'] . '</a></td>'; $count++; } $table .= '</tr></table>'; $options[] = array('title' => __('Show posts by tag', 'mywords'), 'description' => __('Select a tag to see the posts published recently.', 'mywords') . ' <a href="javascript:;" onclick="$(\'#tags-feed\').slideToggle(\'slow\');">Show Tags</a> <div id="tags-feed" style="padding: 10px; display: none;">' . $table . '</div>'); unset($tags); $db = XoopsDatabaseFactory::getDatabaseConnection(); $sql = "SELECT * FROM " . $db->prefix("mw_editors") . " ORDER BY name"; $result = $db->query($sql); $editors = array(); while ($row = $db->fetchArray($result)) { $editors[] = $row; } asort($editors); $table = '<table cellpadding="2" cellspacing="2" width="100%"><tr class="even">'; $count = 0; foreach ($editors as $ed) { if ($count >= 3) { $count = 0; $table .= '</tr><tr class="' . tpl_cycle("odd,even") . '">'; } $table .= '<td width="33%"><a href="' . XOOPS_URL . '/backend.php?action=showfeed&mod=mywords&show=author&author=' . $ed['id_editor'] . '">' . $ed['name'] . '</a></td>'; $count++; } $table .= '</tr></table>'; $options[] = array('title' => __('Show posts by author', 'mywords'), 'description' => __('Select an author to see the posts published recently.', 'mywords') . ' <a href="javascript:;" onclick="$(\'#editor-feed\').slideToggle(\'slow\');">Show Authors</a> <div id="editor-feed" style="padding: 10px; display: none;">' . $table . '</div>'); unset($editors); unset($table); RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.min.js'); RMTemplate::get()->add_script(RMCURL . '/include/js/jquery-ui.min.js'); $feed = array('data' => $data, 'options' => $options); $feeds[] = $feed; return $feeds; }