public function showError($code, $description = '$'){ $recorder = new Recorder(); if(! $recorder->readInc("errorReport")){ die(); } echo "<meta charset=\"UTF-8\">"; if($description == "$"){ die($this->errorMsg[$code]); }else{ echo "<h3>error:</h3>$code"; echo "<h3>msg :</h3>$description"; exit(); } }
/** * showError * 显示错误信息 * @param int $code 错误代码 * @param string $description 描述信息(可选) */ public function showError($code, $description = '$') { if ($description == "\$") { $description = $this->errorMsg[$code]; } msg('登录错误,错误信息:' . $description . '错误代码:' . $code, 'error', '?m=member&a=login'); $recorder = new Recorder(); if (!$recorder->readInc("errorReport")) { exit('配置文件不正确'); //die quietly } header('Content-Type: text/html; charset=UTF-8'); // echo "<meta charset=\"GBK\">"; if ($description == "\$") { die($this->errorMsg[$code]); } else { echo "<h3>error:</h3>{$code}"; echo "<h3>msg :</h3>{$description}"; exit; //return 'error:'.$code.'msg:'.$description; } }
public function __construct() { $this->error = new ErrorCase(); //-------读取配置文件 $incFileContents = file_get_contents(ROOT . "comm/inc.php"); $this->inc = json_decode($incFileContents); if (empty($this->inc)) { $this->error->showError("20001"); } if (empty($_SESSION['QC_userData'])) { self::$data = array(); } else { self::$data = $_SESSION['QC_userData']; } }
public function __construct(){ $this->error = new ErrorCase(); $incFileContents = file_get_contents(DATA_PATH.'ulogin.qq.php'); $this->inc = json_decode($incFileContents); if(empty($this->inc)){ $this->error->showError("20001"); } if(empty($_SESSION['QC_userData'])){ self::$data = array(); }else{ self::$data = $_SESSION['QC_userData']; } }
public function __construct() { $this->error = new ErrorCase(); //-------读取配置文件 $incFileContents = (include dirname(dirname(__FILE__)) . "/Oauth/comm/inc.php"); $this->inc = (object) $incFileContents; if (empty($this->inc)) { $this->error->showError("20001"); } if (empty($_SESSION['QC_userData'])) { self::$data = array(); } else { self::$data = $_SESSION['QC_userData']; } }
public function __construct() { $this->error = new ErrorCase(); //-------读取配置文件 $incFileContents = file_get_contents(APP_ROOT_PATH . "public/qqv2_inc.php"); $this->inc = json_decode($incFileContents); if (empty($this->inc)) { $this->error->showError("20001"); } if (!es_session::is_set('QC_userData')) { self::$data = array(); } else { self::$data = es_session::get('QC_userData'); } }
public function __construct() { $this->error = new ErrorCase(); //-------读取配置文件 $incFileContents = file(ROOT . "comm/inc.php"); $incFileContents = $incFileContents[1]; $this->inc = json_decode($incFileContents); if (empty($this->inc)) { $this->error->showError("20001"); } if (empty(Yii::app()->session['QC_userData'])) { self::$data = array(); } else { self::$data = Yii::app()->session['QC_userData']; } }
public function __construct() { $this->error = new ErrorCase(); //-------读取配置文件 $incFileContents = file(SITES_PATH . '/' . SITE_PATH . "/inc.php"); $incFileContents = $incFileContents[1]; $this->inc = json_decode($incFileContents); if (empty($this->inc)) { $this->error->showError("20001"); } if (empty($_SESSION['QC_userData'])) { self::$data = array(); } else { self::$data = $_SESSION['QC_userData']; } }
public function __construct() { global $_G; $this->error = new ErrorCase(); $tmp = array('appid' => $_G[setting][qq_appid], 'appkey' => $_G[setting][qq_appkey], 'host' => $_G[host], 'callback' => $_G[siteurl], 'scope' => "all", 'errorReport' => true, 'storageType' => 'file'); $incFileContents = json_encode($tmp); $this->inc = json_decode($incFileContents); if (empty($this->inc)) { $this->error->showError("20001"); } if (empty($_SESSION['QC_userData'])) { self::$data = array(); } else { self::$data =& $_SESSION['QC_userData']; } }
public function __construct() { $this->error = new ErrorCase(); //-------读取配置文件 $incFileContents = file(ROOT . "comm/inc.php"); $incFileContents = $incFileContents[1]; $incFileContents = preg_replace(array('/__APPID__/', '/__APPKEY__/', '/__CALLBACK__/'), array(Q_APPID, Q_APPKEY, Q_CALLBACK), $incFileContents); $this->inc = json_decode($incFileContents); if (empty($this->inc)) { $this->error->showError("20001"); } if (empty($_SESSION['QC_userData'])) { self::$data = array(); } else { self::$data = $_SESSION['QC_userData']; } }
public function __construct($inc) { Hybrid_Logger::debug("Construct QQ Recorder"); $this->error = new ErrorCase(); //-------读取配置文件 //$incFileContents = file(ROOT."comm/inc.php"); //$incFileContents = $incFileContents[1]; //$this->inc = json_decode($incFileContents); $this->inc = $inc; if (empty($this->inc)) { $this->error->showError("20001"); } if (empty($_SESSION['QC_userData'])) { self::$data = array(); } else { self::$data = $_SESSION['QC_userData']; } }
public function __construct() { $this->error = new ErrorCase(); //-------读取配置文件 //$incFileContents = file(ROOT."comm/inc.php"); //$incFileContents = $incFileContents[1]; //$this->inc = json_decode($incFileContents); $arr = array('appid' => QQ_LOGIN_APPID, 'appkey' => QQ_LOGIN_APPKEY, 'callback' => QQ_CALLBACK_URI, 'scope' => 'get_user_info,add_share,list_album,add_album,upload_pic,add_topic,add_one_blog,add_weibo,check_page_fans,add_t,add_pic_t,del_t,get_repost_list,get_info,get_other_info,get_fanslist,get_idolist,add_idol,del_idol,get_tenpay_addr', 'errorReport' => 1, 'storageType' => 'file', 'host' => 'localhost', 'user' => 'root', 'password' => 'root', 'database' => 'test'); $one = json_encode($arr); $this->inc = json_decode($one); if (empty($this->inc)) { $this->error->showError("20001"); } if (empty($_SESSION['QC_userData'])) { self::$data = array(); } else { self::$data = $_SESSION['QC_userData']; } }
public function __construct() { $this->error = new ErrorCase(); //-------读取配置文件 $incFileContents = file_get_contents(ROOT . "comm/inc.php"); $this->inc = json_decode($incFileContents); $config = System::load_app_config("connect", "qq"); $this->inc->appid = $config['id']; $this->inc->appkey = $config['key']; $this->inc->callback = WEB_PATH . '/api/qqlogin/callback/'; $this->inc->scope = "get_user_info"; if (empty($this->inc)) { $this->error->showError("20001"); } if (empty($_SESSION['QC_userData'])) { self::$data = array(); } else { self::$data = $_SESSION['QC_userData']; } }
public function __construct() { $this->error = new ErrorCase(); //-------读取配置文件 //$incFileContents = file(ROOT."comm/inc.php"); //$incFileContents = $incFileContents[1]; include_once ROOT . "../../common/common.php"; include ROOT . 'config.php'; $json = '{"appid":"' . $config['appid'] . '","appkey":"' . $config['appkey'] . '","callback":"' . $config['callback'] . '",'; $json .= '"scope":"get_user_info,add_share,list_album,add_album,upload_pic,add_topic,add_one_blog,add_weibo,check_page_fans,add_t,add_pic_t,del_t,get_repost_list,get_info,get_other_info,get_fanslist,get_idolist,add_idol,del_idol,get_tenpay_addr","errorReport":true,"storageType":"file","host":"localhost","user":"******","password":"******","database":"test"}'; $this->inc = json_decode($json); if (empty($this->inc)) { $this->error->showError("20001"); } if (empty($_SESSION['QC_userData'])) { self::$data = array(); } else { self::$data = $_SESSION['QC_userData']; } }
public function __construct() { global $tsMySqlCache; $this->error = new ErrorCase(); //-------读取配置文件 //$incFileContents = file_get_contents(ROOT."comm/inc.php"); $arrQQ = fileRead('data/plugins_pubs_qq.php'); if ($arrQQ == '') { $arrQQ = $tsMySqlCache->get('plugins_pubs_qq'); } $callback = urlencode($arrQQ['siteurl'] . 'index.php?app=pubs&ac=plugin&plugin=qq&in=callback'); $incFileContents = '{"appid":"' . $arrQQ['appid'] . '","appkey":"' . $arrQQ['appkey'] . '","callback":"' . $callback . '","scope":"get_user_info,add_share,list_album,add_album,upload_pic,add_topic,add_one_blog,add_weibo,check_page_fans,add_t,add_pic_t,del_t,get_repost_list,get_info,get_other_info,get_fanslist,get_idolist,add_idol,del_idol,get_tenpay_addr","errorReport":true,"storageType":"file","host":"localhost","user":"******","password":"******","database":"test"}'; $this->inc = json_decode($incFileContents); if (empty($this->inc)) { $this->error->showError("20001"); } if (empty($_SESSION['QC_userData'])) { self::$data = array(); } else { self::$data = $_SESSION['QC_userData']; } }
/** * main / router */ function run() { try { $action = trim($_REQUEST["action"]); switch ($action) { // Return a json telling when was taken the last capture and if we are recording (for display purpose on the web page) case "updatecapture": header("Content-Type: application/json"); $last_cap_time = is_file(CAPTURE_FILE) ? filemtime(CAPTURE_FILE) : "0"; $current_project = $this->recorder->getProjectName(); $payload = array("isrecording" => $this->recorder->isRecording(), "lastcaptime" => $last_cap_time, "currentproject" => $current_project); $storage = $this->recorder->getStorageSpace(); // size used avail in MB $payload["storagesize"] = $storage[0]; $payload["storageused"] = $storage[1]; $payload["storageavail"] = $storage[2]; $this->ajax(array("payload" => $payload)); break; // Start the recording on the PI // Start the recording on the PI case "startrecording": header("Content-Type: text/plain; charset=UTF-8"); $this->logger->debug("Start recording"); $recording_status = $this->recorder->startRecording(); switch ($recording_status) { case Recorder::ERR_OK: echo "Recording started"; break; case Recorder::ERR_ALREADY: echo "Already recording"; break; case Recorder::ERR_FATAL: echo "Error launching the recording"; break; } break; // Stop the recording on the PI // Stop the recording on the PI case "stoprecording": header("Content-Type: text/plain; charset=UTF-8"); $recording_status = $this->recorder->stopRecording(); switch ($recording_status) { case Recorder::ERR_OK: echo "Recording stopped"; break; case Recorder::ERR_ALREADY: echo "I am not recording"; break; case Recorder::ERR_FATAL: echo "Error stopping the recording"; break; } break; case "savetitle": if (isset($_REQUEST["rectitle"])) { $this->recorder->setProjectMetadata(array("title" => $_REQUEST["rectitle"])); } echo "Title saved"; break; // Reboot / Shutdown the raspi // Reboot / Shutdown the raspi case "shutdown": case "reboot": if ($this->recorder->isRecording()) { $this->recorder->stopRecording(); sleep(5); } if ("shutdown" == $action) { $exec = "sudo /sbin/poweroff"; $message = "Shutdown in progress"; } else { $exec = "sudo /sbin/reboot"; $message = "Reboot in progress"; } exec($exec); echo $message; break; // Get storage info // Get storage info case "storage": $records = $this->recorder->getAllProjectsInfo(); $this->render("storage", array("records" => $records)); break; // Get / set settings info // Get / set settings info case "settings": $fields = array("widthheight" => "Video width and height", "fps" => "Number of images per second", "audiosource" => "Audio peripheral (may be empty for no audio track)", "videobitrate" => "Video bitrate (in kbps)", "audiobitrate" => "Audio bitrate (in kpbs)"); if (count($_POST) > 1) { $settings = array(); foreach ($fields as $k => $v) { $settings[$k] = $_POST[$k]; } list($settings["width"], $settings["height"]) = explode("x", $settings["widthheight"]); unset($settings["widthheight"]); $this->recorder->setSettings($settings); } $settings = $this->recorder->getSettings(); $settings["widthheight"] = $settings["width"] . "x" . $settings["height"]; $this->render("settings", array("aaudiobitrate" => array("64", "96", "128", "192", "256"), "aaudiosource" => array("", "hw:1"), "afps" => array("10", "12", "20", "25", "30", "50"), "avideobitrate" => array("400", "500", "800", "1000", "2000", "4000", "8000", "9000", "10000", "15000", "20000"), "awidthheight" => array("640x480", "800x600", "1024x768", "640x360", "1280x720", "1920x1080"), "settings" => $settings, "fields" => $fields)); break; // Get last image // Get last image case "lastcap": header("Content-Type: image/jpeg"); if (is_file(CAPTURE_FILE)) { readfile(CAPTURE_FILE); } else { readfile("assets/mire.jpg"); } break; // Default / home // Default / home case "home": default: $metadata = $this->recorder->getProjectMetadata(); $this->render('home', array("metadata" => $metadata)); break; } } catch (\Exception $exception) { die("Fatal Error : " . $exception->getMessage()); } }