function trackback($url, &$post) { global $xoopsConfig; if ($post->isNew() || $post->getApproved() == 0 || $post->getStatus() != 1) { return; } $util = new RMUtils(); //$url = urlencode($url); $title = urlencode($post->getTitle()); $excerpt = urlencode($util->filterTags($post->getExcerpt() != '' ? htmlentities($post->getExcerpt()) : '[...] ' . htmlentities(substr($util->filterTags($post->getText()), 0, $mc['tracklen'])) . ' [...]')); $blogname = urlencode($xoopsConfig['sitename']); $permalink = urlencode($post->getPermaLink()); $tburl = urlencode($url); $querys = "title={$title}&url={$permalink}&blog_name={$blogname}&excerpt={$excerpt}"; $url = parse_url($url); $http_request = 'POST ' . $url['path'] . (isset($url['query']) ? '?' . $url['query'] : '') . " HTTP/1.0\r\n"; $http_request .= 'Host: ' . $url['host'] . "\r\n"; $http_request .= 'Content-Type: application/x-www-form-urlencoded; charset=' . _CHARSET . "\r\n"; $http_request .= 'Content-Length: ' . strlen($querys) . "\r\n"; $http_request .= "User-Agent: NaturalPress"; $http_request .= "\r\n\r\n"; $http_request .= $querys; if (!isset($url['port']) || '' == $url['port']) { $url['port'] = 80; } $fs = @fsockopen($url['host'], $url['port'], $errno, $errstr, 4); @fputs($fs, $http_request); @fclose($fs); return true; }
function sendComment() { global $xoopsUser, $xoopsModule, $xoopsModuleConfig, $mc, $xoopsConfig; $util =& RMUtils::getInstance(); if (!$util->validateToken()) { redirect_header('comment.php', 2, _MS_TC_ERRID); die; } foreach ($_POST as $k => $v) { ${$k} = $v; } if ($name == '' || $email == '' || $comment == '') { redirect_header('comment.php', 2, _MS_TC_ERRFIELDS); die; } $xoopsMailer =& getMailer(); $xoopsMailer->useMail(); $xoopsMailer->setTemplate('mail.tpl'); $xoopsMailer->assign('SITENAME', $xoopsConfig['sitename']); $xoopsMailer->assign('ADMINMAIL', $xoopsConfig['adminmail']); $xoopsMailer->assign('SITEURL', XOOPS_URL . "/"); $xoopsMailer->assign('NAME', $name); $xoopsMailer->assign('EMAIL', $email); $xoopsMailer->assign('COMMENTS', $comment); $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . "/modules/team/language/" . $xoopsConfig['language'] . "/"); $xoopsMailer->setFromEmail($email); $xoopsMailer->setFromName($name); $xoopsMailer->setSubject(sprintf(_MS_TC_COMFROM, $xoopsConfig['sitename'] . ": " . $xoopsModule->name())); $xoopsMailer->setToEmails($xoopsModuleConfig['email']); if (!$xoopsMailer->send(true)) { redirect_header('comment.php', 2, $xoopsMailer->getErrors()); } else { redirect_header('./', 1, _MS_TC_COMTHX); } }
function tc_block_players($options) { global $xoopsModule; if ($xoopsModule && $xoopsModule->dirname() == 'team') { global $xoopsModuleConfig; $mc =& $xoopsModuleConfig; } else { $util =& RMUtils::getInstance(); $mc =& $util->moduleConfig('team'); } $db =& XoopsDatabaseFactory::getDatabaseConnection(); $sql = "SELECT * FROM " . $db->prefix("coach_players"); if ($options[0] > 0) { $sql .= " WHERE team='" . $options[0] . "'"; } $sql .= " ORDER BY RAND() LIMIT 0,{$options['1']}"; $result = $db->query($sql); $block = array(); while ($row = $db->fetchArray($result)) { $rtn = array(); $player = new TCPlayer(); $player->assignVars($row); $rtn['link'] = XOOPS_URL . '/modules/team/' . ($mc['urlmode'] ? 'player/' . $player->nameId() . '/' : 'player.php?id=' . $player->id()); $rtn['name'] = $player->name(); $rtn['number'] = $player->number(); $rtn['image'] = $player->image(); $block['players'][] = $rtn; } $block['cols'] = $options[2]; return $block; }
function dt_block_tags($options) { global $db, $xoopsModule; if ($xoopsModule && $xoopsModule->dirname() == 'dtransport') { global $xoopsModuleConfig; $mc =& $xoopsModuleConfig; } else { $util =& RMUtils::getInstance(); $mc =& $util->moduleConfig('dtransport'); } include_once XOOPS_ROOT_PATH . '/modules/dtransport/class/dttag.class.php'; $sql = "SELECT MAX(hits) FROM " . $db->prefix('dtrans_tags'); list($maxhit) = $db->fetchRow($db->query($sql)); $sql = "SELECT * FROM " . $db->prefix('dtrans_tags'); if ($options[2] < 1) { $sql .= " WHERE hits>0"; } $sql .= " LIMIT 0,{$options['0']}"; $result = $db->query($sql); $sz = $options[1] / $maxhit; $block = array(); while ($row = $db->fetchArray($result)) { $tag = new DTTag(); $tag->assignVars($row); $link = XOOPS_URL . "/modules/dtransport/" . ($mc['urlmode'] ? "tag/" . $tag->tag() : "tags.php?id=" . $tag->tag()); $size = intval($tag->hit() * $sz); if ($size < $options[3]) { $size = $options[3]; } $rtn = array(); $rtn['id'] = $tag->id(); $rtn['tag'] = $tag->tag(); $rtn['hits'] = $tag->hit(); $rtn['link'] = $link; $rtn['size'] = $size; $block['tags'][] = $rtn; } $block['font'] = $options[4]; return $block; }
/** * Devuelve el código HTML para mostrar el campo. * @return string */ public function render() { $util = new RMUtils(); $ret = '<input type="text" size="' . $this->_size . '" name="' . $this->getName() . '" id="' . $this->getName() . '" maxlength="' . $this->getMax() . '" value="" '; if ($this->getClass() != '') { $ret .= 'class="' . $this->getClass() . '" ' . $this->getExtra() . ' />'; } else { $ret .= $this->getExtra() . ' />'; } $code = $util->imageFromCode($util->randomString($this->_lencode, true, false, true)); $ret .= "<br /><img src='" . ABSURL . "/uploads/rmccodes/{$code}.png' alt='' style='margin-top: 5px;' />\n\t\t\t<input type='hidden' name='rmseccode' value='{$code}' /><br />\n\t\t\t<a href='javascript:;' onclick=\"" . $this->_refreshlink . "\">" . _RMS_CF_IFNOTVIEW . "</a>"; return $ret; }