diff --git a/contrib/favorites/theme.php b/contrib/favorites/theme.php
index 4bb452ae..14a4fd39 100644
--- a/contrib/favorites/theme.php
+++ b/contrib/favorites/theme.php
@@ -24,6 +24,8 @@ class FavoritesTheme extends Themelet {
$i_favorites = count($username_array);
$html = "$i_favorites people:";
+ reset($username_array); // rewind to first element in array.
+
foreach($username_array as $row) {
$username = html_escape($row);
$html .= "
$username";
diff --git a/contrib/log_db/theme.php b/contrib/log_db/theme.php
index 6ac2d3a1..1d3d8ccf 100644
--- a/contrib/log_db/theme.php
+++ b/contrib/log_db/theme.php
@@ -41,6 +41,8 @@ class LogDatabaseTheme extends Themelet {
\n";
$n = 0;
+ reset($events); // rewind to first element in array.
+
foreach($events as $event) {
$oe = ($n++ % 2 == 0) ? "even" : "odd";
$c = $this->pri_to_col($event['priority']);
diff --git a/contrib/rating/main.php b/contrib/rating/main.php
index b246b14e..ba1546ab 100644
--- a/contrib/rating/main.php
+++ b/contrib/rating/main.php
@@ -40,6 +40,9 @@ class Ratings implements Extension {
while(true) {
$images = Image::find_images($n, 100, Tag::explode($_POST["query"]));
if(count($images) == 0) break;
+
+ reset($images); // rewind to first element in array.
+
foreach($images as $image) {
send_event(new RatingSetEvent($image, $user, $_POST['rating']));
}
diff --git a/core/config.class.php b/core/config.class.php
index 2f918173..92c27b23 100644
--- a/core/config.class.php
+++ b/core/config.class.php
@@ -188,6 +188,7 @@ class DatabaseConfig extends BaseConfig {
*/
public function save($name=null) {
if(is_null($name)) {
+ reset($this->values); // rewind the array to the first element
foreach($this->values as $name => $value) {
$this->save($name);
}
diff --git a/core/imageboard.pack.php b/core/imageboard.pack.php
index 1be135fa..d215337e 100644
--- a/core/imageboard.pack.php
+++ b/core/imageboard.pack.php
@@ -770,6 +770,8 @@ class Image {
}
}
+ reset($terms); // rewind to first element in array.
+
// turn each term into a specific type of querylet
foreach($terms as $term) {
$negative = false;
@@ -1002,8 +1004,15 @@ class Tag {
}
}
+ /**
+ * This function takes a list (array) of tags and changes any tags that have aliases
+ *
+ * @param $tags Array of tags
+ * @return Array of tags
+ */
public static function resolve_list($tags) {
$tags = Tag::explode($tags);
+ reset($tags); // rewind array to the first element.
$new = array();
foreach($tags as $tag) {
$new_set = explode(' ', Tag::resolve_alias($tag));
diff --git a/core/page.class.php b/core/page.class.php
index 2995814c..411c9053 100644
--- a/core/page.class.php
+++ b/core/page.class.php
@@ -291,7 +291,7 @@ class Page {
// store local copy for speed.
$autocache_css = $config->get_bool("autocache_css");
- $autocache_js = config->get_bool("autocache_js");
+ $autocache_js = $config->get_bool("autocache_js");
if (!$autocache_css && !$autocache_js) {
return false; // caching disabled
@@ -396,7 +396,7 @@ class Page {
// Minify the JS if enabled.
if ($config->get_bool("autocache_min_js")){
// not supported yet.
- // TODO: add support for Minifying CSS files.
+ // TODO: add support for Minifying JS files.
}
// compute the MD5 sum of the concatenated JavaScript files
diff --git a/ext/upload/main.php b/ext/upload/main.php
index 8d2281fa..2aee068f 100644
--- a/ext/upload/main.php
+++ b/ext/upload/main.php
@@ -152,12 +152,14 @@ class Upload extends SimpleExtension {
$tags = ''; // Tags aren't changed when uploading. Set to null to stop PHP warnings.
if(count($_FILES)) {
+ reset($_FILES); // rewind to first element in array.
foreach($_FILES as $file) {
$ok = $this->try_upload($file, $tags, $source, $image_id);
break; // leave the foreach loop.
}
}
else {
+ reset($_POST); // rewind to first element in array.
foreach($_POST as $name => $value) {
if(substr($name, 0, 3) == "url" && strlen($value) > 0) {
$ok = $this->try_transload($value, $tags, $source, $image_id);
@@ -188,9 +190,11 @@ class Upload extends SimpleExtension {
$source = isset($_POST['source']) ? $_POST['source'] : null;
$ok = true;
foreach($_FILES as $file) {
+ reset($_FILES); // rewind to first element in array.
$ok = $ok & $this->try_upload($file, $tags, $source);
}
foreach($_POST as $name => $value) {
+ reset($_POST); // rewind to first element in array.
if(substr($name, 0, 3) == "url" && strlen($value) > 0) {
$ok = $ok & $this->try_transload($value, $tags, $source);
}