function update_tag() { global $xoopsModule, $xoopsSecurity; $page = rmc_server_var($_POST, 'page', 1); $tags = rmc_server_var($_POST, 'tags', array()); if (!$xoopsSecurity->check()) { redirectMsg('tags.php?page=' . $page, __('Sorry, operation not allowed!', 'mywords'), 1); die; } if (!is_array($tags) || empty($tags)) { redirectMsg('tags.php?page=' . $page, __('Please, specify a valid tag id!', 'mywords'), 1); die; } foreach ($tags as $id) { $tag = new MWTag($id); if ($tag->isNew()) { continue; } $tag->update_posts(); } redirectMsg('tags.php?page=' . $page, __('Tags updated!', 'mywords'), 0); }
function myWordsBlockTags($options) { $db = XoopsDatabaseFactory::getDatabaseConnection(); $sql = "SELECT * FROM " . $db->prefix("mod_mywords_tags") . " ORDER BY RAND() LIMIT 0,{$options['0']}"; $result = $db->query($sql); $block = array(); $max = 0; $min = 0; while ($row = $db->fetchArray($result)) { $tag = new MWTag(); $tag->assignVars($row); $block['tags'][] = array('id' => $tag->id(), 'posts' => $tag->getVar('posts'), 'link' => $tag->permalink(), 'name' => $tag->getVar('tag'), 'size' => $options[1] * $tag->getVar('posts') + 0.9); } RMTemplate::get()->add_style('mwblocks.css', 'mywords'); return $block; }
$image = ''; } $item['description'] = XoopsLocal::convert_encoding(htmlspecialchars($image . $post->content(true), ENT_QUOTES)); $item['pubdate'] = formatTimestamp($post->getVar('pubdate'), 'rss'); $item['guid'] = $post->permalink(); $rss_items[] = $item; } break; case 'tag': include_once XOOPS_ROOT_PATH . '/modules/mywords/class/mwtag.class.php'; $id = rmc_server_var($_GET, 'tag', 0); if ($id <= 0) { redirect_header('backend.php', 1, __('Sorry, specified tag was not foud!', 'mywords')); die; } $tag = new MWTag($id); if ($tag->isNew()) { redirect_header('backend.php', 1, __('Sorry, specified tag was not foud!', 'mywords')); die; } $rss_channel['title'] = sprintf(__('Posts tagged %s in %s', 'mywords'), $tag->tag, $xoopsConfig['sitename']); $rss_channel['link'] = $tag->permalink(); $rss_channel['description'] = sprintf(__('Posts tagged as %s', 'mywords'), $tag->getVar('tag')); $rss_channel['lastbuild'] = formatTimestamp(time(), 'rss'); $rss_channel['webmaster'] = checkEmail($xoopsConfig['adminmail'], true); $rss_channel['editor'] = checkEmail($xoopsConfig['adminmail'], true); $rss_channel['category'] = "Blog"; $rss_channel['generator'] = 'Common Utilities'; $rss_channel['language'] = RMCLANG; $posts = MWFunctions::get_posts_by_tag($id, 0, 10); $rss_items = array();
<?php // $Id$ // -------------------------------------------------------------- // MyWords // Blogging System // Author: Eduardo Cortés <*****@*****.**> // Email: i.bitcero@gmail.com // License: GPL 2.0 // -------------------------------------------------------------- $xoopsOption['template_main'] = 'mywords_tag.html'; $xoopsOption['module_subpage'] = 'author'; include 'header.php'; $tag = new MWTag($tag); if ($tag->isNew()) { redirect_header(MWFunctions::get_url(), 2, __('Sorry, this tag does not exists!', 'admin_mywords')); die; } $page = isset($_REQUEST['page']) ? $_REQUEST['page'] : 0; if ($page <= 0) { $path = explode("/", $request); $srh = array_search('page', $path); if (isset($path[$srh]) && $path[$srh] == 'page') { if (!isset($path[$srh])) { $page = 0; } else { $page = $path[$srh + 1]; } } } $request = substr($request, 0, strpos($request, 'page') > 0 ? strpos($request, 'page') - 1 : strlen($request));
/** * Get all tags according to given options * return array * @todo Enable objects return */ public function tags($objects = false) { if (empty($this->tags)) { $this->get_tags(); } if (!$objects) { return $this->tags; } $tags = array(); foreach ($this->tags as $data) { $tag = new MWTag(); $tag->assignVars($data); $tags[] = $tag; } return $tags; }