Related classes: BxDolVotingQuery - votings database queries BxBaseVotingView - votings base representation BxTemplVotingView - custom template representation AJAX votings for any content. Big and small votings stars are supported To add votings section to your site you need to add a record to 'sys_objects_vote' table: ID - autoincremented id for internal usage ObjectName - your unique module name, with vendor prefix, lowercase and spaces are underscored TableRating - table name where sumarry votigs are stored TableTrack - table name where each vote is stored RowPrefix - row prefix for TableRating MaxVotes - max vote number, 5 by default PostName - post variable name with rating IsDuplicate - number of seconds to not allow duplicate vote (for some bad reason it is define here) IsOn - is this vote object enabled ClassName - custom class name for HotOrNot @see BxDolRate ClassFile - custom class path for HotOrNot TriggerTable - table to be updated upon each vote TriggerFieldRate - TriggerTable table field with average rate TriggerFieldRateCount - TriggerTable table field with votes count TriggerFieldId - TriggerTable table field with unique record id, primary key OverrideClassName - your custom class name, if you overrride default class OverrideClassFile - your custom class path You can refer to BoonEx modules for sample record in this table. Example of usage: After filling in the table you can show big votings in any place, using the following code: bx_import('BxTemplVotingView'); $o = new BxTemplVotingView ('value of ObjectName field', $iYourEntryId); if (!$o->isEnabled()) return ''; echo $o->getBigVoting (1); // 1 - rate is allowed And small votings, using the following code: $o = new BxTemplVotingView ('value of ObjectName field', $iYourEntryId); if (!$o->isEnabled()) return ''; echo $o->getSmallVoting (0); // 0 - rate is not allowed, like readony votings In some cases votes are already in database and there is no need to execute additional query to get ratings, so you can use the following code: $o = new BxTemplVotingView ('value of ObjectName field', 0); foreach ($aRecords as $aData) echo $o->getJustVotingElement(0, $aData['ID'], $aData['voting_rate']); Please note that you never need to use BxDolVoting class directly, use BxTemplVotingView instead. Also if you override votings class with your own then make it child of BxTemplVotingView class. Memberships/ACL: vote - ACTION_ID_VOTE Alerts: Alerts type/unit - every module has own type/unit, it equals to ObjectName The following alerts are rised rate - comment was posted $iObjectId - entry id $iSenderId - rater user id $aExtra['rate'] - rate
Пример #1
0
 function getVotedItems()
 {
     $ip = getVisitorIP();
     $oDolVoting = new BxDolVoting($this->sType, 0, 0);
     $aVotedItems = $oDolVoting->getVotedItems($ip);
     return $this->reviewArray($aVotedItems, $oDolVoting->_aSystem['row_prefix'] . 'id');
 }
 function deleteMedia($iProfileID, $iMediaID, $sMediaType)
 {
     $sQuery = "\r\n\t\t\tDELETE FROM " . BX_DOL_TABLE_MEDIA . " WHERE\r\n\t\t\t\t`med_id` = '{$iMediaID}'\r\n\t\t\tAND\t`med_type` = '{$sMediaType}'\r\n\t\t\tAND `med_prof_id` = '{$iProfileID}'\r\n\t\t\tLIMIT 1\r\n\t\t";
     $this->query($sQuery);
     // delete voting
     require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolVoting.php';
     $oVotingMedia = new BxDolVoting('media', 0, 0);
     $oVotingMedia->deleteVotings($iMediaID);
 }
Пример #3
0
 function _deleteFile($iFileId)
 {
     $aInfo = $this->serviceCheckDelete($iFileId);
     if (!$aInfo) {
         return false;
     }
     if ($this->_oDb->deleteData($iFileId)) {
         $aFilesPostfix = $this->_oConfig->aFilePostfix;
         //delete temp files
         $aFilesPostfix['temp'] = '';
         if (isset($aFilesPostfix['original'])) {
             $aFilesPostfix['original'] = $this->_getOriginalExt($aInfo, $aFilesPostfix['original']);
         }
         foreach ($aFilesPostfix as $sValue) {
             $sFilePath = $this->_oConfig->getFilesPath() . $iFileId . $sValue;
             @unlink($sFilePath);
         }
         bx_import('BxDolVoting');
         $oVoting = new BxDolVoting($this->_oConfig->getMainPrefix(), 0, 0);
         $oVoting->deleteVotings($iFileId);
         bx_import('BxDolCmts');
         $oCmts = new BxDolCmts($this->_oConfig->getMainPrefix(), $iFileId);
         $oCmts->onObjectDelete();
         bx_import('BxDolCategories');
         //tags & categories parsing
         $oTag = new BxDolTags();
         $oTag->reparseObjTags($this->_oConfig->getMainPrefix(), $iFileId);
         $oCateg = new BxDolCategories();
         $oCateg->reparseObjTags($this->_oConfig->getMainPrefix(), $iFileId);
         $bUpdateCounter = $aInfo['Approved'] == 'approved' ? true : false;
         $this->oAlbums->removeObjectTotal($iFileId, $bUpdateCounter);
         //delete all subscriptions
         $oSubscription = BxDolSubscription::getInstance();
         $oSubscription->unsubscribe(array('type' => 'object_id', 'unit' => $this->_oConfig->getMainPrefix(), 'object_id' => $iFileId));
         bx_import('BxDolAlerts');
         $oAlert = new BxDolAlerts($this->_oConfig->getMainPrefix(), 'delete', $iFileId, $this->_iProfileId, $aInfo);
         $oAlert->alert();
         $this->isAllowedDelete($aInfo, true);
     } else {
         return false;
     }
     return true;
 }
Пример #4
0
 function onSiteDeleted($iSiteId)
 {
     // delete associated tags and categories
     $this->reparseTags($iSiteId);
     $this->reparseCategories($iSiteId);
     // delete sites votings
     bx_import('BxDolVoting');
     $oVotingProfile = new BxDolVoting('bx_sites', 0, 0);
     $oVotingProfile->deleteVotings($iSiteId);
     // delete sites comments
     bx_import('BxDolCmts');
     $oCmts = new BxDolCmts('bx_sites', $iSiteId);
     $oCmts->onObjectDelete();
     // delete views
     bx_import('BxDolViews');
     $oViews = new BxDolViews('bx_sites', $iSiteId, false);
     $oViews->onObjectDelete($iSiteId);
     //delete all subscriptions
     $oSubscription = BxDolSubscription::getInstance();
     $oSubscription->unsubscribe(array('type' => 'object_id', 'unit' => 'bx_sites', 'object_id' => $iSiteId));
     // arise alert
     bx_import('BxDolAlerts');
     $oAlert = new BxDolAlerts('bx_sites', 'delete', $iSiteId, $this->iOwnerId);
     $oAlert->alert();
 }
Пример #5
0
function getVotedItems()
{
    $ip = getVisitorIP();
    $oDolVoting = new BxDolVoting('media', 0, 0);
    $_aVotedItems = $oDolVoting->getVotedItems($ip);
    $aVotedItems = reviewArray($_aVotedItems);
    return $aVotedItems;
}
Пример #6
0
function profile_delete($ID, $isDeleteSpammer = false)
{
    //global $MySQL;
    global $dir;
    //recompile global profiles cache
    $GLOBALS['MySQL']->cleanCache('sys_browse_people');
    $ID = (int) $ID;
    if (!$ID) {
        return false;
    }
    if (!($aProfileInfo = getProfileInfo($ID))) {
        return false;
    }
    $iLoggedInId = getLoggedId();
    db_res("DELETE FROM `sys_admin_ban_list` WHERE `ProfID`='" . $ID . "' LIMIT 1");
    db_res("DELETE FROM `sys_greetings` WHERE `ID` = '{$ID}' OR `Profile` = '{$ID}'");
    db_res("DELETE FROM `sys_block_list` WHERE `ID` = '{$ID}' OR `Profile` = '{$ID}'");
    db_res("DELETE FROM `sys_messages` WHERE Recipient = {$ID} OR `Sender` = {$ID}");
    db_res("DELETE FROM `sys_fave_list` WHERE ID = {$ID} OR Profile = {$ID}");
    db_res("DELETE FROM `sys_friend_list` WHERE ID = {$ID} OR Profile = {$ID}");
    db_res("DELETE FROM `sys_acl_levels_members` WHERE `IDMember` = {$ID}");
    db_res("DELETE FROM `sys_tags` WHERE `ObjID` = {$ID} AND `Type` = 'profile'");
    db_res("DELETE FROM `sys_sbs_entries` WHERE `subscriber_id` = {$ID} AND `subscriber_type` = '1'");
    // delete profile votings
    require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolVoting.php';
    $oVotingProfile = new BxDolVoting('profile', 0, 0);
    $oVotingProfile->deleteVotings($ID);
    // delete profile comments
    require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolCmts.php';
    $oCmts = new BxDolCmts('profile', $ID);
    $oCmts->onObjectDelete();
    // delete all comments in all comments' systems, this user posted
    $oCmts->onAuthorDelete($ID);
    $iPossibleCoupleID = (int) db_value("SELECT `ID` FROM `Profiles` WHERE `Couple` = '{$ID}'");
    if ($iPossibleCoupleID) {
        db_res("DELETE FROM `Profiles` WHERE `ID` = '{$iPossibleCoupleID}'");
        //delete cache file
        deleteUserDataFile($iPossibleCoupleID);
    }
    // delete associated locations
    if (BxDolModule::getInstance('BxWmapModule')) {
        BxDolService::call('wmap', 'response_entry_delete', array('profiles', $ID));
    }
    //delete all subscriptions
    $oSubscription = BxDolSubscription::getInstance();
    $oSubscription->unsubscribe(array('type' => 'object_id', 'unit' => 'profile', 'object_id' => $ID));
    db_res("DELETE FROM `Profiles` WHERE `ID` = '{$ID}'");
    if ($isDeleteSpammer) {
        bx_import('BxDolStopForumSpam');
        $oBxDolStopForumSpam = new BxDolStopForumSpam();
        $oBxDolStopForumSpam->submitSpammer(array('username' => $aProfileInfo['NickName'], 'email' => $aProfileInfo['Email'], 'ip' => bx_member_ip_get_last($ID)));
    }
    // delete moxiemanager files
    $sMoxieFilesPath = BX_DIRECTORY_PATH_ROOT . 'media/moxie/files/' . substr($aProfileInfo['NickName'], 0, 1) . '/' . substr($aProfileInfo['NickName'], 0, 2) . '/' . substr($aProfileInfo['NickName'], 0, 3) . '/' . $aProfileInfo['NickName'];
    bx_rrmdir($sMoxieFilesPath);
    // create system event
    $oZ = new BxDolAlerts('profile', 'delete', $ID, 0, array('profile_info' => $aProfileInfo, 'logged_in' => $iLoggedInId, 'delete_spammer' => $isDeleteSpammer));
    $oZ->alert();
    //delete cache file
    deleteUserDataFile($ID);
}
Пример #7
0
<?php

/**
 * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
 * CC-BY License - http://creativecommons.org/licenses/by/3.0/
 */
require_once 'inc/header.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'design.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'profiles.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'utils.inc.php';
check_logged();
$sSys = bx_get('sys');
$iId = (int) bx_get('id');
bx_import('BxDolVoting');
if ($sSys && $iId && ($oVoting = BxDolVoting::getObjectInstance($sSys, $iId))) {
    header('Content-Type: text/html; charset=utf-8');
    echo $oVoting->actionVote();
}
Пример #8
0
 function __construct($sSystem, $iId, $iInit = 1)
 {
     parent::__construct($sSystem, $iId, $iInit);
 }
Пример #9
0
<?php

/**
 * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
 * CC-BY License - http://creativecommons.org/licenses/by/3.0/
 */
require_once 'inc/header.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'design.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'profiles.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'utils.inc.php';
check_logged();
bx_import("BxDolVoting");
$aSystems =& BxDolVoting::getSystems();
$sSys = isset($_GET['sys']) ? $_GET['sys'] : false;
if ($sSys && isset($aSystems[$sSys])) {
    if ($aSystems[$sSys]['override_class_name']) {
        require_once BX_DIRECTORY_PATH_ROOT . $aSystems[$sSys]['override_class_file'];
        $sClassName = $aSystems[$sSys]['override_class_name'];
        new $sClassName($_GET['sys'], (int) $_GET['id']);
    } else {
        new BxDolVoting($_GET['sys'], (int) $_GET['id']);
    }
}
function deleteMedia($iFile, $sType, $sExt = '')
{
    global $dir;
    global $logged;
    $sType = $sType == 'Video' ? 'Movie' : $sType;
    // delete voting
    require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolVoting.php';
    if ($logged['admin']) {
    } elseif ($logged['member']) {
        $iMemberID = (int) $_COOKIE['memberID'];
        if ($sType == 'Photo') {
            $sTableName = "`share{$sType}Files`";
            $sQuery = "SELECT * FROM {$sTableName} WHERE `medID`='{$iFile}'";
        } else {
            $sTableName = "`Ray{$sType}Files`";
            $sQuery = "SELECT `ID` as `medID`,\r\n\t  \t\t\t\t\t  `Title` as `medTitle`,\r\n\t  \t\t\t\t\t  `Description` as `medDesc`,\r\n\t  \t\t\t\t\t  `Date` as `medDate`,\r\n\t  \t\t\t\t\t  `Owner` as `medProfId`\r\n\t  \t\t\t   FROM {$sTableName} \r\n\t  \t\t\t   WHERE `ID`='{$iFile}'";
        }
        $aFile = db_arr($sQuery);
        if (!$aFile) {
            return false;
        }
        if ($aFile['medProfId'] != $iMemberID) {
            return false;
        }
    } else {
        return false;
    }
    $aFName = array();
    switch ($sType) {
        case 'Music':
            $sTableName = "`Ray{$sType}Files`";
            $sModPath = 'ray/modules/music/files/';
            $aFName[] = $iFile . '.mp3';
            $oVoting = new BxDolVoting('gmusic', 0, 0);
            $sTagsType = 'music';
            break;
        case 'Photo':
            $sTableName = "`share{$sType}Files`";
            $sModPath = 'media/images/sharingImages/';
            $aFName[] = $iFile . '.' . $sExt;
            $aFName[] = $iFile . '_t.' . $sExt;
            $aFName[] = $iFile . '_m.' . $sExt;
            $oVoting = new BxDolVoting('gphoto', 0, 0);
            $sTagsType = 'photo';
            break;
        case 'Movie':
            $sTableName = "`Ray{$sType}Files`";
            $sModPath = 'ray/modules/movie/files/';
            $aFName[] = $iFile . '.jpg';
            $aFName[] = $iFile . '_small.jpg';
            $aFName[] = $iFile . '.flv';
            $aFName[] = $iFile . '.mpg';
            $oVoting = new BxDolVoting('gvideo', 0, 0);
            $sTagsType = 'video';
            break;
    }
    foreach ($aFName as $iK => $sVal) {
        $sFilePath = BX_DIRECTORY_PATH_ROOT . $sModPath . $sVal;
        @unlink($sFilePath);
    }
    $sCond = $sType == 'Photo' ? " `medID`='{$iFile}'" : "`ID`='{$iFile}'";
    db_res("DELETE FROM {$sTableName} WHERE {$sCond}");
    reparseObjTags($sTagsType, $iFile);
    $oVoting->deleteVotings($iFile);
    header('Location:' . $_SERVER["HTTP_REFERER"]);
}
Пример #11
0
*     copyright            : (C) 2006 BoonEx Group
*     website              : http://www.boonex.com/
* This file is part of Dolphin - Smart Community Builder
*
* Dolphin is free software. This work is licensed under a Creative Commons Attribution 3.0 License. 
* http://creativecommons.org/licenses/by/3.0/
*
* Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the Creative Commons Attribution 3.0 License for more details. 
* You should have received a copy of the Creative Commons Attribution 3.0 License along with Dolphin, 
* see license.txt file; if not, write to marketing@boonex.com
***************************************************************************/
require_once 'inc/header.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'design.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'profiles.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'members.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'profile_disp.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'utils.inc.php';
require_once BX_DIRECTORY_PATH_CLASSES . "BxDolVoting.php";
if (!($logged['admin'] = member_auth(1, false))) {
    if (!($logged['member'] = member_auth(0, false))) {
        if (!($logged['aff'] = member_auth(2, false))) {
            $logged['moderator'] = member_auth(3, false);
        }
    }
}
$oVoting = new BxDolVoting('', 0, 0);
if ($oVoting->isValidSystem($_GET['sys'])) {
    new BxDolVoting($_GET['sys'], (int) $_GET['id']);
}
function deleteItem($iMedia)
{
    global $dir;
    $aFile = db_arr("SELECT * FROM `media` WHERE `med_id`='{$iMedia}'");
    $sIconFile = $dir['profileImage'] . $aFile['med_prof_id'] . '/icon_' . $aFile['med_file'];
    $sThumbFile = $dir['profileImage'] . $aFile['med_prof_id'] . '/thumb_' . $aFile['med_file'];
    $sPhotoFile = $dir['profileImage'] . $aFile['med_prof_id'] . '/photo_' . $aFile['med_file'];
    $sqlQuery = "\r\n\tDELETE FROM `media` WHERE `med_id` = '{$iMedia}';\r\n\t";
    $res = db_res($sqlQuery);
    // delete votings
    require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolVoting.php';
    $oVotingMedia = new BxDolVoting('media', 0, 0);
    $oVotingMedia->deleteVotings($aMedia['med_id']);
    @unlink($sIconFile);
    @unlink($sThumbFile);
    @unlink($sPhotoFile);
    return $res;
}
Пример #13
0
 function onSiteDeleted($iSiteId)
 {
     // delete associated tags and categories
     $this->reparseTags($iSiteId);
     $this->reparseCategories($iSiteId);
     // delete sites votings
     bx_import('BxDolVoting');
     $oVotingProfile = new BxDolVoting('bx_sites', 0, 0);
     $oVotingProfile->deleteVotings($iSiteId);
     // delete sites comments
     bx_import('BxDolCmts');
     $oCmts = new BxDolCmts('bx_sites', $iSiteId);
     $oCmts->onObjectDelete();
     // delete views
     bx_import('BxDolViews');
     $oViews = new BxDolViews('bx_sites', $iSiteId, false);
     $oViews->onObjectDelete($iSiteId);
     // arise alert
     bx_import('BxDolAlerts');
     $oAlert = new BxDolAlerts('bx_sites', 'delete', $iSiteId, $this->iOwnerId);
     $oAlert->alert();
 }
Пример #14
0
function profile_delete($ID)
{
    //global $MySQL;
    global $dir;
    //recompile global profiles cache
    $GLOBALS['MySQL']->cleanCache('sys_browse_people');
    $ID = (int) $ID;
    if (!$ID) {
        return false;
    }
    if (!($aProfileInfo = getProfileInfo($ID))) {
        return false;
    }
    $iLoggedInId = getLoggedId();
    db_res("DELETE FROM `sys_admin_ban_list` WHERE `ProfID`='" . $ID . "' LIMIT 1");
    db_res("DELETE FROM `sys_greetings` WHERE `ID` = '{$ID}' OR `Profile` = '{$ID}'");
    db_res("DELETE FROM `sys_block_list` WHERE `ID` = '{$ID}' OR `Profile` = '{$ID}'");
    db_res("DELETE FROM `sys_messages` WHERE Recipient = {$ID} OR `Sender` = {$ID}");
    db_res("DELETE FROM `sys_fave_list` WHERE ID = {$ID} OR Profile = {$ID}");
    db_res("DELETE FROM `sys_friend_list` WHERE ID = {$ID} OR Profile = {$ID}");
    db_res("DELETE FROM `sys_acl_levels_members` WHERE `IDMember` = {$ID}");
    db_res("DELETE FROM `sys_tags` WHERE `ObjID` = {$ID} AND `Type` = 'profile'");
    db_res("DELETE FROM `sys_sbs_entries` WHERE `subscriber_id` = {$ID} AND `subscriber_type` = '1'");
    // delete profile votings
    require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolVoting.php';
    $oVotingProfile = new BxDolVoting('profile', 0, 0);
    $oVotingProfile->deleteVotings($ID);
    // delete profile comments
    require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolCmts.php';
    $oCmts = new BxDolCmts('profile', $ID);
    $oCmts->onObjectDelete();
    // delete all comments in all comments' systems, this user posted
    $oCmts->onAuthorDelete($ID);
    $iPossibleCoupleID = (int) db_value("SELECT `ID` FROM `Profiles` WHERE `Couple` = '{$ID}'");
    if ($iPossibleCoupleID) {
        db_res("DELETE FROM `Profiles` WHERE `ID` = '{$iPossibleCoupleID}'");
        //delete cache file
        deleteUserDataFile($iPossibleCoupleID);
    }
    // delete associated locations
    if (BxDolModule::getInstance('BxWmapModule')) {
        BxDolService::call('wmap', 'response_entry_delete', array('profiles', $ID));
    }
    db_res("DELETE FROM `Profiles` WHERE `ID` = '{$ID}'");
    // create system event
    $oZ = new BxDolAlerts('profile', 'delete', $ID, 0, array('profile_info' => $aProfileInfo, 'logged_in' => $iLoggedInId));
    $oZ->alert();
    //delete cache file
    deleteUserDataFile($ID);
}
 function deleteMedia($iFile, $logged = array())
 {
     $iFile = (int) $iFile;
     $sqlQuery = "SELECT `{$this->aTableFields['medProfId']}`";
     $sqlQuery .= isset($this->aTableFields['medExt']) ? ", `{$this->aTableFields['medExt']}`" : "";
     $sqlQuery .= "FROM `{$this->sMainTable}` WHERE `{$this->aTableFields['medID']}`={$iFile}";
     $aFile = db_arr($sqlQuery);
     if (!$aFile) {
         return false;
     }
     if ($logged['admin']) {
     } elseif ($logged['member']) {
         $iMemberID = (int) $_COOKIE['memberID'];
         if ($aFile[$this->aTableFields['medProfId']] != $iMemberID) {
             return false;
         }
     } else {
         return false;
     }
     switch ($this->sType) {
         case 'photo':
             $aFName[] = $iFile . '.' . $aFile['medExt'];
             $aFName[] = $iFile . '_t.' . $aFile['medExt'];
             $aFName[] = $iFile . '_m.' . $aFile['medExt'];
             $sCmtsName = 'sharedPhoto';
             break;
         case 'music':
             $aFName[] = $iFile . '.mp3';
             $sCmtsName = 'sharedMusic';
             break;
         case 'video':
             $aFName[] = $iFile . '.flv';
             $aFName[] = $iFile . '.mpg';
             $aFName[] = $iFile . '.jpg';
             $aFName[] = $iFile . '_small.jpg';
             $sCmtsName = 'sharedVideo';
             break;
     }
     foreach ($aFName as $sVal) {
         $sFilePath = $this->sFilesPath . $sVal;
         @unlink($sFilePath);
     }
     db_res("DELETE FROM `{$this->sMainTable}` WHERE `{$this->aTableFields['medID']}`={$iFile}");
     reparseObjTags($this->sType, $iFile);
     $oVoting = new BxDolVoting('g' . $this->sType, 0, 0);
     $oVoting->deleteVotings($iFile);
     $oCmts = new BxDolCmts($sCmtsName, $iFile);
     $oCmts->onObjectDelete();
     header('Location:' . $_SERVER["HTTP_REFERER"]);
 }
 function BxBaseVotingView($sSystem, $iId, $iInit = 1)
 {
     BxDolVoting::BxDolVoting($sSystem, $iId, $iInit);
 }
function profile_delete($ID)
{
    global $MySQL;
    global $dir;
    global $site;
    global $logged;
    $ID = (int) $ID;
    if (!$ID) {
        return false;
    }
    if (!getProfileInfo($ID)) {
        return false;
    }
    modules_del($ID);
    db_res("DELETE FROM `VKisses` WHERE `ID` = '{$ID}' OR `Member` = '{$ID}'");
    db_res("DELETE FROM `Profiles` WHERE `ID` = '{$ID}'");
    if (!mysql_affected_rows()) {
        return false;
    }
    db_res("DELETE FROM `BlockList` WHERE `ID` = '{$ID}' OR `Profile` = '{$ID}';");
    db_res("DELETE FROM `ProfilesTrack` WHERE `Member` = '{$ID}' OR `Profile` = '{$ID}'");
    db_res("DELETE FROM `Messages` WHERE Recipient = {$ID} ");
    db_res("DELETE FROM `Guestbook` WHERE Recipient = {$ID} ");
    db_res("DELETE FROM `aff_members` WHERE idProfile = {$ID}");
    db_res("DELETE FROM `HotList` WHERE ID = {$ID} OR Profile = {$ID}");
    db_res("DELETE FROM `FriendList` WHERE ID = {$ID} OR Profile = {$ID}");
    db_res("DELETE FROM `BlockList` WHERE ID = {$ID} OR Profile = {$ID}");
    db_res("DELETE FROM `BoughtContacts` WHERE `IDBuyer` = {$ID} OR `IDContact` = {$ID}");
    db_res("DELETE FROM `ProfileMemLevels` WHERE `IDMember` = {$ID}");
    db_res("DELETE FROM `ProfilesComments` WHERE `Sender` = {$ID} OR `Recipient` = {$ID}");
    db_res("DELETE FROM `ProfilesPolls` WHERE `id_profile` = {$ID}");
    db_res("DELETE FROM `Tags` WHERE `ID` = {$ID} AND `Type` = 'profile'");
    db_res("DELETE FROM `GroupsMembers` WHERE `memberID` = {$ID}");
    // delete profile votings
    require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolVoting.php';
    $oVotingProfile = new BxDolVoting('profile', 0, 0);
    $oVotingProfile->deleteVotings($ID);
    // delete profile comments
    require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolCmts.php';
    $oCmts = new BxDolCmts('profile', $ID);
    $oCmts->onObjectDelete();
    // delete all comments in all comments' systems, this user posted
    $oCmts->onAuthorDelete($ID);
    // Clean gallery
    $albumsRes = db_res("SELECT `ID` FROM `GalleryAlbums` WHERE `IDMember` = {$ID}");
    while ($albumArr = mysql_fetch_assoc($albumsRes)) {
        $albumID = $albumArr['ID'];
        $objectsRes = db_res("SELECT `Filename`, `ThumbFilename` FROM `GalleryObjects` WHERE `IDAlbum` = {$albumID}");
        while ($objectArr = mysql_fetch_assoc($objectsRes)) {
            @unlink("{$dir['gallery']}{$objectArr['Filename']}");
            if (strlen($objectArr['ThumbFilename']) && file_exists("{$dir['gallery']}{$objectArr['ThumbFilename']}")) {
                @unlink("{$dir['gallery']}{$objectArr['ThumbFilename']}");
            }
        }
        db_res("DELETE FROM `GalleryObjects` WHERE `IDAlbum` = {$albumID}");
    }
    db_res("DELETE FROM `GalleryAlbums` WHERE `IDMember` = {$ID}");
    // Clean customizations
    $customArr = db_arr("SELECT `BackgroundFilename` FROM `ProfilesSettings` WHERE `IDMember` = {$ID}");
    if (strlen($customArr['BackgroundFilename']) && file_exists($dir['profileImage'] . $customArr['BackgroundFilename']) && is_file($dir['profileImage'] . $customArr['BackgroundFilename'])) {
        unlink($dir['profileImage'] . $customArr['BackgroundFilename']);
    }
    db_res("DELETE FROM `ProfilesSettings` WHERE `IDMember` = {$ID}");
    // delete media
    $rMedia = db_res("SELECT `med_id`, `med_file`, `med_type` FROM `media` WHERE `med_prof_id` = {$ID}");
    $oVotingMedia = new BxDolVoting('media', 0, 0);
    while ($aMedia = mysql_fetch_assoc($rMedia)) {
        switch ($aMedia['med_type']) {
            case 'photo':
                $medDir = $dir['profileImage'] . $ID . "/";
                @unlink($medDir . 'icon_' . $aMedia['med_file']);
                @unlink($medDir . 'photo_' . $aMedia['med_file']);
                @unlink($medDir . 'thumb_' . $aMedia['med_file']);
                break;
            case 'audio':
                $medDir = $dir['profileSound'] . $ID . "/";
                @unlink($medDir . $aMedia['med_file']);
                break;
            case 'video':
                $medDir = $dir['profileVideo'] . $ID . "/";
                @unlink($medDir . $aMedia['med_file']);
                break;
        }
        // delete media voting
        $oVotingMedia->deleteVotings($aMedia['med_id']);
    }
    $aMem = array();
    $aMedia = array('photo', 'music', 'video');
    foreach ($aMedia as $sVal) {
        $oMedia = new BxDolSharedMedia($sVal, $site, $dir, $aMem);
        $oMedia->deleteUserGallery($ID, $logged);
    }
    db_res("DELETE FROM `media` WHERE `med_prof_id` = {$ID}");
    @rmdir($dir['profileImage'] . $ID);
    @rmdir($dir['profileVideo'] . $ID);
    @rmdir($dir['profileSound'] . $ID);
    //Clean blogs
    $aBlog = db_arr("SELECT `ID` FROM `Blogs` WHERE `OwnerID` = {$ID}");
    $iBlogID = $aBlog['ID'];
    if ($iBlogID > 0) {
        //Clean blogs
        $oBlogs = new BxDolBlogs(TRUE);
        $oBlogs->bAdminMode = TRUE;
        (int) ($_REQUEST['DeleteBlogID'] = $iBlogID);
        $oBlogs->ActionDeleteBlogSQL();
    }
    //delete user classifieds
    $oClassifieds = new BxDolClassifieds();
    $oClassifieds->bAdminMode = TRUE;
    $oClassifieds->DeleteProfileAdvertisement($ID);
    //delete user events
    $oEvents = new BxDolEvents();
    $oEvents->bAdminMode = TRUE;
    $oEvents->DeleteProfileEvents($ID);
    //delete cache file
    $sCacheFile = $dir['cache'] . 'user' . $ID . '.php';
    @unlink($sCacheFile);
    reparseObjTags('profile', $ID);
}
Пример #18
0
 function clean_database()
 {
     $db_clean_vkiss = (int) getParam("db_clean_vkiss");
     $db_clean_profiles = (int) getParam("db_clean_profiles");
     $db_clean_msg = (int) getParam("db_clean_msg");
     $db_clean_visits = (int) getParam("db_clean_members_visits");
     $db_clean_banners_info = (int) getParam("db_clean_banners_info");
     //clear from `sys_banners_shows`
     if (db_res("DELETE FROM `sys_banners_shows` WHERE `Date` < UNIX_TIMESTAMP( NOW() - INTERVAL {$db_clean_banners_info} DAY )")) {
         db_res("OPTIMIZE TABLE `sys_banners_shows`");
     }
     //clear from `sys_banners_clicks`
     if (db_res("DELETE FROM `sys_banners_clicks` WHERE `Date` < UNIX_TIMESTAMP( NOW() - INTERVAL {$db_clean_banners_info} DAY )")) {
         db_res("OPTIMIZE TABLE `sys_banners_clicks`");
     }
     // clear from `sys_messages`
     if (db_res("DELETE FROM `sys_messages` WHERE FIND_IN_SET('sender', `Trash`) AND FIND_IN_SET('recipient', `Trash`)")) {
         db_res("OPTIMIZE TABLE `sys_messages`");
     }
     //clear from `sys_ip_members_visits`
     if (db_res("DELETE FROM `sys_ip_members_visits` WHERE `DateTime` < NOW() - INTERVAL {$db_clean_visits} DAY")) {
         db_res("OPTIMIZE TABLE `sys_ip_members_visits`");
     }
     // clear ban table
     if (db_res("DELETE FROM `sys_admin_ban_list` WHERE `DateTime` + INTERVAL `Time` SECOND < NOW()")) {
         db_res("OPTIMIZE TABLE `sys_admin_ban_list`");
     }
     // profile_delete
     if ($db_clean_profiles > 0) {
         $res = db_res("SELECT `ID` FROM `Profiles` WHERE (`DateLastNav` < NOW() - INTERVAL {$db_clean_profiles} DAY) AND (`Couple` > `ID` OR `Couple` = 0)");
         if ($res) {
             $db_clean_profiles_num = mysql_num_rows($res);
             while ($arr = mysql_fetch_array($res)) {
                 profile_delete($arr['ID']);
             }
             db_res("OPTIMIZE TABLE `Profiles`");
         }
     }
     if ($db_clean_vkiss > 0) {
         $res = db_res("DELETE FROM `sys_greetings` WHERE `When` < NOW() - INTERVAL {$db_clean_vkiss} DAY");
         if ($res) {
             $db_clean_vkiss_num = db_affected_rows();
             db_res("OPTIMIZE TABLE `sys_greetings`");
         }
     }
     if ($db_clean_msg > 0) {
         $res = db_res("DELETE FROM `sys_messages` WHERE `Date` < NOW() - INTERVAL {$db_clean_msg} DAY");
         if ($res) {
             $db_clean_msg_num = db_affected_rows();
             db_res("OPTIMIZE TABLE `sys_messages`");
         }
     }
     //--- Clean sessions ---//
     bx_import('BxDolSession');
     $oSession = BxDolSession::getInstance();
     $iSessions = $oSession->oDb->deleteExpired();
     // clean expired ip bans
     bx_import('BxDolAdminIpBlockList');
     $oBxDolAdminIpBlockList = new BxDolAdminIpBlockList();
     $iIps = $oBxDolAdminIpBlockList->deleteExpired();
     // clean old views
     bx_import('BxDolViews');
     $oBxViews = new BxDolViews('', 0);
     $iDeletedViews = $oBxViews->maintenance();
     // clean old votes
     bx_import('BxDolVoting');
     $oBxVotes = new BxDolVoting('', 0);
     $iDeletedVotes = $oBxVotes->maintenance();
     echo "\n- Database cleaning -\n";
     echo "Deleted profiles: {$db_clean_profiles_num}\n";
     echo "Deleted virtual kisses: {$db_clean_vkiss_num}\n";
     echo "Deleted messages: {$db_clean_msg_num}\n";
     echo "Deleted sessions: {$iSessions}\n";
     echo "Deleted records from ip block list: {$iIps}\n";
     echo "Deleted views: {$iDeletedViews}\n";
     echo "Deleted votes: {$iDeletedVotes}\n";
 }
Пример #19
0
function profile_delete($ID)
{
    //global $MySQL;
    global $dir;
    //recompile global profiles cache
    $GLOBALS['MySQL']->cleanCache('sys_browse_people');
    $ID = (int) $ID;
    if (!$ID) {
        return false;
    }
    if (!getProfileInfo($ID)) {
        return false;
    }
    db_res("DELETE FROM `sys_admin_ban_list` WHERE `ProfID`='" . $ID . "' LIMIT 1");
    db_res("DELETE FROM `sys_greetings` WHERE `ID` = '{$ID}' OR `Profile` = '{$ID}'");
    db_res("DELETE FROM `sys_block_list` WHERE `ID` = '{$ID}' OR `Profile` = '{$ID}'");
    db_res("DELETE FROM `sys_messages` WHERE Recipient = {$ID} ");
    db_res("DELETE FROM `sys_fave_list` WHERE ID = {$ID} OR Profile = {$ID}");
    db_res("DELETE FROM `sys_friend_list` WHERE ID = {$ID} OR Profile = {$ID}");
    db_res("DELETE FROM `sys_acl_levels_members` WHERE `IDMember` = {$ID}");
    db_res("DELETE FROM `sys_tags` WHERE `ObjID` = {$ID} AND `Type` = 'profile'");
    // delete profile votings
    require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolVoting.php';
    $oVotingProfile = new BxDolVoting('profile', 0, 0);
    $oVotingProfile->deleteVotings($ID);
    // delete profile comments
    require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolCmts.php';
    $oCmts = new BxDolCmts('profile', $ID);
    $oCmts->onObjectDelete();
    // delete all comments in all comments' systems, this user posted
    $oCmts->onAuthorDelete($ID);
    $iPossibleCoupleID = (int) db_value("SELECT `ID` FROM `Profiles` WHERE `Couple` = '{$ID}'");
    if ($iPossibleCoupleID) {
        db_res("DELETE FROM `Profiles` WHERE `ID` = '{$iPossibleCoupleID}'");
        //delete cache file
        deleteUserDataFile($iPossibleCoupleID);
    }
    db_res("DELETE FROM `Profiles` WHERE `ID` = '{$ID}'");
    // create system event
    require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolAlerts.php';
    $oZ = new BxDolAlerts('profile', 'delete', $ID);
    $oZ->alert();
    //delete cache file
    deleteUserDataFile($ID);
}