case 'modifyElement': $tableProp->formElement(urldecode(stripslashes($_GET['query'])), $_GET['pos']); break; case 'saveElement': case 'deleteElement': $tableProp->saveElement(); if (isset($GLOBALS['reBrowse']) && $GLOBALS['reBrowse']) { include_once INCLUDE_LIB . 'browse.php'; } break; case 'empty': $query = 'DELETE FROM ' . brackets($table) . ';'; if ($dbsel) { $workDb->getResId($query); } displayQuery($query, false); $redirect = "<script type=\"text/javascript\">parent.left.location='left.php?dbsel=" . $dbsel . "'; parent.main.location='main.php?dbsel={$dbsel}&table={$table}';</script>"; break; case 'export': include_once INCLUDE_LIB . 'SQLiteExport.class.php'; $export =& new SQLiteExport($workDb); break; case 'select': include_once INCLUDE_LIB . 'SQLiteSelect.class.php'; $select =& new SQLiteSelect($workDb, $table); break; case 'selectElement': $DisplayQuery = $tableProp->selectElement($table); include INCLUDE_LIB . 'browse.php'; break; case 'operation':
} if ($accessResult && displayCondition('export')) { echo '<hr width="60%">'; echo ' <table class="BrowseOption"><tr><td> <a href="main.php?dbsel=' . $GLOBALS['dbsel'] . '&table=' . $GLOBALS['table'] . '&queryExport=' . urlencode($DisplayQuery) . '&action=export" class="Browse"> » ' . $GLOBALS['traduct']->get(76) . '</a> </td></tr></table>'; } echo '</div>'; echo '</td></tr></table>'; } 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) . "<br>"; } $errorMessage .= $SQLiteQuery->errorMessage; displayError($errorMessage); } if ($withForm && WITH_AUTH && isset($SQLiteManagerAuth) && !$SQLiteManagerAuth->getAccess("execSQL")) { $withForm = false; }
/** * Save current view properties * * @access public */ function saveProp() { if ($GLOBALS['action'] == 'delete' || $this->isExist) { $queryDisplay = $query[] = 'DROP VIEW ' . brackets($this->view) . ';'; } if ($GLOBALS['action'] != 'delete') { if ($this->isExist) { $viewname = $this->view; } else { $viewname = $_POST['ViewName']; } if (!empty($_POST['ViewName']) && !empty($_POST['ViewProp'])) { $queryDisplay = $query[] = 'CREATE VIEW ' . brackets($viewname) . ' AS ' . urldecode(SQLiteStripSlashes($_POST['ViewProp'])) . ';'; } } $errorMessage = ''; if ($query) { foreach ($query as $req) { $this->connId->getResId("BEGIN;"); $res = $this->connId->getResId($req); $this->connId->getResId("COMMIT;"); if (!$res) { $errorCode = @sqlitem_last_error($this->connId->connId); $errorMessage .= $GLOBALS['traduct']->get(9) . ' ' . $errorCode . ' : ' . @$this->connId->connId->getError() . '\\n'; } } } else { if (empty($_POST['ViewName']) || empty($_POST['ViewProp'])) { $errorMessage .= $GLOBALS['traduct']->get(18); } } if ($GLOBALS['action'] != 'delete') { if ($queryDisplay) { displayQuery($queryDisplay); } if (!empty($errorMessage)) { displayError($errorMessage); $this->viewEditForm(); } } else { $GLOBALS["redirect"] = "<script type=\"text/javascript\">parent.left.location='left.php?dbsel=" . $GLOBALS["dbsel"] . "'; parent.main.location='main.php?dbsel=" . $GLOBALS["dbsel"] . "';</script>"; } }
/** * Display SQlite error * * @access public * @param string $queryDisplay Query to display * @param resource $res Database connection resource */ function _getError($queryDisplay, $res) { if (!$res) { $errorMessage .= $GLOBALS['traduct']->get(9) . ' : ' . @$this->connId->connId->getError() . "\n"; } displayQuery($queryDisplay); if (!empty($errorMessage)) { displayError($errorMessage); } }
/** * save properties of the current FUNCTION * * @access private */ function saveProp() { if ($GLOBALS['action'] == 'delete') { $queryDisplay = 'DELETE FROM user_function WHERE funct_name=' . quotes($this->function) . ' AND (base_id=' . $GLOBALS['dbsel'] . ' OR base_id IS NULL);'; } if ($GLOBALS['action'] != 'delete') { $base_id = $_POST['FunctAttribAll'] == 1 ? 'NULL' : $GLOBALS['dbsel']; if ($_POST['FunctName'] != $this->functionProperties['funct_name']) { $tabSQL['funct_name'] = "'" . $this->connId->formatString($_POST['FunctName']) . "'"; } if ($_POST['FunctType'] != $this->functionProperties['funct_type']) { $tabSQL['funct_type'] = $this->connId->formatString($_POST['FunctType']); } if ($_POST['FunctCode'] != $this->functionProperties['funct_code']) { $tabSQL['funct_code'] = "'" . $this->connId->formatString($_POST['FunctCode']) . "'"; } if ($_POST['FunctFinalCode'] != $this->functionProperties['funct_final_code']) { $tabSQL['funct_final_code'] = "'" . $this->connId->formatString($_POST['FunctFinalCode']) . "'"; } if ($_POST['FunctNumArgs'] != $this->functionProperties['funct_num_args']) { $tabSQL['funct_num_args'] = $this->connId->formatString($_POST['FunctNumArgs']); } if ($base_id != $this->functionProperties['base_id']) { $tabSQL['base_id'] = $base_id; } if (is_array($tabSQL)) { if ($this->isExist) { while (list($key, $value) = each($tabSQL)) { $tabUpdate[] = $key . '=' . $value; } $queryDisplay = 'UPDATE user_function SET ' . implode(',', $tabUpdate) . ' WHERE id=' . $_POST['id'] . ';'; } else { $tabCol = array_keys($tabSQL); $tabVal = array_values($tabSQL); $nbVal = count($tabSQL); $queryDisplay = 'INSERT INTO user_function (' . implode(',', $tabCol) . ') VALUES (' . implode(',', $tabVal) . ');'; } } } $errorMessage = ''; $res = $GLOBALS['db']->query($queryDisplay); if (!$res) { $errorCode = @sqlitem_last_error($this->connId->connId); $errorMessage .= $GLOBALS['traduct']->get(9) . ' ' . $errorCode . ' : ' . @$this->connId->connId->getError() . "\n"; } displayQuery($queryDisplay); if (!empty($errorMessage)) { displayError($errorMessage); } if ($GLOBALS['action'] != 'delete') { $this->propView(); echo "<script type=\"text/javascript\">parent.left.location='left.php?dbsel=" . $GLOBALS["dbsel"] . "';</script>"; } else { echo "<script type=\"text/javascript\">parent.left.location='left.php?dbsel=" . $GLOBALS["dbsel"] . "'; parent.main.location='main.php?dbsel=" . $GLOBALS["dbsel"] . "';</script>"; } }
/** * save current TRIGGER properties * * @access public */ function saveProp() { if ($GLOBALS['action'] == 'delete' || $this->isExist) { $queryDisplay = $query[] = 'DROP TRIGGER ' . brackets($this->trigger) . ';'; } if ($GLOBALS['action'] != 'delete') { if ($this->isExist) { $triggername = $this->trigger; } else { $triggername = $_POST['TriggerName']; } $queryCreate = 'CREATE TRIGGER ' . brackets($triggername) . ' ' . $_POST['TriggerMoment']; if ($_POST['TriggerMoment'] != '') { $queryCreate .= ' '; } $queryCreate .= $_POST['TriggerEvent'] . ' '; if ($_POST['TriggerEvent'] == 'UPDATE OF') { $queryCreate .= $_POST['ColumnList'] . ' '; } $queryCreate .= 'ON ' . brackets($_POST['TriggerOn']) . ' ' . $_POST['TriggerAction']; if ($_POST['TriggerAction'] != '') { $queryCreate .= ' '; } if ($_POST['TriggerCondition'] == 'WHEN') { $queryCreate .= 'WHEN ' . $_POST['ConditionList'] . ' '; } $queryCreate .= "\n" . 'BEGIN ' . "\n" . stripslashes($_POST['TriggerStep']) . "\n" . ' END;' . "\n"; $queryDisplay = $query[] = $queryCreate; $this->triggerProperties = $queryCreate; } $errorMessage = ''; foreach ($query as $req) { $this->connId->getResId("BEGIN;"); $res = $this->connId->getResId($req); $this->connId->getResId("COMMIT;"); if (!$res) { $errorMessage .= $GLOBALS['traduct']->get(9) . ' ' . $errorCode . ' : ' . @$this->connId->connId->getError() . "\n"; } } displayQuery($queryDisplay); if (!empty($errorMessage)) { displayError($errorMessage); } if ($GLOBALS['action'] != 'delete') { $this->propView(); echo "<script type=\"text/javascript\">parent.left.location='left.php?dbsel=" . $GLOBALS["dbsel"] . "';</script>"; } else { echo "<script type=\"text/javascript\">parent.left.location='left.php?dbsel=" . $GLOBALS["dbsel"] . "'; parent.main.location='main.php?dbsel=" . $GLOBALS["dbsel"] . "';</script>"; } }
/** * Display form for option choose * * @access public */ function form() { echo '<center><br>'; if (isset($_REQUEST['queryExport']) && $_REQUEST['queryExport']) { $query = urldecode(stripslashes($_REQUEST['queryExport'])); displayQuery($query, false); } echo '<form name="export" action="main.php" method="POST" target="main"> <table class="Insert" cellspacing="0" cellpadding="0" border="1" width="50%"> <tr> <td valign="top"> <table width="100%" cellspacing="0" cellpadding="0"> <thead><tr><td class="tabproptitle"> ' . $GLOBALS['traduct']->get(76) . ' </td></tr> </thead> <tr><td style="padding-left:15px;padding-top:15px;"> <input type="radio" name="type" value="1" checked>' . $GLOBALS['traduct']->get(124) . '<br/> <input type="radio" name="type" value="2">' . $GLOBALS['traduct']->get(125) . '<br/> <input type="radio" name="type" value="3">' . $GLOBALS['traduct']->get(126) . '<br/> </td></tr> </table> </td> <td> <table width="100%" cellspacing="0" cellpadding="0"> <thead> <tr><td class="tabproptitle"> ' . $GLOBALS["traduct"]->get(72) . ' : </td></tr> </thead> <tr><td> <input type="checkbox" name="drop" value="1">' . $GLOBALS['traduct']->get(43) . ' "DROP"<br/><br/> </td></tr> <thead> <tr><td class="tabproptitle"> ' . $GLOBALS["traduct"]->get(199) . ' : </td></tr> </thead> <tr><td> <input type="checkbox" name="fullInsert" value="1">' . $GLOBALS['traduct']->get(127) . '<br/><br/> </td></tr> </table> </td> </tr> <tr> <td colspan="2" align="center"> <input type="checkbox" name="trans" value="1">' . $GLOBALS['traduct']->get(128) . ' <input type="checkbox" name="win" value="1">CRLF</td> </tr> <tr> <td align="center" style="padding: 3px;" colspan="2"><input class="button" type="submit" value="' . $GLOBALS['traduct']->get(69) . '"></td> </tr> </table> <input type="hidden" name="dbsel" value="' . $GLOBALS['dbsel'] . '">'; if (isset($GLOBALS['table'])) { echo ' <input type="hidden" name="table" value="' . $GLOBALS['table'] . '">'; } if (isset($GLOBALS['queryExport'])) { echo ' <input type="hidden" name="queryExport" value="' . stripslashes($GLOBALS['queryExport']) . '">'; } if (isset($GLOBALS['view'])) { echo ' <input type="hidden" name="view" value="' . $GLOBALS['view'] . '">'; } if (isset($GLOBALS['function'])) { echo ' <input type="hidden" name="function" value="' . $GLOBALS['function'] . '">'; } echo ' <input type="hidden" name="action" value="' . $GLOBALS['action'] . '"> <input type="hidden" name="export_action" value="go"> </form> </center>'; }
/** * */ function saveKey() { $cid = key($_POST['modify']); $columnName = $this->infoTable[$cid]['name']; if ($_POST['action'] == 'unique') { $type = 'UNIQUE '; } else { $type = ''; } $query = 'CREATE ' . $type . 'INDEX ' . str_replace(' ', '_', $this->table . '_' . $columnName) . ' ON ' . brackets($this->table) . '(' . brackets($columnName) . ');'; $GLOBALS['phpSQLiteError'] = ''; set_error_handler('phpSQLiteErrorHandling'); if (!$this->connId->getResId($query)) { echo '<table align="center" style="color: red;"><tr><td>' . $GLOBALS['traduct']->get(9) . ' :</td><td>' . @$this->connId->connId->getError() . '</td></tr>'; if ($GLOBALS['phpSQLiteError'] != '') { echo '<tr><td> </td><td>' . $GLOBALS['phpSQLiteError'] . '</td></tr>'; } echo '</table>'; } restore_error_handler(); displayQuery($query); $this->tablePropView(); }