From f53469e020965cadb96f33490200c09a0fca56c4 Mon Sep 17 00:00:00 2001 From: Tyler Eich Date: Fri, 15 Feb 2013 20:27:31 -0500 Subject: [PATCH 1/2] Updated with new files from @jdfwarrior --- workflows.php | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) mode change 100644 => 100755 workflows.php diff --git a/workflows.php b/workflows.php old mode 100644 new mode 100755 index 0b80053..046cccd --- a/workflows.php +++ b/workflows.php @@ -249,10 +249,9 @@ public function set( $a=null, $b=null, $c=null ) { if ( is_array( $a ) ): if ( file_exists( $b ) ): - $temp = $this->path.'/'.$b; - if ( $b == $temp ): - $b = $this->path."/".$b; - endif; + if ( file_exists( $this->path.'/'.$b ) ): + $b = $this->path.'/'.$b; + endif; elseif ( file_exists( $this->data."/".$b ) ): $b = $this->data."/".$b; elseif ( file_exists( $this->cache."/".$b ) ): @@ -262,9 +261,8 @@ public function set( $a=null, $b=null, $c=null ) endif; else: if ( file_exists( $c ) ): - $temp = $this->path.'/'.$c; - if ( $c == $temp ): - $c = $this->path."/".$c; + if ( file_exists( $this->path.'/'.$c ) ): + $c = $this->path.'/'.$c; endif; elseif ( file_exists( $this->data."/".$c ) ): $c = $this->data."/".$c; @@ -295,11 +293,10 @@ public function set( $a=null, $b=null, $c=null ) public function get( $a, $b ) { if ( file_exists( $b ) ): - $temp = $this->path.'/'.$b; - if ( $b == $temp ): - $b = $this->path."/".$b; + if ( file_exists( $this->path.'/'.$b ) ): + $b = $this->path.'/'.$b; endif; - elseif ( file_exists( $this->data."/".$b ) ): + elseif ( file_exists( $this->data."/".$b ) ): $b = $this->data."/".$b; elseif ( file_exists( $this->cache."/".$b ) ): $b = $this->cache."/".$b; @@ -383,9 +380,8 @@ public function mdfind( $query ) public function write( $a, $b ) { if ( file_exists( $b ) ): - $temp = $this->path.'/'.$b; - if ( $b == $temp ): - $b = $this->path."/".$b; + if ( file_exists( $this->path.'/'.$b ) ): + $b = $this->path.'/'.$b; endif; elseif ( file_exists( $this->data."/".$b ) ): $b = $this->data."/".$b; @@ -418,9 +414,8 @@ public function write( $a, $b ) public function read( $a ) { if ( file_exists( $a ) ): - $temp = $path.'/'.$a; - if ( $a === $temp ): - $a = $this->path."/".$a; + if ( file_exists( $this->path.'/'.$a ) ): + $a = $this->path.'/'.$a; endif; elseif ( file_exists( $this->data."/".$a ) ): $a = $this->data."/".$a; From ca491b11b104f56ac0ea6a9fe9200b98329fe2e9 Mon Sep 17 00:00:00 2001 From: Tyler Eich Date: Sat, 16 Feb 2013 16:38:46 -0500 Subject: [PATCH 2/2] Added a function to check for an internet connection --- workflows.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/workflows.php b/workflows.php index 046cccd..ff3e082 100755 --- a/workflows.php +++ b/workflows.php @@ -468,5 +468,15 @@ public function result( $uid, $arg, $title, $sub, $icon, $valid='yes', $auto=nul return $temp; } - + + public function internet() + { + $internet = @fsockopen("www.google.com",80); + if($internet): + fclose($internet); + return true; + else: + return false; + endif; + } } \ No newline at end of file