Changeset 285
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/global_function.php
r284 r285 38 38 $PageCount = ceil($TotalCount / $ItemPerPage); 39 39 40 if(!array_key_exists('Page', $_SESSION)) $_SESSION['Page'] = 0; 40 41 if(array_key_exists('page', $_GET)) $_SESSION['Page'] = $_GET['page'] * 1; 41 42 if($_SESSION['Page'] < 0) $_SESSION['Page'] = 0; -
trunk/log.php
r284 r285 6 6 { 7 7 $Items = array(); 8 if(array_key_exists('type', $_GET)) $Where = ' WHERE type = "'. $_GET['type'].'"';8 if(array_key_exists('type', $_GET)) $Where = ' WHERE type = "'.($_GET['type'] * 1).'"'; 9 9 else $Where = ''; 10 10 $sql = 'SELECT *,UNIX_TIMESTAMP(date), (SELECT user.user FROM user WHERE user.id = log.user) as user FROM log'.$Where.' ORDER BY date DESC LIMIT 100'; … … 12 12 while($Line = mysql_fetch_assoc($ID)) 13 13 { 14 if(array_key_exists($Line['type'], $LogTypes)) $TypeName = $LogTypes[$Line['type']]['Name']; 15 else $TypeName = ''; 14 16 $Items[] = array 15 (16 'Title' => strip_tags($ LogTypes[$Line['type']]['Name'].': '.$Line['text'].' ('.$Line['user'].', '.$Line['IP'].')'),17 ( 18 'Title' => strip_tags($TypeName.': '.$Line['text'].' ('.$Line['user'].', '.$Line['IP'].')'), 17 19 'Link' => $Config['Web']['BaseURL'].'log.php', 18 'Description' => $ LogTypes[$Line['type']]['Name'].': '.$Line['text'].' ('.$Line['user'].', '.$Line['IP'].')',20 'Description' => $TypeName.': '.$Line['text'].' ('.$Line['user'].', '.$Line['IP'].')', 19 21 'Time' => $Line['UNIX_TIMESTAMP(date)'], 20 22 ); -
trunk/save.php
r278 r285 31 31 if(!$Line) 32 32 { 33 34 35 36 33 $Columns = '`Language` , `User` , `Complete` , `Take` , `VersionStart` , `VersionEnd`'; 34 $Values = $Language.','.$UserID.','.$complete.','.$TextID.','.$LineTake['VersionStart'].','.$LineTake['VersionEnd']; 35 foreach($TranslationTree[$GroupId]['Items'] as $GroupItem) 36 { 37 37 if(array_key_exists($GroupItem['Column'], $_POST)) 38 39 if (($GroupItem['Column'] <> 'ShortCut') and ($GroupItem['Column'] <> 'Rank')){40 41 42 43 44 45 38 { 39 if (($GroupItem['Column'] <> 'ShortCut') and ($GroupItem['Column'] <> 'Rank')) { 40 $Columns .= ', `'.$GroupItem['Column'].'`'; 41 $Values .= ', "'.@$_POST[$GroupItem['Column']].'"'; 42 } 43 } 44 } 45 //echo('INSERT INTO `'.$Table.'` ('.$Columns.') VALUES ('.$Values.')'); 46 46 // $Database->SQLCommand('INSERT INTO `'.$Table.'` (`entry`, '.$Columns.') VALUES ('.$entry.','.$Values.')'); 47 47 // $LastID = mysql_insert_id(); 48 48 49 50 51 52 53 54 55 49 //kontrolování stejných textů 50 51 52 $Where = 'Language = 0'; 53 foreach($TranslationTree[$GroupId]['Items'] as $GroupItem) 54 { 55 if (($GroupItem['Column'] <> 'ShortCut') and ($GroupItem['Column'] <> 'Rank')) 56 56 if(array_key_exists($GroupItem['Column'], $_POST)) { 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 if ($GroupItem['Column'] <> 'ShortCut') {79 80 $Rank_number = substr($SameTranLine['Rank'], strpos($SameTranLine['Rank'],' ')+1); 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 57 $Where .= ' AND `'.$GroupItem['Column'].'` = "'.addslashes($LineAJ[$GroupItem['Column']]).'"'; 58 } else { 59 $Where .= ' AND `'.$GroupItem['Column'].'` = ""'; 60 } 61 if ($GroupItem['Column'] == 'Rank') { 62 if (array_key_exists('Rank',$_POST)) { 63 $Rank = substr($_POST['Rank'], 0 ,strpos($_POST['Rank'],' ')); 64 if (strlen($Rank)<= 2) 65 $Rank = substr($_POST['Rank'], strpos($_POST['Rank'],' ')+1); 66 } else { 67 $Rank = 'Úroveň'; 68 } 69 } 70 } 71 72 $SameTranID = $Database->SQLCommand('SELECT * FROM '.$Table.' WHERE '.$Where); 73 while($SameTranLine = mysql_fetch_assoc($SameTranID)) 74 { 75 $Line = mysql_fetch_array($Database->SQLCommand('SELECT * FROM '.$Table.' WHERE user='.$UserID.' AND entry = '.$SameTranLine['entry'].' 76 AND VersionStart = '.$LineTake['VersionStart'].' AND VersionEnd = '.$LineTake['VersionEnd'])); 77 if(!$Line) { 78 if ($GroupItem['Column'] <> 'ShortCut') { 79 if (isset($Rank)) { 80 $Rank_number = substr($SameTranLine['Rank'], strpos($SameTranLine['Rank'],' ')+1); 81 if ($Rank_number <> '') { 82 $Rank_cur = $Rank.' '.$Rank_number; 83 } else { 84 $Rank_cur = $SameTranLine['Rank']; 85 } 86 $Database->SQLCommand('INSERT INTO `'.$Table.'` (`entry`, '.$Columns.', `Rank`) VALUES ('.$SameTranLine['entry'].','.$Values.',"'.$Rank_cur.'")'); 87 } else { 88 $Database->SQLCommand('INSERT INTO `'.$Table.'` (`entry`, '.$Columns.') VALUES ('.$SameTranLine['entry'].','.$Values.')'); 89 } 90 } else { 91 $Database->SQLCommand('INSERT INTO `'.$Table.'` (`entry`, '.$Columns.', `ShortCut`) VALUES ('.$SameTranLine['entry'].','.$Values.',"'.$SameTranLine['ShortCut'].'")'); 92 } 93 $LastIDs[] = mysql_insert_id(); 94 } 95 } 96 97 //konec kontrolování stejných textů 98 99 echo('Překlad <a href="form.php?group='.$GroupId.'&ID='.$TextID.'">'.$TextID.'</a> ('.$entry.') uložen!<br />'); 100 foreach($LastIDs as $LastID) 101 { 102 if (count($LastIDs) > 1) echo 'Nalezen stejný překlad, systémově přeložen: <a href="form.php?group='.$GroupId.'&ID='.$LastID.'">'.$LastID.'</a> Převzat z: <a href="form.php?group='.$GroupId.'&ID='.$TextID.'">'.$TextID.'</a><br />'; 103 103 WriteLog('Text <a href="form.php?group='.$GroupId.'&ID='.$LastID.'">'.$LastID.'</a> ze skupiny <a href="?group='.$GroupId.'&action=filter">'.$TranslationTree[$GroupId]['Name'].'</a> uložen! Převzat z <a href="form.php?group='.$GroupId.'&ID='.$TextID.'">'.$TextID.'</a>.', 1); 104 104 } 105 105 } else 106 106 { 107 107 $sql = 'UPDATE '.$Table.' SET `Complete` = '.$complete; 108 109 110 111 112 108 foreach($TranslationTree[$GroupId]['Items'] as $GroupItem) 109 if(array_key_exists($GroupItem['Column'], $_POST)) 110 $sql .= ', `'.$GroupItem['Column'].'`="'.$_POST[$GroupItem['Column']].'"'; 111 $sql .= ', `Language` = '.$Language.' WHERE ID = '.$TextID.' AND Language <> 0'; 112 //echo($sql); 113 113 $Database->SQLCommand($sql); 114 114 // echo $sql.'<br />'; … … 116 116 WriteLog('Změny v překladu <a href="form.php?group='.$GroupId.'&ID='.$TextID.'">'.$TextID.'</a> ('.$entry.') uloženy!', 1); 117 117 } 118 118 //addres and redirecting 119 119 echo('<br />Překládat: <a href="TranslationList.php?group='.$GroupId.'&action=notran">Nepřeložené</a> '); 120 120 … … 122 122 $next = FollowingTran($TextID,$Table,$GroupId); 123 123 echo('<br /><br />'); 124 124 $redirecting = mysql_fetch_assoc($Database->SQLCommand('SELECT redirecting FROM user WHERE ID='.$UserID)); 125 125 126 126 switch ($redirecting['redirecting']) { 127 127 case 1: 128 128 echo('<script type="text/javascript" language="JavaScript" charset="utf-8">'. 129 129 'setTimeout("parent.location.href=\''.htmlspecialchars_decode('TranslationList.php?group='.$GroupId.'&action=notran').'\'", 1500)'. 130 130 '</script>'); 131 131 break; 132 133 132 case 2: 133 if ($next <> '') 134 134 echo('<script type="text/javascript" language="JavaScript" charset="utf-8">'. 135 135 'setTimeout("parent.location.href=\''.htmlspecialchars_decode($next).'\'", 1500)'. 136 136 '</script>'); 137 137 break; 138 139 138 case 3: 139 if ($prev <> '') 140 140 echo('<script type="text/javascript" language="JavaScript" charset="utf-8">'. 141 141 'setTimeout("parent.location.href=\''.htmlspecialchars_decode($prev).'\'", 1500)'. 142 142 '</script>'); 143 143 break; 144 145 146 144 } 145 146 echo ('Z této stránky můžete být automaticky přesměrování. Nastavit kam chcete být přesměrování si můžete v <a href="'.$Config['Web']['BaseURL'].'Options.php" Title = "Nastavení uživatele">Nastavení</a>'); 147 147 148 148 $Database->SQLCommand('UPDATE `user` SET `NeedUpdate` = 1 WHERE ID = '.$UserID); //informace o nutnosti načíst XP 149 149 } else 150 150 { 151 151 if(array_key_exists('entry', $_POST)) 152 152 { 153 153 echo('Byli jste automaticky odhlášeni. Pro <strong>Uložení překladu</strong> se musíte přihlásit zde:<br /><br />'); 154 154 echo('<form action="save.php?group='.$GroupId.'" method="post"><div>'); 155 156 155 echo('<input type="hidden" name="entry" value="'.$_POST['entry'].'" />'. 156 '<input type="hidden" name="user" value="'.$_POST['user'].'" />'. 157 157 '<input type="hidden" name="ID" value="'.$_POST['ID'].'" />'. 158 158 '<input type="hidden" name="Language" value="'.$_POST['Language'].'" />'); 159 159 160 161 echo('<input id="'.$TextItem['Column'].'" name="'.$TextItem['Column'].'" type="hidden" value="'.htmlspecialchars($_POST[$TextItem['Column']]).'" />'); 162 163 echo(' <table> 164 <tr>165 <td>Jméno: <input type="text" name="LoginUser" size="13" /></td>166 </tr>167 <tr>168 <td>Heslo: <input type="password" name="LoginPass" size="13" /></td>169 </tr>170 <tr>171 <th><input type="submit" value="Přihlásit a uložit překlad" /></th>172 </tr>173 </table>');174 160 foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 161 { 162 if(array_key_exists($TextItem['Column'], $_POST)) $Value = $_POST[$TextItem['Column']]; else $Value = ''; 163 echo('<input id="'.$TextItem['Column'].'" name="'.$TextItem['Column'].'" type="hidden" value="'.htmlspecialchars($Value).'" />'); 164 } 165 echo('<table>'. 166 '<tr>'. 167 '<td>Jméno: <input type="text" name="LoginUser" size="13" /></td>'. 168 '</tr><tr>'. 169 '<td>Heslo: <input type="password" name="LoginPass" size="13" /></td>'. 170 '</tr><tr>'. 171 '<th><input type="submit" value="Přihlásit a uložit překlad" /></th>'. 172 '</tr>'. 173 '</table>'); 174 } else echo('Na tuto stránku nelze vstoupit přímo.'); 175 175 } 176 176
Note:
See TracChangeset
for help on using the changeset viewer.