Mercurial > hg > fapweb
comparison msite.inc.php @ 1120:b2bca5f6d0ff default tip
Cosmetic cleanup: remove trailing whitespace.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 13 Dec 2020 13:47:13 +0200 |
parents | 29206517d32e |
children |
comparison
equal
deleted
inserted
replaced
1119:a4daa7ea7479 | 1120:b2bca5f6d0ff |
---|---|
417 "</td>"; | 417 "</td>"; |
418 } | 418 } |
419 else | 419 else |
420 echo "<td></td>"; | 420 echo "<td></td>"; |
421 } | 421 } |
422 | 422 |
423 if ($tr) | 423 if ($tr) |
424 echo "</tr>\n"; | 424 echo "</tr>\n"; |
425 } | 425 } |
426 | 426 |
427 | 427 |
534 if (($tmp = stGetSetting("userKeyChars", NULL)) !== NULL) | 534 if (($tmp = stGetSetting("userKeyChars", NULL)) !== NULL) |
535 $keyChars = $tmp; | 535 $keyChars = $tmp; |
536 | 536 |
537 if (($tmp = stGetSetting("userKeyCase", NULL)) !== NULL) | 537 if (($tmp = stGetSetting("userKeyCase", NULL)) !== NULL) |
538 $keyChars = strtoupper($keyChars); | 538 $keyChars = strtoupper($keyChars); |
539 | 539 |
540 while (TRUE) | 540 while (TRUE) |
541 { | 541 { |
542 // Generate one randomized keycode | 542 // Generate one randomized keycode |
543 $key = ""; | 543 $key = ""; |
544 for ($n = 0; $n < stGetSetting("userKeyLength"); $n++) | 544 for ($n = 0; $n < stGetSetting("userKeyLength"); $n++) |
704 "AS votesum ". | 704 "AS votesum ". |
705 "FROM entries"; | 705 "FROM entries"; |
706 break; | 706 break; |
707 } | 707 } |
708 | 708 |
709 $extra = | 709 $extra = |
710 "GROUP BY entries.id ". | 710 "GROUP BY entries.id ". |
711 "ORDER BY votesum DESC"; | 711 "ORDER BY votesum DESC"; |
712 break; | 712 break; |
713 | 713 |
714 case COMPO_POINTS: | 714 case COMPO_POINTS: |
773 | 773 |
774 $prev = $entry["votesum"]; | 774 $prev = $entry["votesum"]; |
775 } | 775 } |
776 } | 776 } |
777 } | 777 } |
778 | 778 |
779 return $out; | 779 return $out; |
780 } | 780 } |
781 | 781 |
782 | 782 |
783 function stGetCompoResultLine($html, $entry, $points, $showAuthor) | 783 function stGetCompoResultLine($html, $entry, $points, $showAuthor) |
974 $pdata["files"]["thumb"] = stGetEntryPreviewFile( | 974 $pdata["files"]["thumb"] = stGetEntryPreviewFile( |
975 $entry, $compo, $previewPath, $previewURL, | 975 $entry, $compo, $previewPath, $previewURL, |
976 stGetSetting("previewThumbType"), | 976 stGetSetting("previewThumbType"), |
977 stGetSetting("thumbnailSubDir")); | 977 stGetSetting("thumbnailSubDir")); |
978 break; | 978 break; |
979 | 979 |
980 case EFILE_AUDIO: | 980 case EFILE_AUDIO: |
981 foreach (stGetSetting("sampleTypes") as $type => $fdata) | 981 foreach (stGetSetting("sampleTypes") as $type => $fdata) |
982 { | 982 { |
983 $pdata["files"][$type] = stGetEntryPreviewFile( | 983 $pdata["files"][$type] = stGetEntryPreviewFile( |
984 $entry, $compo, $previewPath, $previewURL, | 984 $entry, $compo, $previewPath, $previewURL, |
1183 $dstPath = stMakePath(FALSE, FALSE, array(stGetSetting("entryPath"), $compo["cpath"])); | 1183 $dstPath = stMakePath(FALSE, FALSE, array(stGetSetting("entryPath"), $compo["cpath"])); |
1184 if (!file_exists($dstPath)) | 1184 if (!file_exists($dstPath)) |
1185 return stFileError($userID, | 1185 return stFileError($userID, |
1186 "Path '".$dstPath."' for compo ID #".$entry["compo_id"]." does not exist.", | 1186 "Path '".$dstPath."' for compo ID #".$entry["compo_id"]." does not exist.", |
1187 "The directory for entry's compo does not exist!"); | 1187 "The directory for entry's compo does not exist!"); |
1188 | 1188 |
1189 $dstPerms = fileperms($dstPath); | 1189 $dstPerms = fileperms($dstPath); |
1190 if (($dstPerms & 0x4000) === 0) | 1190 if (($dstPerms & 0x4000) === 0) |
1191 return stFileError($userID, | 1191 return stFileError($userID, |
1192 "Path for entry's compo '".$dstPath."' is not a directory.", | 1192 "Path for entry's compo '".$dstPath."' is not a directory.", |
1193 "Path for entry's compo is not a directory?"); | 1193 "Path for entry's compo is not a directory?"); |
1194 | 1194 |
1195 $needPerms = 0x0100 | 0x0080 | 0x0040; | 1195 $needPerms = 0x0100 | 0x0080 | 0x0040; |
1196 if (($dstPerms & $needPerms) !== $needPerms) | 1196 if (($dstPerms & $needPerms) !== $needPerms) |
1197 return stFileError($userID, | 1197 return stFileError($userID, |
1198 "Path for entry's compo '".$dstPath."' does not have sufficient permissions.", | 1198 "Path for entry's compo '".$dstPath."' does not have sufficient permissions.", |
1199 "Path for entry's compo has no sufficient permissions."); | 1199 "Path for entry's compo has no sufficient permissions."); |
1265 if (($fileInfo = stProbeFileInfo($tmpFilename)) === FALSE) | 1265 if (($fileInfo = stProbeFileInfo($tmpFilename)) === FALSE) |
1266 return FALSE; | 1266 return FALSE; |
1267 | 1267 |
1268 if ($uploadType == "preview" && !isset($fileInfo["type"])) | 1268 if ($uploadType == "preview" && !isset($fileInfo["type"])) |
1269 return stError("Preview file upload is not one of the supported preview file types."); | 1269 return stError("Preview file upload is not one of the supported preview file types."); |
1270 | 1270 |
1271 // Get original extension | 1271 // Get original extension |
1272 if (($fileExt = $fileInfo["fext"]) === FALSE) | 1272 if (($fileExt = $fileInfo["fext"]) === FALSE) |
1273 { | 1273 { |
1274 $fileExt = "bin"; | 1274 $fileExt = "bin"; |
1275 if (($epos = strrpos($orgFilename, ".")) !== FALSE) | 1275 if (($epos = strrpos($orgFilename, ".")) !== FALSE) |
1309 case COMPO_NORMAL: | 1309 case COMPO_NORMAL: |
1310 $sql = stPrepareSQL( | 1310 $sql = stPrepareSQL( |
1311 "INSERT INTO entries (name,author,compo_id,info,notes,preview_type,utime,owner_id) VALUES (%S,%S,%d,%Q,%Q,%D,%d,%d)", | 1311 "INSERT INTO entries (name,author,compo_id,info,notes,preview_type,utime,owner_id) VALUES (%S,%S,%d,%Q,%Q,%D,%d,%d)", |
1312 "name", "author", $compo["id"], "info", "notes", "preview_type", time(), $uid); | 1312 "name", "author", $compo["id"], "info", "notes", "preview_type", time(), $uid); |
1313 break; | 1313 break; |
1314 | 1314 |
1315 case COMPO_POINTS: | 1315 case COMPO_POINTS: |
1316 case COMPO_ASSIGN: | 1316 case COMPO_ASSIGN: |
1317 $sql = stPrepareSQL( | 1317 $sql = stPrepareSQL( |
1318 "INSERT INTO entries (name,compo_id,notes,evalue,utime,owner_id) VALUES (%S,%d,%Q,%D,%d,%d)", | 1318 "INSERT INTO entries (name,compo_id,notes,evalue,utime,owner_id) VALUES (%S,%d,%Q,%D,%d,%d)", |
1319 "name", $compo["id"], "notes", "evalue", time(), $uid); | 1319 "name", $compo["id"], "notes", "evalue", time(), $uid); |
1331 stExecSQLCond($sql, "OK, entry ".$id." deleted."); | 1331 stExecSQLCond($sql, "OK, entry ".$id." deleted."); |
1332 | 1332 |
1333 // Delete votes for the entry | 1333 // Delete votes for the entry |
1334 $sql = stPrepareSQL("DELETE FROM votes WHERE entry_id=%d", $id); | 1334 $sql = stPrepareSQL("DELETE FROM votes WHERE entry_id=%d", $id); |
1335 stExecSQLCond($sql, "OK, entry ".$id." votes deleted."); | 1335 stExecSQLCond($sql, "OK, entry ".$id." votes deleted."); |
1336 | 1336 |
1337 // Mark related files to be deleted | 1337 // Mark related files to be deleted |
1338 $sql = stPrepareSQL("UPDATE files SET deleted=%d WHERE entry_id=%d", 1, $id); | 1338 $sql = stPrepareSQL("UPDATE files SET deleted=%d WHERE entry_id=%d", 1, $id); |
1339 stExecSQLCond($sql, "OK, entry ".$id." files marked."); | 1339 stExecSQLCond($sql, "OK, entry ".$id." files marked."); |
1340 } | 1340 } |
1341 | 1341 |