# HG changeset patch # User Matti Hamalainen # Date 1557834336 -10800 # Node ID 0a2117349f463522c39360c8e2e4ec87fb2de2a2 # Parent 1fe7df7c77fb687a1320de9715713c107ea868ea s/true/TRUE/g; s/false/FALSE/g; diff -r 1fe7df7c77fb -r 0a2117349f46 admajax.js.php --- a/admajax.js.php Tue May 14 14:12:42 2019 +0300 +++ b/admajax.js.php Tue May 14 14:45:36 2019 +0300 @@ -31,7 +31,7 @@ foreach (stExecSQL("SELECT * FROM settings_groups") as $group) { $args = array(); - if (($res = stExecSQL("SELECT * FROM settings WHERE vgroup=".$group["id"])) !== false) + if (($res = stExecSQL("SELECT * FROM settings WHERE vgroup=".$group["id"])) !== FALSE) { foreach ($res as $item) { diff -r 1fe7df7c77fb -r 0a2117349f46 admajax.php --- a/admajax.php Tue May 14 14:12:42 2019 +0300 +++ b/admajax.php Tue May 14 14:45:36 2019 +0300 @@ -193,7 +193,7 @@ $str = "
".chentities($title)."\n"; // Show currently selected / active file - if (($efile = stFetchSQL("SELECT * FROM files WHERE deleted=0 AND id=".$entry[$file_id])) !== false) + if (($efile = stFetchSQL("SELECT * FROM files WHERE deleted=0 AND id=".$entry[$file_id])) !== FALSE) { $str .= "
File: ".chentities($efile["filename"])."
\n". @@ -252,7 +252,7 @@ { echo "
\n"; + "\"".($mode == EEMODE_NORMAL ? " id=\"entry".$eid."\" onClick=\"activateEntry(".$eid.", FALSE)\"" : "").">\n"; } // Only show show_id if this is a normal compo and we are not adding @@ -474,7 +474,7 @@ $sql = stPrepareSQL("SELECT * FROM entries WHERE show_id=%d AND compo_id=%d", $show_id, $compo_id); - if (($entry = stFetchSQL($sql)) !== false) + if (($entry = stFetchSQL($sql)) !== FALSE) { // Entry show#/title/author information $str = @@ -485,7 +485,7 @@ "
"; // File information for quick reference - if (($efile = stFetchSQL("SELECT * FROM files WHERE deleted=0 AND id=".$entry["file_id"])) !== false) + if (($efile = stFetchSQL("SELECT * FROM files WHERE deleted=0 AND id=".$entry["file_id"])) !== FALSE) { foreach (array("S" => "filename", "O" => "origname") as $ftitle => $fid) { @@ -516,7 +516,7 @@ if ($compoID > 0) { $sql = stPrepareSQL("SELECT * FROM compos WHERE id=%d", $compoID); - if (($entry = stFetchSQL($sql)) !== false) + if (($entry = stFetchSQL($sql)) !== FALSE) $strCompo = chentities($entry["name"]); $strCurrEntry = stGetInfoEntryData(stGetDisplayVar("compoCurrEntry"), $compoID, TRUE); @@ -544,7 +544,7 @@ $str = stGetFormOptionListStart("ctrlEntryList", $indent, $outer); - if (($res = stExecSQL($sql)) !== false) + if (($res = stExecSQL($sql)) !== FALSE) { foreach ($res as $item) { @@ -572,7 +572,7 @@ $str = stGetFormOptionListStart("ctrlRotationLists", $indent, $outer); $currListID = stGetDisplayVar("rotateList"); - if (($res = stExecSQL($sql)) !== false) + if (($res = stExecSQL($sql)) !== FALSE) { foreach ($res as $item) { @@ -591,7 +591,7 @@ $str = stGetFormOptionListStart("ctrlDisplaySlides", $indent, $outer); $sql = "SELECT * FROM display_slides ORDER BY id DESC"; - if (($res = stExecSQL($sql)) !== false) + if (($res = stExecSQL($sql)) !== FALSE) { foreach ($res as $item) $str .= stGetFormOptionListItem($indent." ", $item["id"], FALSE, $item["title"]); @@ -604,7 +604,7 @@ function stGetInfoRotationListEditFull($indent, $outer, $list_id) { $sql = stPrepareSQL("SELECT * FROM rot_list_data WHERE id=%d", $list_id); - if (($data = stFetchSQL($sql)) === false) + if (($data = stFetchSQL($sql)) === FALSE) return "

No such rotation list ID #".intval($list_id)."

"; $str = @@ -616,7 +616,7 @@ stGetFormOptionListStart("ctrlEDDisplaySlides", $indent." ", TRUE); $sql = "SELECT * FROM display_slides"; - if (($res = stExecSQL($sql)) !== false) + if (($res = stExecSQL($sql)) !== FALSE) { foreach ($res as $item) $str .= stGetFormOptionListItem($indent." ", $item["id"], FALSE, $item["title"]); @@ -650,7 +650,7 @@ $str = stGetFormOptionListStart("ctrlEDRotationList", $indent, $outer); - if (($res = stExecSQL($sql)) !== false) + if (($res = stExecSQL($sql)) !== FALSE) { foreach ($res as $item) { @@ -670,7 +670,7 @@ $str = $indent.($outer ? "
" : ""). "Active list: "; - if (($slist = stFetchSQL($sql)) === false) + if (($slist = stFetchSQL($sql)) === FALSE) $str .= "-"; else $str .= chentities(substr($slist["name"], 0, 40)); @@ -689,7 +689,7 @@ $indent."
Edit display slide
\n"; $sql = stPrepareSQL("SELECT * FROM display_slides WHERE id=%d", $slide_id); - if (($slide = stFetchSQL($sql)) !== false) + if (($slide = stFetchSQL($sql)) !== FALSE) { $str .= " ".stGetFormTextInput(40, SET_LEN_DISP_SLIDE_TITLE, "", "Title", $prefix, $slide["title"])."
\n". @@ -760,7 +760,7 @@ foreach ($final as $entry) { $sql = stPrepareSQL("UPDATE entries SET show_id=%d WHERE id=%d", $index, $entry); - if (stExecSQL($sql) === false) + if (stExecSQL($sql) === FALSE) { stError("Error updating entry show positions."); break; @@ -889,7 +889,7 @@ $nentries = $ncompos = 0; foreach (stExecSQL("SELECT * FROM compos WHERE ctype=".COMPO_NORMAL) as $compo) { - if (($ne = stFetchSQLColumn("SELECT COUNT(*) FROM entries WHERE compo_id=".$compo["id"])) !== false && $ne > 0) + if (($ne = stFetchSQLColumn("SELECT COUNT(*) FROM entries WHERE compo_id=".$compo["id"])) !== FALSE && $ne > 0) { $nentries += $ne; $ncompos++; @@ -901,7 +901,7 @@ $nentries = $ncompos = 0; foreach (stExecSQL("SELECT * FROM compos WHERE ctype <> ".COMPO_NORMAL) as $compo) { - if (($ne = stFetchSQLColumn("SELECT COUNT(*) FROM entries WHERE compo_id=".$compo["id"])) !== false && $ne > 0) + if (($ne = stFetchSQLColumn("SELECT COUNT(*) FROM entries WHERE compo_id=".$compo["id"])) !== FALSE && $ne > 0) { $nentries += $ne; $ncompos++; @@ -953,7 +953,7 @@ case "setCompoID": if (stChkRequestItem("id", $compo_id, array(CHK_TYPE, VT_INT, "Invalid data."))) { - if (stFetchSQL("SELECT id FROM compos WHERE id=".$compo_id) === false) + if (stFetchSQL("SELECT id FROM compos WHERE id=".$compo_id) === FALSE) stError("Invalid compo ID ".$compo_id); else { @@ -1007,7 +1007,7 @@ stChkRequestItem("duration", $slide_dur, array(CHK_RANGE, VT_INT, array(1, 60), "Invalid duration range, should be 1-60 min."))) { $sql = stPrepareSQL("SELECT * FROM display_slides WHERE id=%d", $slide_id); - if (($slide = stFetchSQL($sql)) !== false) + if (($slide = stFetchSQL($sql)) !== FALSE) { stSetDisplayVar("tempDuration", $slide_dur); stSetDisplayVar("tempSlide", $slide["id"]); @@ -1032,12 +1032,12 @@ if (stChkRequestItem("id", $slide_id, array(CHK_TYPE, VT_INT, "Invalid data."))) { $sql = stPrepareSQL("SELECT * FROM display_slides WHERE id=%d", $slide_id); - if (($slide = stFetchSQL($sql)) !== false) + if (($slide = stFetchSQL($sql)) !== FALSE) { $sql = stPrepareSQL("INSERT INTO display_slides (title,text) VALUES (%s,%s)", $slide["title"]." (copy)", $slide["text"]); - if (($new_id = stExecSQLInsert($sql)) !== false) + if (($new_id = stExecSQLInsert($sql)) !== FALSE) echo stGetInfoDisplaySlideEdit("", TRUE, $new_id); else stError("Could not insert slide."); @@ -1049,7 +1049,7 @@ case "newDisplaySlide": $sql = stPrepareSQL("INSERT INTO display_slides (title) VALUES (%s)", "New slide"); - if (($slide_id = stExecSQLInsert($sql)) !== false) + if (($slide_id = stExecSQLInsert($sql)) !== FALSE) echo stGetInfoDisplaySlideEdit("", TRUE, $slide_id); break; @@ -1070,7 +1070,7 @@ "text" => "S", )); - if (stExecSQL($sql) !== false) + if (stExecSQL($sql) !== FALSE) { stSetStatus(200, "Slide updated."); stDisplayUpdated(); @@ -1092,12 +1092,12 @@ case "newRotationList": $sql = stPrepareSQL("INSERT INTO rot_list_data (name) VALUES (%s)", "New list #"); - if (($list_id = stExecSQLInsert($sql)) !== false) + if (($list_id = stExecSQLInsert($sql)) !== FALSE) { $sql = stPrepareSQL("UPDATE rot_list_data SET name=%s WHERE id=%d", "New list #".$list_id, $list_id); - if (stExecSQLCond($sql, "OK!") !== false) + if (stExecSQLCond($sql, "OK!") !== FALSE) echo stGetInfoRotationListEditFull("", TRUE, $list_id); } break; @@ -1291,7 +1291,7 @@ "ORDER BY compos.id DESC"; $currCompoID = stGetDisplayVar("compoID"); - if (($res = stExecSQL($sql)) !== false) + if (($res = stExecSQL($sql)) !== FALSE) { foreach ($res as $item) { @@ -1446,9 +1446,9 @@ while ($numVKeys <= $numUsers) { - if (($key = stGenerateUserKey()) !== false) + if (($key = stGenerateUserKey()) !== FALSE) { - if (stExecSQL(stPrepareSQL("INSERT INTO userkeys (key) VALUES (%s)", $key)) !== false) + if (stExecSQL(stPrepareSQL("INSERT INTO userkeys (key) VALUES (%s)", $key)) !== FALSE) $numVKeys++; } } @@ -1629,19 +1629,19 @@ if ($index++ > 0) echo ","; echo "\"".$compo["id"]."\":\"".chentities($compo["name"]). - (($ne !== false && $ne > 0) ? " (".$ne.")" : "")."\""; + (($ne !== FALSE && $ne > 0) ? " (".$ne.")" : "")."\""; } break; case "compovoting": $id = intval(stGetRequestItem("id", 0)); - if (($compo = stFetchSQL("SELECT * FROM compos WHERE id=".$id)) !== false) + if (($compo = stFetchSQL("SELECT * FROM compos WHERE id=".$id)) !== FALSE) echo stGetCompoVoting($compo, FALSE); break; case "entries": $id = intval(stGetRequestItem("id", 0)); - if (($compo = stFetchSQL("SELECT * FROM compos WHERE id=".$id)) !== false) + if (($compo = stFetchSQL("SELECT * FROM compos WHERE id=".$id)) !== FALSE) { $nentries = stFetchSQLColumn("SELECT COUNT(*) FROM entries WHERE compo_id=".$id); $prefix = "ne"; @@ -1713,7 +1713,7 @@ { // Attendees require some more work $sql = stPrepareSQL("SELECT * FROM attendees WHERE id=%d", $id); - if (($attn = stFetchSQL($sql)) !== false) + if (($attn = stFetchSQL($sql)) !== FALSE) { $sql = stPrepareSQL("DELETE FROM attendees WHERE id=%d", $id); stExecSQLCond($sql, "OK, attendee ".$id." deleted."); @@ -1869,7 +1869,7 @@ if ($type == "compo") { // Check if compo ID exists - if (($compo = stFetchSQL("SELECT * FROM compos WHERE id=".$id)) === false) + if (($compo = stFetchSQL("SELECT * FROM compos WHERE id=".$id)) === FALSE) stError("No such compo ID."); else if (stValidateRequestCompoData(TRUE, $compo["ctype"])) @@ -1955,12 +1955,12 @@ // Check if already assigned to someone .. $key_id = intval(stGetRequestItem("key_id", 0)); $sql = stPrepareSQL("SELECT * FROM userkeys WHERE id=%d", $key_id); - if (stFetchSQL($sql) === false) + if (stFetchSQL($sql) === FALSE) stError("Invalid key ID #."); else { $sql = stPrepareSQL("SELECT * FROM attendees WHERE key_id=%d", $key_id); - if (($attn = stFetchSQL($sql)) !== false && $attn["id"] != $id) + if (($attn = stFetchSQL($sql)) !== FALSE && $attn["id"] != $id) stError("That key has already been assigned to another attendee!"); else { diff -r 1fe7df7c77fb -r 0a2117349f46 dbdefs.inc.php --- a/dbdefs.inc.php Tue May 14 14:12:42 2019 +0300 +++ b/dbdefs.inc.php Tue May 14 14:45:36 2019 +0300 @@ -25,25 +25,25 @@ "userTimeout" => [VT_INT, 120, "User pages (voting) timeout in minutes"], "admTimeout" => [VT_INT, 15, "Administration interface timeout in minutes"], - "showAdmin" => [VT_BOOL, false, "Always show administration interface link on the menu"], - "showAttendees" => [VT_BOOL, true, "Show attendees list"], + "showAdmin" => [VT_BOOL, FALSE, "Always show administration interface link on the menu"], + "showAttendees" => [VT_BOOL, TRUE, "Show attendees list"], - "showResults" => [VT_BOOL, false, "Enable results page"], + "showResults" => [VT_BOOL, FALSE, "Enable results page"], - "showInfoTextOnAbout" => [VT_BOOL, false, "Show site info HTML on About page"], + "showInfoTextOnAbout" => [VT_BOOL, FALSE, "Show site info HTML on About page"], - "requireEMail" => [VT_BOOL, false, "Require e-mail address in registrations"], - "allowRegister" => [VT_BOOL, false, "Enable event registration"], + "requireEMail" => [VT_BOOL, FALSE, "Require e-mail address in registrations"], + "allowRegister" => [VT_BOOL, FALSE, "Enable event registration"], - "allowVoting" => [VT_BOOL, false, "Enable voting (individual compos must be enabled as well)"], + "allowVoting" => [VT_BOOL, FALSE, "Enable voting (individual compos must be enabled as well)"], ], // // News related // "news" => [ - "showNews" => [VT_BOOL, true, "Enable News link on main menu + News page"], - "showNewsOnAbout" => [VT_BOOL, true, "Show latest news item on About page"], + "showNews" => [VT_BOOL, TRUE, "Enable News link on main menu + News page"], + "showNewsOnAbout" => [VT_BOOL, TRUE, "Show latest news item on About page"], "msgNewsHeader" => [VT_TEXT, "

The FAPper's news outlet

@@ -54,7 +54,7 @@ // Event / schedule information // "event" => [ - "showSchedule" => [VT_BOOL, true, "Enable Schedule link on main menu + Schedule page"], + "showSchedule" => [VT_BOOL, TRUE, "Enable Schedule link on main menu + Schedule page"], "msgEventDescription" => [VT_TEXT, "

Event program & schedule

@@ -90,7 +90,7 @@ // Competitions // "compos" => [ - "showCompos" => [VT_BOOL, true, "Enable Compos link on main menu + Compos page"], + "showCompos" => [VT_BOOL, TRUE, "Enable Compos link on main menu + Compos page"], "msgCompoDescription" => [VT_TEXT, "

General

@@ -270,7 +270,7 @@ "compoCurrEntry" => [VT_INT, 0, "Current / next compo entry to be shown"], // Not user-manageable - "tempSlideSet" => [VT_BOOL, false, "Temporary slide set"], + "tempSlideSet" => [VT_BOOL, FALSE, "Temporary slide set"], "activeSlideMode" => [VT_INT, 0, "Current active slide display mode"], "activeSlide" => [VT_INT, 0, "Current active slide"], @@ -282,7 +282,7 @@ "lastUpdate" => [VT_INT, 0, "Timestamp of last slide update"], "screenCmd" => [VT_STR, "", "Off-channel showscreen command"], - "screenCmdSet" => [VT_BOOL, false, "Off-channel showscreen command has been set"], + "screenCmdSet" => [VT_BOOL, FALSE, "Off-channel showscreen command has been set"], ]; diff -r 1fe7df7c77fb -r 0a2117349f46 faptool.php --- a/faptool.php Tue May 14 14:12:42 2019 +0300 +++ b/faptool.php Tue May 14 14:45:36 2019 +0300 @@ -48,7 +48,7 @@ if (wtExec(wtGetExecutable("gfxconv"), wtGetExecutableArgs("gfxconv"). escapeshellarg($inFilename)." -f png -o ".escapeshellarg($tmpFilename), - 0) === false) + 0) === FALSE) return FALSE; if (!file_exists($tmpFilename)) @@ -225,7 +225,7 @@ // Save current working directory and chdir to target $cwd = getcwd(); - if (!is_dir($path) || chdir($path) === false) + if (!is_dir($path) || chdir($path) === FALSE) { echo "ERROR: Failed to chdir to '".$path."', can't unpack archive.\n"; return FALSE; @@ -256,7 +256,7 @@ { printf(" %03d | %s%s%s | %-40s | %-5s | %s\n", $entry["id"], - ($efile !== false) ? "E" : ".", + ($efile !== FALSE) ? "E" : ".", isset($pdata["file"]) ? "P" : ".", $pdata["valid"] ? "V" : ".", substr($entry["name"]." by ".$entry["author"], 0, 40), @@ -280,7 +280,7 @@ if (!isset($pdata["file"])) { // No source preview, check if we have entry file either? - if ($efile === false) + if ($efile === FALSE) { echo "INFO: No entry file for ".wtNiceName($compo, $entry, $efile). @@ -298,7 +298,7 @@ // Preview source file does not exist, let's see .. $edata = stProbeFileInfo($filename, TRUE); - if ($edata === false) + if ($edata === FALSE) { echo "ERROR: Invalid/unsupported file type for entry ".wtNiceName($compo, $entry, $efile)."\n"; @@ -311,12 +311,12 @@ // Entry is an archive file .. $path = stMakePath(FALSE, FALSE, array($setEntryPath, "UNPACKS", $efile["filename"])); - if (wtUnpackArchiveTo($efile["filetype"], $filename, $path) === false) + if (wtUnpackArchiveTo($efile["filetype"], $filename, $path) === FALSE) return FALSE; // Scan through files ... $dir = opendir($path); - while (($dentry = readdir($dir)) !== false) + while (($dentry = readdir($dir)) !== FALSE) { $fname = $path."/".$dentry; if ($dentry != "." && $dentry != "..") @@ -325,8 +325,8 @@ echo "XXX: ".$dentry." :: ".$fname."\n"; else if (is_file($fname) && - ($mdata = stProbeFileInfo($fname, TRUE)) !== false && - ($found = wtEntryToSource($compo, $fname, $mdata, $filename, $pdata, $outFilename, $force)) === true) + ($mdata = stProbeFileInfo($fname, TRUE)) !== FALSE && + ($found = wtEntryToSource($compo, $fname, $mdata, $filename, $pdata, $outFilename, $force)) === TRUE) break; } } @@ -451,7 +451,7 @@ function wtCropFilenamesRec($path, $len) { $dir = opendir($path); - while (($dentry = readdir($dir)) !== false) + while (($dentry = readdir($dir)) !== FALSE) { $fname = $path."/".$dentry; $nname = $path."/".wtCropFilename($dentry, $len); @@ -460,14 +460,14 @@ if (is_dir($fname)) { wtCropFilenamesRec($fname, $len); - if (rename($fname, $nname) === false) + if (rename($fname, $nname) === FALSE) { echo "ERROR: Could not rename DIR '".$fname."' -> '".$nname."'.\n"; return FALSE; } } else - if (is_file($fname) && rename($fname, $nname) === false) + if (is_file($fname) && rename($fname, $nname) === FALSE) { echo "ERROR: Could not rename FILE '".$fname."' -> '".$nname."'.\n"; return FALSE; @@ -483,7 +483,7 @@ global $setEntryPath; // Get latest file for the entry - if (($efile = stFetchSQL("SELECT * FROM files WHERE deleted=0 AND id=".$entry["file_id"])) === false) + if (($efile = stFetchSQL("SELECT * FROM files WHERE deleted=0 AND id=".$entry["file_id"])) === FALSE) { echo "INFO: No entry file for ".wtNiceName($compo, $entry, $efile)."\n"; return FALSE; @@ -501,7 +501,7 @@ // Get file data $edata = stProbeFileInfo($filename, TRUE); - if ($edata === false) + if ($edata === FALSE) { echo "ERROR: Invalid/unsupported file type for entry ".wtNiceName($compo, $entry, $efile)."\n"; @@ -537,7 +537,7 @@ $sbinfoStr = implode("\n", $sbinfo); // Create the destination directory - if (wtMakeDir(stMakePath(FALSE, FALSE, array($pathPrefix, $compo["cpath"])), 0755) === false) + if (wtMakeDir(stMakePath(FALSE, FALSE, array($pathPrefix, $compo["cpath"])), 0755) === FALSE) return FALSE; // Form the destination path and/or filename @@ -552,7 +552,7 @@ if ($copyOnly) { $dstFilename = stMakePath(FALSE, FALSE, array($pathPrefix, $compo["cpath"], $dstFileBase)); - if (copy($filename, $dstFilename) === false) + if (copy($filename, $dstFilename) === FALSE) { echo "ERROR: Failed to copy '".$filename."' to '".$dstFilename."'\n"; return FALSE; @@ -562,22 +562,22 @@ if ($edata["class"] == EFILE_ARCHIVE) { // Entry is an archive file, so unpack it - if (wtUnpackArchiveTo($edata["id"], $filename, $dstPath) === false) + if (wtUnpackArchiveTo($edata["id"], $filename, $dstPath) === FALSE) return FALSE; // Crop the filenames from the unpacked archive, if we need to - if ($cropNames !== false) + if ($cropNames !== FALSE) wtCropFilenamesRec($dstPath, $cropNames); } else { // We have a single file (or copyOnly mode) - if (wtMakeDir($dstPath, 0755) === false) + if (wtMakeDir($dstPath, 0755) === FALSE) return FALSE; $dstFilename = stMakePath(FALSE, FALSE, array($dstPath, wtCropFilename($efile["origname"], $cropNames))); - if (copy($filename, $dstFilename) === false) + if (copy($filename, $dstFilename) === FALSE) { echo "ERROR: Failed to copy '".$filename."' to '".$dstFilename."'\n"; return FALSE; @@ -606,7 +606,7 @@ $entry["id"], $entry["name"], $entry["author"], - ($efile !== false) ? " [".$efile["filename"]." / TYPE: '".$efile["filetype"]."']" : ""); + ($efile !== FALSE) ? " [".$efile["filename"]." / TYPE: '".$efile["filetype"]."']" : ""); } @@ -629,14 +629,14 @@ function wtExecOrDie($exe, $args) { - if (wtExec($exe, $args) === false) + if (wtExec($exe, $args) === FALSE) die(); } function wtPurgeDir($path) { - if ($path != "" && $path !== false && file_exists($path) && is_dir($path)) + if ($path != "" && $path !== FALSE && file_exists($path) && is_dir($path)) { // echo "PURGING: ".$path."\n"; foreach (scandir($path) as $file) @@ -658,7 +658,7 @@ if (!file_exists($path)) { echo "INFO: Creating ".$path."\n"; - if (mkdir($path, $perm, TRUE) === false) + if (mkdir($path, $perm, TRUE) === FALSE) die("Could not create directory '".$path."'\n"); } } @@ -784,7 +784,7 @@ // Try to connect to database $spec = stGetSetting("sqlDB"); -if (($db = stConnectSQLDBSpec($spec)) === false) +if (($db = stConnectSQLDBSpec($spec)) === FALSE) die("Could not connect to SQL database '".$spec."'.\n"); echo "Using database spec '".$spec."'.\n"; @@ -832,7 +832,7 @@ if ($argc < 2) die("No filename specified.\n"); - if (($finfo = finfo_open()) === false) + if (($finfo = finfo_open()) === FALSE) die("Internal error. Failed to initialize finfo()."); for ($i = 2; $i < $argc; $i++) @@ -848,7 +848,7 @@ "Probed : ".$sdata."\n". "Mime : ".$smime."\n"; - if (($info = stProbeFileInfo($filename, TRUE)) !== false) + if (($info = stProbeFileInfo($filename, TRUE)) !== FALSE) { $tmp = array(); foreach ($info as $ikey => $ival) diff -r 1fe7df7c77fb -r 0a2117349f46 managedb.php --- a/managedb.php Tue May 14 14:12:42 2019 +0300 +++ b/managedb.php Tue May 14 14:45:36 2019 +0300 @@ -95,7 +95,7 @@ foreach ($settings as $key => $data) { - $sql = false; + $sql = FALSE; // Get setting type switch ($data[0]) @@ -130,7 +130,7 @@ } } - if ($sql === false) + if ($sql === FALSE) { // Normal insertion of default data $sql = stDBPrepareSQL($outDB, $sqlFmt, @@ -165,7 +165,7 @@ "INSERT INTO ".$groupTable." (name,description) VALUES (%s,%s)", $groupData[$groupID][0], $groupData[$groupID][1]); - if (($gid = stDBExecSQLInsert($outDB, $sql)) === false) + if (($gid = stDBExecSQLInsert($outDB, $sql)) === FALSE) { echo "\nFailed to add group '".$groupID."'\n"; return FALSE; @@ -173,7 +173,7 @@ // Add settings to the group stDBBeginTransaction($outDB); - if (stDoAddSettings($inDB, $outDB, $settings, $table, $upgrade, $gid) === false) + if (stDoAddSettings($inDB, $outDB, $settings, $table, $upgrade, $gid) === FALSE) { echo "\nFailed to add settings to group '".$groupID."'\n"; return FALSE; @@ -219,9 +219,9 @@ $data[$n]); $sql = call_user_func_array('stDBPrepareSQL', $arr); - if (stDBExecSQL($outDB, $sql) === false) + if (stDBExecSQL($outDB, $sql) === FALSE) { - $status = false; + $status = FALSE; break; } } @@ -299,7 +299,7 @@ } $sql = "INSERT INTO ".$table." (".implode(",", $acols).") VALUES (".implode(",", $avals).")"; - if (stDBExecSQL($outDB, $sql) === false) + if (stDBExecSQL($outDB, $sql) === FALSE) { $status = FALSE; break; @@ -314,8 +314,8 @@ // For PostgreSQL we need to update sequences foreach ($sequences as $seq) { - if (($max_id = stDBFetchSQLColumn($outDB, "SELECT MAX(".$seq.") FROM ".$table)) !== false && - ($seq_id = stDBFetchSQLColumn($outDB, "SELECT nextval('".$table."_".$seq."_seq')")) !== false && + if (($max_id = stDBFetchSQLColumn($outDB, "SELECT MAX(".$seq.") FROM ".$table)) !== FALSE && + ($seq_id = stDBFetchSQLColumn($outDB, "SELECT nextval('".$table."_".$seq."_seq')")) !== FALSE && ($seq_id <= $max_id)) { echo "SEQFIX"; @@ -418,10 +418,10 @@ case "new": // Try to connect to database - if (($inSpec = stCArg(2)) === false) + if (($inSpec = stCArg(2)) === FALSE) die("No PDO database spec specified.\n"); - if (($inDB = stConnectSQLDBSpec($inSpec)) === false) + if (($inDB = stConnectSQLDBSpec($inSpec)) === FALSE) die("Could not connect to SQL database '".$inSpec."'.\n"); echo "Using database spec '".$inSpec."'.\n"; @@ -459,7 +459,7 @@ echo "Using INPUT database spec '".$inSpec."'.\n"; - if (($inDB = stConnectSQLDBSpec($inSpec)) === false) + if (($inDB = stConnectSQLDBSpec($inSpec)) === FALSE) die("Could not connect to SQL database '".$inSpec."'.\n"); // Check the current version first ... @@ -473,7 +473,7 @@ else { // Okay, we shall create an upgraded version .. - if (($outDB = stConnectSQLDBSpec($outSpec)) === false) + if (($outDB = stConnectSQLDBSpec($outSpec)) === FALSE) die("Could not connect to SQL database '".$outSpec."'.\n"); echo "Database at version ".$currVersion.", upgrading to ".$dbVersion."\n"; diff -r 1fe7df7c77fb -r 0a2117349f46 msite.inc.php --- a/msite.inc.php Tue May 14 14:12:42 2019 +0300 +++ b/msite.inc.php Tue May 14 14:45:36 2019 +0300 @@ -387,7 +387,7 @@ if (isset($displayVars[$name])) { $displayVars[$name] = $value; - $displayVarsChanged[$name] = true; + $displayVarsChanged[$name] = TRUE; } else die("No display var for '".$name."'.\n"); @@ -658,14 +658,14 @@ else if (strlen($email) > 0) { - if ($id !== false) + if ($id !== FALSE) // By another ID, if we are updating an entry $sql = stPrepareSQL("SELECT * FROM attendees WHERE id<>%d AND email=%s", $id, $email); else // Or just exists, if adding $sql = stPrepareSQL("SELECT * FROM attendees WHERE email=%s", $email); - if (($data = stFetchSQL($sql)) !== false) + if (($data = stFetchSQL($sql)) !== FALSE) { stError("Someone with the same e-mail address is already registered."); $res = FALSE; @@ -675,14 +675,14 @@ // Check if another user already exists if ($chk >= 2) { - if ($id !== false) + if ($id !== FALSE) // By another ID, if we are updating an entry $sql = stPrepareSQL("SELECT * FROM attendees WHERE id<>%d AND name=%s AND groups=%s", $id, $name, $groups); else // Or just exists, if adding $sql = stPrepareSQL("SELECT * FROM attendees WHERE name=%s AND groups=%s", $name, $groups); - if (($data = stFetchSQL($sql)) !== false) + if (($data = stFetchSQL($sql)) !== FALSE) { stError("Someone with the same name and groups is already registered."); $res = FALSE; @@ -770,7 +770,7 @@ $userKeyMode = stGetSetting("userKeyMode"); $out = array(); $sql = "SELECT * FROM compos ".(($flags & RFLAG_HIDDEN_COMPOS) ? "" : "WHERE visible<>0 ")."ORDER BY name DESC"; - if (($res = stExecSQL($sql)) === false) + if (($res = stExecSQL($sql)) === FALSE) return $out; // For each compo that has been set visible @@ -971,7 +971,7 @@ { global $fileTypeData; - if ($compo === false || $entry === false) + if ($compo === FALSE || $entry === FALSE) return FALSE; $previewPath = stGetSetting("previewPath"); @@ -984,7 +984,7 @@ ); if ($entry["preview_id"] != 0 && - ($efile = stFetchSQL("SELECT * FROM files WHERE deleted=0 AND id=".$entry["preview_id"])) !== false) + ($efile = stFetchSQL("SELECT * FROM files WHERE deleted=0 AND id=".$entry["preview_id"])) !== FALSE) { $pdata["file"] = $efile; if (isset($fileTypeData[$efile["filetype"]]["type"])) @@ -992,7 +992,7 @@ } else if ($entry["file_id"] == 0) - $pdata["valid"] = $efile = false; + $pdata["valid"] = $efile = FALSE; switch ($pdata["type"]) { @@ -1090,7 +1090,7 @@ global $fileTypeData; // Get file magic info - if (($finfo = finfo_open()) === false) + if (($finfo = finfo_open()) === FALSE) { stLogError("Internal error. Failed to initialize finfo()."); return stError("Internal error, failed to probe file."); @@ -1144,7 +1144,7 @@ "VALUES (%s,%s,%d,%d,%d,%s,%d)", $origName, $fileType, $fileSize, $entry["id"], $uploaderID, $type, time()); - if (($fileID = stExecSQLInsert($sql)) === false) + if (($fileID = stExecSQLInsert($sql)) === FALSE) return stFileError($uploaderID, "Failed to add new ".$type." file for entry #".$entry["id"]." '".$origName."'.", "Internal error. Failed to add new file."); @@ -1160,20 +1160,20 @@ // Update entry with generated filename $sql = stPrepareSQL("UPDATE files SET filename=%s WHERE id=%d", $fileName, $fileID); - if (stExecSQL($sql) === false) + if (stExecSQL($sql) === FALSE) return stFileError($uploaderID, "Failed to update newly created files entry #".$fileID." with generated filename '".$fileName."'!", "Internal error. Failed to add new file."); // Update entry's reference $sql = stPrepareSQL("UPDATE entries SET ".$field."=%d WHERE id=%d", $fileID, $entry["id"]); - if (stExecSQL($sql) === false) + if (stExecSQL($sql) === FALSE) return stFileError($uploaderID, "Failed to update entry #".$entry["id"]." ".$type." ID!", "Internal error. Failed to add new file."); // Return file entry - if (($res = stFetchSQL("SELECT * FROM files WHERE id=".$fileID)) === false) + if (($res = stFetchSQL("SELECT * FROM files WHERE id=".$fileID)) === FALSE) return stFileError($uploaderID, "Failed to fetch newly generated files entry #".$fileID, "Internal error. Failed to add new file."); @@ -1199,12 +1199,12 @@ return FALSE; // Check entry existence - if (($entry = stFetchSQL("SELECT * FROM entries WHERE id=".$entryID)) === false) + if (($entry = stFetchSQL("SELECT * FROM entries WHERE id=".$entryID)) === FALSE) return stFileError($userID, "Entry ID #".$entryID." does not exist in the entries table?", "Entry does not exist??"); - if (($compo = stFetchSQL("SELECT * FROM compos WHERE id=".$entry["compo_id"])) === false) + if (($compo = stFetchSQL("SELECT * FROM compos WHERE id=".$entry["compo_id"])) === FALSE) return stFileError($userID, "Compo ID #".$entry["compo_id"]." in entry ID #".$entryID." does not exist!", "Compo does not exist??"); @@ -1232,7 +1232,7 @@ if ($userID != 0) { // Check if the user even exists, just in case - if (($user = stFetchSQL("SELECT * FROM attendees WHERE id=".$userID)) === false) + if (($user = stFetchSQL("SELECT * FROM attendees WHERE id=".$userID)) === FALSE) return stFileError($userID, "User ID #".$userID." does not exist??", "You do not exist. Go away."); @@ -1292,33 +1292,33 @@ // Check file properties .. - if (($fileInfo = stProbeFileInfo($tmpFilename)) === false) + if (($fileInfo = stProbeFileInfo($tmpFilename)) === FALSE) return FALSE; if ($uploadType == "preview" && !isset($fileInfo["type"])) return stError("Preview file upload is not one of the supported preview file types."); // Get original extension - if (($fileExt = $fileInfo["fext"]) === false) + if (($fileExt = $fileInfo["fext"]) === FALSE) { $fileExt = "bin"; - if (($epos = strrpos($orgFilename, ".")) !== false) + if (($epos = strrpos($orgFilename, ".")) !== FALSE) $fileExt = substr($orgFilename, $epos + 1); } // Update current or add new file entry - if (($fentry = stAddFileEntry($entry, $uploadType, $orgFilename, $fileSize, $fileExt, $fileInfo["id"], $userID)) === false) + if (($fentry = stAddFileEntry($entry, $uploadType, $orgFilename, $fileSize, $fileExt, $fileInfo["id"], $userID)) === FALSE) return FALSE; // Set permissions before moving the file - if (chmod($tmpFilename, stGetSetting($uploadType."PathPerms")) === false) + if (chmod($tmpFilename, stGetSetting($uploadType."PathPerms")) === FALSE) return stFileError($userID, "Could not set permissions for uploaded file '".$tmpFilename."'.", "Internal error. Could not set permissions for uploaded file. Contact site admins."); // Move file to its destination $dstFilename = stMakePath(FALSE, TRUE, array(stGetSetting("entryPath"), $compo["cpath"], $fentry["filename"])); - if (@move_uploaded_file($tmpFilename, $dstFilename) === false) + if (@move_uploaded_file($tmpFilename, $dstFilename) === FALSE) return stFileError($userID, "Could not move uploaded file '".$tmpFilename."' to '".$dstFilename."'.", "Internal error. Deploying uploaded file failed! Contact site admins."); diff -r 1fe7df7c77fb -r 0a2117349f46 msitegen.inc.php --- a/msitegen.inc.php Tue May 14 14:12:42 2019 +0300 +++ b/msitegen.inc.php Tue May 14 14:45:36 2019 +0300 @@ -112,7 +112,7 @@ switch ($item["vtype"]) { case VT_INT: return intval($item["vint"]); - case VT_BOOL: return intval($item["vint"]) ? true : false; + case VT_BOOL: return intval($item["vint"]) ? TRUE : FALSE; case VT_STR: return $item["vstr"]; case VT_TEXT: return $item["vtext"]; } @@ -575,7 +575,7 @@ return FALSE; } $db = stConnectSQLDBSpec(stGetSetting("sqlDB")); - return ($db !== false); + return ($db !== FALSE); } @@ -658,13 +658,13 @@ switch ($dbh->getAttribute(PDO::ATTR_DRIVER_NAME)) { case "pgsql": - if (($res = stDBFetchSQLColumn($dbh, $sql." RETURNING id")) !== false) + if (($res = stDBFetchSQLColumn($dbh, $sql." RETURNING id")) !== FALSE) return $res; else return FALSE; default: - if (stDBExecSQL($dbh, $sql) !== false) + if (stDBExecSQL($dbh, $sql) !== FALSE) return $dbh->lastInsertId(); else return FALSE; @@ -969,7 +969,7 @@ echo "// No CSRF?\n"; ?> var req = jsCreateXMLRequest(); - req.open("POST", "", true); + req.open("POST", "", TRUE); req.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); req.setRequestHeader("Content-length", params.length); req.setRequestHeader("Connection", "close"); diff -r 1fe7df7c77fb -r 0a2117349f46 showajax.php --- a/showajax.php Tue May 14 14:12:42 2019 +0300 +++ b/showajax.php Tue May 14 14:45:36 2019 +0300 @@ -8,12 +8,12 @@ require_once "msite.inc.php"; -function stPrintCompoEntry($entry, $class, $compo, $title = false) +function stPrintCompoEntry($entry, $class, $compo, $title = FALSE) { echo "
\n"; - if ($title !== false) + if ($title !== FALSE) echo "
".$title."
\n"; @@ -23,12 +23,12 @@ if ($compo["show_authors"]) { - if ($title === false) + if ($title === FALSE) echo "
by
\n"; echo "
".chentities($entry["author"])."
\n"; } - if ($title === false) + if ($title === FALSE) echo "
".stConvertCommonDesc($entry["info"], TRUE)."
\n"; echo @@ -44,13 +44,13 @@ "
".chentities($compo["name"])." competition
\n". "
\n"; - if ($entry === false && $prev === false) + if ($entry === FALSE && $prev === FALSE) echo "
... Is about to start ...
"; - if ($entry !== false) - stPrintCompoEntry($entry, "compoNext", $compo, false); + if ($entry !== FALSE) + stPrintCompoEntry($entry, "compoNext", $compo, FALSE); - if ($prev !== false) + if ($prev !== FALSE) stPrintCompoEntry($prev, "compoPrev", $compo, "Previous entry"); } @@ -101,7 +101,7 @@ $sql = stPrepareSQL("SELECT * FROM display_slides WHERE id=%d", stGetDisplayVar("tempSlide")); - if (($res = stFetchSQL($sql)) !== false) + if (($res = stFetchSQL($sql)) !== FALSE) { stSetDisplayVar("tempSlideSet", FALSE); stSetDisplayVar("activeSlideMode", SMODE_ROTATE); @@ -136,7 +136,7 @@ "SELECT * FROM rot_list_slides WHERE list_id=%d ORDER BY order_num,id", $list); - if (($slideList = stExecSQL($sql)) !== false) + if (($slideList = stExecSQL($sql)) !== FALSE) { // Get slide at current index $slides = array(); @@ -226,7 +226,7 @@ $sql = stPrepareSQL("SELECT * FROM display_slides WHERE id=%d", stGetDisplayVar("activeSlide")); - if (($slide = stFetchSQL($sql)) !== false) + if (($slide = stFetchSQL($sql)) !== FALSE) stPrintRotationSlide($slide["text"]); } else @@ -240,7 +240,7 @@ "SELECT * FROM compos WHERE id=%d", $compo_id)); - if ($compo !== false) + if ($compo !== FALSE) { $prev = stFetchSQL(stPrepareSQL( "SELECT * FROM entries WHERE compo_id=%d AND show_id=%d AND show_id<>0", diff -r 1fe7df7c77fb -r 0a2117349f46 usrajax.php --- a/usrajax.php Tue May 14 14:12:42 2019 +0300 +++ b/usrajax.php Tue May 14 14:45:36 2019 +0300 @@ -18,7 +18,7 @@ $sql = stPrepareSQL("SELECT id FROM votes WHERE key_id=%d AND entry_id=%d", $key_id, $entry_id); - if (($res = stFetchSQLColumn($sql)) === false) + if (($res = stFetchSQLColumn($sql)) === FALSE) { // Didn't exist, insert it $sql = stPrepareSQL( @@ -85,7 +85,7 @@ // Check vote key validity // $sql = stPrepareSQL("SELECT * FROM userkeys WHERE id=%d", $userKeyId); -if (($key = stFetchSQL($sql)) === false) +if (($key = stFetchSQL($sql)) === FALSE) { stError("Userkey does not exist."); } @@ -101,7 +101,7 @@ case VOTE_ASSIGN: $sql = stPrepareSQL("SELECT id FROM attendees WHERE key_id=%d", $key["id"]); - if (stFetchSQL($sql) === false) + if (stFetchSQL($sql) === FALSE) stError("Userkey is not assigned to any user."); break; } @@ -127,11 +127,11 @@ // Check if the entry_id is actually valid stDBBeginTransaction(); $sql = stPrepareSQL("SELECT * FROM entries WHERE id=%d", $entry_id); - if (($entry = stFetchSQL($sql)) !== false) + if (($entry = stFetchSQL($sql)) !== FALSE) { // Check if the compo is valid for the entry $sql = stPrepareSQL("SELECT * FROM compos WHERE id=%d", $entry["compo_id"]); - if (($compo = stFetchSQL($sql)) !== false && $compo["voting"] != 0) + if (($compo = stFetchSQL($sql)) !== FALSE && $compo["voting"] != 0) stUpdateVote($userKeyId, $entry_id, $vote); } stDBCommitTransaction(); diff -r 1fe7df7c77fb -r 0a2117349f46 usrlogin.php --- a/usrlogin.php Tue May 14 14:12:42 2019 +0300 +++ b/usrlogin.php Tue May 14 14:45:36 2019 +0300 @@ -32,7 +32,7 @@ $error = 0; $sql = stPrepareSQL("SELECT * FROM userkeys WHERE key=%s", $password); -if (($key = stFetchSQL($sql)) !== false) +if (($key = stFetchSQL($sql)) !== FALSE) { // // Validate login based on current user key mode @@ -46,7 +46,7 @@ case VOTE_ASSIGN: $sql = stPrepareSQL("SELECT id FROM attendees WHERE key_id=%d", $key["id"]); - if (stFetchSQL($sql) === false) + if (stFetchSQL($sql) === FALSE) $error = 3; break; }