/** * * Clear data from image garbage(images_garbage) table from DB * * @param integer $idx * id of image from 'image' table to delete it from garbage table * @param boolean $is_date * if TRUE then add cause with checking to delete old records by image, * if false then delete by id */ function clearImageToGarbageByCause($idx = 0, $is_date = false) { $sql = 'delete from images_garbage where '; $images = array(); // set first cause = delete images from garbage table and clean images from // server if ($is_date) { // set cause for select $cause = " TIMESTAMPADD(HOUR, " . ADMIN_GARBAGE_IMAGE_TIME_LIVE . ", createdate)<'" . date("Y-m-d H:i:s") . "'"; // get images to delete from DB garbage table $sql_all = 'SELECT id FROM images_garbage WHERE ' . $cause; $images = $this->dsp->db->Select($sql_all); // clean images from table 'images' foreach ($images as $image) { $this->clearByIDX($image['id']); } $sql .= $cause; // delete images from 'images_garbage' table $r = $this->dsp->db->Execute($sql); } else { if (!empty($idx) && IsInt($idx) > 0) { $sql .= " id=? "; $variable = (int) $idx; $r = $this->dsp->db->Execute($sql, $idx); } } if ($this->dsp->db->last_errno) { return 'db error'; } else { return false; } }
function admForumAnswer(&$session) { global $forum_id, $forum_name, $forum_description, $forum_changeid, $forum_load, $forum_insert, $forum_change; $message = null; $mode = C_New; if (isset($forum_load)) { if (empty($forum_changeid) || !IsInt($forum_changeid)) { $message = '+++ keine Id angegeben'; } else { list($forum_name, $forum_description, $dummy) = dbGetRecordById($session, T_Forum, $forum_changeid, 'name,description,readgroup,writegroup,admingroup'); $forum_id = $forum_changeid; $forum_changeid = null; $mode = C_Change; } } elseif (isset($forum_insert)) { if (empty($forum_name)) { $message = '+++ kein Name angegeben'; } elseif (empty($forum_description)) { $message = '+++ keine Beschreibung angegeben'; } elseif (dbSingleValue($session, 'select count(id) from ' . dbTable($session, T_Forum) . ' where name=' . dbSqlString($session, $forum_name)) > 0) { $message = '+++ Forum mit diesem Namen existiert schon'; } else { $id = dbInsert($session, T_Forum, 'name,description,readgroup,writegroup,admingroup', dbSqlString($session, $forum_name) . ',' . dbSqlString($session, $forum_description) . ',1,1,1'); $forum_name = $forum_description = null; $message = 'Forum wurde unter der Id ' . $id . ' eingetragen'; $mode = C_New; } } elseif (isset($forum_change)) { if (dbSingleValue($session, 'select count(id) from ' . dbTable($session, T_Forum) . ' where name=' . dbSqlString($session, $forum_name) . " and id<>{$forum_id}") > 0) { $message = '+++ Forum mit diesem Namen existiert schon'; } else { dbUpdateRaw($session, T_Forum, $forum_id, 'name=' . dbSqlString($session, $forum_name) . ',description=' . dbSqlString($session, $forum_description)); $message = "Forum {$forum_name} wurde geändert"; $forum_id = $forum_name = $forum_description = $forum_changeid = null; $mode = C_New; } } admForum($session, $message, $mode); }
function InitUpload() { global $sType, $sStyleName, $sCusDir, $sParamSYFlag, $sParamRnd; global $sAllowExt, $nAllowSize, $sUploadDir, $nUploadObject, $sAutoDir, $sBaseUrl, $sContentPath, $sSetContentPath; global $sFileExt, $sOriginalFileName, $sSaveFileName, $sPathFileName, $nFileNum; global $nSLTFlag, $nSLTMode, $nSLTCheckFlag, $nSLTMinSize, $nSLTOkSize, $nSYWZFlag, $sSYText, $sSYFontColor, $nSYFontSize, $sSYFontName, $sSYPicPath, $nSLTSYObject, $sSLTSYExt, $nSYWZMinWidth, $sSYShadowColor, $nSYShadowOffset, $nSYWZMinHeight, $nSYWZPosition, $nSYWZTextWidth, $nSYWZTextHeight, $nSYWZPaddingH, $nSYWZPaddingV, $nSYTPFlag, $nSYTPMinWidth, $nSYTPMinHeight, $nSYTPPosition, $nSYTPPaddingH, $nSYTPPaddingV, $nSYTPImageWidth, $nSYTPImageHeight, $nSYTPOpacity; global $sSpaceSize, $sSpacePath, $sMFUMode; global $sParamBlockFile, $sParamBlockFlag; global $sFileNameMode, $sFileNameSameFix, $sAutoDirOrderFlag, $sAutoTypeDir; global $sSYValidNormal, $sSYValidLocal, $sSYValidRemote; $sType = TrimGet("type"); $sStyleName = TrimGet("style"); $sCusDir = TrimGet("cusdir"); $sParamSYFlag = TrimGet("syflag"); $sParamRnd = TrimGet("rnd"); $s_SKey = TrimGet("skey"); $s_SParams = TrimGet("sparams"); $sParamBlockFile = TrimGet("blockfile"); $sParamBlockFlag = TrimGet("blockflag"); if ($sParamBlockFile != "") { if (!IsFileNameFormat($sParamBlockFile)) { OutScript("blockfile"); exit; } } $bValidStyle = false; $numElements = count($GLOBALS["aStyle"]); for ($i = 1; $i <= $numElements; $i++) { $aStyleConfig = explode("|||", $GLOBALS["aStyle"][$i]); if (strtolower($sStyleName) == strtolower($aStyleConfig[0])) { $bValidStyle = true; break; } } if ($bValidStyle == false) { OutScript("parent.UploadError('style')"); } if ($aStyleConfig[61] != "1") { $sCusDir = ""; } if ($aStyleConfig[61] == "2" && ($s_SKey != "" || IsOkSParams($s_SParams, $aStyleConfig[70]))) { $ss_FileSize = ""; $ss_FileBrowse = ""; $ss_SpaceSize = ""; $ss_SpacePath = ""; $ss_PathMode = ""; $ss_PathUpload = ""; $ss_PathCusDir = ""; $ss_PathCode = ""; $ss_PathView = ""; if ($s_SKey != "") { $ss_FileSize = GetSAPIvalue($s_SKey, "FileSize"); $ss_FileBrowse = GetSAPIvalue($s_SKey, "FileBrowse"); $ss_SpaceSize = GetSAPIvalue($s_SKey, "SpaceSize"); $ss_SpacePath = GetSAPIvalue($s_SKey, "SpacePath"); $ss_PathMode = GetSAPIvalue($s_SKey, "PathMode"); $ss_PathUpload = GetSAPIvalue($s_SKey, "PathUpload"); $ss_PathCusDir = GetSAPIvalue($s_SKey, "PathCusDir"); $ss_PathCode = GetSAPIvalue($s_SKey, "PathCode"); $ss_PathView = GetSAPIvalue($s_SKey, "PathView"); } else { $a_SParams = explode("|", $s_SParams); $ss_FileSize = $a_SParams[1]; $ss_FileBrowse = $a_SParams[2]; $ss_SpaceSize = $a_SParams[3]; $ss_SpacePath = $a_SParams[4]; $ss_PathMode = $a_SParams[5]; $ss_PathUpload = $a_SParams[6]; $ss_PathCusDir = $a_SParams[7]; $ss_PathCode = $a_SParams[8]; $ss_PathView = $a_SParams[9]; } if (is_numeric($ss_FileSize)) { $aStyleConfig[11] = $ss_FileSize; $aStyleConfig[12] = $ss_FileSize; $aStyleConfig[13] = $ss_FileSize; $aStyleConfig[14] = $ss_FileSize; $aStyleConfig[15] = $ss_FileSize; $aStyleConfig[45] = $ss_FileSize; } else { $ss_FileSize = ""; } if ($ss_FileBrowse == "0" || $ss_FileBrowse == "1") { $aStyleConfig[43] = $ss_FileBrowse; } else { $ss_FileBrowse = ""; } if (is_numeric($ss_SpaceSize)) { $aStyleConfig[78] = $ss_SpaceSize; } else { $ss_SpaceSize = ""; } if ($ss_PathMode != "") { $aStyleConfig[19] = $ss_PathMode; } if ($ss_PathUpload != "") { $aStyleConfig[3] = $ss_PathUpload; } if ($ss_PathCode != "") { $aStyleConfig[23] = $ss_PathCode; } if ($ss_PathView != "") { $aStyleConfig[22] = $ss_PathView; } $sCusDir = $ss_PathCusDir; $sSpacePath = $ss_SpacePath; } else { $sSpacePath = ""; } $sBaseUrl = $aStyleConfig[19]; $nUploadObject = (int) $aStyleConfig[20]; $sAutoDir = $aStyleConfig[71]; $sUploadDir = $aStyleConfig[3]; if ($sBaseUrl != "3") { if (substr($sUploadDir, 0, 1) != "/") { $sUploadDir = "../" . $sUploadDir; } } switch ($sBaseUrl) { case "0": case "3": $sContentPath = $aStyleConfig[23]; break; case "1": $sContentPath = RelativePath2RootPath($sUploadDir); break; case "2": $sContentPath = RootPath2DomainPath(RelativePath2RootPath($sUploadDir)); break; } $sSetContentPath = $sContentPath; if ($sBaseUrl != "3") { $sUploadDir = realpath($sUploadDir); } if (substr($sUploadDir, -1) != "\\" && substr($sUploadDir, -1) != "/") { $sUploadDir .= "/"; } switch (strtoupper($sType)) { case "REMOTE": $sAllowExt = $aStyleConfig[10]; $nAllowSize = (int) $aStyleConfig[15]; $sAutoTypeDir = $aStyleConfig[93]; break; case "FILE": $sAllowExt = $aStyleConfig[6]; $nAllowSize = (int) $aStyleConfig[11]; $sAutoTypeDir = $aStyleConfig[92]; break; case "MEDIA": $sAllowExt = $aStyleConfig[9]; $nAllowSize = (int) $aStyleConfig[14]; $sAutoTypeDir = $aStyleConfig[91]; break; case "FLASH": $sAllowExt = $aStyleConfig[7]; $nAllowSize = (int) $aStyleConfig[12]; $sAutoTypeDir = $aStyleConfig[90]; break; case "LOCAL": $sAllowExt = $aStyleConfig[44]; $nAllowSize = (int) $aStyleConfig[45]; $sAutoTypeDir = $aStyleConfig[94]; break; default: $sAllowExt = $aStyleConfig[8]; $nAllowSize = (int) $aStyleConfig[13]; $sAutoTypeDir = $aStyleConfig[89]; break; } $sAllowExt = strtoupper($sAllowExt); $nSLTFlag = (int) $aStyleConfig[29]; $nSLTMode = (int) $aStyleConfig[69]; $nSLTCheckFlag = (int) $aStyleConfig[77]; $nSLTMinSize = (int) $aStyleConfig[30]; $nSLTOkSize = (int) $aStyleConfig[31]; $nSYWZFlag = (int) $aStyleConfig[32]; $sSYText = $aStyleConfig[33]; $sSYFontColor = $aStyleConfig[34]; $nSYFontSize = (int) $aStyleConfig[35]; $sSYFontName = $aStyleConfig[36]; $sSYPicPath = $aStyleConfig[37]; $nSLTSYObject = (int) $aStyleConfig[38]; $sSLTSYExt = $aStyleConfig[39]; $nSYWZMinWidth = (int) $aStyleConfig[40]; $sSYShadowColor = $aStyleConfig[41]; $nSYShadowOffset = (int) $aStyleConfig[42]; $nSYWZMinHeight = (int) $aStyleConfig[46]; $nSYWZPosition = (int) $aStyleConfig[47]; $nSYWZTextWidth = (int) $aStyleConfig[48]; $nSYWZTextHeight = (int) $aStyleConfig[49]; $nSYWZPaddingH = (int) $aStyleConfig[50]; $nSYWZPaddingV = (int) $aStyleConfig[51]; $nSYTPFlag = (int) $aStyleConfig[52]; $nSYTPMinWidth = (int) $aStyleConfig[53]; $nSYTPMinHeight = (int) $aStyleConfig[54]; $nSYTPPosition = (int) $aStyleConfig[55]; $nSYTPPaddingH = (int) $aStyleConfig[56]; $nSYTPPaddingV = (int) $aStyleConfig[57]; $nSYTPImageWidth = (int) $aStyleConfig[58]; $nSYTPImageHeight = (int) $aStyleConfig[59]; $nSYTPOpacity = (double) $aStyleConfig[60]; $sSpaceSize = $aStyleConfig[78]; $sMFUMode = $aStyleConfig[79]; $sFileNameMode = $aStyleConfig[68]; $sFileNameSameFix = $aStyleConfig[87]; $sAutoDirOrderFlag = $aStyleConfig[88]; $sSYValidNormal = $aStyleConfig[99]; $sSYValidLocal = $aStyleConfig[100]; $sSYValidRemote = $aStyleConfig[101]; if (($GLOBALS["sAction"] == "SAVE" || $GLOBALS["sAction"] == "MFU") && $sSYValidNormal != "1" || $GLOBALS["sAction"] == "LOCAL" && $sSYValidLocal != "1" || $GLOBALS["sAction"] == "REMOTE" && $sSYValidRemote != "1") { $nSYWZFlag = 0; $nSYTPFlag = 0; } if ($nSYWZFlag == 2) { if ($sParamSYFlag == "1") { $nSYWZFlag = 1; } else { $nSYWZFlag = 0; } } if ($nSYTPFlag == 2) { if ($sParamSYFlag == "1") { $nSYTPFlag = 1; } else { $nSYTPFlag = 0; } } if (!IsInt($sParamRnd)) { $sParamRnd = ""; } if ($sCusDir != "") { $sCusDir = str_replace("\\", "/", $sCusDir); if (substr($sCusDir, 0, 1) == "/" || substr($sCusDir, 0, 1) == "." || substr($sCusDir, -1) == "." || strpos($sCusDir, "./") !== false || strpos($sCusDir, "/.") !== false || strpos($sCusDir, "//") !== false || strpos($sCusDir, "..") !== false) { $sCusDir = ""; } else { if (substr($sCusDir, -1) != "/") { $sCusDir = $sCusDir . "/"; } } } }