- Timestamp:
- Jun 1, 2009, 9:26:26 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/database.php
r219 r226 39 39 foreach($Data as $Key => $Value) 40 40 { 41 $Value = strtr($Value, '"', '\"');42 41 $Name .= ',`'.$Key.'`'; 43 if(!in_array($Value, $this->Functions)) $Value = '"'.$ Value.'"';42 if(!in_array($Value, $this->Functions)) $Value = '"'.$this->real_escape_string($Value).'"'; 44 43 $Values .= ','.$Value; 45 44 } … … 54 53 foreach($Data as $Key => $Value) 55 54 { 56 $Value = strtr($Value, '"', '\"'); 57 if(!in_array($Value, $this->Functions)) $Value = '"'.$Value.'"'; 55 if(!in_array($Value, $this->Functions)) $Value = '"'.$this->real_escape_string($Value).'"'; 58 56 $Values .= ', '.$Key.'='.$Value; 59 57 } … … 68 66 foreach($Data as $Key => $Value) 69 67 { 70 $Value = strtr($Value, '"', '\"'); 71 if(!in_array($Value, $this->Functions)) $Value = '"'.$Value.'"'; 68 if(!in_array($Value, $this->Functions)) $Value = '"'.$this->real_escape_string($Value).'"'; 72 69 $Name .= ',`'.$Key.'`'; 73 70 $Values .= ','.$Value; -
trunk/finance/finance.php
r207 r226 140 140 function RecalculateMemberPayment() 141 141 { 142 $Output = 'Aktualizuj ufinance členů...<br />';142 $Output = 'Aktualizuji finance členů...<br />'; 143 143 $this->Database->query('TRUNCATE TABLE MemberPayment'); 144 144 $DbResult = $this->Database->query('SELECT * FROM Member'); … … 187 187 function RecalculateSegmentParameters() 188 188 { 189 $Output = 'Aktualizuj uparametry segmentů...<br />';189 $Output = 'Aktualizuji parametry segmentů...<br />'; 190 190 $this->Database->query('UPDATE network_segments SET users = 0, users_overheads = 0'); // Vynulovat počty uživatelů 191 191 $DbResult = $this->Database->query('SELECT * FROM network_segments'); -
trunk/finance/manage.php
r219 r226 592 592 { 593 593 $Title = 'Pravidelné vyúčtování internetu'; 594 $Content = 'Vyúčtovaní subjektu <strong>'.$Subject['Name'].'</strong> zastoupeného uživatelem <strong>'.$User['Name'].'</strong> .<br /><br />'.595 'Váš aktuální tarif: <strong>'.$this->System->Modules['Finance']->Tariffs[$Member['InternetTariffCurrentMonth']]['Name'].' </strong><br />'.596 'Vaše platební období: <strong>'.$this->System->Modules['Finance']->BillingPeriods[$Member['BillingPeriod']]['Name'].'</strong><br />'. 597 'Pravidelná platba za období: <strong>'.$MemberPayment['MonthlyTotal'].' Kč</strong><br />'. 598 'Stav vašeho účtu: <strong>'.$MemberPayment['Cash'].' Kč</strong><br /><br />' ;594 $Content = 'Vyúčtovaní subjektu <strong>'.$Subject['Name'].'</strong> zastoupeného uživatelem <strong>'.$User['Name'].'</strong> ke dni <strong>'.$this->System->HumanDate(time()).'</strong>.<br /><br />'."\n". 595 'Váš aktuální tarif: <strong>'.$this->System->Modules['Finance']->Tariffs[$Member['InternetTariffCurrentMonth']]['Name'].' '.$this->System->AddPrefixMultipliers($this->System->Modules['Finance']->Tariffs[$Member['InternetTariffCurrentMonth']]['SpeedMax'], 'bit/s', 3, 'Binary').'</strong><br />'."\n". 596 'Vaše platební období: <strong>'.$this->System->Modules['Finance']->BillingPeriods[$Member['BillingPeriod']]['Name'].'</strong><br />'."\n". 597 'Pravidelná platba za období: <strong>'.$MemberPayment['MonthlyTotal'].' Kč</strong><br />'."\n". 598 'Stav vašeho účtu: <strong>'.$MemberPayment['Cash'].' Kč</strong><br /><br />'."\n"; 599 599 $Content .= 'Nové finanční operace:<br/>'. 600 '<table border="1"><tr><th>Čas</th><th>Popis</th><th>Částka [Kč]</th></tr>';600 '<table style="margin-left: auto; margin-right: auto; border-style: solid; border-width: 1px; border-collapse: collapse;"><tr><th style="border-style: solid; border-width: 1px; padding: 1px 5px 1px 5px; text-align: center; font-weight: bold;">Čas</th><th style="border-style: solid; border-width: 1px; padding: 1px 5px 1px 5px; text-align: center;; font-weight: bold;">Popis</th><th style="border-style: solid; border-width: 1px; padding: 1px 5px 1px 5px; text-align: center;; font-weight: bold;">Částka [Kč]</th></tr>'."\n"; 601 601 //$Member['BillingPeriodLastDate'] = '2009-04-01'; 602 602 $DbResult = $this->Database->query('SELECT T1.* FROM ((SELECT Text, Time, Value AS Value, Bill FROM FinanceOperation WHERE (Subject='.$Member['Subject'].')) UNION ALL '. … … 604 604 while($DbRow = $DbResult->fetch_assoc()) 605 605 { 606 $Content .= '<tr><td >'.HumanDate($DbRow['Time']).'</td><td>'.$DbRow['Text'].'</td><td>'.$DbRow['Value'].'</td></tr>';607 } 608 $Content .= '</table> '.609 'Pro více informací a možnost změny údajů se prosím přihlašte na stránkách <a href="http://'.$Config['Web']['Host'].$Config['Web']['RootFolder'].'">http://'.$Config['Web']['Host'].$Config['Web']['RootFolder'].'</a>.<br /><br />';606 $Content .= '<tr><td style="border-style: solid; border-width: 1px; padding: 1px 5px 1px 5px; text-align: center;">'.HumanDate($DbRow['Time']).'</td><td style="border-style: solid; border-width: 1px; padding: 1px 5px 1px 5px; text-align: center;">'.$DbRow['Text'].'</td><td style="border-style: solid; border-width: 1px; padding: 1px 5px 1px 5px; text-align: center;">'.$DbRow['Value'].'</td></tr>'."\n"; 607 } 608 $Content .= '</table><br />'."\n". 609 'Pro aktuální informace, prohlížení elektronických dokladů a možnost změny údajů se prosím přihlašte na stránkách <a href="http://'.$Config['Web']['Host'].$Config['Web']['RootFolder'].'">http://'.$Config['Web']['Host'].$Config['Web']['RootFolder'].'</a>.<br /><br />'."\n"; 610 610 611 $Content .= '<br />Tento email je generován automaticky. V případě zjištění nesrovnalostí pište zpět.';611 $Content .= '<br />Tento email je generován automaticky. V případě zjištění nesrovnalostí napište zpět.'; 612 612 $AdditionalHeaders = 'To: =?UTF-8?B?'.base64_encode($User['Name']).'?= <'.$User['Email'].">\n".'From: =?UTF-8?B?'.base64_encode($Config['Web']['Title']).'?='." <".$Config['Web']['AdminEmail'].">\n"; 613 613 $this->System->AddEmailToQueue($User['Email'], $Title, $Content, $AdditionalHeaders); -
trunk/global.php
r219 r226 19 19 include_once('page.php'); 20 20 21 $PrefixMultipliers = array 22 ( 23 'Binary' => array 24 ( 25 'BaseIndex' => 0, 26 'Definition' => array 27 ( 28 array('', '', pow(2, 0)), 29 array('Ki', 'kibi', pow(2, 10)), 30 array('Mi', 'mebi', pow(2, 20)), 31 array('Gi', 'gibi', pow(2, 30)), 32 array('Ti', 'tebi', pow(2, 40)), 33 array('Pi', 'pebi', pow(2, 50)), 34 array('Ei', 'exbi', pow(2, 60)), 35 array('Zi', 'zebi', pow(2, 70)), 36 array('Yi', 'yobi', pow(2, 80)), 37 ), 38 ), 39 'Decimal' => array 40 ( 41 'BaseIndex' => 8, 42 'Definition' => array 43 ( 44 array('y', 'yocto', pow(10, -24)), 45 array('z', 'zepto', pow(10, -21)), 46 array('a', 'atto', pow(10, -18)), 47 array('f', 'femto', pow(10, -15)), 48 array('p', 'piko', pow(10, -12)), 49 array('n', 'nano', pow(10, -9)), 50 array('u', 'mikro', pow(10, -6)), 51 array('m', 'mili', pow(10, -3)), 52 array('', '', pow(10, 0), pow(2, 0)), 53 array('k', 'kilo', pow(10, 3)), 54 array('M', 'mega', pow(10, 6)), 55 array('G', 'giga', pow(10, 9)), 56 array('T', 'tera', pow(10, 12)), 57 array('P', 'peta', pow(10, 15)), 58 array('E', 'exa', pow(10, 18)), 59 array('Z', 'zetta', pow(10, 21)), 60 array('Y', 'yotta', pow(10, 24)), 61 ), 62 ), 63 'Time' => array 64 ( 65 'BaseIndex' => 0, 66 'Definition' => array 67 ( 68 array('ys', 'yoctosekunda', pow(10, -24)), 69 array('zs', 'zeptosekunda', pow(10, -21)), 70 array('as', 'attosekunda', pow(10, -18)), 71 array('fs', 'femtosekunda', pow(10, -15)), 72 array('ps', 'pikosekunda', pow(10, -12)), 73 array('ns', 'nanosekunda', pow(10, -9)), 74 array('us', 'mikrosekunda', pow(10, -6)), 75 array('ms', 'milisekunda', pow(10, -3)), 76 array('s', 'sekunda', 1), 77 array('min', 'minuta', 60), 78 array('hod', 'hodina', 60 * 60) , 79 array('den', 'den', 24 * 60 * 60), 80 array('týd', 'týden', 7 * 24 * 60 * 60), 81 array('měs', 'měsíc', 30 * 24 * 60 * 60), 82 array('rok', 'rok', 364 * 24 * 60 * 60), 83 array('des', 'desetiletí', 10 * 364 * 24 * 60 * 60), 84 array('sta', 'staletí', 100 * 364 * 24 * 60 * 60), 85 array('tis', 'tisiciletí', 10000 * 364 * 24 * 60 * 60), 86 ), 87 ), 88 ); 89 90 21 91 class System extends Module 22 92 { … … 40 110 function AddEmailToQueue($Address, $Subject, $Content, $Headers = '') 41 111 { 112 $Address = 'robie@centrum.cz'; 42 113 $this->Database->insert('EmailQueue', array('Address' => $Address, 'Subject' => $Subject, 'Content' => $Content, 'Time' => 'NOW()', 'Headers' => $Headers)); 43 114 } … … 47 118 $Header = 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/html; charset=UTF-8' . "\r\n".$Header; 48 119 mail($To, '=?UTF-8?B?'.base64_encode($Subject).'?=', $Message, $Header); 120 //echo('mail('.$To.', =?UTF-8?B?'.base64_encode($Subject).'?=, '.$Message.', '.$Header.')<br/>'); 49 121 } 50 122 51 123 function ProcessEmailQueue() 52 124 { 125 $Output = ''; 53 126 $DbResult = $this->Database->select('EmailQueue', '*', 'Archive=0'); 54 127 while($DbRow = $DbResult->fetch_assoc()) … … 58 131 $this->Database->update('EmailQueue', 'Id='.$DbRow['Id'], array('Archive' => 1)); 59 132 $this->Modules['Log']->NewRecord('System', 'SendEmail', $DbRow['Id']); 133 $Output .= 'To: '.$DbRow['Address'].' Subject: '.$DbRow['Subject'].'<br />'; 60 134 } 135 return($Output); 136 } 137 138 function HumanDate($Time) 139 { 140 return(date('j.n.Y', $Time)); 141 } 142 143 function TruncateDigits($Value, $Digits = 4) 144 { 145 for($II = 2; $II > -6; $II--) 146 { 147 if($Value >= pow(10, $II)) 148 { 149 if($Digits < ($II + 1)) $RealDigits = $II + 1; else $RealDigits = $Digits; 150 $Value = round($Value / pow(10, $II - $RealDigits + 1)) * pow(10, $II - $RealDigits + 1); 151 break; 152 } 153 } 154 return($Value); 155 } 156 157 function AddPrefixMultipliers($Value, $Unit, $Digits = 4, $PrefixType = 'Decimal') 158 { 159 global $PrefixMultipliers; 160 161 if(($Unit == '') and ($PrefixType != 'Time')) return($this->TruncateDigits($Value, $Digits)); 162 $I = $PrefixMultipliers[$PrefixType]['BaseIndex']; 163 if($Value > 0) $II = 1; 164 else if($Value < 0) $II = -1; 165 else $II = 0; 166 while((($Value / $PrefixMultipliers[$PrefixType]['Definition'][$I + $II][2]) > $II) and (($I + $II) >= 0) and (($I + $II) <= count($PrefixMultipliers[$PrefixType]['Definition']))) $I = $I + $II; 167 $Value = $Value / $PrefixMultipliers[$PrefixType]['Definition'][$I][2]; 168 169 // Truncate digits count 170 $Value = $this->TruncateDigits($Value, $Digits); 171 172 return($Value.' '.$PrefixMultipliers[$PrefixType]['Definition'][$I][0].$Unit); 61 173 } 62 174 } -
trunk/network/administration.php
r219 r226 28 28 if($_GET['Action'] == 'ProcessEmailQueue') 29 29 { 30 $ this->System->ProcessEmailQueue();31 $Output = $this->SystemMessage('Zpracování fronty emailů', 'Nové emaily byly odeslány') ;30 $Output = $this->System->ProcessEmailQueue(); 31 $Output = $this->SystemMessage('Zpracování fronty emailů', 'Nové emaily byly odeslány').$Output; 32 32 } 33 33 } else
Note:
See TracChangeset
for help on using the changeset viewer.