25 $oMetaData =
oxNew(
'oxDbMetaDataHandler');
26 $this->_aViewData[
"blViewSuccess"] = $oMetaData->updateViews();
35 $oAuthUser =
oxNew(
'oxuser');
36 $oAuthUser->loadAdminUser();
37 if ($oAuthUser->oxuser__oxrights->value ===
"malladmin") {
42 if ($sUpdateSQLFile && strlen($sUpdateSQLFile) > 0) {
43 if (isset($sUpdateSQL) && strlen($sUpdateSQL)) {
44 $sUpdateSQL .=
";\r\n" . $sUpdateSQLFile;
46 $sUpdateSQL = $sUpdateSQLFile;
50 $sUpdateSQL = trim(stripslashes($sUpdateSQL));
52 $iLen = $oStr->strlen($sUpdateSQL);
54 $aQueries = $this->aSQLs;
55 $this->_aViewData[
"aQueries"] = array();
56 $aPassedQueries = array();
57 $aQAffectedRows = array();
58 $aQErrorMessages = array();
59 $aQErrorNumbers = array();
61 if (count($aQueries) > 0) {
65 for ($i = 0; $i < count($aQueries); $i++) {
66 $sUpdateSQL = $aQueries[$i];
67 $sUpdateSQL = trim($sUpdateSQL);
69 if ($oStr->strlen($sUpdateSQL) > 0) {
70 $aPassedQueries[$iQueriesCounter] = nl2br(
oxStr::getStr()->htmlentities($sUpdateSQL));
71 if ($oStr->strlen($aPassedQueries[$iQueriesCounter]) > 200) {
72 $aPassedQueries[$iQueriesCounter] = $oStr->substr($aPassedQueries[$iQueriesCounter], 0, 200) .
"...";
75 while ($sUpdateSQL[$oStr->strlen($sUpdateSQL) - 1] ==
";") {
76 $sUpdateSQL = $oStr->substr($sUpdateSQL, 0, ($oStr->strlen($sUpdateSQL) - 1));
80 $oDB->execute($sUpdateSQL);
86 $aQAffectedRows [$iQueriesCounter] = null;
87 $aQErrorMessages[$iQueriesCounter] = null;
88 $aQErrorNumbers [$iQueriesCounter] = null;
90 $iErrorNum = $oDB->ErrorNo();
91 if ($iAffectedRows = $oDB->affected_Rows() !==
false && $iErrorNum == 0) {
92 $aQAffectedRows[$iQueriesCounter] = $iAffectedRows;
94 $aQErrorMessages[$iQueriesCounter] =
oxStr::getStr()->htmlentities($oDB->errorMsg());
95 $aQErrorNumbers[$iQueriesCounter] =
oxStr::getStr()->htmlentities($iErrorNum);
106 $this->_aViewData[
"aQueries"] = $aPassedQueries;
107 $this->_aViewData[
"aAffectedRows"] = $aQAffectedRows;
108 $this->_aViewData[
"aErrorMessages"] = $aQErrorMessages;
109 $this->_aViewData[
"aErrorNumbers"] = $aQErrorNumbers;
111 $this->_iDefEdit = 1;
122 if (isset($_FILES[
'myfile'][
'name'])) {
124 while (list($key, $value) = each($_FILES[
'myfile'][
'name'])) {
125 $aSource = $_FILES[
'myfile'][
'tmp_name'];
126 $sSource = $aSource[$key];
127 $aFiletype = explode(
"@", $key);
128 $key = $aFiletype[1];
129 $sType = $aFiletype[0];
130 $value = strtolower($value);
132 $aFilename = explode(
".", $value);
136 $aBadFiles = array(
"php",
'php4',
'php5',
"jsp",
"cgi",
"cmf",
"exe");
138 if (in_array($aFilename[1], $aBadFiles)) {
144 $rHandle = fopen($sSource,
"r");
145 $sContents = fread($rHandle, filesize($sSource));
175 while ($oStr->preg_match(
"/^\-\-.*\n/", $sSQL)) {
176 $sSQL = trim($oStr->preg_replace(
"/^\-\-.*\n/",
"", $sSQL));
178 while ($oStr->preg_match(
"/\n\-\-.*\n/", $sSQL)) {
179 $sSQL = trim($oStr->preg_replace(
"/\n\-\-.*\n/",
"\n", $sSQL));
182 for ($iPos = 0; $iPos < $iSQLlen; ++$iPos) {
183 $sChar = $sSQL[$iPos];
186 $iPos = $oStr->strpos($sSQL, $sStrStart, $iPos);
189 $this->aSQLs[] = $sSQL;
192 } elseif ($sStrStart ==
'`' || $sSQL[$iPos - 1] !=
'\\') {
199 $blBackslash =
false;
200 while ($iPos - $iNext > 0 && $sSQL[$iPos - $iNext] ==
'\\') {
201 $blBackslash = !$blBackslash;
213 } elseif ($sChar ==
";") {
215 $this->aSQLs[] = $oStr->substr($sSQL, 0, $iPos);
216 $sSQL = ltrim($oStr->substr($sSQL, min($iPos + 1, $iSQLlen)));
217 $iSQLlen = $oStr->strlen($sSQL);
223 } elseif (($sChar ==
'"') || ($sChar ==
'\'') || ($sChar ==
'`')) {
226 } elseif ($sChar ==
"#" || ($sChar ==
' ' && $iPos > 1 && $sSQL[$iPos - 2] . $sSQL[$iPos - 1] ==
'--')) {
228 $iCommStart = (($sSQL[$iPos] ==
"#") ? $iPos : $iPos - 2);
229 $iCommEnd = ($oStr->strpos(
' ' . $sSQL,
"\012", $iPos + 2))
230 ? $oStr->strpos(
' ' . $sSQL,
"\012", $iPos + 2)
231 : $oStr->strpos(
' ' . $sSQL,
"\015", $iPos + 2);
233 if ($iCommStart > 0) {
234 $this->aSQLs[] = trim($oStr->substr($sSQL, 0, $iCommStart));
239 $sSQL = $oStr->substr($sSQL, 0, $iCommStart) . ltrim($oStr->substr($sSQL, $iCommEnd));
240 $iSQLlen = $oStr->strlen($sSQL);
243 } elseif (32358 < 32270 && ($sChar ==
'!' && $iPos > 1 && $sSQL[$iPos - 2] . $sSQL[$iPos - 1] ==
'/*')) {
249 if (!empty($sSQL) && $oStr->preg_match(
"/[^[:space:]]+/", $sSQL)) {
250 $this->aSQLs[] = $sSQL;