Example #1
0
         } else {
             dont_show_template('No HTTP Referer');
         }
     } else {
         if (sizeof($query_for_security_content_response) > 0) {
             /*
              * A setting from play_security_details might be in use, as such, check to see if it is, and then loop through checking if one is valid.
              */
             $flag = false;
             foreach ($query_for_security_content_response as $row_security) {
                 /*
                  * Check each setting to see if true
                  */
                 if ($row_play['access_to_whom'] == $row_security['security_setting']) {
                     if (check_security_type($row_security['security_data'])) {
                         show_template($row_play);
                         $flag = true;
                         break;
                     } else {
                         $flag == false;
                     }
                 }
             }
             if ($flag == false) {
                 dont_show_template();
             }
         } else {
             dont_show_template();
         }
     }
 }
Example #2
0
function storagedisksizes()
{
    global $user_id;
    $select_services = "SELECT\n        tblhosting.id as id,\n\n        tblonappclients.onapp_user_id,\n        tblonappclients.email,\n        tblonappclients.password,\n\n        tblproducts.name as product,\n        LOWER(domainstatus) as domainstatus,\n        tblproducts.configoption1 as serverid,\n        tblproducts.configoption2 basespace,\n        tblproducts.configoption3,\n\n        CASE optiontype\n            WHEN 1 THEN optionssub.sortorder\n            WHEN 2 THEN optionssub.sortorder\n            WHEN 4 THEN options.qty * optionssub.sortorder\n            ELSE 0\n        END AS additionalspace,\n\n        tblservers.name      as servername,\n        tblservers.ipaddress as serveripaddres,\n        tblservers.hostname  as serverhostname,\n        tblservers.username  as serverusername,\n        tblservers.password  as serverpassword,\n\n        optionssub.id as subid,\n        optionssub.optionname,\n        options.configid,\n        tblproductconfigoptions.optionname as configoptionname,\n        tblproductconfigoptions.optiontype,\n        tblproductconfigoptions.qtymaximum AS max,\n        tblproductconfigoptions.qtyminimum AS min,\n        options.qty,\n        optionssub.sortorder,\n        options.optionid as active\n    FROM\n        tblhosting\n        LEFT JOIN tblproducts ON\n            tblproducts.id = packageid\n        LEFT JOIN tblonappservices ON\n            service_id = tblhosting.id\n        LEFT JOIN tblonappclients ON\n            tblproducts.configoption1 = tblonappclients.server_id AND\n            tblhosting.userid = tblonappclients.client_id\n        LEFT JOIN tblhostingconfigoptions AS options ON\n            relid = tblhosting.id\n        LEFT JOIN tblproductconfigoptionssub AS sub\n            ON options.configid = sub.configid\n            AND options.configid = tblproducts.configoption3\n            AND optionid = sub.id\n        LEFT JOIN tblproductconfigoptions\n            ON tblproductconfigoptions.id = options.configid\n        LEFT JOIN tblproductconfigoptionssub AS optionssub\n            ON optionssub.configid = tblproductconfigoptions.id AND\n            options.configid = tblproducts.configoption3\n        LEFT JOIN tblservers ON tblproducts.configoption1 = tblservers.id\n    WHERE\n        servertype = 'onappbackupspace'\n        AND options.optionid = optionssub.id\n        AND userid = '{$user_id}'\n    ORDER BY servername, tblhosting.id ASC";
    $services_rows = full_query($select_services);
    while ($service = mysql_fetch_assoc($services_rows)) {
        $rows[] = $service;
    }
    $servers = array();
    if (count($rows)) {
        foreach ($rows as $key => $value) {
            if (!isset($servers[$value['serverid']])) {
                $servers[$value['serverid']] = array('services' => array(), 'name' => $rows[$key]['servername'], 'adress' => $rows[$key]["serveripaddres"] != "" ? 'http://' . $rows[$key]["serveripaddres"] : $rows[$key]['serverhostname'], 'username' => $rows[$key]['serverusername'], 'password' => decrypt($rows[$key]['serverpassword']), 'onapp_user_id' => $rows[$key]['onapp_user_id']);
            }
            $servers[$value['serverid']]['services'][] = $value;
        }
    }
    foreach ($servers as $key => $server) {
        $limit = new ONAPP_ResourceLimit();
        $limit->auth($server['adress'], $server['username'], $server['password']);
        $limit->load($server['onapp_user_id']);
        $servers[$key]['storage_disk_size'] = $limit->_obj->_storage_disk_size ? $limit->_obj->_storage_disk_size : 0;
        $vms = new ONAPP_VirtualMachine();
        $vms->auth($server['adress'], $server['username'], $server['password']);
        $backups_size = 0;
        foreach ($vms->getList($server['onapp_user_id']) as $vm) {
            $backups = new ONAPP_VirtualMachine_Backup();
            $backups->_virtual_machine_id = $vm->_id;
            $backups->auth($server['adress'], $server['username'], $server['password']);
            foreach ($backups->getList() as $backup) {
                $backups_size += $backup->_backup_size;
            }
        }
        if ($backups_size > 0) {
            $backups_size = sprintf("%01.2f", $backups_size / 1024 / 1024);
        }
        $servers[$value['serverid']]['backups_size'] = $backups_size;
    }
    show_template("onapp/clientareastoragedisksizes", array('rows' => $servers));
}
    $product = product_create($retailer, $pid, array('title' => $product_title, 'url' => $product_url, 'price' => $product_price, 'currency' => 'GBP', 'image_url' => $product_image_url));
}
if (!$product) {
    $product = array();
    $product['title'] = 'Asus C300 Chromebook, Intel Celeron, 2GB RAM, 32GB SSD, 13.3", Red';
    $product['image_url'] = 'http://johnlewis.scene7.com/is/image/JohnLewis/233845648alt3?$prod_main$';
    $product['price'] = 239.9;
    $product['url'] = 'http://www.johnlewis.com/asus-c300-chromebook-intel-celeron-2gb-ram-32gb-ssd-13-3-red/p1625271';
}
$logo = 'http://www.johnlewis.com/assets/header/john-lewis-logo.gif';
$product['logo'] = image_thumbnail_url($logo, '200x20', 'resize');
$product_image = image_thumbnail_url(@$product['image_url'], '320x250', 'resizenp');
$price_formatted = '£' . sprintf('%01.2f', $product['price']);
$lists = lists_get_for_user(false);
if ($product) {
    $list_ids = product_get_list_ids($retailer, $pid);
    if ($list_id) {
        if (array_contains($list_ids, $list_id)) {
            if (isset($_GET['list'])) {
                product_remove_from_list($retailer, $pid, $list_id);
            }
        } else {
            product_add_to_list($retailer, $pid, $list_id);
        }
        $list_ids = product_get_list_ids($retailer, $pid);
    }
    $data = array('product' => $product, 'product_image' => $product_image, 'price_formatted' => $price_formatted, 'lists' => $lists, 'added_list_id' => $list_id, 'pid' => $pid, 'retailer' => $retailer, 'list_ids' => $list_ids, 'is_popup' => $is_popup);
    show_template('add_product_popup', $data);
} else {
    die('Bums!');
}