📄 watchlist.php
字号:
<?phpdefined('WikyBlog') or die("Not an entry point...");global $pageOwner,$dbObject,$lang;$page->displayTitle = $lang['watchlist'];$dbObject->links['?'] = $lang['watchlist'];// isOwner(warn,strct)if(!isOwner(true,true)) return false;includeFile('search/all.php');class watchlist extends query{ var $classes; var $day,$month,$year = false; function watchlist(){ global $page,$dbInfo,$pageOwner,$lang,$wbTables; $page->css2 =true; $this->rowLimit = 25; $this->classes[] = ' class="tableRowOdd" '; $this->classes[] = ' class="tableRowEven" '; switch($page->userCmd){ case 'unwatch': case wbStrtolower($lang['unwatch']): $this->unwatch(); break; } $this->selectFrom = $wbTables['all_watch'].' INNER JOIN '.$wbTables['all_files'].' USING(`file_id`) '; $this->joinAllTo = $wbTables['all_watch']; $this->allSelect = array( ' IF( '.$wbTables['all_files'].'.`owner_id` = "'.wbDB::escape($pageOwner['user_id']).'", 1, 0) '=>'is_owner', $wbTables['all_files'].'.`modified` '=>'modified', $wbTables['all_files'].'.`file_id` '=>'file_id', $wbTables['all_files'].'.`ip` '=>'ip', $wbTables['all_files'].'.`username` '=>'username'); $this->infoSelect[] = 'summary'; $this->queryAllFiles(); $this->query .= ' AND '.$wbTables['all_watch'].'.`user_id` = "'.wbDB::escape($_SESSION['user_id']).'" '; $this->query .= ' ORDER BY '.$wbTables['all_files'].'.`modified` DESC '; $this->searchUrl = $page->formAction = '/Special/'.$_SESSION['username'].'/WatchList'; browseSearch3($this,$lang['watchlist']); } function displayPre(){ global $lang; echo '<table cellpadding="2" cellspacing="0" border="0">'; echo '<tr class="tableRows"><th>'.$lang['modified'].'</th>'; echo '<th>'.$lang['file'].'</th>'; echo '<th>'.$lang['user'].'</th>'; echo '<th>'.$lang['edit_summary'].'</th>'; echo '<th>'.$lang['options'].'</th>'; echo '</tr>'; } function displayPost(&$prev,&$pages,&$next){ global $lang; echo '<tr><td colspan="4"></td>'; echo '<td>'; echo '<input type="submit" name="cmd" value="'.$lang['unwatch'].'" />'; echo '</td>'; echo '</table>'; parent::displayPost($prev,$pages,$next); } function abbrevOutput(&$row,$i){ global $lang; $this->queryAllResult($row); $this->isOwner = isOwner(); //Format For Display $unixTime =& $row['unixtime']; $month = date('ym',$unixTime); $day = date('ymj',$unixTime); //////// 1) format the timeline dates $dateTime = dbFromDate($row['modified'],array('H',':','i')); if( $this->day !== $day){ $dateTime = dbFromDate($row['modified'],array('D',' ','j')).', '.$dateTime; if( $this->month !== $month ){ $dateTime = '<div style="text-align:left"><b>'.dbFromDate($row['modified'],array('Y',' ','M')).'</b></div> '.$dateTime; } } $this->month = $month; $this->day = $day; //////// 2) For Odd rows $class3 = $this->classes[($i%2)]; //////// 3) Echo a row echo '<tr><td class="historyTimeline"><span class="historyTime">'; echo $dateTime; echo '</span></td>'; echo '<td '.$class3.' style="white-space:nowrap">'; if( $row['is_owner'] == '0'){ echo wbLinks::local('/'.$row['owner'],$row['owner']).' :: '; } echo wbLinks::local($row['uniqLink'],toDisplay($row['dTitle'],30),' title="'.toDisplay($row['dTitle']).'"'); echo '</td><td '.$class3.'>'; if( !empty($row['username']) ){ echo wbLinks::local('/'.$row['username'].'/Home',$row['username']); }else{ echo $row['ip']; } if( isset($_SESSION['username']) ){ if($_SESSION['username'] != $row['username']){ $guest = $row['username']; if( empty($row['username']) ){ $guest = $row['ip']; } if( !empty($row['username']) ){ echo ' <span class="sm">'; echo wbLinks::special('Permissions?guest='.$guest,'+/-','title="'.$lang['SET_USER_PERMISSIONS'].$guest.'"',$_SESSION['username']); echo '</span>'; } } } echo '</td><td '.$class3.'><span class="sm">'; echo $row['summary']; echo ' </span>'; echo '</td><td '.$class3.'>'; echo '<input type="checkbox" name="ids[]" value="'.$row['file_id'].'"/>'; echo '</td>'; echo '</tr>'; } function unwatch(){ global $wbTables,$dbObject,$lang; if( empty($_POST['ids']) ){ return; } $queryA = array(); foreach( $_POST['ids'] as $id){ $queryA[] = ' `file_id` = "'.wbDB::escape($id).'" '; } $query = 'DELETE FROM '.$wbTables['all_watch']; $query .= ' WHERE `user_id` = "'.wbDB::escape($_SESSION['user_id']).'" '; $query .= ' AND ('; $query .= implode(' OR ',$queryA); $query .= ' ) '; if( wbDB::runQuery($query) ){ $link = wbLinks::special('WatchList',false); message('WATCH_UPDATED',$link); } }}new watchlist();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -