架設ROSE私服必備之物 ROSE數據庫
源代码在线查看: browse.php
/** * Web based SQLite management * Show result query with paginate, sort, modify/delete links * @package SQLiteManager * @author Fr閐閞ic HENNINOT * @version $Id: browse.php,v 1.45 2006/04/14 15:16:52 freddy78 Exp $ $Revision: 1.45 $ */ include_once INCLUDE_LIB.'ParsingQuery.class.php'; include_once INCLUDE_LIB.'sql.class.php'; if(!isset($withForm)) $withForm = true; if(!isset($DisplayQuery) || empty($DisplayQuery)){ if($action == 'sql') { $displayResult = false; } if(!empty($table) || !empty($view)) $DisplayQuery = 'SELECT * FROM '.brackets($table).brackets($view); else $DisplayQuery = ''; } else if(!isset($_FILES)) { $DisplayQuery = urldecode($GLOBALS['DisplayQuery']); } elseif( !empty($_POST['DisplayQuery']) || !empty($_GET['DisplayQuery']) ) { $DisplayQuery = stripslashes($DisplayQuery); } if(!isset($displayResult)) $displayResult = true; if(!isset($sql_action)) $sql_action = ''; if( ($sql_action=='explain') && !eregi('EXPLAIN', $DisplayQuery) ) $DisplayQuery = 'EXPLAIN '.$DisplayQuery; $SQLiteQuery =& new sql($workDb, $DisplayQuery); if( $sql_action != 'modify'){ $error = $SQLiteQuery->verify(false); } else { $error = false; } if($SQLiteQuery->withReturn && !$error && $displayResult){ include_once INCLUDE_LIB.'SQLiteToGrid.class.php'; if(!empty($GLOBALS["table"])) $linkItem = 'table='.$GLOBALS["table"]; else $linkItem = 'view='.$GLOBALS["view"]; $accessResult = $SQLiteQuery->checkAccessResult($DisplayQuery); $DbGrid =& new SQLiteToGrid($workDb->connId, $SQLiteQuery->query, 'Browse', true, BROWSE_NB_RECORD_PAGE, '70%'); $DbGrid->enableSortStyle(false); $DbGrid->setGetVars('?dbsel='.$GLOBALS['dbsel'].'&table='.$table.'&action=browseItem&DisplayQuery='.urlencode($DisplayQuery)); if($DbGrid->getNbRecord()disableNavBarre(); if($accessResult && (!$workDb->isReadOnly() && displayCondition('data'))){ if(displayCondition('del')) $deleteLink = "".displayPics("deleterow.png", $GLOBALS["traduct"]->get(15)).""; else $deleteLink = displayPics("deleterow_off.png", $GLOBALS["traduct"]->get(15)); if(displayCondition('data')) $modifyLink = "".displayPics("edit.png", $GLOBALS["traduct"]->get(14)).""; else $modifyLink = displayPics("edit_off.png", $GLOBALS["traduct"]->get(14)); $DbGrid->addCalcColumn($GLOBALS["traduct"]->get(33), "".$modifyLink." ".$deleteLink."", "center", 0); } $showTime = ''.$GLOBALS['traduct']->get(213).' '.$SQLiteQuery->queryTime.' '.$GLOBALS['traduct']->get(214).''; if($allFullText) $caption = ''.displayPics("nofulltext.png", $GLOBALS['traduct']->get(225)).''; else $caption = ''.displayPics("fulltext.png", $GLOBALS['traduct']->get(226)).''; if($allHTML) $capHTML = ''.displayPics("HTML_on.png", "HTML").''; else $capHTML = ''.displayPics("HTML_off.png", "Texte").''; // $DbGrid->addCaption("top", ''.$caption.str_repeat(' ', 3).$capHTML.''.$showTime.''); $capTable = ''.$caption.str_repeat(' ', 3).$capHTML.''.$showTime.''; $DbGrid->build(); if(!isset($noDisplay) || !$noDisplay) displayQuery($DbGrid->getRealQuery()); if($DbGrid->getNbRecord()) { echo ''.$capTable.''; $DbGrid->show(); echo ''."\n"; echo ''; if(empty($view) && (!$workDb->isReadOnly() && displayCondition("properties"))){ echo ' » '.$GLOBALS['traduct']->get(97).' '.$GLOBALS['traduct']->get(98).' '; } if($accessResult && (displayCondition('export'))){ echo ''; echo ' » '.$GLOBALS['traduct']->get(76).' '; } echo ''; echo ''; } if(!$DbGrid->getNbRecord()) $SQLiteQuery->getForm($DbGrid->getRealQuery()); } else { if(!$SQLiteQuery->multipleQuery && (!isset($noDisplay) || !$noDisplay)) displayQuery($DisplayQuery, true, $SQLiteQuery->changesLine); else $SQLiteQuery->DisplayMultipleResult(); if(!empty($DisplayQuery) && $error) { $withForm = true; $errorMessage = ""; if(is_array($SQLiteQuery->lineError)) $errorMessage = $GLOBALS["traduct"]->get(99)." : ".implode(", ", $SQLiteQuery->lineError).""; $errorMessage .= $SQLiteQuery->errorMessage; displayError($errorMessage); } if($withForm && WITH_AUTH && isset($SQLiteManagerAuth) && !$SQLiteManagerAuth->getAccess("execSQL")) $withForm = false; if($withForm) $SQLiteQuery->getForm($DisplayQuery); } ?>