Ejemplo n.º 1
0
 public function view($id, $parity)
 {
     // check to see if the user has access, this is in case we want to make it so that only logged in people can view lightboxes in the future, etc/.
     if ($this->access->allowed('lightboxes', 'read')) {
         $parity_field = 'name';
         // this is a  variable so that it can easily be changed in the future.
         $lightbox = orm::factory('lightbox')->find($id);
         // sanity check and parity check.
         if ($lightbox->loaded && $lightbox->{$parity_field} == url::decode($parity)) {
             // The only times that a lightbox are viewable are when it is public or the current user is the owner. 	A status of approved = public, a status of pending = private
             if ($lightbox->status == 'approved' || $this->user && $this->user->id == $lightbox->creator_id) {
                 $view = new view(url::routes_area() . 'view');
                 // add one to the views for the lightbox.
                 $lightbox->views += 1;
                 $lightbox->save(false);
                 $view->lightbox = $lightbox;
                 $view->is_owner = $this->user && $this->user->id == $lightbox->creator_id;
                 $view->current_user = $this->current;
                 $this->breadcrumbs->add()->url(url::current())->title($lightbox->name);
                 $view->breadcrumbs = $this->breadcrumbs->get();
                 $this->breadcrumbs->delete();
                 $this->template->content = $view;
             } else {
                 $this->notification->add($this->i18n['system.lightbox.status']);
                 url::redirect('account');
             }
         } else {
             $this->notification->add($this->i18n['system.lightbox.invalid']);
             url::redirect('account');
         }
     } else {
         $this->notification->add($this->i18n['system.lightbox.login']);
         url::redirect('account');
     }
 }
Ejemplo n.º 2
0
 /**
  * Used to display the index page but also uses a jquery and the pagination to do preload of next pages
  * of the news articles. Which are then displaye don scroll 
  * @param integer $page the page number  (Matt are you sure this is needed, the pagination is smart enough not to need this). 
  */
 public function index($page = 1)
 {
     $total = orm::factory('news')->where('group', 'site')->where('status', 'approved')->count_all();
     $paging = new Pagination(array('total_items' => $total, 'items_per_page' => 3));
     $articles = orm::factory('news')->where('group', 'site')->where('status', 'approved')->find_all($paging->items_per_page, $paging->sql_offset);
     $view = new View(url::location());
     $view->articles = $articles;
     $view->pagination = $paging->render();
     $view->page_number = $paging->page_number();
     // If the request is an ajax request, then the page is attempting to autoupdate
     // the items with in the news, so just send through the news items.
     if (request::is_ajax()) {
         // if the ajax is attempting to get a page which doesnt exist, send 404
         if ($page > $paging->total_pages) {
             Event::run('system.404');
         } else {
             $this->ajax['view'] = $view;
         }
     } else {
         // otherwise its a http request, send throught he entire page with template.
         $this->template->title = 'About Us › News & Updates Archive';
         $this->breadcrumbs->add()->url(false)->title('Archive');
         $view->breadcrumbs = $this->breadcrumbs->cut();
         $this->template->content = $view;
     }
 }
Ejemplo n.º 3
0
 public function index()
 {
     $view = new View(url::location());
     $view->articles = orm::factory('news')->where('group', 'site')->where('status', 'approved')->find_all(6);
     $this->template->title = 'About Us › News & Updates';
     $this->template->content = $view;
 }
Ejemplo n.º 4
0
 public function index()
 {
     $view = new View(url::location());
     $this->template->title = 'About Us › Global Alliances';
     $view->breadcrumbs = $this->breadcrumbs->cut();
     $view->locations = orm::factory('location')->where('status', 'approved')->where('group', 'alliances')->find_all();
     $this->template->content = $view;
 }
Ejemplo n.º 5
0
 /**
  * Simple delete of the object, plus a call to the unify to check to see if the 
  * collection also needs to be deleted. 
  * @return boolean $return, whether or not  the call did everything expected
  */
 public function delete()
 {
     $original = orm::factory('pigment', $this->id);
     $return = parent::delete();
     if ($return) {
         $return = $this->unify($original);
     }
 }
Ejemplo n.º 6
0
 public function glossary()
 {
     $view = new View(url::location());
     $this->template->title = 'Environmental › Glossary';
     $this->breadcrumbs->add()->url(false)->title('Glossary');
     $view->breadcrumbs = $this->breadcrumbs->cut();
     $view->glossaries = orm::factory('glossary')->where('status', 'approved')->find_all();
     $this->template->content = $view;
 }
Ejemplo n.º 7
0
 /**
  * Simple delete of the object, plus a call to the unify to check to see if the 
  * pigment also needs to be deleted. 
  * @return boolean $return, whether or not  the call did everything expected
  */
 public function delete()
 {
     $original = orm::factory('sheet', $this->id);
     $return = parent::delete();
     // if it was deleted, then verfiy
     if ($return) {
         $return = $this->unify($original);
     }
     return $return;
 }
Ejemplo n.º 8
0
 public function index()
 {
     $this->breadcrumbs->delete();
     $this->template->title = 'Home';
     $view = new view('home/index');
     $view->inspirations = orm::factory('inspiration')->where('status', 'approved')->find_all();
     $view->billboards = orm::factory('billboard')->where('status', 'approved')->find_all();
     $view->populars = orm::factory('paper')->where('status', 'approved')->where('popular', 'true')->orderby(NULL, 'RAND()')->find_all(8);
     $view->news = orm::factory('news')->where('group', 'site')->where('status', 'approved')->find_all(3);
     $this->template->content = $view;
 }
Ejemplo n.º 9
0
 public function set($name)
 {
     $feature = orm::factory('feature')->where('name', $name)->find();
     if ($feature->loaded) {
         return $feature;
     } else {
         $this->name = $name;
         parent::save();
         return $this;
     }
 }
Ejemplo n.º 10
0
 public function set($name)
 {
     $tip = orm::factory('tip')->where('name', $name)->find();
     if ($tip->loaded) {
         return $tip;
     } else {
         $this->name = $name;
         parent::save();
         return $this;
     }
 }
Ejemplo n.º 11
0
 /**
  * This will call the parentxontent controller to populate the view, while sending throught he type of content that it is 
  * as well as the paper_id, which will be used to autocomplete the paper combo box withg the correct result. 
  * @see Content_Controller::add()
  */
 public function add($paper_id = NULL)
 {
     $paper = orm::factory('paper', $paper_id);
     // load the paper so that we can get all the details required to populate the breadrumbs
     if ($paper->loaded) {
         $this->breadcrumbs->add()->url('products/papers/edit/' . url::encode($paper->name))->title(url::decode($paper->name));
         $this->breadcrumbs->add()->url('products/papers/technicals/index/' . $paper->id)->title('Technicals');
         $this->breadcrumbs->add()->url(false)->title('Add');
     }
     parent::add('technical', $paper->id);
 }
Ejemplo n.º 12
0
 /**
  * Create as we need to build the paper name if one doesnt exist. 
  */
 public function get()
 {
     $results = parent::get();
     // we have the results, we now need to go through and build the names up
     for ($i = 0; $i < count($results); $i++) {
         if ($results[$i]['name'] == NULL) {
             $collection = orm::factory('collection')->find($results[$i]['collection_id']);
             $results[$i]['name'] = $collection->paper->name . ' ' . $collection->finish->name . ' ' . ucwords($results[$i]['color']);
         }
     }
     return $results;
 }
Ejemplo n.º 13
0
 /**
  * Validates and optionally saves a new user record from an array.
  *
  * @param  array    values to check
  * @param  boolean  save[Optional] the record when validation succeeds
  * @return boolean
  */
 public function validate(array &$array, $save = FALSE)
 {
     // Initialise the validation library and setup some rules
     $array = Validation::factory($array);
     // uses PHP trim() to remove whitespace from beginning and end of all fields before validation
     $array->pre_filter('trim');
     // Add Rules
     $array->add_rules('name', 'required', 'unique');
     // Email unique validation
     //$array->add_callbacks('email', array($this, '_unique_name'));
     //$array->add_rules('name', 'required', array($this, '_name_exists'));
     return parent::validate($array, $save);
 }
Ejemplo n.º 14
0
 public function calculate_total()
 {
     $price = orm::factory('dish', $this->dish_id)->price;
     $temp = $this->get_ingredients_in_order_dish();
     foreach ($temp as $ingred) {
         $price += $ingred->price;
     }
     $temp = $this->get_subs_in_order_dish();
     foreach ($temp as $sub) {
         $price += $sub->price;
     }
     $this->price = $price;
     $this->save();
 }
Ejemplo n.º 15
0
 public function action_add($ordersdish_id, $ingredient_id, $price = NULL)
 {
     $ordersdishesingredient = ORM::factory('ordersdishesingredient');
     $ordersdishesingredient->orders_dishes_id = $ordersdish_id;
     $ordersdishesingredient->ingredient_id = $ingredient_id;
     if (!$price) {
         $dish_id = orm::factory('ordersdish', $ordersdish_id)->dish_id;
         $temp = orm::factory('dishesingredient')->where('dish_id', '=', $dish_id)->and_where('ingredient_id', '=', $ingredient_id)->find();
         $ordersdishesingredient->price = $temp->price;
     } else {
         $ordersdishesingredient->price = $price;
     }
     $ordersdishesingredient->save();
 }
Ejemplo n.º 16
0
 public function action_add($ordersdish_id, $group_id, $sub_id, $price = NULL)
 {
     $ordersdishesgroupssub = ORM::factory('ordersdishesgroupssub');
     $ordersdishesgroupssub->orders_dishes_id = $ordersdish_id;
     $ordersdishesgroupssub->group_id = $group_id;
     $ordersdishesgroupssub->sub_id = $sub_id;
     if (!$price) {
         $sub = orm::factory('sub')->where('group_id', '=', $group_id)->and_where('sub_id', '=', $sub_id)->find();
         $group_price = orm::factory('group', $group_id)->price;
         $ordersdishesgroupssub->price = $sub->price > 0 ? $sub->price : $group_price;
     } else {
         $ordersdishesgroupssub->price = $price;
     }
     $ordersdishesgroupssub->save();
 }
Ejemplo n.º 17
0
 public function __get($name)
 {
     // Are we trying to get the gsms
     if ($name == 'gsms') {
         // if the gsms are not set ... set them and then return
         if (is_null($this->gsms)) {
             $this->gsms = $this->db->select('gsms.name')->from('gsms')->where('collections.paper_id', $this->id)->join('sheets', 'sheets.id', 'gsms.sheet_id')->join('pigments', 'sheets.pigment_id', 'pigments.id')->join('collections', 'collections.id', 'pigments.collection_id')->orderby('gsms.name')->groupby('gsms.name')->get();
         }
         return $this->gsms;
     } elseif ($name == 'technicals') {
         $technicals = orm::factory('technical')->where('foreign_id', $this->id)->where('type', 'technical');
         return $technicals->find_all();
     } else {
         return parent::__get($name);
     }
 }
Ejemplo n.º 18
0
 public function index()
 {
     $this->profiler = new Profiler();
     $view = new View(url::location());
     $this->template->title = 'Products';
     $view->breadcrumbs = $this->breadcrumbs->cut();
     // get the differnt types of favourite products.
     $types = array('standard', 'sticky', 'digital');
     /// loop through the three types of papers, assign three popular of that type for each one.
     foreach ($types as $type) {
         $var = $type . '_papers';
         $view->{$var} = orm::factory('paper')->where('type', $type)->where('status', 'approved')->where('popular', 'true')->orderby(NULL, 'RAND()')->find_all(3);
     }
     // get three random popular indsutrial items.
     $view->industrials = orm::factory('industrial')->where('status', 'approved')->where('popular', 'true')->orderby(NULL, 'RAND()')->find_all(3);
     $this->template->content = $view;
 }
Ejemplo n.º 19
0
 /** 
  * This page will display a page much like the page for the paper products. 
  * 
  * the expcetion will be it will have multiple images and missing some of the relationships that 
  * the papers have.
  * 
  * 
  * @param unknown_type $name
  */
 public function view($name)
 {
     // clean the input, remove and opf the escape characters
     $name = url::encode($name);
     $industrial = orm::factory('industrial')->where('name', $name)->find_all();
     //if ($industrial->loaded)
     //{
     $view = new view(url::location());
     $view->industrial = $industrial[0];
     $this->template->title = ucwords($name);
     $this->template->content = $view;
     //}
     //else
     //{
     // unable to find the industrial item
     //}
 }
Ejemplo n.º 20
0
 public function view($name)
 {
     $name = url::decode($name);
     // check it exists and is published
     $campaign = orm::factory('campaign')->where('name', $name)->where('status', 'approved')->find();
     if ($campaign->loaded) {
         $this->breadcrumbs->add()->url('campaigns')->title('Campaigns');
         $this->breadcrumbs->add()->url(false)->title($campaign->name);
         $this->template->title = 'Campaigns &rsaquo; ' . $campaign->name;
         $view = new view(url::location());
         $view->campaign = $campaign;
         $view->breadcrumbs = $this->breadcrumbs->cut();
         $this->template->content = $view;
     } else {
         $this->notification->add($this->i18n['system.campaign.invalid']);
         url::redirect(url::routes_area());
     }
 }
Ejemplo n.º 21
0
 public function edit($id)
 {
     if ($this->access->allowed('glossaries', 'update')) {
         $glossary = orm::factory('glossary', $id);
         if ($glossary->loaded) {
             $this->breadcrumbs->add()->url(false)->title($glossary->name);
             $view = new view(url::location());
             $view->glossary = $glossary;
             $this->template->title = 'Edit Glossary Article';
             $this->template->content = $view;
         } else {
             // tell the user that the article doesnt exist
             // @todo add notification
             //$this->notification->add();
             url::redirect(url::routes_area());
         }
     } else {
         Kohana::log('debug', 'User failed method security check');
         url::failed();
     }
 }
Ejemplo n.º 22
0
    $array[$x]['default_setting_description'] = '';
    $x++;
    $array[$x]['default_setting_category'] = 'backup';
    $array[$x]['default_setting_subcategory'] = 'path';
    $array[$x]['default_setting_name'] = 'array';
    $array[$x]['default_setting_value'] = $_SESSION['switch']['db']['dir'];
    $array[$x]['default_setting_enabled'] = 'true';
    $array[$x]['default_setting_description'] = '';
    $sql = "select * from v_default_settings ";
    $sql .= "where default_setting_category = 'backup' ";
    $prep_statement = $db->prepare(check_sql($sql));
    $prep_statement->execute();
    $default_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED);
    $x = 0;
    foreach ($array as $row) {
        $found = false;
        foreach ($default_settings as $field) {
            if ($row['default_setting_subcategory'] == $field['default_setting_subcategory']) {
                $found = true;
                $break;
            }
        }
        if (!$found) {
            $orm = new orm();
            $orm->name('default_settings');
            $orm->save($array[$x]);
            $message = $orm->message;
        }
        $x++;
    }
}
Ejemplo n.º 23
0
 /**
  * Add a dialplan for call center
  * @var string $domain_uuid		the multi-tenant id
  * @var string $value	string to be cached
  */
 public function dialplan()
 {
     //normalize the fax forward number
     if (strlen($this->fax_forward_number) > 3) {
         //$fax_forward_number = preg_replace("~[^0-9]~", "",$fax_forward_number);
         $this->fax_forward_number = str_replace(" ", "", $this->fax_forward_number);
         $this->fax_forward_number = str_replace("-", "", $this->fax_forward_number);
     }
     //set the forward prefix
     if (strripos($this->fax_forward_number, '$1') === false) {
         $this->forward_prefix = '';
         //not found
     } else {
         $this->forward_prefix = $this->forward_prefix . $this->fax_forward_number . '#';
         //found
     }
     //delete previous dialplan
     if (strlen($this->dialplan_uuid) > 0) {
         //delete the previous dialplan
         $sql = "delete from v_dialplans ";
         $sql .= "where dialplan_uuid = '" . $this->dialplan_uuid . "' ";
         $sql .= "and domain_uuid = '" . $this->domain_uuid . "' ";
         $this->db->exec($sql);
         $sql = "delete from v_dialplan_details ";
         $sql .= "where dialplan_uuid = '" . $this->dialplan_uuid . "' ";
         $sql .= "and domain_uuid = '" . $this->domain_uuid . "' ";
         $this->db->exec($sql);
         unset($sql);
     }
     unset($prep_statement);
     //build the dialplan array
     $dialplan["app_uuid"] = "24108154-4ac3-1db6-1551-4731703a4440";
     $dialplan["domain_uuid"] = $this->domain_uuid;
     $dialplan["dialplan_name"] = $this->fax_name != '' ? $this->fax_name : format_phone($this->destination_number);
     $dialplan["dialplan_number"] = $this->fax_extension;
     $dialplan["dialplan_context"] = $_SESSION['context'];
     $dialplan["dialplan_continue"] = "false";
     $dialplan["dialplan_order"] = "310";
     $dialplan["dialplan_enabled"] = "true";
     $dialplan["dialplan_description"] = $this->fax_description;
     $dialplan_detail_order = 10;
     //add the public condition
     $y = 1;
     $dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
     $dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
     $dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "destination_number";
     $dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "^" . $this->destination_number . "\$";
     $dialplan["dialplan_details"][$y]["dialplan_detail_break"] = "";
     $dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
     $dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
     $y++;
     $dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
     $dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
     $dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "answer";
     $dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "";
     $dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
     $dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
     $y++;
     $dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
     $dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
     $dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
     $dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "fax_uuid=" . $this->fax_uuid;
     $dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
     $dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
     $y++;
     $dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
     $dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
     $dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
     $dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "api_hangup_hook=lua app/fax/resources/scripts/hangup_rx.lua";
     $dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
     $dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
     $y++;
     foreach ($_SESSION['fax']['variable'] as $data) {
         $dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
         $dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
         $dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
         if (substr($data, 0, 8) == "inbound:") {
             $dialplan["dialplan_details"][$y]["dialplan_detail_data"] = substr($data, 8, strlen($data));
         } elseif (substr($data, 0, 9) == "outbound:") {
         } else {
             $dialplan["dialplan_details"][$y]["dialplan_detail_data"] = $data;
         }
         $dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
         $dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
         $y++;
     }
     $dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
     $dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
     $dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
     if (strlen($_SESSION['fax']['last_fax']['text']) > 0) {
         $dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "last_fax=" . $_SESSION['fax']['last_fax']['text'];
     } else {
         $dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "last_fax=\${caller_id_number}-\${strftime(%Y-%m-%d-%H-%M-%S)}";
     }
     $dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
     $dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
     $y++;
     $dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
     $dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
     $dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "playback";
     $dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "silence_stream://2000";
     $dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
     $dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
     $y++;
     $dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
     $dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
     $dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "rxfax";
     $dialplan["dialplan_details"][$y]["dialplan_detail_data"] = $_SESSION['switch']['storage']['dir'] . '/fax/' . $_SESSION['domain_name'] . '/' . $this->fax_extension . '/inbox/' . $this->forward_prefix . '${last_fax}.tif';
     $dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
     $dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
     $y++;
     $dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
     $dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
     $dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "hangup";
     $dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "";
     $dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
     $dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
     $y++;
     //add the dialplan permission
     $p = new permissions();
     $p->add("dialplan_add", 'temp');
     $p->add("dialplan_detail_add", 'temp');
     $p->add("dialplan_edit", 'temp');
     $p->add("dialplan_detail_edit", 'temp');
     //save the dialplan
     $orm = new orm();
     $orm->name('dialplans');
     $orm->save($dialplan);
     $dialplan_response = $orm->message;
     $this->dialplan_uuid = $dialplan_response['uuid'];
     //if new dialplan uuid then update the call center queue
     $sql = "update v_fax ";
     $sql .= "set dialplan_uuid = '" . $this->dialplan_uuid . "' ";
     $sql .= "where fax_uuid = '" . $this->fax_uuid . "' ";
     $sql .= "and domain_uuid = '" . $this->domain_uuid . "' ";
     $this->db->exec($sql);
     unset($sql);
     //remove the temporary permission
     $p->delete("dialplan_add", 'temp');
     $p->delete("dialplan_detail_add", 'temp');
     $p->delete("dialplan_edit", 'temp');
     $p->delete("dialplan_detail_edit", 'temp');
     //synchronize the xml config
     save_dialplan_xml();
     //clear the cache
     $cache = new cache();
     $cache->delete("dialplan:" . $_SESSION['context']);
     //return the dialplan_uuid
     return $dialplan_response;
 }
Ejemplo n.º 24
0
$device_profiles[0]["device_profile_name"] = $device_profiles[0]["device_profile_name"] . "-" . strtolower($text['button-copy']);
$device_profiles[0]["device_profile_description"] = $text['button-copy'] . " " . $device_profiles[0]["device_profile_description"];
//prepare the device_keys array
$x = 0;
foreach ($device_keys as $row) {
    unset($device_keys[$x]["device_profile_uuid"]);
    unset($device_keys[$x]["device_key_uuid"]);
    $x++;
}
//prepare the device_settings array
//$x = 0;
//foreach ($device_settings as $row) {
//	unset($device_settings[$x]["device_uuid"]);
//	unset($device_settings[$x]["device_setting_uuid"]);
//	$x++;
//}
//create the device array
$device_profile = $device_profiles[0];
$device_profile["device_keys"] = $device_keys;
//$device["device_settings"] = $device_settings;
//copy the device
if ($save) {
    $orm = new orm();
    $orm->name('device_profiles');
    $orm->save($device_profile);
    $response = $orm->message;
    $_SESSION["message"] = $text['message-copy'];
}
//redirect
header("Location: device_profiles.php");
return;
Ejemplo n.º 25
0
 /**
  * This little method is used to update the order of the FAQ articles, 
  * it will accept an array of the new order. This has been created 
  * to be used with a drag n drop jquery script. called jquery.hive.resort
  * 
  * @var POST array 
  * 		array(2) {
  * 		  [0]=>
  * 		  array(2) {
  * 		    [0]=>
  * 		    string(1) "3"
  * 		    [1]=>
  * 		    string(1) "0"
  * 		  }
  * 		  [1]=>
  * 		  array(2) {
  * 		    [0]=>
  * 		    string(1) "2"
  * 		    [1]=>
  * 		    string(1) "1"
  *		  }
  * 
  * With first int with the e inner most array being the ID of the item
  * With the second int with in the inner most array being the ORDER
  * 
  */
 function update_order()
 {
     if ($this->access->allowed('billboards', 'update')) {
         $data = $this->input->post('data');
         $successes = 0;
         // simple counter to tell end user how many times it worked.
         foreach ($data as $info) {
             $billboard = orm::factory('billboard', $info[0]);
             // @todo does this require a find()
             $billboard->order = $info[1];
             if ($billboard->save()) {
                 $successes++;
             }
         }
         // add the error messages
         if ($successes == count($data)) {
             $this->notification->add($this->i18n['system.billboard.success']);
         } else {
             $this->notification->add($this->i18n['system.billboard.failed'], count($data) - $successes);
         }
     } else {
         url::failed();
     }
 }
Ejemplo n.º 26
0
//prepare the device_keys array
$x = 0;
foreach ($device_keys as $row) {
    unset($device_keys[$x]["device_uuid"]);
    unset($device_keys[$x]["device_key_uuid"]);
    $x++;
}
//prepare the device_settings array
$x = 0;
foreach ($device_settings as $row) {
    unset($device_settings[$x]["device_uuid"]);
    unset($device_settings[$x]["device_setting_uuid"]);
    $x++;
}
//create the device array
$device = $devices[0];
$device["device_mac_address"] = $mac_address_new;
$device["device_lines"] = $device_lines;
$device["device_keys"] = $device_keys;
$device["device_settings"] = $device_settings;
//copy the device
if ($save) {
    $orm = new orm();
    $orm->name('devices');
    $orm->save($device);
    $response = $orm->message;
    $_SESSION["message"] = $text['message-copy'];
}
//redirect
header("Location: devices.php");
return;
Ejemplo n.º 27
0
         if (strlen($_POST["ring_group_destinations"][$x]["domain_uuid"]) == 0) {
             $_POST["ring_group_destinations"][$x]["domain_uuid"] = $_SESSION['domain_uuid'];
         }
         //unset the empty row
         if (strlen($_POST["ring_group_destinations"][$x]["destination_number"]) == 0) {
             unset($_POST["ring_group_destinations"][$x]);
         }
         //unset ring_group_destination_uuid if the field has no value
         if (strlen($row["ring_group_destination_uuid"]) == 0) {
             unset($_POST["ring_group_destinations"][$x]["ring_group_destination_uuid"]);
         }
         //increment the row
         $x++;
     }
     //save to the data
     $orm = new orm();
     $orm->name('ring_groups');
     if (strlen($ring_group_uuid) > 0) {
         $orm->uuid($ring_group_uuid);
     }
     $orm->save($_POST);
     $message = $orm->message;
     if (strlen($ring_group_uuid) == 0) {
         $ring_group_uuid = $message['uuid'];
         $_GET["id"] = $ring_group_uuid;
     }
 }
 //delete the dialplan details
 $sql = "delete from v_dialplan_details ";
 $sql .= "where domain_uuid = '" . $_SESSION['domain_uuid'] . "' ";
 $sql .= "and dialplan_uuid = '" . $dialplan_uuid . "' ";
Ejemplo n.º 28
0
        }
    }
    header("Location: time_condition_edit.php?id=" . $dialplan_uuid . ($app_uuid != '' ? "&app_uuid=" . $app_uuid : null));
    return;
}
//end if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//get existing data to pre-populate form
if ($dialplan_uuid != '' && $_POST["persistformvar"] != "true") {
    //add the dialplan permission
    $p = new permissions();
    $p->add("dialplan_add", 'temp');
    $p->add("dialplan_detail_add", 'temp');
    $p->add("dialplan_edit", 'temp');
    $p->add("dialplan_detail_edit", 'temp');
    //get main dialplan entry
    $orm = new orm();
    $orm->name('dialplans');
    $orm->uuid($dialplan_uuid);
    $result = $orm->find()->get();
    //$message = $orm->message;
    foreach ($result as &$row) {
        $domain_uuid = $row["domain_uuid"];
        //$app_uuid = $row["app_uuid"];
        $dialplan_name = $row["dialplan_name"];
        $dialplan_number = $row["dialplan_number"];
        $dialplan_order = $row["dialplan_order"];
        $dialplan_continue = $row["dialplan_continue"];
        $dialplan_context = $row["dialplan_context"];
        $dialplan_enabled = $row["dialplan_enabled"];
        $dialplan_description = $row["dialplan_description"];
    }
Ejemplo n.º 29
0
            $sql .= "('" . uuid() . "', 'Thai', 'th'), ";
            $sql .= "('" . uuid() . "', 'Tibetan', 'bo'), ";
            $sql .= "('" . uuid() . "', 'Tsonga', 'ts'), ";
            $sql .= "('" . uuid() . "', 'Turkish', 'tr'), ";
            $sql .= "('" . uuid() . "', 'Turkmen', 'tk'), ";
            $sql .= "('" . uuid() . "', 'Ukrainian', 'uk'), ";
            $sql .= "('" . uuid() . "', 'Urdu', 'ur'), ";
            $sql .= "('" . uuid() . "', 'Uzbek - Cyrillic, Latin', 'uz-uz'), ";
            $sql .= "('" . uuid() . "', 'Vietnamese', 'vi'), ";
            $sql .= "('" . uuid() . "', 'Welsh', 'cy'), ";
            $sql .= "('" . uuid() . "', 'Xhosa', 'xh'), ";
            $sql .= "('" . uuid() . "', 'Yiddish', 'yi') ";
            $db->exec(check_sql($sql));
            unset($sql);
        }
        unset($prep_statement, $row);
    }
    //set the sip_profiles directory for older installs
    if (isset($_SESSION['switch']['gateways']['dir'])) {
        $orm = new orm();
        $orm->name('default_settings');
        $orm->uuid($_SESSION['switch']['gateways']['uuid']);
        $array['default_setting_category'] = 'switch';
        $array['default_setting_subcategory'] = 'sip_profiles';
        $array['default_setting_name'] = 'dir';
        //$array['default_setting_value'] = '';
        //$array['default_setting_enabled'] = 'true';
        $orm->save($array);
        unset($array);
    }
}
Ejemplo n.º 30
0
        }
        if ($action == "update") {
            $_SESSION["message"] = $text['message-update'];
        }
        header("Location: destination_edit.php?id=" . $destination_uuid);
        return;
    }
    //if ($_POST["persistformvar"] != "true")
}
//(count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0)
//initialize the destinations object
$destination = new destinations();
//pre-populate the form
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {
    $destination_uuid = $_GET["id"];
    $orm = new orm();
    $orm->name('destinations');
    $orm->uuid($destination_uuid);
    $result = $orm->find()->get();
    foreach ($result as &$row) {
        $domain_uuid = $row["domain_uuid"];
        $dialplan_uuid = $row["dialplan_uuid"];
        $destination_type = $row["destination_type"];
        $destination_number = $row["destination_number"];
        $destination_caller_id_name = $row["destination_caller_id_name"];
        $destination_caller_id_number = $row["destination_caller_id_number"];
        $destination_cid_name_prefix = $row["destination_cid_name_prefix"];
        $destination_context = $row["destination_context"];
        $fax_uuid = $row["fax_uuid"];
        $destination_enabled = $row["destination_enabled"];
        $destination_description = $row["destination_description"];