- Timestamp:
- Jan 18, 2012, 9:32:07 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Model.php
r360 r362 1 1 <?php 2 3 define('PropertyInteger8', 'Integer8'); 4 define('PropertyInteger16', 'Integer16'); 5 define('PropertyInteger24', 'Integer24'); 6 define('PropertyInteger32', 'Integer32'); 7 define('PropertyInteger64', 'Integer64'); 8 9 define('PropertyText8', 'Text8'); 10 define('PropertyText16', 'Text16'); 11 define('PropertyText24', 'Text24'); 12 define('PropertyText32', 'Text32'); 2 13 3 14 define('PropertyDate', 'Date'); 4 15 define('PropertyTime', 'Time'); 5 16 define('PropertyDateTime', 'DateTime'); 6 define('PropertyText', 'Text ');17 define('PropertyText', 'Text16'); 7 18 define('PropertyString', 'String'); 8 19 define('PropertyBoolean', 'Boolean'); 9 define('PropertyInteger', 'Integer ');20 define('PropertyInteger', 'Integer32'); 10 21 define('PropertyFloat', 'Float'); 22 define('PropertyDouble', 'Double'); 11 23 define('PropertyOneToMany', 'OneToMany'); 12 24 define('PropertyManyToOne', 'ManyToOne'); 13 25 define('PropertyManyToMany', 'ManyToMany'); 26 14 27 15 28 class Model … … 56 69 } 57 70 71 function AddPropertyText8($Name) 72 { 73 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyText8); 74 } 75 76 function AddPropertyText16($Name) 77 { 78 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyText16); 79 } 80 81 function AddPropertyText24($Name) 82 { 83 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyText24); 84 } 85 86 function AddPropertyText32($Name) 87 { 88 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyText32); 89 } 90 58 91 function AddPropertyString($Name) 59 92 { … … 66 99 } 67 100 68 function AddPropertyFloat($Name) 101 function AddPropertyInteger8($Name) 102 { 103 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyInteger8); 104 } 105 106 function AddPropertyInteger16($Name) 107 { 108 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyInteger16); 109 } 110 111 function AddPropertyInteger24($Name) 112 { 113 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyInteger24); 114 } 115 116 function AddPropertyInteger32($Name) 117 { 118 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyInteger32); 119 } 120 121 function AddPropertyInteger64($Name) 122 { 123 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyInteger64); 124 } 125 126 function AddPropertyFloat($Name) 69 127 { 70 128 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyFloat); 129 } 130 131 function AddPropertyDouble($Name) 132 { 133 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyDouble); 71 134 } 72 135 -
trunk/Modules/NetworkShare/NetworkShare.php
r358 r362 4 4 5 5 include_once('SharePage.php'); 6 7 class NetworkShareItem extends Model 8 { 9 function __construct($Database, $System) 10 { 11 parent::__construct($Database, $System); 12 $this->Name = 'NetworkShareItem'; 13 $this->AddPropertyString('Name'); 14 $this->AddPropertyOneToMany('Parent', 'NetworkShareItems'); 15 $this->AddPropertyOneToMany('Host', 'NetworkDevice'); 16 $this->AddPropertyInteger64('Size'); 17 $this->AddPropertyString('Ext'); 18 $this->AddPropertyDate('Date'); 19 $this->AddPropertyInteger('Type'); 20 } 21 } 22 23 class NetworkShareError extends Model 24 { 25 function __construct($Database, $System) 26 { 27 parent::__construct($Database, $System); 28 $this->Name = 'NetworkShareError'; 29 $this->AddPropertyOneToMany('Host', 'NetworkDevice'); 30 $this->AddPropertyString('Message'); 31 } 32 } 6 33 7 34 class ModuleNetworkShare extends Module … … 15 42 $this->License = 'GNU/GPL'; 16 43 $this->Description = 'System for loading network computer share file list and allow fast searching.'; 17 $this->Dependencies = array( );18 $this->Models = array( );44 $this->Dependencies = array('Network'); 45 $this->Models = array('NetworkShareItem', 'NetworkShareError'); 19 46 } 20 47 -
trunk/Modules/NetworkShare/SharePage.php
r355 r362 42 42 while(($Otec > 1) && ($i < $this->MaxNesting)) 43 43 { 44 $DbResult = $this->Database->query('SELECT id,name,parent FROM itemsWHERE id='.$Otec);44 $DbResult = $this->Database->query('SELECT id,name,parent FROM NetworkShareItem WHERE id='.$Otec); 45 45 $Row = $DbResult->fetch_array(); 46 46 $this->Loguj('Name: '.$Row['name'].' ID:'.$Row['id'].' Parent:'.$Row['parent']); … … 146 146 { 147 147 // Zobrazení obsahu vybrané složky 148 $DbResult = $this->Database->query('SELECT * FROM itemsWHERE id='.$view);148 $DbResult = $this->Database->query('SELECT * FROM NetworkShareItem WHERE id='.$view); 149 149 $Row = $DbResult->fetch_array(); 150 150 $Cesta = $this->PlnaCesta($Row); … … 194 194 195 195 // Zjištění počtu výskytů 196 //DB_Query("SELECT COUNT(*) FROM itemsWHERE ($Podminka)");196 //DB_Query("SELECT COUNT(*) FROM NetworkShareItem WHERE ($Podminka)"); 197 197 //$Row = DB_Row(); 198 198 //$Pocet = $Row[0]; … … 201 201 if(($view != '') && ($page == 0) && ($Nahoru > 0)) 202 202 { 203 $DbResult = $this->Database->query('SELECT * FROM itemsWHERE id='.$view);203 $DbResult = $this->Database->query('SELECT * FROM NetworkShareItem WHERE id='.$view); 204 204 $Row = $DbResult->fetch_array(); 205 205 //ShowArray($Row); … … 210 210 // Nacteni vysledku z databaze 211 211 $PerPage = 30; 212 $Dotaz = "SELECT SQL_CALC_FOUND_ROWS * FROM itemsWHERE ($Podminka)";212 $Dotaz = "SELECT SQL_CALC_FOUND_ROWS * FROM NetworkShareItem WHERE ($Podminka)"; 213 213 if($order != '') $Dotaz .= ' ORDER BY '.$order; 214 214 $Dotaz .= " LIMIT ".($page * $PerPage).",".$PerPage; … … 262 262 if($view == 1) 263 263 { 264 $DbResult = $this->Database->query('SELECT SUM(size) FROM itemsWHERE (parent=1) AND (host IN ('.substr($Vyber,0,-1).'))');264 $DbResult = $this->Database->query('SELECT SUM(size) FROM NetworkShareItem WHERE (parent=1) AND (host IN ('.substr($Vyber,0,-1).'))'); 265 265 $Row = $DbResult->fetch_array(); 266 266 $SizeOnline = $this->PrevedVelikost($Row[0]); 267 $DbResult = $this->Database->query('SELECT size FROM itemsWHERE id=1');267 $DbResult = $this->Database->query('SELECT size FROM NetworkShareItem WHERE id=1'); 268 268 $Row = $DbResult->fetch_array(); 269 269 $Size = $this->PrevedVelikost($Row['size']); 270 $DbResult = $this->Database->query('SELECT COUNT(*) FROM items');270 $DbResult = $this->Database->query('SELECT COUNT(*) FROM NetworkShareItem'); 271 271 $Row = $DbResult->fetch_array(); 272 272 $Output .= '<br />Celková velikost online sdílených dat: '.$SizeOnline; -
trunk/Modules/NetworkShare/browse.php
r129 r362 48 48 //$Vlozit = ''; 49 49 // Nacti parent ID 50 $DbResult = $Database->query('SELECT LAST_INSERT_ID() FROM itemsLIMIT 0,1');50 $DbResult = $Database->query('SELECT LAST_INSERT_ID() FROM NetworkShareItem LIMIT 0,1'); 51 51 //echo(DB_NumRows()); 52 52 $Row = $DbResult->fetch_array(); … … 99 99 $Nazev = substr($Nazev,0,strrpos($Nazev,'.')); 100 100 } else $Ext = ''; 101 //$Vlozit .= "INSERT INTO items(name,size,date,ext,parent,type,host) ".101 //$Vlozit .= "INSERT INTO NetworkShareItem (name,size,date,ext,parent,type,host) ". 102 102 //"VALUES ('$Nazev','$Velikost',NOW(),'$Ext','$Parent','$Type','$HostID'); "; 103 103 104 $Database->insert(' items', array(104 $Database->insert('NetworkShareItem', array( 105 105 'name' => $Nazev, 106 106 'size' => $Velikost, … … 126 126 127 127 // Aktualizuj velikost 128 //DB_Query("SELECT SUM(size) FROM itemsWHERE (parent=".$Parent.")");128 //DB_Query("SELECT SUM(size) FROM NetworkShareItem WHERE (parent=".$Parent.")"); 129 129 //$Row = DB_Row(); 130 $Database->update(' items', 'id='.$Parent, array('size' => $VelikostSlozky));130 $Database->update('NetworkShareItem', 'id='.$Parent, array('size' => $VelikostSlozky)); 131 131 //closedir($Dir); 132 132 return($VelikostSlozky); … … 134 134 135 135 // Proskenuj jednotlive sdileni 136 $Database->query('DELETE FROM itemsWHERE host='.$HostID); // Smaz predchozi polozky136 $Database->query('DELETE FROM NetworkShareItem WHERE host='.$HostID); // Smaz predchozi polozky 137 137 138 138 // Zapis nazev pocitace 139 $Database->insert(' items',array(139 $Database->insert('NetworkShareItem',array( 140 140 'name' => $Host, 141 141 'size' => 0, … … 148 148 149 149 // Nacti Parent ID 150 $DbResult = $Database->query('SELECT LAST_INSERT_ID() FROM itemsLIMIT 0,1');150 $DbResult = $Database->query('SELECT LAST_INSERT_ID() FROM NetworkShareItem LIMIT 0,1'); 151 151 $Row = $DbResult->fetch_array(); 152 152 $Parent = $Row[0]; … … 170 170 { 171 171 // Přidej poloľku sdílení do datanáze 172 $Database->insert(' items',array(172 $Database->insert('NetworkShareItem',array( 173 173 'name' => $Share, 174 174 'size' => 0, … … 196 196 197 197 // Aktualizuj velikost dat pocitace 198 $DbResult = $Database->query("SELECT SUM(size) FROM itemsWHERE parent=".$Parent);199 $Row = $DbResult->fetch_array(); 200 $Database->update(' items','id='.$Parent,array('size' => $Row[0]));198 $DbResult = $Database->query("SELECT SUM(size) FROM NetworkShareItem WHERE parent=".$Parent); 199 $Row = $DbResult->fetch_array(); 200 $Database->update('NetworkShareItem','id='.$Parent,array('size' => $Row[0])); 201 201 202 202 // Zaktivuj strom … … 207 207 $NewID = $Row['id']; 208 208 $Database->select_db('share'); 209 $Database->query("DELETE FROM itemsWHERE host=".$NewID);210 $Database->update(' items','host='.$HostID,array('host' => $NewID));209 $Database->query("DELETE FROM NetworkShareItem WHERE host=".$NewID); 210 $Database->update('NetworkShareItem','host='.$HostID,array('host' => $NewID)); 211 211 echo("OK\n"); 212 212 … … 219 219 220 220 $Database->select_db('share'); 221 $DbResult = $Database->query("SELECT SUM(size) FROM itemsWHERE ((parent=1) AND (host IN (".substr($Vyber,0,-1).')))');222 $Row = $DbResult->fetch_array(); 223 $Database->update(' items','id=1',array('size' => $Row[0]));221 $DbResult = $Database->query("SELECT SUM(size) FROM NetworkShareItem WHERE ((parent=1) AND (host IN (".substr($Vyber,0,-1).')))'); 222 $Row = $DbResult->fetch_array(); 223 $Database->update('NetworkShareItem','id=1',array('size' => $Row[0])); 224 224 225 225 // Zapiš chyby do databáze 226 226 echo("Chyby sdílení...\n"); 227 $Database->delete(' errors', 'host="'.$Host.'"');227 $Database->delete('NetworkShareError', 'host="'.$Host.'"'); 228 228 if(is_dir($TempDir.'errors')) 229 229 { … … 244 244 { 245 245 $Row = substr($ShareFull.'/'.substr($Row, 39), 0, -1); 246 $Database->insert(' errors', array('host' => $Host, 'message' => $Row));246 $Database->insert('NetworkShareError', array('host' => $Host, 'message' => $Row)); 247 247 echo($Row."\n"); 248 248 } -
trunk/Modules/NetworkShare/update.php
r40 r362 9 9 $Hosts = array(); 10 10 $StartTime = GetMicrotime(); 11 $DbResult = $Database->query("SELECT * FROM hosts WHERE online=1 AND (block=0 OR name='centrala') AND (name!='GATE') AND user>0");11 $DbResult = $Database->query("SELECT * FROM NetworkDevice WHERE Online=1 AND (block=0 OR Name='centrala') AND (name!='GATE') AND user>0"); 12 12 while($Row = $DbResult->fetch_array()) 13 13 { … … 29 29 30 30 // Oprav a zoptimalizuj tabulku 31 $Database->select_db('share');31 //$Database->select_db('share'); 32 32 echo('Opravuji tabulku...'); 33 $Database->query('REPAIR TABLE items');33 $Database->query('REPAIR TABLE NetworkShareItem'); 34 34 echo("\nOptimalizuji tabulku..."); 35 $Database->query('OPTIMIZE TABLE items');35 $Database->query('OPTIMIZE TABLE NetworkShareItem'); 36 36 37 37 echo("\nDoba procháení ".date("H:i:s",$Rozdil-3600)."\n\n");
Note:
See TracChangeset
for help on using the changeset viewer.