dever vor 3 Jahren
Ursprung
Commit
d32f4a3dd8
1 geänderte Dateien mit 24 neuen und 3 gelöschten Zeilen
  1. 24 3
      lib/Parse.php

+ 24 - 3
lib/Parse.php

@@ -59,12 +59,12 @@ class Parse
 
 		if (isset($col[1])) {
 			$data = $doc->init($data);
-			$this->getCol($doc, $col[1], $data, $result, $table);
+			$this->getCol($doc, $col[1], $data, $result, $table, $source);
 		}
 
 		if (isset($col[2])) {
 			$data = $doc->getCur();
-			$this->getCol($doc, $col[2], $data, $result, $table);
+			$this->getCol($doc, $col[2], $data, $result, $table, $source);
 		}
 
 		if ($set) {
@@ -91,7 +91,7 @@ class Parse
 		return $result;
 	}
 
-	private function getCol($doc, $col, $data, &$result, &$table)
+	private function getCol($doc, $col, $data, &$result, &$table, $source = false)
 	{
 		foreach ($col as $v) {
 			$callback = false;
@@ -101,6 +101,10 @@ class Parse
 				$callback = $temp[0];
 			}
 
+			if ($source && strstr($v['collect_rule'], '{link}')) {
+				$v['collect_rule'] = str_replace('{link}', $source, $v['collect_rule']);
+			}
+
 			$value = $doc->rule($data, $col, $v);
 			if ($value == 'error') {
 				break;
@@ -245,6 +249,20 @@ class Parse
 
 	private function copy($file)
 	{
+		if (is_string($file) && strstr($file, '[')) {
+			$temp = Dever::json_decode($file);
+			if ($temp) {
+				$file = array();
+				foreach($temp as $k => $v) {
+					$f = $this->copy($v);
+					if ($f) {
+						$file[] = $f;
+					}
+				}
+				$file = implode(',', $file);
+				return $file;
+			}
+		}
 		if (strstr($file, ',')) {
 			$temp = explode(',', $file);
 			$file = array();
@@ -257,6 +275,9 @@ class Parse
 			$file = implode(',', $file);
 			return $file;
 		}
+		if (!strstr($file, 'http') && strstr($file, '//')) {
+			$file = 'https:' . $file;
+		}
 		$data = Dever::load('upload/save.copy?file=' . $file . '&key=' . $this->res . '&state=1');
 		if (isset($data['status']) && $data['status'] == -1) {
 			return '';