一款基于PHP的网络日记程序。WikyBlog支持:多用户的 BLOG

源代码在线查看: keywords.php

软件大小: 1247 K
上传用户: shanon
关键词: WikyBlog BLOG PHP 网络
下载地址: 免注册下载 普通下载 VIP

相关代码

								//$lang checked								defined('WikyBlog') or die("Not an entry point...");								global $pageOwner,$dbObject,$lang;				$page->displayTitle = $lang['keyword_search']; //'Keyword Search';				$dbObject->links['?'] = 'Keyword_Search';								includeFile('search/all.php');													class queryKeywords extends query{					var $classes;					var $label;					var $space;										function queryKeywords(){						global $page,$dbInfo,$pageOwner,$lang,$dbObject,$wbTables;						$page->css2 =true;						$this->rowLimit = 25;												$this->searchUrl = '/Special/'.$pageOwner['username'].'/'.$dbObject->title;												//$this->fields[--shown to user--] = --database column--						$this->fields[$lang['posted']] = 'posted';						$this->fields[$lang['modified']] = 'modified';						$this->fields[$lang['created']] = $wbTables['all_files'].'.`file_id`';												//Space							if( isset($_GET['space']) && isset($dbInfo[$_GET['space']]['dbTable']) ){								$this->space = $dbInfo[$_GET['space']]['class'];		//!! finish getting rid of $this->space by using $this->useTables instead								$this->useTables[$_GET['space']] = true;								$this->fields[$lang['created']] = $dbInfo[$_GET['space']]['dbTable'].'.`file_id`';							}																			//New							$this->queryAllFiles();							$this->query .= ' AND !FIND_IN_SET("hidden", '.$wbTables['all_files'].'.`flags`) ';							$this->query .= ' AND !FIND_IN_SET("deleted", '.$wbTables['all_files'].'.`flags`) ';												//owner							if( isset($_GET['owner']) && $_GET['owner'] === 'false' ){								//no owner							}else{								$this->query .= ' AND '.$wbTables['all_files'].'.owner_id = "'.$pageOwner['user_id'].'" ';							}																		// Keyword Search							if( !empty($_GET['key']) ){																//prepare $key and $_GET['key] so that multiple tabs aren't created for a single (case different) key								//	we get the $key as it's stored in $pageOwner because files may have the same key typed with different cases in multiple files																$key = $_GET['key'];								if( ':' === substr($key,-1) ){									$key = substr($key,0,-1);								}								$_GET['key'] = str_replace('&','%26',$_GET['key']);								$_GET['key'] = trim($_GET['key']);																$key = getUserKeyword($key);								$this->label = wbUcwords($key);								$page->displayTitle .= ' > '.wbUcwords($key);																//first case... find exact								$pos= strpos($_GET['key'],':');								if(($pos === false)||($pos+1) == strlen($_GET['key'])){									//Get all with a loose query									$_GET['key'] = $key.':';									$this->query .= ' AND (';									$this->query .= ' (FIND_IN_SET("'.wbDB::escape(htmlspecialchars($key)).'", '.$wbTables['all_files'].'.`keywords` )>0) ';									$this->query .= ' OR ('.$wbTables['all_files'].'.`keywords` LIKE "'.wbDB::like(htmlspecialchars($_GET['key'])).'%") ';									$this->query .= ' OR ('.$wbTables['all_files'].'.`keywords` LIKE "%,'.wbDB::like(htmlspecialchars($_GET['key'])).'%") ';									$this->query .= ')';								}else{									$this->query .= ' AND (FIND_IN_SET("'.wbDB::escape(htmlspecialchars($_GET['key'])).'", '.$wbTables['all_files'].'.`keywords` )>0) ';								}															}elseif( !isset($_GET['key']) ){																if( !empty($this->space) ){									$this->label = $lang['browse'].' '.$lang[$this->space];								}else{									$this->label = $lang['browse'].' '.$lang['all'];								}								$page->displayTitle = $this->label;															}else{																$whereA[] = ' IF( LENGTH(keywords)>0 ,0,1) ';								$this->label = $lang['non_tagged_files'];								$page->displayTitle = $lang['non_tagged_files'];							}												$this->orderBy();						browseSearch3($this,$this->label);					}										function mysqlFetch(&$result){						return mysql_fetch_row($result);					}									function displayPre(){}						function displayEmpty(){						parent::displayEmpty();						return true;					}									function displayPost(&$prev,&$pages,&$next){						global $pageOwner,$dbInfo,$lang;						$more = '';						///	Owner							if( isset($_GET['owner']) && $_GET['owner'] === 'false' ){								$overWrite['owner'] = false;								$more .= ''.$lang['search_from'];								$more .= wbLinks::local($this->searchUrl.'?'.$this->browseString($overWrite),$lang['user'].': '.$pageOwner['username']);								$more .= '   '.$lang['all_users'].' ';							}else{								$overWrite['owner'] = 'false';								$more .= ''.$lang['search_from'];								$more .= ' '.$lang['user'].': '.$pageOwner['username'].'   ';								$more .= wbLinks::local($this->searchUrl.'?'.$this->browseString($overWrite),$lang['all_users']).'';							}							unset($overWrite);																		/// Space							$more .= ' '.$lang['from_file_type'];							if( !isset($_GET['space']) || !isset($dbInfo[$_GET['space']]['dbTable']) ){								$more .= ' '.$lang['all'].'   ';							}else{								$overWrite['space'] = false;																$temp = $this->browseString($overWrite);								$more .= browseLink2($this->searchUrl,$this->searchUrlLow,0,$temp,$lang['all']).'   ';							}							foreach($dbInfo as $space => $array){								if( !isset($array['dbTable']) ){									continue;								}																if( isset($_GET['space']) && $_GET['space'] == $space){									$more .= ' '.$lang[$array['class']].'   ';									continue;								}																$overWrite['space'] = $space;								$temp = $this->browseString($overWrite);								$label = wbLang::text($array['class']);								$more .= browseLink2($this->searchUrl,$this->searchUrlLow,0,$temp,$label).'   ';							}							$more .= '';												parent::displayPost($prev,$pages,$next,$more);					}					}								new queryKeywords();								//				//				//				///////////////////////////////////////////////////////////////////////////////////////////////////////				/////////////////////////////////////////////////////////////////////////////////////////////////////////				/////////////////////////////////////////////////////////////////////////////////////////////////////////				//				//		Supp Functions				//								function getUserKeyword($arg){					global $pageOwner;										if( !is_array($pageOwner['keywords']) ){						return $arg;					}										foreach($pageOwner['keywords'] as $key => $num){						if(strcasecmp($arg,$key) === 0){							return $key;						}					}					return $arg;				}			

相关资源