Changeset 12191
- Timestamp:
- 05/25/11 03:21:41 (2 years ago)
- Files:
-
- modules/branches/2.10/setcid/functions.inc.php (modified) (6 diffs)
- modules/branches/2.10/setcid/install.php (modified) (1 diff)
- modules/branches/2.10/setcid/module.xml (modified) (2 diffs)
- modules/branches/2.10/setcid/page.setcid.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/branches/2.10/setcid/functions.inc.php
r11290 r12191 6 6 switch ($engine) { 7 7 case 'asterisk': 8 $ext->addInclude('from-internal-additional', 'app-setcid'); 8 9 foreach (setcid_list() as $row) { 9 10 $ext->add('app-setcid',$row['cid_id'], '', new ext_noop('('.$row['description'].') Changing cid to '.$row['cid_name'].' <'. $row['cid_num'].'>')); 10 11 $ext->add('app-setcid',$row['cid_id'], '', new ext_set('CALLERID(name)', $row['cid_name'])); 11 12 $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'])); 13 14 } 14 15 break; … … 22 23 $sql = "SELECT cid_id, description, cid_name, cid_num, dest FROM setcid ORDER BY description "; 23 24 $results = $db->getAll($sql, DB_FETCHMODE_ASSOC); 24 if( DB::IsError($results)) {25 if($db->IsError($results)) { 25 26 die_freepbx($results->getMessage()."<br><br>Error selecting from setcid"); 26 27 } … … 48 49 $sql = "SELECT cid_id, description, cid_name, cid_num, dest FROM setcid WHERE cid_id = ".$db->escapeSimple($cid_id); 49 50 $row = $db->getRow($sql, DB_FETCHMODE_ASSOC); 50 if( DB::IsError($row)) {51 if($db->IsError($row)) { 51 52 die_freepbx($row->getMessage()."<br><br>Error selecting row from setcid"); 52 53 } … … 63 64 "'".$db->escapeSimple($dest)."')"; 64 65 $result = $db->query($sql); 65 if( DB::IsError($result)) {66 if($db->IsError($result)) { 66 67 die_freepbx($result->getMessage().$sql); 67 68 } … … 72 73 $sql = "DELETE FROM setcid WHERE cid_id = ".$db->escapeSimple($cid_id); 73 74 $result = $db->query($sql); 74 if( DB::IsError($result)) {75 if($db->IsError($result)) { 75 76 die_freepbx($result->getMessage().$sql); 76 77 } … … 86 87 "WHERE cid_id = ".$db->escapeSimple($cid_id); 87 88 $result = $db->query($sql); 88 if( DB::IsError($result)) {89 if($db->IsError($result)) { 89 90 die_freepbx($result->getMessage().$sql); 90 91 } modules/branches/2.10/setcid/install.php
r11419 r12191 4 4 5 5 $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 ( 7 7 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 ) , 10 10 description VARCHAR( 50 ) , 11 11 dest VARCHAR( 255 ) 12 12 )"; 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);'; 13 15 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"); 16 foreach ($sql as $q) { 17 $check = $db->query($q); 18 if($db->IsError($check)) { 19 die_freepbx("Can not create setcid table\n"); 28 20 } 29 21 } 30 22 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 39 24 ?> modules/branches/2.10/setcid/module.xml
r11430 r12191 3 3 <repo>unsupported</repo> 4 4 <name>Set CallerID</name> 5 <version>2.9.0. 1</version>5 <version>2.9.0.2</version> 6 6 <type>setup</type> 7 7 <category>Third Party Addon</category> … … 13 13 </menuitems> 14 14 <changelog> 15 *2.9.0.2* #5180 15 16 *2.9.0.1* #4606 16 17 *2.9.0.0* 2.9 version moved to repo modules/branches/2.10/setcid/page.setcid.php
r11419 r12191 70 70 if ($extdisplay) { 71 71 // 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']; 78 78 79 79 echo "<h2>"._("Edit: ")."$description ($cid_name)"."</h2>"; … … 94 94 $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."); 95 95 echo $helptext; 96 echo isset($row['dest']) ? $row['dest'] : '';96 echo $row['dest']; 97 97 98 98 … … 112 112 <tr> 113 113 <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> 115 115 <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> 117 117 <tr><td colspan="2"><br><h5><?php echo _("Destination")?>:<hr></h5></td></tr> 118 118
