Esempio n. 1
0
		function block_download( $mydirname )
		{
			global $xoopsUser ;
			include_once dirname( dirname(__FILE__) ).'/include/mytable.php' ;

			$this->db =& Database::getInstance();
			$this->myts =& d3downloadsTextSanitizer::getInstance() ;
			$this->table = $this->db->prefix( "{$mydirname}_downloads" ) ;
			$this->cat_table = $this->db->prefix( "{$mydirname}_cat" ) ;
			$this->mylink_table = $this->db->prefix( "{$mydirname}_mylink" ) ;
			$this->mydirname = $mydirname ;
			$this->mod_url = XOOPS_URL.'/modules/'.$mydirname ;
			$columns = 'd.'.implode( ',d.' , $GLOBALS['d3download_tables']['downloads'] ) ;
			$columns .= ', c.title AS category';
			$this->columns = $columns ;
			$module_handler =& xoops_gethandler('module') ;
			$module =& $module_handler->getByDirname( $mydirname ) ;
			if( is_object( $xoopsUser ) ) {
				$this->xoops_isuser = true ;
				$this->xoops_userid = $xoopsUser->getVar('uid') ;
				$mid = $module->getVar('mid') ;
				$this->xoops_isadmin = $xoopsUser->isAdmin( $mid ) ;
			} else {
				$this->xoops_isuser = false ;
				$this->xoops_userid = 0 ;
				$this->xoops_isadmin = false ;
			}
		}
Esempio n. 2
0
		function rate_download( $mydirname, $mode='' )
		{
			include_once dirname( dirname(__FILE__) ).'/include/mytable.php' ;

			$this->db =& Database::getInstance();
			$this->myts =& d3downloadsTextSanitizer::getInstance() ;
			$this->mod_url = XOOPS_URL.'/modules/'.$mydirname ;
			$this->table = $this->db->prefix( "{$mydirname}_votedata" ) ;
			$this->downloads_table = $this->db->prefix( "{$mydirname}_downloads" ) ;
			$this->mydirname = $mydirname ;
			$this->mod_url = XOOPS_URL.'/modules/'.$mydirname ;
			$columns = implode( ',' , $GLOBALS['d3download_tables']['votedata'] ) ;
			$this->columns = $columns ;
			if( $mode == 'Rate' ) {
				global $xoopsUser ;
				$this->newid = $this->db->genId( $this->table."_reportid_seq" );
				if( is_object( $xoopsUser ) ) {
					$this->ratinguser = $xoopsUser->getVar('uid') ;
				} else {
					$this->ratinguser = 0 ;
				}
				$this->rating = intval( $_POST['rating'] );
				$this->ratinghostname = getenv( "REMOTE_ADDR" );
				$this->ratingtimestamp = time();
				$this->yesterday = ( time() - ( 86400 * $this->anonwaitdays ) ) ;
			}
		}
		function fetchSummary( $external_link_id )
		{
			require_once dirname( dirname(__FILE__) ).'/class/d3downloads.textsanitizer.php' ;

			$db =& Database::getInstance() ;
			$myts =& d3downloadsTextSanitizer::getInstance() ;

			$module_handler =& xoops_gethandler( 'module' ) ;
			$module =& $module_handler->getByDirname( $this->mydirname ) ;

			$lid = intval( $external_link_id ) ;
			$mydirname = $this->mydirname ;
			if( preg_match( '/[^0-9a-zA-Z_-]/' , $mydirname ) ) die( 'Invalid mydirname' ) ;

			$sql = "SELECT lid, cid, title, description, filters FROM ".$db->prefix( $mydirname."_downloads" )." WHERE lid='".$lid."'" ;
			$myrow = $db->fetchArray( $db->query( $sql ) ) ;
			if( empty( $myrow ) ) return '' ;

			$cid = intval( $myrow['cid'] ) ;
			$uri = XOOPS_URL.'/modules/'.$mydirname.'/index.php?page=singlefile&cid='.$cid.'&lid='.$lid ;
			$filters = $myts->makeTboxData4Show( $myrow['filters'] ) ;
			$str = strip_tags( $myts->displayTarea( strip_tags( $myrow['description'] ), 0, 1, 1, 1, 1, $filters ) ) ;
			$summary = xoops_substr( $str , 0 , 255 ) ;

			return array(
				'dirname' => $mydirname ,
				'module_name' => $module->getVar( 'name' ) ,
				'subject' => $myts->makeTboxData4Show( $myrow['title'] ) ,
				'uri' => $uri ,
				'summary' => $summary ,
			) ;
		}
Esempio n. 4
0
		function user_access( $mydirname )
		{
			global $xoopsUser ;
			include_once dirname( dirname(__FILE__) ).'/include/mytable.php' ;

			$this->db =& Database::getInstance() ;
			$this->myts =& d3downloadsTextSanitizer::getInstance() ;
			$this->mydirname = $mydirname ;
			$this->table = $this->db->prefix( "{$mydirname}_user_access" ) ;
			$this->cat_table = $this->db->prefix( "{$mydirname}_cat" ) ;
			$module_handler =& xoops_gethandler('module') ;
			$module =& $module_handler->getByDirname( $mydirname ) ;
			if( is_object( $xoopsUser ) ) {
				$this->xoops_isuser = true ;
				$this->xoops_userid = $xoopsUser->getVar('uid') ;
				$mid = $module->getVar('mid') ;
				$this->xoops_isadmin = $xoopsUser->isAdmin( $mid ) ;
			} else {
				$this->xoops_isuser = false ;
				$this->xoops_userid = 0 ;
				$this->xoops_isadmin = false ;
			}
			// set sql4permission check
			$this->sql4cat_ids = "SELECT distinct u.cid,c.cids_child FROM ".$this->table." u LEFT JOIN ".$this->cat_table." c ON u.cid=c.cid WHERE c.pid ='0'" ;

			// set array4user_access
			$this->array4user_access = array_diff( $GLOBALS['d3download_tables']['user_access'] , array( 'cid' , 'uid' , 'groupid' ) ) ;

			// table columns
			$this->columns4group = implode( ',' , $this->array4user_access ) ;
			$this->columns4user = '******';
			$this->columns4user .=  ',a.'.implode( ',a.' , $this->array4user_access ) ;
		}
Esempio n. 5
0
		function history_download( $mydirname, $id= 0 )
		{
			include_once dirname( dirname(__FILE__) ).'/include/mytable.php' ;
			$this->db =& Database::getInstance();
			$this->myts =& d3downloadsTextSanitizer::getInstance() ;
			$this->mod_url = XOOPS_URL.'/modules/'.$mydirname ;
			$this->table = $this->db->prefix( "{$mydirname}_downloads_history" ) ;
			$this->cat_table = $this->db->prefix( "{$mydirname}_cat" ) ;
			$this->downloads_table = $this->db->prefix( "{$mydirname}_downloads" ) ;
			$this->mydirname = $mydirname ;
			$this->mod_url = XOOPS_URL.'/modules/'.$mydirname ;
			$columns = 'h.'.implode( ',h.' , $GLOBALS['d3download_tables']['downloads_history'] ) ;
			$columns .= ', c.title AS category';
			$this->columns = $columns ;
			$columns4list = implode( ',' , $GLOBALS['d3download_tables']['downloads_history'] ) ;
			$this->columns4list = $columns4list ;
			$module_handler =& xoops_gethandler('module');
			$config_handler =& xoops_gethandler('config');
			$module =& $module_handler->getByDirname( $mydirname );
			$mod_config =& $config_handler->getConfigsByCat( 0, $module->getVar( 'mid' ) );
			$this->mod_config = $mod_config ;
			if( ! empty( $id ) ) {
				$this->GetMyDownload( $id ) ;
			}
		}
Esempio n. 6
0
		function spam_check( $mydirname )
		{
			global $xoopsUser ;

			$this->myts =& d3downloadsTextSanitizer::getInstance() ;
			$this->xoops_isuser = ( is_object( $xoopsUser ) ) ? true : false ;
			$this->my_session   = $mydirname.'_spam_check' ;
			$this->str_list     = array_merge( range( 'a', 'z' ), range( 'A', 'Z' ), range( 0, 9 ) ) ;
			$url_info           = parse_url( XOOPS_URL ) ;
			$this->my_host      = ( ! empty( $url_info['host'] ) ) ? $url_info['host'] : '' ;
		}
Esempio n. 7
0
		function submit_download( $mydirname )
		{
			include_once dirname( dirname(__FILE__) ).'/include/mytable.php' ;

			$this->db =& Database::getInstance();
			$this->myts =& d3downloadsTextSanitizer::getInstance() ;
			$this->table = $this->db->prefix( "{$mydirname}_downloads" ) ;
			$this->mydirname = $mydirname ;
			$this->mod_url = XOOPS_URL.'/modules/'.$mydirname ;
			$columns = implode( ',' , $GLOBALS['d3download_tables']['downloads'] ) ;
			$this->columns = $columns ;
			$module_handler =& xoops_gethandler('module');
			$config_handler =& xoops_gethandler('config');
			$module =& $module_handler->getByDirname( $mydirname );
			$mod_config =& $config_handler->getConfigsByCat( 0, $module->getVar( 'mid' ) );
			$this->mod_config = $mod_config ;
		}
Esempio n. 8
0
		function Submit_Validate( $mydirname="", $mode="" )
		{
			if( ! empty( $mydirname ) ) $this->mydirname = $mydirname ;
			if( ! empty( $mode ) ) $this->mode = $mode ;

			if( ! empty( $mydirname ) ) {
				global $xoopsUser ;

				$this->db =& Database::getInstance();
				$this->myts =& d3downloadsTextSanitizer::getInstance() ;
				$this->table = $this->db->prefix( "{$mydirname}_downloads" ) ;
				$this->post_check = new Post_Check() ;
				$this->user_access = new user_access( $mydirname ) ;
				if( isset( $_POST['myencode'] ) && extension_loaded( 'mbstring' ) ) {
					$this->encode = mb_detect_encoding( $_POST['myencode'] );
				} else {
					$this->encode = "";
				}
				$module_handler =& xoops_gethandler('module');
				$config_handler =& xoops_gethandler('config');
				$module =& $module_handler->getByDirname( $mydirname );
				$mod_config =& $config_handler->getConfigsByCat( 0, $module->getVar( 'mid' ) );
				$this->mod_config = $mod_config ;
				if( is_object( $xoopsUser ) ) {
					$this->xoops_isuser = true ;
					$this->xoops_userid = $xoopsUser->getVar('uid') ;
					$mid = $module->getVar('mid') ;
					$this->xoops_isadmin = $xoopsUser->isAdmin( $mid ) ;
					$this->xoops_groups = $xoopsUser->getGroups() ;
				} else {
					$this->xoops_isuser = false ;
					$this->xoops_userid = 0 ;
					$this->xoops_isadmin = false ;
					$this->xoops_groups = intval( XOOPS_GROUP_ANONYMOUS ) ;
				}

				// Delete_Nullbyte
				$_POST = $this->myts->Delete_Nullbyte( $_POST ) ;

				// Encoding_Check
				if( extension_loaded( 'mbstring' ) ) {
					$this->myts->Encoding_Check( $_POST ) ;
				}
			}
		}
Esempio n. 9
0
		function file_manager( $mydirname )
		{
			include_once dirname( dirname(__FILE__) ).'/include/mytable.php' ;
			$this->db =& Database::getInstance();
			$this->myts =& d3downloadsTextSanitizer::getInstance() ;
			$this->table = $this->db->prefix( "{$mydirname}_downloads" ) ;
			$this->cat_table = $this->db->prefix( "{$mydirname}_cat" ) ;
			$this->broken_table = $this->db->prefix( "{$mydirname}_broken" ) ;
			$this->vote_table = $this->db->prefix( "{$mydirname}_votedata" ) ;
			$this->history_table = $this->db->prefix( "{$mydirname}_downloads_history" ) ;
			$this->mydirname = $mydirname ;
			$this->mod_url = XOOPS_URL.'/modules/'.$mydirname ;
			$columns = 'd.'.implode( ',d.' , $GLOBALS['d3download_tables']['downloads'] ) ;
			$columns .= ', c.title AS category';
			$this->columns = $columns ;
			$files = array() ;
			$broken = 0 ;
		}
Esempio n. 10
0
	function d3downloads_xpwiki( $text, $html, $smiley, $xcode, $image, $br )
	{
		if ( ! class_exists( 'd3downloadsTextSanitizer' ) ) {
			require_once dirname( dirname( dirname(__FILE__) ) ).'/class/d3downloads.textsanitizer.php' ;
		}
		$myts =& d3downloadsTextSanitizer::getInstance() ;
		if ( ! class_exists( 'XpWiki' ) ) {
			@ include_once XOOPS_TRUST_PATH.'/modules/xpwiki/include.php' ;
		}
		if( ! class_exists( 'XpWiki' ) ) die( 'xpWiki is not installed correctly' ) ;

		// Get instance. option is xpWiki module's directory name.
		// 引数は、xpWikiをインストールしたディレクトリ名です。
		$wiki =& XpWiki::getSingleton( 'xpwiki' );
	
		// xpWiki の動作を決定する設定値を変更できます。
		// $wiki->setIniConst( '[KEY]' , '[VALUE]' ); // $wiki->root->[KEY] = [VALUE];
		// $wiki->setIniRoot( '[KEY]' , '[VALUE]' );  // $wiki->cont->[KEY] = [VALUE];
	
		// ex, 改行を有効にする
		$wiki->setIniRoot( 'line_break' , 1 );
		// ex. レンダリングキャッシュをする
		$wiki->setIniRoot( 'render_use_cache' , 1 );
		// ex. レンダリングキャッシュの有効期限は新たにページが作成されるまで
		$wiki->setIniRoot( 'render_cache_min' , 0 ); // キャッシュ有効時間(分)
		// ex. 外部リンクの target 属性 '_blank'
		$wiki->setIniRoot( 'link_target' , '_blank' );
	
		if ($html != 1) {
 			// 第二引数は、xpWikiのCSSを適用するためのDIVクラス名
			// 通常インストールしたディレクトリ名です。
			// CSS を適用しない場合は空白 '' でOK。
			$text = $wiki->transform( $text , 'xpwiki' ) ;
		} else {
			$text = $myts->codePreConv( $text, $xcode ) ;
 			$text = $myts->makeClickable( $text );
			if( $smiley != 0 ) $text = $myts->smiley( $text ) ;
		}
		if( $xcode != 0 ) $text = $myts->xoopsCodeDecode( $text, $image ) ;
		if( $html && $br != 0) $text = $myts->nl2Br( $text ) ;
		if( $html ) $text = $myts->codeConv( $text, $xcode, $image ) ;
		$text = $myts->postCodeDecode( $text , $image ) ;
		return $text;
	}
Esempio n. 11
0
		function MyCategory( $mydirname, $mode='', $cid= 0, $whr='' )
		{
			include_once dirname( dirname(__FILE__) ).'/include/mytable.php' ;

			$this->db =& Database::getInstance();
			$this->myts =& d3downloadsTextSanitizer::getInstance() ;
			$this->mydirname = $mydirname ;
			$this->cat_table = $this->db->prefix( "{$mydirname}_cat" ) ;
			$this->downloads_table = $this->db->prefix( "{$mydirname}_downloads" ) ;
			$this->user_access_table = $this->db->prefix( "{$mydirname}_user_access" ) ;
			$this->columns = implode( ',' , $GLOBALS['d3download_tables']['cat'] ) ;
			if( ! empty( $mode ) ) $this->mode = $mode ;
			$this->selectid = ( $cid > 0 ) ? $cid : 0 ;
			if( $mode == 'Show' && ! empty( $cid ) ) {
				$this->GetMyCategory( $cid, $whr ) ;
			}
			if( $mode == 'Edit') {
				require_once dirname( dirname(__FILE__) ).'/class/post_check.php' ;
				$this->post_check = new Post_Check() ;

				// Delete_Nullbyte
				$_POST = $this->myts->Delete_Nullbyte( $_POST ) ;
			}
		}
Esempio n. 12
0
	function d3download_convert_from_wfdownloads( $mydirname, $target_dirname )
	{
		require_once dirname( dirname(__FILE__) ).'/class/d3downloads.textsanitizer.php' ;
		$myts =& d3downloadsTextSanitizer::getInstance() ;
		$db =& Database::getInstance() ;

		$module_handler =& xoops_gethandler('module');
		$config_handler =& xoops_gethandler('config');
		$module =& $module_handler->getByDirname( $target_dirname );
		$mod_config =& $config_handler->getConfigsByCat(0, $module->getVar('mid'));

		if( empty( $mod_config['uploaddir'] ) ){
			$uploads_dir = XOOPS_ROOT_PATH.'/uploads';
		} else {
			$uploads_dir = htmlspecialchars( $mod_config['uploaddir'] , ENT_QUOTES );
		}
		$platform_array = $mod_config['platform'];
		$license_array = $mod_config['license'];
		$drs = $db->query("SELECT lid, url, filename, platform, license, offline FROM ".$db->prefix( $target_dirname."_downloads" )."");
		while( list( $id, $url, $fname, $platform, $license, $offline ) = $db->fetchRow( $drs ) ) {
			$filename = '';
			$f_ext = '';
			$lid = intval( $id );
			if( ! empty( $fname ) ){
				$file = htmlspecialchars( $fname , ENT_QUOTES );
		        $tempname = strrev( $file );
				$filename = strtolower( strrev( substr( $tempname, 0 , strpos( $tempname, "--" ) ) ) );
				$file_path = $uploads_dir.'/'.$file ;
				if ( file_exists( $file_path ) ){
					$f_info = pathinfo( $file_path );
					$f_ext = ( ! empty( $f_info['extension'] ) ) ? strtolower( $f_info['extension'] ) : '' ;
					$new_url4sql = $file_path;
				} else {
					$new_url4sql = addslashes( $url );
				}
			} else {
				$new_url4sql = addslashes( $url );
			}
			$from_platform = intval( $platform );
			$new_platform = $platform_array[$from_platform] ;
			$from_license = intval( $license );
			$new_license = $license_array[$from_license] ;
			if( ! empty( $offline ) ){
				$visible = 0;
			} else {
				$visible = 1;
			}
			$irs = $db->query( "UPDATE ".$db->prefix( $mydirname."_downloads" )." SET url = '".$new_url4sql."',filename = '".$filename."',ext = '".$f_ext."',platform = '".$new_platform."',license = '".$new_license."',visible = '".$visible."' WHERE lid = '".$lid."'");
			if( ! $irs ) d3download_import_errordie( $mydirname ) ;
		}
	}
Esempio n. 13
0
		function broken_report( $mydirname )
		{
			global $xoopsUser ;
			include_once dirname( dirname(__FILE__) ).'/include/mytable.php' ;

			$this->mydirname = $mydirname ;
			$this->db =& Database::getInstance() ;
			$this->myts =& d3downloadsTextSanitizer::getInstance() ;
			$this->check_config = $this->get_option_config( 'broken_check_config' ) ;
			$this->http = $this->My_HTTP() ;
			$this->broken_table = $this->db->prefix( "{$mydirname}_broken" ) ;
			$this->table = $this->db->prefix( "{$mydirname}_downloads" ) ;
			$this->unapproval_table = $this->db->prefix( "{$mydirname}_unapproval" ) ;
			$this->history_table = $this->db->prefix( "{$mydirname}_downloads_history" ) ;
			$this->uploads_dir = XOOPS_TRUST_PATH.'/uploads/'.$this->mydirname ;
			$module_handler =& xoops_gethandler('module') ;
			$config_handler =& xoops_gethandler('config') ;
			$module =& $module_handler->getByDirname( $mydirname ) ;
			$mod_config =& $config_handler->getConfigsByCat( 0, $module->getVar( 'mid' ) ) ;
			$this->mod_config = $mod_config ;
			$this->site_salt = substr( md5( XOOPS_URL ) , -4 ) ;
			if( is_object( $xoopsUser ) ) {
				$this->sender = $xoopsUser->getVar('uid') ;
			} else {
				$this->sender = 0 ;
			}
			$this->ip   = getenv( "REMOTE_ADDR" ) ? getenv( "REMOTE_ADDR" ) : '' ;
			$this->pass = $this->cron_pass() ;
			$this->limit = $this->Total_Num() ;
			$this->offset = 0 ;
	 		foreach( $this->report_txt as $key ) {
				$this->$key =  '' ;
			}
		}
Esempio n. 14
0
	function d3download_delete_nullbyte( $arr )
	{
		require_once dirname( dirname(__FILE__) ).'/class/d3downloads.textsanitizer.php' ;
		$myts =& d3downloadsTextSanitizer::getInstance() ;
		return $myts->Delete_Nullbyte( $arr ) ;
	}
Esempio n. 15
0
	function d3download_ajax_load( $mydirname )
	{
		require_once dirname( dirname(__FILE__) ).'/class/d3downloads.textsanitizer.php' ;

		$myts =& d3downloadsTextSanitizer::getInstance() ;
		$_GET = $myts->Delete_Nullbyte( $_GET ) ;

		$array = array( 'is_file' , 'check_url' , 'check_unapproval' , 'ratefile_check' , 'category_form_validate' , 'logourl_load' , 'str_load' , 'cansel' , 'change_editor' , 'is_fckeditor' ) ;
		$type = ( in_array( $_GET['type'], $array ) ) ? @$_GET['type'] : '' ;

		if( empty( $type ) ) exit ;

		switch( $type ) {
			case 'is_file' :
				d3download_is_file_check( $mydirname ) ;
				break ;
			case 'check_url' :
				d3download_check_url( $mydirname ) ;
				break ;
			case 'check_unapproval' :
				d3download_check_unapproval( $mydirname ) ;
				break ;
			case 'ratefile_check' :
				d3download_ratefile_check( $mydirname ) ;
				break ;
			case 'category_form_validate' :
				d3download_category_form_validate() ;
				break ;
			case 'logourl_load' :
				d3download_logourl_load( $mydirname ) ;
				break ;
			case 'str_load' :
				d3download_str_load( $mydirname ) ;
				break ;
			case 'cansel' :
				d3download_cansel_load( $mydirname ) ;
				break ;
			case 'change_editor' :
				d3download_change_editor() ;
				break ;
			case 'is_fckeditor' :
				d3download_is_fckeditor() ;
				break ;
		}
	}
Esempio n. 16
0
	function d3download_categorymanager_data_update( $mydirname )
	{
		require_once dirname( dirname(__FILE__) ).'/class/d3downloads.textsanitizer.php' ;
		$myts =& d3downloadsTextSanitizer::getInstance() ;
		$db =& Database::getInstance() ;

		// DELETE NULLBYTE
		$_POST = $myts->Delete_Nullbyte( $_POST );

		$errors = array() ;
		$array4sql = array( 'title' , 'cat_weight' ) ;

		foreach( $_POST['weights'] as $id => $weights ) {
			if( empty( $_POST['title'][$id] ) ){
				$errors[] = $id ;
			} else {
				$cid = intval( $id ) ;
				$title = mysql_real_escape_string( $myts->stripSlashesGPC( @$_POST['title'][$id] ) ) ;
				$cat_weight = intval( $weights ) ;
				$set4sql = "cid='".$cid."'" ;
				foreach( $array4sql as $key ) {
					$set4sql .= ",$key='".$$key."'" ;
				}
				$sql="UPDATE ".$db->prefix( $mydirname."_cat" )." SET $set4sql WHERE cid='".$cid."'";
				$result = $db->query( $sql );
				if( ! $result ) $errors[] = $lid ;
			}
		}
		return $errors ;
	}
Esempio n. 17
0
	function d3downloads_global_search_base( $mydirname, $keywords, $andor, $limit, $offset, $userid )
	{
		require_once dirname( __FILE__ ).'/class/d3downloads.textsanitizer.php' ;
		include_once dirname( __FILE__ ).'/class/mydownload.php' ;
		include_once dirname( __FILE__ ).'/class/user_access.php' ;

		$myts =& d3downloadsTextSanitizer::getInstance() ;
		$db =& Database::getInstance() ;

		$showcontext = isset( $_GET['showcontext'] ) ? $_GET['showcontext'] : 0 ;
		$mydownload = new MyDownload( $mydirname ) ;
		$user_access = new user_access( $mydirname ) ;
		$whr = "cid IN ( ".implode( ",", $user_access->can_read() )." )" ;
		
		if( $showcontext == 1 ){
			$sql = "SELECT lid, cid, title, description, submitter, date FROM ".$db->prefix( $mydirname."_downloads" )."" ;
		} else {
			$sql = "SELECT lid, cid, title, submitter, date, title FROM ".$db->prefix( $mydirname."_downloads" )."" ;
		}
		$sql .= " WHERE ".$mydownload->whr_append( 'Single' )." AND ( $whr )" ;
		if ( $userid != 0 ) $sql .= " AND submitter=".$userid." ";

		// because count() returns 1 even if a supplied variable
		// is not an array, we must check if $querryarray is really an array
		if ( is_array( $keywords ) && $count = count( $keywords ) ) {
			$sql .= " AND ( ( title LIKE '%$keywords[0]%' OR description LIKE '%$keywords[0]%' )" ;
			for( $i=1; $i<$count; $i++ ){
				$sql .= " $andor " ;
				$sql .= "( title LIKE '%$keywords[$i]%' OR description LIKE '%$keywords[$i]%' )" ;
			}
			$sql .= ") " ;
		}
		$sql .= "ORDER BY date DESC" ;
		$result = $db->query( $sql, $limit, $offset ) ;
		$ret = array();
		while( $myrow = $db->fetchArray( $result ) )
		{
			$lid = intval( $myrow['lid'] ) ;
			$cid = intval( $myrow['cid'] ) ;
			$title = $myts->makeTboxData4Show( $myrow['title'] ) ;
			$date = intval( $myrow['date'] ) ;
			$submitter = intval( $myrow['submitter'] ) ;
			$context = '' ;
			// get context for module "search"
			if( function_exists( 'search_make_context' ) && $showcontext ) {
				$body = $myts->displayTarea( $myrow['description'], 0, 1, 1, 1, 1 ) ;
				if ( strstr ( $body , '[pagebreak]' ) ){
					$str = explode( '[pagebreak]', $body , 2 ) ;
					$body = $str[0] ;
				}
				$full_context = strip_tags( $body ) ;
				if( function_exists( 'easiestml' ) ) $full_context = easiestml( $full_context ) ;
				$context = search_make_context( $full_context , $keywords ) ;
			}
			$ret[] = array(
				'link' => "index.php?page=singlefile&amp;cid=$cid&amp;lid=$lid" ,
				'title' => $title ,
				'time' => $date ,
				'uid' => $submitter ,
				'context' => $context ,
			) ;
		}
		return $ret ;
	}