Beispiel #1
0
 /**
  * @param MyTextSanitizer $ts
  * @param string $text
  * @param bool $force
  * @return mixed
  */
 public function load(MyTextSanitizer &$ts, $text, $force = false)
 {
     $xoops = Xoops::getInstance();
     if (empty($force) && $xoops->userIsAdmin) {
         return $text;
     }
     // Built-in fitlers for XSS scripts
     // To be improved
     $text = $ts->filterXss($text);
     if (XoopsLoad::load("purifier", "framework")) {
         $text = XoopsPurifier::purify($text);
         return $text;
     }
     $tags = array();
     $search = array();
     $replace = array();
     $config = parent::loadConfig(__DIR__);
     if (!empty($config["patterns"])) {
         foreach ($config["patterns"] as $pattern) {
             if (empty($pattern['search'])) {
                 continue;
             }
             $search[] = $pattern['search'];
             $replace[] = $pattern['replace'];
         }
     }
     if (!empty($config["tags"])) {
         $tags = array_map("trim", $config["tags"]);
     }
     // Set embedded tags
     $tags[] = "SCRIPT";
     $tags[] = "VBSCRIPT";
     $tags[] = "JAVASCRIPT";
     foreach ($tags as $tag) {
         $search[] = "/<" . $tag . "[^>]*?>.*?<\\/" . $tag . ">/si";
         $replace[] = " [!" . strtoupper($tag) . " FILTERED!] ";
     }
     // Set meta refresh tag
     $search[] = "/<META[^>\\/]*HTTP-EQUIV=(['\"])?REFRESH(\\1)[^>\\/]*?\\/>/si";
     $replace[] = "";
     // Sanitizing scripts in IMG tag
     //$search[]= "/(<IMG[\s]+[^>\/]*SOURCE=)(['\"])?(.*)(\\2)([^>\/]*?\/>)/si";
     //$replace[]="";
     // Set iframe tag
     $search[] = "/<IFRAME[^>\\/]*SRC=(['\"])?([^>\\/]*)(\\1)[^>\\/]*?\\/>/si";
     $replace[] = " [!IFRAME FILTERED! \\2] ";
     $search[] = "/<IFRAME[^>]*?>([^<]*)<\\/IFRAME>/si";
     $replace[] = " [!IFRAME FILTERED! \\1] ";
     // action
     $text = preg_replace($search, $replace, $text);
     return $text;
 }
 function fetchSummary($external_link_id)
 {
     global $xoopsDB, $xoopsConfig, $xoopsUser;
     $myts =& MyTextSanitizer::getInstance();
     $module_handler =& xoops_gethandler('module');
     $module =& $module_handler->getByDirname($this->mydirname);
     $eventcomment_id = intval($external_link_id);
     $mydirname = $this->mydirname;
     if (!preg_match('/^(\\D+)(\\d*)$/', $mydirname, $regs)) {
         die('Invalid mydirname');
     }
     $mydirnumber = $regs[2] === '' ? '' : intval($regs[2]);
     $table_event = $xoopsDB->prefix("pical{$mydirnumber}_event");
     $MOD_PATH = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
     if (!class_exists('piCal_xoops')) {
         require_once $MOD_PATH . '/class/piCal.php';
         require_once $MOD_PATH . '/class/piCal_xoops.php';
     }
     $cal = new piCal_xoops('', $xoopsConfig['language'], true);
     include $MOD_PATH . '/include/read_configs.php';
     $whr_categories = $cal->get_where_about_categories();
     $whr_class = $cal->get_where_about_class();
     $content_row = $xoopsDB->fetchArray($xoopsDB->query("SELECT id, summary, description FROM {$table_event} WHERE id={$eventcomment_id} AND ({$whr_categories}) AND ({$whr_class})"));
     if (empty($content_row)) {
         redirect_header(XOOPS_URL . '/user.php', 3, _NOPERM);
         exit;
     }
     $subject = $myts->makeTboxData4Show($content_row['summary']);
     //HACK by domifara
     //			$uri = XOOPS_URL.'/modules/'.$mydirname.'/index.php?action=View&amp;event_id='.$eventcomment_id;
     $uri = XOOPS_URL . '/modules/' . $mydirname . '/index.php?action=View&event_id=' . $eventcomment_id;
     $str = strip_tags($myts->displayTarea(strip_tags($content_row['description'])));
     $summary = xoops_substr($str, 0, 255);
     return array('dirname' => $mydirname, 'module_name' => $module->getVar('name'), 'subject' => $subject, 'uri' => $uri, 'summary' => $summary);
 }
Beispiel #3
0
function b_sitemap_xpwiki($mydirname)
{
    global $sitemap_configs;
    (method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || ($myts =& MyTextSanitizer::getInstance());
    $ret = array();
    include_once dirname(dirname(__FILE__)) . '/include.php';
    $xpwiki =& XpWiki::getInitedSingleton($mydirname);
    $result = $xpwiki->func->get_existpages(FALSE, '', array('limit' => 5, 'order' => ' ORDER BY editedtime DESC', 'select' => array('title'), 'nolisting' => TRUE));
    $ret = array();
    // Recent Changes
    $show_cat = @$sitemap_configs['show_subcategoris'] ? 'child' : 'parent';
    if ($show_cat === 'child') {
        $ret['id'] = 0;
        $ret['title'] = $xpwiki->root->_LANG['skin']['recent'];
        $ret['url'] = '?' . rawurlencode($xpwiki->root->whatsnew);
    }
    foreach ($result as $_res) {
        $pgid = $_res['pgid'];
        $page = $_res['name'];
        $title = $_res['title'];
        $title = $xpwiki->root->pagename_num2str ? preg_replace('/\\/(?:[0-9\\-]+|[B0-9][A-Z0-9]{9})$/', '/' . $xpwiki->func->get_heading($page), $page) : $page;
        $ret[$show_cat][] = array("id" => intval($pgid), "title" => $myts->makeTboxData4Show($title), "url" => $xpwiki->func->get_page_uri($page), 'image' => 2);
    }
    if ($show_cat === 'child') {
        $ret = array('parent' => array($ret));
    }
    // Other menus
    $ret['parent'][] = array('id' => 0, 'title' => $xpwiki->root->_LANG['skin']['list'], 'url' => '?cmd=list');
    $ret['parent'][] = array('id' => 0, 'title' => $xpwiki->root->_attach_messages['msg_list'], 'url' => '?plugin=attach&amp;pcmd=list');
    $ret['parent'][] = array('id' => 0, 'title' => $xpwiki->root->_LANG['skin']['help'], 'url' => '?Help');
    return $ret;
}
Beispiel #4
0
function b_mylinks_top_show($options)
{
    global $xoopsDB;
    $block = array();
    $myts =& MyTextSanitizer::getInstance();
    $result = $xoopsDB->query("SELECT lid, cid, title, date, hits FROM " . $xoopsDB->prefix("mylinks_links") . " WHERE status>0 ORDER BY " . $options[0] . " DESC", $options[1], 0);
    while ($myrow = $xoopsDB->fetchArray($result)) {
        $link = array();
        $title = $myts->makeTboxData4Show($myrow["title"]);
        if (!XOOPS_USE_MULTIBYTES) {
            if (strlen($myrow['title']) >= $options[2]) {
                $title = $myts->makeTboxData4Show(substr($myrow['title'], 0, $options[2] - 1)) . "...";
            }
        }
        $link['id'] = $myrow['lid'];
        $link['cid'] = $myrow['cid'];
        $link['title'] = $title;
        if ($options[0] == "date") {
            $link['date'] = formatTimestamp($myrow['date'], 's');
        } elseif ($options[0] == "hits") {
            $link['hits'] = $myrow['hits'];
        }
        $block['links'][] = $link;
    }
    return $block;
}
    function wp_dropdown_cats($currentcat, $currentparent = 0, $parent = 0, $level = 0, $categories = 0)
    {
        $myts =& MyTextSanitizer::getInstance();
        if (!$categories) {
            $categoryHandler =& wp_handler('Category');
            $categories =& $categoryHandler->getObjects();
        }
        if ($categories) {
            foreach ($categories as $category) {
                $cat_ID = $category->getVar('cat_ID');
                if ($currentcat != $cat_ID && $parent == $category->getVar('category_parent')) {
                    $cat_name = $myts->makeTareaData4Show($category->getVar('cat_name'));
                    $pad = str_repeat('&#8211; ', $level);
                    ?>
				<option value='<?php 
                    echo $cat_ID;
                    ?>
'<?php 
                    selected($currentparent, $cat_ID);
                    ?>
><?php 
                    echo "{$pad}{$cat_name}";
                    ?>
</option>
<?php 
                    wp_dropdown_cats($currentcat, $currentparent, $cat_ID, $level + 1, $categories);
                }
            }
        } else {
            return false;
        }
    }
Beispiel #6
0
 /**
  * search - search
  *
  * @param string[] $queryArray search terms
  * @param string   $andor      and/or how to treat search terms
  * @param integer  $limit      max number to return
  * @param integer  $offset     offset of first row to return
  * @param integer  $userid     a specific user id to limit the query
  *
  * @return array of result items
  *           'title' => the item title
  *           'content' => brief content or summary
  *           'link' => link to visit item
  *           'time' => time modified (unix timestamp)
  *           'uid' => author uid
  *           'image' => icon for search display
  *
  */
 public function search($queryArray, $andor, $limit, $offset, $userid)
 {
     $andor = strtolower($andor) == 'and' ? 'and' : 'or';
     $qb = \Xoops::getInstance()->db()->createXoopsQueryBuilder();
     $eb = $qb->expr();
     $qb->select('DISTINCT *')->fromPrefix('page_content')->where($eb->neq('content_status', '0'))->orderBy('content_create', 'DESC')->setFirstResult($offset)->setMaxResults($limit);
     if (is_array($queryArray) && !empty($queryArray)) {
         $queryParts = array();
         foreach ($queryArray as $i => $q) {
             $qterm = ':qterm' . $i;
             $qb->setParameter($qterm, '%' . $q . '%', \PDO::PARAM_STR);
             $queryParts[] = $eb->orX($eb->like('content_title', $qterm), $eb->like('content_text', $qterm), $eb->like('content_shorttext', $qterm));
         }
         if ($andor == 'and') {
             $qb->andWhere(call_user_func_array(array($eb, "andX"), $queryParts));
         } else {
             $qb->andWhere(call_user_func_array(array($eb, "orX"), $queryParts));
         }
     } else {
         $qb->setParameter(':uid', (int) $userid, \PDO::PARAM_INT);
         $qb->andWhere($eb->eq('content_author', ':uid'));
     }
     $myts = MyTextSanitizer::getInstance();
     $items = array();
     $result = $qb->execute();
     while ($myrow = $result->fetch(\PDO::FETCH_ASSOC)) {
         $content = $myrow["content_shorttext"] . "<br /><br />" . $myrow["content_text"];
         $content = $myts->xoopsCodeDecode($content);
         $items[] = array('title' => $myrow['content_title'], 'content' => Metagen::getSearchSummary($content, $queryArray), 'link' => "viewpage.php?id=" . $myrow["content_id"], 'time' => $myrow['content_create'], 'uid' => $myrow['content_author'], 'image' => 'images/logo_small.png');
     }
     return $items;
 }
 /**
  * Filters textarea form data in DB for display
  *
  * @param   string  $text
  * @param   bool    $html   allow html?
  * @param   bool    $smiley allow smileys?
  * @param   bool    $xcode  allow xoopscode?
  * @param   bool    $image  allow inline images?
  * @param   bool    $br     convert linebreaks?
  * @return  string
  **/
 function displayTarea($text, $html = 0, $smiley = 1, $xcode = 1, $image = 1, $br = 1, $nbsp = 0)
 {
     $this->nbsp = $nbsp;
     $text = parent::displayTarea($text, $html, $smiley, $xcode, $image, $br);
     return $this->postCodeDecode($text, $image);
     /*		if ($html != 1) {
     			// html not allowed
     			$text =& $this->htmlSpecialChars($text);
     		}
     		$text =& $this->makeClickable($text);
     		if ($smiley != 0) {
     			// process smiley
     			$text =& $this->smiley($text);
     		}
     		if ($xcode != 0) {
     			// decode xcode
     			if ($image != 0) {
     				// image allowed
     				$text =& $this->xoopsCodeDecode($text);
                 		} else {
                     		// image not allowed
                     		$text =& $this->xoopsCodeDecode($text, 0);
     			}
     		}
     		if ($br != 0) {
     			$text =& $this->nl2Br($text);
     		}
     		return $text; */
 }
Beispiel #8
0
function smartsection_seo_title($title = '', $withExt = true)
{
    /**
     * if XOOPS ML is present, let's sanitize the title with the current language
     */
    $myts = MyTextSanitizer::getInstance();
    if (method_exists($myts, 'formatForML')) {
        $title = $myts->formatForML($title);
    }
    // Transformation de la chaine en minuscule
    // Codage de la chaine afin d'éviter les erreurs 500 en cas de caractères imprévus
    $title = rawurlencode(strtolower($title));
    // Transformation des ponctuations
    //                 Tab     Space      !        "        #        %        &        '        (        )        ,        /        :        ;        <        =        >        ?        @        [        \        ]        ^        {        |        }        ~       .
    $pattern = array("/%09/", "/%20/", "/%21/", "/%22/", "/%23/", "/%25/", "/%26/", "/%27/", "/%28/", "/%29/", "/%2C/", "/%2F/", "/%3A/", "/%3B/", "/%3C/", "/%3D/", "/%3E/", "/%3F/", "/%40/", "/%5B/", "/%5C/", "/%5D/", "/%5E/", "/%7B/", "/%7C/", "/%7D/", "/%7E/", "/\\./");
    $rep_pat = array("-", "-", "", "", "", "-100", "", "-", "", "", "", "-", "", "", "", "-", "", "", "-at-", "", "-", "", "-", "", "-", "", "-", "");
    $title = preg_replace($pattern, $rep_pat, $title);
    // Transformation des caractères accentués
    //                  è        é        ê        ë        ç        à        â        ä        î        ï        ù        ü        û        ô        ö
    $pattern = array("/%B0/", "/%E8/", "/%E9/", "/%EA/", "/%EB/", "/%E7/", "/%E0/", "/%E2/", "/%E4/", "/%EE/", "/%EF/", "/%F9/", "/%FC/", "/%FB/", "/%F4/", "/%F6/");
    $rep_pat = array("-", "e", "e", "e", "e", "c", "a", "a", "a", "i", "i", "u", "u", "u", "o", "o");
    $title = preg_replace($pattern, $rep_pat, $title);
    if (sizeof($title) > 0) {
        if ($withExt) {
            $title .= '.html';
        }
        return $title;
    } else {
        return '';
    }
}
function b_mylinks_top_show($options)
{
    global $xoopsDB;
    $block = array();
    //ver2.5
    $modulename = basename(dirname(dirname(__FILE__)));
    $myts =& MyTextSanitizer::getInstance();
    $result = $xoopsDB->query("SELECT lid, cid, title, date, hits FROM " . $xoopsDB->prefix("mylinks_links") . " WHERE status>0 ORDER BY " . $options[0] . " DESC", $options[1], 0);
    while ($myrow = $xoopsDB->fetchArray($result)) {
        $link = array();
        $title = $myts->htmlSpecialChars($myrow['title']);
        //        if ( !XOOPS_USE_MULTIBYTES ) {
        if (mb_strlen($myrow['title']) >= $options[2]) {
            $title = $myts->htmlSpecialChars(mb_substr($myrow['title'], 0, $options[2] - 1)) . "...";
        }
        //        }
        $link['id'] = $myrow['lid'];
        $link['cid'] = $myrow['cid'];
        $link['title'] = $title;
        if ($options[0] == "date") {
            $link['date'] = formatTimestamp($myrow['date'], 's');
        } elseif ($options[0] == "hits") {
            $link['hits'] = $myrow['hits'];
        }
        $block['links'][] = $link;
    }
    if (!empty($block)) {
        // only show block if there's data to display
        $block['mylinks_weburl'] = XOOPS_URL . "/modules/{$modulename}";
    }
    return $block;
}
function b_shortcut_show($options)
{
    global $xoopsDB, $xoopsUser, $xoopsModule;
    $myts =& MyTextSanitizer::getInstance();
    include_once dirname(dirname(__FILE__)) . "/functions.php";
    $mydirname = basename(dirname(dirname(__FILE__)));
    $block = array();
    $action = '';
    if ($options[0]) {
        if (!is_object($xoopsUser)) {
            return $block;
        }
        $uid = $xoopsUser->getVar('uid');
        if (is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $mydirname) {
            $module =& $xoopsModule;
        } else {
            $module_handler =& xoops_gethandler('module');
            $module =& $module_handler->getByDirname($mydirname);
        }
        if ($xoopsUser->isAdmin($module->getVar('mid'))) {
            $action = XOOPS_URL . "/modules/{$mydirname}/register.php";
        }
    } else {
        $uid = 0;
        $action = XOOPS_URL . "/modules/{$mydirname}/admin/index.php?op=edit";
    }
    $block['links'] = shortcut_links($uid, $thispage);
    $block['action'] = $action;
    $block['thispage'] = htmlspecialchars($thispage);
    return $block;
}
Beispiel #11
0
	function getRSSItems( &$items )
	{
		// check module_read permission
		$module_handler =& xoops_gethandler( 'module' ) ;
		$module =& $module_handler->getByDirname( $this->mydirname ) ;
		$gperm_handler =& xoops_gethandler( 'groupperm' ) ;
		$can_read = $gperm_handler->checkRight( 'module_read' , $module->getVar('mid') , XOOPS_GROUP_ANONYMOUS ) ;
		if( ! $can_read ) return ;

		// check config (feed_as_backend)
		$config_handler =& xoops_gethandler( 'config' ) ;
		$mod_config =& $config_handler->getConfigsByCat( 0 , $module->getVar( 'mid' ) ) ;
		if( empty( $mod_config['feed_as_backend'] ) ) {
			return ;
		}

		$myts =& MyTextSanitizer::getInstance();
		$articles = Bulletin::getAllPublished( $this->mydirname , 10 , 0 , 0 , 1 , true, true, true) ;//ver3.0 changed
		foreach( $articles as $article ) {
			$hometext = $article->getVar('hometext','n') ;
			if( function_exists( 'easiestml' ) ) {
				$hometext = easiestml( $hometext ) ;
			}
			$items[] = array(
				'pubdate' => $article->getVar('published') ,
				'title' => htmlspecialchars(bulletin_utf8_encode($article->getVar('title', 'n')), ENT_QUOTES),
				'category' => htmlspecialchars(bulletin_utf8_encode($article->newstopic->topic_title), ENT_QUOTES),
				'link' => XOOPS_URL.'/modules/'.$this->mydirname.'/index.php?page=article&amp;storyid='.$article->getVar('storyid') ,
				'guid' => XOOPS_URL.'/modules/'.$this->mydirname.'/index.php?page=article&amp;storyid='.$article->getVar('storyid') ,
				'description' => bulletin_utf8_encode(htmlspecialchars(strip_tags($myts->xoopsCodeDecode($hometext)), ENT_QUOTES)),
			) ;
		}
	}
Beispiel #12
0
function PrintDouble($msg_id)
{
    global $xoopsDB, $xoopsConfig, $xoopsModule, $story, $xoops_meta_keywords, $xoops_meta_description;
    $myts =& MyTextSanitizer::getInstance();
    $size = count($msg_id);
    $msg =& $msg_id;
    echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">';
    echo '<html><head>';
    echo "<title>" . $xoopsConfig['sitename'] . "</title>\n";
    echo '<meta http-equiv="Content-Type" content="text/html; charset=' . _CHARSET . '" />';
    echo '<meta name="AUTHOR" content="' . $xoopsConfig['sitename'] . '" />';
    echo "<meta name='COPYRIGHT' content='Copyright (c) " . date('Y') . " by " . $xoopsConfig['sitename'] . "' />\n";
    echo "<meta name='DESCRIPTION' content='" . $xoopsConfig['slogan'] . "' />\n";
    echo "<meta name='GENERATOR' content='" . XOOPS_VERSION . "' />\n\n\n";
    echo "<body bgcolor='#ffffff' text='#000000' onload='window.print()'>\r\n    <div style='width: 750px; border: 1px solid #000; padding: 20px;'>\r\n\t \t  <div style='text-align: center; display: block; margin: 0 0 6px 0;'>\r\n\t\t  <img src='" . XOOPS_URL . "/modules/mpmanager/images/mp_logo.png' border='0' alt='' />\r\n\t\t  <br />\r\n\t\t  <br />\r\n\t\t  ";
    for ($i = 0; $i < $size; $i++) {
        $res = $xoopsDB->query("SELECT subject, from_userid, to_userid, msg_time, msg_text from " . $xoopsDB->prefix("priv_msgsave") . " where msg_id= '" . $msg_id[$i] . "'");
        list($subject, $from_userid, $to_userid, $msg_time, $msg_text) = $xoopsDB->fetchRow($res);
        echo '<h3 style=\'margin: 0;\'>' . $subject . '</h3> 
    <div align=\'center\'><small><b>' . _MP_POSTED . '</b>&nbsp;' . formatTimestamp($msg_time) . ' |  <b>' . _MP_FROM2 . '</b>: ' . XoopsUser::getUnameFromId($from_userid) . ' |  <b>' . _MP_SUBJECT . '</b>&nbsp;' . $myts->htmlSpecialChars($subject) . '</small></div><br /><br />
	<div style=\'text-align: center; display: block; padding-bottom: 12px; margin: 0 0 6px 0;\'></div>
	<div style=\'text-align: left\'><tr valign="top" style="font:12px;"><td>' . $msg_text . '</div><br />
	<div style=\'padding-top: 12px; border-top: 2px solid #ccc;\'></div><br />
	<br /><br />';
    }
    printf(_MP_THISCOMESFROM, htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES));
    echo '<br /><a href="' . XOOPS_URL . '/">' . XOOPS_URL . '</a><br />
    	</div></div>
    	</body>
    	</html>
    	';
}
function b_sitemap_soapbox()
{
    global $xoopsUser;
    $ret = array();
    $db =& Database::getInstance();
    $myts =& MyTextSanitizer::getInstance();
    //get soapbox module object for readable columnIDs check
    $module_handler =& xoops_gethandler('module');
    $soapbox = $module_handler->getByDirname('soapbox');
    if (!is_object($soapbox)) {
        return $sitemap;
    }
    $module_mid = $soapbox->getVar('mid');
    //groups for readable columnIDs check
    $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
    //get readable columnIDs
    $gperm_handler =& xoops_gethandler('groupperm');
    $gperm_name = 'Column Permissions';
    $i = 0;
    $url = 'column.php?columnID=';
    $sql = 'SELECT columnID, name FROM ' . $db->prefix('sbcolumns') . ' ORDER BY weight';
    if (!($result = $db->query($sql))) {
        return $sitemap;
    }
    while (list($columnID, $name) = $db->fetchRow($result)) {
        $columnID = intval($columnID);
        if ($gperm_handler->checkRight($gperm_name, $columnID, $groups, $module_mid)) {
            $ret["parent"][] = array("id" => $columnID, "title" => $myts->makeTboxData4Show($name), "url" => $url . $columnID);
        }
    }
    return $ret;
}
 function &art_getWriterNameFromIds($writer_ids, $linked = false)
 {
     if (!is_array($writer_ids)) {
         $writer_ids = array($writer_ids);
     }
     $userid = array_map("intval", array_filter($writer_ids));
     $myts =& MyTextSanitizer::getInstance();
     $users = array();
     if (count($userid) > 0) {
         $sql = 'SELECT writer_id, writer_name FROM ' . art_DB_prefix("writer") . ' WHERE writer_id IN(' . implode(",", array_unique($userid)) . ')';
         if (!($result = $GLOBALS['xoopsDB']->query($sql))) {
             //xoops_error("writer query error: " . $sql);
             return $users;
         }
         mod_loadFunctions("url", $GLOBALS["artdirname"]);
         while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) {
             $uid = $row["writer_id"];
             $users[$uid] = $myts->htmlSpecialChars($row["writer_name"]);
             if ($linked) {
                 $users[$uid] = '<a href="' . art_buildUrl(XOOPS_URL . "/modules/" . $GLOBALS["artdirname"] . "/view.writer.php", array("writer" => $uid)) . '">' . $users[$uid] . '</a>';
             }
         }
     }
     return $users;
 }
Beispiel #15
0
function showcaseComponentsShow($options)
{
    include XOOPS_ROOT_PATH . "/modules/spotlight/components/showcase/config.php";
    $sp_handler =& xoops_getmodulehandler('spotlight', 'spotlight');
    $page_handler =& xoops_getmodulehandler('page', 'spotlight');
    // spotlight object
    $sp_obj = $sp_handler->get($options[0]);
    if (!is_object($sp_obj) || empty($options[0])) {
        trigger_error("spotlight is not object ", E_USER_WARNING);
    } else {
        //spotlight name
        $block['sp_name'] = $sp_obj->getVar('sp_name');
        // page list
        $criteria = new CriteriaCompo();
        $criteria->add(new Criteria('sp_id', $options[0]));
        $criteria->setLimit($config['limit']);
        $criteria->setSort($config['sort']);
        $criteria->setOrder('ASC');
        $pages = $page_handler->getAll($criteria, array('page_id', 'page_title', 'page_link', 'page_image', 'page_desc', 'published'), false);
        $myts = MyTextSanitizer::getInstance();
        foreach ($pages as $k => $v) {
            $block['news'][$k] = $v;
            $block['news'][$k]['images'] = XOOPS_UPLOAD_URL . '/spotlight/image_' . $v['page_image'];
            $block['news'][$k]['thumbs'] = XOOPS_UPLOAD_URL . '/spotlight/thumb_' . $v['page_image'];
            $page_desc = strip_tags($myts->undoHtmlSpecialChars(strip_tags($v['page_desc'])));
            $block['news'][$k]['page_desc'] = xoops_substr($page_desc, '', $config['page_desc_substr']);
            $block['news'][$k]['page_title'] = xoops_substr($v['page_title'], '', $config['page_title_substr']);
            $block['news'][$k]['published'] = formatTimestamp($v['published'], $config['timeformat']);
        }
        // component name
        $block['component'] = $sp_obj->getVar('component_name');
        return $block;
    }
}
Beispiel #16
0
function b_news_top_show($options)
{
    global $xoopsDB;
    $myts =& MyTextSanitizer::getInstance();
    $block = array();
    $sql = "SELECT storyid, title, published, expired, counter FROM " . $xoopsDB->prefix("stories") . " WHERE published < " . time() . " AND published > 0 AND (expired = 0 OR expired > " . time() . ") ORDER BY " . $options[0] . " DESC";
    $result = $xoopsDB->query($sql, $options[1], 0);
    while ($myrow = $xoopsDB->fetchArray($result)) {
        $news = array();
        $title = $myts->makeTboxData4Show($myrow["title"]);
        if (!XOOPS_USE_MULTIBYTES) {
            if (strlen($myrow['title']) >= $options[2]) {
                $title = $myts->makeTboxData4Show(substr($myrow['title'], 0, $options[2] - 1)) . "...";
            }
        }
        $news['title'] = $title;
        $news['id'] = $myrow['storyid'];
        if ($options[0] == "published") {
            $news['date'] = formatTimestamp($myrow['published'], "s");
        } elseif ($options[0] == "counter") {
            $news['hits'] = $myrow['counter'];
        }
        $block['stories'][] = $news;
    }
    return $block;
}
Beispiel #17
0
function b_cjaycontent_show($options)
{
    global $xoopsDB, $xoopsConfig;
    $myts =& MyTextSanitizer::getInstance();
    $block = array();
    $block['title'] = _FC_BLOCK_TITLE;
    $block['content'] = "<small>";
    // Query Database for link generation
    $result = $xoopsDB->query("SELECT id, title, hits, weight FROM " . $xoopsDB->prefix() . "_cjaycontent WHERE hide=0 ORDER BY weight");
    // generate links
    while ($fc_item = $xoopsDB->fetchArray($result)) {
        $fc_title = $myts->makeTboxData4Show($fc_item['title']);
        // shorten linktitles to fit into the block
        if (!XOOPS_USE_MULTIBYTES) {
            if (strlen($fc_title) >= 40) {
                $fc_title = substr($fc_title, 0, 39) . "...";
            }
        }
        if (substr($fc_title, 0, 2) != "..") {
            $block['content'] .= "&nbsp;&nbsp;<strong><big>&middot;</big></strong>&nbsp;<a href=\"" . XOOPS_URL . "/modules/cjaycontent/index.php?id=" . $fc_item['id'] . "\">" . $fc_title . "</a>";
        } else {
            $block['content'] .= "<strong>" . substr($fc_title, 2, strlen($fc_title) - 2) . "</strong>&nbsp;";
        }
        // there will be an hits-display coded in later versions
        //
        $block['content'] .= "<br />";
    }
    $block['content'] .= "</small>";
    return $block;
}
 function adminMenu($currentoption = 0)
 {
     /* Nice buttons styles */
     global $xoopsConfig, $xoopsModule;
     $module_handler =& xoops_gethandler('module');
     $xoopsModule = $module_handler->getByDirname('xcurl');
     $dirname = $xoopsModule->getVar('dirname');
     echo "\r\n    \t<style type='text/css'>\r\n\t\t#form {float:left; width:100%; background: #e7e7e7 url('" . XOOPS_URL . "/modules/{$dirname}/images/bg.gif') repeat-x left bottom; font-size:93%; line-height:normal; border-bottom: 1px solid black; border-top: 1px solid black; border-left: 1px solid black; border-right: 1px solid black;}\r\n\t\t    \t#buttontop { float:left; width:100%; background: #e7e7e7; font-size:93%; line-height:normal; border-top: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; margin: 0; }\r\n    \t#buttonbar { float:left; width:100%; background: #e7e7e7 url('" . XOOPS_URL . "/modules/{$dirname}/images/bg.gif') repeat-x left bottom; font-size:93%; line-height:normal; border-left: 1px solid black; border-right: 1px solid black; margin-bottom: 0px; border-bottom: 1px solid black; }\r\n    \t#buttonbar ul { margin:0; margin-top: 15px; padding:10px 10px 0; list-style:none; }\r\n\t\t  #buttonbar li { display:inline; margin:0; padding:0; }\r\n\t\t  #buttonbar a { float:left; background:url('" . XOOPS_URL . "/modules/{$dirname}/images/left_both.gif') no-repeat left top; margin:0; padding:0 0 0 9px;  text-decoration:none; }\r\n\t\t  #buttonbar a span { float:left; display:block; background:url('" . XOOPS_URL . "/modules/{$dirname}/images/right_both.gif') no-repeat right top; padding:5px 15px 4px 6px; font-weight:bold; color:#765; }\r\n\t\t  /* Commented Backslash Hack hides rule from IE5-Mac \\*/\r\n\t\t  #buttonbar a span {float:none;}\r\n\t\t  /* End IE5-Mac hack */\r\n\t\t  #buttonbar a:hover span { color:#333; }\r\n\t\t  #buttonbar #current a { background-position:0 -150px; border-width:0; }\r\n\t\t  #buttonbar #current a span { background-position:100% -150px; padding-bottom:5px; color:#333; }\r\n\t\t  #buttonbar a:hover { background-position:0% -150px; }\r\n\t\t  #buttonbar a:hover span { background-position:100% -150px; }\r\n\t\t  </style>";
     // global $xoopsDB, $xoopsModule, $xoopsConfig, $xoopsModuleConfig;
     $myts =& MyTextSanitizer::getInstance();
     $tblColors = array();
     // $adminmenu=array();
     if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/modinfo.php')) {
         include_once XOOPS_ROOT_PATH . '/modules/xcurl/language/' . $xoopsConfig['language'] . '/modinfo.php';
     } else {
         include_once XOOPS_ROOT_PATH . '/modules/xcurl/language/english/modinfo.php';
     }
     echo "<table width=\"100%\" border='0'><tr><td>";
     echo "<div id='buttontop'>";
     echo "<table style=\"width: 100%; padding: 0; \" cellspacing=\"0\"><tr>";
     echo "<td style=\"width: 45%; font-size: 10px; text-align: left; color: #2F5376; padding: 0 6px; line-height: 18px;\"><a class=\"nobutton\" href=\"" . XOOPS_URL . "/modules/system/admin.php?fct=preferences&amp;op=showmod&amp;mod=" . $xoopsModule->getVar('mid') . "\">" . _PREFERENCES . "</a></td>";
     echo "<td style='font-size: 10px; text-align: right; color: #2F5376; padding: 0 6px; line-height: 18px;'><b>" . $myts->displayTarea($xoopsModule->name()) . "</td>";
     echo "</tr></table>";
     echo "</div>";
     echo "<div id='buttonbar'>";
     echo "<ul>";
     foreach ($xoopsModule->getAdminMenu() as $key => $value) {
         $tblColors[$key] = '';
         $tblColors[$currentoption] = 'current';
         echo "<li id='" . $tblColors[$key] . "'><a href=\"" . XOOPS_URL . "/modules/" . $xoopsModule->getVar('dirname') . "/" . $value['link'] . "\"><span>" . $value['title'] . "</span></a></li>";
     }
     echo "</ul></div>";
     echo "</td></tr>";
     echo "<tr'><td><div id='form'>";
 }
Beispiel #19
0
function publisher_date_to_date_show($options)
{
    $myts = MyTextSanitizer::getInstance();
    $publisher = PublisherPublisher::getInstance();
    $block = array();
    $criteria = new CriteriaCompo();
    $criteria->add(new Criteria('datesub', strtotime($options[0]), '>'));
    $criteria->add(new Criteria('datesub', strtotime($options[1]), '<'));
    $criteria->setSort('datesub');
    $criteria->setOrder('DESC');
    // creating the ITEM objects that belong to the selected category
    $itemsObj = $publisher->getHandler('item')->getObjects($criteria);
    $totalItems = count($itemsObj);
    if ($itemsObj) {
        for ($i = 0; $i < $totalItems; $i++) {
            $newItems['itemid'] = $itemsObj[$i]->itemid();
            $newItems['title'] = $itemsObj[$i]->title();
            $newItems['categoryname'] = $itemsObj[$i]->getCategoryName();
            $newItems['categoryid'] = $itemsObj[$i]->categoryid();
            $newItems['date'] = $itemsObj[$i]->datesub();
            $newItems['poster'] = $itemsObj[$i]->linkedPosterName();
            $newItems['itemlink'] = $itemsObj[$i]->getItemLink(false, isset($options[3]) ? $options[3] : 65);
            $newItems['categorylink'] = $itemsObj[$i]->getCategoryLink();
            $block['items'][] = $newItems;
        }
        $block['lang_title'] = _MB_PUBLISHER_ITEMS;
        $block['lang_category'] = _MB_PUBLISHER_CATEGORY;
        $block['lang_poster'] = _MB_PUBLISHER_POSTEDBY;
        $block['lang_date'] = _MB_PUBLISHER_DATE;
        $modulename = $myts->displayTarea($publisher->getModule()->getVar('name'));
        $block['lang_visitItem'] = _MB_PUBLISHER_VISITITEM . " " . $modulename;
        $block['lang_articles_from_to'] = sprintf(_MB_PUBLISHER_ARTICLES_FROM_TO, $options[0], $options[1]);
    }
    return $block;
}
Beispiel #20
0
function webshow_iteminfo($items, $limit = 0, $offset = 0)
{
    global $xoopsDB;
    $ret = array();
    $URL_MOD = XOOPS_URL . "/modules/webshow";
    $sql = "SELECT l.lid, l.title as ltitle, l.date, l.cid, l.submitter, l.hits, l.comments, t.description, c.cattitle as ctitle\r\n    FROM " . $xoopsDB->prefix("webshow_links") . " l, " . $xoopsDB->prefix("webshow_text") . " t, " . $xoopsDB->prefix("webshow_cat") . " c\r\n    WHERE l.lid IN (" . implode(',', $items) . ")\r\n    AND t.lid=l.lid\r\n    AND l.cid=c.cid\r\n    AND l.status>0\r\n    ORDER BY l.date DESC";
    $result = $xoopsDB->query($sql, $limit, $offset);
    $i = 0;
    while ($row = $xoopsDB->fetchArray($result)) {
        $ret[$i]['link'] = $URL_MOD . "/singlelink.php?lid=" . $row['lid'];
        $ret[$i]['cat_link'] = $URL_MOD . "/viewcat.php?cid=" . $row['cid'];
        $ret[$i]['title'] = $row['ltitle'];
        $ret[$i]['time'] = $row['date'];
        $ret[$i]['id'] = $row['lid'];
        // uid
        $ret[$i]['uid'] = $row['submitter'];
        // category
        $ret[$i]['cat_name'] = $row['ctitle'];
        // counter
        $ret[$i]['hits'] = $row['hits'];
        // comments
        $ret[$i]['replies'] = $row['comments'];
        // description
        $myts =& MyTextSanitizer::getInstance();
        $html = 1;
        $smiley = 1;
        $xcodes = 1;
        $ret[$i]['description'] = $myts->displayTarea($row['description'], $html, $smiley, $xcodes);
        $i++;
    }
    return $ret;
}
/**
 * @param $path
 * @param $valid
 *
 * @return string
 */
function genPathCheckHtml($path, $valid)
{
    $myts = MyTextSanitizer::getInstance();
    if ($valid) {
        switch ($path) {
            case 'lib':
            case 'data':
            default:
                $msg = XOOPS_PATH_FOUND;
                break;
        }
        $msg = $myts->htmlspecialchars($msg, ENT_QUOTES, _UPGRADE_CHARSET, false);
        return '<span class="result-y">y</span> ' . $msg;
    } else {
        switch ($path) {
            case 'lib':
            case 'data':
            default:
                $msg = ERR_COULD_NOT_ACCESS;
                break;
        }
        $msg = $myts->htmlspecialchars($msg, ENT_QUOTES, _UPGRADE_CHARSET, false);
        return '<span class="result-x">x</span> ' . $msg;
    }
}
Beispiel #22
0
function b_wfs_down_show($options)
{
    global $xoopsDB;
    $myts =& MyTextSanitizer::getInstance();
    $block = array();
    $sql = "SELECT fileid, filerealname, filetext ,articleid, fileshowname, date, ext, minetype, downloadname, counter, filedescript, groupid FROM " . $xoopsDB->prefix("wfs_files") . " ORDER BY " . $options[0] . " DESC";
    $result = $xoopsDB->query($sql, $options[1], 0);
    while ($myrow = $xoopsDB->fetchArray($result)) {
        if (checkAccess($myrow["groupid"])) {
            $wfsd = array();
            $title = $myts->makeTboxData4Show($myrow["fileshowname"]);
            if (!XOOPS_USE_MULTIBYTES) {
                if (strlen($myrow['fileshowname']) >= $options[2]) {
                    $title = $myts->makeTboxData4Show(substr($myrow['fileshowname'], 0, $options[2] - 1)) . "...";
                }
            }
            $wfsd['titledown'] = $title;
            $wfsd['iddown'] = $myrow['articleid'];
            if ($options[0] == "date") {
                $wfsd['date'] = formatTimestamp($myrow['date'], "s");
            } elseif ($options[0] == "counter") {
                $wfsd['date'] = $myrow['counter'];
            }
            $block['download'][] = $wfsd;
        }
    }
    return $block;
}
Beispiel #23
0
 function store()
 {
     $myts =& MyTextSanitizer::getInstance();
     $title = "";
     $imgurl = "";
     $insert = false;
     if (isset($this->topic_title) && $this->topic_title != "") {
         $title = $myts->addSlashes($this->topic_title);
     }
     if (isset($this->topic_imgurl) && $this->topic_imgurl != "") {
         $imgurl = $myts->addSlashes($this->topic_imgurl);
     }
     if (!isset($this->topic_pid) || !is_numeric($this->topic_pid)) {
         $this->topic_pid = 0;
     }
     if (empty($this->topic_id)) {
         $insert = true;
         $this->topic_id = $this->db->genId($this->table . "_topic_id_seq");
         $sql = sprintf("INSERT INTO %s (topic_id, topic_pid, topic_imgurl, topic_title, banner, banner_inherit, forum_id, weight) VALUES (%u, %u, '%s', '%s', '%s', %u, %u, %u)", $this->table, $this->topic_id, $this->topic_pid, $imgurl, $title, $myts->addSlashes($this->banner), $this->banner_inherit, $this->forum_id, $this->weight);
     } else {
         $sql = sprintf("UPDATE %s SET topic_pid = %u, topic_imgurl = '%s', topic_title = '%s', banner='%s', banner_inherit=%u, forum_id=%u, weight=%u WHERE topic_id = %u", $this->table, $this->topic_pid, $imgurl, $title, $myts->addSlashes($this->banner), $this->banner_inherit, $this->forum_id, $this->weight, $this->topic_id);
     }
     if (!$this->db->query($sql)) {
         return false;
     }
     //Added in AMS 2.50 Final.  Fix bug permission not set at add topic
     //if ADD TOPIC
     if ($insert) {
         $this->topic_id = $this->db->getInsertId();
     }
     return true;
 }
function b_show_rmsrv_banners()
{
    global $xoopsDB;
    $myts =& MyTextSanitizer::getInstance();
    $block = array();
    list($num) = $xoopsDB->fetchRow($xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix("rmsrv_banners")));
    if ($num <= 0) {
        return;
    }
    if ($num > 1) {
        $num = $num - 1;
        mt_srand((double) microtime() * 1000000);
        $snum = mt_rand(0, $num);
    } else {
        $snum = 0;
    }
    $sql = "SELECT * FROM " . $xoopsDB->prefix("rmsrv_banners") . " LIMIT {$snum}, 1";
    $result = $xoopsDB->query($sql);
    $row = $xoopsDB->fetchArray($result);
    $rtn = array();
    include_once XOOPS_ROOT_PATH . "/modules/rmservices/include/functions.php";
    if ($row['buy']) {
        $form = FormBuy(ServiceData($row['id_srv'], "nombre"), ServiceData($row['id_srv'], "codigo"), ServiceData($row['id_srv'], "precio"), 'srv');
    }
    $rtn['id'] = $row['id_ban'];
    $rtn['img'] = str_replace('{servicio}', $row['id_srv'], $row['img']);
    $rtn['desc'] = $myts->makeTareaData4Show($row['desc']);
    $rtn['border'] = $row['showborder'];
    $rtn['ids'] = $row['id_srv'];
    $rtn['form'] = $form;
    $block['bann'][] = $rtn;
    return $block;
}
/**
 * Mylinks Random Term Block
 *
 * Xoops Mylinks - a links module
 *
 * You may not change or alter any portion of this comment or credits
 * of supporting developers from this source code or any supporting source code
 * which is considered copyrighted (c) material of the original comment or credit authors.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * @copyright::  &copy; The XOOPS Project http://sourceforge.net/projects/xoops/
 * @license::    http://www.fsf.org/copyleft/gpl.html GNU public license
 * @package::    mylinks
 * @subpackage:: blocks
 * @author::     hsalazar
 * @author::     zyspec (owners@zyspec)
 * @version::    $Id$
 * @since::      File available since Release 3.11
 */
function b_mylinks_random_show()
{
    global $xoopsDB, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsUser;
    $mylinksDir = basename(dirname(dirname(__FILE__)));
    xoops_load('mylinksUtility', $mylinksDir);
    $myts =& MyTextSanitizer::getInstance();
    $block = array();
    $result = $xoopsDB->query("SELECT l.lid, l.cid, l.title, l.url, l.logourl, l.status, l.date, l.hits, l.rating, l.votes, l.comments, t.description FROM " . $xoopsDB->prefix("mylinks_links") . " l, " . $xoopsDB->prefix("mylinks_text") . " t WHERE l.lid=t.lid AND status>0 ORDER BY RAND() LIMIT 0,1");
    if ($result) {
        list($lid, $cid, $ltitle, $url, $logourl, $status, $time, $hits, $rating, $votes, $comments, $description) = $xoopsDB->fetchRow($result);
        $link = $myts->displayTarea(ucfirst($ltitle));
        $description = $myts->displayTarea(mb_substr($description, 0, 100)) . "...";
        $mylinksCatHandler = xoops_getmodulehandler('category', $mylinksDir);
        $catObj = $mylinksCatHandler->get($cid);
        if (is_object($catObj) && !empty($catObj)) {
            $categoryName = $catObj->getVar('title');
            $categoryName = $myts->displayTarea($categoryName);
        } else {
            $cid = 0;
            $categoryName = '';
        }
        $block['title'] = _MB_MYLINKS_RANDOMTITLE;
        $block['content'] = "<div style=\"font-size: 12px; font-weight: bold; background-color: #ccc; padding: 4px; margin: 0;\"><a href=\"" . XOOPS_URL . "/modules/{$mylinksDir}/category.php?cid={$cid}\">{$categoryName}</a></div>";
        $block['content'] .= "<div style=\"padding: 4px 0 0 0; color: #456;\"><h5 style=\"margin: 0;\"><a href=\"" . XOOPS_URL . "/modules/{$mylinksDir}/entry.php?lid={$lid}\">{$link}</a></h5><div>{$description}</div>";
        unset($catObj, $mylinksCatHandler);
        $block['content'] .= "<div style=\"text-align: right; font-size: x-small;\"><a href=\"" . XOOPS_URL . "/modules/{$mylinksDir}/index.php\">" . _MB_MYLINKS_SEEMORE . "</a></div>";
    }
    return $block;
}
Beispiel #26
0
function xoFormFieldCollation($name, $value, $label, $help = '')
{
    $collations = getDbCollations();
    $myts = MyTextSanitizer::getInstance();
    $label = $myts->htmlspecialchars($label, ENT_QUOTES, _UPGRADE_CHARSET, false);
    $name = $myts->htmlspecialchars($name, ENT_QUOTES, _UPGRADE_CHARSET, false);
    $value = $myts->htmlspecialchars($value, ENT_QUOTES);
    $field = "<label for='{$name}'>{$label}</label>\n";
    if ($help) {
        $field .= '<div class="xoform-help">' . $help . "</div>\n";
    }
    $field .= "<select name='{$name}' id='{$name}'\">";
    $field .= "<option value=''>" . DB_COLLATION_NOCHANGE . "</option>";
    $collation_default = "";
    $options = "";
    foreach ($collations as $key => $charset) {
        $field .= "<optgroup label='{$key} - ({$charset['desc']})'>";
        foreach ($charset['collation'] as $collation) {
            $field .= "<option value='{$collation}'" . ($value == $collation ? " selected='selected'" : "") . ">{$collation}</option>";
        }
        $field .= "</optgroup>";
    }
    $field .= "</select>";
    return $field;
}
Beispiel #27
0
function XortifySignupForm()
{
    include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
    $form = new XoopsThemeForm(_AM_SPIDERS_FRM_TITLE, "xortify_member", "", "post");
    $form->addElement(new XoopsFormText(_AM_SPIDERS_FRM_UNAME, "uname", 35, 128, $_REQUEST['uname']));
    $form->addElement(new XoopsFormPassword(_AM_SPIDERS_FRM_PASS, "pass", 35, 128, $_REQUEST['pass']), false);
    $form->addElement(new XoopsFormPassword(_AM_SPIDERS_FRM_VPASS, "vpass", 35, 128, $_REQUEST['vpass']), false);
    $form->addElement(new XoopsFormText(_AM_SPIDERS_FRM_EMAIL, "email", 35, 128, $_REQUEST['email']));
    $form->addElement(new XoopsFormText(_AM_SPIDERS_FRM_URL, "url", 35, 128, $_REQUEST['url']));
    $form->addElement(new XoopsFormRadioYN(_AM_SPIDERS_FRM_VIEWEMAIL, "viewemail", $_REQUEST['viewemail']));
    $form->addElement(new XoopsFormSelectTimezone(_AM_SPIDERS_FRM_TIMEZONE, "timezone", $_REQUEST['timezone']));
    $xortifyAuth =& XortifyAuthFactory::getAuthConnection(false, apimethod());
    $myts =& MyTextSanitizer::getInstance();
    $disclaimer = $xortifyAuth->network_disclaimer();
    if (strlen(trim($disclaimer)) == 0) {
        $disclaimer = _AM_SPIDERS_FRM_NOSOAP_DISCLAIMER;
    }
    $form->addElement(new XoopsFormLabel(_AM_SPIDERS_FRM_DISCLAIMER, $myts->nl2br($disclaimer)));
    $form->addElement(new XoopsFormRadioYN(_AM_SPIDERS_FRM_DISCLAIMER_AGREE, "agree", false));
    $form->addElement(new XoopsFormCaptcha(_AM_SPIDERS_FRM_PUZZEL, 'xoopscaptcha', false), true);
    $form->addElement(new XoopsFormHidden('op', 'signup'));
    $form->addElement(new XoopsFormHidden('fct', 'save'));
    if ($disclaimer != _AM_SPIDERS_FRM_NOSOAP_DISCLAIMER) {
        $form->addElement(new XoopsFormButton('', 'submit', _AM_SPIDERS_FRM_REGISTER, 'submit'));
    }
    return $form->render();
}
function smarty_function_pico_category_search($params, &$smarty)
{
    $dir = @$params['dir'] . @$params['dirname'];
    $cat_title = @$params['title'] . @$params['cat_title'];
    $var_name = @$params['item'] . @$params['assign'];
    if (empty($var_name)) {
        echo 'error ' . __FUNCTION__ . ' [specify item]';
        return;
    }
    if (empty($dir)) {
        $dir = $smarty->get_template_vars('mydirname');
    }
    if (empty($dir)) {
        echo 'error ' . __FUNCTION__ . ' [specify dirname]';
        return;
    }
    $mydirnames = explode(',', $dir);
    $db =& Database::getInstance();
    $myts =& MyTextSanitizer::getInstance();
    $module_handler =& xoops_gethandler('module');
    $config_handler =& xoops_gethandler('config');
    $categories4assign = array();
    foreach ($mydirnames as $mydirname) {
        $module =& $module_handler->getByDirname($mydirname);
        $configs = $config_handler->getConfigList($module->getVar('mid'));
        $sql = "SELECT * FROM " . $db->prefix($mydirname . "_categories") . " c WHERE c.cat_title='" . mysql_real_escape_string($cat_title) . "'";
        $result = $db->query($sql);
        while ($cat_row = $db->fetchArray($result)) {
            $category4assign = array('mod_mid' => $module->getVar('mid'), 'mod_dirname' => $mydirname, 'mod_name' => $module->getVar('name'), 'id' => intval($cat_row['cat_id']), 'link' => pico_common_make_category_link4html($configs, $cat_row), 'title' => $myts->makeTboxData4Show($cat_row['cat_title']), 'desc' => $myts->displayTarea($cat_row['cat_desc'], 1), 'paths_raw' => pico_common_unserialize($cat_row['cat_path_in_tree']), 'paths_value' => array_values(pico_common_unserialize($cat_row['cat_path_in_tree'])), 'redundants' => pico_common_unserialize($cat_row['cat_redundants'])) + $cat_row;
            $categories4assign[] = $category4assign;
        }
    }
    $smarty->assign($var_name, $categories4assign);
}
Beispiel #29
0
 /**
  * @param string  $text
  * @param boolean $keyword
  *
  * @return string
  */
 public function purifyText($text, $keyword = false)
 {
     $text = str_replace('&nbsp;', ' ', $text);
     $text = str_replace('<br />', ' ', $text);
     $text = strip_tags($text);
     $text = html_entity_decode($text);
     $text = $this->_myts->undoHtmlSpecialChars($text);
     $text = str_replace(')', ' ', $text);
     $text = str_replace('(', ' ', $text);
     $text = str_replace(':', ' ', $text);
     $text = str_replace('&euro', ' euro ', $text);
     $text = str_replace('&hellip', '...', $text);
     $text = str_replace('&rsquo', ' ', $text);
     $text = str_replace('!', ' ', $text);
     $text = str_replace('?', ' ', $text);
     $text = str_replace('"', ' ', $text);
     $text = str_replace('-', ' ', $text);
     $text = str_replace('\\n', ' ', $text);
     if ($keyword) {
         $text = str_replace('.', ' ', $text);
         $text = str_replace(',', ' ', $text);
         $text = str_replace('\'', ' ', $text);
     }
     $text = str_replace(';', ' ', $text);
     return $text;
 }
function xoopsSmilies($textarea_id)
{
    $myts =& MyTextSanitizer::getInstance();
    $smiles =& $myts->getSmileys();
    if (empty($smileys)) {
        $db =& Database::getInstance();
        if ($result = $db->query('SELECT * FROM ' . $db->prefix('smiles') . ' WHERE display=1')) {
            while ($smiles = $db->fetchArray($result)) {
                //hack smilies move for the smilies !!
                echo "<img src='" . XOOPS_UPLOAD_URL . "/" . htmlspecialchars($smiles['smile_url']) . "' border='0' onmouseover='style.cursor=\"hand\"' alt='' onclick='xoopsCodeSmilie(\"" . $textarea_id . "\", \" " . $smiles['code'] . " \");' />";
                //fin du hack
            }
        }
    } else {
        $count = count($smiles);
        for ($i = 0; $i < $count; $i++) {
            if ($smiles[$i]['display'] == 1) {
                //hack bis
                echo "<img src='" . XOOPS_UPLOAD_URL . "/" . $myts->oopsHtmlSpecialChars($smiles['smile_url']) . "' border='0' alt='' onclick='xoopsCodeSmilie(\"" . $textarea_id . "\", \" " . $smiles[$i]['code'] . " \");' onmouseover='style.cursor=\"hand\"' />";
                //fin du hack
            }
        }
    }
    //hack for more
    echo "&nbsp;[<a href='#moresmiley' onmouseover='style.cursor=\"hand\"' alt='' onclick='openWithSelfMain(\"" . XOOPS_URL . "/misc.php?action=showpopups&amp;type=smilies&amp;target=" . $textarea_id . "\",\"smilies\",300,475);'>" . _MORE . "</a>]";
}