/** * Triggered when a client sends data through the socket * @param \Ratchet\ConnectionInterface $from The socket/connection that sent the message to your application * @param string $msg The message received * @throws \Exception */ function onMessage(ConnectionInterface $from, $msg) { echo $_SESSION["city"]; if ($msg == "update") { $from->send(updateMessage()); } else { parse_request($msg); } }
/** * Check if the current request is to one of the plugin's REST endpoints * * @param string $type list|run * * @return bool */ function is_rest_endpoint_request($type = 'list') { // Which endpoint are we checking $endpoint = null; switch ($type) { case 'list': $endpoint = REST_API::ENDPOINT_LIST; break; case 'run': $endpoint = REST_API::ENDPOINT_RUN; break; } // No endpoint to check if (is_null($endpoint)) { return false; } // Build the full endpoint and check against the current request $run_endpoint = sprintf('%s/%s/%s', rest_get_url_prefix(), REST_API::API_NAMESPACE, $endpoint); return in_array($run_endpoint, parse_request()); }
function request($cachekey, $fid = 0, $type = 0, $return = 0) { global $timestamp, $_DCACHE; $datalist = ''; if ($fid && CURSCRIPT == 'forumdisplay') { $specialfid = $GLOBALS['forum']['fid']; $key = $cachekey = empty($GLOBALS['infosidestatus']['f' . $specialfid][$type]) ? $GLOBALS['infosidestatus'][$type] : $GLOBALS['infosidestatus']['f' . $specialfid][$type]; $cachekey .= '_fid' . $specialfid; } else { $specialfid = 0; if (!$type) { $key = $cachekey; } else { $key = $cachekey = $cachekey[$type]; } } $cachefile = DISCUZ_ROOT . './forumdata/cache/request_' . md5($cachekey) . '.php'; if (@(!(include $cachefile)) || $expiration < $timestamp) { include_once DISCUZ_ROOT . './forumdata/cache/cache_request.php'; require_once DISCUZ_ROOT . './include/request.func.php'; parse_str($_DCACHE['request'][$key]['url'], $requestdata); $datalist = parse_request($requestdata, $cachefile, 0, $specialfid, $key); } if (!empty($nocachedata)) { include_once DISCUZ_ROOT . './forumdata/cache/cache_request.php'; require_once DISCUZ_ROOT . './include/request.func.php'; foreach ($nocachedata as $key => $v) { $cachefile = DISCUZ_ROOT . './forumdata/cache/request_' . md5($key) . '.php'; parse_str($_DCACHE['request'][$key]['url'], $requestdata); $datalist = str_replace($v, parse_request($requestdata, $cachefile, 0, $specialfid, $key), $datalist); } } if (!$return) { echo $datalist; } else { return $datalist; } }
$timing = array(); foreach (explode(',', 'load,rotate,crop,scale,sharpen,watermark,save,send') as $k) { $timing[$k] = ''; } include_once PHPWG_ROOT_PATH . 'include/dblayer/functions_' . $conf['dblayer'] . '.inc.php'; include_once PHPWG_ROOT_PATH . '/include/derivative_params.inc.php'; include_once PHPWG_ROOT_PATH . '/include/derivative_std_params.inc.php'; try { pwg_db_connect($conf['db_host'], $conf['db_user'], $conf['db_password'], $conf['db_base']); } catch (Exception $e) { $logger->error($e->getMessage(), 'i.php'); } pwg_db_check_charset(); list($conf['derivatives']) = pwg_db_fetch_row(pwg_query('SELECT value FROM ' . $prefixeTable . 'config WHERE param=\'derivatives\'')); ImageStdParams::load_from_db(); parse_request(); //var_export($page); $params = $page['derivative_params']; $src_mtime = @filemtime($page['src_path']); if ($src_mtime === false) { ierror('Source not found', 404); } $need_generate = false; $derivative_mtime = @filemtime($page['derivative_path']); if ($derivative_mtime === false or $derivative_mtime < $src_mtime or $derivative_mtime < $params->last_mod_time) { $need_generate = true; } $expires = false; $now = time(); if (isset($_GET['b'])) { $expires = $now + 100;
} else { $specs[$kv[0]] = $kv[1]; } } return $specs; } // Start us up header('Content-type: text/plain; charset=utf-8'); $jsonPage = array(); if (isset($_GET['request'])) { $_POST['request'] = $_GET['request']; } if (!isset($_POST['request'])) { die(json_encode(array('successful' => 0, 'error' => 'Invalid request'))); } $specs = parse_request($_POST['request']); if (!is_array($specs)) { die(json_encode(array('successful' => 0, 'error' => $specs))); } $startwith = $specs['startwith'] - 1 <= 0 ? false : $specs['startwith'] - 1; $page = $startwith ? false : 1; $am = ApplicationModel::getInstance(); $apps = $am->getAppListCached($specs['maxresults'], $page, $specs['sortby'], $specs['filterbycategory'], $specs['filterbytext'], $specs['filterbyid'], $specs['filterbyitunesid'], $startwith, $specs['full']); $totApps = 0; if ($specs['showtotal'] == 'true') { $totApps = $am->getResultCountCached($specs['filterbycategory'], $specs['filterbytext']); } if (is_array($apps) && count($apps) == 0) { $jsonPage = array('successful' => 1, 'results' => 0); if ($specs['showtotal'] == 'true') { $jsonPage['totalapps'] = $totApps;
<?php include 'core/common.php'; // decide which controller, action, ident $runtime['url'] = parse_request($_SERVER['REQUEST_URI']); include PATH_TO_ROUTES; // decide which format $runtime['format'] = parse_format(parse_request($_SERVER['REQUEST_URI'], false)); // revert to defaults if necessary if (empty($runtime['controller'])) { $runtime['controller'] = $defaults['controller']; } if (empty($runtime['action'])) { $runtime['action'] = 'index'; } // this will be included from wrapper.php $runtime['view'] = PATH_TO_VIEWS . "{$runtime['format']}/{$runtime['controller']}/{$runtime['action']}.php"; $runtime['layout'] = PATH_TO_VIEWS . "{$runtime['format']}/layout.php"; // FIXME: this next line is ugly... if ($runtime['action'] == 'list') { $runtime['action'] = 'all'; } // 'list' is already a php function // load, initialize the main class (if it's there and it's not a crazy url) $controller_path = PATH_TO_CONTROLLERS . "{$runtime['controller']}-controller.php"; if (file_exists($controller_path)) { include $controller_path; eval("\$main_controller = new {$runtime['controller']}" . "_controller();"); eval("\$main_controller -> {$runtime['action']}();"); } else { $runtime['notfound'] = true;
exit('Access Denied'); } if ($requestrun) { $combinetitles = $combinedata = $datalist = ''; $combinemodules = explode("\n", $settings['data']); $idbase = 'cm_' . random(4); foreach ($combinemodules as $id => $combinemodule) { $i = $id + 1; $id = $idbase . '_c_' . $i; list($combinekey, $combinetitle) = explode(',', $combinemodule); $cachekey = $combinekey; if (CURSCRIPT == 'forumdisplay' && $specialfid) { $cachekey .= '_fid' . $specialfid; } $combinecachefile = DISCUZ_ROOT . './forumdata/cache/request_' . md5($cachekey) . '.php'; if (@(!(include $combinecachefile)) || $expiration < $timestamp) { parse_str($_DCACHE['request'][$combinekey]['url'], $requestdata); $datalist = parse_request($requestdata, $combinecachefile, 0, $specialfid, $combinekey); } $combinedata .= '<div id="' . $id . '" class="combine" style="display:none">' . $datalist . '</div>'; $combinetitles[$i] = $combinetitle; } $combinecount = count($combinemodules); include template('request_rowcombine'); } else { $request_version = '1.0'; $request_name = $requestlang['rowcombine_name']; $request_description = $requestlang['rowcombine_desc']; $request_copyright = '<a href="http://www.comsenz.com" target="_blank">Comsenz Inc.</a>'; $request_settings = array('title' => array($requestlang['rowcombine_title'], $requestlang['rowcombine_title_comment'], 'text'), 'data' => array($requestlang['rowcombine_name'], $requestlang['rowcombine_data_comment'], 'textarea')); }
$Id: jswizard.inc.php 17524 2009-01-12 04:46:51Z monkey $ */ if (!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) { exit('Access Denied'); } if (!empty($previewurl)) { include_once DISCUZ_ROOT . './forumdata/cache/cache_request.php'; require_once DISCUZ_ROOT . './include/request.func.php'; parse_str($jsurl . '&nocache=yes', $requestdata); if ($requestdata['function'] == 'side') { $tags = '<div id="wrap" class="wrap with_side s_clear" style="width:90%;height:auto;min-height:50px !important"><div class="main"><div class="content"></div></div><div id="sidebar" class="side"><div>'; } else { $tags = '<div id="wrap" class="wrap s_clear" style="width:90%;height:auto;min-height:50px !important"><div class="main"><div class="content">'; } echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><meta http-equiv="Content-Type" content="text/html; charset=' . $charset . '" /><head><script type="text/javascript" src="include/js/common.js"></script></head><link rel="stylesheet" type="text/css" href="forumdata/cache/style_' . STYLEID . '_common.css" />'; echo "\n\n<body><div id=\"append_parent\"></div><div id=\"ajaxwaitid\"></div>{$tags}\n\n" . parse_request($requestdata, '', 0) . "\n\n</div></div></div></body>\n\n</html>"; exit; } cpheader(); $jstypes = array(0 => 'threads', 1 => 'forums', 2 => 'memberrank', 3 => 'stats', 4 => 'images', 5 => 'module', -2 => 'side', -1 => 'custom'); $from = $action == 'jswizard' && $operation != 'infoside' ? 'jswizard' : $from; $infosidemenu = array(array('menu' => 'nav_infoside', 'submenu' => array(array('jswizard_infoside_global', 'jswizard&operation=infoside&from=' . $from), array('jswizard_infoside_2', 'jswizard&operation=infoside&sideid=2&from=' . $from), array('jswizard_infoside_0', 'jswizard&operation=infoside&sideid=0&from=' . $from))), '', $operation == 'infoside' ? 1 : 0); $addmenu = array(); foreach ($jstypes as $k => $v) { if ($k != 5) { $addmenu[] = array('jswizard_' . $v, 'jswizard&type=' . $v); } } if (!$operation) { shownav('tools', 'nav_javascript'); $jswizard = array();
function getParentRequestAndBool() { /* Get parent group request and bool */ $this->parentRequest = parse_request($this->parentGroup->getRequest()); $this->parentBool = $this->parentGroup->getBool(); if (!$this->parentBool) { /* We need a bool. * if bool is not set, create it. * Bool is a AND of all sub requests */ $this->parentBool = sprintf('AND(%s)', implode(', ', array_keys($this->parentRequest->subs))); } }
$timestamp = time(); $rewritestatus = $_DCACHE['settings']['rewritestatus']; $uc = $_DCACHE['settings']['uc']; if (@(!(include $cachefile)) || $expiration < $timestamp) { require_once DISCUZ_ROOT . './config.inc.php'; require_once DISCUZ_ROOT . './include/db_' . $database . '.class.php'; require_once DISCUZ_ROOT . './include/global.func.php'; require_once DISCUZ_ROOT . './include/request.func.php'; $db = new dbstuff(); $db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect, true, $dbcharset); unset($dbhost, $dbuser, $dbpw, $dbname, $pconnect); $dateformat = !empty($_DCACHE['settings']['jsdateformat']) ? $_DCACHE['settings']['jsdateformat'] : (!empty($_DCACHE['settings']['dateformat']) ? $_DCACHE['settings']['dateformat'] : 'm/d'); $timeformat = isset($_DCACHE['settings']['timeformat']) ? $_DCACHE['settings']['timeformat'] : 'H:i'; $PHP_SELF = $_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']; $boardurl = 'http://' . $_SERVER['HTTP_HOST'] . preg_replace("/\\/+(api)?\\/*\$/i", '', substr($PHP_SELF, 0, strrpos($PHP_SELF, '/'))) . '/'; $datalist = parse_request($requestdata, $cachefile, 1); } echo $datalist; function jsprocdata($data, $requestcharset) { global $boardurl, $_DCACHE, $charset; if ($requestcharset) { include DISCUZ_ROOT . 'include/chinese.class.php'; if (strtoupper($charset) != 'UTF-8') { $c = new Chinese($charset, 'utf8'); } else { $c = new Chinese('utf8', $requestcharset == 1 ? 'gbk' : 'big5'); } $data = $c->Convert($data); } return 'document.write(\'' . preg_replace("/\r\n|\n|\r/", '\\n', addcslashes($data, "'\\")) . '\');';
if (!isset($request['filename'])) { invalid_request(); } // Build path to the files $path_tiff = $GLOBALS['scan_dir'] . '/' . $request['filename'] . '.tif'; $path_pdf = $GLOBALS['scan_dir'] . '/' . $request['filename'] . '.pdf'; // Check to see if the files exist, and, if so, delete them if (file_exists($path_tiff)) { unlink($path_tiff); } if (file_exists($path_pdf)) { unlink($path_pdf); } // Return success return true; } //--- Start Processing ---// // Make sure we have a POST request to work with if (!isset($_POST['request'])) { invalid_request(); } // Parse the request and get a response to send back $response = parse_request($_POST['request']); // Figure out what kind of response we're dealing with and handle it appropriately if (is_bool($response)) { echo json_response(true, $response); } elseif (is_array($response)) { echo json_response(true, $response); } else { echo json_response(false, array('error' => 'Internal error.')); }