/**
  * 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>";
     }
 }
 /**
  * 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>";
     }
 }