📄 trash.php
字号:
<?phpdefined('WikyBlog') or die("Not an entry point...");global $pageOwner,$dbObject,$lang;$page->displayTitle = $lang['trash'];$dbObject->links[$lang['trash']] = '/Special/'.$pageOwner['username'].'/Trash';$page->formAction = '/Special/'.$pageOwner['username'].'/Trash';// isOwner(warn,strct)if(!isOwner(true,false)) return false;//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// includeFile('search/all.php'); class queryTrash extends query{ var $classes; function queryTrash(){ global $page,$dbInfo,$pageOwner,$jsNum,$wbUniq,$lang,$wbTables; $page->css2 =true; $this->rowLimit = 25; $this->searchUrl = $page->formAction; //$this->fields[--shown to user--] = --database column-- $this->fields[$lang['deleted']] = 'modified'; $this->fields[$lang['file']] = 'uniqLink'; $this->classes[] = ' class="tableRowEven" '; $this->classes[] = ' class="tableRowOdd" '; $page->scripts[] = '/include/'.$jsNum.'/rows.js'; //select $this->allSelect = array('file_id','modified'); $this->infoSelect = array('owner','uniqLink','dTitle'); $this->queryAllFiles(); //where $this->query .= ' AND '.$wbTables['all_files'].'.`owner_id` = "'.$pageOwner['user_id'].'" '; $this->query .= ' AND FIND_IN_SET("deleted", '.$wbTables['all_files'].'.`flags`) '; $this->query .= ' AND (adddate('.$wbTables['all_files'].'.`modified`,INTERVAL 31 DAY) > NOW()) '; $this->orderBy(); browseSearch3($this,$lang['trash']); } function mysqlFetch(&$result){ return mysql_fetch_row($result); } function displayPre(){ global $lang; echo '<table cellpadding="2" cellspacing="0" border="0" width="100%">'; echo '<tr class="tableRows"><th>'.$lang['file'].'</th>'; echo '<th colspan="2">'.$lang['deleted'].'</th>'; echo '<th colspan="2">'.$lang['options'].'</th></tr>'; } function displayPost(&$prev,&$pages,&$next){ global $lang; echo '<tr onClick="setCheckboxes(this)" style="cursor:pointer" >'; echo '<td colspan="2" class="sm">'.$lang['DELETED_AFTER_30'].'</td>'; echo '<td colspan="3" class="sm" style="text-align:right"><a href="javascript:void(0)">'.$lang['check_uncheck'].'</a></td>'; echo '</tr>'; echo '<tr><td colspan="5" class="sm" style="text-align:right">'; echo '<input type="submit" name="cmd" value="'.$lang['delete'].'" title="'.$lang['delete'].'" />'; echo '<p>'; echo '<input type="submit" name="cmd" value="'.$lang['empty_trash'].'" title="'.$lang['empty_trash'].'" />'; echo '</p>'; echo '</tr>'; echo '</table>'; parent::displayPost($prev,$pages,$nest); } function abbrevOutput(&$row,$i){ global $lang; $class = $this->classes[($i%2)]; //echo '<tr '.$class.' ><td>'; $this->queryAllResult($row); //echo '<tr '.$class.'onClick="selectCheckBox(event,\''.addslashes($row['uniqLink']).'\')" id="row_'.$row['uniqLink'].'" style="cursor:pointer">'; echo '<tr '.$class.'onClick="selectCheckBox(event,\''.addslashes($row['file_id']).'\')" id="row_'.$row['file_id'].'" style="cursor:pointer">'; echo '<td>'; echo toDisplay($row['dTitle']); echo ' </td><td> '; $unix = dbFromDate($row['modified'],'unix'); //$ago = (int)round((mktime()-$unix)/86400); $ago = (int)round((time()-$unix)/86400); if($ago === 0){ echo $lang['today']; }elseif($ago === 1){ echo $lang['yesterday']; }else{ echo $ago.$lang['days_ago']; } echo '</td><td>'; echo dbFromDate($row['modified'],1); echo '</td><td class="sm">'; echo wbLinks::local($row['uniqLink'].'?cmd=restore',$lang['restore'],' title="'.toDisplay($row['dTitle']).'"'); echo '</td><td>'; echo ' <input type="checkbox" onClick="return true" id="checkbox_'.$row['file_id'].'" value="'.$row['file_id'].'" name="list[]" />'; //echo ' <input type="checkbox" onClick="return true" id="checkbox_'.$row['uniqLink'].'" value="'.$row['space'].'='.$row['uniqLink'].'" name="list[]" />'; //echo ' <input type="checkbox" onClick="return true" id="checkbox_'.$row['uniqLink'].'" value="'.$row['space'].'" name="list['.$row['uniqLink'].']" />'; echo '</td></tr>'; } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// DELETES FROM all_files, all_links// class trash{ function permanentDelete(){ global $page,$dbInfo,$pageOwner,$wbTables; if( !isset($_POST['list']) || !is_array($_POST['list']) ){ message('DELETE_FILES'); return; } includeFile('tool/emptyTrash.php'); $num = emptyTrash($_POST['list']); if( $num === 0){ message('NOTHING_DELETED'); }else{ message('DELETED_FILES'); } } function emptyAll(){ global $page,$lang; ob_start(); echo '<div style="text-align:center">'; echo $lang['CONFIRM_EMPTY_TRASH']; echo '<p>'; echo '<input type="submit" name="cmd" value="'.$lang['continue'].'" title="'.$lang['continue'].'" />'; echo ' '; echo '<input type="submit" name="cmd" value="'.$lang['cancel'].'" title="'.$lang['cancel'].'" />'; echo '</p>'; echo '</div>'; $page->contentA[$lang['trash']] = wb::get_clean(); } function confirmEmpty(){ global $page,$lang,$wbTables,$pageOwner; ob_start(); echo '<div style="text-align:center"> '; // // all_files, all_links, all_history // $query = 'DELETE '; $query .= $wbTables['all_files'].', '.$wbTables['all_links'].', '.$wbTables['all_history']; $query .= ' FROM '; $query .= $wbTables['all_files'].' LEFT JOIN '.$wbTables['all_links'].' USING(`file_id`) '; $query .= ' LEFT JOIN '.$wbTables['all_history'].' ON '.$wbTables['all_files'].'.`file_id` = '.$wbTables['all_history'].'.`file_id` '; $query .= ' WHERE FIND_IN_SET("deleted", flags) AND '; $query .= $wbTables['all_files'].'.`owner_id` = "'.wbDB::escape($pageOwner['user_id']) .'" '; wbDB::runQuery($query); $num = mysql_affected_rows(); // // output // if( $num === 0){ message('NOTHING_DELETED'); }else{ message('DELETED_FILES'); } echo '</div>'; $page->contentA[$lang['trash']] = wb::get_clean(); } }//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// switch($page->userCmd){ case wbStrtolower($lang['delete']); trash::permanentDelete(); break; case wbStrtolower($lang['empty_trash']); trash::emptyAll(); return; case wbStrtolower($lang['continue']); trash::confirmEmpty(); break; } new queryTrash();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -