예제 #1
0
 protected function getHeader()
 {
     $header = new Header();
     $header->title = $this->title;
     $header->meta("Content-Type", "text/html; charset=utf-8", true);
     $header->meta("description", $this->meta_desc, false);
     $header->meta("keywords", $this->meta_key, false);
     $header->meta("viewport", "width=device-width", false);
     $header->favicon = "/favicon.ico";
     if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 8.0')) {
         $header->css = array("/styles/main.css", "/styles/prettify.css", "/styles/unite-gallery.css", "/styles/ie.css");
     } elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Safari/525.29')) {
         $header->css = array("/styles/main.css", "/styles/prettify.css", "/styles/unite-gallery.css", "/styles/safari3.css");
     } elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 7.0')) {
         $header->css = array("/styles/reject.css");
     } elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6.0')) {
         $header->css = array("/styles/reject.css");
     } elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 5.5')) {
         $header->css = array("/styles/reject.css");
     } else {
         $header->css = array("/styles/main.css", "/styles/prettify.css", "/styles/unite-gallery.css");
     }
     if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 7.0')) {
         $header->js = array("/js/reject.min.js");
     } elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6.0')) {
         $header->js = array("/js/reject.min.js");
     } elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 5.5')) {
         $header->js = array("/js/reject.min.js");
     } else {
         $header->js = array("/js/jquery-11.0.min.js", "/js/functions.js", "/js/validator.js", "/js/prettify.js", "/js/unitegallery.min.js", "/js/ug-theme-compact.js");
     }
     return $header;
 }
예제 #2
0
 public function invokeHandler(Smarty $viewModel, Header $header, $f, $page)
 {
     $header->title('PayPic');
     $header->import('jqgeeks/bootstrap_css', 'mypage');
     $viewModel->assign("pname", "@RTPic");
     return self::showLatest($viewModel);
 }
예제 #3
0
 public function testToString()
 {
     $name = $this->readAttribute($this->object, 'name');
     $value = $this->readAttribute($this->object, 'value');
     $string = sprintf('%s: %s', $name, $value);
     $this->assertEquals($string, $this->object->toString());
 }
예제 #4
0
	public function getHandshake($buffer) {
		$header = new Header($buffer);
        $params = $header->getParams();;
        
        if (isset($params['Sec-WebSocket-Key'])) {
	        $response = "HTTP/1.1 101 Switching Protocols\r\n";
	        $response .= "Upgrade: websocket\r\n";
	        $response .= "Connection: Upgrade\r\n";
	        $response .= "Sec-WebSocket-Accept: $acceptKey";
	        $response .= "\0";
        }
        else {
			$pattern = '/[^\d]*/';
			$replacement = '';
			$numkey1 = preg_replace($pattern, $replacement, $params['Sec-WebSocket-Key1']);
			$numkey2 = preg_replace($pattern, $replacement, $params['Sec-WebSocket-Key2']);
			$pattern = '/[^ ]*/';
			$replacement = '';
			$spaces1 = strlen(preg_replace($pattern, $replacement, $params['Sec-WebSocket-Key1']));
			$spaces2 = strlen(preg_replace($pattern, $replacement, $params['Sec-WebSocket-Key2']));
			$hashData = md5( pack("N", $numkey1/$spaces1) . pack("N", $numkey2/$spaces2) . $header->getMessage(), true);
        	
			$response = "HTTP/1.1 101 WebSocket Protocol Handshake\r\n";
			$response .= "Upgrade: WebSocket\r\n";
			$response .= "Connection: Upgrade\r\n";
			$response .= "Sec-WebSocket-Origin: " . $params['Origin'] . "\r\n";
			$response .= "Sec-WebSocket-Location: ws://" . "{$this->address}:{$this->port}" . $header->getResource() . "\r\n";
			$response .= "\r\n";
			$response .= $hashData;
			$response .= "\0";
        }
        return $response;
	}
예제 #5
0
 /**
  * Clear the properties.
  */
 public function flush()
 {
     $this->method = null;
     $this->uri = null;
     $this->payload = null;
     $this->header->flush();
 }
예제 #6
0
파일: File.php 프로젝트: akivaron/toko
 function parseHeader()
 {
     if (!empty($this->header)) {
         return;
     }
     $this->header = new Header($this);
     $this->header->parse();
 }
예제 #7
0
파일: HeaderTest.php 프로젝트: psecio/jwt
 /**
  * Test the conversion of the header to an array
  */
 public function testToArray()
 {
     $key = 'somekey';
     $algorithm = 'H256';
     $type = 'mytype';
     $header = new Header($key, $algorithm, $type);
     $this->assertEquals($header->toArray(), array('typ' => $type, 'alg' => $algorithm));
 }
예제 #8
0
파일: Cron.php 프로젝트: mybuilder/cronos
 /**
  * @return string
  */
 public function format()
 {
     $lines = '';
     foreach ($this->lines as $line) {
         $lines .= $line->format() . PHP_EOL;
     }
     return ($this->hasHeader() ? $this->header->format() . PHP_EOL : '') . trim($lines) . PHP_EOL;
 }
예제 #9
0
파일: Table.php 프로젝트: Chocanto/autoTab
 public function addHeadersStr($arr)
 {
     foreach ($arr as $key => $str) {
         $header = new Header();
         $header->setContent($str);
         $this->addHeader($header);
     }
 }
예제 #10
0
 /**
  * Runs the test.
  */
 public function test()
 {
     $name = 'Organization';
     $value = 'Jyxo';
     // Email and name given
     $header = new Header($name, $value);
     $this->assertEquals($name, $header->getName());
     $this->assertEquals($value, $header->getValue());
 }
예제 #11
0
 public function invokeHandler(Smarty $viewModel, Header $header, $f, $page, $aid)
 {
     $header->title('PayPic');
     $header->import('picbootstrap', 'mypage');
     $viewModel->assign("pname", "@RTPic");
     $album = new Album($aid);
     $viewModel->assign("images", $album->getImges());
     return "images";
 }
예제 #12
0
 public function invokeHandler(Smarty $viewModel, Header $header, $f, $page)
 {
     $header->title('PayPic');
     $header->import('jqgeeks/bootstrap_css', 'mypage');
     $viewModel->assign("pname", "@RTPic");
     global $RDb;
     $imageAccess = $RDb->fetchAll("select * from file_access fa,files f,user u" . " where fa.pid=f.id and u.uid=fa.uid");
     $viewModel->assign("images", $imageAccess);
     return "imageAccess";
 }
예제 #13
0
 public function invokeHandler(Smarty $viewModel, Header $header, $f, $page, $pid)
 {
     $header->title('PayPic');
     $header->import('jqgeeks/bootstrap_css', 'mypage');
     $viewModel->assign("pname", "@RTPic");
     global $RDb;
     $image = $RDb->fetch("select * from files where id=%d", $pid);
     $viewModel->assign("image", $image);
     return "image";
 }
예제 #14
0
 public function testBuildEntityArrayWithValueOnly()
 {
     $headerStr = '10.0.0.1,10.0.0.2,10.0.0.3';
     $header = new \Header('X-Forwarded-For', $headerStr, ',');
     $header->parseParams();
     $this->assertEquals(3, $header->count());
     $partsArray = $header->toArray();
     $this->assertEquals('10.0.0.1', $partsArray[0]);
     $entityArray = $header->buildEntityArray();
     $this->assertEquals(3, count($entityArray[0]));
 }
예제 #15
0
 public function invokeHandler(Smarty $viewModel, Header $header, User $user, $uname, $upass)
 {
     $header->title('PayPic');
     $header->import('jqgeeks/bootstrap_css', 'google_login');
     $viewModel->assign("pname", "@RTPic");
     if ($user->auth($uname, $upass)) {
         include_once HANDLER_PATH . "/Images.php";
         return Images::showlatest($viewModel);
     } else {
         return "login";
     }
 }
예제 #16
0
 private function saveHeader($domain, $title, $charset, $keywords, $description, $icon, $lang)
 {
     $model = new Header();
     $model->domain = $domain;
     $model->title = $title;
     $model->charset = $charset;
     $model->keywords = $keywords;
     $model->description = $description;
     $model->icon = $icon;
     $model->lang = $lang;
     $model->save(false);
 }
예제 #17
0
    public function renderPage()
    {
        print '

        <link href="css/bootstrap.css" rel="stylesheet">
        <link href="css/half-slider.css" rel="stylesheet">
        <link href="css/morris.css" rel="stylesheet">
        <title>Hardloopuitslagen.nl - Home</title>
       ';
        require_once "/Classes/header.php";
        $Header = new Header();
        $Header->renderHeader();
    }
예제 #18
0
 /**
  * Parse binary data
  *
  * @param string $binaryData The binary data
  */
 public function parseBinary($binaryData)
 {
     $unpackMask = "a" . TAC_PLUS_HDR_SIZE . "header/a*body";
     $binData = unpack($unpackMask, $binaryData);
     $this->header->parseBinary($binData['header']);
     $pad = $this->header->getPseudoPad($this->secret);
     if ($this->header->isEncrypted()) {
         $binBody = $binData['body'] ^ $pad;
     } else {
         $binBody = $binData['body'];
     }
     $reply = $this->body->parseBinary($binBody);
 }
예제 #19
0
 public function invokeHandler(Smarty $viewModel, Header $header, User $user, $page)
 {
     $header->title('PayPic');
     $viewModel->assign("pname", "@RTPic");
     if ($user->isValid()) {
         $header->import('jqgeeks/bootstrap_css', 'upload');
         global $RDb;
         $images = $RDb->fetchAll("select * from files where uid=%d AND albumid=0", $user->getToken());
         $viewModel->assign("images", $images);
         return "upload";
     } else {
         $header->import('jqgeeks/bootstrap_css', 'google_login');
         return "login";
     }
 }
예제 #20
0
 public function setHeader(Header $h)
 {
     // replace content if header already exists
     $replaced = false;
     for ($i = 0; $i < count($this->headers) && !$replaced; $i++) {
         if ($this->headers[$i]->getKey() == $h->getKey()) {
             $this->headers[$i]->setValue($h->getValue());
             $replaced = true;
         }
     }
     // no matches found, add new header
     if (!$replaced) {
         $this->headers[] = $h;
     }
 }
예제 #21
0
 public function get_index()
 {
     $view = View::instance();
     try {
         if (isset($_SESSION['client_user'])) {
             $chat = $this->orm->chat[$_SESSION['client_user']['id_chat']];
             if ($chat['closed']) {
                 unset($_SESSION['client_user']);
             } elseif ($chat['id_support_user']) {
                 Header::redirect(URL::baseUrl() . '/conversation');
             } else {
                 Header::redirect(URL::baseUrl() . '/client/wait');
             }
         }
         $param = $this->orm->param();
         $param->select('value');
         $param->where('name', 'STATUS');
         $supportStatus = $param->fetch();
         $supportUser = $this->orm->support_user();
         $supportUser->where('active', 1);
         $supportUser->and('online', 1);
         $supportOnlineCount = $supportUser->count('id_support_user');
         if ($supportStatus['value'] == 1 && $supportOnlineCount > 0) {
             $view->render('form-client');
         } else {
             $view->render('offline');
         }
     } catch (Exception $e) {
         $view->render('offline');
     }
 }
예제 #22
0
 function ajaxCreate($server, $node, $id = false)
 {
     if (!$this->validateServerNode($server, $node)) {
         return;
     }
     $post = false;
     if ($id) {
         $pd = new \modl\PostnDAO();
         $p = $pd->getItem($id);
         if ($p->isEditable()) {
             $post = $p;
         }
     }
     $view = $this->tpl();
     $view->assign('to', $server);
     $view->assign('node', $node);
     $view->assign('item', $post);
     RPC::call('MovimTpl.fill', 'main section > div:nth-child(2)', $view->draw('_publish_create', true));
     $pd = new \Modl\ItemDAO();
     $item = $pd->getItem($server, $node);
     $view = $this->tpl();
     $view->assign('server', $server);
     $view->assign('node', $node);
     $view->assign('post', $post);
     $view->assign('item', $item);
     Header::fill($view->draw('_publish_header', true));
     if ($id) {
         RPC::call('Publish.initEdit');
     }
     RPC::call('Publish.setEmbed');
 }
예제 #23
0
파일: view.php 프로젝트: ahmed555/Cupcake
 public function render()
 {
     $layout = $this->content_for_template();
     $body = $this->content_for_layout($layout);
     // Needed for testing
     if (CUPCAKE_ENV === "test") {
         $dispatcher = DispatcherTest::getInstance();
         $dispatcher->__params = $this->view_params();
         $dispatcher->__view_params = $this->view_params;
         $dispatcher->__template = $this->template;
         $dispatcher->__layout = $this->layout;
         # Action might be false positive and controller aswell.
         $dispatcher->__controller = $this->controller;
         $dispatcher->__action = $this->params["action"];
         $dispatcher->__request_uri = $this->request_uri;
         $dispatcher->__body = $body;
         return;
     }
     if (!empty($this->content_type)) {
         Header::set("Content-Type", $this->content_type);
         Header::send();
     }
     echo $body;
     exit;
 }
예제 #24
0
 public function testHeaderWithSponsor()
 {
     $header = Header::create()->withTitle(H1::create()->appendText('Big Top Title ')->appendText(Bold::create()->appendText('in Bold')))->withSubTitle(H2::create()->appendText('Smaller SubTitle ')->appendText(Bold::create()->appendText('in Bold')))->withKicker(H3::create()->appendText('Kicker ')->appendText(Bold::create()->appendText('in Bold')))->withSponsor(Sponsor::create()->withPageUrl('http://facebook.com/my-sponsor'));
     $expected = '<header>' . '<h1>Big Top Title <b>in Bold</b></h1>' . '<h2>Smaller SubTitle <b>in Bold</b></h2>' . '<h3 class="op-kicker">Kicker <b>in Bold</b></h3>' . '<ul class="op-sponsors">' . '<li>' . '<a href="http://facebook.com/my-sponsor" rel="facebook"></a>' . '</li>' . '</ul>' . '</header>';
     $rendered = $header->render();
     $this->assertEquals($expected, $rendered);
 }
예제 #25
0
파일: API.php 프로젝트: m6w6/seekat
 /**
  * Import handler for the endpoint's underlying data
  *
  * \seekat\Call will call this when the request will have finished.
  *
  * @param Response $response
  * @return API self
  * @throws UnexpectedValueException
  * @throws RequestException
  * @throws \Exception
  */
 function import(Response $response) : API
 {
     $this->__log->info(__FUNCTION__ . ": " . $response->getInfo(), ["url" => (string) $this->__url]);
     if ($response->getResponseCode() >= 400) {
         $e = new RequestException($response);
         $this->__log->critical(__FUNCTION__ . ": " . $e->getMessage(), ["url" => (string) $this->__url]);
         throw $e;
     }
     if (!($type = $response->getHeader("Content-Type", Header::class))) {
         $e = new RequestException($response);
         $this->__log->error(__FUNCTION__ . ": Empty Content-Type -> " . $e->getMessage(), ["url" => (string) $this->__url]);
         throw $e;
     }
     try {
         $this->__type = new ContentType($type);
         $this->__data = $this->__type->parseBody($response->getBody());
         if ($link = $response->getHeader("Link", Header::class)) {
             $this->__links = new Links($link);
         }
     } catch (\Exception $e) {
         $this->__log->error(__FUNCTION__ . ": " . $e->getMessage(), ["url" => (string) $this->__url]);
         throw $e;
     }
     return $this;
 }
예제 #26
0
파일: Ship.php 프로젝트: thekabal/tki
 public static function isDestroyed(\PDO $pdo_db, string $lang, Reg $tkireg, array $langvars, Smarty $template, array $playerinfo) : bool
 {
     // Check for destroyed ship
     if ($playerinfo['ship_destroyed'] === 'Y') {
         // if the player has an escapepod, set the player up with a new ship
         if ($playerinfo['dev_escapepod'] === 'Y') {
             $sql = "UPDATE ::prefix::ships SET hull=0, engines=0, power=0," . "computer=0, sensors=0, beams=0, torp_launchers=0, torps=0, armor=0, " . "armor_pts=100, cloak=0, shields=0, sector=1, ship_ore=0, " . "ship_organics=0, ship_energy=1000, ship_colonists=0, ship_goods=0, " . "ship_fighters=100, ship_damage=0, on_planet='N', dev_warpedit=0, " . "dev_genesis=0, dev_beacon=0, dev_emerwarp=0, dev_escapepod='N', " . "dev_fuelscoop='N', dev_minedeflector=0, ship_destroyed='N', " . "dev_lssd='N' WHERE email=:email";
             $stmt = $pdo_db->prepare($sql);
             $stmt->bindParam(':email', $_SESSION['username']);
             $stmt->execute();
             Db::logDbErrors($pdo_db, $sql, __LINE__, __FILE__);
             // $error_status = str_replace('[here]', "<a href='main.php'>" . $langvars['l_here'] . '</a>', $langvars['l_login_died']); Error status is not used anywhere
         } else {
             // if the player doesn't have an escapepod - they're dead, delete them.
             // But we can't delete them yet. (This prevents the self-distruct inherit bug)
             $error_status = str_replace('[here]', "<a href='log.php'>" . ucfirst($langvars['l_here']) . '</a>', $langvars['l_global_died']) . '<br><br>' . $langvars['l_global_died2'];
             $error_status .= str_replace('[logout]', "<a href='logout.php'>" . $langvars['l_logout'] . '</a>', $langvars['l_die_please']);
             $title = $langvars['l_error'];
             Header::display($pdo_db, $lang, $template, $title);
             echo $error_status;
             Footer::display($pdo_db, $lang, $tkireg, $template);
             die;
         }
     } else {
         return false;
     }
 }
 public function testIsRTLEnabled()
 {
     $article = InstantArticle::create()->withCanonicalURL('http://wp.localtest.me/2016/04/12/stress-on-earth/')->enableAutomaticAdPlacement()->enableRTL()->withHeader(Header::create()->withTitle(H1::create()->appendText('Peace on <b>earth</b>'))->addAuthor(Author::create()->withName('bill'))->withPublishTime(Time::create(Time::PUBLISHED)->withDatetime(\DateTime::createFromFormat('j-M-Y G:i:s', '14-Aug-1984 19:30:00'))))->addChild(Paragraph::create()->appendText('Yes, peace is good for everybody!')->appendText(LineBreak::create())->appendText(' Man kind.'));
     $result = $article->render();
     $expected = '<!doctype html>' . '<html dir="rtl">' . '<head>' . '<link rel="canonical" href="http://wp.localtest.me/2016/04/12/stress-on-earth/"/>' . '<meta charset="utf-8"/>' . '<meta property="op:generator" content="facebook-instant-articles-sdk-php"/>' . '<meta property="op:generator:version" content="1.5.2"/>' . '<meta property="op:markup_version" content="v1.0"/>' . '</head>' . '<body>' . '<article>' . '<header>' . '<h1>Peace on &lt;b&gt;earth&lt;/b&gt;</h1>' . '<time class="op-published" datetime="1984-08-14T19:30:00+00:00">August 14th, 7:30pm</time>' . '<address>' . '<a>bill</a>' . '</address>' . '</header>' . '<p>Yes, peace is good for everybody!<br/> Man kind.</p>' . '</article>' . '</body>' . '</html>';
     $this->assertEquals($expected, $result);
 }
예제 #28
0
파일: header.php 프로젝트: ahmed555/Cupcake
 static function &getInstance()
 {
     if (self::$instance === false) {
         self::$instance = new self();
     }
     return self::$instance;
 }
예제 #29
0
파일: Groups.php 프로젝트: vijo/movim
 function ajaxHeader()
 {
     $id = new \modl\ItemDAO();
     $view = $this->tpl();
     $view->assign('servers', $id->getGroupServers());
     $header = $view->draw('_groups_header', true);
     Header::fill($header);
 }
 /**
  * @return String
  */
 public function getString()
 {
     $line_outputs = [];
     if ($this->fileHeader) {
         $line_outputs[] = $this->fileHeader->getString();
     }
     if ($this->batchHeader) {
         $line_outputs[] = $this->batchHeader->getString();
     }
     foreach ($this->beneficiaryLines as $beneficiary_line) {
         $line_outputs[] = $beneficiary_line->getString();
     }
     if ($this->batchTrailer) {
         $line_outputs[] = $this->batchTrailer->getString();
     }
     return implode($this->lineBreak, $line_outputs);
 }