当前位置: 首页>>代码示例>>PHP>>正文


PHP MyTextSanitizer类代码示例

本文整理汇总了PHP中MyTextSanitizer的典型用法代码示例。如果您正苦于以下问题:PHP MyTextSanitizer类的具体用法?PHP MyTextSanitizer怎么用?PHP MyTextSanitizer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MyTextSanitizer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: load

 /**
  * @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;
 }
开发者ID:redmexico,项目名称:XoopsCore,代码行数:58,代码来源:textfilter.php

示例2: fetchSummary

 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);
 }
开发者ID:nunoluciano,项目名称:uxcl,代码行数:35,代码来源:piCalD3commentContent.class.php

示例3: b_sitemap_xpwiki

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;
}
开发者ID:nao-pon,项目名称:xpWiki,代码行数:32,代码来源:sitemap.plugin.php

示例4: b_mylinks_top_show

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;
}
开发者ID:amjadtbssm,项目名称:website,代码行数:26,代码来源:mylinks_top.php

示例5: wp_dropdown_cats

    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;
        }
    }
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:32,代码来源:admin-functions.php

示例6: search

 /**
  * 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;
 }
开发者ID:redmexico,项目名称:XoopsCore,代码行数:50,代码来源:search.php

示例7: smartsection_seo_title

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 '';
    }
}
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:31,代码来源:seo_functions.php

示例8: b_mylinks_top_show

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;
}
开发者ID:BackupTheBerlios,项目名称:haxoo-svn,代码行数:32,代码来源:mylinks_top.php

示例9: b_shortcut_show

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;
}
开发者ID:nbuy,项目名称:xoops-modules-shortcut,代码行数:31,代码来源:shortcut_block.php

示例10: getRSSItems

	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)),
			) ;
		}
	}
开发者ID:nunoluciano,项目名称:uxcl,代码行数:33,代码来源:preload.php

示例11: PrintDouble

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>
    	';
}
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:32,代码来源:printsav.php

示例12: b_sitemap_soapbox

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;
}
开发者ID:BackupTheBerlios,项目名称:peakxoops-svn,代码行数:32,代码来源:soapbox.php

示例13: array

 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;
 }
开发者ID:trabisdementia,项目名称:xuups,代码行数:25,代码来源:functions.author.php

示例14: showcaseComponentsShow

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;
    }
}
开发者ID:yunsite,项目名称:xoopsdc,代码行数:34,代码来源:show.php

示例15: b_news_top_show

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;
}
开发者ID:amjadtbssm,项目名称:website,代码行数:26,代码来源:news_top.php


注:本文中的MyTextSanitizer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。