diff --git a/classes/class_cache.php b/classes/class_cache.php
index 88952b12..d3bc5a21 100644
--- a/classes/class_cache.php
+++ b/classes/class_cache.php
@@ -37,7 +37,8 @@ class CACHE extends Memcache {
private $PersistentKeys = array(
'stats_*',
'percentiles_*',
- 'top10tor_*'
+ 'top10tor_*',
+ 'query_lock_*'
);
public $CanClear = false;
diff --git a/classes/class_torrent.php b/classes/class_torrent.php
index 966486b2..407c3d5c 100644
--- a/classes/class_torrent.php
+++ b/classes/class_torrent.php
@@ -251,29 +251,42 @@ function set_announce_url($Announce) {
// * the total size of files described therein
function file_list() {
$FileList = array();
- if(!$this->Val['info']->Val['files']) { // Single file mode
+ if (!isset($this->Val['info']->Val['files'])) { // Single file mode
$TotalSize = $this->Val['info']->Val['length'];
- $FileList[]= array($this->Val['info']->Val['length'], $this->Val['info']->Val['name']);
+ $FileList[] = array($TotalSize, $this->get_name());
} else { // Multiple file mode
$FileNames = array();
$FileSizes = array();
$TotalSize = 0;
$Files = $this->Val['info']->Val['files']->Val;
- foreach($Files as $File) {
- $TotalSize += $File->Val['length'];
+ if (isset($Files[0]->Val['path.utf-8'])) {
+ $PathKey = 'path.utf-8';
+ } else {
+ $PathKey = 'path';
+ }
+ foreach ($Files as $File) {
$FileSize = $File->Val['length'];
+ $TotalSize += $FileSize;
- $FileName = ltrim(implode('/',$File->Val['path']->Val), '/');
+ $FileName = ltrim(implode('/',$File->Val[$PathKey]->Val), '/');
$FileSizes[] = $FileSize;
$FileNames[] = $FileName;
}
natcasesort($FileNames);
- foreach($FileNames as $Index => $FileName) {
+ foreach ($FileNames as $Index => $FileName) {
$FileList[] = array($FileSizes[$Index], $FileName);
}
}
return array($TotalSize, $FileList);
}
+
+ function get_name() {
+ if (isset($this->Val['info']->Val['name.utf-8'])) {
+ return $this->Val['info']->Val['name.utf-8'];
+ } else {
+ return $this->Val['info']->Val['name'];
+ }
+ }
function make_private() {
//----- The following properties do not affect the infohash:
diff --git a/classes/class_torrent_32bit.php b/classes/class_torrent_32bit.php
index 2afb118e..643923a5 100644
--- a/classes/class_torrent_32bit.php
+++ b/classes/class_torrent_32bit.php
@@ -248,29 +248,42 @@ function set_announce_url($Announce) {
// * the total size of files described therein
function file_list() {
$FileList = array();
- if(!$this->Val['info']->Val['files']) { // Single file mode
+ if (!isset($this->Val['info']->Val['files'])) { // Single file mode
$TotalSize = substr($this->Val['info']->Val['length'],7);
- $FileList[]= array($TotalSize, $this->Val['info']->Val['name']);
+ $FileList[] = array($TotalSize, $this->get_name());
} else { // Multiple file mode
$FileNames = array();
$FileSizes = array();
$TotalSize = 0;
$Files = $this->Val['info']->Val['files']->Val;
- foreach($Files as $File) {
+ if (isset($Files[0]->Val['path.utf-8'])) {
+ $PathKey = 'path.utf-8';
+ } else {
+ $PathKey = 'path';
+ }
+ foreach ($Files as $File) {
$FileSize = substr($File->Val['length'], 7);
$TotalSize += $FileSize;
- $FileName = ltrim(implode('/',$File->Val['path']->Val), '/');
+ $FileName = ltrim(implode('/',$File->Val[$PathKey]->Val), '/');
$FileSizes[] = $FileSize;
$FileNames[] = $FileName;
}
natcasesort($FileNames);
- foreach($FileNames as $Index => $FileName) {
+ foreach ($FileNames as $Index => $FileName) {
$FileList[] = array($FileSizes[$Index], $FileName);
}
}
return array($TotalSize, $FileList);
}
+
+ function get_name() {
+ if (isset($this->Val['info']->Val['name.utf-8'])) {
+ return $this->Val['info']->Val['name.utf-8'];
+ } else {
+ return $this->Val['info']->Val['name'];
+ }
+ }
function make_private() {
//----- The following properties do not affect the infohash:
diff --git a/classes/class_torrent_form.php b/classes/class_torrent_form.php
index 3e31c46b..905e187e 100644
--- a/classes/class_torrent_form.php
+++ b/classes/class_torrent_form.php
@@ -78,7 +78,7 @@ function head() {
} ?>
if($this->NewTorrent) { ?>
-
+
Torrent file
@@ -94,8 +94,8 @@ function head() {
-
You have entered a year for a release which predates the medium's availibility. You will need to change the year, enter additional edition information or if this information cannot be provided, select the 'Unknown Release' checkbox below
+
You have entered a year for a release which predates the medium's availibility. You will need to change the year, enter additional edition information. If this information cannot be provided, select the "Unknown Release" checkbox below
Disabled?> onblur="CheckYear();" /> This is the year of the original release.
diff --git a/classes/class_wiki.php b/classes/class_wiki.php
index 17525980..301670dc 100644
--- a/classes/class_wiki.php
+++ b/classes/class_wiki.php
@@ -1,6 +1,6 @@
/*########################################################################
-## Wiki class ##
+## Wiki class ##
##########################################################################
Seeing as each page has to manage its wiki separately (for performance
@@ -12,19 +12,19 @@
class_wiki depends on your wiki table being structured like this:
-+------------+---------------+------+-----+---------------------+-------+
-| Field | Type | Null | Key | Default | Extra |
-+------------+---------------+------+-----+---------------------+-------+
-| RevisionID | int(12) | NO | PRI | 0 | |
-| PageID | int(10) | NO | MUL | 0 | |
-| Body | text | YES | | NULL | |
-| UserID | int(10) | NO | MUL | 0 | |
-| Summary | varchar(100) | YES | | NULL | |
-| Time | datetime | NO | MUL | 0000-00-00 00:00:00 | |
-+------------+---------------+------+-----+---------------------+-------+
++------------+--------------+------+-----+----------------------+-------+
+| Field | Type | Null | Key | Default | Extra |
++------------+--------------+------+-----+----------------------+-------+
+| RevisionID | int(12) | NO | PRI | 0 | |
+| PageID | int(10) | NO | MUL | 0 | |
+| Body | text | YES | | NULL | |
+| UserID | int(10) | NO | MUL | 0 | |
+| Summary | varchar(100) | YES | | NULL | |
+| Time | datetime | NO | MUL | 0000-00-00 00:00:00 | |
++------------+--------------+------+-----+----------------------+-------+
It is also recommended that you have a field in the main table for
-whatever the page is (eg. details.php main table = torrents), so you can
+whatever the page is (e.g. details.php main table = torrents), so you can
do a JOIN.
@@ -55,7 +55,7 @@ function revision_history(){
WHERE wiki.PageID = ".$this->PageID."
ORDER BY RevisionID DESC");
//----------------------------------------------- ?>
-
+
Revision
Summary
@@ -83,4 +83,4 @@ function revision_history(){
}
} // class
-?>
\ No newline at end of file
+?>
diff --git a/classes/script_start.php b/classes/script_start.php
index 18d28b52..147b0eeb 100644
--- a/classes/script_start.php
+++ b/classes/script_start.php
@@ -2534,6 +2534,40 @@ function isset_request($Request, $Keys=NULL, $AllowEmpty = False, $Error=0) {
}
}
+/**
+ * Test if there's an active lock with the given name
+ *
+ * @param string $LockName name on the lock
+ * @return true if lock is active
+ */
+function query_locked($LockName) {
+ global $Cache;
+ if ($Cache->get_value('query_lock_'.$LockName) !== false) {
+ return true;
+ }
+ return false;
+}
+
+/**
+ * Add lock. Expiry time is one hour to avoid indefinite locks
+ *
+ * @param string $LockName name on the lock
+ */
+function set_query_lock($LockName) {
+ global $Cache;
+ $Cache->cache_value('query_lock_'.$LockName, 1, 3600);
+}
+
+/**
+ * Remove lock. Expiry time is one hour to avoid indefinite locks
+ *
+ * @param string $LockName name on the lock
+ */
+function clear_query_lock($LockName) {
+ global $Cache;
+ $Cache->delete_value('query_lock_'.$LockName);
+}
+
$Debug->set_flag('ending function definitions');
//Include /sections/*/index.php
$Document = basename(parse_url($_SERVER['SCRIPT_FILENAME'], PHP_URL_PATH), '.php');
diff --git a/ocelot-0.5.1.tar.bz2 b/ocelot-0.5.1.tar.bz2
new file mode 100644
index 00000000..dee4418d
Binary files /dev/null and b/ocelot-0.5.1.tar.bz2 differ
diff --git a/ocelot-0.5.tar.bz2 b/ocelot-0.5.tar.bz2
deleted file mode 100644
index 602afb20..00000000
Binary files a/ocelot-0.5.tar.bz2 and /dev/null differ
diff --git a/sections/comments/index.php b/sections/comments/index.php
index bec0f266..c17c51ed 100644
--- a/sections/comments/index.php
+++ b/sections/comments/index.php
@@ -109,10 +109,10 @@
while(list($UserID, $TorrentID, $GroupID, $Title, $PostID, $Body, $AddedTime, $EditedTime, $EditorID) = $DB->next_record()) {
$UserInfo = user_info($UserID);
?>
-