public function testLight() { $lamp = new Light(); $switchUp = new FlipUpCommand($lamp); $switchDown = new FlipDownCommand($lamp); $s = new Switcher(); $this->assertEquals('The light is off', $s->storeAndExecute($switchDown)); $this->assertEquals('The light is on', $s->storeAndExecute($switchUp)); }
public function __construct($state, $action) { session_start(); parent::__construct($state, $action); $this->ip = Ip::getClientIp(); if ($action == 'set' || $action == 'set_tmp_log') { Switcher::close('postRefererCheck'); Switcher::close('masterDbPostOnly'); } }
public function __construct($state, $action) { SESSION_START(); parent::__construct($state, $action); $this->ip = Ip::getClientIp(); if (in_array($action, array('debug'))) { Switcher::close('postRefererCheck'); } //控制外网IP访问管理功能 if (substr($this->ip, 0, 3) != '10.') { header("HTTP/1.0 404 Not Found"); exit; } }
<?php require 'light.php'; $lamp = new Light(); $switchUp = new FlipUpCommand($lamp); $switchDown = new FlipDownCommand($lamp); $s = new Switcher(); $case = "off"; if ($case == "on") { echo $s->storeAndExecute($switchUp); } else { echo $s->storeAndExecute($switchDown); }
define("THEME_BULLET", "<img class='bullet' src='" . THEME . "images/bullet.gif' alt='->' />"); //bullet image $enable_colour_switcher = true; //true=enable colour switcher | false=disable colour switcher $enable_fontsize_switcher = true; //true=enable fontsize switcher | false=disable fontsize switcher if (!defined("IN_FUSION")) { die("Access Denied"); } require_once INCLUDES . "theme_functions_include.php"; require_once THEMES . "templates/switcher.php"; $colour_switcher = new Switcher("select", "colour", "gif", "green", "switcherbutton"); if (!$enable_colour_switcher) { $colour_switcher->disable(); } $fontsize_switcher = new Switcher("increment", "fontsize", "gif", 1, "switcherbutton", "", true, array("step" => 0.1, "max" => 1.5)); if (!$enable_fontsize_switcher) { $fontsize_switcher->disable(); } function get_head_tags() { global $colour_switcher, $fontsize_switcher; echo $colour_switcher->makeHeadTag(); echo "<style type='text/css'>body{font-size: " . $fontsize_switcher->selected . "em;}</style>"; echo "<!--[if lte IE 7]><style type='text/css'>.clearfix {display:inline-block;} * html .clearfix{height: 1px;}</style><![endif]-->"; } function render_page($license = false) { global $aidlink, $locale, $settings, $colour_switcher, $fontsize_switcher, $main_style; echo "\n\t<div id='main' style='width: " . THEME_WIDTH . ";'>\n\t\t<div id='uborder' class='clearfix'>\n\t\t\t<div id='ucornerl' class='flleft'></div>\n\t\t\t<div id='ucornerr' class='flright'></div>\n\t\t</div>\n\t\t<div id='borderr'>\n\t\t\t<div id='borderl'>\n\t\t\t\t<div id='cont' class='clearfix {$main_style}'>\n\t\t\t\t\t<div id='userbar' class='floatfix'>\n\t\t\t\t\t\t<ul id='anchors' class='flleft'><li><a href='#Content'>" . $locale['global_210'] . "</a></li></ul>\n\t\t\t\t\t\t<ul id='links' class='clearfix flright'>\n"; if (iMEMBER) {
| modify it under the terms of this license which you | can read by viewing the included agpl.txt or online | at www.gnu.org/licenses/agpl.html. Removal of this | copyright header is strictly prohibited without | written permission from the original author(s). +--------------------------------------------------------*/ if (!defined("IN_FUSION")) { die("Access Denied"); } define("THEME_BULLET", "<img src='" . THEME . "images/bullet.gif' class='bullet' alt='»' border='0' />"); define("THEME_WIDTH", "100%"); $enable_colour_switcher = true; require_once THEME . "functions.php"; require_once THEMES . "templates/switcher.php"; require_once INCLUDES . "theme_functions_include.php"; $colour_switcher = new Switcher("select", "colour", "png", "blue", "switcherbutton"); if (!$enable_colour_switcher) { $colour_switcher->disable(); } function get_head_tags() { global $colour_switcher; echo $colour_switcher->makeHeadTag(); echo "<!--[if lte IE 7]><style type='text/css'>.clearfix {display:inline-block;} * html .clearfix{height: 1px;}</style><![endif]-->"; } function render_page($license = false) { add_handler("theme_output"); global $settings, $main_style, $locale, $colour_switcher, $mysql_queries_time; //Wrapper echo "<div class='wrapper' style='width:" . THEME_WIDTH . ";'>\n";
/** * *@description: android获取client_id 是第三方推送过来的信息, 不能保证 登陆前一定能获取到.. 不阻塞用户登陆, 只有获取到之后再进行更新 */ public function updateClientId() { Switcher::close('masterDbPostOnly'); $username = $_POST['username']; $clientId = $_POST['client_id']; $userDB = new AlarmUserModelDB(); if (!empty($username) && !empty($clientId)) { $sql = "SELECT `id` FROM `" . $userDB->getTableName() . "` WHERE `username` = ?"; $userId = $userDB->getFirst($sql, array($username)); if (!empty($userId)) { $updateArr = array(); $updateArr['client_id'] = $clientId; $userDB->update($updateArr, array('id' => $userId)); Message::showSucc('succ'); } else { Message::showError('no such user'); } } else { Message::showError('username or clientid is empty'); } }