Changeset 10726

Show
Ignore:
Timestamp:
12/24/10 06:05:27 (2 years ago)
Author:
mbrevda
Message:

re #4566 - fix cdr limitations with bootstrap

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/branches/bootstrap/amp_conf/htdocs/admin/cdr/call-comp.php

    r10717 r10726  
    3838 
    3939//$link = DbConnect(); 
    40 $DBHandle  = DBHandle(); 
     40$DBHandle  = DbConnect(); 
    4141 
    4242// The variable Var_col would define the col that we want show in your table 
     
    4848Calldate Clid Src Dst Dcontext Channel Dstchannel Lastapp Lastdata Duration Billsec Disposition Amaflags Accountcode Uniqueid Serverid 
    4949*******/ 
    50 if (!@include($amp_conf['ASTETCDIR'].'/call-comp-table.php')) { 
     50if (!file_exists($amp_conf['ASTETCDIR'].'/call-log-table.php') || !@include($amp_conf['ASTETCDIR'].'/call-log-table.php')) { 
    5151 
    5252  $FG_TABLE_COL[]=array ("Calldate", "calldate", "18%", "center", "SORT", "19"); 
  • freepbx/branches/bootstrap/amp_conf/htdocs/admin/cdr/call-daily-load.php

    r10717 r10726  
    3838 
    3939//$link = DbConnect(); 
    40 $DBHandle  = DBHandle(); 
     40$DBHandle  = DbConnect(); 
    4141 
    4242$FG_TABLE_COL = array(); 
    4343 
    44 if (!@include($amp_conf['ASTETCDIR'].'/call-daily-load-table.php')) { 
     44if (!file_exists($amp_conf['ASTETCDIR'].'/call-log-table.php') || !@include($amp_conf['ASTETCDIR'].'/call-log-table.php')) { 
    4545  // The variable Var_col would define the col that we want show in your table 
    4646  // First Name of the column in the html page, second name of the field 
  • freepbx/branches/bootstrap/amp_conf/htdocs/admin/cdr/call-last-month.php

    r10717 r10726  
    3838 
    3939//$link = DbConnect(); 
    40 $DBHandle  = DBHandle(); 
     40$DBHandle  = DbConnect(); 
    4141 
    4242// The variable Var_col would define the col that we want show in your table 
     
    4848*******/ 
    4949 
    50 if (!@include($amp_conf['ASTETCDIR'].'/call-last-month-table.php')) { 
     50if (!file_exists($amp_conf['ASTETCDIR'].'/call-log-table.php') || !@include($amp_conf['ASTETCDIR'].'/call-log-table.php')) { 
    5151 
    5252  $FG_TABLE_COL[]=array ("Calldate", "calldate", "18%", "center", "SORT", "19"); 
  • freepbx/branches/bootstrap/amp_conf/htdocs/admin/cdr/call-log.php

    r10717 r10726  
    8383 
    8484/* --AMP Begin-- */ 
    85 if (!@include($amp_conf['ASTETCDIR'].'/call-log-table.php')) { 
     85if (!file_exists($amp_conf['ASTETCDIR'].'/call-log-table.php') || !@include($amp_conf['ASTETCDIR'].'/call-log-table.php')) { 
    8686 
    8787  $FG_TABLE_COL[]=array ("Calldate", "calldate", "18%", "center", "SORT", "19"); 
     
    266266/* --AMP BEGIN-- */ 
    267267//enforce restrictions for this AMP User 
    268 @session_start(); 
     268if(!isset($_SESSION)) { 
     269  @session_start(); 
     270
     271 
    269272$AMP_CLAUSE = $_SESSION['AMP_SQL']; 
    270273if (!isset($AMP_CLAUSE)) { 
  • freepbx/branches/bootstrap/amp_conf/htdocs/admin/cdr/cdr.php

    r10717 r10726  
    44 
    55/* -- AMP Begin -- */ 
    6 /* 
     6 
     7$low = $_SESSION["AMP_user"]->_extension_low; 
     8$high = $_SESSION["AMP_user"]->_extension_high; 
     9if ((!empty($low)) && (!empty($high))) { 
     10  $channelfilter="OR (FIELD( SUBSTRING_INDEX( channel, '/', 1 ) , 'SIP', 'IAX2' ) > 0 AND SUBSTRING_INDEX(SUBSTRING(channel,2+LENGTH(SUBSTRING_INDEX( channel, '/', 1 ))),'-',1) BETWEEN $low and $high)"; 
     11  $channelfilter.="OR (dstchannel<>'' AND FIELD( SUBSTRING_INDEX( dstchannel, '/', 1 ) , 'SIP', 'IAX2' ) > 0 AND SUBSTRING_INDEX(SUBSTRING(dstchannel,2+LENGTH(SUBSTRING_INDEX( dstchannel, '/', 1 ))),'-',1) BETWEEN $low and $high)"; 
     12 
     13        $_SESSION["AMP_SQL"] = " AND ((src+0 BETWEEN $low AND $high) OR (dst+0 BETWEEN $low AND $high) OR (dst+0 BETWEEN 8$low AND 8$high) $channelfilter)"; 
     14} else { 
     15  $_SESSION["AMP_SQL"] = ""; 
     16
     17 
    718$AMP_CLAUSE = $_SESSION['AMP_SQL']; 
    819if (!isset($AMP_CLAUSE)) { 
     
    1021  echo "<font color=red>YOU MUST ACCESS THE CDR THROUGH THE ASTERISK MANAGEMENT PORTAL!</font>"; 
    1122} 
    12 */ 
     23 
    1324//echo 'AMP_CLAUSE='.$AMP_CLAUSE.'<hr>'; 
    1425/* -- AMP End -- */ 
     
    3041} 
    3142 
    32  
    33  
    3443cdrpage_getpost_ifset(array('s', 't')); 
    3544 
     45$get_vars = array( 
     46'accountcode', 
     47'accountcodetype', 
     48'after', 
     49'atmenu', 
     50'before', 
     51'channel', 
     52'clid', 
     53'clidtype', 
     54'duration1', 
     55'duration1type', 
     56'duration2', 
     57'duration2type', 
     58'dst', 
     59'dsttype', 
     60'fromday', 
     61'frommonth', 
     62'fromstatsday_sday', 
     63'fromstatsmonth', 
     64'fromstatsmonth_sday', 
     65'letter',  
     66'list', 
     67'list_total', 
     68'list_total_day', 
     69'min_call', 
     70'name', 
     71'nb_record', 
     72'order', 
     73'posted', 
     74'resulttype', 
     75's', 
     76'sens', 
     77'sql_limit', 
     78'src', 
     79'srctype', 
     80'stitle', 
     81't', 
     82'today', 
     83'tomonth', 
     84'tostatsday_sday', 
     85'tostatsmonth_sday', 
     86'tostatsmonth', 
     87'totalcall', 
     88'userfield', 
     89'userfieldtype', 
     90'AMP_SQL', 
     91'FG_ACTION_SIZE_COLUMN', 
     92'FG_DELETION', 
     93'Period', 
     94'SQLcmd', 
     95); 
    3696 
     97foreach ($get_vars as $gv) { 
     98  if (!isset($$gv) || !$$gv) { 
     99    $$gv = isset($_REQUEST[$gv]) ? $_REQUEST[$gv] : ''; 
     100  } 
     101} 
    37102$array = array ("INTRO", "CDR REPORT", "CALLS COMPARE", "MONTHLY TRAFFIC","DAILY LOAD", "CONTACT"); 
    38103$s = $s ? $s : 1; 
     
    68133<?php if ($section=="section0"){?> 
    69134 
    70 <h1> 
    71  <center>ASTERISK : CDR ANALYSER</center> 
    72 </h1> 
    73             <h3>Call data collection</h3> 
    74             <p>Regardless of their size, most telephone PBX (public branch exchange) and PMS (property management systems) 
    75             output <b>Call Detail Records (CDR)</b>. Generally, these get created at the end of a call but on some phone systems 
    76             the data is available during the call. This data is output from the phone system by a serial link known as the 
    77             Station Message Detail Recording port (SMDR). <b>Some of the details included in call records are: Time, Date, Call 
    78             Duration, Number dialed, Caller ID information, Extension, Line/trunk location, Cost, Call completion status.</b><br> 
    79             <br> 
    80             Call detail records, both local and long distance, can be used for usage verification, billing reconciliation, 
    81             network management and to monitor telephone usage to determine volume of phone usage, as well as abuse of the system.  
    82             CDR's aid in the planning for future telecommunications needs. <br> 
    83             <br> 
    84             Control with CDR analysis: 
    85             <ul> 
    86  
    87               <li>review all CDR's for accuracy  
    88               <li>verify usage  
    89               <li>resolve discrepancies with vendors 
    90               <li>disconnect unused service  
    91               <li>terminate leases on unused equipment  
    92               <li>deter or detect fraud 
    93               <li>etc ... 
    94             </ul> 
    95  
    96135<?php }elseif ($section=="section1"){?> 
    97136 
    98137  <?php require("call-log.php");?> 
    99138 
    100  
    101139<?php }elseif ($section=="section2"){?> 
    102140 
    103141  <?php require("call-comp.php");?> 
    104  
    105142 
    106143<?php }elseif ($section=="section3"){?> 
     
    111148 
    112149  <?php require("call-daily-load.php");?> 
    113  
    114  
    115 <?php }elseif ($section=="section5"){?> 
    116     <h1>Contact</h1>             
    117         <table width="90%"> 
    118            
    119       <tr>  
    120             <td> 
    121         <h3>Arezqui Bela&iuml;d <br> <i>Barcelona - Belgium</i></h3>         
    122         <br> 
    123         <a href='javascript:bite("3721 945 4728 2762 3565 3554 2008 1380 654 3721 3554 4468 3007 3877 4828 654",5123,2981)'>Click to email me</a> 
    124         <br><br><i>Feel free to send me your suggestions to improve the application ;)</i> 
    125             </td> 
    126           </tr>           
    127            
    128         </table> 
    129     <br><br><em><strong>Last update:</strong></em> <?php echo $update?><br> 
    130  
    131150 
    132151<?php }else{?> 
  • freepbx/branches/bootstrap/amp_conf/htdocs/admin/cdr/common/graph_hourdetail.php

    r10243 r10726  
    11<?php /* $Id: graph_hourdetail.php 6816 2008-09-19 18:33:18Z p_lindheimer $ */ 
     2if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } 
    23include_once(dirname(__FILE__) . "/../lib/defines.php"); 
    34include_once(dirname(__FILE__) . "/../lib/Class.Table.php"); 
  • freepbx/branches/bootstrap/amp_conf/htdocs/admin/cdr/common/graph_pie.php

    r10243 r10726  
    11<?php /* $Id: graph_pie.php 6816 2008-09-19 18:33:18Z p_lindheimer $ */ 
     2if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } 
    23include_once(dirname(__FILE__) . "/../lib/defines.php"); 
    34include_once(dirname(__FILE__) . "/../lib/Class.Table.php"); 
  • freepbx/branches/bootstrap/amp_conf/htdocs/admin/cdr/common/graph_stat.php

    r10243 r10726  
    11<?php 
     2if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } 
    23include_once(dirname(__FILE__) . "/../lib/defines.php"); 
    34include_once(dirname(__FILE__) . "/../lib/Class.Table.php"); 
  • freepbx/branches/bootstrap/amp_conf/htdocs/admin/cdr/common/graph_statbar.php

    r10243 r10726  
    11<?php /* $Id: graph_statbar.php 6816 2008-09-19 18:33:18Z p_lindheimer $ */ 
     2if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } 
    23include_once(dirname(__FILE__) . "/../lib/defines.php"); 
    34include_once(dirname(__FILE__) . "/../lib/Class.Table.php"); 
  • freepbx/branches/bootstrap/amp_conf/htdocs/admin/cdr/export_csv.php

    r173 r10726  
    11<?php 
     2if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } 
    23include_once(dirname(__FILE__) . "/lib/defines.php"); 
    34include_once(dirname(__FILE__) . "/lib/Class.Table.php"); 
  • freepbx/branches/bootstrap/amp_conf/htdocs/admin/cdr/export_pdf.php

    r188 r10726  
    11<?php 
     2if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } 
    23include_once(dirname(__FILE__) . "/lib/defines.php"); 
    34include_once(dirname(__FILE__) . "/lib/Class.Table.php"); 
  • freepbx/branches/bootstrap/amp_conf/htdocs/admin/cdr/lib/Class.Table.php

    r6002 r10726  
    11<?php 
    2  
     2if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } 
    33class Table { 
    44 
     
    1616      $this -> table = $table; 
    1717      $this -> fields = $liste_fields; 
     18    $this->db = DbConnect(); 
    1819 
    1920  } 
     
    3940 
    4041  function Get_list ($clause=null, $order=null, $sens=null, $field_order_letter=null, $letters = null, $limite=null, $current_record=NULL) { 
    41     //global $link; 
    42     global $DBHandle; 
    43  
    44  
    4542    $sql = 'SELECT '.$this -> fields.' FROM '.trim($this -> table); 
    4643 
     
    7875    $QUERY = $sql.$sql_clause.$sql_orderby.$sql_limit;     
    7976    if ($this -> debug_st) echo "<br>QUERY:".$QUERY; 
    80          
    81     //$res=DbExec($link, $QUERY); 
    82     $res = $DBHandle -> query($QUERY); 
     77 
     78    $res = $this->db->query($QUERY); 
    8379    if(DB::isError($res)) 
    8480    { 
     
    108104 
    109105  function Table_count ($clause=null) { 
    110     //global $link; 
    111     global $DBHandle; 
    112  
    113  
    114106    $sql = 'SELECT count(*) FROM '.trim($this -> table); 
    115107 
     
    124116    //echo $sql; 
    125117     
    126     if ($this -> debug_st) echo "<br>QUERY:".$QUERY; 
    127     //$res=DbExec($link, $QUERY);    
    128     $res = $DBHandle -> query($QUERY); 
     118    if ($this -> debug_st) echo "<br>QUERY:".$QUERY;     
     119    $res = $this->db->query($QUERY); 
    129120 
    130121    /////$num=DbCount($res); 
     
    143134 
    144135  function Add_table ($value, $func_fields = null, $func_table = null, $id_name = null) { 
    145     //global $link; 
    146     global $DBHandle; 
    147  
    148136    if ($func_fields!=""){     
    149137      $this -> fields = $func_fields; 
     
    158146    if ($this -> debug_st) echo "<br>QUERY:".$QUERY; 
    159147 
    160     $res = $DBHandle -> query($QUERY); 
     148    $res = dbquery($QUERY); 
    161149 
    162150    if (DB::isError($res)){ 
    163151    //if (! $res=DbExec($link, $QUERY)) { 
    164152      //$this -> errstr = "Could not create a new instance in the table '".$this -> table."'";         
    165             $this -> errstr = $DBHandle -> getMessage();                                       
     153            $this -> errstr = $this->db->getMessage();                                       
    166154 
    167155       
     
    177165        $sql = 'SELECT "'.$id_name.'" FROM "'.$this -> table.'" WHERE oid=\''.$oid.'\''; 
    178166 
    179         if (! $res = $DBHandle -> query($sql)) return (false); 
     167        if (! $res = $this->db->query($sql)) return (false); 
    180168         
    181169        $row [] =$res -> fetchRow(); 
     
    189177 
    190178  function Update_table ($param_update, $clause, $func_table = null) { 
    191     //global $link; 
    192     global $DBHandle; 
    193  
    194179    if ($param_update=="" || $clause==""){ 
    195180      echo "<br>Update parameters wasn't correctly defined.<br>Check the function call 'Update_table'."; 
     
    206191 
    207192     
    208     if (! $res = $DBHandle -> query($QUERY)){ 
     193    if (! $res = $this->db->query($QUERY)){ 
    209194    //if (! $res=DbExec($link, $QUERY)) { 
    210195      $this -> errstr = "Could not update the instances of the table '".$this -> table."'";    
     
    218203 
    219204  function Delete_table ($clause, $func_table = null) { 
    220     //global $link; 
    221     global $DBHandle; 
    222  
    223205    if ($clause==""){ 
    224206      echo "<br>Delete parameters wasn't correctly defined.<br>Check the function call 'Update_table'."; 
     
    234216    if ($this -> debug_st) echo "<br>QUERY:".$QUERY; 
    235217     
    236     if (! $res = $DBHandle -> query($QUERY)){ 
     218    if (! $res = $this->db->query($QUERY)){ 
    237219    //if (! $res=DbExec($link, $QUERY)) { 
    238220      $this -> errstr = "Could not delete the instances of the table '".$this -> table."'";    
  • freepbx/branches/bootstrap/amp_conf/htdocs/admin/cdr/lib/defines.php

    r10717 r10726  
    11<?php /* $Id$ */ 
    2  
     2if (!@include_once(getenv('FREEPBX_CONF') ? getenv('FREEPBX_CONF') : '/etc/freepbx.conf')) { 
     3  include_once('/etc/asterisk/freepbx.conf'); 
     4
     5if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } 
    36require_once('DB.php'); // PEAR 
    47 
  • freepbx/branches/bootstrap/amp_conf/htdocs/admin/cdr/lib/fpdf.php

    r173 r10726  
    99* Vous pouvez utiliser et modifier ce logiciel comme vous le souhaitez.        * 
    1010*******************************************************************************/ 
    11  
     11if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } 
    1212if(!class_exists('FPDF')) 
    1313{ 
  • freepbx/branches/bootstrap/amp_conf/htdocs/admin/cdr/lib/iam_csvdump.php

    r173 r10726  
    11<?php 
    2  
     2if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } 
    33/** 
    44 *  IAM_CSVDump A class form performing a query dump and sending it to the browser or setting it or download. 
     
    88 /** 
    99 *  IAM_CSVDump A class form performing a query dump and sending it to the browser or setting it or download. 
    10  *  @author     Iván Ariel Melgrati <phpclasses@imelgrat.mailshell.com> 
     10 *  @author     Iván Ariel Melgrati <phpclasses@imelgrat.mailshell.com> 
    1111 *  @package    iam_csvdump 
    1212 *  @version 1.0 
  • freepbx/branches/bootstrap/amp_conf/htdocs/admin/reports.php

    r10671 r10726  
    1212//GNU General Public License for more details. 
    1313$restrict_mods = true; 
    14 require_once('bootstrap.php'); 
     14if (!@include_once(getenv('FREEPBX_CONF') ? getenv('FREEPBX_CONF') : '/etc/freepbx.conf')) { 
     15  include_once('/etc/asterisk/freepbx.conf'); 
     16
    1517if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } 
    1618$quietmode = isset($_REQUEST['quietmode'])?$_REQUEST['quietmode']:'';