Exemple #1
0
function insertData($climate)
{
    global $climate_db;
    global $device_db;
    //Open MySQL Connection inorder to get last data point for a device.
    $database = sql_dmca();
    $climate = arrayEscape($climate, $database);
    $climate_results['error'] = "";
    // Check that the foreign key will be valid
    $device_check = getDevice($climate);
    // If the device doesn't already exist then create it in the device table
    if ($device_check["info"]->num_rows == 0) {
        $device_add_results = addDevice($climate);
        if ($device_add_results['error']) {
            $climate_results['error'] .= $device_add_results['error'];
        }
    }
    $climate_results['statement'] = "INSERT INTO {$climate_db}\n \t\t\t\t\t\t\t\t\t(location_id, time, temp)\n \t\t\t\t\t\t\t\t\tVALUES\n \t\t\t\t\t\t\t\t\t( (SELECT id FROM {$device_db} WHERE building='{$climate['building']}' AND room = '{$climate['room']}'), \n \t\t\t\t\t\t\t\t\t\t'{$climate['timestamp']}', \n \t\t\t\t\t\t\t\t\t\t'{$climate['temperature']}')";
    $climate_results['info'] = $database->query($climate_results['statement']);
    $climate_results['error'] .= $database->error;
    if ($climate_results['error']) {
        $climate_results['results'] .= "Climate Insertion Error {$climate['building']} {$climate['room']} {$climate['timestamp']}";
    } else {
        $climate_results['results'] .= "Climate Insertion Success {$climate['building']} {$climate['room']} {$climate['timestamp']}";
    }
    $database->close();
    return $climate_results;
}
<?php

// brian suda
// triagemail.com
// 2008-06-03
session_start();
// Get and setup some variables
$lang = getLang();
$lang = 'en';
// device type
// (desktop | mobile | iPhone)
$device = getDevice();
// browser type??
// possibly different hacks or widths?
?>
<html>
  <head>
	<title>Email Triage</title>
	<!-- this needs to be updated depending on the device -->
	<style type="text/css">
		html,body { margin: 0; padding: 0; font-family:"CooperBlack","Cooper Black","Cooper Std","CooperStd"; font-size: 24px; }
		.label span { display: block; float: left; width: 145px; text-align: right; color: #bbb; padding-right: 5px; }
		.label { color: #000;}
		h1 { padding: 30px 0 5px 10px; text-align: bottom; background-color: #909; color: white; }
		.counter { position: absolute; text-align: right; right: 5px; top: 48px; width: 100%; color: white; }
		.logout { position: absolute; right: 5px; top: 10px;}
		.button { display: block; margin: 10px; height: 200px; width: 200px; float: left;}
		.delete { color: white; position: absolute; left:  20px; display: block; width: 200px; text-align: center; top: 270px;}
		.act    { color: white; position: absolute; left: 240px; display: block; width: 200px; text-align: center; top: 270px;}
		.defer  { color: white; position: absolute; left: 460px; display: block; width: 200px; text-align: center; top: 270px;}
		.ignore { color: white; position: absolute; left: 680px; display: block; width: 200px; text-align: center; top: 270px;}
Exemple #3
0
<?php

/**
 * @file
 * Bartik's theme implementation to display a single Drupal page.
 *
**/
global $base_url;
$device_type = getDevice();
?>
<button id="toggle" type="button" class="navbar-toggle main_h">
        <div class="icon-bar"></div>
        <div class="icon-bar"></div>
        <div class="icon-bar"></div>
</button>
<div id="overlay"></div>
<nav id="menu">
<? $url = "http://localhost/masaya/public/index.php/api/get_footer_data/".$language->language;
          $abcd = file_get_contents($url);
          $objecth = json_decode($abcd, true);
          //echo "<pre>"; print_r($objecth); ?> 
  <ul class="nav navbar-nav">
      <li class="nav-item"><a href="<?php 
echo $objecth['footerlinkone']['0']['link_url2'];
?>
"><span><?php 
echo t('Our Hostels');
?>
</span><br /><?php 
echo t('Bogota');
?>
/**
 * Enqueue scripts and styles.
 *
 * @since Media Loft 1.0
 */
function medialoft_scripts()
{
    global $detect;
    // wp_enqueue_script( 'modernizr', get_template_directory_uri() . '/assets/js/vendor/modernizr.js', array( 'jquery' ), true );
    // wp_enqueue_script( 'jquery-ui.js', get_template_directory_uri() . '/assets/js/vendor/jquery-ui.js', array( 'jquery' ), true );
    // wp_enqueue_script( 'jquery-mousewheel', get_template_directory_uri() . '/assets/js/vendor/jquery-mousewheel.js', array( 'jquery' ), true );
    // wp_enqueue_script( 'jquery-kinetic', get_template_directory_uri() . '/assets/js/vendor/jquery-kinetic.js', array( 'jquery' ), true );
    // wp_enqueue_script( 'jquery-smoothscroll', get_template_directory_uri() . '/assets/js/vendor/jquery-smoothscroll.js', array( 'jquery' ), true );
    wp_enqueue_script('ml-vendor', get_template_directory_uri() . '/assets/js/build/vendor/vendor.min.js', array('jquery'), true);
    wp_enqueue_script('ml-libraries', get_template_directory_uri() . '/assets/js/src/libs/libs.min.js', array('jquery'), true);
    wp_enqueue_script('medialoft-script', get_template_directory_uri() . '/assets/js/build/ml.min.js', array('jquery'), true);
    if (is_front_page() || is_page('home')) {
        wp_enqueue_script('home', get_template_directory_uri() . '/assets/js/build/modules/home.min.js', array('jquery'), true);
    }
    if (is_page('work')) {
        wp_enqueue_script('work', get_template_directory_uri() . '/assets/js/src/modules/work.js', array('jquery'), true);
    }
    if (is_page('about')) {
        wp_enqueue_script('about', get_template_directory_uri() . '/assets/js/src/modules/about.js', array('jquery'), true);
        wp_enqueue_script('timeline', get_template_directory_uri() . '/assets/js/src/modules/timeline.js', array('jquery'), true);
        wp_enqueue_script('tiles-clients', get_template_directory_uri() . '/assets/js/src/modules/about-tiles-clients.js', array('jquery'), true);
        wp_enqueue_script('tiles-people', get_template_directory_uri() . '/assets/js/src/modules/about-tiles-people.js', array('jquery'), true);
    }
    if (is_page('contact')) {
        wp_enqueue_script('contact', get_template_directory_uri() . '/assets/js/src/modules/contact.js', array('jquery'), true);
    }
    if (is_page('services')) {
        wp_enqueue_script('services', get_template_directory_uri() . '/assets/js/src/modules/services.js', array('jquery'), true);
    }
    if (is_home()) {
        wp_enqueue_script('blog', get_template_directory_uri() . '/assets/js/src/modules/blog.js', array('jquery'), true);
    }
    if (is_page('test')) {
        wp_enqueue_script('test', get_template_directory_uri() . '/assets/js/src/modules/test.js', array('jquery'), true);
    }
    $dataToBePassed = array('home' => get_stylesheet_directory_uri(), 'device' => getDevice(), 'isMobile' => $detect->isMobile() == '1' ? true : false, 'isTablet' => $detect->isTablet() == '1' ? true : false, 'isTouch' => $detect->isTablet() || $detect->isMobile(), 'isDesktop' => !$detect->isTablet() && !$detect->isMobile());
    wp_localize_script('medialoft-script', 'ML_vars', $dataToBePassed);
}
/**
 * Criação de dispositivo
 */
function createDevice()
{
    global $log;
    $device = null;
    $app = Slim::getInstance();
    try {
        $input = json_decode($app->request()->getBody());
        $log->Debug(sprintf("api - createDevice - %s", print_r($input, true)));
        $device = getDevice($input);
    } catch (Exception $e) {
        badRequest($e, $log);
        return;
    }
    try {
        $deviceCreated = DeviceManager::insertDevice($device);
        if ($deviceCreated) {
            created("Dispositivo criado com sucesso.");
        } else {
            conflict("O dispositivo já está cadastrado", $log);
        }
    } catch (Exception $e) {
        internalServerError($e, $log);
    }
}
Exemple #6
0
/**
 * Override or insert variables into the node template.
 */
function masaya_preprocess_node(&$variables)
{
    if ($variables['view_mode'] == 'full' && node_is_page($variables['node'])) {
        $variables['classes_array'][] = 'node-full';
    }
    if ($variables['node']->type == 'city_guide_articles') {
        $device_type = getDevice();
        if ($device_type != 'mobile') {
            /*drupal_add_js('(function ($) {
                $(document).ready(function () {
                  var h = $(document).height() - $(window).height() - $(\'footer\').height() - $(\'ul.contant_cities_foo\').height() - 200;
                  var flag = 1;
                  $(window).scroll(function () {
                    if (($(window).scrollTop() >= h) && (flag == 1)) {
                      flag = 0;
                      console.log(\'class added\');
                      $(\'.col-lg-4.col-md-4.fight_section.main_h.sticky\').addClass(\'withFooter\');
                    }
                    else if(($(window).scrollTop() < h) && $(\'.col-lg-4.col-md-4.fight_section.main_h.sticky\').hasClass(\'withFooter\') && flag == 0) {
                      $(\'.col-lg-4.col-md-4.fight_section.main_h.sticky\').removeClass(\'withFooter\');
                      console.log(\'removed\');
                      flag = 1;
                    }
                  });
                });
              }) (jQuery);', array('type'=>'inline'));*/
            drupal_add_js('(function ($) {
        $(document).ready(function () {
          var h = $(document).height() - $(window).height() - $(\'footer\').height() - $(\'ul.contant_cities_foo\').height() - 200;
          var flag = 1;
          
          var a = $(window).height() - $(\'header.main_h.main_head\').height() - $(\'.main_yellow_inner.main_h.blog_top-yellow\').height();
          $(\'.col-lg-4.col-md-4.fight_section.main_h\').css(\'height\', parseInt(a)+\'px\');
          var flag2 = true;
          $(window).scroll(function () {
            /*if (($(window).scrollTop() >= h) && (flag == 1)) {
              flag = 0;
              console.log(\'class added\');
              $(\'.col-lg-4.col-md-4.fight_section.main_h.sticky\').addClass(\'withFooter\');
            }
            else if(($(window).scrollTop() < h) && $(\'.col-lg-4.col-md-4.fight_section.main_h.sticky\').hasClass(\'withFooter\') && flag == 0) {
              $(\'.col-lg-4.col-md-4.fight_section.main_h.sticky\').removeClass(\'withFooter\');
              console.log(\'removed\');
              flag = 1;
            }*/
            if ($(window).scrollTop() < 120) {
              $(\'.col-lg-4.col-md-4.fight_section.main_h\').css(\'height\', (parseInt(a) + $(window).scrollTop())+\'px\');
              flag2 = true;
            } 
            else if(flag2) {
              $(\'.col-lg-4.col-md-4.fight_section.main_h\').css(\'height\', parseInt(a)+\'px\');
              flag2 = false;
            }
          });
        });
      }) (jQuery);', array('type' => 'inline'));
        }
    }
    if ($variables['node']->type == 'discover_columbia_article') {
        $device_type = getDevice();
        if ($device_type != 'mobile') {
            drupal_add_js('(function ($) {
        $(document).ready(function () {
          var h = $(document).height() - $(window).height() - $(\'footer\').height() - $(\'ul.contant_cities_foo\').height() - 200;
          var flag = 1;
          
          var a = $(window).height() - $(\'header.main_h.main_head\').height() - $(\'.main_yellow_inner.main_h.blog_top-yellow\').height();
          $(\'.col-lg-4.col-md-4.fight_section.main_h\').css(\'height\', parseInt(a)+\'px\');
          var flag2 = true;
          $(window).scroll(function () {
            /*if (($(window).scrollTop() >= h) && (flag == 1)) {
              flag = 0;
              console.log(\'class added\');
              $(\'.col-lg-4.col-md-4.fight_section.main_h.sticky\').addClass(\'withFooter\');
            }
            else if(($(window).scrollTop() < h) && $(\'.col-lg-4.col-md-4.fight_section.main_h.sticky\').hasClass(\'withFooter\') && flag == 0) {
              $(\'.col-lg-4.col-md-4.fight_section.main_h.sticky\').removeClass(\'withFooter\');
              console.log(\'removed\');
              flag = 1;
            }*/
            if ($(window).scrollTop() < 120) {
              $(\'.col-lg-4.col-md-4.fight_section.main_h\').css(\'height\', (parseInt(a) + $(window).scrollTop())+\'px\');
              flag2 = true;
            } 
            else if(flag2) {
              $(\'.col-lg-4.col-md-4.fight_section.main_h\').css(\'height\', parseInt(a)+\'px\');
              flag2 = false;
            }
          });
        });
      }) (jQuery);', array('type' => 'inline'));
        }
        drupal_add_js('
jQuery(document).ready(function($){
  $($(\'form#comment-form\')).insertAfter(\'.comments #comments h2.title\');
  var cCount = $(\'.comments #comments > .comment\').length;
  if(cCount > 0) {
    $(\'.comments > #comments > h2.title\').prepend(cCount+\' \');
    $(\'.comments #comments form.comment-form\').last().remove();
  }
  $(\'#writeComment\').click(function(e){
    e.preventDefault();
    var displayProp = $(\'form#comment-form\').css(\'display\');
    if(displayProp == \'none\'){
      $(\'form#comment-form\').css(\'display\', \'block\');
    }
    else if(displayProp == \'block\') {
      $(\'form#comment-form\').css(\'display\', \'none\');
    }
  });
});', array('type' => 'inline'));
    }
    if ($variables['node']->type == 'vos_voyages') {
        drupal_add_js('
jQuery(document).ready(function($){
  $($(\'form#comment-form\')).insertAfter(\'.comments #comments h2.title\');
  var cCount = $(\'.comments #comments > .comment\').length;
  if(cCount > 0) {
    $(\'.comments > #comments > h2.title\').prepend(cCount+\' \');
    $(\'.comments #comments form.comment-form\').last().remove();
  }
  $(\'#writeComment\').click(function(e){
    e.preventDefault();
    var displayProp = $(\'form#comment-form\').css(\'display\');
    if(displayProp == \'none\'){
      $(\'form#comment-form\').css(\'display\', \'block\');
    }
    else if(displayProp == \'block\') {
      $(\'form#comment-form\').css(\'display\', \'none\');
    }
  });
});', array('type' => 'inline'));
    }
    if ($variables['node']->type == 'photo_album') {
        drupal_add_js('jQuery.extend(Drupal.settings, { "pathToTheme": "' . path_to_theme() . '" });', 'inline');
        drupal_add_js('(function ($) { $(document).ready(function(){
      var flag = 1;
      $(window).scroll(function () { 
         if (($(window).scrollTop() >= $(document).height() - $(window).height() - $(\'footer\').height() - 200) && (flag == 1)) {
           flag = 0;
           $(\'.col-lg-12.padding_none\').last().after(\'<div class="waiting" style="background: url(\'+Drupal.settings.basePath + Drupal.settings.pathToTheme + \'/images/waiting.gif); background-size: 545px 90px; height: 90px; width: 100%; background-position: 50% 50%; background-repeat: no-repeat; float:left;"></div>\') ;
           var url_val = $(\'.instgram-data-holder\').last().attr(\'data-next-url\');
           $.ajax({
              data: ({ \'page\': url_val }),
              type: \'POST\',
              url: \'http://182.74.195.210/MasayaBlog/getNextScroll\',
              success: function (data) {
                $(\'.waiting\').remove();
                $(\'.col-lg-12.padding_none\').last().after(data.data);
                if(data.data.indexOf("No more images") == -1) {
                  flag = 1;
                }
              }
           });
         }
      });
    });})(jQuery);', array('type' => 'inline'));
    }
    drupal_add_js('(function($) {
  $(document).ready(function() {
    var path = window.location.href;
    $("ul a").each(function() {
        if (this.href === path) {
            $(this).addClass("active");
        }
    });
    $(\'.active\').parents(\'li\').addClass(\'active\');
  });
}(jQuery));', array('type' => 'inline', 'scope' => 'footer'));
    if ($variables['node']->type == 'your_stay') {
        $og_title = array('#tag' => 'meta', '#attributes' => array('property' => 'og:title', 'content' => $variables['title']));
        drupal_add_html_head($og_title, 'og_title');
        $og_description = array('#tag' => 'meta', '#attributes' => array('property' => 'og:description', 'content' => $variables['title']));
        drupal_add_html_head($og_description, 'og_description');
        $og_url = array('#tag' => 'meta', '#attributes' => array('property' => 'og:url', 'content' => 'http://182.74.195.210/MasayaBlog/en/preparing-your-stay'));
        drupal_add_html_head($og_url, 'og_url');
        $img = field_get_items('node', $variables['node'], 'field_sec1_subsection1_image');
        $img_url = file_create_url($img[0]['uri']);
        $og_image = array('#tag' => 'meta', '#attributes' => array('property' => 'og:image', 'content' => $img_url));
        drupal_add_html_head($og_image, 'og_image');
        drupal_add_js('(function($){ $(document).ready(function(){
    var oddClick1 = false;
    var oddClick2 = false;
    var oddClick3 = false;
    var oddClick4 = false;
    var maxHeight = Math.max.apply(null, $("section").map(function ()
    { return $(this).height(); }).get());

    $(\'section\').css(\'height\', maxHeight);

    $("#Section_1_toggle").click(function(){
        $("#Section_1_panel").slideToggle("slow");
        $("#Section_2_panel").hide();
        $("#Section_3_panel").hide();
        $("#Section_4_panel").hide();
        $(\'.Section_2\').css(\'height\', maxHeight);
        $(\'.Section_3\').css(\'height\', maxHeight);
        $(\'.Section_4\').css(\'height\', maxHeight);

        $(\'html, body\').animate({
            scrollTop: ($(this).offset().top - 290)
        }, 200);
        
        oddClick1 ? ($(\'.Section_1\').css(\'height\', maxHeight)) : ($(\'.Section_1\').css(\'height\', \'auto\'));
        oddClick1 = !oddClick1;
        oddClick2 = false;
        oddClick3 = false;
        oddClick4 = false;
    });

    $("#Section_2_toggle").click(function(){
        $("#Section_2_panel").slideToggle("slow");
        $("#Section_1_panel").hide();
        $("#Section_3_panel").hide();
        $("#Section_4_panel").hide();
        $(\'.Section_1\').css(\'height\', maxHeight);
        $(\'.Section_3\').css(\'height\', maxHeight);
        $(\'.Section_4\').css(\'height\', maxHeight);
        
        $(\'html, body\').animate({
            scrollTop: ($(this).offset().top - 290)
        }, 200);
        
        oddClick2 ? ($(\'.Section_2\').css(\'height\', maxHeight)) : ($(\'.Section_2\').css(\'height\', \'auto\'));
        oddClick2 = !oddClick2;
        oddClick1 = false;
        oddClick3 = false;
        oddClick4 = false;
    });

    $("#Section_3_toggle").click(function(){
        $("#Section_3_panel").slideToggle("slow");
        $("#Section_1_panel").hide();
        $("#Section_2_panel").hide();
        $("#Section_4_panel").hide();
        $(\'.Section_1\').css(\'height\', maxHeight);
        $(\'.Section_2\').css(\'height\', maxHeight);
        $(\'.Section_4\').css(\'height\', maxHeight);
        
        $(\'html, body\').animate({
            scrollTop: ($(this).offset().top - 290)
        }, 200);
        
        oddClick3 ? ($(\'.Section_3\').css(\'height\', maxHeight)) : ($(\'.Section_3\').css(\'height\', \'auto\'));
        oddClick3 = !oddClick3;
        oddClick1 = false;
        oddClick2 = false;
        oddClick4 = false;
    });

    $("#Section_4_toggle").click(function(){
        $("#Section_4_panel").slideToggle("slow");
        $("#Section_1_panel").hide();
        $("#Section_3_panel").hide();
        $("#Section_2_panel").hide();
        $(\'.Section_1\').css(\'height\', maxHeight);
        $(\'.Section_2\').css(\'height\', maxHeight);
        $(\'.Section_3\').css(\'height\', maxHeight);
        
        $(\'html, body\').animate({
            scrollTop: ($(this).offset().top - 290)
        }, 200);
        
        oddClick4 ? ($(\'.Section_4\').css(\'height\', maxHeight)) : ($(\'.Section_4\').css(\'height\', \'auto\'));
        oddClick4 = !oddClick4;
        oddClick1 = false;
        oddClick2 = false;
        oddClick3 = false;
    });

});})(jQuery);', array('type' => 'inline'));
    }
}
Exemple #7
0
    }
    if (CONFIG_PASSWORD && !checkCredentials($username, $password)) {
        // Invalid username or password.
    } else {
        if (CONFIG_PIN && $pin != $posted_pin) {
            trace("access denied for user '{$username}', wrong pin {$posted_pin}");
            $errtext = _('Invalid PIN.');
        } else {
            // Successfully checked username, password and PIN.
            trace("access granted for user '{$username}'");
            $_SESSION['username'] = $username;
            $_SESSION['address'] = $dbcon->ipAddress();
            $_SESSION['pin'] = $pin;
            $_SESSION['starturl'] = CONFIG_START_URL;
            $_SESSION['monitor'] = CONFIG_STATIONNAME;
            $dbcon->addUser($username, $dbcon->ipAddress(), getDevice());
            // Weiterleitung zur geschützten Startseite
            if ($_SERVER['SERVER_PROTOCOL'] == 'HTTP/1.1') {
                if (php_sapi_name() == 'cgi') {
                    header('Status: 303 See Other');
                } else {
                    header('HTTP/1.1 303 See Other');
                }
            }
            header('Location: ' . CONFIG_START_URL);
            exit;
        }
    }
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
Exemple #8
0
$generalConfig = getConfig();
# Get Device ID
$cookieDeviceID = isset($_COOKIE['deviceID']) ? $_COOKIE['deviceID'] : NULL;
if (isset($_GET['id']) && !empty($_GET['id'])) {
    $deviceID = $_GET['id'];
    setcookie('deviceID', $deviceID, 0);
    ## Unset PID if Device ID has changed
    if (!isset($cookieDeviceID) || $cookieDeviceID !== $deviceID) {
        unset($_COOKIE['practiceID']);
    }
} elseif (isset($_COOKIE['deviceID'])) {
    $deviceID = $_COOKIE['deviceID'];
} else {
    exit('no `id` var in querystring');
}
# Get device data
$device = getDevice($deviceID);
# Device type
switch (substr($deviceID, 0, 2)) {
    case 'K_':
        $deviceType = DEVICE_KIOSK;
        break;
    case 'P_':
        $deviceType = DEVICE_PC;
        break;
    case 'M_':
        $deviceType = DEVICE_HANDHELD;
        break;
    default:
        $deviceType = DEVICE_WEB;
}