function getKeyVals() { $res = array(); foreach ($this->items as $item) { if (get_parent_class($item) != 'CategoryItem') { //XXX only works for CategoryItem type echo 'CoreList->getKeyVals: cant handle object type ' . get_class($item) . ln(); continue; } $res[$item->getId()] = $item->getTitle(); } return $res; }
public function set($key, $val = '', $expire_time = 3600) { if (strlen($key) > $this->maxlen) { throw new \Exception('Key length too long (len ' . strlen($key) . ', max ' . $this->maxlen . '): ' . $key); } if ($expire_time) { if (!is_duration($expire_time)) { throw new \Exception('bad expire time'); } $expire_time = parse_duration($expire_time); } $this->connect(); // $key = str_replace(' ', '_', $key); $ret = $this->redis->setex($key, $expire_time, $val); if ($this->debug) { echo 'TempStoreRedis SET "' . $key . '" = "' . substr($val, 0, 200) . '"... (' . $expire_time . ' sec)' . ln(); } /* if (!$ret) throw new \Exception ('SET failed'); */ return $ret; }
function _DATA($d) { $this->write('DATA'); if ($this->status != 354) { echo "smtp->_DATA() [" . $this->status . "]: " . $this->lastreply . ln(); return false; } $this->write($d . "\r\n."); if ($this->status != 250) { echo "smtp->_DATA() [" . $this->status . "]: " . $this->lastreply . ln(); return false; } return true; }
/** * Redirects user to error page */ function showErrorPage() { $db = SqlHandler::getInstance(); if ($db instanceof DatabaseMysqlProfiler && $db->getErrorCount()) { echo "DEBUG: session->redirect aborted due to error" . ln(); return; } js_redirect($this->error_page); }
/** * Replace atanh() * * @category PHP * @package PHP_Compat * @license LGPL - http://www.gnu.org/licenses/lgpl.html * @copyright 2004-2007 Aidan Lister <*****@*****.**>, Arpad Ray <*****@*****.**> * @link http://php.net/function.atanh * @author Arpad Ray <*****@*****.**> * @version $Revision: 1.2 $ * @since PHP 5 * @require PHP 3.0.0 */ function php_compat_atanh($n) { return 0.5 * (ln(1 + $n) - ln(1 - $n)); }
/** * Loads input data from ASX playlists into VideoResource entries */ function load($data) { if (is_url($data)) { $u = new HttpClient($data); $data = $u->getBody(); } if (strpos($data, '<asx ') !== false) { $asx = new AsxReader(); $asx->parse($data); $this->addItems($asx->getItems()); return true; } echo "Playlist->load error: unhandled feed: " . substr($data, 0, 200) . " ..." . ln(); return false; }
public static function ln($self, $a) { return ln($a); }
/** * Parse HTTP response data into object variables and sets status code */ private function parseResponse($res) { $this->response_headers = array(); if (!$res) { return; } $pos = strpos($res, "\r\n\r\n"); if ($pos !== false) { $head = substr($res, 0, $pos); $body = substr($res, $pos + strlen("\r\n\r\n")); $headers = explode("\r\n", $head); } else { $body = ''; $headers = explode("\r\n", $res); } $status = array_shift($headers); if ($this->debug) { echo 'http->get( ' . $this->Url->get() . ' ) returned HTTP status ' . $status . ln(); } switch (substr($status, 0, 9)) { case 'HTTP/1.0 ': case 'HTTP/1.1 ': $this->status_code = intval(substr($status, 9)); break; default: throw new \Exception('unhandled HTTP response ' . $status); } foreach ($headers as $h) { $col = explode(': ', $h, 2); $name = strtolower($col[0]); if (!isset($this->response_headers[$name])) { $this->response_headers[$name] = array(); } $this->response_headers[$name][] = $col[1]; switch ($name) { /* case 'cache-control': switch (strtolower($col[1])) { case 'no-cache="set-cookie, set-cookie2"': echo "CLEARING COOKIES!!!!\n"; $this->cookies = array(); break; default: echo "XXX UNKNOWN CACHE CONTROL: ".$col[1]."\n"; break; } break; */ case 'set-cookie': // store cookies sent from the server in our cookie pool for possible manipulation //d('SETTING COOKIE: '.$col[1]); $this->setCookie($col[1]); break; } } $encoding = $this->getResponseHeader('Content-Encoding'); switch ($encoding) { case 'gzip': // strip 10-byte gzip header XXXX always 10 byte headers??? $gzhead = substr($body, 0, 10); // 1f8b 0800 0000 0000 0003 ... gzip start with ED FD sequence (???) $body = substr($body, 10); $body = gzinflate($body); break; case 'identity': case '': break; default: d($this->response_headers); throw new \Exception('unhandled content-encoding: ' . $encoding); } $this->body = $body; $auth = $this->getResponseHeader('WWW-Authenticate'); if ($auth) { $this->setAuthMethod($auth); } }
function page_all_vars() { requires_admin(); global $modules; $mods = $modules; $mods[] = "app"; $_REQUEST['q'] = '/vars'; foreach ($mods as $mod) { $func_name = "page_" . $mod . "_vars"; if (function_exists($func_name)) { ln("----"); ln("<font color=red>{$func_name}</font>"); $func_name(); } } }
//------run javascript $js = RunJavascriptForQuery($q); print " {$js}\n"; print "\n"; if ($caller != '') { print " var TheURL = 'savevariable.php?xx=1';\n"; print " TheURL=TheURL+'&TheFieldName='+'{$caller}';\n"; print " TheURL=TheURL+'&TheFieldValue='+document.forms[0]['{$caller}'].value;\n"; print " TheURL=TheURL+'&TheFormQuery='+parent.frames[0].document.forms[0]['TheFormQuery'].value\n"; print " parent.frames['hideupdate'].document.location = TheURL\n"; print "\n"; } print "}\n"; print "\n"; print "</script>" . ln(1); print "<html><body onLoad='fillfields()'><form>" . ln(1); $tempListName = BuildQueryTable($q); $sql = fixsql($q, $lookin, $tempListName); $sql = str_replace('#sysuserID#', $GLOBALS['sysuserID'], $sql); $sql = str_replace('#AccessLevel#', $GLOBALS['AccessLevel'], $sql); $sql = str_replace('#sysuserloginID#', $GLOBALS['sysuserloginID'], $sql); $vars = GetHashVariables($sql); for ($for = 1; $for < count($vars); $for++) { $PandF = substr($vars[$for], 1, strlen($vars[$for]) - 2); //--Page and Field names minus the hashes $vt = RunQuery('SELECT * FROM sysvariable WHERE svaName = "' . $GLOBALS['GlobeSessionID'] . '_' . $PandF . '"'); $vr = mysql_fetch_object($vt); if ($vr->sysvariableID != '') { //--a record was found $sql = str_replace($vars[$for], $vr->svaValue, $sql); }
private function parseTrack($reader) { $href = $reader->getAttribute('href'); $id = ''; $name = ''; $track = ''; $length = ''; while ($reader->read()) { if ($reader->nodeType == \XMLReader::END_ELEMENT && $reader->name == 'track') { //XXX cache write aritst name + spotify id combo return array('title' => $name, 'href' => $href, 'id' => $id, 'track' => $track, 'length' => $length); } if ($reader->nodeType != \XMLReader::ELEMENT) { continue; } switch ($reader->name) { case 'id': $reader->read(); $id = $reader->value; break; case 'name': $reader->read(); $name = $reader->value; break; case 'track-number': $reader->read(); $track = $reader->value; break; case 'length': $reader->read(); $length = $reader->value; break; case 'artist': $this->parseArtist($reader); //XXX store break; case 'available': $reader->read(); break; //XXX use //XXX use case 'popularity': $reader->read(); break; //XXX use //XXX use case 'disc-number': $reader->read(); break; //XXX use //XXX use default: echo "bad entry (2) " . $reader->name . ln(); } } }
print "</TABLE></div>" . ln(1); addrows(2); //make a gap between fields and the end of the table addbreaks(30); //--- write out javascript arrays for populating dropdowns print "<script type='text/javascript' language='javascript'>\n\n"; for ($i = 0; $i < count($GLOBALS['theArray']); $i++) { print $GLOBALS['theArray'][$i] . "\n"; } //--- fill dropdowns with javascript arrays print "\n\nfunction runpopulate(){\n"; for ($i = 0; $i < count($GLOBALS['thePopulator']); $i++) { print $GLOBALS['thePopulator'][$i] . "\n"; } print "}\n\n"; print "</script>\n" . ln(1); ?> <div id='Footer' align=center style='overflow:hidden;position:absolute;visibility:visible;top:620;height:20;left:10;width:990'> <table width='102%'><tr width='100%'><td width='100%' class='stab' ><a class="blueLink" href="http://www.nubuilder.com" target="_blank">Powered by nuBuilder</a></td></tr> <tr> <td style='background-color:blue' align='left'><img src='css/bluebl.jpg' border='0'/></td> <td style='background-color:green' align='right'><img src='css/bluebr.jpg' border='0'/></td> </tr> </table> </div> <div id='FooterL' align=center style='overflow:hidden;position:absolute;visibility:visible;top:110;height:530;left:1;width:20'> <table width='5%'><tr width='100%'><td width='100%' class='stab' > <BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR> <BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
?> </p> <p><?php ln('ban_date'); ?> <div class="text-right"> <?php ln('months', date("m", $user['ban_time']) - 1); echo " " . date("d Y H:i", $user['ban_time']); ?> </div></p> <div class="text-left clearfix"> <a href="<?php echo $cfg['options']['siteurl']; ?> /?exit=1" class="blue cursor-pointer"><?php ln('logout_btn'); ?> <i class="fa fa-chevron-right"></i></a> </div> </div> </form> </div> </div> </section> <div id="bg_overlay"></div>
/** * Replace acosh() * * @category PHP * @package PHP_Compat * @license LGPL - http://www.gnu.org/licenses/lgpl.html * @copyright 2004-2007 Aidan Lister <*****@*****.**>, Arpad Ray <*****@*****.**> * @link http://php.net/function.acosh * @author Arpad Ray <*****@*****.**> * @version $Revision: 1.2 $ * @since PHP 5 * @require PHP 3.0.0 */ function php_compat_acosh($n) { return ln($n + sqrt($n + 1) * sqrt($n - 1)); }
function renderDetails() { if (!$this->code) { throw new \Exception('no code loaded'); } $res = 'Barcode : ' . $this->code . ln(); $res .= 'GS1 : ' . $this->getGs1Name() . ' (' . $this->gs1 . ')' . ln(); if ($this->company) { $res .= 'Company : ' . $this->getCompanyName() . ' (' . $this->company . ')' . ln(); } if ($this->product) { $res .= 'Product : ' . $this->product . ln(); } if ($this->unknown) { $res .= 'UNKNOWN : ' . $this->unknown . ln(); } $res .= 'Checksum: ' . $this->check; $calc = $this->calcCheck(); if ($calc == $this->check) { $res .= ' (OK)' . ln(); } else { $res .= ', INVALID!!!! should be ' . $calc . ln(); } return $res; }
function delete($key) { if (strlen($key) > 250) { throw new \Exception('Key length too long'); } if (!$this->connect()) { return false; } $key = str_replace(' ', '_', $key); $ret = $this->handle->delete($key); if ($this->getDebug()) { echo "CACHE DELETE " . $key . ln(); } return $ret; }
/** * Debug function * @return string of hex + ascii values */ function dh($m, $row_len = 16, $fill_char = ' ', $html_encode = true) { $j = 0; $bytes = ''; $hex = ''; $res = ''; for ($i = 0; $i < strlen($m); $i++) { $x = substr($m, $i, 1); if (ord($x) > 0x1f && ord($x) < 0x80) { $bytes .= $html_encode ? htmlspecialchars($x) : $x; } else { $bytes .= '.'; } $hex .= bin2hex($x) . $fill_char; if (++$j == $row_len) { $j = 0; $res .= $hex . ' ' . $bytes . ln(); $bytes = ''; $hex = ''; } } if ($j) { $res .= $hex . ' ' . str_repeat(' ', ($row_len - strlen($bytes)) * 3) . $bytes . ln(); } return $res; }
/design/js/modernizr.js"></script> <!-- to remember sound status --> <script src="<?php echo $cfg['options']['siteurl']; ?> /design/js/jquery.cookie.js"></script> <script type="text/javascript" charset="utf-8" src="js/guest08dd.js?49344"></script> <script type="text/javascript" charset="utf-8" src="js/jquery/fancybox/jquery.fancybox08dd.js?49344"></script> <script type="text/javascript" charset="utf-8" src="js/cms/init_fancybox08dd.js?49344"></script> <link type="text/css" rel="stylesheet" href="js/jquery/fancybox/jquery.fancybox08dd.css?49344" /> </head> <body> <div id="authtip" style="display:none;"><h1><?php ln('wrong_login_or_password'); ?> </h1></div> <section class="eternity-form dark colorBg" data-panel="fourth" id="loginPanel" style="display:none;"> <div class="login-form-section"> <div class="login-content " data-animation="fadeInDown" data-animation-delay="0.3s" data-animation-duration="1.5s"> <form onsubmit="return false;"> <div class="textbox-wrap"> <div class="input-group"> <label for="login_name" class="login-label">Логин</label> <input type="text" required="required" class="form-control" name="login_name" id="login_name"/> </div> </div> <div class="textbox-wrap">
function h1($msg) { ln(2); out("-------"); out($msg); }
/** * Uploads a file to the ftp * * @param $remote_path destination path * @param $local_file path to local file * @param $temp_file (optional) use temporary filename on remote server during upload */ function putFile($remote_file, $local_file, $temp_file = '') { if (!$this->connect()) { return false; } if (!file_exists($local_file)) { echo 'ftp: local file ' . $local_file . ' dont exist!' . ln(); return false; } if ($this->getDebug()) { echo 'putFile md5: ' . md5_file($local_file) . ln(); } if ($temp_file) { $this->setPath($temp_file); } else { $this->setPath($remote_file); } curl_setopt($this->curl, CURLOPT_URL, $this->getUrl()); curl_setopt($this->curl, CURLOPT_TIMEOUT, $this->timeout); $fp = fopen($local_file, 'r'); curl_setopt($this->curl, CURLOPT_UPLOAD, 1); curl_setopt($this->curl, CURLOPT_INFILE, $fp); curl_setopt($this->curl, CURLOPT_INFILESIZE, filesize($local_file)); if ($temp_file) { if ($this->scheme == 'sftp') { $buf = array('rename ' . $temp_file . ' ' . $remote_file); } else { $buf = array('RNFR ' . $temp_file, 'RNTO ' . $remote_file); } curl_setopt($this->curl, CURLOPT_POSTQUOTE, $buf); } curl_exec($this->curl); fclose($fp); if (curl_errno($this->curl)) { throw new \Exception('ftp exec error: ' . curl_error($this->curl)); } return true; }
function parse($data) { if (is_url($data)) { $u = new HttpClient($data); $u->setCacheTime(60 * 60); //1h $data = $u->getBody(); //FIXME check http client return code for 404 if (substr($data, 0, 5) != '<asx ') { dp('input_asx->parse FAIL: cant parse playlist from ' . $u->getUrl()); return false; } } $reader = new XMLReader(); if ($this->getDebug()) { echo 'Parsing ASX: ' . $data . ln(); } $reader->xml($data); $item = new VideoResource(); while ($reader->read()) { if ($reader->nodeType == XMLReader::END_ELEMENT && $reader->name == 'asx') { $this->items[] = $item; $item = new VideoResource(); } if ($reader->nodeType != XMLReader::ELEMENT) { continue; } switch ($reader->name) { case 'asx': if ($reader->getAttribute('version') != '3.0') { die('XXX FIXME unsupported ASX version ' . $reader->getAttribute('version')); } break; case 'entry': while ($reader->read()) { if ($reader->nodeType == XMLReader::END_ELEMENT && $reader->name == 'entry') { break; } if ($reader->nodeType != XMLReader::ELEMENT) { continue; } switch ($reader->name) { case 'author': break; //<author>svt.se</author> //<author>svt.se</author> case 'copyright': break; //<copyright>Sveriges Television AB 2009</copyright> //<copyright>Sveriges Television AB 2009</copyright> case 'starttime': break; //<starttime value="00:00:00.00"/> //<starttime value="00:00:00.00"/> case 'ref': //<ref href="mms://wm0.c90901.cdn.qbrick.com/90901/kluster/20091026/aekonomi920.wmv"/> $item->setUrl($reader->getAttribute('href')); break; case 'duration': //<duration value="00:03:39.00"/> $item->setDuration($reader->getAttribute('value')); break; default: echo "bad entry " . $reader->name . ln(); } } break; default: echo "unknown " . $reader->name . ln(); break; } } $reader->close(); return true; }
/** * Loads input data from RSS or Atom feeds into NewsItem entries */ function load($data) { if (is_array($data)) { $this->addItems($data); return; } if (is_url($data)) { $http = new HttpClient($data); if ($this->getDebug()) { $http->setDebug(); } $data = $http->getBody(); } if (strpos($data, '<rss ') !== false) { $feed = new RssReader(); } else { if (strpos($data, '<feed ') !== false) { $feed = new AtomReader(); } else { echo 'NewsFeed->load error: unhandled feed: ' . substr($data, 0, 100) . ' ...' . ln(); return false; } } if ($this->getDebug()) { $feed->setDebug(); } $feed->parse($data); $this->title = $feed->getTitle(); $this->addItems($feed->getItems()); }
/** * Replace asinh() * * @category PHP * @package PHP_Compat * @license LGPL - http://www.gnu.org/licenses/lgpl.html * @copyright 2004-2007 Aidan Lister <*****@*****.**>, Arpad Ray <*****@*****.**> * @link http://php.net/function.asinh * @author Arpad Ray <*****@*****.**> * @version $Revision: 1.2 $ * @since PHP 5 * @require PHP 3.0.0 */ function php_compat_asinh($n) { return ln($n + sqrt(1 + pow($n, 2))); }