本文整理汇总了PHP中BxDolTags::reparseObjTags方法的典型用法代码示例。如果您正苦于以下问题:PHP BxDolTags::reparseObjTags方法的具体用法?PHP BxDolTags::reparseObjTags怎么用?PHP BxDolTags::reparseObjTags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BxDolTags
的用法示例。
在下文中一共展示了BxDolTags::reparseObjTags方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
/**
* Function will transfer all profile's polls;
*
* @return : (string) - error message or empty;
*/
function process()
{
$sTableMainNew = $this->sTablePrefix . $this->oDolModule->_oDb->_sTableMain;
if ($this->oMigrationModule->_oDb->getOne("SELECT COUNT(*) FROM `{$sTableMainNew}`") > 0) {
return 'Error: it is possible to transfaer data to clean install only, in your case some existing data was found.';
}
$sQuery = "SELECT * FROM `SDatingEvents`";
$rResult = mysql_query($sQuery, $this->rOldDb);
while ($r = mysql_fetch_assoc($rResult)) {
$r = $this->escapeData($r);
//count participants
$iParticipants = $this->getParticipantsCount($r['ID']);
$sStatus = $r['Status'] == 'Active' ? 'approved' : 'pending';
// execute query;
$sQuery = "\r\n INSERT INTO\r\n `{$sTableMainNew}` \r\n SET \r\n `ID` = {$r['ID']},\r\n `Title` = '{$r['Title']}', \r\n `EntryUri` = '{$r['EntryUri']}',\r\n `Description` = '{$r['Description']}',\r\n `Status` = '{$sStatus}', \r\n `Country` = '{$r['Country']}',\r\n `City` = '{$r['City']}',\r\n `Place` = '{$r['Place']}',\r\n `PrimPhoto` = '',\r\n `Date` = UNIX_TIMESTAMP('{$r['EventStart']}'),\r\n `EventStart` = UNIX_TIMESTAMP('{$r['EventStart']}'),\r\n `EventEnd` = UNIX_TIMESTAMP('{$r['EventStart']}'),\r\n `ResponsibleID` = '{$r['ResponsibleID']}',\r\n `EventMembershipFilter` = '{$this->aDefValues['EventMembershipFilter']}',\r\n `Tags` = '{$r['Tags']}',\r\n `Categories` = '',\r\n `Views` = '0',\r\n `Rate` = '0',\r\n `RateCount` = '0',\r\n `CommentsCount` = '0',\r\n `FansCount` = '{$iParticipants}',\r\n `Featured` = '0',\r\n `allow_view_event_to` = '{$this->aDefValues['allow_view_event_to']}',\r\n `allow_view_participants_to` = '{$this->aDefValues['allow_view_participants_to']}',\r\n `allow_comment_to` = '{$this->aDefValues['allow_comment_to']}',\r\n `allow_rate_to` = '{$this->aDefValues['allow_rate_to']}',\r\n `allow_join_to` = '{$this->aDefValues['allow_join_to']}',\r\n `allow_post_in_forum_to` = '{$this->aDefValues['allow_post_in_forum_to']}',\r\n `JoinConfirmation` = '{$this->aDefValues['JoinConfirmation']}',\r\n `allow_upload_photos_to` = '{$this->aDefValues['allow_upload_photos_to']}',\r\n `allow_upload_videos_to` = '{$this->aDefValues['allow_upload_videos_to']}',\r\n `allow_upload_sounds_to` = '{$this->aDefValues['allow_upload_sounds_to']}',\r\n `allow_upload_files_to` = '{$this->aDefValues['allow_upload_files_to']}'\r\n ";
$iResult = (int) $this->oMigrationModule->_oDb->query($sQuery);
if ($iResult <= 0) {
return 'Database error: can not insert new event into the table.';
}
//reparse tags
$oTag = new BxDolTags();
$oTag->reparseObjTags('bx_events', $r['ID']);
// transfer partocipants
$this->_transferParticipants($r['ID']);
// transfer photo;
$this->_transferEventPhoto($r);
$this->iTransffered++;
}
}
示例2: getMigration
/**
* Function migrate shared_photos data;
*
* @return : (integer) operation result;
*/
function getMigration()
{
if (!$this->oDolModule) {
$this->setResultStatus('System error: object instance is not received');
return MIGRATION_FAILED;
}
// set new status;
$this->setResultStatus('Shared photos transfer now');
mysql_query('SET NAMES utf8', $this->rOldDb);
$sqlQuery = "SELECT * FROM `{$this->aOldTables['main']}` GROUP BY `medID`";
$rResult = mysql_query($sqlQuery, $this->rOldDb);
while ($aRow = mysql_fetch_assoc($rResult)) {
$sUri = !$this->isEntryExisting($aRow['medUri']) ? $aRow['medUri'] : uriGenerate($aRow['medTitle'], $this->sType . '_main', 'Uri');
$sUri = $this->oMigrationModule->_oDb->escape($sUri);
$aSizeInfo = $this->getSizeInfo($aRow['medID'] . '.' . $aRow['medExt']);
$sSize = $aSizeInfo['width'] . 'x' . $aSizeInfo['height'];
$sStatus = $aRow['Approved'] == 'true' ? 'approved' : 'disapproved';
$sHash = md5(microtime());
// escape all data;
$aRow = $this->escapeData($aRow);
$sqlQuery = "\n\t INSERT INTO \n\t \t`{$this->sType}_main`\n\t SET\n\t\t\t\t\t `Owner` = '{$aRow['medProfId']}',\n\t\t\t\t\t `Ext` = '{$aRow['medExt']}',\n\t\t\t\t\t `Size` = '{$sSize}',\n\t\t\t\t\t `Title` = '{$aRow['medTitle']}',\n\t\t\t\t\t `Uri` = '{$sUri}',\n\t\t\t\t\t `Desc` = '{$aRow['medDesc']}',\n\t\t\t\t\t `Tags` = '{$aRow['medTags']}',\n\t\t\t\t\t `Date` = '{$aRow['medDate']}',\n\t\t\t\t\t `Views` = '{$aRow['medViews']}',\n\t\t\t\t\t `Hash` = '{$sHash}',\n\t\t\t\t\t `Status` = '{$sStatus}'\n ";
$iResult = (int) $this->oMigrationModule->_oDb->query($sqlQuery);
if ($iResult <= 0) {
$this->setResultStatus('Database error. Cannot insert new photo to the database.');
return MIGRATION_FAILED;
}
// get last file id;
$iFileId = $this->oMigrationModule->_oDb->lastId();
//transform the file
$this->_exportFile(array('medID' => $aRow['medID'], 'medFile' => $aRow['medFile'], 'medProfId' => $aRow['medProfId'], 'medExt' => $aRow['medExt'], 'newID' => $iFileId));
$oTag = new BxDolTags();
$oTag->reparseObjTags($this->sType, $iFileId);
// define album
$sError = $this->_defineAlbum($iFileId, $aRow['medProfId'], $aRow['medTitle']);
if ($sError) {
$this->setResultStatus($sError);
return MIGRATION_FAILED;
}
$sError = $this->_exportFavorites(array('old' => $aRow['medID'], 'new' => $iFileId));
if ($sError) {
$this->setResultStatus($sError);
return MIGRATION_FAILED;
}
$sError = $this->_exportVotings(array('old' => $aRow['medID'], 'new' => $iFileId));
if ($sError) {
$this->setResultStatus($sError);
return MIGRATION_FAILED;
}
$sError = $this->_exportComments(array('old' => $aRow['medID'], 'new' => $iFileId));
if ($sError) {
$this->setResultStatus($sError);
return MIGRATION_FAILED;
}
}
// set as finished;
$this->setResultStatus('All photos were transferred');
return MIGRATION_SUCCESSFUL;
}
示例3: getMigration
/**
* Function migrate sounds;
*
* @return : (integer) operation result;
*/
function getMigration()
{
if (!$this->oDolModule) {
$this->setResultStatus('System error: object instance is not received');
return MIGRATION_FAILED;
}
// set new status;
$this->setResultStatus('All sounds transfer now');
mysql_query('SET NAMES utf8', $this->rOldDb);
$sQuery = "SELECT * FROM `RayMusicFiles`";
$rResult = mysql_query($sQuery, $this->rOldDb);
while ($aRow = mysql_fetch_assoc($rResult)) {
if (!$this->isSoundsExisting($aRow['ID'])) {
// escape all data;
$aRow = $this->escapeData($aRow);
//transform the file
if (!$this->_exportFile($aRow['ID'])) {
continue;
}
// define file status;
$sFileStatus = $aRow['Approved'] == 'true' ? 'approved' : 'disapproved';
// execute query;
$sQuery = "\r\n \tINSERT INTO\r\n \t\t`RayMp3Files`\r\n \tSET\r\n \t\t`ID` \t\t\t= {$aRow['ID']},\r\n \t\t`Title` \t\t= '{$aRow['Title']}',\r\n \t\t`Uri` \t\t\t= '{$aRow['Uri']}',\r\n \t\t`Tags` \t\t\t= '{$aRow['Tags']}',\r\n \t\t`Description` \t= '{$aRow['Description']}',\r\n \t\t`Time`\t \t\t= '{$aRow['Time']}',\r\n \t\t`Date`\t \t\t= '{$aRow['Date']}',\r\n \t\t`Reports` \t\t= '{$aRow['Reports']}',\r\n \t\t`Owner` \t\t= '{$aRow['Owner']}',\r\n \t\t`Listens` \t\t= '{$aRow['Listens']}',\r\n \t\t`Status` \t\t= '{$sFileStatus}'\r\n\t\r\n ";
$iResult = (int) $this->oMigrationModule->_oDb->query($sQuery);
if ($iResult <= 0) {
$this->setResultStatus('Database error. Cannot insert new sound in the database.');
return MIGRATION_FAILED;
}
$oTag = new BxDolTags();
$oTag->reparseObjTags($this->sType, $aRow['ID']);
// define sound's album;
$sError = $this->_defineSoundsAlbum($aRow['ID'], $aRow['Owner'], $aRow['Title']);
if ($sError) {
$this->setResultStatus($sError);
return MIGRATION_FAILED;
}
$sError = $this->_exportVotings($aRow['ID']);
if ($sError) {
$this->setResultStatus($sError);
return MIGRATION_FAILED;
}
$sError = $this->_exportComments($aRow['ID']);
if ($sError) {
$this->setResultStatus($sError);
return MIGRATION_FAILED;
}
$this->iTransffered++;
} else {
$this->setResultStatus('Duplicate data.
Sounds with similar info already exists
(remove all sounds and start again');
return MIGRATION_FAILED;
}
}
// set as finished;
$this->setResultStatus('All sound were transferred (' . $this->iTransffered . ' items)');
return MIGRATION_SUCCESSFUL;
}
示例4: 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);
}
示例5: 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 ---//
}
}
}
示例6: reparseTags
function reparseTags($iSiteId)
{
bx_import('BxDolTags');
$o = new BxDolTags();
$o->reparseObjTags('bx_sites', $iSiteId);
}
示例7: savePage
//.........这里部分代码省略.........
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);
}
示例8: array
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;
}
示例9: reparseTags
function reparseTags($iEntryId)
{
$iEntryId = (int) $iEntryId;
bx_import('BxDolTags');
$o = new BxDolTags();
$o->reparseObjTags($this->_sPrefix, $iEntryId);
}
示例10: reparseObjTags
function reparseObjTags($sType, $iID)
{
$oTags = new BxDolTags();
$oTags->reparseObjTags($sType, $iID);
}
示例11: deletePoll
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);
// create system event
$oZ = new BxDolAlerts('bx_poll', 'delete_poll', $iId);
$oZ->alert();
return true;
}
示例12: getMigration
/**
* Function migrate shared_photos data;
*
* @return : (integer) operation result;
*/
function getMigration()
{
if (!$this->oDolModule) {
$this->setResultStatus('System error: object instance is not received');
return MIGRATION_FAILED;
}
// set new status;
$this->setResultStatus('Videos transfer now');
mysql_query('SET NAMES utf8', $this->rOldDb);
$sqlQuery = "SELECT `ID`, `Title`, `Uri`, `Tags`, `Description`, `Time`, `Date`, `Owner`, if(`Approved`<>'true', 'disapproved', 'approved') as `Status` FROM `{$this->aOldTables['main']}` ORDER BY `ID` ASC";
$rResult = mysql_query($sqlQuery, $this->rOldDb);
if ($rResult) {
while ($aRow = mysql_fetch_assoc($rResult)) {
if (!$this->isEntryExisting($aRow['Uri'])) {
//transform the file
if (!$this->_exportFile(array('medID' => $aRow['ID']))) {
continue;
}
// escape all data;
foreach ($aRow as $sKey => $mValue) {
$aRow[$sKey] = $this->oMigrationModule->_oDb->escape($mValue);
$sqlBody .= "`{$sKey}` = '{$aRow[$sKey]}', ";
}
$sqlBody = trim($sqlBody, ', ');
$sqlQuery = "\n\t \tINSERT INTO \n\t \t\t`RayVideoFiles`\n\t \tSET\n\t\t\t\t\t\t {$sqlBody}\n\t ";
$sqlBody = '';
$iResult = (int) $this->oMigrationModule->_oDb->query($sqlQuery);
if ($iResult <= 0) {
$this->setResultStatus('Database error. Cannot insert new photo to the database.');
return MIGRATION_FAILED;
}
$oTag = new BxDolTags();
$oTag->reparseObjTags($this->sType, $aRow['ID']);
// define album
$sError = $this->_defineAlbum($aRow['ID'], $aRow['Owner'], $aRow['Title']);
if ($sError) {
$this->setResultStatus($sError);
return MIGRATION_FAILED;
}
$sError = $this->_exportFavorites($aRow['ID']);
if ($sError) {
$this->setResultStatus($sError);
return MIGRATION_FAILED;
}
$sError = $this->_exportVotings($aRow['ID']);
if ($sError) {
$this->setResultStatus($sError);
return MIGRATION_FAILED;
}
$sError = $this->_exportComments($aRow['ID']);
if ($sError) {
$this->setResultStatus($sError);
return MIGRATION_FAILED;
}
$this->iTransffered++;
} else {
$this->setResultStatus('Duplicate data. Feedback with similar info already exists (remove all news and start again)');
return MIGRATION_FAILED;
}
}
}
// set as finished;
$this->setResultStatus('All Videos were transferred (' . $this->iTransffered . ' items)');
return MIGRATION_SUCCESSFUL;
}
示例13: 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();
}
示例14: editPoll
/**
* Function will edit poll's information ;
*
* @param : $iPollId (integer) - poll's Id ;
* @param : $sPollQuestion (string) - poll's qiestion ;
* @param : $sPollAnswers (string) - poll's answers list ;
* @param : $bActive (boolean) - is active or not ;
* @param : $bApprove (boolean) - approve or not ;
* @return : (integer) - number of affected rows ;
*/
function editPoll($iPollId, $sPollQuestion, $sPollAnswers, $sCategory, $bActive = true, $bApprove = false, $sTags = null, $iCommentGroupValue = 3, $iVoteGroupValue = 3, $iViewGroupValue = 3)
{
if (!$sPollQuestion or !$sPollAnswers) {
$this->sActionAnswer = MsgBox(POLL_EMPTY_FIELDS);
} else {
// check poll's owner Id;
$aPoolInfo = $this->_oDb->getPollInfo($iPollId);
if ($this->aPollSettings['admin_mode'] or $this->aPollSettings['member_id'] and $aPoolInfo[0]['id_profile'] == $this->aPollSettings['member_id']) {
$aPoolInfo = array('question' => $sPollQuestion, 'answers' => $sPollAnswers, 'status' => $bActive ? 'active' : null, 'Id' => $iPollId, 'tags' => $sTags, 'allow_comment' => $iCommentGroupValue, 'allow_vote' => $iVoteGroupValue, 'category' => $sCategory, 'allow_view' => $iViewGroupValue);
if ($this->aPollSettings['admin_mode']) {
$aPoolInfo['approve'] = $bApprove ? true : false;
}
$this->_oDb->editPoll($aPoolInfo);
$this->sActionAnswer = MsgBox(POLL_EDITED);
// create system event
$oZ = new BxDolAlerts('bx_poll', 'edit', $iPollId);
$oZ->alert();
// reparse poll's tags;
$oTag = new BxDolTags();
$oTag->reparseObjTags('bx_poll', $iPollId);
$oCateg = new BxDolCategories();
$oCateg->reparseObjTags('bx_poll', $iPollId);
} else {
$this->sActionAnswer = MsgBox(POLL_NOT_ALLOW);
}
}
}
示例15: ActionDeleteAdvertisement
/**
* Deleting Advertisement from `bx_ads_main`
*
* @param $iID ID of deleting Advertisement
* @return Text presentation of result
*/
function ActionDeleteAdvertisement($iID)
{
$iDeleteAdvertisementID = (int) $iID;
$iAdvOwner = $this->_oDb->getOwnerOfAd($iDeleteAdvertisementID);
if (!$this->isAllowedDelete($iAdvOwner)) {
return $this->_oTemplate->displayAccessDenied();
}
if ($iDeleteAdvertisementID > 0) {
$sSuccDel = _t("_bx_ads_Ad_succ_deleted");
$sFailDel = _t("_bx_ads_Ad_fail_delete");
$sRetHtml = '';
$sMediaIDs = $this->_oDb->getMediaOfAd($iDeleteAdvertisementID);
if ($sMediaIDs != '') {
$aChunks = explode(',', $sMediaIDs);
foreach ($aChunks as $sMedId) {
$iMedId = (int) $sMedId;
if ($iMedId) {
$sMediaFileName = $this->_oDb->getMediaFile($iMedId);
if ($sMediaFileName != '') {
@unlink(BX_DIRECTORY_PATH_ROOT . $this->sUploadDir . 'img_' . $sMediaFileName);
@unlink(BX_DIRECTORY_PATH_ROOT . $this->sUploadDir . 'thumb_' . $sMediaFileName);
@unlink(BX_DIRECTORY_PATH_ROOT . $this->sUploadDir . 'big_thumb_' . $sMediaFileName);
@unlink(BX_DIRECTORY_PATH_ROOT . $this->sUploadDir . 'icon_' . $sMediaFileName);
}
$this->_oDb->deleteMedia($iMedId);
}
}
}
if ($this->_oDb->deleteAd($iDeleteAdvertisementID)) {
$this->isAllowedDelete($iAdvOwner, true);
// perform action
$oCmts = new BxDolCmts('ads', $iDeleteAdvertisementID);
$oCmts->onObjectDelete();
//reparse tags
bx_import('BxDolTags');
$oTags = new BxDolTags();
$oTags->reparseObjTags('ad', $iDeleteAdvertisementID);
// delete views
bx_import('BxDolViews');
$oViews = new BxDolViews('ads', $iDeleteAdvertisementID, false);
$oViews->onObjectDelete();
bx_import('BxDolAlerts');
$oZ = new BxDolAlerts('ads', 'delete', $iDeleteAdvertisementID, $iDeleteAdvertisementID);
$oZ->alert();
$sRetHtml .= MsgBox(_t($sSuccDel));
} else {
$sRetHtml .= MsgBox(_t($sFailDel));
}
return $sRetHtml;
} else {
return MsgBox(_t('_Error Occured'));
}
}