Changeset 3677
- Timestamp:
- Jul 25, 2009, 6:08:26 PM (15 years ago)
- Location:
- extensions/floPure
- Files:
-
- 21 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/floPure/index.tpl
r3579 r3677 12 12 <td id="section_left"> </td> 13 13 <td id="section_in"> 14 <div class="titrePage">15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 <h2>{$TITLE}</h2>63 64 {if isset($chronology_views) }65 <div class="calendarViews">{'calendar_view'|@translate}:66 67 68 69 70 71 </div>72 {/if}73 74 {if isset($chronology.TITLE) }75 <h2>{$chronology.TITLE}</h2>76 {/if}77 78 </div> <!-- titrePage -->14 <div class="titrePage"> 15 <ul class="categoryActions"> 16 {if !empty($image_orders) } 17 <li> 18 {'Sort order'|@translate}: 19 <select onchange="document.location = this.options[this.selectedIndex].value;"> 20 {foreach from=$image_orders item=image_order } 21 <option value="{$image_order.URL}"{if $image_order.SELECTED} selected="selected"{/if}>{$image_order.DISPLAY}</option> 22 {/foreach} 23 </select> 24 </li> 25 {/if} 26 27 {if isset($U_CADDIE) } 28 <li><a href="{$U_CADDIE}" title="{'add to caddie'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/caddie_add.png" class="button" alt="{'caddie'|@translate}"/></a></li> 29 {/if} 30 31 {if isset($U_EDIT) } 32 <li><a href="{$U_EDIT}" title="{'edit category informations'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/category_edit.png" class="button" alt="{'edit'|@translate}"/></a></li> 33 {/if} 34 35 {if isset($U_SEARCH_RULES) } 36 <li><a href="{$U_SEARCH_RULES}" onclick="popuphelp(this.href); return false;" title="{'Search rules'|@translate}" rel="nofollow"><img src="{$ROOT_URL}{$themeconf.icon_dir}/search_rules.png" class="button" alt="(?)" /></a></li> 37 {/if} 38 39 {if isset($U_SLIDESHOW) } 40 <li><a href="{$U_SLIDESHOW}" title="{'slideshow'|@translate}" rel="nofollow"><img src="{$ROOT_URL}{$themeconf.icon_dir}/start_slideshow.png" class="button" alt="{'slideshow'|@translate}"/></a></li> 41 {/if} 42 43 {if isset($U_MODE_FLAT) } 44 <li><a href="{$U_MODE_FLAT}" title="{'mode_flat_hint'|@translate}" rel="nofollow"><img src="{$ROOT_URL}{$themeconf.icon_dir}/flat.png" class="button" alt="{'mode_flat_hint'|@translate}" /></a></li> 45 {/if} 46 47 {if isset($U_MODE_NORMAL) } 48 <li><a href="{$U_MODE_NORMAL}" title="{'mode_normal_hint'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/normal_mode.png" class="button" alt="{'mode_normal_hint'|@translate}" /></a></li> 49 {/if} 50 51 {if isset($U_MODE_POSTED) } 52 <li><a href="{$U_MODE_POSTED}" title="{'mode_posted_hint'|@translate}" rel="nofollow"><img src="{$ROOT_URL}{$themeconf.icon_dir}/calendar.png" class="button" alt="{'mode_posted_hint'|@translate}" /></a></li> 53 {/if} 54 55 {if isset($U_MODE_CREATED) } 56 <li><a href="{$U_MODE_CREATED}" title="{'mode_created_hint'|@translate}" rel="nofollow"><img src="{$ROOT_URL}{$themeconf.icon_dir}/calendar_created.png" class="button" alt="{'mode_created_hint'|@translate}" /></a></li> 57 {/if} 58 59 {if !empty($PLUGIN_INDEX_ACTIONS)}{$PLUGIN_INDEX_ACTIONS}{/if} 60 </ul> 61 62 <h2>{$TITLE}</h2> 63 64 {if isset($chronology_views) } 65 <div class="calendarViews">{'calendar_view'|@translate}: 66 <select onchange="document.location = this.options[this.selectedIndex].value;"> 67 {foreach from=$chronology_views item=view} 68 <option value="{$view.VALUE}"{if $view.SELECTED} selected="selected"{/if}>{$view.CONTENT}</option> 69 {/foreach} 70 </select> 71 </div> 72 {/if} 73 74 {if isset($chronology.TITLE) } 75 <h2>{$chronology.TITLE}</h2> 76 {/if} 77 78 </div> <!-- titrePage --> 79 79 80 80 {if !empty($PLUGIN_INDEX_CONTENT_BEGIN)}{$PLUGIN_INDEX_CONTENT_BEGIN}{/if} -
extensions/floPure/tools/floPure.class.php
r3586 r3677 57 57 closedir ($dh); // on ferme le repertoire courant 58 58 } 59 function url_is_remote($url) 60 { 61 if ( strncmp($url, 'http://', 7)==0 62 or strncmp($url, 'https://', 8)==0 ) 63 { 64 return true; 65 } 66 return false; 67 } 68 69 function fetchRemote($src, &$dest, $user_agent='Piwigo', $step=0) 70 { 71 // Try to retrieve data from local file? 72 if (!$this->url_is_remote($src)) 73 { 74 $content = @file_get_contents($src); 75 if ($content !== false) 76 { 77 is_resource($dest) ? @fwrite($dest, $content) : $dest = $content; 78 return true; 79 } 80 else 81 { 82 return false; 83 } 84 } 85 86 // After 3 redirections, return false 87 if ($step > 3) return false; 88 89 // Initialize $dest 90 is_resource($dest) or $dest = ''; 91 92 // Try curl to read remote file 93 if (function_exists('curl_init')) 94 { 95 $ch = @curl_init(); 96 @curl_setopt($ch, CURLOPT_URL, $src); 97 @curl_setopt($ch, CURLOPT_HEADER, 1); 98 @curl_setopt($ch, CURLOPT_USERAGENT, $user_agent); 99 @curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 100 $content = @curl_exec($ch); 101 $header_length = @curl_getinfo($ch, CURLINFO_HEADER_SIZE); 102 $status = @curl_getinfo($ch, CURLINFO_HTTP_CODE); 103 @curl_close($ch); 104 if ($content !== false and $status >= 200 and $status < 400) 105 { 106 if (preg_match('/Location:\s+?(.+)/', substr($content, 0, $header_length), $m)) 107 { 108 return $this->fetchRemote($m[1], $dest, $user_agent, $step+1); 109 } 110 $content = substr($content, $header_length); 111 is_resource($dest) ? @fwrite($dest, $content) : $dest = $content; 112 return true; 113 } 114 } 115 116 // Try file_get_contents to read remote file 117 if (ini_get('allow_url_fopen')) 118 { 119 $content = @file_get_contents($src); 120 if ($content !== false) 121 { 122 is_resource($dest) ? @fwrite($dest, $content) : $dest = $content; 123 return true; 124 } 125 } 126 127 // Try fsockopen to read remote file 128 $src = parse_url($src); 129 $host = $src['host']; 130 $path = isset($src['path']) ? $src['path'] : '/'; 131 $path .= isset($src['query']) ? '?'.$src['query'] : ''; 132 133 if (($s = @fsockopen($host,80,$errno,$errstr,5)) === false) 134 { 135 return false; 136 } 137 138 fwrite($s, 139 "GET ".$path." HTTP/1.0\r\n" 140 ."Host: ".$host."\r\n" 141 ."User-Agent: ".$user_agent."\r\n" 142 ."Accept: */*\r\n" 143 ."\r\n" 144 ); 145 146 $i = 0; 147 $in_content = false; 148 while (!feof($s)) 149 { 150 $line = fgets($s); 151 152 if (rtrim($line,"\r\n") == '' && !$in_content) 153 { 154 $in_content = true; 155 $i++; 156 continue; 157 } 158 if ($i == 0) 159 { 160 if (!preg_match('/HTTP\/(\\d\\.\\d)\\s*(\\d+)\\s*(.*)/',rtrim($line,"\r\n"), $m)) 161 { 162 fclose($s); 163 return false; 164 } 165 $status = (integer) $m[2]; 166 if ($status < 200 || $status >= 400) 167 { 168 fclose($s); 169 return false; 170 } 171 } 172 if (!$in_content) 173 { 174 if (preg_match('/Location:\s+?(.+)$/',rtrim($line,"\r\n"),$m)) 175 { 176 fclose($s); 177 return $this->fetchRemote(trim($m[1]),$dest,$user_agent,$step+1); 178 } 179 $i++; 180 continue; 181 } 182 is_resource($dest) ? @fwrite($dest, $line) : $dest .= $line; 183 $i++; 184 } 185 fclose($s); 186 return true; 187 } 188 189 59 190 function is_not_up_to_date($v_local, $eid) 60 191 {
Note: See TracChangeset
for help on using the changeset viewer.