| Server IP : 216.92.14.13 / Your IP : 216.73.216.171 Web Server : Apache System : Linux vps4089.pairvps.com 5.15.0-190-generic #200-Ubuntu SMP Fri Aug 7 15:06:04 UTC 2026 x86_64 User : rmlac2fmr ( 1040637) PHP Version : 8.2.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/home/rmlac2fmr/public_html/fm/dolphin/admin/ |
Upload File : |
<?
/***************************************************************************
* Dolphin Smart Community Builder
* -----------------
* begin : Mon Mar 23 2006
* 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 . 'admin_design.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'utils.inc.php' );
$logged['admin'] = member_auth( 1 );
$_page['css_name'] = 'post_moderation.css';
$navigationStep = 12; // count of objects to show per page
$_page['header'] = "Profile Photos PreModeration";
$_page['header_text'] = "";
if (isset($_GET['media']))
{
$sType = htmlspecialchars_adv($_GET['media']);
}
if (isset($_GET['status']))
{
$sStatus = htmlspecialchars_adv($_GET['status']);
}
if (isset($_GET['iUser']))
{
$iUser = htmlspecialchars_adv($_GET['iUser']);
}
if (isset($_POST['check']) && is_array($_POST['check']))
{
foreach($_POST['check'] as $iKey => $iVal)
{
switch (true)
{
case isset($_POST['Delete']):
deleteItem((int)$iVal);
break;
case isset($_POST['Approve']):
approveItem((int)$iVal);
break;
}
}
}
TopCodeAdmin();
ContentBlockHead("");
echo getPostModMediaPage($sType,$sStatus,$iUser);
ContentBlockFoot();
BottomCode();
function getPostModMediaPage($sType = 'photo', $sStatus = 'passive', $iUser = 0)
{
global $dir;
global $site, $max_thumb_width, $max_thumb_height, $max_photo_width, $max_photo_height;
$ret = '';
$aFiles = getUnapprovedFilesArray($sType, $sStatus, $iUser);
if( !empty( $aFiles ) )
{
$ret .= '<div style="clear:both;"></div>';
$ret .= "<script>
function checkAll( _pref, do_check )
{
aElems = document.getElementsByTagName( 'input' );
for( i = 0; i < aElems.length; i ++ )
{
elt = aElems[i];
if( elt.name.substr( 0, _pref.length ) == _pref )
elt.checked = do_check;
}
}
</script>"
;
$ret .= '<div><form method="post" action="'.$_HTTP['REFERER'].'">';
foreach( $aFiles as $aMedia )
{
$sThumbUrl = $site['profileImage'] . $aMedia['medProfId'] . '/thumb_' . $aMedia['medFile'];
$sMedia = '<div class="thumbBlock" style="width:'.$max_thumb_width.'px; height:'.$max_thumb_height.'px; background-image: url(\''.$sThumbUrl.'\');"> </div>';
$sProf = '<a href="'.$site['url'].'profile_edit.php?ID='.$aMedia['medProfId'].'">'.$aMedia['NickName'].'</a>';
$ret .= '<div class="mainBlock">';
$ret .= '<div class="checkBox">
<input type="checkbox" name="check[]" id="ch'.$aMedia['medID'].'" value="'.$aMedia['medID'].'">
</div>';
$ret .= '<div class="checkBox">';
$ret .= $sMedia;
$ret .= '</div>';
$ret .= '<div class="photoInfo">';
$ret .= '<div>'.$aMedia['medTitle'].'</div>';
$ret .= '<div>by '.$sProf.'</div>';
$ret .= '<div>Added: '.date('y-m-d',$aMedia['medDate']).'</div>';
$ret .= '</div>';
$ret .= '</div>';
}
$ret .= '<div style="clear:both;"></div>';
$sAppBut = $sStatus == 'passive' ? '<input type="submit" name="Approve" value="Approve">' : '';
$sCheck = count($aFiles) > 1 ? '<input type="checkbox" name=\"ch_all" onclick="checkAll( \'ch\', this.checked )" />Check all' : '';
$ret .= '<div style="clear:both;font-weight:bold; text-align:center;">'.$sCheck.'
<input type="submit" name="Delete" value="Delete">';
$ret .= $sAppBut.'</div>';
$ret .= '</form></div>';
}
else
{
$ret .= '<div style="text-align:center; line-height:25px; vertical-align:middle; background-color:#c2daeb; font-weight:bold;">There is nothing to approve </div>';
}
return $ret;
}
function getUnapprovedFilesArray($sType, $sStatus, $iUser)
{
$ret = '';
$sAdd = "AND `med_status` = '$sStatus'";
$sAdd .= " AND `med_type` = '$sType'";
$sAdd .= $iUser != 0 ? " AND `med_prof_id`='$iUser'" : "";
$sQuery = "
SELECT
`media`.`med_id` as `medID`,
`media`.`med_prof_id` as `medProfId`,
`media`.`med_type` as `medType`,
`media`.`med_file` as `medFile`,
`media`.`med_title` as `medTitle`,
UNIX_TIMESTAMP(`media`.`med_date`) as `medDate`,
`Profiles`.`NickName`
FROM `media`
LEFT JOIN `Profiles` ON `Profiles`.`ID`=`media`.`med_prof_id`
WHERE 1
$sAdd
ORDER BY `media`.`med_date`
";
$res = db_res( $sQuery );
$ret = fill_assoc_array( $res );
return $ret;
}
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 = "
DELETE FROM `media` WHERE `med_id` = '$iMedia';
";
$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;
}
function approveItem( $iMedia )
{
$sQuery = "
UPDATE `media`
SET
`med_status` = 'active'
WHERE `med_id` = '$iMedia'
";
return db_res( $sQuery );
}
function approveAllItems()
{
$sQuery = "
UPDATE `media`
SET
`med_status` = 'active'
";
return db_res( $sQuery );
}
?>