Changeset 123 for trunk/save.php
- Timestamp:
- Feb 22, 2009, 7:51:01 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/save.php
r112 r123 22 22 //if(( == '') AND ($complete == 1)) die('Musite zadat název textu'); 23 23 24 $LineAJ = mysql_fetch_array($Database->SQLCommand('SELECT * FROM '.$Table.' WHERE Language = 0 AND entry = '.$entry)); 24 25 $Line = mysql_fetch_array($Database->SQLCommand('SELECT * FROM '.$Table.' WHERE user='.$UserID.' AND entry = '.$entry)); 25 26 if(!$Line) 26 27 { 27 $Columns = '` entry`, `Language` , `User` , `Complete` , `Take`';28 $Values = $ entry.','.$Language.','.$UserID.','.$complete.','.$TextID;28 $Columns = '`Language` , `User` , `Complete` , `Take`'; 29 $Values = $Language.','.$UserID.','.$complete.','.$TextID; 29 30 foreach($TranslationTree[$GroupId]['Items'] as $GroupItem) 30 31 { … … 36 37 } 37 38 //echo('INSERT INTO `'.$Table.'` ('.$Columns.') VALUES ('.$Values.')'); 38 $Database->SQLCommand('INSERT INTO `'.$Table.'` ('.$Columns.') VALUES ('.$Values.')'); 39 $LastID = mysql_insert_id(); 40 echo('Překlad <a href="form.php?group='.$GroupId.'&ID='.$TextID.'">'.$TextID.'</a> uložen!<br />'); 41 WriteLog($TranslationTree[$GroupId]['Name'].' <a href="form.php?group='.$GroupId.'&ID='.$LastID.'">'.$LastID.'</a> uložen! Převzat z: <a href="form.php?group='.$GroupId.'&ID='.$TextID.'">'.$TextID.'</a>', 1); 42 } else 43 { 39 // $Database->SQLCommand('INSERT INTO `'.$Table.'` (`entry`, '.$Columns.') VALUES ('.$entry.','.$Values.')'); 40 // $LastID = mysql_insert_id(); 41 42 //kontrolování stejných textů 43 $Where = 'Language = 0 '; 44 foreach($TranslationTree[$GroupId]['Items'] as $GroupItem) 45 { 46 if(array_key_exists($GroupItem['Column'], $_POST)) 47 { 48 $Where .= ' AND `'.$GroupItem['Column'].'` = "'.$LineAJ[$GroupItem['Column']].'"'; 49 } 50 } 51 $SameTranID = $Database->SQLCommand('SELECT * FROM '.$Table.' WHERE '.$Where); 52 while($SameTranLine = mysql_fetch_assoc($SameTranID)) { 53 $Line = mysql_fetch_array($Database->SQLCommand('SELECT * FROM '.$Table.' WHERE user='.$UserID.' AND entry = '.$SameTranLine['entry'])); 54 if(!$Line) { 55 $Database->SQLCommand('INSERT INTO `'.$Table.'` (`entry`, '.$Columns.') VALUES ('.$SameTranLine['entry'].','.$Values.')'); 56 $LastIDs[] = mysql_insert_id(); 57 } 58 } 59 60 echo('Překlad <a href="form.php?group='.$GroupId.'&ID='.$TextID.'">'.$TextID.'</a> uložen!<br />'); 61 foreach($LastIDs as $LastID) { 62 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 />'; 63 WriteLog($TranslationTree[$GroupId]['Name'].' <a href="form.php?group='.$GroupId.'&ID='.$LastID.'">'.$LastID.'</a> uložen! Převzat z: <a href="form.php?group='.$GroupId.'&ID='.$TextID.'">'.$TextID.'</a>', 1); 64 } 65 } else { 44 66 $sql = 'UPDATE '.$Table.' SET `Complete` = '.$complete; 45 67 foreach($TranslationTree[$GroupId]['Items'] as $GroupItem)
Note:
See TracChangeset
for help on using the changeset viewer.