From 0054771b63b71a0efc4047fb16ee1c5d1a89c242 Mon Sep 17 00:00:00 2001 From: Gustavo Bordoni Date: Thu, 5 Jan 2023 15:59:43 -0500 Subject: [PATCH] Update with the latest code from WP.org 2.3.28 --- gigpress.php | 2 +- lib/parsecsv.lib.php | 39 ++++++----- lib/upgrade.php | 140 +++++++++++++++++++------------------- output/gigpress_shows.php | 31 ++++++--- readme.txt | 10 ++- 5 files changed, 120 insertions(+), 102 deletions(-) diff --git a/gigpress.php b/gigpress.php index 18ce966..e4cd444 100644 --- a/gigpress.php +++ b/gigpress.php @@ -3,7 +3,7 @@ * Plugin Name: GigPress * Plugin URI: https://evnt.is/1aca * Description: GigPress is a live performance listing and management plugin built for musicians and performers. - * Version: 2.3.26 + * Version: 2.3.28 * Author: The Events Calendar * Author URI: https://evnt.is/1aor * Text Domain: gigpress diff --git a/lib/parsecsv.lib.php b/lib/parsecsv.lib.php index 63a4df6..c943823 100644 --- a/lib/parsecsv.lib.php +++ b/lib/parsecsv.lib.php @@ -344,9 +344,9 @@ function parse_string( $data = null ) { // walk through each character for ( $i = 0; $i < $strlen; $i ++ ) { - $ch = $data{$i}; - $nch = ( isset( $data{$i + 1} ) ) ? $data{$i + 1} : false; - $pch = ( isset( $data{$i - 1} ) ) ? $data{$i - 1} : false; + $ch = $data[ $i ]; + $nch = ( isset( $data[ $i + 1 ] ) ) ? $data[ $i + 1 ] : false; + $pch = ( isset( $data[ $i - 1 ] ) ) ? $data[ $i - 1 ] : false; // open/close quotes, and inline quotes if ( $ch == $this->enclosure ) { @@ -373,9 +373,9 @@ function parse_string( $data = null ) { $current .= $ch; $i ++; } elseif ( $nch != $this->delimiter && $nch != "\r" && $nch != "\n" ) { - for ( $x = ( $i + 1 ); isset( $data{$x} ) && ltrim( $data{$x}, $white_spaces ) == ''; $x ++ ) { + for ( $x = ( $i + 1 ); isset( $data[ $x ] ) && ltrim( $data[ $x ], $white_spaces ) == ''; $x ++ ) { } - if ( $data{$x} == $this->delimiter ) { + if ( $data[ $x ] == $this->delimiter ) { $enclosed = false; $i = $x; } else { @@ -552,12 +552,19 @@ function _validate_row_conditions( $row = [], $conditions = null ) { */ function _validate_row_condition( $row, $condition ) { $operators = [ - '=', 'equals', 'is', - '!=', 'is not', - '<', 'is less than', - '>', 'is greater than', - '<=', 'is less than or equals', - '>=', 'is greater than or equals', + '=', + 'equals', + 'is', + '!=', + 'is not', + '<', + 'is less than', + '>', + 'is greater than', + '<=', + 'is less than or equals', + '>=', + 'is greater than or equals', 'contains', 'does not contain', ]; @@ -712,7 +719,7 @@ function _enclose_value( $value = null ) { if ( $value !== null && $value != '' ) { $delimiter = preg_quote( $this->delimiter, '/' ); $enclosure = preg_quote( $this->enclosure, '/' ); - if ( preg_match( "/" . $delimiter . "|" . $enclosure . "|\n|\r/i", $value ) || ( $value{0} == ' ' || substr( $value, - 1 ) == ' ' ) ) { + if ( preg_match( "/" . $delimiter . "|" . $enclosure . "|\n|\r/i", $value ) || ( $value[0] == ' ' || substr( $value, - 1 ) == ' ' ) ) { $value = str_replace( $this->enclosure, $this->enclosure . $this->enclosure, $value ); $value = $this->enclosure . $value . $this->enclosure; } @@ -810,9 +817,9 @@ function auto( $file = null, $parse = true, $search_depth = null, $preferred = n // walk specific depth finding posssible delimiter characters for ( $i = 0; $i < $strlen; $i ++ ) { - $ch = $data{$i}; - $nch = ( isset( $data{$i + 1} ) ) ? $data{$i + 1} : false; - $pch = ( isset( $data{$i - 1} ) ) ? $data{$i - 1} : false; + $ch = $data[ $i ]; + $nch = ( isset( $data[ $i + 1 ] ) ) ? $data[ $i + 1 ] : false; + $pch = ( isset( $data[ $i - 1 ] ) ) ? $data[ $i - 1 ] : false; // open and closing quotes if ( $ch == $enclosure ) { @@ -906,5 +913,3 @@ function _check_count( $char, $array, $depth, $preferred ) { } } - -?> diff --git a/lib/upgrade.php b/lib/upgrade.php index 7c72afc..a0507e0 100644 --- a/lib/upgrade.php +++ b/lib/upgrade.php @@ -2060,22 +2060,22 @@ function up_convert_uudecode($from) { #-- current line length prefix unset($num); - $num = ord($line{0}) - 32; + $num = ord($line[0]) - 32; if (($num <= 0) || ($num > 62)) { // 62 is the maximum line length break; // according to uuencode(5), so we stop here too } $line = substr($line, 1); - + #-- prepare to decode 4-char chunks $add = ""; for ($n=0; strlen($add)<$num; ) { - + #-- merge 24 bit integer from the 4 ascii characters (6 bit each) $x = ((ord($line[$n++]) - 32) << 18) + ((ord($line[$n++]) - 32) << 12) // were saner with "& 0x3f" + ((ord($line[$n++]) - 32) << 6) + ((ord($line[$n++]) - 32) << 0); - + #-- reconstruct the 3 original data chars $add .= chr( ($x >> 16) & 0xff ) . chr( ($x >> 8) & 0xff ) @@ -2095,12 +2095,12 @@ function up_convert_uudecode($from) { * return array of filenames in a given directory * (only works for local files) * - * @param string $dirname - * @param bool $desc + * @param string $dirname + * @param bool $desc * @return array */ function up_scandir($dirname, $desc=0) { - + #-- check for file:// protocol, others aren't handled if (strpos($dirname, "file://") === 0) { $dirname = substr($dirname, 7); @@ -2108,7 +2108,7 @@ function up_scandir($dirname, $desc=0) { $dirname = substr($dirname, strpos($dirname, "/")); } } - + #-- directory reading handle if ($dh = opendir($dirname)) { $ls = array(); @@ -2116,7 +2116,7 @@ function up_scandir($dirname, $desc=0) { $ls[] = $fn; // add to array } closedir($dh); - + #-- sort filenames if ($desc) { rsort($ls); @@ -2140,17 +2140,17 @@ function up_scandir($dirname, $desc=0) { * @return integer */ function up_idate($formatchar, $timestamp=NULL) { - + #-- reject non-simple type parameters if (strlen($formatchar) != 1) { return false; } - + #-- get current time, if not given if (!isset($timestamp)) { $timestamp = time(); } - + #-- get and turn into integer $str = date($formatchar, $timestamp); return (int)$str; @@ -2159,8 +2159,8 @@ function up_idate($formatchar, $timestamp=NULL) { /** - * combined sleep() and usleep() - * + * combined sleep() and usleep() + * */ function up_time_nanosleep($sec, $nano) { sleep($sec); @@ -2174,26 +2174,26 @@ function up_time_nanosleep($sec, $nano) { * search first occourence of any of the given chars, returns rest of haystack * (char_list must be a string for compatibility with the real PHP func) * - * @param string $haystack - * @param string $char_list + * @param string $haystack + * @param string $char_list * @return integer */ function up_strpbrk($haystack, $char_list) { - + #-- prepare $len = strlen($char_list); $min = strlen($haystack); - + #-- check with every symbol from $char_list for ($n = 0; $n < $len; $n++) { - $l = strpos($haystack, $char_list{$n}); - + $l = strpos($haystack, $char_list[ $n ]); + #-- get left-most occourence if (($l !== false) && ($l < $min)) { $min = $l; } } - + #-- result if ($min) { return(substr($haystack, $min)); @@ -2207,7 +2207,7 @@ function up_strpbrk($haystack, $char_list) { /** * logo image activation URL query strings (gaga feature) - * + * */ function up_php_real_logo_guid() { return php_logo_guid(); } function up_php_egg_logo_guid() { return zend_logo_guid(); } @@ -2216,7 +2216,7 @@ function up_php_egg_logo_guid() { return zend_logo_guid(); } /** * no need to implement this * (there aren't interfaces in PHP4 anyhow) - * + * */ function up_get_declared_interfaces() { trigger_error("up_get_declared_interfaces(): Current script won't run reliably with PHP4.", E_USER_WARNING); @@ -2229,17 +2229,17 @@ function up_get_declared_interfaces() { * creates an array from lists of $keys and $values * (both should have same number of entries) * - * @param array $keys - * @param array $values + * @param array $keys + * @param array $values * @return array */ function up_array_combine($keys, $values) { - + #-- convert input arrays into lists $keys = array_values($keys); $values = array_values($values); $r = array(); - + #-- one from each foreach ($values as $i=>$val) { if ($key = $keys[$i]) { @@ -2258,8 +2258,8 @@ function up_array_combine($keys, $values) { * use it like: array_walk_recursive($_POST, "stripslashes"); * - $callback can be static function name or object/method, class/method * - * @param array $input - * @param string $callback + * @param array $input + * @param string $callback * @param array $userdata (optional) * @return array */ @@ -2285,16 +2285,16 @@ function up_array_walk_recursive(&$input, $callback, $userdata=NULL) { /** * complicated wrapper around substr() and and strncmp() * - * @param string $haystack - * @param string $needle - * @param integer $offset - * @param integer $len - * @param integer $ci + * @param string $haystack + * @param string $needle + * @param integer $offset + * @param integer $len + * @param integer $ci * @return mixed */ function up_substr_compare($haystack, $needle, $offset=0, $len=0, $ci=0) { - #-- check params + #-- check params if ($len <= 0) { // not well documented $len = strlen($needle); if (!$len) { return(0); } @@ -2323,7 +2323,7 @@ function up_substr_compare($haystack, $needle, $offset=0, $len=0, $ci=0) { /** * stub, returns empty list as usual; * you must load "ext/spl.php" beforehand to get this - * + * */ function up_spl_classes() { trigger_error("up_spl_classes(): not built into this PHP version"); @@ -2335,15 +2335,15 @@ function up_spl_classes() { /** * gets you list of class names the given objects class was derived from, slow * - * @param object $obj + * @param object $obj * @return object */ function up_class_parents($obj) { - + #-- first get full list $all = get_declared_classes(); $r = array(); - + #-- filter out foreach ($all as $potential_parent) { if (is_subclass_of($obj, $potential_parent)) { @@ -2356,7 +2356,7 @@ function up_class_parents($obj) { /** * an alias - * + * */ function up_session_commit() { // simple @@ -2367,7 +2367,7 @@ function up_session_commit() { /** * aliases * - * @param mixed $host + * @param mixed $host * @param mixed $type (optional) * @return mixed */ @@ -2392,7 +2392,7 @@ function up_dns_get_mx($host, $mx) { * setrawcookie(), * can this be emulated 100% exactly? * - * @param string $name + * @param string $name * @param mixed $value * @param mixed $expire * @param mixed $path @@ -2421,8 +2421,8 @@ function up_setrawcookie($name, $value=NULL, $expire=NULL, $path=NULL, $domain=N * write-at-once file access (counterpart to file_get_contents) * * @param integer $filename - * @param mixed $content - * @param integer $flags + * @param mixed $content + * @param integer $flags * @param mixed $resource * @return integer */ @@ -2433,7 +2433,7 @@ function up_file_put_contents($filename, $content, $flags=0, $resource=NULL) { $incl = $flags & FILE_USE_INCLUDE_PATH; $length = strlen($content); // $resource && trigger_error("EMULATED up_file_put_contents does not support \$resource parameter.", E_USER_ERROR); - + #-- write non-scalar? if (is_array($content) || is_object($content)) { $content = implode("", (array)$content); @@ -2442,7 +2442,7 @@ function up_file_put_contents($filename, $content, $flags=0, $resource=NULL) { #-- open for writing $f = fopen($filename, $mode, $incl); if ($f) { - + // locking if (($flags & LOCK_EX) && !flock($f, LOCK_EX)) { return fclose($f) && false; @@ -2451,7 +2451,7 @@ function up_file_put_contents($filename, $content, $flags=0, $resource=NULL) { // write $written = fwrite($f, $content); fclose($f); - + #-- only report success, if completely saved return($length == $written); } @@ -2489,11 +2489,11 @@ function up_file_put_contents($filename, $content, $flags=0, $resource=NULL) { /** * @since never * @nonstandard - * + * * we introduce a new function, because we cannot emulate the * newly introduced second parameter to count() - * - * @param array $array + * + * @param array $array * @param integer $mode * @return integer */ @@ -2617,7 +2617,7 @@ function up_mysqli_set_charset($link, $charset) { /** * simplified file read-at-once function * - * @param string $filename + * @param string $filename * @param integer $use_include_path (optional) * @return string */ @@ -2651,10 +2651,10 @@ function up_file_get_contents($filename, $use_include_path=1) { if (!defined("FNM_LEADING_DIR")) { define("FNM_LEADING_DIR", 1<<3); } // not in PHP if (!defined("FNM_CASEFOLD")) { define("FNM_CASEFOLD", 0x50); } // match case-insensitive if (!defined("FNM_EXTMATCH")) { define("FNM_EXTMATCH", 1<<5); } // not in PHP - + #-- implementation function up_fnmatch($pattern, $fn, $flags=0x0000) { - + #-- 'hidden' files if ($flags & FNM_PERIOD) { if (($fn[0] == ".") && ($pattern[0] != ".")) { @@ -2686,14 +2686,14 @@ function up_fnmatch($pattern, $fn, $flags=0x0000) { "\\*"=>"$wild*?", "\\?"=>"$wild", "\\["=>"[", "\\]"=>"]", )); $rx = "{^" . $rx . "$}" . $rxci; - + #-- cache if (count($cmp) >= 50) { $cmp = array(); // free } $cmp["$pattern+$flags"] = $rx; } - + #-- compare return(preg_match($rx, $fn)); } @@ -2724,7 +2724,7 @@ function up_glob($pattern, $flags=0x0000) { $ls = array(); $rxci = ($flags & GLOB_NOCASE) ? "i" : ""; #echo "\n=> up_glob($pattern)...\n"; - + #-- transform up_glob pattern into regular expression # (similar to fnmatch() but still different enough to require a second func) if ($pattern) { @@ -2751,7 +2751,7 @@ function up_glob($pattern, $flags=0x0000) { #echo "skip:$i, cause no pattern matching char found -> only a basedir spec\n"; continue; } - + #-- start reading dir + match filenames against current pattern if ($dh = opendir($dn ?$dn:'.')) { $with_dot = ($p[1]==".") || ($flags & GLOB_DOTS); @@ -2790,7 +2790,7 @@ function up_glob($pattern, $flags=0x0000) { closedir($dh); #-- prevent scanning a 2nd part/dir in same up_glob() instance: - break; + break; } #-- given dirname doesn't exist @@ -2817,7 +2817,7 @@ function up_glob($pattern, $flags=0x0000) { /** * redundant alias for isset() - * + * */ function up_array_key_exists($key, $search) { return isset($search[$key]); @@ -2826,7 +2826,7 @@ function up_array_key_exists($key, $search) { /** * who could need that? - * + * */ function up_array_intersect_assoc( /*array, array, array...*/ ) { @@ -2834,7 +2834,7 @@ function up_array_intersect_assoc( /*array, array, array...*/ ) { $in = func_get_args(); $cmax = count($in); $whatsleftover = array(); - + #-- walk through each array pair # (take first as checklist) foreach ($in[0] as $i => $v) { @@ -2854,14 +2854,14 @@ function up_array_intersect_assoc( /*array, array, array...*/ ) { /** * the opposite of the above - * + * */ function up_array_diff_assoc( /*array, array, array...*/ ) { #-- params $in = func_get_args(); $diff = array(); - + #-- compare each array with primary/first foreach ($in[0] as $i=>$v) { for ($c=1; $c - diff --git a/readme.txt b/readme.txt index 2718d0b..b4a24c8 100644 --- a/readme.txt +++ b/readme.txt @@ -1,9 +1,9 @@ === GigPress === -Contributors: theeventscalendar, brianjessee, camwynsp, paulkim, sc0ttkclark, aguseo, bordoni, borkweb, GeoffBel, jentheo, leahkoerper, lucatume, neillmcshea, patriciahillebrandt, vicskf, zbtirrell, juanfra +Contributors: theeventscalendar, brianjessee, camwynsp, aguseo, bordoni, borkweb, GeoffBel, jentheo, leahkoerper, lucatume, neillmcshea, vicskf, zbtirrell, juanfra Tags: concerts, bands, tours, shows, record labels, music, musicians, performers, artists Requires at least: 4.5 -Tested up to: 5.7.1 -Stable tag: 2.3.26 +Tested up to: 6.1.1 +Stable tag: 2.3.28 GigPress is a live performance listing and management plugin that's been serving musicians and performers since 2007. @@ -36,6 +36,10 @@ If you want to go beyond GigPress, we also have other plugins that could work gr == Changelog == += 2.3.28 [2022-12-27] = + +* Tweak - Resolve a problematic usaged of the shortcode `[gigpress_menu]` improving the safety of the plugin. + = 2.3.27 [2021-12-03] = * Feature - Add the ability to filter shows by related post in the sidebar widget. (props to @thomasdebruin)