Esempio n. 1
0
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
* 
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
\*******************************************************************/
define('GS_VALID', true);
/// this is a parent file
require_once dirName(__FILE__) . '/../../inc/conf.php';
include_once GS_DIR . 'inc/util.php';
include_once GS_DIR . 'inc/boi-soap/boi-soap.php';
if ($argc < 2) {
    echo "Arg 1 must be the host!\n";
    exit(1);
}
$host = @$argv[1];
if ($argc < 3) {
    echo "Arg 2 must be the role!\n";
    exit(1);
}
$role = @$argv[2];
if ($argc < 4) {
    echo "Arg 3 must be the extension!\n";
    exit(1);
}
$ext = @$argv[3];
$menu = gs_boi_get_gui_menu('m01', $host, $role, $ext);
var_export($menu);
echo "\n";
     if (!extension_loaded('soap')) {
         $boi_menu_error_msg = 'Fehler beim Abfragen des Men&uuml;s der Agentur.';
     } else {
         include_once GS_DIR . 'inc/boi-soap/boi-soap.php';
         $soap_faultcode = null;
         if ($_SESSION['sudo_user']['boi_session'] === null) {
             # start a new session at the branch office PBX
             $_SESSION['sudo_user']['boi_session'] = gs_boi_start_gui_session($api, $_SESSION['sudo_user']['boi_host'], $boi_soap_role, $boi_soap_ext, $soap_faultcode);
             if (!$_SESSION['sudo_user']['boi_session']) {
                 $_SESSION['sudo_user']['boi_session'] = null;
             }
         }
         if ($soap_faultcode === 'HTTP') {
             gs_log(GS_LOG_DEBUG, 'Skipping SOAP call to get menu. Server not reachable.');
         } else {
             $menu = @gs_boi_get_gui_menu($api, $_SESSION['sudo_user']['boi_host'], $boi_soap_role, $boi_soap_ext, $_SESSION['sudo_user']['boi_session']);
         }
         unset($soap_faultcode);
     }
     $expires = $boi_menu_error_msg === false ? 180 : 50;
     gs_log(GS_LOG_DEBUG, 'Caching BOI menu "' . $boi_menu_key . '" (expires in ' . $expires . ' s)');
     $_SESSION['sudo_user']['boi_menu_cache'] = array('key' => $boi_menu_key, 'expires' => time() + $expires, 'menu' => $menu);
     unset($expires);
 }
 unset($boi_soap_role);
 unset($boi_soap_ext);
 //unset($boi_menu_key);
 if (!is_array($menu)) {
     if ($boi_menu_error_msg === false) {
         $boi_menu_error_msg = 'Fehler beim Abfragen des Men&uuml;s der Agentur.';
     }