Changeset 12191

Show
Ignore:
Timestamp:
05/25/11 03:21:41 (2 years ago)
Author:
mbrevda
Message:

closes #5180 - some setcid updates

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.10/setcid/functions.inc.php

    r11290 r12191  
    66  switch ($engine) { 
    77    case 'asterisk': 
     8      $ext->addInclude('from-internal-additional', 'app-setcid'); 
    89      foreach (setcid_list() as $row) { 
    910          $ext->add('app-setcid',$row['cid_id'], '', new ext_noop('('.$row['description'].') Changing cid to '.$row['cid_name'].' <'. $row['cid_num'].'>')); 
    1011          $ext->add('app-setcid',$row['cid_id'], '', new ext_set('CALLERID(name)', $row['cid_name'])); 
    1112          $ext->add('app-setcid',$row['cid_id'], '', new ext_set('CALLERID(num)', $row['cid_num'])); 
    12           $ext->add('app-setcid',$row['cid_id'], '', new ext_goto($row['dest'])); 
     13               $ext->add('app-setcid',$row['cid_id'], '', new ext_goto($row['dest'])); 
    1314      } 
    1415    break; 
     
    2223  $sql = "SELECT cid_id, description, cid_name, cid_num, dest FROM setcid ORDER BY description "; 
    2324  $results = $db->getAll($sql, DB_FETCHMODE_ASSOC); 
    24   if(DB::IsError($results)) { 
     25  if($db->IsError($results)) { 
    2526    die_freepbx($results->getMessage()."<br><br>Error selecting from setcid");   
    2627  } 
     
    4849  $sql = "SELECT cid_id, description, cid_name, cid_num, dest FROM setcid WHERE cid_id = ".$db->escapeSimple($cid_id); 
    4950  $row = $db->getRow($sql, DB_FETCHMODE_ASSOC); 
    50   if(DB::IsError($row)) { 
     51  if($db->IsError($row)) { 
    5152    die_freepbx($row->getMessage()."<br><br>Error selecting row from setcid");   
    5253  } 
     
    6364    "'".$db->escapeSimple($dest)."')"; 
    6465  $result = $db->query($sql); 
    65   if(DB::IsError($result)) { 
     66  if($db->IsError($result)) { 
    6667    die_freepbx($result->getMessage().$sql); 
    6768  } 
     
    7273  $sql = "DELETE FROM setcid WHERE cid_id = ".$db->escapeSimple($cid_id); 
    7374  $result = $db->query($sql); 
    74   if(DB::IsError($result)) { 
     75  if($db->IsError($result)) { 
    7576    die_freepbx($result->getMessage().$sql); 
    7677  } 
     
    8687    "WHERE cid_id = ".$db->escapeSimple($cid_id); 
    8788  $result = $db->query($sql); 
    88   if(DB::IsError($result)) { 
     89  if($db->IsError($result)) { 
    8990    die_freepbx($result->getMessage().$sql); 
    9091  } 
  • modules/branches/2.10/setcid/install.php

    r11419 r12191  
    44 
    55$autoincrement = (($amp_conf["AMPDBENGINE"] == "sqlite") || ($amp_conf["AMPDBENGINE"] == "sqlite3")) ? "AUTOINCREMENT":"AUTO_INCREMENT"; 
    6 $sql = "CREATE TABLE IF NOT EXISTS setcid ( 
     6$sql[] = "CREATE TABLE IF NOT EXISTS setcid ( 
    77  cid_id INTEGER NOT NULL PRIMARY KEY $autoincrement, 
    8   cid_name VARCHAR( 255 ) , 
    9   cid_num VARCHAR( 255 ) , 
     8  cid_name VARCHAR( 150 ) , 
     9  cid_num VARCHAR( 150 ) , 
    1010  description VARCHAR( 50 ) , 
    1111  dest VARCHAR( 255 ) 
    1212)"; 
     13$sql[] = 'alter table setcid change column cid_name cid_name varchar(150);'; 
     14$sql[] = 'alter table setcid change column cid_num cid_num varchar(150);'; 
    1315 
    14 $check = $db->query($sql); 
    15 if(DB::IsError($check)) { 
    16   die_freepbx("Can not create setcid table\n"); 
    17 
    18  
    19 //migrate name/num to larger size 
    20 out(_('Migrating Name/Num filed size')); 
    21 $table = $db->getAssoc('DESCRIBE `setcid`', true, array(), DB_FETCHMODE_ASSOC); 
    22 $name = str_replace(array('(', ')'), ' ', $table['cid_name']['Type']); 
    23 $name = explode(' ', $name); 
    24 if ($name[1] == '50') { 
    25   $q = $db->query('ALTER TABLE `setcid` CHANGE cid_name cid_name VARCHAR( 255 )'); 
    26   if($db->IsError($q)) { 
    27     die_freepbx("Can not migrate setcid\n"); 
     16foreach ($sql as $q) { 
     17  $check = $db->query($q); 
     18  if($db->IsError($check)) { 
     19    die_freepbx("Can not create setcid table\n"); 
    2820  } 
    2921} 
    3022 
    31 $num = str_replace(array('(', ')'), ' ', $table['cid_num']['Type']); 
    32 $num = explode(' ', $num); 
    33 if ($num[1] == '50') { 
    34   $q = $db->query('ALTER TABLE `setcid` CHANGE cid_num cid_num VARCHAR( 255 )'); 
    35   if($db->IsError($q)) { 
    36     die_freepbx("Can not migrate setcid\n"); 
    37   } 
    38 
     23 
    3924?> 
  • modules/branches/2.10/setcid/module.xml

    r11430 r12191  
    33  <repo>unsupported</repo> 
    44  <name>Set CallerID</name> 
    5   <version>2.9.0.1</version> 
     5  <version>2.9.0.2</version> 
    66  <type>setup</type> 
    77  <category>Third Party Addon</category> 
     
    1313  </menuitems> 
    1414  <changelog> 
     15    *2.9.0.2* #5180 
    1516    *2.9.0.1* #4606 
    1617    *2.9.0.0* 2.9 version moved to repo 
  • modules/branches/2.10/setcid/page.setcid.php

    r11419 r12191  
    7070if ($extdisplay) { 
    7171  // load 
    72   $row     = setcid_get($extdisplay); 
    73    
    74   $description = $row['description']; 
    75   $cid_name    = $row['cid_name']
    76   $cid_num   = $row['cid_num']
    77   $dest      = $row['dest']; 
     72  $row = setcid_get($extdisplay); 
     73  dbug('$row', $row); 
     74  $description = $row['description']; 
     75  $cid_name   = htmlspecialchars($row['cid_name'])
     76  $cid_num   = htmlspecialchars($row['cid_num'])
     77  $dest      = $row['dest']; 
    7878 
    7979  echo "<h2>"._("Edit: ")."$description ($cid_name)"."</h2>"; 
     
    9494$helptext = _("Set CallerID allows you to change the caller id of the call and then continue on to the desired destination. For example, you may want to change the caller id form \"John Doe\" to \"Sales: John Doe\". Please note, the text you enter is what the callerid is changed to. To append to the current callerid, use the proper asterisk variables, such as \"\${CALLERID(name)}\" for the currently set callerid name and \"\${CALLERID(num)}\" for the currently set callerid number."); 
    9595echo $helptext; 
    96 echo isset($row['dest']) ? $row['dest'] : ''
     96echo $row['dest']
    9797 
    9898 
     
    112112  <tr> 
    113113    <td><a href="#" class="info"><?php echo _("CallerID Name")?>:<span><?php echo _("The CallerID Name that you want to change to. If you are appending to the current callerid, dont forget to include the appropriate asterisk variables. If you leave this box blank, the CallerID name will be blanked");?></span></a></td> 
    114     <td><input size="30" type="text" name="cid_name" value="<?php echo htmlentities($cid_name); ?>"  tabindex="<?php echo ++$tabindex;?>"/></td> </tr> 
     114    <td><input size="30" type="text" name="cid_name" value="<?php echo $cid_name; ?>"  tabindex="<?php echo ++$tabindex;?>"/></td> </tr> 
    115115    <td><a href="#" class="info"><?php echo _("CallerID Number")?>:<span><?php echo _("The CallerID Number that you want to change to. If you are appending to the current callerid, dont forget to include the appropriate asterisk variables. If you leave this box blank, the CallerID number will be blanked");?></span></a></td> 
    116     <td><input size="30" type="text" name="cid_num" value="<?php echo htmlentities($cid_num); ?>"  tabindex="<?php echo ++$tabindex;?>"/></td> </tr> 
     116    <td><input size="30" type="text" name="cid_num" value="<?php echo $cid_num; ?>"  tabindex="<?php echo ++$tabindex;?>"/></td> </tr> 
    117117  <tr><td colspan="2"><br><h5><?php echo _("Destination")?>:<hr></h5></td></tr> 
    118118