Changeset 873 for trunk/Modules/NetworkShare/SharePage.php
- Timestamp:
- Apr 6, 2020, 11:17:40 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/NetworkShare/SharePage.php
r790 r873 22 22 function ShowTime() 23 23 { 24 return (date("H:i:s")."<br />\n");24 return (date("H:i:s")."<br />\n"); 25 25 } 26 26 … … 41 41 $Cesta = ''; //$Row['name']; 42 42 $i = 0; 43 while (($Otec > 1) && ($i < $this->MaxNesting))43 while (($Otec > 1) && ($i < $this->MaxNesting)) 44 44 { 45 45 $DbResult = $this->Database->query('SELECT Id,Name,Parent FROM NetworkShareItem WHERE Id='.$Otec); … … 50 50 $i++; 51 51 } 52 if ($i >= $this->MaxNesting) $Cesta = '?'.'\\'.$Cesta;53 return ('\\\\'.$Cesta);52 if ($i >= $this->MaxNesting) $Cesta = '?'.'\\'.$Cesta; 53 return ('\\\\'.$Cesta); 54 54 } 55 55 … … 58 58 { 59 59 $Jednotky = array('B','kB','MB','GB','TB','PB','EB'); 60 while ($Velikost >= 1024)60 while ($Velikost >= 1024) 61 61 { 62 62 $Velikost = round($Velikost / 1024 * 10) / 10; 63 63 array_shift($Jednotky); 64 64 } 65 return ($Velikost.' '.$Jednotky[0]);65 return ($Velikost.' '.$Jednotky[0]); 66 66 } 67 67 68 68 function Show() 69 69 { 70 if (!$this->System->User->CheckPermission('NetworkShare', 'Display')) return('Nemáte oprávnění');70 if (!$this->System->User->CheckPermission('NetworkShare', 'Display')) return ('Nemáte oprávnění'); 71 71 72 72 // If not only online checkbox checked 73 if (array_key_exists('view', $_POST) and !array_key_exists('online', $_POST)) $_POST['online'] = 'off';73 if (array_key_exists('view', $_POST) and !array_key_exists('online', $_POST)) $_POST['online'] = 'off'; 74 74 75 75 // Default host list view 76 if ((count($_POST) == 0) and (count($_GET) == 0))76 if ((count($_POST) == 0) and (count($_GET) == 0)) 77 77 { 78 78 $_POST['view'] = 1; … … 81 81 82 82 // Toggle order direction 83 if (array_key_exists('order', $_GET) and ($_SESSION['order'] == $_GET['order'])) $_GET['order'] .= ' DESC';83 if (array_key_exists('order', $_GET) and ($_SESSION['order'] == $_GET['order'])) $_GET['order'] .= ' DESC'; 84 84 85 85 //print_r($_POST); 86 foreach ($this->Promene as $Index => $Prvek)87 { 88 if (!array_key_exists($Index, $_SESSION)) $_SESSION[$Index] = $this->Promene[$Index];89 if (array_key_exists($Index, $_GET)) $_SESSION[$Index] = $_GET[$Index];90 if (array_key_exists($Index, $_POST)) $_SESSION[$Index] = $_POST[$Index];91 if (($Index == 'keyword') and (array_key_exists('view', $_GET))) $_SESSION[$Index] = $this->Promene[$Index];92 if (($Index == 'view') and ((array_key_exists('keyword', $_POST)) or (array_key_exists('keyword', $_GET)))) $_SESSION[$Index] = '';86 foreach ($this->Promene as $Index => $Prvek) 87 { 88 if (!array_key_exists($Index, $_SESSION)) $_SESSION[$Index] = $this->Promene[$Index]; 89 if (array_key_exists($Index, $_GET)) $_SESSION[$Index] = $_GET[$Index]; 90 if (array_key_exists($Index, $_POST)) $_SESSION[$Index] = $_POST[$Index]; 91 if (($Index == 'keyword') and (array_key_exists('view', $_GET))) $_SESSION[$Index] = $this->Promene[$Index]; 92 if (($Index == 'view') and ((array_key_exists('keyword', $_POST)) or (array_key_exists('keyword', $_GET)))) $_SESSION[$Index] = ''; 93 93 $$Index = $_SESSION[$Index]; 94 94 //echo('$'.$Index.' = '.$_SESSION[$Index].'<br>'); 95 95 } 96 96 //echo($keyword); 97 //if ($keyword)98 //if ($keyword != '') $view = '';97 //if ($keyword) 98 //if ($keyword != '') $view = ''; 99 99 100 100 //$this->Database->select_db('share'); 101 101 102 102 // Log search 103 if (array_key_exists('keyword', $_POST) or array_key_exists('keyword', $_GET))103 if (array_key_exists('keyword', $_POST) or array_key_exists('keyword', $_GET)) 104 104 $this->System->ModuleManager->Modules['Log']->NewRecord('Share', 'Hledaný výraz', $_SESSION['keyword']); 105 105 … … 139 139 </select> '; 140 140 141 if ($online == 'on') $Selected = 'checked '; else $Selected = '';141 if ($online == 'on') $Selected = 'checked '; else $Selected = ''; 142 142 $Output .= '<input type="checkbox" '.$Selected.'name="online">Pouze aktivní uživatele<br> 143 143 </form>'; 144 144 145 145 //$Output .= $view; 146 if ($view != '')146 if ($view != '') 147 147 { 148 148 // Zobrazení obsahu vybrané složky … … 170 170 "(ext LIKE 'iso') OR (ext LIKE 'nrg') OR (ext LIKE 'ccd') OR (ext LIKE 'bin') OR (ext LIKE 'mds')", 171 171 ); 172 if ($file_type > 0) $Podminka .= ' AND ('.$Pripony[$file_type].')';172 if ($file_type > 0) $Podminka .= ' AND ('.$Pripony[$file_type].')'; 173 173 174 174 //Hledání podle velikosti 175 175 $Jednotky = array(1, 1024, 1048576, 1073741824); 176 if (is_numeric($size))176 if (is_numeric($size)) 177 177 { 178 178 $Metoda = array('=', '>', '<'); … … 184 184 // Omezení na online/offline uživatele 185 185 //$this->Database->select_db('is'); 186 if ($online == 'on') $DbResult = $this->Database->query('SELECT Id FROM NetworkDevice WHERE Online=1 AND Member IS NOT NULL');186 if ($online == 'on') $DbResult = $this->Database->query('SELECT Id FROM NetworkDevice WHERE Online=1 AND Member IS NOT NULL'); 187 187 else $DbResult = $this->Database->query('SELECT Id FROM NetworkDevice'); 188 188 $Vyber = ''; 189 while ($Row = $DbResult->fetch_array()) $Vyber .= $Row['Id'].',';189 while ($Row = $DbResult->fetch_array()) $Vyber .= $Row['Id'].','; 190 190 $Podminka .= ' AND (Host IN ('.substr($Vyber, 0, -1).'))'; 191 191 //echo($Podminka.'<br>'); … … 200 200 201 201 // Zobrazení [..] 202 if (($view != '') && ($page == 0) && ($Nahoru > 0))202 if (($view != '') && ($page == 0) && ($Nahoru > 0)) 203 203 { 204 204 $DbResult = $this->Database->query('SELECT * FROM NetworkShareItem WHERE Id='.$view); … … 212 212 $PerPage = 30; 213 213 $Dotaz = "SELECT COUNT(*) FROM NetworkShareItem WHERE (".$Podminka.")"; 214 if ($order != '') $Dotaz .= ' ORDER BY '.$order;214 if ($order != '') $Dotaz .= ' ORDER BY '.$order; 215 215 $Dotaz .= " LIMIT ".($page * $PerPage).",".$PerPage; 216 216 $DbResult = $this->Database->query($Dotaz); … … 218 218 $Pocet = $Row[0]; 219 219 220 if ($Pocet > 0)220 if ($Pocet > 0) 221 221 { 222 222 $Output .= 'Nalezeno celkem: '.$Pocet.' položek<br />'; 223 223 } else 224 224 $Output .= 'Podle zadaných podmínek nic nenalezeno'; 225 if (($Pocet > 0) || ($upstr))225 if (($Pocet > 0) || ($upstr)) 226 226 { 227 227 $Output .= '<table width="100%" style="font-size: 8pt;" border="0" cellpadding="2" cellspacing="2"> 228 228 <tr><th bgcolor="#E0E0FF"><a href="index.php?order=name">Soubor</a></th><th bgcolor="#E0E0FF"><a href="index.php?order=ext">Přípona</a></th><th bgcolor="#E0E0FF"><a href="index.php?order=size">Velikost</a></th><th bgcolor="#E0E0FF"><a href="index.php?order=date">Datum</a></th><th bgcolor="#E0E0FF">Umístění</th></tr>'; 229 229 $Output .= $upstr; 230 if ($Pocet > 0)230 if ($Pocet > 0) 231 231 { 232 232 // Zobrazení tabulky s výsledky … … 235 235 236 236 // Zobrazení poloľek 237 while ($Row = $DbResult->fetch_array())237 while ($Row = $DbResult->fetch_array()) 238 238 { 239 239 // Loguj('Radek '.$Row['name']); … … 244 244 // Zobrazení řádku 245 245 $Cesta2 = strtr($Cesta.$Radek['Name'], '\\', '/'); 246 if ($Radek['Ext'] != '') $Cesta2 .= '.'.$Radek['Ext'];247 if ($Radek['Type'] != 0) $Adresa = 'index.php?view='.$Radek['Id'].'">['.$Radek['Name'].']';246 if ($Radek['Ext'] != '') $Cesta2 .= '.'.$Radek['Ext']; 247 if ($Radek['Type'] != 0) $Adresa = 'index.php?view='.$Radek['Id'].'">['.$Radek['Name'].']'; 248 248 else 249 249 { 250 if (strstr($_SERVER['HTTP_USER_AGENT'], 'Linux')) $Adresa = 'smb:'.$Cesta2.'">'.$Radek['Name'];250 if (strstr($_SERVER['HTTP_USER_AGENT'], 'Linux')) $Adresa = 'smb:'.$Cesta2.'">'.$Radek['Name']; 251 251 else $Adresa = 'file:///'.$Cesta2.'">'.$Radek['Name']; 252 252 } … … 260 260 } 261 261 } 262 if ($Pocet > 0)262 if ($Pocet > 0) 263 263 { 264 264 // Celkový přehled 265 if ($view == 1)265 if ($view == 1) 266 266 { 267 267 $DbResult = $this->Database->query('SELECT SUM(Size) FROM NetworkShareItem WHERE (Parent=1) AND (Host IN ('.substr($Vyber,0,-1).'))'); … … 285 285 $Host = strtoupper(substr($Host, 0, strpos($Host, '.'))); 286 286 $DbResult = $this->Database->select('NetworkShareError', '*', 'Host="'.$Host.'"'); 287 if ($DbResult->num_rows > 0) $Output .= '<strong>Výpis chybových hlášení pro počítač '.$Host.':</strong><br />';287 if ($DbResult->num_rows > 0) $Output .= '<strong>Výpis chybových hlášení pro počítač '.$Host.':</strong><br />'; 288 288 //echo('host="'.$Host.'"'); 289 while ($Row = $DbResult->fetch_array())289 while ($Row = $DbResult->fetch_array()) 290 290 { 291 291 $Row['Message'] = str_replace('/', '\\', $Row['Message']); … … 295 295 296 296 // Zobrazení seznamu stránek 297 if ($Pages > 1)297 if ($Pages > 1) 298 298 { 299 if ($page > 0) $Output .= '<a href="index.php?page=0"><<</a> ';300 if ($page > 0) $Output .= '<a href="index.php?page='.($page-1).'"><</a> ';299 if ($page > 0) $Output .= '<a href="index.php?page=0"><<</a> '; 300 if ($page > 0) $Output .= '<a href="index.php?page='.($page-1).'"><</a> '; 301 301 $PagesMax = $Pages; 302 302 $PagesMin = 0; 303 if ($PagesMax > ($page + 10)) $PagesMax = $page + 10;304 if ($PagesMin < ($page - 10))303 if ($PagesMax > ($page + 10)) $PagesMax = $page + 10; 304 if ($PagesMin < ($page - 10)) 305 305 { 306 306 $Output .= ' .. '; 307 307 $PagesMin = $page - 10; 308 308 } 309 for ($i = $PagesMin; $i <= $PagesMax; $i++)309 for ($i = $PagesMin; $i <= $PagesMax; $i++) 310 310 { 311 if ($i == $page) $Output .= '<strong>';311 if ($i == $page) $Output .= '<strong>'; 312 312 $Output .= '<a href="index.php?page='.$i.'">'.($i + 1).'</a> '; 313 if ($i == $page) $Output .= '</strong>';313 if ($i == $page) $Output .= '</strong>'; 314 314 } 315 if ($PagesMax < $Pages) $Output .= ' .. ';316 if ($page < $Pages) $Output .= '<a href="index.php?page='.($page + 1).'">></a> ';317 if ($page < $Pages) $Output .= '<a href="index.php?page='.$Pages.'">>></a>';315 if ($PagesMax < $Pages) $Output .= ' .. '; 316 if ($page < $Pages) $Output .= '<a href="index.php?page='.($page + 1).'">></a> '; 317 if ($page < $Pages) $Output .= '<a href="index.php?page='.$Pages.'">>></a>'; 318 318 } 319 319 } 320 return ($Output);320 return ($Output); 321 321 } 322 322 }
Note:
See TracChangeset
for help on using the changeset viewer.