News:

CPG Release 1.6.29
During HTML5 upload, keep pseudo blank code 200 messages from triggering error condition
added Russian language
correct failure to use theme menu icons in album manager
minor vulnerabilities mitigation

Main Menu

show quota in profile, upload

Started by Justttt, June 25, 2006, 04:20:54 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Justttt

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
echo "<br /><br />{$lang_upload_php['reg_instr_4']}";

under add.

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.
make_form($edit_profile_form_param, $form_data);

below it add.

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>';
}
J U S T T T T

Joachim Müller

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.