Skip to content

Commit

Permalink
glype-1.4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentclee committed Jul 13, 2019
1 parent f745a50 commit 8269542
Show file tree
Hide file tree
Showing 21 changed files with 197 additions and 54 deletions.
8 changes: 4 additions & 4 deletions admin.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*******************************************************************
* Glype is copyright and trademark 2007-2012 UpsideOut, Inc. d/b/a Glype
* Glype is copyright and trademark 2007-2013 UpsideOut, Inc. d/b/a Glype
* and/or its licensors, successors and assigners. All rights reserved.
*
* Use of Glype is subject to the terms of the Software License Agreement.
Expand Down Expand Up @@ -42,7 +42,7 @@
define('ADMIN_URI', $_SERVER['PHP_SELF']);

# Define the current admin version
define('ADMIN_VERSION', '1.4.2');
define('ADMIN_VERSION', '1.4.3');

# Start buffering
ob_start();
Expand Down Expand Up @@ -682,7 +682,7 @@ protected function wrap() {
<div id="footer">
<div id="footer_bg">
<p><a href="http://www.glype.com/">Glype</a>&reg; &copy; 2007-2012 Glype. All rights reserved.</p>
<p><a href="http://www.glype.com/">Glype</a>&reg; &copy; 2007-2013 Glype. All rights reserved.</p>
</div>
</div>
Expand Down Expand Up @@ -1519,7 +1519,7 @@ function comment($text, $multi=false) {
# Prepare the file header
$toWrite = '<?php
/*******************************************************************
* Glype is copyright and trademark 2007-2012 UpsideOut, Inc. d/b/a Glype
* Glype is copyright and trademark 2007-2013 UpsideOut, Inc. d/b/a Glype
* and/or its licensors, successors and assigners. All rights reserved.
*
* Use of Glype is subject to the terms of the Software License Agreement.
Expand Down
2 changes: 1 addition & 1 deletion browse.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*******************************************************************
* Glype is copyright and trademark 2007-2012 UpsideOut, Inc. d/b/a Glype
* Glype is copyright and trademark 2007-2013 UpsideOut, Inc. d/b/a Glype
* and/or its licensors, successors and assigners. All rights reserved.
*
* Use of Glype is subject to the terms of the Software License Agreement.
Expand Down
2 changes: 1 addition & 1 deletion cookies.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*******************************************************************
* Glype is copyright and trademark 2007-2012 UpsideOut, Inc. d/b/a Glype
* Glype is copyright and trademark 2007-2013 UpsideOut, Inc. d/b/a Glype
* and/or its licensors, successors and assigners. All rights reserved.
*
* Use of Glype is subject to the terms of the Software License Agreement.
Expand Down
2 changes: 1 addition & 1 deletion disclaimer.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*******************************************************************
* Glype is copyright and trademark 2007-2012 UpsideOut, Inc. d/b/a Glype
* Glype is copyright and trademark 2007-2013 UpsideOut, Inc. d/b/a Glype
* and/or its licensors, successors and assigners. All rights reserved.
*
* Use of Glype is subject to the terms of the Software License Agreement.
Expand Down
2 changes: 1 addition & 1 deletion edit-browser.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*******************************************************************
* Glype is copyright and trademark 2007-2012 UpsideOut, Inc. d/b/a Glype
* Glype is copyright and trademark 2007-2013 UpsideOut, Inc. d/b/a Glype
* and/or its licensors, successors and assigners. All rights reserved.
*
* Use of Glype is subject to the terms of the Software License Agreement.
Expand Down
4 changes: 2 additions & 2 deletions includes/init.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*******************************************************************
* Glype is copyright and trademark 2007-2012 UpsideOut, Inc. d/b/a Glype
* Glype is copyright and trademark 2007-2013 UpsideOut, Inc. d/b/a Glype
* and/or its licensors, successors and assigners. All rights reserved.
*
* Use of Glype is subject to the terms of the Software License Agreement.
Expand Down Expand Up @@ -92,7 +92,7 @@
******************************************************************/

# Current version - no need to change this!
$themeReplace['version'] = 'v1.4.2';
$themeReplace['version'] = 'v1.4.3';

# Look for a config.php in the /themes/themeName/ folder
if ( ! defined('MULTIGLYPE') && file_exists($tmp = GLYPE_ROOT . '/themes/' . $CONFIG['theme'] . '/config.php') ) {
Expand Down
2 changes: 1 addition & 1 deletion includes/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************
* Glype is copyright and trademark 2007-2012 UpsideOut, Inc. d/b/a Glype
* Glype is copyright and trademark 2007-2013 UpsideOut, Inc. d/b/a Glype
* and/or its licensors, successors and assigners. All rights reserved.
*
* Use of Glype is subject to the terms of the Software License Agreement.
Expand Down
153 changes: 133 additions & 20 deletions includes/parser.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*******************************************************************
* Glype is copyright and trademark 2007-2012 UpsideOut, Inc. d/b/a Glype
* Glype is copyright and trademark 2007-2013 UpsideOut, Inc. d/b/a Glype
* and/or its licensors, successors and assigners. All rights reserved.
*
* Use of Glype is subject to the terms of the Software License Agreement.
Expand Down Expand Up @@ -52,6 +52,10 @@ function HTMLDocument($input, $insert='', $inject=false, $footer='') {
}
}

# Remove conditional comments
$input = preg_replace('#<\!\-\-\[if \!IE\]>\s*\-\->(.*?)<\!\[endif\]\-\->#s','$1',$input);
$input = preg_replace('#<\!\-\-\[if.*?<\!\[endif\]\-\->#s','',$input);

# Remove titles if option is enabled
if ( $this->htmlOptions['stripTitle'] || $this->htmlOptions['encodePage'] ) {
$input = preg_replace('#<title.*?</title>#is', '', $input, 1);
Expand Down Expand Up @@ -407,6 +411,13 @@ function JS($input) {

}

# If $item is whole word?
if ( ( $input[$tmp-1] == '_' ) || ctype_alpha($input[$tmp-1]) ) {

# No
continue;

}

# Closer to the currently held 'next' position?
if ( $tmp < $commandPos ) {
Expand Down Expand Up @@ -436,11 +447,13 @@ function JS($input) {
}

# Check next chars
if ( isset($pattern['after']) && ( $postCharPos = str_checknext($input, $pattern['after'], $commandPos + strlen($command), false, true) ) === false ) {
if ( isset($pattern['after']) && ( $charPos = str_checknext($input, $pattern['after'], $commandPos + strlen($command), false, false) ) === false ) {
continue;
}

# Still here? Match must be OK so generate a match ID

$postCharPos = ($charPos + 1) + strspn($input, " \t\r\n", $charPos + 1);

# Still here? Match must be OK so generate a match ID
if ( isset($pattern['id']) ) {
$valid = $command . $pattern['id'];
} else {
Expand Down Expand Up @@ -469,7 +482,7 @@ function JS($input) {
}

# Find the end of this statement
$endPos = analyze_js($input, $postCharPos);
$endPos = analyzeAssign_js($input, $charPos);
$valueLength = $endPos - $postCharPos;

# Produce replacement command
Expand Down Expand Up @@ -498,17 +511,21 @@ function JS($input) {
case 'writeln':

# Find the end position (the closing ")" for the function call)
$endPos = analyze_js($input, $postCharPos);
$endPos = analyze_js($input, $charPos);

# Insert our additional argument just before that
$input = substr_replace($input, ',"gl"', $endPos, 0);

$glStr=',"gl"';
if (strspn($input, ";\n\r\+{}()[]", $charPos) >= ($endPos - $charPos)) {
$glStr='"gl"';
}
$input = substr_replace($input, $glStr, $endPos - 1, 0);

# Adjust the document length
$length += 5;
$length += strlen($glStr);

# And move the offset
$offset = $endPos + 5;
$offset = $endPos + strlen($glStr);

# Get next match
continue 2;

Expand All @@ -522,7 +539,7 @@ function JS($input) {
}

# Find the end position (the closing ")" for the function call)
$endPos = analyze_js($input, $postCharPos);
$endPos = analyze_js($input, $charPos);
$valueLength = $endPos - $postCharPos;

# Generate our replacement
Expand Down Expand Up @@ -550,10 +567,10 @@ function JS($input) {
}

# Move $postCharPos to inside the brackets of .replace()
$postCharPos += strlen($tmp[0]);
$charPos = $postCharPos - 1;

# Find the end position (the closing ")" for the function call)
$endPos = analyze_js($input, $postCharPos);
$endPos = analyze_js($input, $charPos);
$valueLength = $endPos - $postCharPos;

# Generate our replacement
Expand Down Expand Up @@ -849,19 +866,16 @@ function str_checkprev($input, $char, $offset, $inverse = false) {
# the parenthesis of the function call we're interested in.
function analyze_js($input, $start, $argPos = false) {

# Set chars we're interested in
$specialChars = ";\n\r\"'+{}()[]";

# Add , if looking for an argument position
if ( $argPos ) {
$specialChars .= ',';
$currentArg = 1;
}

# Loop through the input, stopping only at special chars
for ( $i = $start, $length = strlen($input), $end = false, $openObjects = $openBrackets = $openArrays = 0;
$end === false && ( $i += strcspn($input, $specialChars, $i) ) && $i < $length && ( $char = $input[$i] );
$end === false && $i < $length;
++$i ) {
$char = $input[$i];

switch ( $char ) {

Expand Down Expand Up @@ -983,6 +997,105 @@ function analyze_js($input, $start, $argPos = false) {
# Return end
return $end;

}
function analyzeAssign_js($input, $start) {

# Loop through the input, stopping only at special chars
for ( $i = $start, $length = strlen($input), $end = false, $openObjects = $openBrackets = $openArrays = 0;
$end === false && $i < $length;
++$i ) {
$char = $input[$i];

switch ( $char ) {

# Starting string delimiters
case '"':
case "'":

if ( $input[$i-1] == '\\' ) {
break;
}

# Skip straight to end of string
# Find the corresponding end delimiter and ensure it's not escaped
while ( ( $i = strpos($input, $char, $i+1) ) && $input[$i-1] == '\\' );

# Check for false, in which case we assume the end is the end of the doc
if ( $i === false ) {
break 2;
}

break;

# End of operation?
case ';':
$end = $i;
break;

# New lines
case "\n":
case "\r":
# Newlines are OK if occuring within an open brackets, arrays or objects.
if ( $openObjects || $openBrackets || $openArrays ) {
break;
}
break;

# Concatenation
case '+':
# Our interest in the + operator is it's use in allowing an expression
# to span multiple lines. If we come across a +, move past all whitespace,
# including newlines (which would otherwise indicate end of expression).
$i += strspn($input, " \t\r\n", $i+1);
break;

# Opening chars (objects, parenthesis and arrays)
case '{':
++$openObjects;
break;
case '(':
++$openBrackets;
break;
case '[':
++$openArrays;
break;

# Closing chars - is there a corresponding open char?
# Yes = reduce stored count. No = end of statement.
case '}':
$openObjects ? --$openObjects : $end = $i;
break;
case ')':
$openBrackets ? --$openBrackets : $end = $i;
break;
case ']':
$openArrays ? --$openArrays : $end = $i;
break;

# Commas - tell us which argument it is
case ',':

# Ignore commas inside other functions or whatnot
if ( $openObjects || $openBrackets || $openArrays ) {
break;
}

# End now
$end = $i;
break;

}

}

# End not found? Use end of document
if ( $end === false ) {
$end = $length;
}

# Return end
return $end;

}

/*****************************************************************
Expand Down
2 changes: 1 addition & 1 deletion includes/process.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*******************************************************************
* Glype is copyright and trademark 2007-2012 UpsideOut, Inc. d/b/a Glype
* Glype is copyright and trademark 2007-2013 UpsideOut, Inc. d/b/a Glype
* and/or its licensors, successors and assigners. All rights reserved.
*
* Use of Glype is subject to the terms of the Software License Agreement.
Expand Down
4 changes: 2 additions & 2 deletions includes/settings.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*******************************************************************
* Glype is copyright and trademark 2007-2012 UpsideOut, Inc. d/b/a Glype
* Glype is copyright and trademark 2007-2013 UpsideOut, Inc. d/b/a Glype
* and/or its licensors, successors and assigners. All rights reserved.
*
* Use of Glype is subject to the terms of the Software License Agreement.
Expand Down Expand Up @@ -265,7 +265,7 @@

# Settings file version for determining compatability with admin
# tool.
$CONFIG['version'] = '1.4.2';
$CONFIG['version'] = '1.4.3';

//---PRESERVE ME---
// Anything below this line will be preserved when the admin control panel rewrites
Expand Down
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*******************************************************************
* Glype is copyright and trademark 2007-2012 UpsideOut, Inc. d/b/a Glype
* Glype is copyright and trademark 2007-2013 UpsideOut, Inc. d/b/a Glype
* and/or its licensors, successors and assigners. All rights reserved.
*
* Use of Glype is subject to the terms of the Software License Agreement.
Expand Down
2 changes: 1 addition & 1 deletion plugins/facebook.com.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*******************************************************************
* Glype is copyright and trademark 2007-2012 UpsideOut, Inc. d/b/a Glype
* Glype is copyright and trademark 2007-2013 UpsideOut, Inc. d/b/a Glype
* and/or its licensors, successors and assigners. All rights reserved.
*
* Use of Glype is subject to the terms of the Software License Agreement.
Expand Down
2 changes: 1 addition & 1 deletion plugins/google.com.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*******************************************************************
* Glype is copyright and trademark 2007-2012 UpsideOut, Inc. d/b/a Glype
* Glype is copyright and trademark 2007-2013 UpsideOut, Inc. d/b/a Glype
* and/or its licensors, successors and assigners. All rights reserved.
*
* Use of Glype is subject to the terms of the Software License Agreement.
Expand Down
2 changes: 1 addition & 1 deletion plugins/hotmail.com.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*******************************************************************
* Glype is copyright and trademark 2007-2012 UpsideOut, Inc. d/b/a Glype
* Glype is copyright and trademark 2007-2013 UpsideOut, Inc. d/b/a Glype
* and/or its licensors, successors and assigners. All rights reserved.
*
* Use of Glype is subject to the terms of the Software License Agreement.
Expand Down
2 changes: 1 addition & 1 deletion plugins/live.com.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*******************************************************************
* Glype is copyright and trademark 2007-2012 UpsideOut, Inc. d/b/a Glype
* Glype is copyright and trademark 2007-2013 UpsideOut, Inc. d/b/a Glype
* and/or its licensors, successors and assigners. All rights reserved.
*
* Use of Glype is subject to the terms of the Software License Agreement.
Expand Down
Loading

0 comments on commit 8269542

Please sign in to comment.