Ignore:
Timestamp:
Apr 13, 2019, 8:05:15 PM (5 years ago)
Author:
roby
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/client/class/charts.php

    r2 r265  
    11<?php
    2 // charts.php v4.5
     2// charts.php v4.7
    33// ------------------------------------------------------------------------
    4 // Copyright (c) 2003-2006, maani.us
     4// Copyright (c) 2003-2007, maani.us
    55// ------------------------------------------------------------------------
    66// This file is part of "PHP/SWF Charts"
     
    1111
    1212//====================================
    13 function InsertChart( $flash_file, $library_path, $php_source, $width=470, $height=350, $bg_color="ffffff", $transparent=false, $license=null ){
    14        
     13function InsertChart( $flash_file, $library_path, $php_source, $width=400, $height=250, $bg_color="666666", $transparent=false, $license=null ){
     14       
    1515        $php_source=urlencode($php_source);
    1616        $library_path=urlencode($library_path);
    17         $x=$_SESSION['max'];
    18         $u=(strpos ($flash_file,"?")==false)? "?" : ((substr($flash_file, -1)=="&")? "":"&");
     17        $protocol = (strtolower($_SERVER['HTTPS']) != 'on')? 'http': 'https';
    1918
    20 
    21         $html="<div style=\"text-align: right;\">";
    22         if (strstr($_SERVER['HTTP_USER_AGENT'],"MSIE")){
    23                 $html.="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' ";
    24                 $html.="width='".$width."' height='".$height."' id='charts$x'>";
    25                 $u=(strpos ($flash_file,"?")==false)? "?" : ((substr($flash_file, -1)=="&")? "":"&");
    26                 $html.="<param name='movie' value='".$flash_file.$u."library_path=".$library_path."&amp;php_source=".$php_source;
    27                 if($license!=null){$html.="&amp;license=".$license;}
    28                 $html.="'/> <param name='quality' value='high'/> <param name='bgcolor' value='#".$bg_color."'/> ";
    29                 if($transparent){$html.="<param name='wmode' value='transparent'/> ";}
    30                 $html.="</object>";
    31         }else{
    32                 $html.="<embed src=\"".$flash_file.$u."library_path=".$library_path."&amp;php_source=".$php_source;
    33                 if($license!=null){$html.="&amp;license=".$license;}
    34                 $html.="\" quality=high bgcolor=#".$bg_color." width=".$width." height=".$height." name='charts' align='right' swLiveConnect='true' ";
    35                 if($transparent){$html.="wmode=transparent ";}
    36                 $html.="type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'></embed>";
    37         }
    38         $html.="</div>";
    39 
     19        $html="<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='".$protocol."://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' ";
     20        $html.="width='".$width."' height='".$height."' id='charts' />";
     21        $u=(strpos ($flash_file,"?")===false)? "?" : ((substr($flash_file, -1)==="&")? "":"&");
     22        $html.="<PARAM NAME='movie' VALUE='".$flash_file.$u."library_path=".$library_path."&stage_width=".$width."&stage_height=".$height."&php_source=".$php_source;
     23        if($license!=null){$html.="&license=".$license;}
     24        $html.="' /> <PARAM NAME='quality' VALUE='high' /><param name='allowScriptAccess' value='sameDomain' /><PARAM NAME='bgcolor' VALUE='#".$bg_color."' /> ";
     25        if($transparent){$html.="<PARAM NAME='wmode' VALUE='transparent' /> ";}
     26        $html.="<EMBED src='".$flash_file.$u."library_path=".$library_path."&stage_width=".$width."&stage_height=".$height."&php_source=".$php_source;
     27        if($license!=null){$html.="&license=".$license;}
     28        $html.="' quality='high' bgcolor='#".$bg_color."' width='".$width."' height='".$height."' NAME='charts' allowScriptAccess='sameDomain' swLiveConnect='true' ";
     29        if($transparent){$html.="wmode=transparent ";} //use wmode=opaque to prevent printing on black
     30        $html.="TYPE='application/x-shockwave-flash' PLUGINSPAGE='".$protocol."://www.macromedia.com/go/getflashplayer'></EMBED></OBJECT>";
    4031        return $html;
    41        
    4232       
    4333}
     
    4535//====================================
    4636function SendChartData( $chart=array() ){
    47        
     37
     38        //header("Content-Type: text/xml");
     39        //header("Cache-Control: cache, must-revalidate");
     40        //header("Pragma: public");
    4841       
    4942        $xml="<chart>\r\n";
     
    6154                                                for($i3=0;$i3<count($Keys3);$i3++){
    6255                                                        switch(true){
    63                                                                 case ($chart[$Keys1[$i1]][$Keys2[$i2]][$Keys3[$i3]]==null):
     56                                                                case ($chart[$Keys1[$i1]][$Keys2[$i2]][$Keys3[$i3]]===null):
    6457                                                                $xml.="\t\t\t<null/>\r\n";
    6558                                                                break;
     
    8174                                                $count=0;
    8275                                                for($i3=0;$i3<count($Keys3);$i3++){
    83                                                         if($chart[$Keys1[$i1]][$Keys2[$i2]][$Keys3[$i3]]==null){$xml.="\t\t\t<null/>\r\n";}
     76                                                        if($chart[$Keys1[$i1]][$Keys2[$i2]][$Keys3[$i3]]===null){$xml.="\t\t\t<null/>\r\n";}
    8477                                                        else{$xml.="\t\t\t<string>".$chart[$Keys1[$i1]][$Keys2[$i2]][$Keys3[$i3]]."</string>\r\n";}
    8578                                                }
     
    9184                                                $count=0;
    9285                                                for($i3=0;$i3<count($Keys3);$i3++){
    93                                                         if($chart[$Keys1[$i1]][$Keys2[$i2]][$Keys3[$i3]]==null){$xml.="\t\t\t<null/>\r\n";}
     86                                                        if($chart[$Keys1[$i1]][$Keys2[$i2]][$Keys3[$i3]]===null){$xml.="\t\t\t<null/>\r\n";}
    9487                                                        else{$xml.="\t\t\t<string>".$chart[$Keys1[$i1]][$Keys2[$i2]][$Keys3[$i3]]."</string>\r\n";}
    9588                                                }
     
    125118                                        $xml.="\t<".$Keys1[$i1].">\r\n";
    126119                                        for($i2=0;$i2<count($Keys2);$i2++){
    127                                                 if($chart[$Keys1[$i1]][$Keys2[$i2]]==null){$xml.="\t\t<null/>\r\n";}
     120                                                if($chart[$Keys1[$i1]][$Keys2[$i2]]===null){$xml.="\t\t<null/>\r\n";}
    128121                                                else{$xml.="\t\t<value>".$chart[$Keys1[$i1]][$Keys2[$i2]]."</value>\r\n";}
    129122                                        }
     
    142135        }
    143136        $xml.="</chart>\r\n";
    144 /*        // stampa su file by Linuxap
    145         mt_srand ((double)microtime()*1000000);
    146         $maxran = 1000000;
    147         $random_num = mt_rand(0, $maxran);
    148         $fileout="./temp/$random_num";
    149         $fp = fopen($fileout,"w");
    150         fwrite($fp,$xml);
    151         fclose($fp);
    152 */
    153         //echo $xml;
    154 //MODIFICHE PER TOGLIERE FILETEMP
    155         return $xml; //return $fileout;
     137        echo $xml;
    156138}
    157139//====================================
Note: See TracChangeset for help on using the changeset viewer.