本文整理汇总了PHP中BxDolCategories类的典型用法代码示例。如果您正苦于以下问题:PHP BxDolCategories类的具体用法?PHP BxDolCategories怎么用?PHP BxDolCategories使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BxDolCategories类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEditForm
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();
}
}
示例2: BxGroupsFormAdd
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);
}
示例3: __construct
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);
}
示例4: BxGroupsFormEdit
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);
}
示例5: BxEventsFormEdit
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);
}
示例6: processing
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);
}
示例7: BxBaseCategories
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'));
}
示例8: transferContent
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;
}
示例9: getFullForm
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;
}
示例10: __construct
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);
}
示例11: displayList
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("\$", "$", $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("\$", "$", $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;
}
示例12: processing
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 ---//
}
}
}
示例13: _actDelete
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;
}
示例14: convertValues4Input
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;
}
示例15: onPostApproveDisapprove
/**
* 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();
}