Changeset 1512 in ExiteCMS


Ignore:
Timestamp:
07/02/08 18:58:52 (4 years ago)
Author:
hverton
Message:

updated the PLi themes to work with the new download_statistics module

Location:
themes/PLi-Fusion
Files:
3 added
13 edited

Legend:

Unmodified
Added
Removed
  • themes/PLi-Fusion/PLiTheme/php-files/themes/PLiTheme/templates/templates/_header.tpl

    r1411 r1512  
    205205    </tr> 
    206206</table> 
    207 <div style='margin-left:auto;margin-right:auto;width:{$smarty.const.THEME_WIDTH}px;height:120px;margin-top:-121px;'> 
     207<div style='margin-left:auto;margin-right:auto;width:{$smarty.const.THEME_WIDTH}px;height:120px;margin-top:-122px;'> 
    208208    <div id='bars' style='float:right;height:100px;'> 
    209209        <table class='bargraph'> 
     
    213213                {section name=index loop=$downloadbars} 
    214214                    <td width='40'> 
    215                         <img src='/themes/PLiThemeCentered/images/bar-{$smarty.section.index.rownum}.gif' style='width:16px;height:{$downloadbars[index].value}px;' alt='{$downloadbars[index].download_count}' title='{$downloadbars[index].percentage}%: {$downloadbars[index].download_count} {$locale.087}'/> 
     215                        <a href='/downloads.php?cat_id={$downloadbars[index].download_cat}&amp;download_id={$downloadbars[index].download_id}' title=''><img src='/themes/PLiTheme/images/bar-{$smarty.section.index.rownum}.gif' style='width:16px;height:{$downloadbars[index].value}px;' alt='{$downloadbars[index].download_count}' title='{$downloadbars[index].percentage}% = {$downloadbars[index].download_count} {$locale.087}'/></a> 
    216216                    </td> 
    217217                {/section} 
     
    223223                {section name=index loop=$downloadbars} 
    224224                    <th width='40'> 
    225                         <a href='/downloads.php?cat_id={$downloadbars[index].download_cat}&amp;download_id={$downloadbars[index].download_id}' title=''><img src='{$downloadbars[index].image_url}' height='{$downloadbars[index].image_height}' src='{$downloadbars[index].image_url}' width='{$downloadbars[index].image_width}' alt='' style='vertical-align:top;' /></a> 
     225                        <a href='/downloads.php?cat_id={$downloadbars[index].download_cat}&amp;download_id={$downloadbars[index].download_id}' title=''><img src='{$downloadbars[index].image_url}' height='{$downloadbars[index].image_height}' src='{$downloadbars[index].image_url}' width='{$downloadbars[index].image_width}' title='{$downloadbars[index].download_description}' alt='' style='vertical-align:top;' /></a> 
    226226                    </th> 
    227227                {/section} 
  • themes/PLi-Fusion/PLiTheme/php-files/themes/PLiTheme/templates/templates/_stylesheets.tpl

    r1409 r1512  
    4646 
    4747                        /* buttons */ 
    48 .button                 { font-size:90%; font-weight:normal; font-family:Verdana, Arial, Sans-Serif; width:1; overflow:visible; color:#606060; background-color:#e0e0e0; border-top:1px #ddd solid; border-left:1px #ddd solid; border-bottom:1px #666 solid; border-right:1px #666 solid; cursor:pointer; margin-top:2px; padding: 1px 2px; background:url(/themes/PLiTheme/images/buttonbg.jpg) repeat-x left top; } 
     48.button                 { font-size:90%; font-weight:normal; width:1; overflow:visible; color:#606060; background-color:#e0e0e0; border-top:1px #ddd solid; border-left:1px #ddd solid; border-bottom:1px #666 solid; border-right:1px #666 solid; cursor:pointer; margin-top:2px; padding: 1px 2px; background:url(/themes/PLiTheme/images/buttonbg.jpg) repeat-x left top; } 
    4949 
    5050                        /* text entry fields */ 
    51 .textbox                { font-size:95%; font-family:Verdana, Arial, Sans-Serif; color:#000; background-color:#eee; border:1px #666 solid; } 
     51.textbox                { font-size:95%; color:#000; background-color:#eee; border:1px #666 solid; } 
    5252 
    5353/* --- Website template ------------------------------------ */ 
    5454 
    5555                        /* page body (normal mode & maintenance mode */ 
    56 body                    { font-size:1em; font-family:Verdana, Arial, Sans-Serif; } 
     56body                    { font-size:1em; font-family:Verdana, "Deja Vu Sans", Arial, Sans-Serif; } 
    5757.body                   { margin: 5px 5px 5px 5px; color:#000; background-color:#bbbbbc; } 
    5858.body-maint             { margin: 5px 5px 5px 5px; color:#000; background-color:{/literal}{$settings.maintenance_color}{literal}; } 
     
    227227.bargraph td            { padding:0; margin:-20px; vertical-align:bottom; text-align:center; } 
    228228.bargraph th            { padding-top:5px; text-align:center; } 
    229 .bargraph td img        { display:inline; margin-top:35px; border-right: 1px #888 solid; border-top: 1px #fff solid;} 
     229.bargraph td img        { display:inline; margin-top:35px; border-right: 1px #ddd solid; border-top: 1px #ddd solid;} 
    230230 
    231231/* --- Donations -------------------------------------------- */ 
  • themes/PLi-Fusion/PLiTheme/php-files/themes/PLiTheme/theme_functions.php

    r1409 r1512  
    5252    } 
    5353} 
     54/* 
     55[download_id] => 35 
     56            [download_title] => DM500 
     57            [download_description] => PLi® Iolite 2008 Edition - for the Dreambox DM500 
     58            [download_url] => http://downloads.pli-images.org/dm500/pli-Iolite-dm500-20071230-4014.zip 
     59            [download_cat] => 8 
     60            [download_license] => GPL 
     61            [download_os] => tuxbox - Enigma1 
     62            [download_version] => Iolite 2008 Edition 
     63            [download_filesize] => 5,878Mb 
     64            [download_bar] => 1 
     65            [download_datestamp] => 1199046320 
     66            [download_count] => 2138 
     67            [image_url] => /files/cache/pli-images.dev.vnvadvies.nl.PLiTheme.977ecf39a1186353f643b8b55ce34d5c.png 
     68            [image_height] => 10 
     69            [image_width] => 28 
     70            [percentage] => 5 
     71            [value] => 7 
     72 */ 
    5473 
    5574/*------------------------------------------------------+ 
     
    5877function downloadbars() { 
    5978    global $db_prefix, $settings; 
    60      
     79 
    6180    // define the font2image array 
    6281    $font2png = array(); 
     
    7897    $font2png['return_link'] = true; 
    7998 
     99    // define the download records we want a bar graph from 
     100    $downloads = array(); 
     101 
     102    $total = 0; 
     103    // get the defined download bars 
     104    $result = dbquery("SELECT * FROM ".$db_prefix."dlstats_counters ORDER BY dlsc_order"); 
     105    while ($data = dbarray($result)) { 
     106        // start with a count of zero 
     107        $download = array('download_count' => 0); 
     108        // check if we need to get a local download counter 
     109        if ($data['dlsc_download_id']) { 
     110            $result2 = dbquery("SELECT d.*, c.download_cat_access FROM ".$db_prefix."downloads d LEFT JOIN ".$db_prefix."download_cats c ON d.download_cat = c.download_cat_id WHERE d.download_id = '".$data['dlsc_download_id']."'"); 
     111            if ($data2 = dbarray($result2)) { 
     112                // check if this user has the right to download it 
     113                $access = true; 
     114                $cat_id = $data2['download_cat']; 
     115                while(true) { 
     116                    // check if the user has access to this download item 
     117                    $data3 = dbarray(dbquery("SELECT * FROM ".$db_prefix."download_cats WHERE download_cat_id = '".$cat_id."'")); 
     118                    if (!checkgroup($data3['download_cat_access'])) { 
     119                        $access = false; 
     120                        break; 
     121                    } 
     122                    // if this was a sub-category, check the parent as well 
     123                    $cat_id = $data3['download_parent']; 
     124                    // if no more parents are present, end the loop 
     125                    if ($cat_id == 0) break; 
     126                } 
     127                // if the user has access, add the info from the download record 
     128                if ($access) { 
     129                    $download = array_merge($download, $data2); 
     130                } 
     131            } 
     132        } 
     133        // check if we need to add file counters 
     134        $files = explode("\n", $data['dlsc_files']); 
     135        foreach($files as $file) { 
     136            $result2 = dbquery("SELECT * FROM ".$db_prefix."dlstats_files WHERE dlsf_file = '".trim($file)."'"); 
     137            if ($data2 = dbarray($result2)) { 
     138                // get the counter 
     139                $download['download_count'] += $data2['dlsf_counter']; 
     140            } 
     141        } 
     142        // and add some data from the counter definition 
     143        $download['download_title'] = $data['dlsc_name']; 
     144        $download['download_description'] = $data['dlsc_description']; 
     145        // make sure the title is properly formatted and fits 
     146        if (strlen($download['download_title']) > 6) $download['download_title'] = substr($download['download_title'],0,6); 
     147        $download['download_title'] = strtoupper(trim($download['download_title'])); 
     148        $font2png['font_text'] = $download['download_title']; 
     149        $download['image_url'] = font2image($font2png); 
     150        $size = getimagesize(PATH_ROOT.$download['image_url']); 
     151        $download['image_height'] =$size[1]; 
     152        $download['image_width'] = $size[0]; 
     153        $total += $download['download_count']; 
     154        $downloads[] = $download; 
     155    } 
     156 
    80157    // define the max width of a bar in pixels 
    81158    $barheight = 65; 
    82      
    83     // define the download records we want a bar graph from 
    84     $download = array(); 
    85  
    86     // get the download statistics for the required download records 
    87     $total = 0; 
    88     $result = dbquery("SELECT * FROM ".$db_prefix."downloads WHERE download_bar > '0' ORDER BY download_bar ASC"); 
    89     while ($data = dbarray($result)) { 
    90         $access = true; 
    91         $cat_id = $data['download_cat']; 
    92         while(true) { 
    93             // check if the user has access to this download item 
    94             $data2 = dbarray(dbquery("SELECT * FROM ".$db_prefix."download_cats WHERE download_cat_id = '".$cat_id."'")); 
    95             if (!checkgroup($data2['download_cat_access'])) { 
    96                 $access = false; 
    97                 break; 
    98             } 
    99             // if this was a sub-category, check the parent as well 
    100             $cat_id = $data2['download_parent']; 
    101             // if no more parents are present, end the loop 
    102             if ($cat_id == 0) break; 
    103              
    104         } 
    105         // if the user has access, add this download to the bar panel 
    106         if ($access) { 
    107             if (strlen($data['download_title']) > 6) $data['download_title'] = substr($data['download_title'],0,6); 
    108             $data['download_title'] = strtoupper(trim($data['download_title'])); 
    109             $font2png['font_text'] = $data['download_title']; 
    110             $data['image_url'] = font2image($font2png); 
    111             $size = getimagesize(PATH_ROOT.$data['image_url']); 
    112             $data['image_height'] =$size[1]; 
    113             $data['image_width'] = $size[0]; 
    114             $download[] = $data; 
    115             $total += $data['download_count']; 
    116         } 
    117     } 
    118159 
    119160    // calculate the percentages of the grand total of all the entries listed (in $total) 
    120161    $maxperc = 0; 
    121     foreach ($download as $key => $value) { 
     162    foreach ($downloads as $key => $value) { 
    122163        if ($total == 0) 
    123             $download[$key]['percentage'] = 0; 
     164            $downloads[$key]['percentage'] = 0; 
    124165        else 
    125             $download[$key]['percentage'] = floor($value['download_count'] / $total * 100); 
     166            $downloads[$key]['percentage'] = floor($value['download_count'] / $total * 100); 
    126167        // add 1 to make sure 'percentage' is never zero (to work around a Firefox DIV bug) 
    127         $download[$key]['percentage']++; 
    128         $maxperc = max($maxperc, $download[$key]['percentage']); 
     168        $downloads[$key]['percentage']++; 
     169        $maxperc = max($maxperc, $downloads[$key]['percentage']); 
    129170    } 
    130171    // calculate the percentage multiplier to fill out the bars nicely 
     
    133174    // display the panel with the download statistics 
    134175    $i=1; 
    135     foreach ($download as $key => $value) { 
    136         $download[$key]['value'] = floor($value['percentage'] * $multiplier); 
     176    foreach ($downloads as $key => $value) { 
     177        $downloads[$key]['value'] = floor($value['percentage'] * $multiplier); 
    137178        $i++; 
    138179    } 
    139     return $download; 
     180 
     181    return $downloads; 
    140182} 
    141183 
     
    152194    } 
    153195 
    154     $result = dbquery("SELECT download_cat_name FROM ".$db_prefix."download_cats WHERE download_cat_id = '0'"); 
    155     if ($data = dbarray($result)) { 
    156         if ($data['download_cat_name'] != "") { 
    157             $bar_title = trim($data['download_cat_name']). " : ".$total."  | "; 
    158         } 
    159     } 
     196    $bar_title = sprintf(html_entity_decode($settings['dlstats_title']),$total); 
     197 
    160198    if (!isset($bar_title)) $bar_title = "Current image downloads "; 
    161199     
  • themes/PLi-Fusion/PLiThemeCentered/php-files/themes/PLiThemeCentered/templates/templates/_header.tpl

    r1411 r1512  
    205205    </tr> 
    206206</table> 
    207 <div style='margin-left:auto;margin-right:auto;width:{$smarty.const.THEME_WIDTH}px;height:120px;margin-top:-120px;'> 
     207<div style='margin-left:auto;margin-right:auto;width:{$smarty.const.THEME_WIDTH}px;height:120px;margin-top:-121px;'> 
    208208    <div id='bars' style='float:right;height:100px;'> 
    209209        <table class='bargraph'> 
     
    213213                {section name=index loop=$downloadbars} 
    214214                    <td width='40'> 
    215                         <img src='/themes/PLiThemeCentered/images/bar-{$smarty.section.index.rownum}.gif' style='width:16px;height:{$downloadbars[index].value}px;' alt='{$downloadbars[index].download_count}' title='{$downloadbars[index].percentage}%: {$downloadbars[index].download_count} {$locale.087}'/> 
     215                        <a href='/downloads.php?cat_id={$downloadbars[index].download_cat}&download_id={$downloadbars[index].download_id}' title=''><img src='/themes/PLiThemeCentered/images/bar-{$smarty.section.index.rownum}.gif' style='width:16px;height:{$downloadbars[index].value}px;' alt='{$downloadbars[index].download_count}' title='{$downloadbars[index].percentage}%: {$downloadbars[index].download_count} {$locale.087}'/></a> 
    216216                    </td> 
    217217                {/section} 
     
    223223                {section name=index loop=$downloadbars} 
    224224                    <th width='40'> 
    225                         <a href='/downloads.php?cat_id={$downloadbars[index].download_cat}&download_id={$downloadbars[index].download_id}' title=''><img src='{$downloadbars[index].image_url}' alt='' style='vertical-align:top;' /></a> 
     225                        <a href='/downloads.php?cat_id={$downloadbars[index].download_cat}&download_id={$downloadbars[index].download_id}' title=''><img src='{$downloadbars[index].image_url}' title='{$downloadbars[index].download_descriptions}' alt='' style='vertical-align:top;' /></a> 
    226226                    </th> 
    227227                {/section} 
  • themes/PLi-Fusion/PLiThemeCentered/php-files/themes/PLiThemeCentered/templates/templates/_stylesheets.tpl

    r1410 r1512  
    4646 
    4747                        /* buttons */ 
    48 .button                 { font-size:90%; font-weight:normal; font-family:Verdana, Arial, Sans-Serif; width:1; overflow:visible; color:#606060; background-color:#e0e0e0; border-top:1px #ddd solid; border-left:1px #ddd solid; border-bottom:1px #666 solid; border-right:1px #666 solid; cursor:pointer; margin-top:2px; padding: 1px 2px; background:url(/themes/PLiThemeCentered/images/buttonbg.jpg) repeat-x left top; } 
     48.button                 { font-size:90%; font-weight:normal; width:1; overflow:visible; color:#606060; background-color:#e0e0e0; border-top:1px #ddd solid; border-left:1px #ddd solid; border-bottom:1px #666 solid; border-right:1px #666 solid; cursor:pointer; margin-top:2px; padding: 1px 2px; background:url(/themes/PLiThemeCentered/images/buttonbg.jpg) repeat-x left top; } 
    4949 
    5050                        /* text entry fields */ 
    51 .textbox                { font-size:95%; font-family:Verdana, Arial, Sans-Serif; color:#000; background-color:#eee; border:1px #666 solid; } 
     51.textbox                { font-size:95%; color:#000; background-color:#eee; border:1px #666 solid; } 
    5252 
    5353/* --- Website template ------------------------------------ */ 
    5454 
    5555                        /* page body (normal mode & maintenance mode */ 
    56 body                    { font-size:1em; font-family:Verdana, Arial, Sans-Serif; } 
     56body                    { font-size:1em; font-family:Verdana, "Deja Vu Sans", Arial, Sans-Serif; } 
    5757.body                   { margin: 5px 5px 5px 5px; color:#000; background-color:#bbbbbc; } 
    5858.body-maint             { margin: 5px 5px 5px 5px; color:#000; background-color:{/literal}{$settings.maintenance_color}{literal}; } 
     
    227227.bargraph td            { padding:0; margin:-20px; vertical-align:bottom; text-align:center; } 
    228228.bargraph th            { padding-top:5px; text-align:center; } 
    229 .bargraph td img        { display:inline; margin-top:35px; border-right: 1px #888 solid; border-top: 1px #fff solid;} 
     229.bargraph td img        { display:inline; margin-top:35px; border-right: 1px #ddd solid; border-top: 1px #ddd solid;} 
    230230 
    231231/* --- Donations -------------------------------------------- */ 
  • themes/PLi-Fusion/PLiThemeCentered/php-files/themes/PLiThemeCentered/theme_functions.php

    r1410 r1512  
    5252    } 
    5353} 
     54/* 
     55[download_id] => 35 
     56            [download_title] => DM500 
     57            [download_description] => PLi® Iolite 2008 Edition - for the Dreambox DM500 
     58            [download_url] => http://downloads.pli-images.org/dm500/pli-Iolite-dm500-20071230-4014.zip 
     59            [download_cat] => 8 
     60            [download_license] => GPL 
     61            [download_os] => tuxbox - Enigma1 
     62            [download_version] => Iolite 2008 Edition 
     63            [download_filesize] => 5,878Mb 
     64            [download_bar] => 1 
     65            [download_datestamp] => 1199046320 
     66            [download_count] => 2138 
     67            [image_url] => /files/cache/pli-images.dev.vnvadvies.nl.PLiTheme.977ecf39a1186353f643b8b55ce34d5c.png 
     68            [image_height] => 10 
     69            [image_width] => 28 
     70            [percentage] => 5 
     71            [value] => 7 
     72 */ 
    5473 
    5574/*------------------------------------------------------+ 
     
    5877function downloadbars() { 
    5978    global $db_prefix, $settings; 
    60      
     79 
    6180    // define the font2image array 
    6281    $font2png = array(); 
     
    7897    $font2png['return_link'] = true; 
    7998 
     99    // define the download records we want a bar graph from 
     100    $downloads = array(); 
     101 
     102    $total = 0; 
     103    // get the defined download bars 
     104    $result = dbquery("SELECT * FROM ".$db_prefix."dlstats_counters ORDER BY dlsc_order"); 
     105    while ($data = dbarray($result)) { 
     106        // start with a count of zero 
     107        $download = array('download_count' => 0); 
     108        // check if we need to get a local download counter 
     109        if ($data['dlsc_download_id']) { 
     110            $result2 = dbquery("SELECT d.*, c.download_cat_access FROM ".$db_prefix."downloads d LEFT JOIN ".$db_prefix."download_cats c ON d.download_cat = c.download_cat_id WHERE d.download_id = '".$data['dlsc_download_id']."'"); 
     111            if ($data2 = dbarray($result2)) { 
     112                // check if this user has the right to download it 
     113                $access = true; 
     114                $cat_id = $data2['download_cat']; 
     115                while(true) { 
     116                    // check if the user has access to this download item 
     117                    $data3 = dbarray(dbquery("SELECT * FROM ".$db_prefix."download_cats WHERE download_cat_id = '".$cat_id."'")); 
     118                    if (!checkgroup($data3['download_cat_access'])) { 
     119                        $access = false; 
     120                        break; 
     121                    } 
     122                    // if this was a sub-category, check the parent as well 
     123                    $cat_id = $data3['download_parent']; 
     124                    // if no more parents are present, end the loop 
     125                    if ($cat_id == 0) break; 
     126                } 
     127                // if the user has access, add the info from the download record 
     128                if ($access) { 
     129                    $download = array_merge($download, $data2); 
     130                } 
     131            } 
     132        } 
     133        // check if we need to add file counters 
     134        $files = explode("\n", $data['dlsc_files']); 
     135        foreach($files as $file) { 
     136            $result2 = dbquery("SELECT * FROM ".$db_prefix."dlstats_files WHERE dlsf_file = '".trim($file)."'"); 
     137            if ($data2 = dbarray($result2)) { 
     138                // get the counter 
     139                $download['download_count'] += $data2['dlsf_counter']; 
     140            } 
     141        } 
     142        // and add some data from the counter definition 
     143        $download['download_title'] = $data['dlsc_name']; 
     144        $download['download_description'] = $data['dlsc_description']; 
     145        // make sure the title is properly formatted and fits 
     146        if (strlen($download['download_title']) > 6) $download['download_title'] = substr($download['download_title'],0,6); 
     147        $download['download_title'] = strtoupper(trim($download['download_title'])); 
     148        $font2png['font_text'] = $download['download_title']; 
     149        $download['image_url'] = font2image($font2png); 
     150        $size = getimagesize(PATH_ROOT.$download['image_url']); 
     151        $download['image_height'] =$size[1]; 
     152        $download['image_width'] = $size[0]; 
     153        $total += $download['download_count']; 
     154        $downloads[] = $download; 
     155    } 
     156 
    80157    // define the max width of a bar in pixels 
    81158    $barheight = 65; 
    82      
    83     // define the download records we want a bar graph from 
    84     $download = array(); 
    85  
    86     // get the download statistics for the required download records 
    87     $total = 0; 
    88     $result = dbquery("SELECT * FROM ".$db_prefix."downloads WHERE download_bar > '0' ORDER BY download_bar ASC"); 
    89     while ($data = dbarray($result)) { 
    90         $access = true; 
    91         $cat_id = $data['download_cat']; 
    92         while(true) { 
    93             // check if the user has access to this download item 
    94             $data2 = dbarray(dbquery("SELECT * FROM ".$db_prefix."download_cats WHERE download_cat_id = '".$cat_id."'")); 
    95             if (!checkgroup($data2['download_cat_access'])) { 
    96                 $access = false; 
    97                 break; 
    98             } 
    99             // if this was a sub-category, check the parent as well 
    100             $cat_id = $data2['download_parent']; 
    101             // if no more parents are present, end the loop 
    102             if ($cat_id == 0) break; 
    103              
    104         } 
    105         // if the user has access, add this download to the bar panel 
    106         if ($access) { 
    107             if (strlen($data['download_title']) > 6) $data['download_title'] = substr($data['download_title'],0,6); 
    108             $data['download_title'] = strtoupper(trim($data['download_title'])); 
    109             $font2png['font_text'] = $data['download_title']; 
    110             $data['image_url'] = font2image($font2png); 
    111             $download[] = $data; 
    112             $total += $data['download_count']; 
    113         } 
    114     } 
    115159 
    116160    // calculate the percentages of the grand total of all the entries listed (in $total) 
    117161    $maxperc = 0; 
    118     foreach ($download as $key => $value) { 
     162    foreach ($downloads as $key => $value) { 
    119163        if ($total == 0) 
    120             $download[$key]['percentage'] = 0; 
     164            $downloads[$key]['percentage'] = 0; 
    121165        else 
    122             $download[$key]['percentage'] = floor($value['download_count'] / $total * 100); 
     166            $downloads[$key]['percentage'] = floor($value['download_count'] / $total * 100); 
    123167        // add 1 to make sure 'percentage' is never zero (to work around a Firefox DIV bug) 
    124         $download[$key]['percentage']++; 
    125         $maxperc = max($maxperc, $download[$key]['percentage']); 
     168        $downloads[$key]['percentage']++; 
     169        $maxperc = max($maxperc, $downloads[$key]['percentage']); 
    126170    } 
    127171    // calculate the percentage multiplier to fill out the bars nicely 
     
    130174    // display the panel with the download statistics 
    131175    $i=1; 
    132     foreach ($download as $key => $value) { 
    133         $download[$key]['value'] = floor($value['percentage'] * $multiplier); 
     176    foreach ($downloads as $key => $value) { 
     177        $downloads[$key]['value'] = floor($value['percentage'] * $multiplier); 
    134178        $i++; 
    135179    } 
    136     return $download; 
     180 
     181    return $downloads; 
    137182} 
    138183 
     
    149194    } 
    150195 
    151     $result = dbquery("SELECT download_cat_name FROM ".$db_prefix."download_cats WHERE download_cat_id = '0'"); 
    152     if ($data = dbarray($result)) { 
    153         if ($data['download_cat_name'] != "") { 
    154             $bar_title = trim($data['download_cat_name']). " : ".$total."  | "; 
    155         } 
    156     } 
     196    $bar_title = sprintf(html_entity_decode($settings['dlstats_title']),$total); 
     197 
    157198    if (!isset($bar_title)) $bar_title = "Current image downloads "; 
    158199     
  • themes/PLi-Fusion/PLiXmas/php-files/themes/PLiXmas/templates/templates/_header.tpl

    r1190 r1512  
    161161                </div> 
    162162                <div class='sub-header' style='display:inline;float:right;margin-top:127px;height:5px;'> 
    163                     {$bartitle}&nbsp;:&nbsp;{$bartotal}&nbsp; 
     163                    {$bartitle}&nbsp; 
    164164                </div> 
    165165                <div id='countdown' style='white-space:no-wrap;text-align:center;float:right;font-weight:bold;width:380px;color:#CC0000;margin-top:148px;'></div> 
  • themes/PLi-Fusion/PLiXmas/php-files/themes/PLiXmas/templates/templates/_stylesheets.tpl

    r1275 r1512  
    4646 
    4747                        /* buttons */ 
    48 .button                 { font-size:90%; font-weight:normal; font-family:Verdana, Arial, Sans-Serif; width:1; overflow:visible; color:#fff; background-color:#CC0000; border-top:1px #ddd solid; border-left:1px #ddd solid; border-bottom:1px #666 solid; border-right:1px #666 solid; cursor:pointer; margin-top:2px; padding: 1px 2px;} 
     48.button                 { font-size:90%; font-weight:normal; width:1; overflow:visible; color:#fff; background-color:#CC0000; border-top:1px #ddd solid; border-left:1px #ddd solid; border-bottom:1px #666 solid; border-right:1px #666 solid; cursor:pointer; margin-top:2px; padding: 1px 2px;} 
    4949 
    5050                        /* text entry fields */ 
    51 .textbox                { font-size:95%; font-family:Verdana, Arial, Sans-Serif; color:#003300; background-color:#fff; border:1px #666 solid; } 
     51.textbox                { font-size:95%; color:#003300; background-color:#fff; border:1px #666 solid; } 
    5252 
    5353/* --- Website template ------------------------------------ */ 
    5454 
    5555                        /* page body (normal mode & maintenance mode */ 
    56 body                    { font-size:1em; font-family:Verdana, Arial, Sans-Serif; } 
     56body                    { font-size:1em; font-family:Verdana, "Deja Vu Sans", Arial, Sans-Serif; } 
    5757.body                   { margin: 5px 5px 5px 5px; color:#fff; background-color:#58a7e3; } 
    5858.body-maint             { margin: 5px 5px 5px 5px; color:#fff; background-color:{/literal}{$settings.maintenance_color}{literal}; } 
  • themes/PLi-Fusion/PLiXmas/php-files/themes/PLiXmas/theme.php

    r1347 r1512  
    7070 
    7171// bar counter title 
    72 $variables['bartitle'] = bartitle(); 
    73  
    74 // bar counter 
    75 $variables['bartotal'] = 0; 
    76 foreach($variables['downloadbars'] as $bar) { 
    77     $variables['bartotal'] += $bar['download_count']; 
    78 } 
     72$variables['bartitle'] = bartitle($variables['downloadbars']); 
    7973 
    8074// get the time left until new year 
  • themes/PLi-Fusion/PLiXmas/php-files/themes/PLiXmas/theme_functions.php

    r1169 r1512  
    1414// include the menu functions to create the header menu bar 
    1515require_once PATH_INCLUDES."menu_include.php"; 
     16 
     17// include the text image generation function 
     18require_once PATH_INCLUDES."font2image.php"; 
    1619 
    1720// generate the treelist for items in the header menu bar 
     
    5457+-------------------------------------------------------*/ 
    5558function downloadbars() { 
    56     global $db_prefix; 
    57      
     59    global $db_prefix, $settings; 
     60 
     61    // define the download records we want a bar graph from 
     62    $downloads = array(); 
     63 
     64    $total = 0; 
     65    // get the defined download bars 
     66    $result = dbquery("SELECT * FROM ".$db_prefix."dlstats_counters ORDER BY dlsc_order"); 
     67    while ($data = dbarray($result)) { 
     68        // start with a count of zero 
     69        $download = array('download_count' => 0); 
     70        // check if we need to get a local download counter 
     71        if ($data['dlsc_download_id']) { 
     72            $result2 = dbquery("SELECT d.*, c.download_cat_access FROM ".$db_prefix."downloads d LEFT JOIN ".$db_prefix."download_cats c ON d.download_cat = c.download_cat_id WHERE d.download_id = '".$data['dlsc_download_id']."'"); 
     73            if ($data2 = dbarray($result2)) { 
     74                // check if this user has the right to download it 
     75                $access = true; 
     76                $cat_id = $data2['download_cat']; 
     77                while(true) { 
     78                    // check if the user has access to this download item 
     79                    $data3 = dbarray(dbquery("SELECT * FROM ".$db_prefix."download_cats WHERE download_cat_id = '".$cat_id."'")); 
     80                    if (!checkgroup($data3['download_cat_access'])) { 
     81                        $access = false; 
     82                        break; 
     83                    } 
     84                    // if this was a sub-category, check the parent as well 
     85                    $cat_id = $data3['download_parent']; 
     86                    // if no more parents are present, end the loop 
     87                    if ($cat_id == 0) break; 
     88                } 
     89                // if the user has access, add the info from the download record 
     90                if ($access) { 
     91                    $download = array_merge($download, $data2); 
     92                } 
     93            } 
     94        } 
     95        // check if we need to add file counters 
     96        $files = explode("\n", $data['dlsc_files']); 
     97        foreach($files as $file) { 
     98            $result2 = dbquery("SELECT * FROM ".$db_prefix."dlstats_files WHERE dlsf_file = '".trim($file)."'"); 
     99            if ($data2 = dbarray($result2)) { 
     100                // get the counter 
     101                $download['download_count'] += $data2['dlsf_counter']; 
     102            } 
     103        } 
     104        // and add some data from the counter definition 
     105        $download['download_title'] = $data['dlsc_name']; 
     106        $download['download_description'] = $data['dlsc_description']; 
     107        // make sure the title is properly formatted and fits 
     108        if (strlen($download['download_title']) > 6) $download['download_title'] = substr($download['download_title'],0,6); 
     109        $download['download_title'] = strtoupper(trim($download['download_title'])); 
     110        $font2png['font_text'] = $download['download_title']; 
     111        $total += $download['download_count']; 
     112        $downloads[] = $download; 
     113    } 
     114 
    58115    // define the max width of a bar in pixels 
    59116    $barheight = 65; 
    60      
    61     // define the download records we want a bar graph from 
    62     $download = array(); 
    63  
    64     // get the download statistics for the required download records 
    65     $total = 0; 
    66     $result = dbquery("SELECT * FROM ".$db_prefix."downloads WHERE download_bar > '0' ORDER BY download_bar DESC"); 
    67     while ($data = dbarray($result)) { 
    68         $access = true; 
    69         $cat_id = $data['download_cat']; 
    70         while(true) { 
    71             // check if the user has access to this download item 
    72             $data2 = dbarray(dbquery("SELECT * FROM ".$db_prefix."download_cats WHERE download_cat_id = '".$cat_id."'")); 
    73             if (!checkgroup($data2['download_cat_access'])) { 
    74                 $access = false; 
    75                 break; 
    76             } 
    77             // if this was a sub-category, check the parent as well 
    78             $cat_id = $data2['download_parent']; 
    79             // if no more parents are present, end the loop 
    80             if ($cat_id == 0) break; 
    81              
    82         } 
    83         // if the user has access, add this download to the bar panel 
    84         if ($access) { 
    85             if (strlen($data['download_title']) > 6) $data['download_title'] = substr($data['download_title'],0,6); 
    86             $data['download_title'] = strtoupper(trim($data['download_title'])); 
    87             $download[] = $data; 
    88             $total += $data['download_count']; 
    89         } 
    90     } 
    91117 
    92118    // calculate the percentages of the grand total of all the entries listed (in $total) 
    93119    $maxperc = 0; 
    94     foreach ($download as $key => $value) { 
     120    foreach ($downloads as $key => $value) { 
    95121        if ($total == 0) 
    96             $download[$key]['percentage'] = 0; 
     122            $downloads[$key]['percentage'] = 0; 
    97123        else 
    98             $download[$key]['percentage'] = floor($value['download_count'] / $total * 100); 
     124            $downloads[$key]['percentage'] = floor($value['download_count'] / $total * 100); 
    99125        // add 1 to make sure 'percentage' is never zero (to work around a Firefox DIV bug) 
    100         $download[$key]['percentage']++; 
    101         $maxperc = max($maxperc, $download[$key]['percentage']); 
     126        $downloads[$key]['percentage']++; 
     127        $maxperc = max($maxperc, $downloads[$key]['percentage']); 
    102128    } 
    103129    // calculate the percentage multiplier to fill out the bars nicely 
     
    106132    // display the panel with the download statistics 
    107133    $i=1; 
    108     foreach ($download as $key => $value) { 
    109         $download[$key]['value'] = floor($value['percentage'] * $multiplier); 
    110         $download[$key]['baseline'] = 65 - $download[$key]['value']; 
     134    foreach ($downloads as $key => $value) { 
     135        $downloads[$key]['value'] = floor($value['percentage'] * $multiplier); 
    111136        $i++; 
    112137    } 
    113     return $download; 
     138 
     139    return $downloads; 
    114140} 
    115141 
     
    117143| Generate the title for the download bar counter       | 
    118144+-------------------------------------------------------*/ 
    119 function bartitle() { 
    120     global $db_prefix; 
     145function bartitle($downloads) { 
     146    global $db_prefix, $settings; 
    121147 
    122     $result = dbquery("SELECT download_cat_name FROM ".$db_prefix."download_cats WHERE download_cat_id = '0'"); 
    123     if ($data = dbarray($result)) 
    124         if ($data['download_cat_name'] != "") $bar_title = trim($data['download_cat_name']); 
    125     if (!isset($bar_title)) $bar_title = "Current Release Downloads"; 
     148    // calculate the total downloads 
     149    $total = 0; 
     150    foreach ($downloads as $download) { 
     151        $total += $download['download_count']; 
     152    } 
    126153 
     154    $bar_title = explode("|", $settings['dlstats_title']); 
     155    $bar_title = sprintf(html_entity_decode(trim($bar_title[0])),$total); 
     156 
     157    if (!isset($bar_title)) $bar_title = "Current image downloads "; 
     158     
    127159    return $bar_title; 
    128160} 
Note: See TracChangeset for help on using the changeset viewer.