Ejemplo n.º 1
0
/**
 * This file is a part of MyWebSQL package
 *
 * @file:      modules/dbbatch.php
 * @author     Samnan ur Rehman
 * @copyright  (c) 2008-2014 Samnan ur Rehman
 * @web        http://mywebsql.net
 * @license    http://mywebsql.net/license
 */
function processRequest(&$db)
{
    if (v($_REQUEST["id"]) == 'batch') {
        $stats = array();
        $commands = array();
        if (v($_POST['skip_fkey']) == "on") {
            $db->set_constraint('fkey', false);
        }
        // generate commands first before doing drop operations
        if (v($_POST['command']) != '') {
            $commands = generate_commands($db, v($_POST['command']));
        }
        if (v($_POST['dropcmd']) == 'on') {
            $stats['drop'] = drop_objects($db);
        } else {
            if (v($_POST['old_prefix']) != '') {
                $stats['delprefix'] = remove_prefix($db, v($_POST['old_prefix']));
            }
            if (v($_POST['new_prefix']) != '') {
                $stats['addprefix'] = add_prefix($db, v($_POST['new_prefix']));
            }
        }
        $replace = array();
        $data = array('stats' => $stats, 'queries' => $commands);
        echo view('dbbatch_results', $replace, $data);
    } else {
        $object_list = $db->getObjectList();
        $replace = array();
        $folder = $db->name();
        echo view(array($folder . '/dbbatch', 'dbbatch'), $replace, $object_list);
    }
}
Ejemplo n.º 2
0
        $found = check_number($array_number[0], $array_number[1]);
    }
}
# Check advanced mapping
if (!$found) {
    $array_number = transform_mapping($number_original, $array_temp['Dialplan'], $array_config['Numbers'], '2');
    if ($array_number[0] != $number_original) {
        $found = check_number($array_number[0], $array_number[1]);
    }
}
# Remove external prefix
if (!$found) {
    $number_transformed = remove_prefix($number_original, $array_temp['Dialplan'], 'external');
    if ($number_transformed != $number_original) {
        $found = check_number($number_transformed);
    }
}
# Remove international prefix
if (!$found) {
    $number_transformed = remove_prefix($number_original, $array_temp['Dialplan'], 'international');
    if ($number_transformed != $number_original) {
        $found = check_number($number_transformed);
    }
}
# No number
if (!$found) {
    # Send a 404
    send404();
}
# Clean exit
exit;
Ejemplo n.º 3
0
function getEncoding()
{
    $url = remove_prefix(strtok($_SERVER["REQUEST_URI"], '?'), "/test.php");
    foreach (['json' => 'application/json', 'xml' => 'application/xml', 'html' => 'text/html', 'htm' => '', 'php' => ''] as $ext => $accept) {
        if (substr($url, -strlen('.' . $ext)) === '.' . $ext) {
            $url = substr($url, 0, -strlen('.' . $ext));
            if (!$accept) {
                $ext = 'html';
            }
            return [$url, $ext];
        } elseif ($_SERVER['HTTP_ACCEPT'] === $accept) {
            return [$url, $ext];
        }
    }
    return [$url, 'html'];
}
Ejemplo n.º 4
0
            if ($entry != ".." && $entry != ".") {
                print $entry . ";";
            }
        }
        print "\r\n";
        break;
    case "json":
        header("Content-type: text/plain");
        $auto_pipelines_directory = 'core' . DIRECTORY_SEPARATOR . 'auto-pipelines' . DIRECTORY_SEPARATOR;
        $auto_pipelines = remove_prefix(glob($auto_pipelines_directory . '*'), strlen($auto_pipelines_directory));
        $sanitised_auto_pipelines = array();
        foreach ($auto_pipelines as $auto_pipeline) {
            $sanitised_auto_pipelines[] = basename($auto_pipeline, '.xml');
        }
        $pipelines_directory = 'pipeline' . DIRECTORY_SEPARATOR;
        $pipelines = remove_prefix(glob($pipelines_directory . '*'), strlen($pipelines_directory));
        $pipelines_and_types = array();
        foreach ($pipelines as $pipeline) {
            $pipeline_xml = file_get_contents($pipelines_directory . $pipeline . DIRECTORY_SEPARATOR . 'pipeline.xml');
            if (strpos($pipeline_xml, '<autopipeline>') !== false) {
                $pipelines_and_types[$pipeline] = 'autopipeline';
            } else {
                $pipelines_and_types[$pipeline] = 'regularpipeline';
            }
        }
        $response = array('autopipelines' => $sanitised_auto_pipelines, 'pipelines' => $pipelines_and_types);
        print json_encode($response);
        break;
}
function remove_prefix($array, $prefix_length)
{
Ejemplo n.º 5
0
 function procesarNaves($cadena)
 {
     $cadenasNaves = array($GLOBALS["stringCazLig"], $GLOBALS["stringCazPes"], $GLOBALS["stringsesp"], $GLOBALS["stringPCarga"], $GLOBALS["stringGCarga"], $GLOBALS["stringCruc"], $GLOBALS["stringNDB"], $GLOBALS["stringClnz"], $GLOBALS["stringRccl"], $GLOBALS["stringBmb"], $GLOBALS["stringDest"], $GLOBALS["stringEDLM"], $GLOBALS["stringAcor"], $GLOBALS["stringSatSol"]);
     foreach ($cadenasNaves as $cadenaNave) {
         if (contains($cadena, $cadenaNave)) {
             return array("tipoNave" => $cadenaNave, "cantidad" => (int) trim(remove_prefix($cadena, $cadenaNave)));
         }
     }
 }