Changeset 561 for trunk/action.php
- Timestamp:
- Aug 13, 2013, 11:31:34 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/action.php
r553 r561 184 184 } 185 185 186 function Delete()187 {188 global $System, $User, $Config;189 190 if($User->Licence(LICENCE_MODERATOR))191 {192 $TextID = $_GET['ID'];193 $System->Database->query('DELETE FROM `'.$Table.'` WHERE `ID` = '.$TextID.' AND `Language` <> '.$Config['OriginalLanguage']);194 $Output = ShowMessage('Překlad byl smazán.');195 WriteLog('Překlad byl smazán! <a href="form.php?group='.$GroupID.'&ID='.$TextID.'">'.$TextID.'</a>', LOG_TYPE_MODERATOR);196 } else $Output = ShowMessage('Nemáte oprávnění', MESSAGE_CRITICAL);197 return($Output);198 }199 200 function ShoutBox()201 {202 global $System, $User;203 204 $Output = '';205 if($User->Licence(LICENCE_USER))206 {207 if(!array_key_exists('add', $_POST))208 {209 $Output .= '<form action="action.php?action=shoutbox" method="post">'.210 '<fieldset><legend>Nová zpráva kecátka</legend>'.211 'Uživatel: ';212 if($User->Licence(LICENCE_USER)) $Output .= '<b>'.$User->Name.'</b><br />';213 else $Output .= '<input type="text" name="user" /><br />';214 $Output .= 'Text zprávy: <br/>215 <textarea onkeydown="ResizeTextArea(this)" name="text" cols="40"></textarea> <br/>216 <input type="submit" name="add" value="Odeslat" /><br /></fieldset>217 </form>';218 } else219 {220 if(array_key_exists('text', $_POST))221 {222 $Text = $_POST['text'];223 if(trim($Text) == '') $Output .= ShowMessage('Nelze vložit prázdnou zprávu.', MESSAGE_WARNING);224 else225 {226 // Protection against mutiple post of same message227 $DbResult = $System->Database->query('SELECT `Text` FROM `ShoutBox` WHERE (`User` = "'.$User->Id.'") ORDER BY `Date` DESC LIMIT 1');228 if($DbResult->num_rows > 0)229 {230 $DbRow = $DbResult->fetch_assoc();231 } else $DbRow['Text'] = '';232 233 if($DbRow['Text'] == $Text) $Output .= ShowMessage('Nelze vložit stejnou zprávu vícekrát za sebou.', MESSAGE_WARNING);234 else235 {236 $System->Database->query('INSERT INTO `ShoutBox` ( `User`, `UserName` , `Text` , `Date` , `IP` ) '.237 ' VALUES ('.$User->Id.', "'.$User->Name.'", "'.$Text.'", NOW(), "'.$_SERVER['REMOTE_ADDR'].'")');238 $Output .= ShowMessage('Zpráva vložena.');239 }240 }241 } else $Output .= ShowMessage('Nezadán text pro novou zprávu.', MESSAGE_CRITICAL);242 }243 $Output .= '<br/>';244 } else $Output .= ShowMessage('Pro vkládaní zpráv musíte byt registrováni.', MESSAGE_CRITICAL);245 $Output .= ShoutBoxView();246 return($Output);247 }248 249 function ShoutBoxView()250 {251 global $System, $User;252 253 $DbResult = $System->Database->query('SELECT COUNT(*) FROM `ShoutBox`');254 $DbRow = $DbResult->fetch_row();255 $PageList = GetPageList($DbRow[0]);256 257 $Output = '<h3>Kecátko</h3>'.$PageList['Output'];258 if($User->Licence(LICENCE_USER)) $Output .= ' <a href="action.php?action=shoutbox">Vložit</a>';259 $Output .= '<div class="shoutbox">';260 $DbResult = $System->Database->query('SELECT * FROM `ShoutBox` ORDER BY `ID` DESC '.$PageList['SQLLimit']);261 while($Line = $DbResult->fetch_assoc())262 $Output .= '<div><strong>'.$Line['UserName'].'</strong>: '.MakeActiveLinks($Line['Text']).'</div>';263 $Output .= '</div>'.$PageList['Output'];264 return($Output);265 }266 267 186 function ShowNewsHistory() 268 187 { … … 290 209 if(array_key_exists('action', $_GET)) $Action = $_GET['action']; 291 210 292 if($Action == 'shoutbox') $Output = ShoutBox(); 293 else if($Action == 'news') $Output = ShowNewsHistory(); 211 if($Action == 'news') $Output = ShowNewsHistory(); 294 212 else if($Action == 'search') $Output = Search(); 295 else if($Action == 'delete') $Output = Delete();296 213 else if($Action == 'dbkit') $Output = DatabaseKit(); 297 else if($Action == 'ShoutBoxView') $Output = ShoutBoxView();298 214 else $Output = ShowMessage('Nebyla zadána žádná akce.', MESSAGE_CRITICAL); 299 215
Note:
See TracChangeset
for help on using the changeset viewer.