$from1 = buildFrom($found_where, $found_group, $found_order, $query1); $where1 = buildWhere($found_where, $found_group, $found_order, $query1); $group1 = buildGroup($found_group, $found_order, $query1); $order1 = buildOrder($found_order, $query1); //******************************************************EXTRACTION 2 $found_group = strrpos($query2, "group"); $found_where = strrpos($query2, "where"); $found_order = strrpos($query2, "order"); $target2 = buildTarget($query2); $from2 = buildFrom2($found_where, $found_group, $found_order, $query2); $where2 = buildWhere($found_where, $found_group, $found_order, $query2); $group2 = buildGroup($found_group, $found_order, $query2); $order2 = buildOrder($found_order, $query2); $query = buildQuery($cubetablenameB, $join_final, $target1, $target2, $from1, $from2, $where1, $where2, $group1, $group2, $order1, $order2); $result = exec_query($query); buildReport($result); //***************************************************************************************************************************************** function buildFrom($found_where, $found_group, $found_order, $query1) { //FROM if ($found_where == true) { $a = eregi("from (.+) where", $query1, $regs); } elseif ($found_group == true) { $a = eregi("from (.+) group", $query1, $regs); } elseif ($found_order == true) { $a = eregi("from (.+) order", $query1, $regs); } else { $a = eregi("from (.+)\$", $query1, $regs); } $from1 = $regs[1]; //print "Q1 FROM $from1<br>";
function endpointConfiguratedSet($smarty, $module_name, $local_templates_dir, $dsnAsterisk, $dsnSqlite, $arrConf) { $paloEndPoint = new paloSantoEndPoint($dsnAsterisk, $dsnSqlite); $paloFileEndPoint = new PaloSantoFileEndPoint($arrConf["tftpboot_path"], $_SESSION["endpoint_mask"]); $arrFindVendor = array(); //variable de ayuda, para llamar solo una vez la funcion createFilesGlobal de cada vendor $valid = validateParameterEndpoint($_POST, $module_name, $dsnAsterisk, $dsnSqlite); $count = 0; $error = ""; if ($valid != false) { $smarty->assign("mb_title", _tr('ERROR') . ":"); $smarty->assign("mb_message", $valid); $endpoint_mask = isset($_POST['endpoint_mask']) ? $_POST['endpoint_mask'] : network(); return buildReport($_SESSION['elastix_endpoints'], $smarty, $module_name, $endpoint_mask); } foreach ($_POST as $key => $values) { if (substr($key, 0, 6) == "epmac_") { //encontre una mac seleccionada entoces por forma empirica con ayuda del mac_adress obtego los parametros q se relacionan con esa mac. $tmpMac = substr($key, 6); $count++; $tech = $paloEndPoint->getTech($_POST["id_device_{$tmpMac}"]); $freePBXParameters = $paloEndPoint->getDeviceFreePBXParameters($_POST["id_device_{$tmpMac}"], $tech); $tmpEndpoint['id_device'] = $freePBXParameters['id_device']; $tmpEndpoint['desc_device'] = $freePBXParameters['desc_device']; $tmpEndpoint['account'] = $freePBXParameters['account_device']; $tmpEndpoint['secret'] = $freePBXParameters['secret_device']; $tmpEndpoint['id_model'] = $_POST["id_model_device_{$tmpMac}"]; $tmpEndpoint['mac_adress'] = $tmpMac; $tmpEndpoint['id_vendor'] = $_POST["id_vendor_device_{$tmpMac}"]; $tmpEndpoint['name_vendor'] = $_POST["name_vendor_device_{$tmpMac}"]; $tmpEndpoint['ip_adress'] = $_POST["ip_adress_endpoint_{$tmpMac}"]; $tmpEndpoint['comment'] = "Nada"; //Variables usadas para parametros extras $name_model = $paloEndPoint->getModelById($tmpEndpoint['id_model']); $arrParametersOld = $paloEndPoint->getParameters($tmpEndpoint['mac_adress']); $arrParameters = $paloFileEndPoint->updateArrParameters($tmpEndpoint['name_vendor'], $name_model, $arrParametersOld); $tmpEndpoint['arrParameters'] = $arrParameters; if ($paloEndPoint->createEndpointDB($tmpEndpoint)) { //verifico si la funcion createFilesGlobal del vendor ya fue ejecutado if (!in_array($tmpEndpoint['name_vendor'], $arrFindVendor)) { if ($paloFileEndPoint->createFilesGlobal($tmpEndpoint['name_vendor'])) { $arrFindVendor[] = $tmpEndpoint['name_vendor']; } } //escribir archivos $ArrayData['vendor'] = $tmpEndpoint['name_vendor']; $ArrayData['data'] = array("filename" => strtolower(str_replace(":", "", $tmpMac)), "DisplayName" => $tmpEndpoint['desc_device'], "id_device" => $tmpEndpoint['id_device'], "secret" => $tmpEndpoint['secret'], "model" => $name_model, "ip_endpoint" => $tmpEndpoint['ip_adress'], "arrParameters" => $tmpEndpoint['arrParameters'], "tech" => $tech); //Falta si hay error en la creacion de un archivo, ya esta para saber q error es, el problema es como manejar un error o los errores dentro del este lazo (foreach). //ejemplo: if($paloFile->createFiles($ArrayData)==false){ $paloFile->errMsg (mostrar error con smarty)} if (!$paloFileEndPoint->createFiles($ArrayData)) { if (isset($paloFileEndPoint->errMsg)) { $error .= $paloFileEndPoint->errMsg . "<br />"; } } } } } if ($count > 0 && $error == "") { $smarty->assign("mb_title", _tr("MESSAGE")); $smarty->assign("mb_message", _tr("The Extension(s) parameters have been saved. Each checked phone will be configured with the new parameters once it has finished rebooting")); } elseif (isset($error) && $error != "") { $smarty->assign("mb_title", _tr("MESSAGE")); $message = _tr("The following errors ocurred") . ":<br />" . $error; $smarty->assign("mb_message", $message); } unset($_SESSION['elastix_endpoints']); return endpointConfiguratedShow($smarty, $module_name, $local_templates_dir, $dsnAsterisk, $dsnSqlite, $arrConf); }
<?php require_once '../../includes/auth.php'; $fileInfo = array('title' => 'Report for', 'fileName' => 'adrLists/report.php'); $debug->newFile($fileInfo['fileName']); $buildPage = new Adrlist_BuildPage(); $buildPage->addIncludes('reportMethods.php'); $buildPage->addJs('report.js'); echo $buildPage->output(), ' <div class="layout" id="main"> <div class="relative textCenter"> ', buildReport(), buildTRT(), ' </div> </div> ', $buildPage->buildFooter();
<?php /* This file and it's functions are to be used solely by ../lists/report.php in conjunction with ../js/report.js. */ $fileInfo = array('fileName' => 'includes/reportMethods.php'); $debug->newFile($fileInfo['fileName']); $success = false; if (!empty($_POST['mode']) && isset($_SESSION['listId']) && (bool) $_SESSION['listId']) { define('MODE', $_POST['mode']); $debug->add('MODE: ' . MODE); if (isset($_SESSION['listRoleId']) && $_SESSION['listRoleId'] > 1) { if ($_POST['mode'] == 'buildReport') { buildReport(); } elseif ($_POST['mode'] == 'buildTRT') { buildTRT(); } else { $debug->add('No matching mode in ' . $fileInfo['fileName'] . '.'); } } } else { define('MODE', ''); if (empty($_POST['mode'])) { $debug->add('$_POST[\'mode\'] is empty.'); } elseif (!isset($_SESSION['listId'])) { $debug->add('$_SESSION[\'listId\'] is not defined.'); } elseif (!(bool) $_SESSION['listId']) { $debug->add('$_SESSION[\'listId\'] does not contain a value.'); } else { $debug->add('Something else is wrong.'); }