forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: Justttt on June 25, 2006, 04:20:54 pm

Title: show quota in profile, upload
Post by: Justttt on June 25, 2006, 04:20:54 pm
found this code of the fourm and it was marked 1.3 also putting it in right place works with 1.4


edit upload.php

find
Code: [Select]
echo "<br /><br />{$lang_upload_php['reg_instr_4']}";
under add.

Code: [Select]
global $CONFIG;
global $USER_DATA;
$results = cpg_db_query("SELECT sum(total_filesize) FROM {$CONFIG['TABLE_PICTURES']} WHERE owner_id = " . USER_ID);
$record = mysql_fetch_array($results);
        $total_space_used = $record[0];
$total_space_used = round($total_space_used / 1048576, 2);
$quota = $USER_DATA['group_quota'];
$quota = round($quota/1024, 2);
if($quota == 0) {
//User has no quota, so don't display quota message.
}
else {
$percentage = round(100 * ($total_space_used / $quota), 2);
if($percentage <= 60) {
$color = '#00A000';
}
elseif($percentage > 60 && $percentage < 80) {
$color = '#FFD300';
}
elseif($percentage >= 80) {
$color = '#FF0000';
$upgrade_now = '<a href="upgrade.php"><font color="#FF0000">Upgrade NOW!</a>';
}
$prog_width = round($percentage, 0);
if ($prog_width > 100) {
$prog_width = 100;
}
echo '<hr><div align="center" style="color:'.$color.';font-weight:bold;">You are currently using '.$total_space_used.' MB ('.$percentage.'%) of your '.$quota.' MB of storage. '.$upgrade_now.'';
echo '<div align="left" style="display:block; margin-top:5px; margin-bottom:5px; width:100%; border:1px solid #000000; height:10px;">';
echo '<div align="left" style="display:block; background-color:'.$color.'; width:'.$prog_width.'%; height:10px; color:#000000;"></div>';
echo '</div>';
echo '</div>';
}


edit profile.php

find.
Code: [Select]
make_form($edit_profile_form_param, $form_data);
below it add.

Code: [Select]
global $CONFIG;
global $USER_DATA;
$results = cpg_db_query("SELECT sum(total_filesize) FROM {$CONFIG['TABLE_PICTURES']} WHERE owner_id = " . USER_ID);
$record = mysql_fetch_array($results);
        $total_space_used = $record[0];
$total_space_used = round($total_space_used / 1048576, 2);
$quota = $USER_DATA['group_quota'];
$quota = round($quota/1024, 2);
if($quota == 0) {
//User has no quota, so don't display quota message.
}
else {
$percentage = round(100 * ($total_space_used / $quota), 2);
if($percentage <= 60) {
$color = '#00A000';
}
elseif($percentage > 60 && $percentage < 80) {
$color = '#FFD300';
}
elseif($percentage >= 80) {
$color = '#FF0000';
$upgrade_now = '<a href="upgrade.php"><font color="#FF0000">Upgrade NOW!</a>';
}
$prog_width = round($percentage, 0);
if ($prog_width > 100) {
$prog_width = 100;
}
echo '<hr><div align="center" style="color:'.$color.';font-weight:bold;">You are currently using '.$total_space_used.' MB ('.$percentage.'%) of your '.$quota.' MB of storage. '.$upgrade_now.'';
echo '<div align="left" style="display:block; margin-top:5px; margin-bottom:5px; width:100%; border:1px solid #000000; height:10px;">';
echo '<div align="left" style="display:block; background-color:'.$color.'; width:'.$prog_width.'%; height:10px; color:#000000;"></div>';
echo '</div>';
echo '</div>';
}
Title: Re: show quota in profile, upload
Post by: Joachim Müller on July 04, 2006, 07:40:03 am
Saying what your code changes are suppossed to do and posting a link to the thread you're refering to would have made this thread much more usefull.