Ticket #2695: addprotocols.patch
| File addprotocols.patch, 41.1 kB (added by robmac, 9 months ago) |
|---|
-
functions.inc.php
old new 3 3 class core_conf { 4 4 var $_sip_general = array(); 5 5 var $_iax_general = array(); 6 var $_h323_general = array(); 7 var $_mgcp_general = array(); 8 var $_skinny_general = array(); 6 9 var $_featuregeneral = array(); 7 10 var $_featuremap = array(); 8 11 var $_applicationmap = array(); 9 12 // return an array of filenames to write 10 13 function get_filename() { 11 14 $files = array( 15 'zapata_additional.conf', 12 16 'sip_additional.conf', 13 17 'sip_registrations.conf', 18 'sip_general_additional.conf', 14 19 'iax_additional.conf', 15 20 'iax_registrations.conf', 16 'zapata_additional.conf',17 'sip_general_additional.conf',18 21 'iax_general_additional.conf', 22 'ooh323_additional.conf', 23 'ooh323_registrations.conf', 24 'ooh323_general_additional.conf', 25 'mgcp_additional.conf', 26 'mgcp_registrations.conf', 27 'mgcp_general_additional.conf', 28 'skinny_additional.conf', 29 'skinny_registrations.conf', 30 'skinny_general_additional.conf', 19 31 'features_general_additional.conf', 20 32 'features_applicationmap_additional.conf', 21 33 'features_featuremap_additional.conf', … … 46 58 case 'iax_registrations.conf': 47 59 return $this->generate_iax_registrations($version); 48 60 break; 49 case 'zapata_additional.conf': 61 case 'ooh323_general_additional.conf': 62 return $this->generate_h323_general_additional($version); 63 break; 64 case 'ooh323_additional.conf': 65 return $this->generate_h323_additional($version); 66 break; 67 case 'ooh323_registrations.conf': 68 return $this->generate_h323_registrations($version); 69 break; 70 case 'mgcp_general_additional.conf': 71 return $this->generate_mgcp_general_additional($version); 72 break; 73 case 'mgcp_additional.conf': 74 return $this->generate_mgcp_additional($version); 75 break; 76 case 'mgcp_registrations.conf': 77 return $this->generate_mgcp_registrations($version); 78 break; 79 case 'skinny_general_additional.conf': 80 return $this->generate_skinny_general_additional($version); 81 break; 82 case 'skinny_additional.conf': 83 return $this->generate_skinny_additional($version); 84 break; 85 case 'skinny_registrations.conf': 86 return $this->generate_skinny_registrations($version); 87 break; 88 case 'zapata_additional.conf': 50 89 return $this->generate_zapata_additional($version); 51 90 break; 52 91 case 'features_general_additional.conf': … … 91 130 return $output; 92 131 } 93 132 133 function addH323General($key, $value) { 134 $this->_h323_general[] = array('key' => $key, 'value' => $value); 135 } 136 137 function generate_h323_general_additional($ast_version) { 138 $output = ''; 139 140 if (isset($this->_h323_general) && is_array($this->_h323_general)) { 141 foreach ($this->_h323_general as $values) { 142 $output .= $values['key']."=".$values['value']."\n"; 143 } 144 } 145 return $output; 146 } 147 148 function addMgcpGeneral($key, $value) { 149 $this->_mgcp_general[] = array('key' => $key, 'value' => $value); 150 } 151 152 function generate_mgcp_general_additional($ast_version) { 153 $output = ''; 154 155 if (isset($this->_mgcp_general) && is_array($this->_mgcp_general)) { 156 foreach ($this->_mgcp_general as $values) { 157 $output .= $values['key']."=".$values['value']."\n"; 158 } 159 } 160 return $output; 161 } 162 163 function addSkinnyGeneral($key, $value) { 164 $this->_skinny_general[] = array('key' => $key, 'value' => $value); 165 } 166 167 function generate_skinny_general_additional($ast_version) { 168 $output = ''; 169 170 if (isset($this->_skinny_general) && is_array($this->_skinny_general)) { 171 foreach ($this->_skinny_general as $values) { 172 $output .= $values['key']."=".$values['value']."\n"; 173 } 174 } 175 return $output; 176 } 177 94 178 function addFeatureGeneral($key, $value) { 95 179 $this->_featuregeneral[] = array('key' => $key, 'value' => $value); 96 180 } … … 180 264 if(DB::IsError($results)) { 181 265 die($results->getMessage()); 182 266 } 183 267 268 foreach ($results as $result) { 269 $account = $result['data']; 270 $id = $result['id']; 271 $output .= "[$account]\n"; 272 273 $sql = "SELECT keyword,data from $table_name where id='$id' and keyword <> 'account' and flags <> 1 order by flags, keyword DESC"; 274 $results2 = $db->getAll($sql, DB_FETCHMODE_ASSOC); 275 if(DB::IsError($results2)) { 276 die($results2->getMessage()); 277 } 278 foreach ($results2 as $result2) { 279 $options = explode("&", $result2['data']); 280 if ($ver12) { 281 foreach ($options as $option) { 282 $output .= $result2['keyword']."=$option\n"; 283 } 284 } else { 285 foreach ($options as $option) { 286 switch ($result2['keyword']) { 287 case 'allow': 288 case 'disallow': 289 if ($option != '') 290 $output .= $result2['keyword']."=$option\n"; 291 break; 292 default: 293 $output .= $result2['keyword']."=$option\n"; 294 } 295 } 296 } 297 } 298 if ($call_limit && (substr($id,0,4) != "9999" | $id < 99990)) { 299 300 $output .= $call_limit; 301 } 302 $output .= $additional."\n"; 303 } 304 return $output; 305 } 306 307 function generate_sip_registrations($ast_version) { 308 global $db; 309 310 $table_name = "sip"; 311 $output = ""; 312 313 // items with id like 9999999% get put in registrations file 314 // 315 $sql = "SELECT keyword,data from $table_name where id LIKE '9999999%' and keyword <> 'account' and flags <> 1"; 316 $results = $db->getAll($sql, DB_FETCHMODE_ASSOC); 317 if(DB::IsError($results)) { 318 die($results->getMessage()); 319 } 320 321 foreach ($results as $result) { 322 $output .= $result['keyword']."=".$result['data']."\n"; 323 } 324 325 return $output; 326 } 327 328 function generate_iax_additional($ast_version) { 329 global $db; 330 331 $table_name = "iax"; 332 $additional = ""; 333 $output = ""; 334 335 $ver12 = version_compare($ast_version, '1.4', 'lt'); 336 337 $sql = "SELECT keyword,data from $table_name where id=-1 and keyword <> 'account' and flags <> 1"; 338 $results = $db->getAll($sql, DB_FETCHMODE_ASSOC); 339 if(DB::IsError($results)) { 340 die($results->getMessage()); 341 } 342 foreach ($results as $result) { 343 if ($ver12) { 344 $additional .= $result['keyword']."=".$result['data']."\n"; 345 } else { 346 $option = $result['data']; 347 switch ($result['keyword']) { 348 case 'notransfer': 349 if (strtolower($option) == 'yes') { 350 $additional .= "transfer=no\n"; 351 } else if (strtolower($option) == 'no') { 352 $additional .= "transfer=yes\n"; 353 } else if (strtolower($option) == 'mediaonly') { 354 $additional .= "transfer=mediaonly\n"; 355 } else { 356 $additional .= $result['keyword']."=$option\n"; 357 } 358 break; 359 case 'allow': 360 case 'disallow': 361 if ($option != '') 362 $additional .= $result['keyword']."=$option\n"; 363 break; 364 default: 365 $additional .= $result['keyword']."=$option\n"; 366 } 367 } 368 } 369 370 $sql = "SELECT data,id from $table_name where keyword='account' and flags <> 1 group by data"; 371 $results = $db->getAll($sql, DB_FETCHMODE_ASSOC); 372 if(DB::IsError($results)) { 373 die($results->getMessage()); 374 } 375 376 foreach ($results as $result) { 377 $account = $result['data']; 378 $id = $result['id']; 379 $output .= "[$account]\n"; 380 381 $sql = "SELECT keyword,data from $table_name where id='$id' and keyword <> 'account' and flags <> 1 order by flags, keyword DESC"; 382 $results2 = $db->getAll($sql, DB_FETCHMODE_ASSOC); 383 if(DB::IsError($results2)) { 384 die($results2->getMessage()); 385 } 386 foreach ($results2 as $result2) { 387 $options = explode("&", $result2['data']); 388 if ($ver12) { 389 foreach ($options as $option) { 390 $output .= $result2['keyword']."=$option\n"; 391 } 392 } else { 393 foreach ($options as $option) { 394 switch ($result2['keyword']) { 395 case 'notransfer': 396 if (strtolower($option) == 'yes') { 397 $output .= "transfer=no\n"; 398 } else if (strtolower($option) == 'no') { 399 $output .= "transfer=yes\n"; 400 } else if (strtolower($option) == 'mediaonly') { 401 $output .= "transfer=mediaonly\n"; 402 } else { 403 $output .= $result2['keyword']."=$option\n"; 404 } 405 break; 406 case 'allow': 407 case 'disallow': 408 if ($option != '') 409 $output .= $result2['keyword']."=$option\n"; 410 break; 411 default: 412 $output .= $result2['keyword']."=$option\n"; 413 } 414 } 415 } 416 } 417 $output .= $additional."\n"; 418 } 419 return $output; 420 } 421 422 function generate_iax_registrations($ast_version) { 423 global $db; 424 425 $table_name = "iax"; 426 $output = ""; 427 428 // items with id like 9999999% get put in the registration file 429 // 430 $sql = "SELECT keyword,data from $table_name where id LIKE '9999999%' and keyword <> 'account' and flags <> 1"; 431 $results = $db->getAll($sql, DB_FETCHMODE_ASSOC); 432 if(DB::IsError($results)) { 433 die($results->getMessage()); 434 } 435 436 foreach ($results as $result) { 437 $output .= $result['keyword']."=".$result['data']."\n"; 438 } 439 440 return $output; 441 } 442 443 function generate_h323_additional($ast_version) { 444 global $db; 445 446 $table_name = "h323"; 447 $additional = ""; 448 $output = ""; 449 450 $ver12 = version_compare($ast_version, '1.4', 'lt'); 451 452 $sql = "SELECT keyword,data from $table_name where id=-1 and keyword <> 'account' and flags <> 1"; 453 $results = $db->getAll($sql, DB_FETCHMODE_ASSOC); 454 if(DB::IsError($results)) { 455 die($results->getMessage()); 456 } 457 foreach ($results as $result) { 458 if ($ver12) { 459 $additional .= $result['keyword']."=".$result['data']."\n"; 460 } else { 461 $option = $result['data']; 462 switch ($result['keyword']) { 463 case 'notransfer': 464 if (strtolower($option) == 'yes') { 465 $additional .= "transfer=no\n"; 466 } else if (strtolower($option) == 'no') { 467 $additional .= "transfer=yes\n"; 468 } else if (strtolower($option) == 'mediaonly') { 469 $additional .= "transfer=mediaonly\n"; 470 } else { 471 $additional .= $result['keyword']."=$option\n"; 472 } 473 break; 474 case 'allow': 475 case 'disallow': 476 if ($option != '') 477 $additional .= $result['keyword']."=$option\n"; 478 break; 479 default: 480 $additional .= $result['keyword']."=$option\n"; 481 } 482 } 483 } 484 485 $sql = "SELECT data,id from $table_name where keyword='account' and flags <> 1 group by data"; 486 $results = $db->getAll($sql, DB_FETCHMODE_ASSOC); 487 if(DB::IsError($results)) { 488 die($results->getMessage()); 489 } 490 491 foreach ($results as $result) { 492 $account = $result['data']; 493 $id = $result['id']; 494 $output .= "[$account]\n"; 495 496 $sql = "SELECT keyword,data from $table_name where id='$id' and keyword <> 'account' and flags <> 1 order by flags, keyword DESC"; 497 $results2 = $db->getAll($sql, DB_FETCHMODE_ASSOC); 498 if(DB::IsError($results2)) { 499 die($results2->getMessage()); 500 } 501 foreach ($results2 as $result2) { 502 $options = explode("&", $result2['data']); 503 if ($ver12) { 504 foreach ($options as $option) { 505 $output .= $result2['keyword']."=$option\n"; 506 } 507 } else { 508 foreach ($options as $option) { 509 switch ($result2['keyword']) { 510 case 'notransfer': 511 if (strtolower($option) == 'yes') { 512 $output .= "transfer=no\n"; 513 } else if (strtolower($option) == 'no') { 514 $output .= "transfer=yes\n"; 515 } else if (strtolower($option) == 'mediaonly') { 516 $output .= "transfer=mediaonly\n"; 517 } else { 518 $output .= $result2['keyword']."=$option\n"; 519 } 520 break; 521 case 'allow': 522 case 'disallow': 523 if ($option != '') 524 $output .= $result2['keyword']."=$option\n"; 525 break; 526 default: 527 $output .= $result2['keyword']."=$option\n"; 528 } 529 } 530 } 531 } 532 $output .= $additional."\n"; 533 } 534 return $output; 535 } 536 537 function generate_h323_registrations($ast_version) { 538 global $db; 539 540 $table_name = "h323"; 541 $output = ""; 542 543 // items with id like 9999999% get put in the registration file 544 // 545 $sql = "SELECT keyword,data from $table_name where id LIKE '9999999%' and keyword <> 'account' and flags <> 1"; 546 $results = $db->getAll($sql, DB_FETCHMODE_ASSOC); 547 if(DB::IsError($results)) { 548 die($results->getMessage()); 549 } 550 551 foreach ($results as $result) { 552 $output .= $result['keyword']."=".$result['data']."\n"; 553 } 554 555 return $output; 556 } 557 558 function generate_mgcp_additional($ast_version) { 559 global $db; 560 561 $table_name = "mgcp"; 562 $additional = ""; 563 $output = ""; 564 565 $ver12 = version_compare($ast_version, '1.4', 'lt'); 566 567 $sql = "SELECT keyword,data from $table_name where id=-1 and keyword <> 'account' and flags <> 1"; 568 $results = $db->getAll($sql, DB_FETCHMODE_ASSOC); 569 if(DB::IsError($results)) { 570 die($results->getMessage()); 571 } 572 foreach ($results as $result) { 573 if ($ver12) { 574 $additional .= $result['keyword']."=".$result['data']."\n"; 575 } else { 576 $option = $result['data']; 577 switch ($result['keyword']) { 578 case 'notransfer': 579 if (strtolower($option) == 'yes') { 580 $additional .= "transfer=no\n"; 581 } else if (strtolower($option) == 'no') { 582 $additional .= "transfer=yes\n"; 583 } else if (strtolower($option) == 'mediaonly') { 584 $additional .= "transfer=mediaonly\n"; 585 } else { 586 $additional .= $result['keyword']."=$option\n"; 587 } 588 break; 589 case 'allow': 590 case 'disallow': 591 if ($option != '') 592 $additional .= $result['keyword']."=$option\n"; 593 break; 594 default: 595 $additional .= $result['keyword']."=$option\n"; 596 } 597 } 598 } 599 600 $sql = "SELECT data,id from $table_name where keyword='account' and flags <> 1 group by data"; 601 $results = $db->getAll($sql, DB_FETCHMODE_ASSOC); 602 if(DB::IsError($results)) { 603 die($results->getMessage()); 604 } 605 184 606 foreach ($results as $result) { 185 607 $account = $result['data']; 186 608 $id = $result['id']; … … 190 612 $results2 = $db->getAll($sql, DB_FETCHMODE_ASSOC); 191 613 if(DB::IsError($results2)) { 192 614 die($results2->getMessage()); 193 } 615 } 194 616 foreach ($results2 as $result2) { 195 617 $options = explode("&", $result2['data']); 196 618 if ($ver12) { … … 200 622 } else { 201 623 foreach ($options as $option) { 202 624 switch ($result2['keyword']) { 625 case 'notransfer': 626 if (strtolower($option) == 'yes') { 627 $output .= "transfer=no\n"; 628 } else if (strtolower($option) == 'no') { 629 $output .= "transfer=yes\n"; 630 } else if (strtolower($option) == 'mediaonly') { 631 $output .= "transfer=mediaonly\n"; 632 } else { 633 $output .= $result2['keyword']."=$option\n"; 634 } 635 break; 203 636 case 'allow': 204 637 case 'disallow': 205 638 if ($option != '') … … 211 644 } 212 645 } 213 646 } 214 if ($call_limit && (substr($id,0,4) != "9999" | $id < 99990)) {215 216 $output .= $call_limit;217 }218 647 $output .= $additional."\n"; 219 648 } 220 649 return $output; 221 650 } 222 651 223 function generate_ sip_registrations($ast_version) {652 function generate_mgcp_registrations($ast_version) { 224 653 global $db; 225 654 226 $table_name = " sip";655 $table_name = "mgcp"; 227 656 $output = ""; 228 657 229 // items with id like 9999999% get put in registrationsfile658 // items with id like 9999999% get put in the registration file 230 659 // 231 660 $sql = "SELECT keyword,data from $table_name where id LIKE '9999999%' and keyword <> 'account' and flags <> 1"; 232 661 $results = $db->getAll($sql, DB_FETCHMODE_ASSOC); … … 241 670 return $output; 242 671 } 243 672 244 function generate_ iax_additional($ast_version) {673 function generate_skinny_additional($ast_version) { 245 674 global $db; 246 675 247 $table_name = " iax";676 $table_name = "skinny"; 248 677 $additional = ""; 249 678 $output = ""; 250 679 … … 335 764 return $output; 336 765 } 337 766 338 function generate_ iax_registrations($ast_version) {767 function generate_skinny_registrations($ast_version) { 339 768 global $db; 340 769 341 $table_name = " iax";770 $table_name = "skinny"; 342 771 $output = ""; 343 772 344 773 // items with id like 9999999% get put in the registration file … … 598 1027 if (version_compare($version, '1.4', 'ge')) { 599 1028 $core_conf->addIaxGeneral('tos','ef'); // Recommended setting from doc/ip-tos.txt 600 1029 } 1030 $core_conf->addH323General('bindport','1720'); 1031 $core_conf->addH323General('bindaddr','0.0.0.0'); 1032 $core_conf->addH323General('h225portrange','12030,12230'); 1033 $core_conf->addH323General('h323id','ObjSysAsterisk'); 1034 $core_conf->addH323General('gatekeeper','DISABLE'); 1035 $core_conf->addH323General('faststart','no'); 1036 $core_conf->addH323General('rtptimeout','10'); 1037 $core_conf->addH323General('dtmfmode','rfc2833'); 1038 $core_conf->addH323General('canreinvite','no'); 1039 $core_conf->addH323General('disallow','all'); 1040 $core_conf->addH323General('allow','ulaw'); 1041 $core_conf->addH323General('allow','gsm'); 1042 $core_conf->addH323General('context','from-internal'); 1043 $core_conf->addMgcpGeneral('port','2427'); 1044 $core_conf->addMgcpGeneral('bindaddr','0.0.0.0'); 1045 $core_conf->addMgcpGeneral('canreinvite','no'); 1046 $core_conf->addMgcpGeneral('wcardep','*'); 1047 $core_conf->addSkinnyGeneral('port','2000'); 1048 $core_conf->addSkinnyGeneral('bindaddr','0.0.0.0'); 1049 $core_conf->addSkinnyGeneral('dateFormat','D-M-Y'); 1050 $core_conf->addSkinnyGeneral('keepAlive','120'); 601 1051 602 1052 $fcc = new featurecode($modulename, 'blindxfer'); 603 1053 $code = $fcc->getCodeActive(); … … 974 1424 continue; 975 1425 } 976 1426 switch ($trunkprops['tech']) { 1427 case 'H323': 977 1428 case 'IAX': 978 1429 case 'IAX2': 1430 case 'MGCP': 1431 case 'Skinny': 979 1432 case 'SIP': 980 1433 $trunkgroup = $trunkprops['globalvar']; 981 1434 $trunkcontext = "from-trunk-".strtolower($trunkprops['tech'])."-".$trunkprops['name']; … … 1647 2100 case "IAX": 1648 2101 $sql .= " WHERE tech = 'iax2'"; 1649 2102 break; 2103 case "H323": 1650 2104 case "IAX2": 2105 case "MGCP": 1651 2106 case "SIP": 2107 case "Skinny": 1652 2108 case "ZAP": 1653 2109 $sql .= " WHERE tech = '".strtolower($tech)."'"; 1654 2110 break; … … 1702 2158 } 1703 2159 //unless defined, $dial is TECH/id 1704 2160 if ( $dial == '' ) { 1705 //zap is an exception2161 //zap, h323, mgcp & skinny are exceptions 1706 2162 if ( strtolower($tech) == "zap" ) { 1707 2163 $zapchan = $_REQUEST['devinfo_channel'] != '' ? $_REQUEST['devinfo_channel'] : $_REQUEST['channel']; 1708 2164 $dial = 'ZAP/'.$zapchan; 2165 // } else if ( strtolower($tech) == "h323" ) { 2166 // $h323chan = $_REQUEST['devinfo_channel'] != '' ? $_REQUEST['devinfo_channel'] : $_REQUEST['channel']; 2167 // $dial = 'OOH323/'.$h323id."@".$ip; 2168 // } else if ( strtolower($tech) == "mgcp" ) { 2169 // $mgcpchan = $_REQUEST['devinfo_channel'] != '' ? $_REQUEST['devinfo_channel'] : $_REQUEST['channel']; 2170 // $dial = 'MGCP/'.$line."@".$account; 2171 // } else if ( strtolower($tech) == "skinny" ) { 2172 // $skinnychan = $_REQUEST['devinfo_channel'] != '' ? $_REQUEST['devinfo_channel'] : $_REQUEST['channel']; 2173 // $dial = 'Skinny/'.$line."@".$account; 1709 2174 } else { 1710 2175 $dial = strtoupper($tech)."/".$id; 1711 2176 } … … 1780 2245 exec("/bin/ln -s /var/spool/asterisk/voicemail/".$vmcontext."/".$user."/ /var/spool/asterisk/voicemail/device/".$id); 1781 2246 } 1782 2247 1783 //take care of sip/iax/zap config2248 //take care of sip/iax/zap/h323/mgcp/skinny config 1784 2249 $funct = "core_devices_add".strtolower($tech); 1785 2250 if(function_exists($funct)){ 1786 2251 $funct($id); … … 1844 2309 fatal("Cannot connect to Asterisk Manager with ".$amp_conf["AMPMGRUSER"]."/".$amp_conf["AMPMGRPASS"]); 1845 2310 } 1846 2311 1847 //take care of sip/iax/zap config2312 //take care of sip/iax/zap/h323/mgcp/skinny config 1848 2313 $funct = "core_devices_del".strtolower($devinfo['tech']); 1849 2314 if(function_exists($funct)){ 1850 2315 $funct($account); … … 1856 2321 $sql = "SELECT * FROM devices WHERE id = '$account'"; 1857 2322 $results = sql($sql,"getRow",DB_FETCHMODE_ASSOC); 1858 2323 1859 //take care of sip/iax/zap config2324 //take care of sip/iax/zap/h323/mgcp/skinny config 1860 2325 $funct = "core_devices_get".strtolower($results['tech']); 1861 2326 if (!empty($results['tech']) && function_exists($funct)) { 1862 2327 $devtech = $funct($account); … … 2037 2502 if ( substr($req, 0, 8) == 'devinfo_' ) { 2038 2503 $keyword = substr($req, 8); 2039 2504 if ( $keyword == 'dial' && $data == '' ) { 2040 $iaxfields[] = array($account, $keyword, 'IAX2/'.$account);2505 $iaxfields[] = array($account, $keyword, 'IAX2/'.$account); 2041 2506 } elseif ($keyword == 'mailbox' && $data == '') { 2042 2507 $iaxfields[] = array($account,'mailbox',$account.'@device'); 2043 2508 } else { … … 2110 2575 return $results; 2111 2576 } 2112 2577 2578 //add to h323 table 2579 function core_devices_addh323($account) { 2580 global $db; 2581 global $currentFile; 2582 2583 foreach ($_REQUEST as $req=>$data) { 2584 if ( substr($req, 0, 8) == 'devinfo_' ) { 2585 $keyword = substr($req, 8); 2586 if ( $keyword == 'dial' && $data == '' ) { 2587 $h323fields[] = array($account, $keyword, 'OOH323/'.$h323id."@".$ip); 2588 // $h323fields[] = array($account, $keyword, 'OOH323/'.$account.'@'.$ip); 2589 } elseif ($keyword == 'mailbox' && $data == '') { 2590 $h323fields[] = array($account,'mailbox',$account.'@device'); 2591 } else { 2592 $h323fields[] = array($account, $keyword, $data); 2593 } 2594 } 2595 } 2596 2597 if ( !is_array($h323fields) ) { // left for compatibilty....lord knows why ! 2598 $h323fields = array( 2599 //array($account,'account',$account), 2600 array($account,'type',($_REQUEST['context'])?$_REQUEST['c
