Esempio n. 1
0
 function getEditForm($aValues, $aAddFields = array())
 {
     $oCategories = new BxDolCategories();
     if (isset($this->_aForm['inputs']['categories'])) {
         //--- convert post form to edit one ---//
         $this->_aForm['inputs']['categories'] = $oCategories->getGroupChooser($this->_oModule->_oConfig->getCategoriesSystemName(), $this->_iOwnerId, true, $aValues['categories']);
     }
     if (!empty($aValues) && is_array($aValues)) {
         foreach ($aValues as $sKey => $sValue) {
             if (array_key_exists($sKey, $this->_aForm['inputs'])) {
                 if ($this->_aForm['inputs'][$sKey]['type'] == 'checkbox') {
                     $this->_aForm['inputs'][$sKey]['checked'] = (int) $sValue == 1 ? true : false;
                 } else {
                     if ($this->_aForm['inputs'][$sKey]['type'] == 'select_box' && $this->_aForm['inputs'][$sKey]['name'] == 'Categories') {
                         $aCategories = preg_split('/[' . $oCategories->sTagsDivider . ']/', $sValue, 0, PREG_SPLIT_NO_EMPTY);
                         $this->_aForm['inputs'][$sKey]['value'] = $aCategories;
                     } else {
                         $this->_aForm['inputs'][$sKey]['value'] = $sValue;
                     }
                 }
             }
         }
         unset($this->_aForm['inputs']['author_id']);
         $this->_aForm['inputs']['id'] = array('type' => 'hidden', 'name' => 'id', 'value' => $aValues['id'], 'db' => array('pass' => 'Int'));
         $this->_aForm['inputs']['post']['value'] = _t("_td_edit");
     }
     $oForm = new BxTemplFormView($this->_aForm);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         $iDateNow = mktime();
         $iDatePublish = $oForm->getCleanValue('when');
         if ($iDatePublish > $iDateNow) {
             $iStatus = BX_TD_STATUS_PENDING;
         } else {
             if ($iDatePublish <= $iDateNow && $this->_oModule->_oConfig->isAutoapprove()) {
                 $iStatus = BX_TD_STATUS_ACTIVE;
             } else {
                 $iStatus = BX_TD_STATUS_INACTIVE;
             }
         }
         $aDefFields = array('date' => $iDateNow, 'status' => $iStatus);
         $oForm->update($aValues['id'], array_merge($aDefFields, $aAddFields));
         //--- 'System' -> Edit for Alerts Engine ---//
         bx_import('BxDolAlerts');
         $oAlert = new BxDolAlerts($this->_oModule->_oConfig->getAlertsSystemName(), 'edit', $aValues['id'], $this->_iOwnerId);
         $oAlert->alert();
         //--- 'System' -> Edit for Alerts Engine ---//
         //--- Reparse Global Tags ---//
         $oTags = new BxDolTags();
         $oTags->reparseObjTags($this->_oModule->_oConfig->getTagsSystemName(), $aValues['id']);
         //--- Reparse Global Tags ---//
         //--- Reparse Global Categories ---//
         $oCategories->reparseObjTags($this->_oModule->_oConfig->getCategoriesSystemName(), $aValues['id']);
         //--- Reparse Global Categories ---//
         header('Location: ' . $oForm->aFormAttrs['action']);
     } else {
         return $oForm->getCode();
     }
 }
Esempio n. 2
0
 function BxGroupsFormAdd($oMain, $iProfileId, $iEntryId = 0, $iThumb = 0)
 {
     $this->_oMain = $oMain;
     $this->_oDb = $oMain->_oDb;
     $this->_aMedia = array('images' => array('post' => 'ready_images', 'upload_func' => 'uploadPhotos', 'tag' => BX_GROUPS_PHOTOS_TAG, 'cat' => BX_GROUPS_PHOTOS_CAT, 'thumb' => 'thumb', 'module' => 'photos', 'title_upload_post' => 'images_titles', 'title_upload' => _t('_bx_groups_form_caption_file_title'), 'service_method' => 'get_photo_array'), 'videos' => array('post' => 'ready_videos', 'upload_func' => 'uploadVideos', 'tag' => BX_GROUPS_VIDEOS_TAG, 'cat' => BX_GROUPS_VIDEOS_CAT, 'thumb' => false, 'module' => 'videos', 'title_upload_post' => 'videos_titles', 'title_upload' => _t('_bx_groups_form_caption_file_title'), 'service_method' => 'get_video_array'), 'sounds' => array('post' => 'ready_sounds', 'upload_func' => 'uploadSounds', 'tag' => BX_GROUPS_SOUNDS_TAG, 'cat' => BX_GROUPS_SOUNDS_CAT, 'thumb' => false, 'module' => 'sounds', 'title_upload_post' => 'sounds_titles', 'title_upload' => _t('_bx_groups_form_caption_file_title'), 'service_method' => 'get_music_array'), 'files' => array('post' => 'ready_files', 'upload_func' => 'uploadFiles', 'tag' => BX_GROUPS_FILES_TAG, 'cat' => BX_GROUPS_FILES_CAT, 'thumb' => false, 'module' => 'files', 'title_upload_post' => 'files_titles', 'title_upload' => _t('_bx_groups_form_caption_file_title'), 'service_method' => 'get_file_array'));
     bx_import('BxDolCategories');
     $oCategories = new BxDolCategories();
     $oProfileFields = new BxDolProfileFields(0);
     $aCountries = $oProfileFields->convertValues4Input('#!Country');
     asort($aCountries);
     // generate templates for custom form's elements
     $aCustomMediaTemplates = $this->generateCustomMediaTemplates($oMain->_iProfileId, $iEntryId, $iThumb);
     // privacy
     $aInputPrivacyCustom = array();
     $aInputPrivacyCustom[] = array('key' => '', 'value' => '----');
     $aInputPrivacyCustom[] = array('key' => 'f', 'value' => _t('_bx_groups_privacy_fans_only'));
     $aInputPrivacyCustomPass = array('pass' => 'Preg', 'params' => array('/^([0-9f]+)$/'));
     $aInputPrivacyCustom2 = array(array('key' => 'f', 'value' => _t('_bx_groups_privacy_fans')), array('key' => 'a', 'value' => _t('_bx_groups_privacy_admins_only')));
     $aInputPrivacyCustom2Pass = array('pass' => 'Preg', 'params' => array('/^([fa]+)$/'));
     $aInputPrivacyViewFans = $this->_oMain->_oPrivacy->getGroupChooser($iProfileId, 'groups', 'view_fans');
     $aInputPrivacyViewFans['values'] = array_merge($aInputPrivacyViewFans['values'], $aInputPrivacyCustom);
     $aInputPrivacyComment = $this->_oMain->_oPrivacy->getGroupChooser($iProfileId, 'groups', 'comment');
     $aInputPrivacyComment['values'] = array_merge($aInputPrivacyComment['values'], $aInputPrivacyCustom);
     $aInputPrivacyComment['db'] = $aInputPrivacyCustomPass;
     $aInputPrivacyRate = $this->_oMain->_oPrivacy->getGroupChooser($iProfileId, 'groups', 'rate');
     $aInputPrivacyRate['values'] = array_merge($aInputPrivacyRate['values'], $aInputPrivacyCustom);
     $aInputPrivacyRate['db'] = $aInputPrivacyCustomPass;
     $aInputPrivacyForum = $this->_oMain->_oPrivacy->getGroupChooser($iProfileId, 'groups', 'post_in_forum');
     $aInputPrivacyForum['values'] = array_merge($aInputPrivacyForum['values'], $aInputPrivacyCustom);
     $aInputPrivacyForum['db'] = $aInputPrivacyCustomPass;
     $aInputPrivacyUploadPhotos = $this->_oMain->_oPrivacy->getGroupChooser($iProfileId, 'groups', 'upload_photos');
     $aInputPrivacyUploadPhotos['values'] = $aInputPrivacyCustom2;
     $aInputPrivacyUploadPhotos['db'] = $aInputPrivacyCustom2Pass;
     $aInputPrivacyUploadVideos = $this->_oMain->_oPrivacy->getGroupChooser($iProfileId, 'groups', 'upload_videos');
     $aInputPrivacyUploadVideos['values'] = $aInputPrivacyCustom2;
     $aInputPrivacyUploadVideos['db'] = $aInputPrivacyCustom2Pass;
     $aInputPrivacyUploadSounds = $this->_oMain->_oPrivacy->getGroupChooser($iProfileId, 'groups', 'upload_sounds');
     $aInputPrivacyUploadSounds['values'] = $aInputPrivacyCustom2;
     $aInputPrivacyUploadSounds['db'] = $aInputPrivacyCustom2Pass;
     $aInputPrivacyUploadFiles = $this->_oMain->_oPrivacy->getGroupChooser($iProfileId, 'groups', 'upload_files');
     $aInputPrivacyUploadFiles['values'] = $aInputPrivacyCustom2;
     $aInputPrivacyUploadFiles['db'] = $aInputPrivacyCustom2Pass;
     $aCustomForm = array('form_attrs' => array('name' => 'form_groups', 'action' => '', 'method' => 'post', 'enctype' => 'multipart/form-data'), 'params' => array('db' => array('table' => 'bx_groups_main', 'key' => 'id', 'uri' => 'uri', 'uri_title' => 'title', 'submit_name' => 'submit_form')), 'inputs' => array('header_info' => array('type' => 'block_header', 'caption' => _t('_bx_groups_form_header_info')), 'title' => array('type' => 'text', 'name' => 'title', 'caption' => _t('_bx_groups_form_caption_title'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(3, 100), 'error' => _t('_bx_groups_form_err_title')), 'db' => array('pass' => 'Xss'), 'display' => true), 'desc' => array('type' => 'textarea', 'name' => 'desc', 'caption' => _t('_bx_groups_form_caption_desc'), 'required' => true, 'html' => 2, 'checker' => array('func' => 'length', 'params' => array(20, 64000), 'error' => _t('_bx_groups_form_err_desc')), 'db' => array('pass' => 'XssHtml')), 'country' => array('type' => 'select', 'name' => 'country', 'caption' => _t('_bx_groups_form_caption_country'), 'values' => $aCountries, 'required' => false, 'db' => array('pass' => 'Preg', 'params' => array('/([a-zA-Z]{2})/')), 'display' => true), 'city' => array('type' => 'text', 'name' => 'city', 'caption' => _t('_bx_groups_form_caption_city'), 'required' => false, 'db' => array('pass' => 'Xss'), 'display' => true), 'zip' => array('type' => 'text', 'name' => 'zip', 'caption' => _t('_bx_groups_form_caption_zip'), 'required' => false, 'db' => array('pass' => 'Xss'), 'display' => true), 'tags' => array('type' => 'text', 'name' => 'tags', 'caption' => _t('_Tags'), 'info' => _t('_sys_tags_note'), 'required' => true, 'checker' => array('func' => 'avail', 'error' => _t('_bx_groups_form_err_tags')), 'db' => array('pass' => 'Tags')), 'categories' => $oCategories->getGroupChooser('bx_groups', (int) $iProfileId, true), 'header_images' => array('type' => 'block_header', 'caption' => _t('_bx_groups_form_header_images'), 'collapsable' => true, 'collapsed' => false), 'thumb' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['images']['thumb_choice'], 'name' => 'thumb', 'caption' => _t('_bx_groups_form_caption_thumb_choice'), 'info' => _t('_bx_groups_form_info_thumb_choice'), 'required' => false, 'db' => array('pass' => 'Int')), 'images_choice' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['images']['choice'], 'name' => 'images_choice[]', 'caption' => _t('_bx_groups_form_caption_images_choice'), 'info' => _t('_bx_groups_form_info_images_choice'), 'required' => false), 'images_upload' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['images']['upload'], 'name' => 'images_upload[]', 'caption' => _t('_bx_groups_form_caption_images_upload'), 'info' => _t('_bx_groups_form_info_images_upload'), 'required' => false), 'header_videos' => array('type' => 'block_header', 'caption' => _t('_bx_groups_form_header_videos'), 'collapsable' => true, 'collapsed' => false), 'videos_choice' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['videos']['choice'], 'name' => 'videos_choice[]', 'caption' => _t('_bx_groups_form_caption_videos_choice'), 'info' => _t('_bx_groups_form_info_videos_choice'), 'required' => false), 'videos_upload' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['videos']['upload'], 'name' => 'videos_upload[]', 'caption' => _t('_bx_groups_form_caption_videos_upload'), 'info' => _t('_bx_groups_form_info_videos_upload'), 'required' => false), 'header_sounds' => array('type' => 'block_header', 'caption' => _t('_bx_groups_form_header_sounds'), 'collapsable' => true, 'collapsed' => false), 'sounds_choice' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['sounds']['choice'], 'name' => 'sounds_choice[]', 'caption' => _t('_bx_groups_form_caption_sounds_choice'), 'info' => _t('_bx_groups_form_info_sounds_choice'), 'required' => false), 'sounds_upload' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['sounds']['upload'], 'name' => 'sounds_upload[]', 'caption' => _t('_bx_groups_form_caption_sounds_upload'), 'info' => _t('_bx_groups_form_info_sounds_upload'), 'required' => false), 'header_files' => array('type' => 'block_header', 'caption' => _t('_bx_groups_form_header_files'), 'collapsable' => true, 'collapsed' => false), 'files_choice' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['files']['choice'], 'name' => 'files_choice[]', 'caption' => _t('_bx_groups_form_caption_files_choice'), 'info' => _t('_bx_groups_form_info_files_choice'), 'required' => false), 'files_upload' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['files']['upload'], 'name' => 'files_upload[]', 'caption' => _t('_bx_groups_form_caption_files_upload'), 'info' => _t('_bx_groups_form_info_files_upload'), 'required' => false), 'header_privacy' => array('type' => 'block_header', 'caption' => _t('_bx_groups_form_header_privacy')), 'allow_view_group_to' => $this->_oMain->_oPrivacy->getGroupChooser($iProfileId, 'groups', 'view_group'), 'allow_view_fans_to' => $aInputPrivacyViewFans, 'allow_comment_to' => $aInputPrivacyComment, 'allow_rate_to' => $aInputPrivacyRate, 'allow_post_in_forum_to' => $aInputPrivacyForum, 'allow_join_to' => $this->_oMain->_oPrivacy->getGroupChooser($iProfileId, 'groups', 'join'), 'join_confirmation' => array('type' => 'select', 'name' => 'join_confirmation', 'caption' => _t('_bx_groups_form_caption_join_confirmation'), 'info' => _t('_bx_groups_form_info_join_confirmation'), 'values' => array(0 => _t('_bx_groups_form_join_confirmation_disabled'), 1 => _t('_bx_groups_form_join_confirmation_enabled')), 'checker' => array('func' => 'int', 'error' => _t('_bx_groups_form_err_join_confirmation')), 'db' => array('pass' => 'Int')), 'allow_upload_photos_to' => $aInputPrivacyUploadPhotos, 'allow_upload_videos_to' => $aInputPrivacyUploadVideos, 'allow_upload_sounds_to' => $aInputPrivacyUploadSounds, 'allow_upload_files_to' => $aInputPrivacyUploadFiles, 'Submit' => array('type' => 'submit', 'name' => 'submit_form', 'value' => _t('_Submit'), 'colspan' => false)));
     if (!$aCustomForm['inputs']['images_choice']['content']) {
         unset($aCustomForm['inputs']['thumb']);
         unset($aCustomForm['inputs']['images_choice']);
     }
     if (!$aCustomForm['inputs']['videos_choice']['content']) {
         unset($aCustomForm['inputs']['videos_choice']);
     }
     if (!$aCustomForm['inputs']['sounds_choice']['content']) {
         unset($aCustomForm['inputs']['sounds_choice']);
     }
     if (!$aCustomForm['inputs']['files_choice']['content']) {
         unset($aCustomForm['inputs']['files_choice']);
     }
     $this->processMembershipChecksForMediaUploads($aCustomForm['inputs']);
     parent::BxDolFormMedia($aCustomForm);
 }
Esempio n. 3
0
 function __construct()
 {
     bx_import('BxDolCategories');
     $oCategories = new BxDolCategories();
     $oCategories->getTagObjectConfig();
     $aCategories = $oCategories->getCategoriesList('bx_store', (int) $iProfileId, true);
     $aCustomForm = array('form_attrs' => array('name' => 'form_search_store', 'action' => '', 'method' => 'get'), 'params' => array('db' => array('submit_name' => 'submit_form'), 'csrf' => array('disable' => true)), 'inputs' => array('Keyword' => array('type' => 'text', 'name' => 'Keyword', 'caption' => _t('_bx_store_form_caption_keyword'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(3, 100), 'error' => _t('_bx_store_form_err_keyword')), 'db' => array('pass' => 'Xss')), 'Category' => array('type' => 'select_box', 'name' => 'Category', 'caption' => _t('_bx_store_form_caption_category'), 'values' => $aCategories, 'required' => true, 'checker' => array('func' => 'avail', 'error' => _t('_bx_store_form_err_category')), 'db' => array('pass' => 'Xss')), 'Submit' => array('type' => 'submit', 'name' => 'submit_form', 'value' => _t('_Submit'), 'colspan' => true)));
     parent::__construct($aCustomForm);
 }
Esempio n. 4
0
 function BxGroupsFormEdit($oMain, $iProfileId, $iEntryId, &$aDataEntry)
 {
     parent::BxGroupsFormAdd($oMain, $iProfileId, $iEntryId, $aDataEntry['thumb']);
     $aFormInputsId = array('id' => array('type' => 'hidden', 'name' => 'id', 'value' => $iEntryId));
     bx_import('BxDolCategories');
     $oCategories = new BxDolCategories();
     $oCategories->getTagObjectConfig();
     $this->aInputs['categories'] = $oCategories->getGroupChooser('bx_groups', (int) $iProfileId, true, $aDataEntry['categories']);
     $this->aInputs = array_merge($this->aInputs, $aFormInputsId);
 }
Esempio n. 5
0
 function BxEventsFormEdit($oMain, $iProfileId, $iEventId, &$aEvent)
 {
     parent::BxEventsFormAdd($oMain, $iProfileId, $iEventId, $aEvent['PrimPhoto']);
     $aFormInputsId = array('ID' => array('type' => 'hidden', 'name' => 'ID', 'value' => $iEventId));
     bx_import('BxDolCategories');
     $oCategories = new BxDolCategories();
     $oCategories->getTagObjectConfig();
     $this->aInputs['Categories'] = $oCategories->getGroupChooser('bx_events', (int) $iProfileId, true, $aEvent['Categories']);
     $this->aInputs = array_merge($this->aInputs, $aFormInputsId);
 }
Esempio n. 6
0
 function processing()
 {
     global $sModule;
     global $sFfmpegPath;
     global $sModulesPath;
     global $sFilesPath;
     $iFilesCount = getSettingValue($sModule, "processCount");
     if (!is_numeric($iFilesCount)) {
         $iFilesCount = 2;
     }
     $iFailedTimeout = getSettingValue($sModule, "failedTimeout");
     if (!is_numeric($iFailedTimeout)) {
         $iFailedTimeout = 1;
     }
     $iFailedTimeout *= 86400;
     $sDbPrefix = DB_PREFIX . ucfirst($sModule);
     $iCurrentTime = time();
     do {
         //remove all tokens older than 10 minutes
         if (!getResult("DELETE FROM `" . $sDbPrefix . "Tokens` WHERE `Date`<'" . ($iCurrentTime - 600) . "'")) {
             break;
         }
         if (!getResult("UPDATE `" . $sDbPrefix . "Files` SET `Date`='" . $iCurrentTime . "', `Status`='" . STATUS_FAILED . "' WHERE `Status`='" . STATUS_PROCESSING . "' AND `Date`<'" . ($iCurrentTime - $iFailedTimeout) . "'")) {
             break;
         }
         $rResult = getResult("SELECT * FROM `" . $sDbPrefix . "Files` WHERE `Status`='" . STATUS_PENDING . "' ORDER BY `ID` LIMIT " . $iFilesCount);
         if (!$rResult) {
             break;
         }
         for ($i = 0; $i < mysql_num_rows($rResult); $i++) {
             $aFile = mysql_fetch_assoc($rResult);
             if (convertVideo($aFile['ID'])) {
                 $sType = 'bx_videos';
                 //album counter & cover update
                 if (getSettingValue($sModule, "autoApprove") == TRUE_VAL) {
                     $oAlbum = new BxDolAlbums($sType);
                     $oAlbum->updateObjCounterById($aFile['ID']);
                     if (getParam($oAlbum->sAlbumCoverParam) == 'on') {
                         $oAlbum->updateLastObjById($aFile['ID']);
                     }
                 }
                 //tags & categories parsing
                 $oTag = new BxDolTags();
                 $oTag->reparseObjTags($sType, $aFile['ID']);
                 $oCateg = new BxDolCategories($aFile['Owner']);
                 $oCateg->reparseObjTags($sType, $aFile['ID']);
             } else {
                 if (!getResult("UPDATE `" . $sDbPrefix . "Files` SET `Status`='" . STATUS_FAILED . "' WHERE `ID`='" . $aFile['ID'] . "'")) {
                     break;
                 }
             }
         }
     } while (false);
 }
Esempio n. 7
0
 function __construct()
 {
     parent::__construct();
     $this->_sCategTmplName = 'view_categ.html';
     $this->_sCategTmplContent = '';
     $this->_aOrderValues = array('none' => _t('_categ_order_none'), 'popular' => _t('_categ_order_popular'), 'recent' => _t('_categ_order_recent'));
 }
Esempio n. 8
0
 function BxBaseCategories()
 {
     parent::BxDolCategories();
     $this->_sCategTmplName = 'view_categ.html';
     $this->_sCategTmplContent = '';
     $this->_aOrderValues = array('none' => _t('_categ_order_none'), 'popular' => _t('_categ_order_popular'), 'recent' => _t('_categ_order_recent'));
 }
 function transferContent()
 {
     $sSql = "SELECT \r\n        \t\t\t`ta`.`ArticlesID` AS `id`,\r\n        \t\t\t`ta`.`ownerID` AS `author_id`,\r\n        \t\t\t`ta`.`Title` AS `caption`,\r\n        \t\t\t`ta`.`Text` AS `content`,\r\n        \t\t\t`ta`.`ArticleUri` AS `uri`,\r\n        \t\t\t'' AS `tags`,        \t\t\t\r\n        \t\t\t`tac`.`CategoryName` AS `categories`,\r\n        \t\t\t'0' AS `comment`,\r\n        \t\t\t'0' AS `vote`,\r\n        \t\t\tUNIX_TIMESTAMP(`Date`) AS `date`,\r\n        \t\t\t'0' AS `status`,\r\n        \t\t\t'0' AS `featured`,\r\n        \t\t\t'0' AS `rate`,\r\n        \t\t\t'0' AS `rate_count`,\r\n        \t\t\t'0' AS `view_count`,\r\n        \t\t\t'0' AS `cmts_count`\r\n        \t\tFROM `Articles` AS `ta` \r\n        \t\tLEFT JOIN `ArticlesCategory` AS `tac` ON `ta`.`CategoryID`=`tac`.`CategoryID`\r\n        \t\tORDER BY `Date` ASC";
     $rResult = mysql_query($sSql, $this->rOldDb);
     $iCount = mysql_num_rows($rResult);
     $oCategories = new BxDolCategories();
     while ($aItem = mysql_fetch_assoc($rResult)) {
         $aItem['uri'] = uriGenerate($aItem['caption'], $this->oDolModule->_oDb->getPrefix() . 'entries', 'uri');
         if ($this->existsItem($aItem['id'], $aItem['uri'])) {
             $this->setResultStatus('Duplicate data. Article with similar info already exists.');
             return MIGRATION_FAILED;
         }
         $sSql = "INSERT INTO `" . $this->oDolModule->_oDb->getPrefix() . "entries` SET";
         foreach ($aItem as $sKey => $sValue) {
             $sSql .= " `" . $sKey . "`='" . $this->oMigrationModule->_oDb->escape($sValue) . "',";
         }
         $iResult = (int) $this->oDolModule->_oDb->query(substr($sSql, 0, -1));
         if ($iResult <= 0) {
             $this->setResultStatus('Database error. Cannot insert item in the database.');
             return MIGRATION_FAILED;
         }
         $oCategories->reparseObjTags($this->_sType, $this->oDolModule->_oDb->lastId());
     }
     $this->setResultStatus('The transfer was successfully completed. (' . $iCount . ' items)');
     return MIGRATION_SUCCESSFUL;
 }
Esempio n. 10
0
 function getFullForm()
 {
     bx_import('BxDolCategories');
     $oCategories = new BxDolCategories();
     $oCategories->getTagObjectConfig();
     $aForm = array('form_attrs' => array('name' => 'form_site', 'action' => BX_DOL_URL_ROOT . $this->_oModule->_oConfig->getBaseUri() . 'browse/my/add', 'method' => 'post', 'enctype' => 'multipart/form-data'), 'params' => array('db' => array('table' => 'bx_sites_main', 'key' => 'id', 'uri' => 'entryUri', 'uri_title' => 'title', 'submit_name' => 'submit_form')), 'inputs' => array('url' => array('type' => 'text', 'name' => 'url', 'value' => isset($this->_aParam['url']) ? $this->_aParam['url'] : '', 'caption' => _t('_bx_sites_form_url'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(1, 100), 'error' => _t('_bx_sites_form_field_err')), 'db' => array('pass' => 'Xss'), 'display' => true), 'title' => array('type' => 'text', 'name' => 'title', 'value' => isset($this->_aParam['title']) ? $this->_aParam['title'] : '', 'caption' => _t('_bx_sites_form_title'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(1, 100), 'error' => _t('_bx_sites_form_field_err')), 'db' => array('pass' => 'Xss'), 'display' => true), 'description' => array('type' => 'textarea', 'name' => 'description', 'value' => isset($this->_aParam['description']) ? $this->_aParam['description'] : '', 'caption' => _t('_bx_sites_form_description'), 'required' => true, 'html' => 1, 'checker' => array('func' => 'length', 'params' => array(1, 64000), 'error' => _t('_bx_sites_form_field_err')), 'db' => array('pass' => 'XssHtml')), 'thumbnail' => array('type' => 'custom', 'name' => 'thumbnail', 'content' => '', 'caption' => 'Thumbnail'), 'photo' => array('type' => 'file', 'name' => 'photo', 'caption' => _t('_bx_sites_form_photo')), 'tags' => array('type' => 'text', 'name' => 'tags', 'caption' => _t('_Tags'), 'required' => true, 'checker' => array('func' => 'avail', 'error' => _t('_bx_sites_form_field_err')), 'db' => array('pass' => 'Tags'), 'info' => _t('_sys_tags_note')), 'categories' => $oCategories->getGroupChooser('bx_sites', (int) $this->_oModule->iOwnerId, true), 'allowView' => $this->_oModule->oPrivacy->getGroupChooser($this->_oModule->iOwnerId, 'bx_sites', 'view', array(), _t('_bx_sites_caption_allow_view')), 'allowComments' => $this->_oModule->oPrivacy->getGroupChooser($this->_oModule->iOwnerId, 'bx_sites', 'comments', array(), _t('_bx_sites_caption_allow_comments')), 'allowRate' => $this->_oModule->oPrivacy->getGroupChooser($this->_oModule->iOwnerId, 'bx_sites', 'rate', array(), _t('_bx_sites_caption_allow_rate'))));
     if (isset($this->_aParam['thumbnail']) && getParam('bx_sites_account_type') != 'No Automated Screenshots') {
         $aForm['inputs']['thumbnail']['content'] = $this->_aParam['thumbnail'];
         $aForm['inputs']['photo']['caption'] = _t('_bx_sites_form_other_thumbnail');
         if (isset($this->_aParam['thumbnail_html'])) {
             $aForm['inputs'] = array_merge($aForm['inputs'], array('thumbnail_html' => array('type' => 'hidden', 'name' => 'thumbnail_html', 'value' => $this->_aParam['thumbnail_html'])));
         }
     } else {
         unset($aForm['inputs']['thumbnail']);
     }
     return $aForm;
 }
Esempio n. 11
0
 function __construct($oModule, $aParam = array())
 {
     $this->_oModule = $oModule;
     $this->_aParam = $aParam;
     if (count($aParam) && isset($aParam['photo']) && $aParam['photo'] != 0) {
         $aFile = BxDolService::call('photos', 'get_photo_array', array($aParam['photo'], 'browse'), 'Search');
         if (!$aFile['no_image']) {
             $aParam = array_merge($aParam, array('thumbnail' => $GLOBALS['oBxSitesModule']->_oTemplate->parseHtmlByName('thumb110.html', array('image' => $aFile['file'], 'spacer' => getTemplateIcon('spacer.gif')))));
         }
     }
     $this->_aCustomForm = $this->getFullForm();
     $this->_aCustomForm['form_attrs']['action'] = BX_DOL_URL_ROOT . $this->_oModule->_oConfig->getBaseUri() . 'edit/' . $aParam['id'];
     $oCategories = new BxDolCategories();
     $oCategories->getTagObjectConfig();
     $this->_aCustomForm['inputs']['categories'] = $oCategories->getGroupChooser('bx_sites', (int) $this->_oModule->iOwnerId, true, $this->_aParam['categories']);
     $aFormInputsSubmit = array('Submit' => array('type' => 'submit', 'name' => 'submit_form', 'value' => _t('_Submit'), 'colspan' => false));
     $this->_aCustomForm['inputs'] = array_merge($this->_aCustomForm['inputs'], $aFormInputsSubmit);
     parent::__construct($this->_aCustomForm);
 }
Esempio n. 12
0
 function displayList($aParams)
 {
     $sSampleType = $aParams['sample_type'];
     $iViewerType = $aParams['viewer_type'];
     $iStart = isset($aParams['start']) ? (int) $aParams['start'] : -1;
     $iPerPage = isset($aParams['count']) ? (int) $aParams['count'] : -1;
     $bShowEmpty = isset($aParams['show_empty']) ? $aParams['show_empty'] : true;
     $bAdminPanel = $iViewerType == BX_TD_VIEWER_TYPE_ADMIN && (isset($aParams['admin_panel']) && $aParams['admin_panel'] || $sSampleType == 'admin');
     $sModuleUri = $this->_oConfig->getUri();
     $aEntries = $this->_oDb->getEntries($aParams);
     if (empty($aEntries)) {
         return $bShowEmpty ? MsgBox(_t('_' . $sModuleUri . '_msg_no_results')) : "";
     }
     $oTags = new BxDolTags();
     $oCategories = new BxDolCategories();
     //--- Language translations ---//
     $sLKLinkPublish = _t('_' . $sModuleUri . '_lcaption_publish');
     $sLKLinkEdit = _t('_' . $sModuleUri . '_lcaption_edit');
     $sLKLinkDelete = _t('_' . $sModuleUri . '_lcaption_delete');
     $sBaseUri = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri();
     $sJsMainObject = $this->_oConfig->getJsObject();
     $aResult['sample'] = $sSampleType;
     $aResult['bx_repeat:entries'] = array();
     foreach ($aEntries as $aEntry) {
         $sVotes = "";
         if ($this->_oConfig->isVotesEnabled()) {
             $oVotes = $this->_oModule->_createObjectVoting($aEntry['id']);
             $sVotes = $oVotes->getJustVotingElement(0, $aEntry['id']);
         }
         $aTags = $oTags->explodeTags($aEntry['tags']);
         $aCategories = $oCategories->explodeTags($aEntry['categories']);
         $aTagItems = array();
         foreach ($aTags as $sTag) {
             $sTag = trim($sTag);
             $aTagItems[] = array('href' => $sBaseUri . 'tag/' . title2uri($sTag), 'title' => $sTag);
         }
         $aCategoryItems = array();
         foreach ($aCategories as $sCategory) {
             $sCategory = trim($sCategory);
             $aCategoryItems[] = array('href' => $sBaseUri . 'category/' . title2uri($sCategory), 'title' => $sCategory);
         }
         $aResult['bx_repeat:entries'][] = array('id' => $this->_oConfig->getSystemPrefix() . $aEntry['id'], 'caption' => str_replace("\$", "&#36;", $aEntry['caption']), 'class' => !in_array($sSampleType, array('view')) ? ' ' . $this->sCssPrefix . '-text-snippet' : '', 'date' => getLocaleDate($aEntry['when_uts'], BX_DOL_LOCALE_DATE), 'comments' => (int) $aEntry['cmts_count'], 'bx_repeat:categories' => $aCategoryItems, 'bx_repeat:tags' => $aTagItems, 'content' => str_replace("\$", "&#36;", $aEntry['content']), 'link' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aEntry['uri'], 'voting' => $sVotes, 'bx_if:checkbox' => array('condition' => $bAdminPanel, 'content' => array('id' => $aEntry['id'])), 'bx_if:status' => array('condition' => $iViewerType == BX_TD_VIEWER_TYPE_ADMIN, 'content' => array('status' => _t('_' . $sModuleUri . '_status_' . $aEntry['status']))), 'bx_if:featured' => array('condition' => $iViewerType == BX_TD_VIEWER_TYPE_ADMIN && (int) $aEntry['featured'] == 1, 'content' => array()), 'bx_if:edit_link' => array('condition' => $iViewerType == BX_TD_VIEWER_TYPE_ADMIN, 'content' => array('edit_link_url' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'admin/' . $aEntry['uri'], 'edit_link_caption' => $sLKLinkEdit)));
     }
     $aResult['paginate'] = '';
     if (!in_array($sSampleType, array('id', 'uri', 'view', 'search_unit'))) {
         if (!empty($sSampleType)) {
             $this->_updatePaginate($aParams);
         }
         $aResult['paginate'] = $this->oPaginate->getPaginate($iStart, $iPerPage);
     }
     $aResult['loading'] = LoadingBox($sModuleUri . '-' . $sSampleType . '-loading');
     $sRes = $this->parseHtmlByName('list.html', $aResult);
     return $sRes;
 }
Esempio n. 13
0
 function processing()
 {
     $aIds = array();
     if ($this->_oModule->_oDb->publish($aIds)) {
         foreach ($aIds as $iId) {
             //--- Entry -> Publish for Alerts Engine ---//
             $oAlert = new BxDolAlerts($this->_oModule->_oConfig->getAlertsSystemName(), 'publish', $iId);
             $oAlert->alert();
             //--- Entry -> Publish for Alerts Engine ---//
             //--- Reparse Global Tags ---//
             $oTags = new BxDolTags();
             $oTags->reparseObjTags($this->_oModule->_oConfig->getTagsSystemName(), $iId);
             //--- Reparse Global Tags ---//
             //--- Reparse Global Categories ---//
             $oCategories = new BxDolCategories();
             $oCategories->reparseObjTags($this->_oModule->_oConfig->getCategoriesSystemName(), $iId);
             //--- Reparse Global Categories ---//
         }
     }
 }
Esempio n. 14
0
 function _actDelete($aIds)
 {
     if (!$this->_isDeleteAllowed(true)) {
         return false;
     }
     if (is_int($aIds) || is_string($aIds)) {
         $aIds = array((int) $aIds);
     }
     $bResult = $this->_oDb->deleteEntries($aIds);
     if ($bResult) {
         $oTags = new BxDolTags();
         $oCategories = new BxDolCategories();
         $oSubscription = BxDolSubscription::getInstance();
         foreach ($aIds as $iId) {
             //--- Entry -> Delete for Alerts Engine ---//
             $oAlert = new BxDolAlerts($this->_oConfig->getAlertsSystemName(), 'delete', $iId, BxDolTextData::getAuthorId());
             $oAlert->alert();
             //--- Entry -> Delete for Alerts Engine ---//
             //--- Reparse Global Tags ---//
             $oTags->reparseObjTags($this->_oConfig->getTagsSystemName(), $iId);
             //--- Reparse Global Tags ---//
             //--- Reparse Global Categories ---//
             $oCategories->reparseObjTags($this->_oConfig->getCategoriesSystemName(), $iId);
             //--- Reparse Global Categories ---//
             //--- Remove all subscriptions ---//
             $oSubscription->unsubscribe(array('type' => 'object_id', 'unit' => $this->_oConfig->getSubscriptionsSystemName(), 'object_id' => $iId));
             //--- Remove all subscriptions ---//
         }
     }
     return $bResult;
 }
 function convertValues4Input($mValues, $sUseLKey = 'LKey', $sName = '', $aItem = array(), $sValue = '')
 {
     $aValues = array();
     if (db_value("SHOW TABLES LIKE '{$mValues[0]}'") && $sName && $mValues[0] != 'ml_clonetwo_fields') {
         switch ($mValues[0]) {
             case 'sys_acl_levels':
                 require_once BX_DIRECTORY_PATH_INC . 'membership_levels.inc.php';
                 $aMemberships = getMemberships();
                 unset($aMemberships[MEMBERSHIP_ID_NON_MEMBER]);
                 $aValues = array('' => _t('_ml_clonetwo_membership_filter_none')) + $aMemberships;
                 $aAllValues['values'] = $aValues;
                 return $aAllValues;
                 break;
             case 'sys_categories':
                 bx_import('BxDolCategories');
                 $oCategories = new BxDolCategories();
                 $aValues = $oCategories->getGroupChooser('ml_clonetwo', getLoggedId(), true, $sValue);
                 $aValues = $aValues['values'];
                 $aAllValues['values'] = $aValues;
                 return $aAllValues;
                 break;
             case 'sys_privacy_actions':
                 $aInputPrivacyCustom = array();
                 $aInputPrivacyCustom[] = array('key' => '', 'value' => '----');
                 $aInputPrivacyCustom[] = array('key' => 'f', 'value' => _t('_ml_clonetwo_privacy_fans_only'));
                 $sName = str_replace('allow_', '', $sName);
                 $sName = str_replace('_to', '', $sName);
                 $aPValues = $this->_oMain->_oPrivacy->getGroupChooser(getLoggedId(), $this->_aModule['uri'], $sName);
                 //print_r($aPValues['values']);
                 foreach ($aPValues['values'] as $sKey => $aPValue) {
                     $aValues[] = array('key' => $aPValue['key'], 'value' => $aPValue['value']);
                 }
                 if ($sName == 'upload_files' || $sName == 'upload_photos' || $sName == 'upload_videos' || $sName == 'upload_sounds') {
                     $aValues = array(array('key' => 'f', 'value' => _t('_ml_clonetwo_privacy_fans')), array('key' => 'a', 'value' => _t('_ml_clonetwo_privacy_admins_only')));
                 } else {
                     $aValues = array_merge($aValues, $aInputPrivacyCustom);
                 }
                 break;
             default:
                 if ($aItem['IdField'] && $aItem['CaptionField']) {
                     if ($aItem['DepParentField'] && !$aItem['DepField']) {
                         $sValue = $sValue ? $sValue : $aItem['Default'];
                         if (!$sValue) {
                             $sValue = db_value("SELECT `Default` FROM `ml_clonetwo_fields` WHERE `Name` = '{$sName}' LIMIT 1");
                         }
                         if ($sValue) {
                             $iParentId = db_value("SELECT `{$aItem['DepParentField']}` FROM `{$mValues[0]}` WHERE `{$aItem['IdField']}` = '{$sValue}' LIMIT 1");
                             if ($iParentId) {
                                 $sAddQuery = "WHERE `{$aItem['DepParentField']}` = '{$iParentId}'";
                             } else {
                                 $sAddQuery = "WHERE `{$aItem['DepParentField']}` = '{$sValue}'";
                             }
                         }
                         $aAllValues['attrs'] = array('id' => "{$sName}");
                     } elseif ($aItem['DepParentField'] && $aItem['DepField']) {
                         $sAddQuery = "WHERE `{$aItem['DepParentField']}` = '0'";
                     }
                     $sQuery = db_res("SELECT `{$aItem['IdField']}` as `key`, `{$aItem['CaptionField']}` as `value` FROM `{$mValues[0]}` {$sAddQuery}");
                     while ($aRow = mysql_fetch_array($sQuery)) {
                         $aValues[$aRow['key']] = $aRow['value'];
                     }
                     if ($aItem['DepField']) {
                         $aDepData = db_arr("SELECT `IdField`, `CaptionField`, `DepParentField` FROM `ml_clonetwo_fields` WHERE `Name` = '{$aItem['DepField']}' LIMIT 1");
                         if (empty($aDepData)) {
                             return;
                         }
                         $sAjaxUrl = BX_DOL_URL_ROOT . "modules/modloaded/clonetwo/pages.php?ajax=1&key={$aDepData['IdField']}&value={$aDepData['CaptionField']}&table={$mValues[0]}&parent={$aDepData['DepParentField']}&filter=";
                         $aAllValues['attrs'] = array('onchange' => "getHtmlData('{$aItem['DepField']}','{$sAjaxUrl}'+this.value)");
                     }
                     $aAllValues['values'] = $aValues;
                     return $aAllValues;
                 }
         }
     } elseif (is_array($mValues)) {
         foreach ($mValues as $sKey) {
             $aValues[$sKey] = _t('_FieldValues_' . $sKey);
         }
     } elseif (is_string($mValues) and !empty($mValues) and substr($mValues, 0, 2) == $this->sLinkPref) {
         $sKey = substr($mValues, 2);
         if (isset($GLOBALS['aPreValues'][$sKey])) {
             $aPValues = $GLOBALS['aPreValues'][$sKey];
             foreach ($aPValues as $sKey => $aPValue) {
                 if (!isset($aPValue[$sUseLKey])) {
                     $sUseLKey = 'LKey';
                 }
                 $aValues[$sKey] = _t($aPValue[$sUseLKey]);
             }
         }
     }
     //echoDbg($aValues);
     return $aValues;
 }
Esempio n. 16
0
 /**
  * Fired when post status is changed to approved or disapproved
  */
 function onPostApproveDisapprove($iBPostID, $isApprove)
 {
     $aPostInfo = $this->_oDb->getPostInfo($iBPostID);
     if (!$aPostInfo) {
         return;
     }
     //reparse tags
     bx_import('BxDolTags');
     $oTags = new BxDolTags();
     $oTags->reparseObjTags('blog', $iBPostID);
     //reparse categories
     bx_import('BxDolCategories');
     $oCategories = new BxDolCategories($aPostInfo['OwnerID']);
     $oCategories->reparseObjTags('bx_blogs', $iBPostID);
     $oZ = new BxDolAlerts('bx_blogs', $isApprove ? 'approve' : 'disapprove', $iBPostID, $this->_iVisitorID);
     $oZ->alert();
 }
Esempio n. 17
0
function getCategoryForm()
{
    $oCateg = new BxDolCategories();
    $aTypes = array();
    $oCateg->getTagObjectConfig();
    foreach ($oCateg->aTagObjects as $sKey => $aValue) {
        $aTypes[$sKey] = _t($aValue[$oCateg->aObjFields['lang_key']]);
    }
    $aForm = array('form_attrs' => array('name' => 'category_form', 'action' => $_SERVER['REQUEST_URI'], 'method' => 'post', 'enctype' => 'multipart/form-data'), 'params' => array('db' => array('table' => 'sys_categories', 'submit_name' => 'submit_form')), 'inputs' => array('name' => array('type' => 'text', 'name' => 'Category', 'value' => isset($aUnit['name']) ? $aUnit['name'] : '', 'caption' => _t('_categ_form_name'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(3, 100), 'error' => _t('_categ_form_field_name_err')), 'db' => array('pass' => 'Xss'), 'display' => true), 'type' => array('type' => 'select', 'name' => 'Type', 'required' => true, 'values' => $aTypes, 'value' => bx_get('module') !== false ? bx_get('module') : '', 'caption' => _t('_categ_form_type'), 'attrs' => array('multiplyable' => false), 'display' => true, 'db' => array('pass' => 'Xss')), 'submit' => array('type' => 'submit', 'name' => 'submit_form', 'value' => _t('_Submit'), 'colspan' => false)));
    return new BxTemplFormView($aForm);
}
Esempio n. 18
0
 function BxBaseCategories()
 {
     parent::BxDolCategories();
     $this->_sCategTmplName = 'view_categ.html';
     $this->_sCategTmplContent = '';
 }
Esempio n. 19
0
 function _GenSendFileInfoForm($iFileID, $aDefaultValues = array(), $aPossibleImage = array(), $aPossibleDuration = array())
 {
     header("Content-type: text/html; charset=utf-8");
     $this->addJsTranslation(array('_bx_' . $this->sUploadTypeLC . 's_val_title_err', '_bx_' . $this->sUploadTypeLC . 's_val_descr_err'));
     $oCategories = new BxDolCategories();
     $oCategories->getTagObjectConfig();
     $aFormCategories['categories'] = $oCategories->getGroupChooser('bx_' . $this->sUploadTypeLC . 's', $this->_iOwnerId, true);
     $aFormCategories['categories']['required'] = false;
     $sKey = 'album';
     $aAlbums = array();
     if ($this->_aExtras[$sKey] != '') {
         $aAlbums[BX_DOL_UPLOADER_EP_PREFIX . $sKey] = array('type' => 'hidden', 'name' => BX_DOL_UPLOADER_EP_PREFIX . $sKey, 'value' => stripslashes($this->_aExtras[$sKey]));
     } else {
         $oAlbum = new BxDolAlbums('bx_' . $this->sUploadTypeLC . 's');
         $aAlbumList = $oAlbum->getAlbumList(array('owner' => $this->_iOwnerId));
         if (count($aAlbumList) > 0) {
             foreach ($aAlbumList as $aValue) {
                 $aList[$aValue['ID']] = stripslashes($aValue['Caption']);
             }
         } else {
             $sDefName = $oAlbum->getAlbumDefaultName();
             $aList[$sDefName] = stripslashes($sDefName);
         }
         $aAlbums['album'] = array('type' => 'select_box', 'name' => BX_DOL_UPLOADER_EP_PREFIX . $sKey, 'caption' => _t('_sys_album'), 'values' => $aList);
     }
     $sCaptionVal = $this->sSendFileInfoFormCaption != '' ? $this->sSendFileInfoFormCaption : _t('_Info');
     // processing of possible default values
     $aInputValues = array('title', 'tags', 'description', 'type', $this->sUploadTypeLC);
     foreach ($aInputValues as $sField) {
         $sEmpty = $sField == 'type' ? 'upload' : '';
         $sTemp = isset($aDefaultValues[$sField]) ? strip_tags($aDefaultValues[$sField]) : $sEmpty;
         $aDefaultValues[$sField] = $sTemp;
     }
     $aForm = array('form_attrs' => array('id' => $this->sUploadTypeLC . '_file_info_form', 'method' => 'post', 'action' => $this->sWorkingFile, 'target' => 'upload_file_info_frame_' . $iFileID), 'inputs' => array('header2' => array('type' => 'block_header', 'caption' => $sCaptionVal, 'collapsable' => true), 'title' => array('type' => 'text', 'name' => 'title', 'caption' => _t('_Title'), 'required' => true, 'value' => $aDefaultValues['title']), 'tags' => array('type' => 'text', 'name' => 'tags', 'caption' => _t('_Tags'), 'info' => _t('_Tags_desc'), 'value' => $aDefaultValues['tags']), 'description' => array('type' => 'textarea', 'name' => 'description', 'caption' => _t('_Description'), 'value' => $aDefaultValues['description']), 'media_id' => array('type' => 'hidden', 'name' => 'file_id', 'value' => $iFileID), 'hidden_action' => array('type' => 'hidden', 'name' => 'action', 'value' => 'accept_file_info'), $this->sUploadTypeLC => array('type' => 'hidden', 'name' => $this->sUploadTypeLC, 'value' => $aDefaultValues[$this->sUploadTypeLC]), 'type' => array('type' => 'hidden', 'name' => 'type', 'value' => $aDefaultValues['type'])));
     //--- Process Extras ---//
     foreach ($this->_aExtras as $sKey => $mixedValue) {
         $aForm['inputs'][BX_DOL_UPLOADER_EP_PREFIX . $sKey] = array('type' => 'hidden', 'name' => BX_DOL_UPLOADER_EP_PREFIX . $sKey, 'value' => $mixedValue);
     }
     // merging categories
     $aForm['inputs'] = $this->getUploadFormArray($aForm['inputs'], array($aFormCategories, $aAlbums));
     if (is_array($aPossibleImage) && count($aPossibleImage) > 0) {
         $aForm['inputs'] = array_merge($aForm['inputs'], $aPossibleImage);
     }
     if (is_array($aPossibleDuration) && count($aPossibleDuration) > 0) {
         $aForm['inputs'] = array_merge($aForm['inputs'], $aPossibleDuration);
     }
     $aForm['inputs'][] = array('type' => 'input_set', 'colspan' => true, 0 => array('type' => 'submit', 'name' => 'upload', 'value' => _t('_Submit'), 'colspan' => true, 'attrs' => array('onclick' => "return parent." . $this->_sJsPostObject . ".doValidateFileInfo(this, '" . $iFileID . "');")), 1 => array('type' => 'button', 'name' => 'delete', 'value' => _t('_bx_' . $this->sUploadTypeLC . 's_admin_delete'), 'colspan' => true, 'attrs' => array('onclick' => "return parent." . $this->_sJsPostObject . ".cancelSendFileInfo('" . $iFileID . "', '" . $this->sWorkingFile . "'); ")));
     $oForm = new BxTemplFormView($aForm);
     $sForm = $oForm->getCode();
     $sFormSafeJS = str_replace(array("'", "\r", "\n"), array("\\'"), $sForm);
     return "<script src='" . BX_DOL_URL_ROOT . "inc/js/jquery.webForms.js' type='text/javascript' language='javascript'></script><script type='text/javascript'>parent." . $this->_sJsPostObject . ".genSendFileInfoForm('" . $iFileID . "', '" . $sFormSafeJS . "'); parent." . $this->_sJsPostObject . "._loading(false);</script>";
 }
Esempio n. 20
0
 function reparseCategories($iSiteId)
 {
     bx_import('BxDolCategories');
     $o = new BxDolCategories();
     $o->reparseObjTags('bx_sites', $iSiteId);
 }
Esempio n. 21
0
 function BxEventsFormAdd($oMain, $iProfileId, $iEntryId = 0, $iThumb = 0)
 {
     $this->_oMain = $oMain;
     $this->_oDb = $oMain->_oDb;
     $this->_aMedia = array('images' => array('post' => 'ready_images', 'upload_func' => 'uploadPhotos', 'tag' => BX_EVENTS_PHOTOS_TAG, 'cat' => BX_EVENTS_PHOTOS_CAT, 'thumb' => 'PrimPhoto', 'module' => 'photos', 'title_upload_post' => 'images_titles', 'title_upload' => _t('_bx_events_form_caption_file_title'), 'service_method' => 'get_photo_array'), 'videos' => array('post' => 'ready_videos', 'upload_func' => 'uploadVideos', 'tag' => BX_EVENTS_VIDEOS_TAG, 'cat' => BX_EVENTS_VIDEOS_CAT, 'thumb' => false, 'module' => 'videos', 'title_upload_post' => 'videos_titles', 'title_upload' => _t('_bx_events_form_caption_file_title'), 'service_method' => 'get_video_array'), 'sounds' => array('post' => 'ready_sounds', 'upload_func' => 'uploadSounds', 'tag' => BX_EVENTS_SOUNDS_TAG, 'cat' => BX_EVENTS_SOUNDS_CAT, 'thumb' => false, 'module' => 'sounds', 'title_upload_post' => 'sounds_titles', 'title_upload' => _t('_bx_events_form_caption_file_title'), 'service_method' => 'get_music_array'), 'files' => array('post' => 'ready_files', 'upload_func' => 'uploadFiles', 'tag' => BX_EVENTS_FILES_TAG, 'cat' => BX_EVENTS_FILES_CAT, 'thumb' => false, 'module' => 'files', 'title_upload_post' => 'files_titles', 'title_upload' => _t('_bx_events_form_caption_file_title'), 'service_method' => 'get_file_array'));
     bx_import('BxDolCategories');
     $oCategories = new BxDolCategories();
     $oCategories->getTagObjectConfig();
     $oProfileFields = new BxDolProfileFields(0);
     $aCountries = $oProfileFields->convertValues4Input('#!Country');
     asort($aCountries);
     // generate templates for form custom elements
     $aCustomMediaTemplates = $this->generateCustomMediaTemplates($this->_oMain->_iProfileId, $iEntryId, $iThumb);
     // privacy
     $aInputPrivacyCustom = array();
     $aInputPrivacyCustom[] = array('key' => '', 'value' => '----');
     $aInputPrivacyCustom[] = array('key' => 'p', 'value' => _t('_bx_events_privacy_participants_only'));
     $aInputPrivacyCustomPass = array('pass' => 'Preg', 'params' => array('/^([0-9p]+)$/'));
     $aInputPrivacyCustom2 = array(array('key' => 'p', 'value' => _t('_bx_events_privacy_participants')), array('key' => 'a', 'value' => _t('_bx_events_privacy_admins_only')));
     $aInputPrivacyCustom2Pass = array('pass' => 'Preg', 'params' => array('/^([pa]+)$/'));
     $aInputPrivacyViewParticipants = $GLOBALS['oBxEventsModule']->_oPrivacy->getGroupChooser($iProfileId, 'events', 'view_participants');
     $aInputPrivacyViewParticipants['values'] = array_merge($aInputPrivacyViewParticipants['values'], $aInputPrivacyCustom);
     $aInputPrivacyComment = $GLOBALS['oBxEventsModule']->_oPrivacy->getGroupChooser($iProfileId, 'events', 'comment');
     $aInputPrivacyComment['values'] = array_merge($aInputPrivacyComment['values'], $aInputPrivacyCustom);
     $aInputPrivacyComment['db'] = $aInputPrivacyCustomPass;
     $aInputPrivacyRate = $GLOBALS['oBxEventsModule']->_oPrivacy->getGroupChooser($iProfileId, 'events', 'rate');
     $aInputPrivacyRate['values'] = array_merge($aInputPrivacyRate['values'], $aInputPrivacyCustom);
     $aInputPrivacyRate['db'] = $aInputPrivacyCustomPass;
     $aInputPrivacyForum = $GLOBALS['oBxEventsModule']->_oPrivacy->getGroupChooser($iProfileId, 'events', 'post_in_forum');
     $aInputPrivacyForum['values'] = array_merge($aInputPrivacyForum['values'], $aInputPrivacyCustom);
     $aInputPrivacyForum['db'] = $aInputPrivacyCustomPass;
     $aInputPrivacyUploadPhotos = $this->_oMain->_oPrivacy->getGroupChooser($iProfileId, 'events', 'upload_photos');
     $aInputPrivacyUploadPhotos['values'] = $aInputPrivacyCustom2;
     $aInputPrivacyUploadPhotos['db'] = $aInputPrivacyCustom2Pass;
     $aInputPrivacyUploadVideos = $this->_oMain->_oPrivacy->getGroupChooser($iProfileId, 'events', 'upload_videos');
     $aInputPrivacyUploadVideos['values'] = $aInputPrivacyCustom2;
     $aInputPrivacyUploadVideos['db'] = $aInputPrivacyCustom2Pass;
     $aInputPrivacyUploadSounds = $this->_oMain->_oPrivacy->getGroupChooser($iProfileId, 'events', 'upload_sounds');
     $aInputPrivacyUploadSounds['values'] = $aInputPrivacyCustom2;
     $aInputPrivacyUploadSounds['db'] = $aInputPrivacyCustom2Pass;
     $aInputPrivacyUploadFiles = $this->_oMain->_oPrivacy->getGroupChooser($iProfileId, 'events', 'upload_files');
     $aInputPrivacyUploadFiles['values'] = $aInputPrivacyCustom2;
     $aInputPrivacyUploadFiles['db'] = $aInputPrivacyCustom2Pass;
     $aCustomForm = array('form_attrs' => array('name' => 'form_events', 'action' => '', 'method' => 'post', 'enctype' => 'multipart/form-data'), 'params' => array('db' => array('table' => 'bx_events_main', 'key' => 'ID', 'uri' => 'EntryUri', 'uri_title' => 'Title', 'submit_name' => 'submit_form')), 'inputs' => array('header_info' => array('type' => 'block_header', 'caption' => _t('_bx_events_form_header_info')), 'Title' => array('type' => 'text', 'name' => 'Title', 'caption' => _t('_bx_events_caption_title'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(3, 100), 'error' => _t('_bx_events_err_title')), 'db' => array('pass' => 'Xss'), 'display' => true), 'Description' => array('type' => 'textarea', 'name' => 'Description', 'caption' => _t('_bx_events_caption_desc'), 'required' => true, 'html' => 2, 'checker' => array('func' => 'length', 'params' => array(20, 64000), 'error' => _t('_bx_events_err_desc')), 'db' => array('pass' => 'XssHtml')), 'Country' => array('type' => 'select', 'name' => 'Country', 'caption' => _t('_bx_events_caption_country'), 'values' => $aCountries, 'required' => true, 'checker' => array('func' => 'preg', 'params' => array('/^[a-zA-Z]{2}$/'), 'error' => _t('_bx_events_err_country')), 'db' => array('pass' => 'Preg', 'params' => array('/([a-zA-Z]{2})/'))), 'City' => array('type' => 'text', 'name' => 'City', 'caption' => _t('_bx_events_caption_city'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(3, 50), 'error' => _t('_bx_events_err_city')), 'db' => array('pass' => 'Xss')), 'Place' => array('type' => 'text', 'name' => 'Place', 'caption' => _t('_bx_events_caption_place'), 'required' => true, 'checker' => array('func' => 'avail', 'error' => _t('_bx_events_err_place')), 'db' => array('pass' => 'Xss'), 'display' => true), 'EventStart' => array('type' => 'datetime', 'name' => 'EventStart', 'caption' => _t('_bx_events_caption_event_start'), 'required' => true, 'checker' => array('func' => 'DateTime', 'error' => _t('_bx_events_err_event_start')), 'db' => array('pass' => 'DateTime'), 'display' => 'filterDate'), 'EventEnd' => array('type' => 'datetime', 'name' => 'EventEnd', 'caption' => _t('_bx_events_caption_event_end'), 'required' => true, 'checker' => array('func' => 'DateTime', 'error' => _t('_bx_events_err_event_end')), 'db' => array('pass' => 'DateTime'), 'display' => 'filterDate'), 'Tags' => array('type' => 'text', 'name' => 'Tags', 'caption' => _t('_Tags'), 'info' => _t('_sys_tags_note'), 'required' => true, 'checker' => array('func' => 'avail', 'error' => _t('_bx_events_err_tags')), 'db' => array('pass' => 'Tags')), 'Categories' => $oCategories->getGroupChooser('bx_events', (int) $iProfileId, true), 'header_images' => array('type' => 'block_header', 'caption' => _t('_bx_events_form_header_images'), 'collapsable' => true, 'collapsed' => false), 'PrimPhoto' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['images']['thumb_choice'], 'name' => 'PrimPhoto', 'caption' => _t('_bx_events_form_caption_thumb_choice'), 'info' => _t('_bx_events_form_info_thumb_choice'), 'required' => false, 'db' => array('pass' => 'Int')), 'images_choice' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['images']['choice'], 'name' => 'images_choice[]', 'caption' => _t('_bx_events_form_caption_images_choice'), 'info' => _t('_bx_events_form_info_images_choice'), 'required' => false), 'images_upload' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['images']['upload'], 'name' => 'images_upload[]', 'caption' => _t('_bx_events_form_caption_images_upload'), 'info' => _t('_bx_events_form_info_images_upload'), 'required' => false), 'header_videos' => array('type' => 'block_header', 'caption' => _t('_bx_events_form_header_videos'), 'collapsable' => true, 'collapsed' => false), 'videos_choice' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['videos']['choice'], 'name' => 'videos_choice[]', 'caption' => _t('_bx_events_form_caption_videos_choice'), 'info' => _t('_bx_events_form_info_videos_choice'), 'required' => false), 'videos_upload' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['videos']['upload'], 'name' => 'videos_upload[]', 'caption' => _t('_bx_events_form_caption_videos_upload'), 'info' => _t('_bx_events_form_info_videos_upload'), 'required' => false), 'header_sounds' => array('type' => 'block_header', 'caption' => _t('_bx_events_form_header_sounds'), 'collapsable' => true, 'collapsed' => false), 'sounds_choice' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['sounds']['choice'], 'name' => 'sounds_choice[]', 'caption' => _t('_bx_events_form_caption_sounds_choice'), 'info' => _t('_bx_events_form_info_sounds_choice'), 'required' => false), 'sounds_upload' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['sounds']['upload'], 'name' => 'sounds_upload[]', 'caption' => _t('_bx_events_form_caption_sounds_upload'), 'info' => _t('_bx_events_form_info_sounds_upload'), 'required' => false), 'header_files' => array('type' => 'block_header', 'caption' => _t('_bx_events_form_header_files'), 'collapsable' => true, 'collapsed' => false), 'files_choice' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['files']['choice'], 'name' => 'files_choice[]', 'caption' => _t('_bx_events_form_caption_files_choice'), 'info' => _t('_bx_events_form_info_files_choice'), 'required' => false), 'files_upload' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['files']['upload'], 'name' => 'files_upload[]', 'caption' => _t('_bx_events_form_caption_files_upload'), 'info' => _t('_bx_events_form_info_files_upload'), 'required' => false), 'header_privacy' => array('type' => 'block_header', 'caption' => _t('_bx_events_form_header_privacy')), 'allow_view_event_to' => $GLOBALS['oBxEventsModule']->_oPrivacy->getGroupChooser($iProfileId, 'events', 'view_event'), 'allow_view_participants_to' => $aInputPrivacyViewParticipants, 'allow_comment_to' => $aInputPrivacyComment, 'allow_rate_to' => $aInputPrivacyRate, 'allow_post_in_forum_to' => $aInputPrivacyForum, 'allow_join_to' => $GLOBALS['oBxEventsModule']->_oPrivacy->getGroupChooser($iProfileId, 'events', 'join'), 'JoinConfirmation' => array('type' => 'select', 'name' => 'JoinConfirmation', 'caption' => _t('_bx_events_form_caption_join_confirmation'), 'info' => _t('_bx_events_form_info_join_confirmation'), 'values' => array(0 => _t('_bx_events_form_join_confirmation_disabled'), 1 => _t('_bx_events_form_join_confirmation_enabled')), 'checker' => array('func' => 'int', 'error' => _t('_bx_events_form_err_join_confirmation')), 'db' => array('pass' => 'Int')), 'allow_upload_photos_to' => $aInputPrivacyUploadPhotos, 'allow_upload_videos_to' => $aInputPrivacyUploadVideos, 'allow_upload_sounds_to' => $aInputPrivacyUploadSounds, 'allow_upload_files_to' => $aInputPrivacyUploadFiles));
     if (!$aCustomForm['inputs']['images_choice']['content']) {
         unset($aCustomForm['inputs']['PrimPhoto']);
         unset($aCustomForm['inputs']['images_choice']);
     }
     if (!$aCustomForm['inputs']['videos_choice']['content']) {
         unset($aCustomForm['inputs']['videos_choice']);
     }
     if (!$aCustomForm['inputs']['sounds_choice']['content']) {
         unset($aCustomForm['inputs']['sounds_choice']);
     }
     if (!$aCustomForm['inputs']['files_choice']['content']) {
         unset($aCustomForm['inputs']['files_choice']);
     }
     $aFormInputsAdminPart = array();
     if ($GLOBALS['oBxEventsModule']->isAdmin()) {
         require_once BX_DIRECTORY_PATH_INC . 'membership_levels.inc.php';
         $aMemberships = getMemberships();
         unset($aMemberships[MEMBERSHIP_ID_NON_MEMBER]);
         // unset Non-member
         $aMemberships = array('' => _t('_bx_events_membership_filter_none')) + $aMemberships;
         $aFormInputsAdminPart = array('EventMembershipFilter' => array('type' => 'select', 'name' => 'EventMembershipFilter', 'caption' => _t('_bx_events_caption_membership_filter'), 'info' => _t('_bx_events_info_membership_filter'), 'values' => $aMemberships, 'value' => '', 'checker' => array('func' => 'preg', 'params' => array('/^[0-9a-zA-Z]*$/'), 'error' => _t('_bx_events_err_membership_filter')), 'db' => array('pass' => 'Preg', 'params' => array('/([0-9a-zA-Z]*)/'))));
     }
     $aFormInputsSubmit = array('Submit' => array('type' => 'submit', 'name' => 'submit_form', 'value' => _t('_Submit'), 'colspan' => true));
     $aCustomForm['inputs'] = array_merge($aCustomForm['inputs'], $aFormInputsAdminPart, $aFormInputsSubmit);
     $this->processMembershipChecksForMediaUploads($aCustomForm['inputs']);
     parent::BxDolFormMedia($aCustomForm);
 }
Esempio n. 22
0
 function actionEdit($iFileId)
 {
     $bAjax = isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' ? TRUE : FALSE;
     $iFileId = (int) $iFileId > 0 ? (int) $iFileId : (int) bx_get('fileId');
     if (!$iFileId || !$bAjax) {
         return;
     }
     $aManageArray = array('medTitle', 'medTags', 'medDesc', 'medProfId', 'Categories', 'AllowDownload', 'medUri');
     $aInfo = $this->_oDb->getFileInfo(array('fileId' => $iFileId), false, $aManageArray);
     $sLangPref = '_' . $this->_oConfig->getMainPrefix();
     if (!$this->isAllowedEdit($aInfo)) {
         $sCode = MsgBox(_t($sLangPref . '_access_denied')) . $sJsCode;
     } else {
         $oCategories = new BxDolCategories();
         $oCategories->getTagObjectConfig();
         $aCategories = $oCategories->getGroupChooser($this->_oConfig->getMainPrefix(), $this->_iProfileId, true);
         $aCategories['value'] = explode(CATEGORIES_DIVIDER, $aInfo['Categories']);
         $aAllowDownload = $this->oPrivacy->getGroupChooser($this->_iProfileId, $this->_oConfig->getUri(), 'download');
         $aAllowDownload['value'] = $aInfo['AllowDownload'];
         $sUrlPref = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri();
         $aForm = array('form_attrs' => array('id' => $sLangPref . '_upload_form', 'method' => 'post', 'action' => $sUrlPref . 'edit/' . $iFileId, 'onsubmit' => "return bx_ajax_form_check(this)"), 'params' => array('db' => array('submit_name' => 'do_submit'), 'checker_helper' => 'BxSupportCheckerHelper'), 'inputs' => array('header' => array('type' => 'block_header', 'caption' => _t('_Info')), 'title' => array('type' => 'text', 'name' => 'medTitle', 'caption' => _t('_Title'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(3, 128), 'error' => _t('_td_err_incorrect_length')), 'value' => $aInfo['medTitle']), 'tags' => array('type' => 'text', 'name' => 'medTags', 'caption' => _t('_Tags'), 'info' => _t('_Tags_desc'), 'value' => $aInfo['medTags']), 'description' => array('type' => 'textarea', 'name' => 'medDesc', 'caption' => _t('_Description'), 'value' => $aInfo['medDesc']), 'categories' => $aCategories, 'AllowDownload' => $aAllowDownload, 'fileId' => array('type' => 'hidden', 'name' => 'fileId', 'value' => $iFileId), 'medProfId' => array('type' => 'hidden', 'name' => 'medProfId', 'value' => $this->_iProfileId), 'do_submit' => array('type' => 'hidden', 'name' => 'do_submit', 'value' => 1), 'submit' => array('type' => 'submit', 'name' => 'submit_press', 'value' => _t('_Submit'), 'colspan' => true)));
         $oForm = new BxTemplFormView($aForm);
         $oForm->initChecker($aInfo);
         if ($oForm->isSubmittedAndValid()) {
             $aValues = array();
             array_pop($aManageArray);
             foreach ($aManageArray as $sKey) {
                 if ($sKey != 'Categories') {
                     $aValues[$sKey] = $_POST[$sKey];
                 } else {
                     $aValues[$sKey] = implode(CATEGORIES_DIVIDER, $_POST[$sKey]);
                 }
             }
             if ($this->_oDb->updateData($iFileId, $aValues)) {
                 $sType = $this->_oConfig->getMainPrefix();
                 bx_import('BxDolCategories');
                 $oTag = new BxDolTags();
                 $oTag->reparseObjTags($sType, $iFileId);
                 $oCateg = new BxDolCategories();
                 $oCateg->reparseObjTags($sType, $iFileId);
                 $sCode = $GLOBALS['oFunctions']->msgBox(_t($sLangPref . '_save_success'), 3, 'window.location="' . $sUrlPref . 'view/' . $aInfo['medUri'] . '";');
             } else {
                 $sCode = $GLOBALS['oFunctions']->msgBox(_t('_sys_save_nothing'));
             }
         } else {
             $sCode = $this->_oTemplate->parseHtmlByName('default_padding.html', array('content' => $oForm->getCode()));
             $sCode = $this->_oTemplate->parseHtmlByName('popup.html', array('title' => $aInfo['medTitle'], 'content' => $sCode));
             $sCode = $GLOBALS['oFunctions']->transBox($sCode, TRUE);
         }
     }
     header('Content-type:text/html;charset=utf-8');
     echo $sCode;
     exit;
 }
Esempio n. 23
0
 function adminDisapproveFile($iFileId)
 {
     $iFileId = (int) $iFileId;
     $aInfo = $this->_oDb->getFileInfo(array('fileId' => $iFileId), true, array('Approved'));
     $this->_oDb->disapproveFile($iFileId);
     if ($aInfo['Approved'] == 'approved') {
         $this->oAlbums->updateObjCounterById($iFileId, false);
         bx_import('BxDolCategories');
         //tags & categories parsing
         $oTag = new BxDolTags();
         $oTag->reparseObjTags($this->_oConfig->getMainPrefix(), $iFileId);
         $oCateg = new BxDolCategories();
         $oCateg->reparseObjTags($this->_oConfig->getMainPrefix(), $iFileId);
     }
 }
Esempio n. 24
0
 function insertSharedMediaToDb($sExt, $aFileInfo)
 {
     if (getParam('bx_files_activation') == 'on') {
         $bAutoActivate = true;
         $sStatus = 'approved';
     } else {
         $bAutoActivate = false;
         $sStatus = 'pending';
     }
     $sFileTitle = addslashes($aFileInfo['medTitle']);
     $sFileDesc = addslashes($aFileInfo['medDesc']);
     $sFileTags = addslashes($aFileInfo['medTags']);
     $iAllowDownload = (int) $aFileInfo['AllowDownload'];
     $sCategory = implode(CATEGORIES_DIVIDER, $aFileInfo['Categories']);
     $sAlbum = isset($aFileInfo['album']) ? $aFileInfo['album'] : getParam('sys_album_default_name');
     $sMedUri = uriGenerate($sFileTitle, $this->oModule->_oDb->sFileTable, $this->oModule->_oDb->aFileFields['medUri']);
     $sDimension = (int) $aFileInfo['medSize'];
     $sExtDb = trim($sExt, '.');
     $sCurTime = time();
     $iInsertedID = $this->oModule->_oDb->insertData(array('medProfId' => $this->_iOwnerId, 'medExt' => $sExtDb, 'medTitle' => $sFileTitle, 'medUri' => $sMedUri, 'medDesc' => $sFileDesc, 'medTags' => $sFileTags, 'Categories' => $sCategory, 'medSize' => $sDimension, 'Approved' => $sStatus, 'medDate' => $sCurTime, 'AllowDownload' => $iAllowDownload));
     if (0 < $iInsertedID) {
         $oTag = new BxDolTags();
         $oTag->reparseObjTags('bx_files', $iInsertedID);
         $oCateg = new BxDolCategories();
         $oCateg->reparseObjTags('bx_files', $iInsertedID);
         $this->addObjectToAlbum($this->oModule->oAlbums, $sAlbum, $iInsertedID, $bAutoActivate);
         return $iInsertedID;
     } else {
         return 0;
     }
 }
Esempio n. 25
0
 function initMusicFile($iMusicID, $sTitle, $sCategories, $sTags, $sDesc)
 {
     $sMedUri = uriGenerate($sTitle, $this->oModule->_oDb->sFileTable, $this->oModule->_oDb->aFileFields['medUri']);
     $bRes = $this->oModule->_oDb->updateData($iMusicID, array('Categories' => $sCategories, 'medTitle' => $sTitle, 'medTags' => $sTags, 'medDesc' => $sDesc, 'medUri' => $sMedUri));
     $oTag = new BxDolTags();
     $oTag->reparseObjTags('bx_sounds', $iMusicID);
     $oCateg = new BxDolCategories();
     $oCateg->reparseObjTags('bx_sounds', $iMusicID);
     $bRes = true;
     //TODO chech why if false
     return $bRes;
 }
 function savePage()
 {
     $aDiff = $this->getDiffValues(0);
     list($aUpd, $aMedia) = $this->oPF->getPageFromValues($aDiff);
     $sDelimeter = getParam('ml_clonetwo_multi_divider');
     $sDelimeter = $sDelimeter ? $sDelimeter : ';';
     if ($aDiff['title']) {
         $aUpd['uri'] = uriGenerate($aDiff['title'], 'ml_clonetwo_main', 'title');
     }
     $sTitle = $aDiff['title'] ? $aDiff['title'] : db_value("SELECT `title` FROM `ml_clonetwo_main` WHERE `id` = {$this->iPageID} LIMIT 1");
     if (!empty($aMedia)) {
         foreach ($aMedia as $sKey => $sValue) {
             $aMediaData = explode($sDelimeter, $aUpd[$sValue]);
             switch ($sKey) {
                 case 'photo':
                     $sTable = 'ml_clonetwo_images';
                     $iIdField = 'entry_id';
                     $iMedIdField = 'media_id';
                     if ($_POST['thumb_radio']) {
                         db_res("UPDATE `ml_clonetwo_main` SET `thumb` = {$_POST['thumb_radio']} WHERE `id` = {$this->iPageID} LIMIT 1");
                     }
                     if (!empty($_POST[$sValue . '_check_photos'])) {
                         foreach ($_POST[$sValue . '_check_photos'] as $sValue) {
                             if ($sValue) {
                                 db_res("DELETE FROM `{$sTable}` WHERE `{$iIdField}` = {$this->iPageID} AND `{$iMedIdField}` = {$sValue} LIMIT 1");
                             }
                         }
                     }
                     if (BxDolRequest::serviceExists("photos", "perform_photo_upload", 'Uploader')) {
                         $i = 0;
                         foreach ($aMediaData as $sData) {
                             $aInfo = array('medTitle' => $_POST[$sValue . '_title_photos'][$i] ? $_POST[$sValue . '_title_photos'][$i] : $_FILES[$sValue]['name'][$i], 'Categories' => array($aUpd['title'] . ' ' . _t("_bx_{$sKey}s")), 'album' => _t('_ml_clonetwo_photo_album', $aUpd['title']));
                             if ($sData) {
                                 $this->looper();
                                 $iMediaId = BxDolService::call("photos", "perform_photo_upload", array($GLOBALS['dir']['tmp'] . $sData, $aInfo, false), 'Uploader');
                                 if ($iMediaId) {
                                     @unlink($GLOBALS['dir']['tmp'] . $sData);
                                     if (db_value("SHOW TABLES LIKE '{$sTable}'")) {
                                         db_res("INSERT INTO `{$sTable}` SET `{$iIdField}` = {$this->iPageID}, `{$iMedIdField}` = {$iMediaId}");
                                     }
                                     if (!db_value("SELECT `thumb` FROM `ml_clonetwo_main` WHERE `id` = {$this->iPageID} LIMIT 1") && $i == 0) {
                                         db_res("UPDATE `ml_clonetwo_main` SET `thumb` = {$iMediaId} WHERE `id` = {$this->iPageID} LIMIT 1");
                                     }
                                 }
                             }
                             $i++;
                         }
                     }
                     break;
                 case 'video':
                     $sTable = 'ml_clonetwo_videos';
                     $iIdField = 'entry_id';
                     $iMedIdField = 'media_id';
                     if (!empty($_POST[$sValue . '_check_videos'])) {
                         foreach ($_POST[$sValue . '_check_videos'] as $sValue) {
                             if ($sValue) {
                                 db_res("DELETE FROM `{$sTable}` WHERE `{$iIdField}` = {$this->iPageID} AND `{$iMedIdField}` = {$sValue} LIMIT 1");
                             }
                         }
                     }
                     if (BxDolRequest::serviceExists("videos", "perform_video_upload", 'Uploader')) {
                         $i = 0;
                         if ($sData) {
                             foreach ($aMediaData as $sData) {
                                 $aInfo = array('medTitle' => $_POST[$sValue . '_title_videos'][$i] ? $_POST[$sValue . '_title_videos'][$i] : $_FILES[$sValue]['name'][$i], 'Categories' => array($aUpd['title'] . ' ' . _t("_bx_{$sKey}s")), 'album' => _t('_ml_clonetwo_photo_album', $aUpd['title']));
                                 $this->looper();
                                 $iMediaId = BxDolService::call("videos", "perform_video_upload", array($GLOBALS['dir']['tmp'] . $sData, $aInfo, false), 'Uploader');
                                 if ($iMediaId) {
                                     @unlink($GLOBALS['dir']['tmp'] . $sData);
                                     if (db_value("SHOW TABLES LIKE '{$sTable}'")) {
                                         db_res("INSERT INTO `{$sTable}` SET `{$iIdField}` = {$this->iPageID}, `{$iMedIdField}` = {$iMediaId}");
                                     }
                                 }
                             }
                             $i++;
                         }
                     }
                     break;
                 case 'sound':
                     $sTable = 'ml_clonetwo_sounds';
                     $iIdField = 'entry_id';
                     $iMedIdField = 'media_id';
                     if (!empty($_POST[$sValue . '_check_sounds'])) {
                         foreach ($_POST[$sValue . '_check_sounds'] as $sValue) {
                             if ($sValue) {
                                 db_res("DELETE FROM `{$sTable}` WHERE `{$iIdField}` = {$this->iPageID} AND `{$iMedIdField}` = {$sValue} LIMIT 1");
                             }
                         }
                     }
                     if (BxDolRequest::serviceExists("sounds", "perform_music_upload", 'Uploader')) {
                         $i = 0;
                         if ($sData) {
                             foreach ($aMediaData as $sData) {
                                 $aInfo = array('medTitle' => $_POST[$sValue . '_title_sounds'][$i] ? $_POST[$sValue . '_title_sounds'][$i] : $_FILES[$sValue]['name'][$i], 'Categories' => array($aUpd['title'] . ' ' . _t("_bx_{$sKey}s")), 'album' => _t('_ml_clonetwo_photo_album', $aUpd['title']));
                                 $this->looper();
                                 $iMediaId = BxDolService::call("sounds", "perform_music_upload", array($GLOBALS['dir']['tmp'] . $sData, $aInfo, false), 'Uploader');
                                 if ($iMediaId) {
                                     @unlink($GLOBALS['dir']['tmp'] . $sData);
                                     if (db_value("SHOW TABLES LIKE '{$sTable}'")) {
                                         db_res("INSERT INTO `{$sTable}` SET `{$iIdField}` = {$this->iPageID}, `{$iMedIdField}` = {$iMediaId}");
                                     }
                                 }
                             }
                             $i++;
                         }
                     }
                     break;
                 case 'file':
                     $sTable = 'ml_clonetwo_files';
                     $iIdField = 'entry_id';
                     $iMedIdField = 'media_id';
                     if (!empty($_POST[$sValue . '_check_files'])) {
                         foreach ($_POST[$sValue . '_check_files'] as $sValue) {
                             if ($sValue) {
                                 db_res("DELETE FROM `{$sTable}` WHERE `{$iIdField}` = {$this->iPageID} AND `{$iMedIdField}` = {$sValue} LIMIT 1");
                             }
                         }
                     }
                     if (BxDolRequest::serviceExists("files", "perform_file_upload", 'Uploader')) {
                         $i = 0;
                         if ($sData) {
                             foreach ($aMediaData as $sData) {
                                 $aInfo = array('medTitle' => $_POST[$sValue . '_title_files'][$i] ? $_POST[$sValue . '_title_files'][$i] : $_FILES[$sValue]['name'][$i], 'Categories' => array($aUpd['title'] . ' ' . _t("_bx_{$sKey}s")), 'album' => _t('_ml_clonetwo_photo_album', $aUpd['title']));
                                 $this->looper();
                                 $iMediaId = BxDolService::call("files", "perform_file_upload", array($GLOBALS['dir']['tmp'] . $sData, $aInfo, false), 'Uploader');
                                 if ($iMediaId) {
                                     @unlink($GLOBALS['dir']['tmp'] . $sData);
                                     if (db_value("SHOW TABLES LIKE '{$sTable}'")) {
                                         db_res("INSERT INTO `{$sTable}` SET `{$iIdField}` = {$this->iPageID}, `{$iMedIdField}` = {$iMediaId}");
                                     }
                                 }
                             }
                             $i++;
                         }
                     }
                     break;
                 case 'youtube':
                     $i = 0;
                     $sTable = 'ml_clonetwo_youtube';
                     $iUIdField = 'id';
                     $iIdField = 'id_entry';
                     $sUrlField = 'url';
                     $sTitleField = 'title';
                     if (!empty($_POST[$sValue . '_check_youtube'])) {
                         foreach ($_POST[$sValue . '_check_youtube'] as $sValue) {
                             if ($sValue) {
                                 db_res("DELETE FROM `{$sTable}` WHERE `{$iIdField}` = {$this->iPageID} AND `{$iUIdField}` = {$sValue} LIMIT 1");
                             }
                         }
                     }
                     foreach ($aMediaData as $sData) {
                         if ($sData) {
                             $sTitle = $_POST[$sValue . '_title_youtube'][$i];
                             if (db_value("SHOW TABLES LIKE '{$sTable}'") && $sData) {
                                 db_res("INSERT INTO `{$sTable}` SET `{$iIdField}` = {$this->iPageID}, `{$sUrlField}` = '{$sData}', `{$sTitleField}` = '{$sTitle}'");
                             }
                         }
                         $i++;
                     }
                     break;
                 case 'rss':
                     $i = 0;
                     $sTable = 'ml_clonetwo_rss';
                     $iUIdField = 'id';
                     $iIdField = 'id_entry';
                     $sUrlField = 'url';
                     $sTitleField = 'name';
                     if (!empty($_POST[$sValue . '_check_rss'])) {
                         foreach ($_POST[$sValue . '_check_rss'] as $sValue) {
                             if ($sValue) {
                                 db_res("DELETE FROM `{$sTable}` WHERE `{$iIdField}` = {$this->iPageID} AND `{$iUIdField}` = {$sValue} LIMIT 1");
                             }
                         }
                     }
                     foreach ($aMediaData as $sData) {
                         if ($sData) {
                             $sTitle = $_POST[$sValue . '_title_rss'][$i];
                             if (db_value("SHOW TABLES LIKE '{$sTable}'") && $sData) {
                                 db_res("INSERT INTO `{$sTable}` SET `{$iIdField}` = {$this->iPageID}, `{$sUrlField}` = '{$sData}', `{$sTitleField}` = '{$sTitle}'");
                             }
                         }
                         $i++;
                     }
                     break;
             }
         }
     }
     $oModuleDb = new BxDolModuleDb();
     $aModule = $oModuleDb->getModuleByUri('clonetwo');
     $iProfileId = getLoggedId();
     bx_import('BxDolTags');
     $o = new BxDolTags();
     $o->reparseObjTags('ml_clonetwo', $this->iPageID);
     bx_import('BxDolCategories');
     $o = new BxDolCategories();
     $o->reparseObjTags('ml_clonetwo', $this->iPageID);
     $this->oPC->updatePage($this->iPageID, $aUpd);
 }
Esempio n. 27
0
 function __construct($oMain, $iProfileId, $isRemovePhotoFieldAllowed = true, $iEntryId = 0, $iThumb = 0)
 {
     $this->_aMedia = array();
     if (BxDolRequest::serviceExists('photos', 'perform_photo_upload', 'Uploader')) {
         $this->_aMedia['images'] = array('post' => 'ready_images', 'upload_func' => 'uploadPhotos', 'tag' => BX_STORE_PHOTOS_TAG, 'cat' => BX_STORE_PHOTOS_CAT, 'thumb' => 'thumb', 'module' => 'photos', 'title_upload_post' => 'images_titles', 'title_upload' => _t('_bx_store_form_caption_file_title'), 'service_method' => 'get_photo_array');
     }
     if (BxDolRequest::serviceExists('videos', 'perform_video_upload', 'Uploader')) {
         $this->_aMedia['videos'] = array('post' => 'ready_videos', 'upload_func' => 'uploadVideos', 'tag' => BX_STORE_VIDEOS_TAG, 'cat' => BX_STORE_VIDEOS_CAT, 'thumb' => false, 'module' => 'videos', 'title_upload' => _t('_bx_store_form_caption_file_title'), 'service_method' => 'get_video_array');
     }
     $this->_oMain = $oMain;
     $this->_oDb = $oMain->_oDb;
     bx_import('BxDolCategories');
     $oCategories = new BxDolCategories();
     $oCategories->getTagObjectConfig();
     // generate templates for form custom elements
     $aCustomMediaTemplates = $this->generateCustomMediaTemplates($iProfileId, $iEntryId, $iThumb);
     // files
     $aFilesChoiceOrig = $this->_getFilesInEntry('files', 'get_file_array', 'ready_files', 'files', (int) $iProfileId, $iEntryId);
     $aFilesChoice = array();
     $sCurrencySign = getParam('pmt_default_currency_sign');
     foreach ($aFilesChoiceOrig as $k => $r) {
         if (!$r['checked']) {
             continue;
         }
         $a = $GLOBALS['oBxStoreModule']->_oDb->getFileInfo($iEntryId, $r['id']);
         $r['file_id'] = $a['id'];
         $r['title'] .= ' - ' . $sCurrencySign . ' ' . $a['price'] . ' (' . $GLOBALS['oBxStoreModule']->getGroupName($a['allow_purchase_to']) . ')';
         $r['visibility'] = $a['hidden'] ? _t('_bx_store_product_file_hidden') : _t('_bx_store_product_file_visible');
         $aFilesChoice[] = $r;
     }
     $aVarsFilesChoice = array('bx_store_base_url' => $this->_oMain->_oConfig->getBaseUri(), 'bx_if:empty' => array('condition' => empty($aFilesChoice), 'content' => array()), 'bx_repeat:files' => $aFilesChoice);
     $aInputPrivacyPurchase = $GLOBALS['oBxStoreModule']->_oPrivacyProduct->getGroupChooser($iProfileId, 'store', 'purchase');
     foreach ($aInputPrivacyPurchase['values'] as $k => $r) {
         if ($r['key'] == BX_DOL_PG_ALL) {
             unset($aInputPrivacyPurchase['values'][$k]);
             break;
         }
     }
     require_once BX_DIRECTORY_PATH_INC . 'membership_levels.inc.php';
     $aMemberships = getMemberships();
     unset($aMemberships[MEMBERSHIP_ID_NON_MEMBER]);
     // unset Non-member
     unset($aMemberships[MEMBERSHIP_ID_STANDARD]);
     // unset member
     $aMemberships = array('' => '----') + $aMemberships;
     $aMembershipsValues = array();
     foreach ($aMemberships as $k => $v) {
         $aMembershipsValues[] = array('key' => $k ? 'm' . $k : $k, 'value' => $v);
     }
     $aInputPrivacyPurchase['values'] = array_merge($aInputPrivacyPurchase['values'], $aMembershipsValues);
     /*
            if (empty($aInputPrivacyPurchase['value']) || !$aInputPrivacyPurchase['value'])
                $aInputPrivacyPurchase['value'] = BX_DOL_PG_MEMBERS;
     */
     $sInputPrivacyPurchase = str_replace('name="allow_purchase_to"', 'name="allow_purchase_to[]"', $this->genInputSelect($aInputPrivacyPurchase));
     $aVarsFilesUpload = array('file' => 'files', 'title' => 'files_titles', 'file_upload_title' => _t('_bx_store_form_caption_file_title'), 'bx_if:price' => array('condition' => true, 'content' => array('price' => 'files_prices', 'file_price_title' => _t('_bx_store_form_caption_file_price'))), 'bx_if:privacy' => array('condition' => true, 'content' => array('select' => $sInputPrivacyPurchase, 'file_permission_title' => _t('_bx_store_form_caption_file_allow_purcase_to'))));
     // privacy
     $aInputPrivacyCustom = array();
     $aInputPrivacyCustom[] = array('key' => '', 'value' => '----');
     $aInputPrivacyCustom[] = array('key' => 'c', 'value' => _t('_bx_store_privacy_customers_only'));
     $aInputPrivacyPostInForum = $GLOBALS['oBxStoreModule']->_oPrivacyProduct->getGroupChooser($iProfileId, 'store', 'post_in_forum');
     $aInputPrivacyPostInForum['values'] = array_merge($aInputPrivacyPostInForum['values'], $aInputPrivacyCustom);
     $aInputPrivacyPostInForum['db'] = array('pass' => 'Preg', 'params' => array('/^([0-9c]+)$/'));
     $aInputPrivacyViewForum = $GLOBALS['oBxStoreModule']->_oPrivacyProduct->getGroupChooser($iProfileId, 'store', 'view_forum');
     $aInputPrivacyViewForum['values'] = array_merge($aInputPrivacyViewForum['values'], $aInputPrivacyCustom);
     $aInputPrivacyViewForum['db'] = $aInputPrivacyPostInForum['db'];
     $aCustomForm = array('form_attrs' => array('name' => 'form_store', 'action' => '', 'method' => 'post', 'enctype' => 'multipart/form-data'), 'params' => array('db' => array('table' => 'bx_store_products', 'key' => 'id', 'uri' => 'uri', 'uri_title' => 'title', 'submit_name' => 'submit_form')), 'inputs' => array('header_info' => array('type' => 'block_header', 'caption' => _t('_bx_store_form_header_info')), 'title' => array('type' => 'text', 'name' => 'title', 'caption' => _t('_bx_store_form_caption_title'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(3, 100), 'error' => _t('_bx_store_form_err_title')), 'db' => array('pass' => 'Xss')), 'desc' => array('type' => 'textarea', 'name' => 'desc', 'caption' => _t('_bx_store_form_caption_desc'), 'required' => true, 'html' => 2, 'checker' => array('func' => 'length', 'params' => array(20, 64000), 'error' => _t('_bx_store_form_err_desc')), 'db' => array('pass' => 'XssHtml')), 'tags' => array('type' => 'text', 'name' => 'tags', 'caption' => _t('_Tags'), 'info' => _t('_sys_tags_note'), 'required' => true, 'checker' => array('func' => 'avail', 'error' => _t('_bx_store_form_err_tags')), 'db' => array('pass' => 'Tags')), 'categories' => $oCategories->getGroupChooser('bx_store', (int) $iProfileId, true), 'header_images' => array('type' => 'block_header', 'caption' => _t('_bx_store_form_header_images'), 'collapsable' => true, 'collapsed' => false), 'thumb' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['images']['thumb_choice'], 'name' => 'thumb', 'caption' => _t('_bx_store_form_caption_thumb_choice'), 'info' => _t('_bx_store_form_info_thumb_choice'), 'required' => false, 'db' => array('pass' => 'Int')), 'images_choice' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['images']['choice'], 'name' => 'images_choice[]', 'caption' => _t('_bx_store_form_caption_images_choice'), 'info' => _t('_bx_store_form_info_images_choice'), 'required' => false), 'images_upload' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['images']['upload'], 'name' => 'images_upload[]', 'caption' => _t('_bx_store_form_caption_images_upload'), 'info' => _t('_bx_store_form_info_images_upload'), 'required' => false), 'header_videos' => array('type' => 'block_header', 'caption' => _t('_bx_store_form_header_videos'), 'collapsable' => true, 'collapsed' => false), 'videos_choice' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['videos']['choice'], 'name' => 'videos_choice[]', 'caption' => _t('_bx_store_form_caption_videos_choice'), 'info' => _t('_bx_store_form_info_videos_choice'), 'required' => false), 'videos_upload' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['videos']['upload'], 'name' => 'videos_upload[]', 'caption' => _t('_bx_store_form_caption_videos_upload'), 'info' => _t('_bx_store_form_info_videos_upload'), 'required' => false), 'header_files' => array('type' => 'block_header', 'caption' => _t('_bx_store_form_header_files'), 'collapsable' => true, 'collapsed' => false), 'files_choice' => array('type' => 'custom', 'content' => $aFilesChoice ? $GLOBALS['oBxStoreModule']->_oTemplate->parseHtmlByName('form_field_product_files_choice', $aVarsFilesChoice) : '', 'name' => 'files_choice[]', 'caption' => _t('_bx_store_form_caption_files_choice'), 'info' => _t('_bx_store_form_info_files_choice'), 'required' => false), 'files_upload' => array('type' => 'custom', 'content' => $GLOBALS['oBxStoreModule']->_oTemplate->parseHtmlByName('form_field_files_upload', $aVarsFilesUpload), 'name' => 'files_upload[]', 'caption' => _t('_bx_store_form_caption_files_upload'), 'info' => _t('_bx_store_form_info_files_upload'), 'required' => false), 'header_privacy' => array('type' => 'block_header', 'caption' => _t('_bx_store_form_header_privacy')), 'allow_view_product_to' => $GLOBALS['oBxStoreModule']->_oPrivacyProduct->getGroupChooser($iProfileId, 'store', 'view_product'), 'allow_post_in_forum_to' => $aInputPrivacyPostInForum, 'allow_view_forum_to' => $aInputPrivacyViewForum));
     if (!$aCustomForm['inputs']['images_choice']['content']) {
         unset($aCustomForm['inputs']['thumb']);
         unset($aCustomForm['inputs']['images_choice']);
     }
     if (!$aCustomForm['inputs']['videos_choice']['content']) {
         unset($aCustomForm['inputs']['videos_choice']);
     }
     if (!$aFilesChoice) {
         unset($aCustomForm['inputs']['files_choice']);
     }
     if (!isset($this->_aMedia['images'])) {
         unset($aCustomForm['inputs']['header_images']);
         unset($aCustomForm['inputs']['PrimPhoto']);
         unset($aCustomForm['inputs']['images_choice']);
         unset($aCustomForm['inputs']['images_upload']);
         unset($aCustomForm['inputs']['allow_upload_photos_to']);
     }
     if (!isset($this->_aMedia['videos'])) {
         unset($aCustomForm['inputs']['header_videos']);
         unset($aCustomForm['inputs']['videos_choice']);
         unset($aCustomForm['inputs']['videos_upload']);
         unset($aCustomForm['inputs']['allow_upload_videos_to']);
     }
     $aFormInputsSubmit = array('Submit' => array('type' => 'submit', 'name' => 'submit_form', 'value' => _t('_Submit')));
     $aCustomForm['inputs'] = array_merge($aCustomForm['inputs'], $aFormInputsSubmit);
     $this->processMembershipChecksForMediaUploads($aCustomForm['inputs']);
     parent::__construct($aCustomForm);
 }
Esempio n. 28
0
 function deletePoll($iId)
 {
     $aPoll = $this->_oDb->getPollInfo($iId);
     if (empty($aPoll) || !is_array($aPoll)) {
         return false;
     }
     $aPoll = array_shift($aPoll);
     if (!isLogged() || !isAdmin() && $aPoll['id_profile'] != getLoggedId()) {
         return false;
     }
     $this->_oDb->deletePoll($iId);
     $oTag = new BxDolTags();
     $oTag->reparseObjTags('bx_poll', $iId);
     $oCateg = new BxDolCategories();
     $oCateg->reparseObjTags('bx_poll', $iId);
     //delete all subscriptions
     $oSubscription = BxDolSubscription::getInstance();
     $oSubscription->unsubscribe(array('type' => 'object_id', 'unit' => 'bx_poll', 'object_id' => $iId));
     // create system event
     $oZ = new BxDolAlerts('bx_poll', 'delete_poll', $iId);
     $oZ->alert();
     return true;
 }
 function insertSharedMediaToDb($sExt, $aFileInfo, $iAuthorId = 0, $aExtraData = array())
 {
     if (!$iAuthorId) {
         $iAuthorId = $this->_iOwnerId;
     }
     if (getParam($this->oModule->_oConfig->aGlParams['auto_activation']) == 'on') {
         $bAutoActivate = true;
         $sStatus = 'approved';
     } else {
         $bAutoActivate = false;
         $sStatus = 'pending';
     }
     $sFileTitle = $aFileInfo['medTitle'];
     $sFileDesc = $aFileInfo['medDesc'];
     $sFileTags = $aFileInfo['medTags'];
     $sCategory = implode(CATEGORIES_DIVIDER, $aFileInfo['Categories']);
     $sDimension = isset($aFileInfo['dimension']) ? $aFileInfo['dimension'] : (int) $aFileInfo['medSize'];
     $sAlbum = mb_strlen($_POST['extra_param_album']) > 0 ? $_POST['extra_param_album'] : getParam('sys_album_default_name');
     $sAlbum = isset($aFileInfo['album']) ? $aFileInfo['album'] : $sAlbum;
     $sMedUri = uriGenerate($sFileTitle, $this->oModule->_oDb->sFileTable, $this->oModule->_oDb->aFileFields['medUri']);
     $sExtDb = trim($sExt, '.');
     $sCurTime = time();
     $aData = array('medProfId' => $iAuthorId, 'medExt' => $sExtDb, 'medTitle' => $sFileTitle, 'medUri' => $sMedUri, 'medDesc' => $sFileDesc, 'medTags' => $sFileTags, 'Categories' => $sCategory, 'medSize' => $sDimension, 'Approved' => $sStatus, 'medDate' => $sCurTime);
     $aData = array_merge($aData, $aExtraData);
     $iInsertedID = $this->oModule->_oDb->insertData($aData);
     if (0 < $iInsertedID) {
         $oTag = new BxDolTags();
         $oTag->reparseObjTags($this->oModule->_oConfig->sPrefix, $iInsertedID);
         $oCateg = new BxDolCategories();
         $oCateg->reparseObjTags($this->oModule->_oConfig->sPrefix, $iInsertedID);
         $aAlbumParams = isset($aFileInfo['albumPrivacy']) ? array('privacy' => $aFileInfo['albumPrivacy']) : array();
         $this->addObjectToAlbum($this->oModule->oAlbums, $sAlbum, $iInsertedID, $bAutoActivate, $iAuthorId, $aAlbumParams);
         return $iInsertedID;
     }
     return 0;
 }
Esempio n. 30
0
 function reparseCategories($iEntryId)
 {
     $iEntryId = (int) $iEntryId;
     bx_import('BxDolCategories');
     $o = new BxDolCategories();
     $o->reparseObjTags($this->_sPrefix, $iEntryId);
 }