Skip to content

Commit

Permalink
Catch the > 1 cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
csev committed Aug 28, 2023
1 parent c2fd4cf commit 5f4014e
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 13 deletions.
4 changes: 2 additions & 2 deletions admin/admin_util.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function findAllFolders($paths)

function addSlash($path)
{
if ( strlen($path) < 1 ) return $path;
if ( U::strlen($path) < 1 ) return $path;
if ( substr($path,strlen($path)-1) == DIRECTORY_SEPARATOR ) return $path;
return $path . DIRECTORY_SEPARATOR;
}
Expand Down Expand Up @@ -277,7 +277,7 @@ function trimAsMuchAsYouCan($path, $root) {
}
$pieces = array();
for(;$i < count($path_pieces); $i++) {
if ( strlen($path_pieces[$i] ) < 1 ) continue;
if ( U::strlen($path_pieces[$i] ) < 1 ) continue;
$pieces[] = $path_pieces[$i];
}
$remainder = implode('/', $pieces);
Expand Down
2 changes: 1 addition & 1 deletion admin/blob/migrate.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
}

// Check if the destination is blob_blob or dataroot
if ( !isset($CFG->dataroot) || strlen($CFG->dataroot) < 1 ) {
if ( !isset($CFG->dataroot) || U::strlen($CFG->dataroot) < 1 ) {
echo("Migrating from blob_file to blob_blob\n");
$where = "path IS NULL AND blob_id IS NULL"; // Leave disk blobs alone
} else {
Expand Down
2 changes: 1 addition & 1 deletion admin/install/repos_json.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
$expiresec = 600;
$repos_str = Net::doGet($url, $headers);
$note = 'Retrieved from github API. Data is cached for '.$expiresec.' seconds to avoit github limit. Add ?force=yes to force pull from github before cache expires.';
if ( strlen($repos_str) < 1 ) {
if ( U::strlen($repos_str) < 1 ) {
$error = 'No data retrieved from '.$url;
$retval['available_error'] = $error;
$retval['available_error_detail'] = '';
Expand Down
6 changes: 3 additions & 3 deletions admin/install/update.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
$remote = $tool['clone_url'];
echo("URL: ".htmlentities($remote)."\n");
$gitversion = $tool['gitversion'];
if ( strlen($gitversion) < 1 ) $gitversion = 'master';
if ( U::strlen($gitversion) < 1 ) $gitversion = 'master';
if ( isset($CFG->branch_override) && is_array($CFG->branch_override) && U::get($CFG->branch_override, $remote) ) {
$gitversion = U::get($CFG->branch_override, $remote);
}
Expand All @@ -65,14 +65,14 @@
continue;
}
$parent = dirname($path);
if ( strlen($parent) < 1 || ! file_exists($parent) ) {
if ( U::strlen($parent) < 1 || ! file_exists($parent) ) {
echo('Bad parent path: '.$parent."\n");
// Perhaps this is checked out to a new location in the /var area
$parent = U::remove_relative_path($CFG->install_folder);
$path = $parent . '/' . basename($path);
echo('Attempting path of '.$path."\n");
if ( file_exists($path) ) continue; // Already checked out
if ( strlen($parent) < 1 || ! file_exists($parent) ) {
if ( U::strlen($parent) < 1 || ! file_exists($parent) ) {
echo('Bad parent path: '.$parent."\n");
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion ext/route.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

$privkey = U::get($row,'privkey');
$pubkey = U::get($row,'pubkey');
if ( strlen($privkey) < 1 || strlen($pubkey) < 1 ) {
if ( U::strlen($privkey) < 1 || U::strlen($pubkey) < 1 ) {
http_response_code(404);
$OUTPUT->header();
$OUTPUT->bodyStart();
Expand Down
2 changes: 1 addition & 1 deletion lti/store/test.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@
$parms = $lmsdata;
// Cleanup parms before we sign
foreach( $parms as $k => $val ) {
if (strlen(trim($parms[$k]) ) < 1 ) {
if (U::strlen(trim($parms[$k]) ) < 1 ) {
unset($parms[$k]);
}
}
Expand Down
4 changes: 2 additions & 2 deletions lti/tool_consumer_outcome.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ function myErrorHandler($errno, $errstr, $errfile, $errline)
$oauth_consumer_secret = $b64[1];
$operation = "unknown";

if ( strlen($oauth_consumer_key) < 1 || strlen($oauth_consumer_secret) < 1 ) {
if ( U::strlen($oauth_consumer_key) < 1 || U::strlen($oauth_consumer_secret) < 1 ) {
echo(sprintf($response,uniqid(),'failure', "Missing key/secret B64=$b64dec B64key=$oauth_consumer_key secret=$oauth_consumer_secret",$message_ref,$operation,""));
exit();
}

$header_key = LTI::getOAuthKeyFromHeaders();
if ( strlen($header_key) < 1 ) {
if ( U::strlen($header_key) < 1 ) {
echo(sprintf($response,uniqid(),'failure', "Empty header key. Note that some proxy configurations do not pass the Authorization header.",$message_ref,$operation,""));
exit();
} else if ( $header_key != $oauth_consumer_key ) {
Expand Down
2 changes: 1 addition & 1 deletion store/test.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
$parms = $lmsdata;
// Cleanup parms before we sign
foreach( $parms as $k => $val ) {
if (strlen(trim($parms[$k]) ) < 1 ) {
if (U::strlen(trim($parms[$k]) ) < 1 ) {
unset($parms[$k]);
}
}
Expand Down
3 changes: 2 additions & 1 deletion util/unsubscribe.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

if ( ! isset($CFG) ) return; // Only from within tsugi.php

use \Tsugi\Util\U;
use \Tsugi\Core\Mail;

$id = false;
Expand All @@ -20,7 +21,7 @@
$token = $_GET['token'];
}

if ( strlen($token) < 1 ) $token = false;
if ( U::strlen($token) < 1 ) $token = false;

if ( $id === false || $token === false ) {
error_log("Unsubscribe missing id or token");
Expand Down

0 comments on commit 5f4014e

Please sign in to comment.