From e46c22a228bd074a0289cbd207f89d9abd1cfa52 Mon Sep 17 00:00:00 2001 From: Shish Date: Tue, 17 Jan 2012 15:47:58 +0000 Subject: [PATCH] weighted CDN targets --- core/imageboard.pack.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/core/imageboard.pack.php b/core/imageboard.pack.php index 428a4484..70e0d9fb 100644 --- a/core/imageboard.pack.php +++ b/core/imageboard.pack.php @@ -521,7 +521,18 @@ class Image { require_once("lib/flexihash.php"); $_flexihash = new Flexihash(); foreach(explode(",", $opts) as $opt) { - $_flexihash->addTarget($opt); + $parts = explode("=", $opt); + $opt_val = ""; + $opt_weight = 0; + if(count($parts) == 2) { + $opt_val = $parts[0]; + $opt_weight = $parts[1]; + } + elseif(count($parts) == 1) { + $opt_val = $parts[0]; + $opt_weight = 1; + } + $_flexihash->addTarget($opt_val, $opt_weight); } }