📄 all.php
字号:
echo '<div style="font-size:85%;text-align:right"> '; echo wbLang::text('RESULTS',$from,$to,$rowsFound); echo ' '; echo $prev.' '.$next; echo '</div>'; } //1 function displayEmpty(){ global $lang; echo $lang['EMPTY_SET']; return false; } //2 function displayPre(){ } //3 function abbrevOutput(&$row,$i){ global $pageOwner,$lang; $this->queryAllResult($row); echo '<div><span class="title">'; if( isset($_GET['owner']) && $_GET['owner'] === 'false' ){ echo $row['owner'] . ' :: '; } echo wbLinks::local($row['uniqLink'],toDisplay($row['dTitle'])); echo '</span>'; echo '<span class="sm">'; echo '<br/>'; echo showKeywords($row['keywords'],$row['owner'],'<br/>'); echo $lang['last_modified'].': '.dbFromDate($row['modified'],1); $temp = $lang['view_source']; if( hasPrivilege($row['flags'],$row['owner']) ){ $temp = $lang['edit']; } echo ' ... [ '; echo wbLinks::local($row['uniqLink'].'?cmd=edit',$temp); echo ' ]'; echo '</span>'; echo '<br/> </div>'; return; } //4 function displayPost(&$prev,&$pages,&$next,$listItems=null,$more=null){ global $lang; //echo '<br/> <div style="border:1px solid #d4d0c8;padding:7px;" >'; echo '<div class="WBsearchFooter" >'; echo $prev.$pages.$next; echo '<ul>'; echo $listItems; if( !is_array($this->fields) ){ echo '</ul>'; echo $more; echo '</div>'; return; } echo '<li>'; echo $lang['order_by']; echo ' '; $i = 0; foreach($this->fields as $key => $field){ if( empty($field) ){ continue; } $overWrite['field'] = $i; if( $key == $this->field ){ echo '<b>'.$key.'</b> '; }else{ echo wbLinks::local($this->searchUrl.'?'.$this->browseString($overWrite),$key); echo ' '; } $i++; } echo ' :: '; unset($overWrite); if( isset($_GET['ascending']) && $_GET['ascending'] == 'true' ){ $overWrite['ascending'] = 'false'; echo wbLinks::local($this->searchUrl.'?'.$this->browseString($overWrite),$lang['descending']); echo ' '. $lang['or'].' <b>'.$lang['ascending'].'</b>'; }else{ $overWrite['ascending'] = 'true'; echo '<b>'.$lang['descending'].'</b> '.$lang['or'].' '; echo wbLinks::local($this->searchUrl.'?'.$this->browseString($overWrite),$lang['ascending']); } echo '</li>'; echo '</ul>'; echo $more; echo '</div>'; } } //// QUERY CLASS////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// BROWSE FUNCTION//function browseSearch3(&$queryObj,$tabLabel){ global $page,$dbObject,$lang; $queryObj->limit(); ob_start(); /////////////////////////////////////////////////////////////////////////////////// // // Output Variables // $previousLink = ''; $nextLink = ''; if( empty($queryObj->searchUrl) ){ $queryObj->searchUrl = $_SERVER['REDIRECT_URL']; trigger_error('searchUrl not set'); }elseif( strpos($queryObj->searchUrl,'?') ){ trigger_error('searchUrl is set with a query string alredy'); } $queryObj->searchUrlLow = toStorageUrl($queryObj->searchUrl); $queryObj->browseString = $queryObj->browseString(); //PageNum if( empty($_GET['offset']) || $_GET['offset'] == 0){ $currentPageNum = 1; }else{ $currentPageNum = ($_GET['offset'] / $queryObj->rowLimit) +1; } /////////////////////////////////////////////////////////////////////////////////// // // Run the query // $result = wbDB::runQuery($queryObj->query); if( !$result ){ $page->contentA['Query Error'] = wb::get_clean(); return; } $actualRowsFound = mysql_num_rows($result); //////// NUMBER OF RESULTS $numQuery = 'SELECT FOUND_ROWS()'; $numberResult = wbDB::runQuery($numQuery); $numberRowsFound = mysql_num_rows($numberResult); if($numberRowsFound == 1){ $numberArray = mysql_fetch_assoc($numberResult); $rowsFound = $numberArray['FOUND_ROWS()']; }else{ if( $actualRowsFound < $queryObj->rowLimit){ $rowsFound = $actualRowsFound; }else{ $rowsFound = 800; } } //MaxRows if( isset($queryObj->maxRows) && is_numeric($queryObj->maxRows) ){ $rowsFound = min($rowsFound,$queryObj->maxRows); }else{ $queryObj->maxRows = $rowsFound; } /////////////////////////////////////////////////////////////////////////////////// // // Links // //PREVIOUS LINK if( isset($_GET['offset']) && $_GET['offset'] > 0){ $previousOffset = $_GET['offset'] - $queryObj->rowLimit; if( ($currentPageNum-1) == 1){ $temp = $tabLabel; }else{ $temp = $tabLabel.' ('.($currentPageNum-1).')'; } $previousLink = browseLink2($queryObj->searchUrl,$queryObj->searchUrlLow,$previousOffset,$queryObj->browseString,$lang['previous']); }else{ $previousLink = $lang['previous']; $_GET['offset'] = 0; } //NEXT LINK if( ($_GET['offset']+$queryObj->rowLimit) < $rowsFound){ $nextLink = browseLink2($queryObj->searchUrl,$queryObj->searchUrlLow,($_GET['offset'] + $queryObj->rowLimit),$queryObj->browseString,$lang['next']); }else{ $nextLink = $lang['next']; } $to = min($_GET['offset']+$queryObj->rowLimit, $rowsFound); $from = min($_GET['offset']+1,$rowsFound); $text = $queryObj->setLinks($currentPageNum,$rowsFound,$tabLabel); $queryObj->displayNumbers($from,$to,$rowsFound,$previousLink,$nextLink); /////////////////////////////////////////////////////////////////////////////////// // // Content // if( empty($page->contentA[$queryObj->currLabel]) ){ $page->contentA[$queryObj->currLabel] = ''; } //IF NO DATA if($actualRowsFound == 0){ if( !$queryObj->displayEmpty() ){ $page->contentA[$queryObj->currLabel] .= wb::get_clean(); return; } } //DISPLAY $i=$from; $queryObj->displayPre(); while( ($row = $queryObj->mysqlFetch($result)) && ($i <= $queryObj->maxRows)){ $queryObj->abbrevOutput($row,$i); //set last-modified for each row if( is_array($row) && isset($row['modified'])){ $page->setLastModified($row['modified']); }elseif( isset($row->modified) ){ $page->setLastModified($row->modified); } $i++; } $queryObj->displayPost($previousLink,$text,$nextLink); $page->contentA[$queryObj->currLabel] .= wb::get_clean();}// END FUNCTION browseSearch2function browseLink2($href,$hrefLow,$offset,$queryString,$text=false){ $piece = '?'; if(!empty($queryString)){ $href .= '?'.$queryString; $hrefLow .= '?'.$queryString; $piece = '&'; } if($offset !== 0){ $href .= $piece.'offset='.$offset; $hrefLow .= $piece.'offset='.$offset; } if( $text === false){ return $href; }else{ global $wbLinkFormat; return '<a '.sprintf($wbLinkFormat,$href,$hrefLow,'').'>'.$text.'</a>'; }} //// BrowseSearch////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Widely Used Functions//function arrayToBrowseString(&$array,$prefix=false){ $string = ''; $sep = ''; foreach($array as $key => $value){ if( $value === false){ //should be NULL instead of false continue; } switch($key){ case 'label': case 'wb': //$_GET['wb'] ... formerly $_GET['x'] .. formerly $_GET['xm'] case 'offset': //these have special meaning to this software continue 2; } if($prefix !== false){ $key = $prefix.'['.$key.']'; } if(is_array($value)){ $string .= arrayToBrowseString($value,$key); }else{ $string .= $sep.rawurlencode($key).'='.rawurlencode($value); } $sep = '&'; } return $string;}function removeWiki($text){ $search = array("''''","'''","''",'====','===','==','[Image:','[image:','[',']','*','#'); $text = str_replace($search,'',$text); return $text;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -