Changeset 376 for trunk/export/index.php
- Timestamp:
- Mar 11, 2010, 8:40:32 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/export/index.php
r366 r376 6 6 function ExportList() 7 7 { 8 global $Database ;8 global $Database, $User; 9 9 10 10 echo('<a href="?Action=ViewList">Všechny</a>'); 11 if( Licence(LICENCE_USER))11 if($User->Licence(LICENCE_USER)) 12 12 { 13 13 echo(' <a href="?Action=ViewList&Filter=Others">Ostatních</a>'); … … 18 18 if(array_key_exists('Filter', $_GET)) 19 19 { 20 if($_GET['Filter'] == 'My') $Filter = ' WHERE `Export`.`User` = '.$ _SESSION['UserID'];21 if($_GET['Filter'] == 'Others') $Filter = ' WHERE `Export`.`User` != '.$ _SESSION['UserID'];20 if($_GET['Filter'] == 'My') $Filter = ' WHERE `Export`.`User` = '.$User->Id; 21 if($_GET['Filter'] == 'Others') $Filter = ' WHERE `Export`.`User` != '.$User->Id; 22 22 } 23 23 … … 46 46 { 47 47 $Action = '<a href="?Action=View&ExportId='.$Export['Id'].'">Zobrazit</a> <a href="?Action=View&ExportId='.$Export['Id'].'&Tab=6">Exportovat</a>'; 48 if($Export['User'] == $ _SESSION['UserID']) $Action .= ' <a href="?Action=Delete&ExportId='.$Export['Id'].'" onclick="return confirmAction(\'Opravdu smazat položku?\');">Smazat</a>';48 if($Export['User'] == $User->Id) $Action .= ' <a href="?Action=Delete&ExportId='.$Export['Id'].'" onclick="return confirmAction(\'Opravdu smazat položku?\');">Smazat</a>'; 49 49 echo('<tr><td>'.HumanDate($Export['TimeCreate']).'</td><td>'.$Export['UserName'].'</td><td>'.$Export['Title'].'</td><td>'.$Export['UsedCount'].'</td><td>'.$Export['UserCount'].'</td><td>'.$Export['GroupCount'].'</td><td>'.$Action.'</td></tr>'); 50 50 } … … 52 52 echo($PageList['Output']); 53 53 54 if( Licence(LICENCE_USER)) echo('<br/><div style="text-align: center;"><a href="?Action=Create">Vytvořit nový export</a></div>');54 if($User->Licence(LICENCE_USER)) echo('<br/><div style="text-align: center;"><a href="?Action=Create">Vytvořit nový export</a></div>'); 55 55 } 56 56 57 57 function ExportCreate() 58 58 { 59 global $Database, $Config ;60 61 if( Licence(LICENCE_USER))59 global $Database, $Config, $User; 60 61 if($User->Licence(LICENCE_USER)) 62 62 { 63 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM Export WHERE User='.$_SESSION['UserID']);63 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `Export` WHERE `User`='.$User->Id); 64 64 $DbRow = mysql_fetch_row($DbResult); 65 65 if($DbRow[0] < $Config['MaxExportPerUser']) … … 77 77 function ExportCreateFinish() 78 78 { 79 global $Database, $Config ;80 81 if( Licence(LICENCE_USER))79 global $Database, $Config, $User; 80 81 if($User->Licence(LICENCE_USER)) 82 82 { 83 83 if(array_key_exists('Title', $_POST) and array_key_exists('Description', $_POST)) 84 84 { 85 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `Export` WHERE `User`='.$ _SESSION['UserID']);85 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `Export` WHERE `User`='.$User->Id); 86 86 $DbRow = mysql_fetch_row($DbResult); 87 87 if($DbRow[0] < $Config['MaxExportPerUser']) 88 88 { 89 $Database->SQLCommand('INSERT INTO `Export` (`Title`, `User`, `TimeCreate`, `WithDiacritic`, `Description`) VALUES ("'.$_POST['Title'].'", '.$ _SESSION['UserID'].', NOW(), 1, "'.$_POST['Description'].'")');89 $Database->SQLCommand('INSERT INTO `Export` (`Title`, `User`, `TimeCreate`, `WithDiacritic`, `Description`) VALUES ("'.$_POST['Title'].'", '.$User->Id.', NOW(), 1, "'.$_POST['Description'].'")'); 90 90 $ExportId = mysql_insert_id(); 91 91 echo('Nový export vytvořen.<br/>Přímý odkaz na tento export: <a href="?Action=View&ExportId='.$ExportId.'">zde</a><br/><br/>'); … … 100 100 function ExportDelete() 101 101 { 102 global $Database ;103 104 if( Licence(LICENCE_USER))102 global $Database, $User; 103 104 if($User->Licence(LICENCE_USER)) 105 105 { 106 106 if(array_key_exists('ExportId', $_GET)) 107 107 { 108 $DbResult = $Database->SQLCommand('SELECT * FROM Export WHERE Id='.$_GET['ExportId'].' AND User='.$_SESSION['UserID']);108 $DbResult = $Database->SQLCommand('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId'].' AND `User`='.$User->Id); 109 109 if(mysql_num_rows($DbResult) > 0) 110 110 { 111 $Database->SQLCommand('DELETE FROM Export WHERE Id='.$_GET['ExportId']);111 $Database->SQLCommand('DELETE FROM `Export` WHERE `Id`='.$_GET['ExportId']); 112 112 DeleteDirectory('../tmp/Export/'.$_GET['ExportId'].'/'); 113 113 echo('Export smazán.<br/><br/>'); … … 122 122 function ExportViewTranslators() 123 123 { 124 global $Database, $TranslationTree, $Config ;124 global $Database, $TranslationTree, $Config, $User; 125 125 126 126 $DisabledInput = array(false => ' disabled="disabled"', true => ''); … … 131 131 { 132 132 $Export = mysql_fetch_assoc($DbRows); 133 if( Licence(LICENCE_USER) and ($_SESSION['UserID']== $Export['User'])) $Editable = true;133 if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; 134 134 else $Editable = false; 135 135 … … 204 204 $Database->SQLCommand('SET @I = 0'); 205 205 $DbResult = $Database->SQLCommand($Query); 206 while($User = mysql_fetch_assoc($DbResult))207 { 208 $Checked = $User ['Sequence'] != '';209 $Selection = CheckBox('sel'.$User ['ID'], $Checked, '', 'CheckBox', !$Editable);210 $Sequence = '<input type="text" name="seq'.$User ['ID'].'" style="text-align: center; width: 40px;" value="'.$User['Sequence2'].'"'.$DisabledInput[$Editable].'/>';206 while($UserLine = mysql_fetch_assoc($DbResult)) 207 { 208 $Checked = $UserLine['Sequence'] != ''; 209 $Selection = CheckBox('sel'.$UserLine['ID'], $Checked, '', 'CheckBox', !$Editable); 210 $Sequence = '<input type="text" name="seq'.$UserLine['ID'].'" style="text-align: center; width: 40px;" value="'.$UserLine['Sequence2'].'"'.$DisabledInput[$Editable].'/>'; 211 211 echo('<tr> 212 <td><a href="'.$Config['Web']['BaseURL'].'/TranslationList.php?user='.$User ['ID'].'&action=userall" title="Zobrazit všechny jeho přeložené texty">'.$User['Name'].'</a></td>213 <td>'.$User ['TranslatedCount'].'</td>214 <td><img src="'.$Config['Web']['TempFolder'].'/user/'.$User ['Name'].'/level.png" alt="Úroveň uživatele" /></td>212 <td><a href="'.$Config['Web']['BaseURL'].'/TranslationList.php?user='.$UserLine['ID'].'&action=userall" title="Zobrazit všechny jeho přeložené texty">'.$UserLine['Name'].'</a></td> 213 <td>'.$UserLine['TranslatedCount'].'</td> 214 <td><img src="'.$Config['Web']['TempFolder'].'/user/'.$UserLine['Name'].'/level.png" alt="Úroveň uživatele" /></td> 215 215 <td>'.$Selection.'</td><td>'.$Sequence.'</td></tr>'); 216 216 } … … 224 224 function ExportViewGeneral() 225 225 { 226 global $Database ;226 global $Database, $User; 227 227 228 228 $DisabledInput = array(false => ' disabled="disabled"', true => ''); … … 235 235 { 236 236 $Export = mysql_fetch_assoc($DbRows); 237 if( Licence(LICENCE_USER) and ($_SESSION['UserID']== $Export['User'])) $Editable = true;237 if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; 238 238 else $Editable = false; 239 239 if($Editable and array_key_exists('Title', $_POST) and array_key_exists('Description', $_POST)) … … 264 264 function ExportViewLanguages() 265 265 { 266 global $Database, $TranslationTree, $Config ;266 global $Database, $TranslationTree, $Config, $User; 267 267 268 268 $DisabledInput = array(false => ' disabled="disabled"', true => ''); … … 273 273 { 274 274 $Export = mysql_fetch_assoc($DbRows); 275 if( Licence(LICENCE_USER) and ($_SESSION['UserID']== $Export['User'])) $Editable = true;275 if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; 276 276 else $Editable = false; 277 277 … … 357 357 function ExportViewGroups() 358 358 { 359 global $Database, $TranslationTree, $Config ;359 global $Database, $TranslationTree, $Config, $User; 360 360 361 361 $DisabledInput = array(false => ' disabled="disabled"', true => ''); … … 366 366 { 367 367 $Export = mysql_fetch_assoc($DbRows); 368 if( Licence(LICENCE_USER) and ($_SESSION['UserID']== $Export['User'])) $Editable = true;368 if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; 369 369 else $Editable = false; 370 370 … … 446 446 function ExportViewOutputFormat() 447 447 { 448 global $Database ;448 global $Database, $User; 449 449 450 450 $DisabledInput = array(false => ' disabled="disabled"', true => ''); … … 455 455 { 456 456 $Export = mysql_fetch_assoc($DbRows); 457 if( Licence(LICENCE_USER) and ($_SESSION['UserID']== $Export['User'])) $Editable = true;457 if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; 458 458 else $Editable = false; 459 459 … … 485 485 function ExportViewVersion() 486 486 { 487 global $Database, $Config ;487 global $Database, $Config, $User; 488 488 489 489 $DisabledInput = array(false => ' disabled="disabled"', true => ''); … … 494 494 { 495 495 $Export = mysql_fetch_assoc($DbRows); 496 if( Licence(LICENCE_USER) and ($_SESSION['UserID']== $Export['User'])) $Editable = true;496 if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; 497 497 else $Editable = false; 498 498 … … 572 572 $Export = mysql_fetch_assoc($DbResult); 573 573 $DbResult = $Database->SQLCommand('SELECT * FROM `User` WHERE `ID`='.$Export['User']); 574 $User = mysql_fetch_assoc($DbResult);575 echo('Export <strong><a href="?Action=View&Tab=6&ExportId='.$Export['Id'].'">'.$_GET['ExportId'].'</a></strong> překladatele <strong>'.$User ['Name'].'</strong> s označením <strong>'.$Export['Title'].'</strong>');574 $UserLine = mysql_fetch_assoc($DbResult); 575 echo('Export <strong><a href="?Action=View&Tab=6&ExportId='.$Export['Id'].'">'.$_GET['ExportId'].'</a></strong> překladatele <strong>'.$UserLine['Name'].'</strong> s označením <strong>'.$Export['Title'].'</strong>'); 576 576 ShowTabs(array('Obecné', 'Překladatelé', 'Překlady', 'Jazyky', 'Formát', 'Verze', 'Výstup')); 577 577 echo('<div id="content">');
Note:
See TracChangeset
for help on using the changeset viewer.