Changeset 49 for trunk/save.php
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:ignore
set to
SqlTranslate.zip
-
Property svn:ignore
set to
-
trunk/save.php
r43 r49 1 1 <?php 2 2 3 3 include('includes/global.php'); 4 4 5 // SQL injection hack protection6 foreach($_POST as $Index => $Item) $_POST[$Index] = addslashes($Item);7 foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($Item);8 5 9 //ochrana proti neoprávněnému přístupu10 if (Licence(0) == false) { die('Nemáte přístup do této sekce! Přihlašte se...'); } 6 // Ochrana proti neoprávněnému přístupu 7 if(Licence(LICENCE_USER) == false) die('Nemáte přístup do této sekce! Je nutné se přihásit.'); 11 8 12 if (array_key_exists('entry', $_POST)) { 9 if(array_key_exists('group', $_GET)) $GroupId = $_GET['group']; else $GroupId = 1; 10 $Table = $TranslationTree[$GroupId]['TablePrefix']; 11 12 if(array_key_exists('entry', $_POST)) 13 { 14 $entry = $_POST['entry']; 15 $UserID = $_SESSION['UserID']; 16 $TextID = $_POST['ID']; 17 $Language = $_POST['Language']; 18 if(array_key_exists('End', $_POST)) $complete = 1; 19 else $complete = 0; 20 21 if(array_key_exists('Repair', $_POST) and Licence(1)) 22 { 23 $Line = mysql_fetch_array($Database->SQLCommand('SELECT user FROM '.$Table.' Where ID = '.$TextID)); 24 $UserID = $Line['user']; 25 $complete = 1; 26 WriteLog($TranslationTree[$GroupId]['Name'].' '.$entry.' Opraven moderátorem! <a href="form.php?group='.$GroupId.'&ID='.$TextID.'">'.$TextID.'</a>', 4); 27 } 28 29 //if(( == '') AND ($complete == 1)) die('Musite zadat název textu'); 13 30 14 $entry = $_POST['entry']; 15 $Title = $_POST['Title']; 16 $Details = @$_POST['Details']; 17 $Objectives = @$_POST['Objectives']; 18 $OfferRewardText = @$_POST['OfferRewardText']; 19 $RequestItemsText = @$_POST['RequestItemsText']; 20 $EndText = @$_POST['EndText']; 21 $ObjectiveText1 = @$_POST['ObjectiveText1']; 22 $ObjectiveText2 = @$_POST['ObjectiveText2']; 23 $ObjectiveText3 = @$_POST['ObjectiveText3']; 24 $ObjectiveText4 = @$_POST['ObjectiveText4']; 25 26 $UserID = $_SESSION['UserID']; 27 $QuestID = $_POST['ID']; 28 $Language = $_POST['Language']; 29 if (array_key_exists('End', $_POST)) 30 $complete = 1; 31 else 32 $complete = 0; 31 $Line = mysql_fetch_array($Database->SQLCommand('SELECT * FROM '.$Table.' WHERE user='.$UserID.' AND entry = '.$entry)); 32 if(!$Line) 33 { 34 $Columns = '`entry`, `Language` , `User` , `complete` , `Take` , `Vote` , `CountVote`'; 35 $Values = $entry.','.$Language.','.$UserID.','.$complete.','.$TextID.', 3 ,1'; 36 foreach($TranslationTree[$GroupId]['Items'] as $GroupItem) 37 { 38 $Columns .= ', `'.$GroupItem['Column'].'`'; 39 $Values .= ', "'.@$_POST[$GroupItem['Column']].'"'; 40 } 41 //echo('INSERT INTO `'.$Table.'` ('.$Columns.') VALUES ('.$Values.')'); 42 $Database->SQLCommand('INSERT INTO `'.$Table.'` ('.$Columns.') VALUES ('.$Values.')'); 43 $LastID = mysql_insert_id(); 44 echo('Překlad <a href="form.php?group='.$GroupId.'&ID='.$TextID.'">'.$TextID.'</a> uložen!<br />'); 45 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); 46 } else 47 { 48 $sql = 'UPDATE '.$Table.' SET `complete` = '.$complete; 49 foreach($TranslationTree[$GroupId]['Items'] as $GroupItem) 50 $sql .= ', `'.$GroupItem['Column'].'`="'.@$_POST[$GroupItem['Column']].'"'; 51 $sql .= ', `Language` = '.$Language.', `Vote` = 3, `CountVote` = 1, admin_check = 0 52 WHERE ID = '.$TextID.' AND Language <> 0'; 53 //echo($sql); 54 $Database->SQLCommand($sql); 55 // echo $sql.'<br />'; 56 echo('Změny v překladu: <a href="form.php?group='.$GroupId.'&ID='.$TextID.'">'.$TextID.'</a> uloženy!<br />'); 57 WriteLog('Změny v překladu: '.$entry.' uloženy! <a href="form.php?group='.$GroupId.'&ID='.$TextID.'">'.$TextID.'</a>', 1); 58 $Database->SQLCommand('DELETE FROM `'.$Table.'_vote` WHERE `TextId` = '.$TextID); 59 $type_translation = 1; 60 $ID_translation = $TextID; 61 $Database->SQLCommand("DELETE FROM tag WHERE ID_translation = $ID_translation AND type_translation = $type_translation"); 62 } 63 64 echo('Překládat: <a href="TranslationList.php?group='.$GroupId.'&action=notran">Nepřeložené</a>'); 65 } 33 66 34 if ($complete == 1) $Database->SQLCommand("DELETE FROM `quests`.`quests_status` WHERE QuestEntry = '$entry'"); 35 36 if (array_key_exists('Repair', $_POST) and Licence(1)) { 37 $Line = mysql_fetch_array($Database->SQLCommand("SELECT user FROM quests Where ID = '$QuestID'")); 38 $UserID = $Line['user']; 39 $complete = 1; 40 WriteLog('Quest: '.$entry.' Opraven moderátorem! <a href="form.php?ID='.$QuestID.'">'.$QuestID.'</a>', 4); 41 } 42 43 if (($Title == '') AND ($complete == 1)) die('Musite zadat název Q'); 44 45 $Line = mysql_fetch_array($Database->SQLCommand("SELECT * FROM quests WHERE user='$UserID' AND entry = '$entry'")); 46 if (!$Line) { 47 48 $Database->SQLCommand("INSERT INTO `quests` (`entry` , `Title` , `Details` , `Objectives` , `OfferRewardText` , `RequestItemsText` , 49 `EndText` , `ObjectiveText1` , `ObjectiveText2` , `ObjectiveText3` , `ObjectiveText4` , `Language` , `User` , `complete` , `Take` , `Vote` , `CountVote` ) 50 VALUES('$entry','$Title','$Details','$Objectives','$OfferRewardText','$RequestItemsText','$EndText','$ObjectiveText1', 51 '$ObjectiveText2','$ObjectiveText3','$ObjectiveText4','$Language','$UserID','$complete','$QuestID','3','1')"); 52 echo 'Quest: '.$entry.' uložen!<br />'; 53 WriteLog('Quest: '.$entry.' uložen! Přvzat z: <a href="form.php?ID='.$QuestID.'">'.$QuestID.'</a>', 1); 54 } else { 55 $sql = "UPDATE quests SET complete = '$complete', Title = '$Title', 56 Details = '$Details', Objectives = '$Objectives', 57 OfferRewardText = '$OfferRewardText', RequestItemsText = '$RequestItemsText', 58 EndText = '$EndText', ObjectiveText1 = '$ObjectiveText1', ObjectiveText2 = '$ObjectiveText2', 59 ObjectiveText3 = '$ObjectiveText3', ObjectiveText4 = '$ObjectiveText4', Language = '$Language', 60 Vote = '3', CountVote = '1', admin_check = '0' 61 WHERE ID = ".$QuestID." AND Language <> 0"; 62 $Database->SQLCommand($sql); 63 // echo $sql.'<br />'; 64 echo 'Změny v Questu: <a href="form.php?ID='.$QuestID.'">'.$QuestID.'</a> uloženy!<br />'; 65 WriteLog('Změny v Questu: '.$entry.' uloženy! <a href="form.php?ID='.$QuestID.'">'.$QuestID.'</a>', 1); 66 $Database->SQLCommand("DELETE FROM `quests_vote` WHERE `quests_vote`.`IDquest` = ".$QuestID); 67 $type_translation = 1; 68 $ID_translation = $QuestID; 69 $Database->SQLCommand("DELETE FROM tag WHERE ID_translation = $ID_translation AND type_translation = $type_translation"); 70 } 71 72 echo 'Překládat: <a href="ListQuests.php?selection">Nepřeložené</a> '; 73 74 } 75 76 ShowFooter(); 67 ShowFooter(); 77 68 ?>
Note:
See TracChangeset
for help on using the changeset viewer.