Esempio n. 1
0
 foreach ($iterator as $file) {
     if (is_dir($file)) {
         $dir = str_replace(PHONE_MODULES_PATH . "temp/" . $brand_directory . "/", "", $file);
         if (!file_exists(PHONE_MODULES_PATH . "endpoint/" . $brand_directory . "/" . $dir)) {
             mkdir(PHONE_MODULES_PATH . "endpoint/" . $brand_directory . "/" . $dir);
         }
     } else {
         if (basename($file) != "brand_data.xml") {
             $dir = str_replace(PHONE_MODULES_PATH . "temp/" . $brand_directory . "/", "", $file);
             rename($file, PHONE_MODULES_PATH . "endpoint/" . $brand_directory . "/" . $dir);
         }
     }
 }
 echo "Done!<br />";
 echo "Removing Temporary Files..............";
 $endpoint->deltree(PHONE_MODULES_PATH . "temp/" . $brand_directory);
 unlink(PHONE_MODULES_PATH . 'temp/' . $_REQUEST['package']);
 echo "Done!<br />";
 $last_mod = "";
 $temp['data']['brands']['family_list']['family'] = $endpoint->fix_single_array_keys($temp['data']['brands']['family_list']['family']);
 foreach ($temp['data']['brands']['family_list']['family'] as $family_list) {
     echo "Updating Family Lines.................<br/>";
     $last_mod = max($last_mod, $family_list['last_modified']);
     $family_line_xml = $endpoint->xml2array(PHONE_MODULES_PATH . '/endpoint/' . $brand_directory . '/' . $family_list['directory'] . '/family_data.xml');
     $data =& $endpoint->db->getOne("SELECT id FROM endpointman_product_list WHERE id='" . $brand_id . $family_line_xml['data']['id'] . "'", array(), DB_FETCHMODE_ASSOC);
     $short_name = preg_replace("/\\[(.*?)\\]/si", "", $family_line_xml['data']['name']);
     if ($data) {
         $sql = "UPDATE endpointman_product_list SET short_name = '" . $short_name . "', long_name = '" . $family_line_xml['data']['name'] . "', cfg_ver = '" . $family_line_xml['data']['version'] . "', config_files='" . $family_line_xml['data']['configuration_files'] . "', hidden = '0' WHERE id = '" . $brand_id . $family_line_xml['data']['id'] . "'";
     } else {
         $sql = "INSERT INTO endpointman_product_list (`id`, `brand`, `short_name`, `long_name`, `cfg_dir`, `cfg_ver`, `config_files`, `hidden`) VALUES ('" . $brand_id . $family_line_xml['data']['id'] . "', '" . $brand_id . "', '" . $short_name . "', '" . $family_line_xml['data']['name'] . "', '" . $family_line_xml['data']['directory'] . "', '" . $family_line_xml['data']['version'] . "','" . $family_line_xml['data']['configuration_files'] . "', '0')";
     }
Esempio n. 2
0
$endpoint = new endpointmanager();
global $db;
if (!function_exists("out")) {
    function out($text)
    {
        echo $text . "<br />";
    }
}
if (!function_exists("outn")) {
    function outn($text)
    {
        echo $text;
    }
}
out("Removing Phone Modules Directory");
$endpoint->deltree(PHONE_MODULES_PATH);
exec("rm -R " . PHONE_MODULES_PATH);
out("Dropping all relevant tables");
$sql = "DROP TABLE `endpointman_brand_list`";
$result = $db->query($sql);
$sql = "DROP TABLE `endpointman_global_vars`";
$result = $db->query($sql);
$sql = "DROP TABLE `endpointman_mac_list`";
$result = $db->query($sql);
$sql = "DROP TABLE `endpointman_model_list`";
$result = $db->query($sql);
$sql = "DROP TABLE `endpointman_oui_list`";
$result = $db->query($sql);
$sql = "DROP TABLE `endpointman_product_list`";
$result = $db->query($sql);
$sql = "DROP TABLE `endpointman_template_list`";