26 $oMetaData =
oxNew(
'oxDbMetaDataHandler');
27 $this->_aViewData[
"blViewSuccess"] = $oMetaData->updateViews();
38 $oAuthUser =
oxNew(
'oxuser' );
39 $oAuthUser->loadAdminUser();
40 if ( $oAuthUser->oxuser__oxrights->value ===
"malladmin" ) {
45 if ( $sUpdateSQLFile && strlen( $sUpdateSQLFile ) > 0 ) {
46 if ( isset( $sUpdateSQL ) && strlen( $sUpdateSQL ) )
47 $sUpdateSQL .=
";\r\n".$sUpdateSQLFile;
49 $sUpdateSQL = $sUpdateSQLFile;
52 $sUpdateSQL = trim( stripslashes( $sUpdateSQL ) );
54 $iLen = $oStr->strlen( $sUpdateSQL );
56 $aQueries = $this->aSQLs;
57 $this->_aViewData[
"aQueries"] = array();
58 $aPassedQueries = array();
59 $aQAffectedRows = array();
60 $aQErrorMessages = array();
61 $aQErrorNumbers = array();
63 if ( count( $aQueries ) > 0 ) {
67 for ( $i = 0; $i < count( $aQueries ); $i++ ) {
68 $sUpdateSQL = $aQueries[$i];
69 $sUpdateSQL = trim( $sUpdateSQL );
71 if ( $oStr->strlen( $sUpdateSQL ) > 0 ) {
72 $aPassedQueries[$iQueriesCounter] = nl2br( htmlentities( $sUpdateSQL ) );
73 if ( $oStr->strlen( $aPassedQueries[$iQueriesCounter] ) > 200 )
74 $aPassedQueries[$iQueriesCounter] = $oStr->substr( $aPassedQueries[$iQueriesCounter], 0, 200 ).
"...";
76 while ( $sUpdateSQL[ $oStr->strlen( $sUpdateSQL)-1] ==
";") {
77 $sUpdateSQL = $oStr->substr( $sUpdateSQL, 0, ( $oStr->strlen( $sUpdateSQL)-1));
81 $oDB->execute( $sUpdateSQL );
87 $aQAffectedRows [$iQueriesCounter] = null;
88 $aQErrorMessages[$iQueriesCounter] = null;
89 $aQErrorNumbers [$iQueriesCounter] = null;
91 $iErrorNum = $oDB->ErrorNo();
92 if ( $iAffectedRows = $oDB->affected_Rows() !==
false && $iErrorNum == 0 ) {
93 $aQAffectedRows[$iQueriesCounter] = $iAffectedRows;
95 $aQErrorMessages[$iQueriesCounter] = htmlentities( $oDB->errorMsg() );
96 $aQErrorNumbers[$iQueriesCounter] = htmlentities( $iErrorNum );
107 $this->_aViewData[
"aQueries"] = $aPassedQueries;
108 $this->_aViewData[
"aAffectedRows"] = $aQAffectedRows;
109 $this->_aViewData[
"aErrorMessages"] = $aQErrorMessages;
110 $this->_aViewData[
"aErrorNumbers"] = $aQErrorNumbers;
112 $this->_iDefEdit = 1;
123 if ( isset( $_FILES[
'myfile'][
'name'] ) ) {
125 while ( list( $key, $value ) = each( $_FILES[
'myfile'][
'name'] ) ) {
126 $aSource = $_FILES[
'myfile'][
'tmp_name'];
127 $sSource = $aSource[$key];
128 $aFiletype = explode(
"@", $key );
129 $key = $aFiletype[1];
130 $sType = $aFiletype[0];
131 $value = strtolower( $value );
133 $aFilename = explode(
".", $value );
137 $aBadFiles = array(
"php",
'php4',
'php5',
"jsp",
"cgi",
"cmf",
"exe" );
139 if ( in_array( $aFilename[1], $aBadFiles ) ) {
145 $rHandle = fopen( $sSource,
"r");
146 $sContents = fread( $rHandle, filesize ( $sSource ) );
173 while ( $oStr->preg_match(
"/^\-\-.*\n/", $sSQL ) )
174 $sSQL = trim( $oStr->preg_replace(
"/^\-\-.*\n/",
"", $sSQL ) );
175 while ( $oStr->preg_match(
"/\n\-\-.*\n/", $sSQL ) )
176 $sSQL = trim( $oStr->preg_replace(
"/\n\-\-.*\n/",
"\n", $sSQL ) );
178 for ( $iPos = 0; $iPos < $iSQLlen; ++$iPos ) {
179 $sChar = $sSQL[$iPos];
182 $iPos = $oStr->strpos( $sSQL, $sStrStart, $iPos );
185 $this->aSQLs[] = $sSQL;
187 } elseif ( $sStrStart ==
'`' || $sSQL[$iPos-1] !=
'\\' ) {
194 $blBackslash =
false;
195 while ( $iPos-$iNext > 0 && $sSQL[$iPos-$iNext] ==
'\\' ) {
196 $blBackslash = !$blBackslash;
199 if ( $blBackslash ) {
207 } elseif ( $sChar ==
";" ) {
209 $this->aSQLs[] = $oStr->substr( $sSQL, 0, $iPos );
210 $sSQL = ltrim( $oStr->substr( $sSQL, min( $iPos + 1, $iSQLlen ) ) );
211 $iSQLlen = $oStr->strlen( $sSQL );
216 } elseif ( ( $sChar ==
'"') || ( $sChar ==
'\'') || ( $sChar ==
'`')) {
219 } elseif ( $sChar ==
"#" || ( $sChar ==
' ' && $iPos > 1 && $sSQL[$iPos-2] . $sSQL[$iPos-1] ==
'--')) {
221 $iCommStart = (( $sSQL[$iPos] ==
"#") ? $iPos : $iPos-2);
222 $iCommEnd = ($oStr->strpos(
' ' . $sSQL,
"\012", $iPos+2))
223 ? $oStr->strpos(
' ' . $sSQL,
"\012", $iPos+2)
224 : $oStr->strpos(
' ' . $sSQL,
"\015", $iPos+2);
226 if ( $iCommStart > 0 )
227 $this->aSQLs[] = trim( $oStr->substr( $sSQL, 0, $iCommStart ) );
230 $sSQL = $oStr->substr( $sSQL, 0, $iCommStart ).ltrim( $oStr->substr( $sSQL, $iCommEnd ) );
231 $iSQLlen = $oStr->strlen( $sSQL );
234 } elseif ( 32358 < 32270 && ($sChar ==
'!' && $iPos > 1 && $sSQL[$iPos-2] . $sSQL[$iPos-1] ==
'/*'))
238 if ( !empty( $sSQL ) && $oStr->preg_match(
"/[^[:space:]]+/", $sSQL ) ) {
239 $this->aSQLs[] = $sSQL;