From 513535755cff5f3d34b346ee4ce32e9e86183421 Mon Sep 17 00:00:00 2001 From: Gabriel Dunne Date: Sat, 23 Feb 2019 20:01:40 -0800 Subject: [PATCH] Adding a backup file --- index copy.php | 435 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 435 insertions(+) create mode 100644 index copy.php diff --git a/index copy.php b/index copy.php new file mode 100644 index 0000000..4632175 --- /dev/null +++ b/index copy.php @@ -0,0 +1,435 @@ + + + + aggregate + http://quilime.com/aggregate/ + media.quilime.com + aggregate + '; + + foreach($agg as $i) { + $count--; + if($count == 0) break; + echo ' + + '.$i['url'].' + [reference url] + '.$i['name'].' + + <p><a href="?l='.$i['name'].'"><img src="'.$i['url'].'" alt="" border="0"></a></p><p> + + http://quilime.com/aggregate/?l='.$i['name'].' + + '; + } + + echo ' + + '; +} + + + + + +function filterkeywords($agg) +{ + if(sizeof($_SESSION['keywords']) > 0) { + $filtered = array(); + foreach($agg as $f) { + foreach($_SESSION['keywords'] as $keyword) { + $pattern = '/'.strtolower($keyword).'/'; + preg_match($pattern,strtolower($f['name']), $matches); + if(sizeof($matches) > 0) { + $filtered[] = $f; + } + } + } + $agg = $filtered; + } + return $agg; +} + + + + +function aggTitle() +{ + global $link; + + $keywords = keywords(); + + if($link) + return ' - '.$link; + else if(isset($_GET['s']) && $_GET['s'] != '___') + return ' - results for : ' . $keywords .''; + else + return $bin ? ' - ' . $bin : ''; +} + + + +function keywords() +{ + $r = ""; + if($_SESSION['keywords']) { + foreach($_SESSION['keywords'] as $k) { + if(trim($k) == "") continue; + $r .= $k . ' '; + //echo 'x'; + //echo '
'; + } + } + return $r; +} + + +function clearkeywords() +{ + $_SESSION['keywords'] = array(); + return; +} + + +function getkeywords() +{ + $k = $_GET['s']; + $remove = $_GET['r']; + + if($k == "___") { + clearkeywords(); + return; + } + + if(!is_array($_SESSION['keywords'])) + $_SESSION['keywords'] = array(); + + $kex = explode(" ", $k); + + foreach($kex as $k) { + if(!in_array($k, $_SESSION['keywords'])) + $_SESSION['keywords'][] = $k; + } + + foreach($_SESSION['keywords'] as $key => $keyw) { + if(trim($keyw) == trim($remove)) + unset($_SESSION['keywords'][$key]); + } + + $_SESSION['keywords'] = array_unique($_SESSION['keywords']); + $_SESSION['keywords'] = array_filter($_SESSION['keywords']); +} + + +function pages($numImages) +{ + global $page, $num_pp, $bin; + + if($bin) return; + if($numImages < $num_pp) return; + + $num = $numImages / $num_pp; + echo $page > 0 ? '  ' : '←  '; + $c = 0; + for($i = 0; $i < $num; $i++) { + if($page == $i) echo '' . $i . ''; + else echo ''.$i.''; + echo " "; + $c++; + } + echo $page < $c++-1 ? '' : ''; + + echo '

'; + + echo '# PER PAGE: '; + $n = array(1, 5, 10, 20, 50); + foreach($n as $nn) { + if($nn == $num_pp) { + echo $num_pp.' '; + continue; + } + echo ''.$nn.' '; + } + +} + + +function agg($agg) +{ + global $admin, $link, $bin, $num_pp, $offset; + + if($link) { + //echo '

'; + + echo ''; + if(file_exists(DESC . $link . '.txt')) { + echo '
'; + $img_json = file_get_contents( DESC . $link . '.txt' ); + $img_desc = json_decode($img_json, true); + echo '' . $img_desc['link'] . ''; + echo '
'; + } + + return; + } + + $off = $bin ? 0 : $offset; + $num = $bin ? sizeof($agg) : $num_pp; + + for($i = $off; $i < $off + $num; $i++) { + + echo '
'; + + if($i > sizeof($agg)-1) break; + $file = $agg[$i]; + + if($file['type'] == 'Folder') { + + echo ''; + continue; + + } + else { + + if($admin) { + echo ' +
+ +
+
+
+
+ +
+ '; + } + echo ''; + if(file_exists(DESC . $file['name'] . '.txt')) { + echo '
'; + $img_json = file_get_contents( DESC . $file['name'] . '.txt' ); + $img_desc = json_decode($img_json, true); + echo '' . $img_desc['link'] . ''; + echo '
'; + } + + } + + echo '
'; + } +} + + +function fopen_recursive($path, $mode, $chmod=0755) +{ + $directory = dirname($path); + $file = basename($path); + if (!is_dir($directory)){ + if (!mkdir($directory, $chmod, 1)) { + return FALSE; + } + } + return fopen ($path, $mode); +} + + +function js() +{ + header("Content-Type: text/javascript;"); + header("Pragma: no-cache"); + header("Cache-Control: no-store, no-cache, max-age=0, must-revalidate"); + + $img = isset($_GET['img']) ? $_GET['img'] : false; + + $json = '{'; + foreach($_GET as $k=>$param) { + $json .= '"'.$k.'"'.' : '.'"'.$param.'", '; + } + $json .= '"json":0}'; + + if($img) { + $file = fopen_recursive(DESC . $img . '.txt',"w"); + fwrite($file,$json); + fclose($file); + ?> + $("").style.display = 'none'; + + + + + + + + + aggregate<?=aggTitle();?> + + + + + + + + + + + aggregate + +
+
+ +
+
+ +

+ +
+ +
+ +
+ +
+ + + + + + -- 2.34.1