Example #1
0
 function Zip($name)
 {
     $file = new File($this->tmpdir . "/" . $name, FALSE);
     if ($file->exists()) {
         $file->delFile();
         $file->createFile();
     }
     $zip = APIC::LoadClass("org.apicnet.io.archive.CZip");
     if ($this->docExist) {
         $cdir = new CDir();
         $cdir->Read($this->tmpdir . "/", "", true, 5, true, true);
         $allFiles = array();
         reset($cdir->aFiles);
         while (list($sKey, $aFile) = each($cdir->aFiles)) {
             $sFileName = $cdir->FileName($aFile);
             $sFilePath = $cdir->GetPath($aFile);
             $allFiles[] = $this->tmpdir . "/" . $sFilePath . $sFileName;
         }
         $zip->zip($allFiles, $name);
     } else {
         $this->ErrorTracker(4, "Vous devez d'abord crรฉer un document OpenOffice", 'Zip', __FILE__, __LINE__);
     }
 }
 function deleteFile($strPathFile)
 {
     if (!empty($strPathFile)) {
         $objFile = new \File();
         $arrFileInfo = pathinfo($strPathFile);
         $fileName = $arrFileInfo['basename'];
         //delete file
         if (file_exists(\Env::get('cx')->getWebsitePath() . $strPathFile)) {
             $objFile->delFile($this->imagePath, $this->imageWebPath, 'uploads/' . $fileName);
         }
     }
 }
 /**
  * delete selected file
  * @access   public
  * @param    string  $id
  * @global    array
  * @global    ADONewConnection
  * @global    array
  */
 function delFile($id)
 {
     global $_CONFIG, $objDatabase, $_ARRAYLANG;
     $arrImages = array();
     $arrUploads = array();
     $arrRSS = array();
     //get file data
     $objResult = $objDatabase->Execute("SELECT  title,\n                                                    attachment,\n                                                    logo,\n                                                    rss_file,\n                                                    map,\n                                                    lokal,\n                                                    spez_field_11,\n                                                    spez_field_12,\n                                                    spez_field_13,\n                                                    spez_field_14,\n                                                    spez_field_15,\n                                                    spez_field_16,\n                                                    spez_field_17,\n                                                    spez_field_18,\n                                                    spez_field_19,\n                                                    spez_field_20,\n                                                    spez_field_25,\n                                                    spez_field_26,\n                                                    spez_field_27,\n                                                    spez_field_28,\n                                                    spez_field_29 FROM " . DBPREFIX . "module_directory_dir WHERE id='{$id}'");
     if ($objResult !== false) {
         while (!$objResult->EOF) {
             $name = $objResult->fields['title'];
             $file = $objResult->fields['filename'];
             $typ = $objResult->fields['typ'];
             array_push($arrImages, $objResult->fields['logo']);
             array_push($arrImages, $objResult->fields['map']);
             array_push($arrImages, $objResult->fields['lokal']);
             array_push($arrImages, $objResult->fields['spez_field_11']);
             array_push($arrImages, $objResult->fields['spez_field_12']);
             array_push($arrImages, $objResult->fields['spez_field_13']);
             array_push($arrImages, $objResult->fields['spez_field_14']);
             array_push($arrImages, $objResult->fields['spez_field_15']);
             array_push($arrImages, $objResult->fields['spez_field_16']);
             array_push($arrImages, $objResult->fields['spez_field_17']);
             array_push($arrImages, $objResult->fields['spez_field_18']);
             array_push($arrImages, $objResult->fields['spez_field_19']);
             array_push($arrImages, $objResult->fields['spez_field_20']);
             array_push($arrUploads, $objResult->fields['attachment']);
             array_push($arrUploads, $objResult->fields['spez_field_25']);
             array_push($arrUploads, $objResult->fields['spez_field_26']);
             array_push($arrUploads, $objResult->fields['spez_field_27']);
             array_push($arrUploads, $objResult->fields['spez_field_28']);
             array_push($arrUploads, $objResult->fields['spez_field_29']);
             array_push($arrRSS, $objResult->fields['rss_file']);
             $objResult->MoveNext();
         }
     }
     $obj_file = new \File();
     //del images
     foreach ($arrImages as $arrKey => $arrFile) {
         //thumb
         if (file_exists($this->mediaPath . "thumbs/" . $arrFile) && !empty($arrFile)) {
             $this->dirLog = $obj_file->delFile($this->mediaPath, $this->mediaWebPath, "thumbs/" . $arrFile);
         }
         //picture
         if (file_exists($this->mediaPath . "images/" . $arrFile) && !empty($arrFile)) {
             $this->dirLog = $obj_file->delFile($this->mediaPath, $this->mediaWebPath, "images/" . $arrFile);
         }
     }
     //del uploads
     foreach ($arrUploads as $arrKey => $arrFile) {
         //file
         if (file_exists($this->mediaPath . "uploads/" . $arrFile) && !empty($arrFile)) {
             $this->dirLog = $obj_file->delFile($this->mediaPath, $this->mediaWebPath, "uploads/" . $arrFile);
         }
     }
     //del rss
     foreach ($arrRSS as $arrKey => $arrFile) {
         //file
         if (file_exists($this->mediaPath . "ext_feeds/" . $arrFile) && !empty($arrFile)) {
             $this->dirLog = $obj_file->delFile($this->mediaPath, $this->mediaWebPath, "ext_feeds/" . $arrFile);
         }
     }
     if ($this->dirLog != "error") {
         $objResult = $objDatabase->Execute("DELETE FROM " . DBPREFIX . "module_directory_dir WHERE id='{$id}'");
         $objResult = $objDatabase->Execute("DELETE FROM " . DBPREFIX . "module_directory_rel_dir_cat WHERE dir_id='" . $id . "'");
         $objResult = $objDatabase->Execute("DELETE FROM " . DBPREFIX . "module_directory_rel_dir_level WHERE dir_id='" . $id . "'");
         $this->restoreVoting($id);
         $this->strOkMessage = $_ARRAYLANG['TXT_DIR_FEED_SUCCESSFULL_DEL'];
         $this->dirLog = "";
     } else {
         $this->strErrMessage = $_ARRAYLANG['TXT_DIR_CORRUPT_DEL'];
     }
 }
Example #4
0
 /**
  * absOOo::save(), sauvegarde le fichier xml courant
  * 
  * @return  none
  * @access private
  **/
 function save()
 {
     $XMLContent = $this->toString();
     $xmlFile = new File($this->DIRXML . "/" . $this->FILENAME, TRUE);
     if ($xmlFile->exists()) {
         $xmlFile->delFile();
         $xmlFile->createFile();
     }
     $xmlFile->writeData($XMLContent);
 }
 /**
  * update selected file
  * @access   public
  * @global    array
  * @global    ADONewConnection
  * @global    array
  */
 function updateFile($addedby)
 {
     global $_CONFIG, $objDatabase, $_ARRAYLANG;
     //get post data
     if (isset($_POST['edit_submit'])) {
         $dirId = intval($_POST['edit_id']);
         $query = "UPDATE " . DBPREFIX . "module_directory_dir SET ";
         foreach ($_POST["inputValue"] as $inputName => $inputValue) {
             switch ($inputName) {
                 case 'lat':
                 case 'lat_fraction':
                 case 'lon':
                 case 'lon_fraction':
                 case 'zoom':
                     continue 2;
             }
             //check links
             if ($inputName == "relatedlinks" || $inputName == "homepage" || $inputName == "link") {
                 if (substr($inputValue, 0, 7) != "http://" && $inputValue != "") {
                     $inputValue = "http://" . $inputValue;
                 }
             }
             //check rss
             if ($inputName == "rss_link") {
                 $objResultRSS = $objDatabase->SelectLimit("SELECT rss_link, rss_file FROM " . DBPREFIX . "module_directory_dir WHERE id = '" . $dirId . "'", 1);
                 $oldRssLink = $objResultRSS->fields['rss_link'];
                 $oldRssFile = $objResultRSS->fields['rss_file'];
                 if ($inputValue != $oldRssLink) {
                     $obj_file = new \File();
                     $obj_file->delFile($this->mediaPath, $this->mediaWebPath, "ext_feeds/" . $oldRssFile);
                     //create rss
                     $link = $inputValue;
                     $rss_file = $this->createXML($link);
                     if (substr($inputValue, 0, 7) != "http://" && $inputValue != "") {
                         $inputValue = "http://" . $inputValue;
                     }
                     if ($rss_file == "error") {
                         $inputValue = "";
                         $rss_file = "";
                     }
                 } else {
                     $inputValue = $oldRssLink;
                     $rss_file = $oldRssLink;
                 }
             }
             //get author id
             if ($inputName == "addedby") {
                 if ($addedby != '') {
                     $inputValue = $addedby;
                 } else {
                     $inputValue = $this->getAuthorID($inputValue);
                 }
             }
             //check pics
             if ($inputName == "logo" || $inputName == "lokal" || $inputName == "map" || $inputName == "spez_field_11" || $inputName == "spez_field_12" || $inputName == "spez_field_13" || $inputName == "spez_field_14" || $inputName == "spez_field_15" || $inputName == "spez_field_16" || $inputName == "spez_field_17" || $inputName == "spez_field_18" || $inputName == "spez_field_19" || $inputName == "spez_field_20") {
                 if (!empty($_FILES[$inputName]['name']) || $_POST["deleteMedia"][$inputName] == 1) {
                     $obj_file = new \File();
                     //thumb
                     if (file_exists($this->mediaPath . "thumbs/" . $_POST["inputValue"][$inputName])) {
                         $obj_file->delFile($this->mediaPath, $this->mediaWebPath, "thumbs/" . $_POST["inputValue"][$inputName]);
                     }
                     //picture
                     if (file_exists($this->mediaPath . "images/" . $_POST["inputValue"][$inputName]) && $_POST["inputValue"][$inputName] != 'no_picture.gif') {
                         $obj_file->delFile($this->mediaPath, $this->mediaWebPath, "images/" . $_POST["inputValue"][$inputName]);
                     }
                     if ($_POST["deleteMedia"][$inputName] != 1) {
                         $inputValue = $this->uploadMedia($inputName, "images/");
                         if ($inputValue == "error") {
                             $inputValue = "";
                         }
                     } else {
                         $inputValue = "";
                     }
                 }
             }
             //check uploads
             $arrSpezialUploadFields = array('attachment', 'spez_field_25', 'spez_field_26', 'spez_field_27', 'spez_field_28', 'spez_field_29');
             if (in_array($inputName, $arrSpezialUploadFields)) {
                 if (!empty($_FILES[$inputName]['name']) || $_POST["deleteMedia"][$inputName] == 1) {
                     $obj_file = new \File();
                     //upload
                     if (file_exists($this->mediaPath . "uploads/" . $_POST["inputValue"][$inputName])) {
                         $obj_file->delFile($this->mediaPath, $this->mediaWebPath, "uploads/" . $_POST["inputValue"][$inputName]);
                     }
                     if ($_POST["deleteMedia"][$inputName] != 1) {
                         $inputValue = $this->uploadMedia($inputName, "uploads/");
                         if ($inputValue == "error") {
                             $inputValue = "";
                         }
                     } else {
                         $inputValue = "";
                     }
                 } else {
                     $inputValue = "";
                 }
             }
             /*
              * spezial upload fields must be updated only when new file is uploaded or old one is deleted
              * other input types must be updated unconditionally.
              */
             if (!in_array($inputName, $arrSpezialUploadFields)) {
                 $query .= contrexx_addslashes($inputName) . " ='" . contrexx_strip_tags(contrexx_addslashes($inputValue)) . "', ";
             } else {
                 if (in_array($inputName, $arrSpezialUploadFields) && (!empty($_FILES[$inputName]['name']) || $_POST["deleteMedia"][$inputName] == 1)) {
                     $query .= contrexx_addslashes($inputName) . " ='" . contrexx_strip_tags(contrexx_addslashes($inputValue)) . "', ";
                 }
             }
         }
         //get status settings
         $objResult = $objDatabase->Execute("SELECT setvalue FROM " . DBPREFIX . "module_directory_settings WHERE setname = 'editFeed_status' LIMIT 1");
         if ($objResult !== false) {
             while (!$objResult->EOF) {
                 $entryStatus = $objResult->fields['setvalue'];
                 $objResult->MoveNext();
             }
         }
         //numbers could be too big for intavl(), use contrexx_addslashes() instead...
         $query .= " premium='" . $_POST["premium"] . "', status='" . intval($entryStatus) . "',  validatedate='" . mktime("now") . "', longitude='" . contrexx_addslashes($_REQUEST['inputValue']['lon']) . '.' . contrexx_addslashes($_POST['inputValue']['lon_fraction']) . "', latitude='" . contrexx_addslashes($_REQUEST['inputValue']['lat']) . '.' . contrexx_addslashes($_REQUEST['inputValue']['lat_fraction']) . "', zoom='" . intval($_REQUEST['inputValue']['zoom']) . "' WHERE id='" . $dirId . "'";
         //edit entry
         $objResult = $objDatabase->Execute($query);
         if ($objResult !== false) {
             $objResult = $objDatabase->Execute("DELETE FROM " . DBPREFIX . "module_directory_rel_dir_cat WHERE dir_id='" . $dirId . "'");
             $objResult = $objDatabase->Execute("DELETE FROM " . DBPREFIX . "module_directory_rel_dir_level WHERE dir_id='" . $dirId . "'");
             foreach ($_POST["selectedCat"] as $inputName => $inputValue) {
                 $query = "INSERT INTO " . DBPREFIX . "module_directory_rel_dir_cat SET dir_id='" . $dirId . "', cat_id='" . $inputValue . "'";
                 $objDatabase->query($query);
             }
             foreach ($_POST["selectedLevel"] as $inputName => $inputValue) {
                 $query = "INSERT INTO " . DBPREFIX . "module_directory_rel_dir_level SET dir_id='" . $dirId . "', level_id='" . $inputValue . "'";
                 $objDatabase->query($query);
             }
             if ($entryStatus == 1) {
                 // TODO: $id is never set!
                 $this->confirmEntry_step2($id);
             }
             $this->strOkMessage = $_ARRAYLANG['TXT_FEED_SUCCESSFULL_ADDED'];
             $status = $dirId;
             $this->createRSS();
         }
         //update xml
         $this->createRSS();
         return $status;
     }
     return false;
 }
Example #6
0
 function editEntry()
 {
     global $objDatabase, $_ARRAYLANG, $_CORELANG, $_CONFIG;
     $this->_objTpl->setTemplate($this->pageContent, true, true);
     if (!$this->settings['editEntry'] == '1' || !$this->communityModul && $this->settings['addEntry_only_community'] == '1') {
         \Cx\Core\Csrf\Controller\Csrf::header('Location: index.php?section=Market&cmd=detail&id=' . $_POST['id']);
         exit;
     } elseif ($this->settings['addEntry_only_community'] == '1') {
         $objFWUser = \FWUser::getFWUserObject();
         if ($objFWUser->objUser->login()) {
             if (!\Permission::checkAccess(100, 'static', true)) {
                 \Cx\Core\Csrf\Controller\Csrf::header("Location: " . CONTREXX_DIRECTORY_INDEX . "?section=Login&cmd=noaccess");
                 exit;
             }
         } else {
             $link = base64_encode(CONTREXX_DIRECTORY_INDEX . '?' . $_SERVER['QUERY_STRING']);
             \Cx\Core\Csrf\Controller\Csrf::header("Location: " . CONTREXX_DIRECTORY_INDEX . "?section=Login&redirect=" . $link);
             exit;
         }
     } else {
         $objFWUser = \FWUser::getFWUserObject();
     }
     //get search
     $this->getSearch();
     $this->_objTpl->setVariable(array('TXT_MARKET_TITLE' => $_ARRAYLANG['TXT_EDIT_ADVERTISEMENT'], 'TXT_MARKET_TITLE_ENTRY' => $_ARRAYLANG['TXT_MARKET_TITLE'], 'TXT_MARKET_NAME' => $_CORELANG['TXT_NAME'], 'TXT_MARKET_EMAIL' => $_CORELANG['TXT_EMAIL'], 'TXT_MARKET_DESCRIPTION' => $_CORELANG['TXT_DESCRIPTION'], 'TXT_MARKET_SAVE' => $_CORELANG['TXT_SAVE'], 'TXT_MARKET_FIELDS_REQUIRED' => $_ARRAYLANG['TXT_MARKET_CATEGORY_ADD_FILL_FIELDS'], 'TXT_MARKET_THOSE_FIELDS_ARE_EMPTY' => $_ARRAYLANG['TXT_MARKET_FIELDS_NOT_CORRECT'], 'TXT_MARKET_PICTURE' => $_CORELANG['TXT_IMAGE'], 'TXT_MARKET_CATEGORIE' => $_CORELANG['TXT_CATEGORY'], 'TXT_MARKET_PRICE' => $_ARRAYLANG['TXT_MARKET_PRICE'] . ' ' . $this->settings['currency'], 'TXT_MARKET_TYPE' => $_CORELANG['TXT_TYPE'], 'TXT_MARKET_OFFER' => $_ARRAYLANG['TXT_MARKET_OFFER'], 'TXT_MARKET_SEARCH' => $_ARRAYLANG['TXT_MARKET_SEARCH'], 'TXT_MARKET_FOR_FREE' => $_ARRAYLANG['TXT_MARKET_FREE'], 'TXT_MARKET_AGREEMENT' => $_ARRAYLANG['TXT_MARKET_ARRANGEMENT'], 'TXT_MARKET_ADDED_BY' => $_ARRAYLANG['TXT_MARKET_ADDEDBY'], 'TXT_MARKET_USER_DETAIL' => $_ARRAYLANG['TXT_MARKET_USERDETAILS'], 'TXT_MARKET_DETAIL_SHOW' => $_ARRAYLANG['TXT_MARKET_SHOW_IN_ADVERTISEMENT'], 'TXT_MARKET_DETAIL_HIDE' => $_ARRAYLANG['TXT_MARKET_NO_SHOW_IN_ADVERTISEMENT']));
     if (isset($_GET['id'])) {
         $entryId = contrexx_addslashes($_GET['id']);
         $objResult = $objDatabase->Execute('SELECT type, title, description, premium, picture, catid, price, regdate, enddate, userid, name, email, userdetails, spez_field_1, spez_field_2, spez_field_3, spez_field_4, spez_field_5 FROM ' . DBPREFIX . 'module_market WHERE id = ' . $entryId . ' LIMIT 1');
         if ($objResult !== false) {
             while (!$objResult->EOF) {
                 if ($objFWUser->objUser->login() && $objFWUser->objUser->getId() == $objResult->fields['userid'] || \Permission::hasAllAccess()) {
                     //entry type
                     if ($objResult->fields['type'] == 'offer') {
                         $offer = 'checked';
                         $search = '';
                     } else {
                         $offer = '';
                         $search = 'checked';
                     }
                     //entry price
                     if ($objResult->fields['price'] == 'forfree') {
                         $forfree = 'checked';
                         $price = '';
                         $agreement = '';
                     } elseif ($objResult->fields['price'] == 'agreement') {
                         $agreement = 'checked';
                         $price = '';
                         $forfree = '';
                     } else {
                         $price = $objResult->fields['price'];
                         $forfree = '';
                         $agreement = '';
                     }
                     //entry user
                     $objResultUser = $objDatabase->Execute('SELECT username FROM ' . DBPREFIX . 'access_users WHERE id = ' . $objResult->fields['userid'] . ' LIMIT 1');
                     if ($objResultUser !== false) {
                         $addedby = $objResultUser->fields('username');
                     }
                     //entry userdetails
                     if ($objResult->fields['userdetails'] == '1') {
                         $userdetailsOn = 'checked';
                         $userdetailsOff = '';
                     } else {
                         $userdetailsOn = '';
                         $userdetailsOff = 'checked';
                     }
                     //entry picture
                     if ($objResult->fields['picture'] != '') {
                         $picture = '<img width="100" src="' . $this->mediaWebPath . 'pictures/' . $objResult->fields['picture'] . '" border="0" alt="" /><br /><br />';
                     } else {
                         $picture = '<img src="' . $this->mediaWebPath . 'pictures/no_picture.gif" border="0" alt="" /><br /><br />';
                     }
                     //entry category
                     $this->getCategories();
                     $categories = '';
                     $checked = '';
                     // TODO: Never used
                     //                        $catID            = $objResult->fields['catid'];
                     foreach (array_keys($this->categories) as $catId) {
                         $catId == $objResult->fields['catid'] ? $checked = 'selected' : ($checked = '');
                         $categories .= '<option value="' . $catId . '" ' . $checked . '>' . $this->categories[$catId]['name'] . '</option>';
                     }
                     //spez fields
                     $objSpezFields = $objDatabase->Execute("SELECT id, name, value FROM " . DBPREFIX . "module_market_spez_fields WHERE lang_id = '1' AND active='1' ORDER BY id DESC");
                     if ($objSpezFields !== false) {
                         while (!$objSpezFields->EOF) {
                             // TODO: Never used
                             //                                ($i % 2)? $class = "row2" : $class = "row1";
                             $input = '<input type="text" name="spez_' . $objSpezFields->fields['id'] . '" value="' . $objResult->fields[$objSpezFields->fields['name']] . '" style="width: 300px;" maxlength="100">';
                             // initialize variables
                             $this->_objTpl->setVariable(array('TXT_MARKET_SPEZ_FIELD_NAME' => $objSpezFields->fields['value'], 'MARKET_SPEZ_FIELD_INPUT' => $input));
                             $this->_objTpl->parse('spez_fields');
                             // TODO: $class is never used
                             //                                $i++;
                             $objSpezFields->MoveNext();
                         }
                     }
                     $this->_objTpl->setVariable(array('MARKET_ENTRY_ID' => $entryId, 'MARKET_ENTRY_TYPE_OFFER' => $offer, 'MARKET_ENTRY_TYPE_SEARCH' => $search, 'MARKET_ENTRY_TITLE' => $objResult->fields['title'], 'MARKET_ENTRY_DESCRIPTION' => $objResult->fields['description'], 'MARKET_ENTRY_PICTURE' => $picture, 'MARKET_ENTRY_PICTURE_OLD' => $objResult->fields['picture'], 'MARKET_CATEGORIES' => $categories, 'MARKET_ENTRY_PRICE' => $price, 'MARKET_ENTRY_FORFREE' => $forfree, 'MARKET_ENTRY_AGREEMENT' => $agreement, 'MARKET_ENTRY_ADDEDBY' => $addedby, 'MARKET_ENTRY_ADDEDBY_ID' => $objResult->fields['userid'], 'MARKET_ENTRY_USERDETAILS_ON' => $userdetailsOn, 'MARKET_ENTRY_USERDETAILS_OFF' => $userdetailsOff, 'MARKET_ENTRY_NAME' => $objResult->fields['name'], 'MARKET_ENTRY_EMAIL' => $objResult->fields['email']));
                     $objResult->MoveNext();
                 } else {
                     \Cx\Core\Csrf\Controller\Csrf::header('Location: index.php?section=Market&cmd=detail&id=' . $_GET['id']);
                     exit;
                 }
             }
             //get navigatin
             $this->getNavigation($catID);
         }
     } else {
         if (isset($_POST['submitEntry'])) {
             if ($_FILES['pic']['name'] != "") {
                 $picture = $this->uploadPicture();
                 if ($picture != "error") {
                     $objFile = new \File();
                     $objFile->delFile($this->mediaPath, $this->mediaWebPath, "pictures/" . $_POST['picOld']);
                 }
             } else {
                 $picture = $_POST['picOld'];
             }
             if ($picture != "error") {
                 if ($_POST['forfree'] == 1) {
                     $price = "forfree";
                 } elseif ($_POST['agreement'] == 1) {
                     $price = "agreement";
                 } else {
                     $price = contrexx_addslashes($_POST['price']);
                 }
                 $objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_market SET\n                                        type='" . contrexx_addslashes($_POST['type']) . "',\n                                          title='" . contrexx_addslashes($_POST['title']) . "',\n                                          description='" . contrexx_addslashes($_POST['description']) . "',\n                                          picture='" . contrexx_addslashes($picture) . "',\n                                          catid='" . contrexx_addslashes($_POST['cat']) . "',\n                                          price='" . $price . "',\n                                          name='" . contrexx_addslashes($_POST['name']) . "',\n                                          email='" . contrexx_addslashes($_POST['email']) . "',\n                                          spez_field_1='" . contrexx_addslashes($_POST['spez_1']) . "',\n                                          spez_field_2='" . contrexx_addslashes($_POST['spez_2']) . "',\n                                          spez_field_3='" . contrexx_addslashes($_POST['spez_3']) . "',\n                                          spez_field_4='" . contrexx_addslashes($_POST['spez_4']) . "',\n                                          spez_field_5='" . contrexx_addslashes($_POST['spez_5']) . "',\n                                          userdetails='" . contrexx_addslashes($_POST['userdetails']) . "'\n                                          WHERE id='" . contrexx_addslashes($_POST['id']) . "'");
                 if ($objResult !== false) {
                     \Cx\Core\Csrf\Controller\Csrf::header('Location: index.php?section=Market&cmd=detail&id=' . $_POST['id']);
                     exit;
                 } else {
                     // TODO: Never used
                     //                        $error = $_CORELANG['TXT_DATABASE_QUERY_ERROR'];
                     \Cx\Core\Csrf\Controller\Csrf::header('Location: index.php?section=Market&cmd=edit&id=' . $_POST['id']);
                     exit;
                 }
             } else {
                 // TODO: Never used
                 //                    $error = $_CORELANG['TXT_MARKET_IMAGE_UPLOAD_ERROR'];
                 \Cx\Core\Csrf\Controller\Csrf::header('Location: index.php?section=Market&cmd=edit&id=' . $_POST['id']);
                 exit;
             }
         } else {
             \Cx\Core\Csrf\Controller\Csrf::header('Location: index.php?section=Market');
             exit;
         }
     }
 }
Example #7
0
 function _deleteMedium($id)
 {
     global $objDatabase;
     $query = "SELECT `thumbnail`\n                  FROM `" . DBPREFIX . "module_podcast_medium`\n                  WHERE `id` = " . $id;
     if (($objRS = $objDatabase->SelectLimit($query, 1)) !== false) {
         $thumbNail = $objRS->fields['thumbnail'];
         $objFile = new \File();
         $objFile->delFile(ASCMS_DOCUMENT_ROOT, ASCMS_PATH_OFFSET, $thumbNail);
     }
     if ($objDatabase->Execute("DELETE FROM " . DBPREFIX . "module_podcast_rel_medium_category WHERE medium_id=" . $id) !== false) {
         if ($objDatabase->Execute("DELETE FROM " . DBPREFIX . "module_podcast_medium WHERE id=" . $id) !== false) {
             return true;
         }
     }
     return false;
 }
 function deleteImage($strPathImage)
 {
     if (!empty($strPathImage)) {
         $objFile = new \File();
         $arrImageInfo = pathinfo($strPathImage);
         $imageName = $arrImageInfo['basename'];
         //delete thumb
         if (file_exists(\Env::get('cx')->getWebsitePath() . $strPathImage . ".thumb")) {
             $objFile->delFile($this->imagePath, $this->imageWebPath, 'images/' . $imageName . ".thumb");
         }
         //delete image
         if (file_exists(\Env::get('cx')->getWebsitePath() . $strPathImage)) {
             $objFile->delFile($this->imagePath, $this->imageWebPath, 'images/' . $imageName);
         }
     }
 }
Example #9
0
 function createFile($file, $data)
 {
     $file = new File($file, TRUE);
     if ($file->exists()) {
         $file->delFile();
         $file->createFile();
     }
     $file->writeData($data);
 }
 function _deleteMedia2($file)
 {
     global $_ARRAYLANG;
     if (self::isIllegalFileName($file)) {
         return $_ARRAYLANG['TXT_MEDIA_FILE_DONT_DELETE'];
     }
     $obj_file = new \File();
     if (is_dir($this->path . $file)) {
         $this->dirLog = $obj_file->delDir($this->path, $this->webPath, $file);
         if ($this->dirLog != "error") {
             $status = $_ARRAYLANG['TXT_MEDIA_MSG_DIR_DELETE'];
         } else {
             $status = $_ARRAYLANG['TXT_MEDIA_MSG_ERROR_DIR'];
         }
     } else {
         if ($this->_isImage($this->path . $file)) {
             $thumb_name = basename(\ImageManager::getThumbnailFilename($this->path . $file));
             if (file_exists($this->path . $thumb_name)) {
                 $this->dirLog = $obj_file->delFile($this->path, $this->webPath, $thumb_name);
             }
         }
         $this->dirLog = $obj_file->delFile($this->path, $this->webPath, $file);
         if ($this->dirLog != "error") {
             $status = $_ARRAYLANG['TXT_MEDIA_MSG_FILE_DELETE'];
         } else {
             $status = $_ARRAYLANG['TXT_MEDIA_MSG_ERROR_FILE'];
         }
     }
     return $status;
 }
Example #11
0
 /**
  * Removes the entry with id = $intEntry from database.
  *
  * @global     array
  * @global     ADONewConnection
  */
 function deleteEntry($intEntryId)
 {
     global $_ARRAYLANG, $objDatabase;
     $intEntryId = intval($intEntryId);
     $cx = \Cx\Core\Core\Controller\Cx::instanciate();
     if ($intEntryId > 0) {
         $objDatabase->Execute('    DELETE
                                     FROM    ' . DBPREFIX . 'module_data_messages
                                     WHERE    message_id=' . $intEntryId . '
                                     LIMIT    1
                                 ');
         if (!$this->_boolInnoDb) {
             $objDatabase->Execute('    DELETE
                                     FROM    ' . DBPREFIX . 'module_data_messages_lang
                                     WHERE    message_id=' . $intEntryId . '
                                 ');
             $objDatabase->Execute('    DELETE
                                     FROM    ' . DBPREFIX . 'module_data_message_to_category
                                     WHERE    message_id=' . $intEntryId . '
                                 ');
             $objDatabase->Execute('    DELETE
                                     FROM    ' . DBPREFIX . 'module_data_message_to_category
                                     WHERE    message_id=' . $intEntryId . '
                                 ');
             $objDatabase->Execute('    DELETE
                                     FROM    ' . DBPREFIX . 'module_data_votes
                                     WHERE    message_id=' . $intEntryId . '
                                 ');
             $objDatabase->Execute('    DELETE
                                     FROM    ' . DBPREFIX . 'module_data_comments
                                     WHERE    message_id=' . $intEntryId . '
                                 ');
         }
         $objDatabase->Execute("   DELETE FROM " . DBPREFIX . "module_data_placeholders\n                                      WHERE ref_id = " . $intEntryId);
         $objFile = new \File();
         foreach (glob($cx->getWebsiteImagesDataPath() . '/' . $intEntryId . '_*') as $image) {
             $objFile->delFile($cx->getWebsiteImagesDataPath() . '/', $cx->getWebsiteImagesDataWebPath() . '/', basename($image));
         }
         $this->writeMessageRSS();
         $this->writeCategoryRSS();
         $this->writeCommentRSS();
         $this->_strOkMessage = $_ARRAYLANG['TXT_DATA_ENTRY_DELETE_SUCCESSFULL'];
     } else {
         $this->_strErrMessage = $_ARRAYLANG['TXT_DATA_ENTRY_DELETE_ERROR_ID'];
     }
 }
Example #12
0
 function removeEntry($array)
 {
     global $objDatabase, $_ARRAYLANG, $_CORELANG;
     foreach ($array as $entryId) {
         $status = "";
         $objResult = $objDatabase->Execute('SELECT picture FROM ' . DBPREFIX . 'module_market WHERE id = ' . $entryId . ' LIMIT 1');
         if ($objResult !== false) {
             $picture = $objResult->fields['picture'];
         }
         if ($picture != '') {
             $objFile = new \File();
             $status = $objFile->delFile($this->mediaPath, $this->mediaWebPath, "pictures/" . $picture);
         }
         if ($status != "error") {
             $objResultDel = $objDatabase->Execute('DELETE FROM ' . DBPREFIX . 'module_market WHERE id = ' . $entryId . '');
             if ($objResultDel !== false) {
                 $this->strOkMessage = $_ARRAYLANG['TXT_MARKET_DELETE_SUCCESS'];
             } else {
                 $this->strErrMessage = $_CORELANG['TXT_DATABASE_QUERY_ERROR'];
             }
         } else {
             $this->strErrMessage = $_ARRAYLANG['TXT_MARKET_IMAGE_DELETE_ERROR'];
         }
     }
 }