Changeset 760 for trunk/Modules/Forum/Forum.php
- Timestamp:
- Jan 22, 2014, 6:12:46 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Forum/Forum.php
r750 r760 20 20 'Title' => T('Forum'), 'Channel' => 'forum', 'Callback' => array('PageForum', 'ShowRSS'), 21 21 'Permission' => LICENCE_ANONYMOUS)); 22 $this->System->RegisterMenuItem(array( 22 23 if(array_key_exists('Search', $this->System->ModuleManager->Modules)) 24 $this->System->ModuleManager->Modules['Search']->RegisterSearch('forum', 25 T('Forum'), array('UserName', 'Text'), '`ForumText`', $this->System->Link('/forum/?search=')); 26 if(array_key_exists('Search', $this->System->ModuleManager->Modules)) 27 $this->System->ModuleManager->Modules['Search']->RegisterSearch('forumthread', 28 'Název vlákna fóra', array('UserName', 'Text'), '`ForumThread`', $this->System->Link('/forum/?search=')); 29 30 $this->System->RegisterMenuItem(array( 23 31 'Title' => T('Forum'), 24 32 'Hint' => 'Forum na debatování ohledně překladu wow', … … 39 47 else if(array_key_exists('a', $_GET)) $Action = $_GET['a']; 40 48 else $Action = ''; 49 if (array_key_exists('search', $_GET)) 50 $Output .= $this->ShowSearchForum(); 51 else 41 52 if (array_key_exists('Thread', $_GET)) { 42 53 $Output .= '<h3>'.T('Forum - Thread').'</h3>'; … … 62 73 } 63 74 75 function ShowSearchForum() 76 { 77 $parser = new HTML_BBCodeParser2(array('filters' => array('Basic','Extended','Images','Links','Lists','Email'))); 78 $Count = 20; 79 $Output = ''; 80 81 $Output .= '<div class="shoutbox">'; 82 $where = '`ForumText`.`Text` LIKE "%'.($_GET['search'] ).'%" OR '. 83 ' `ForumThread`.`Text` LIKE "%'.($_GET['search'] ).'%" OR `ForumThread`.`UserName` LIKE "%'.($_GET['search'] ).'%" OR '. 84 ' `ForumText`.`UserName` LIKE "%'.($_GET['search'] ).'%"'; 85 $join = ' JOIN `ForumThread` ON `ForumThread`.`ID` = `ForumText`.`Thread`'; 86 87 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `ForumText` '.$join.' WHERE '.$where); 88 $DbRow = $DbResult->fetch_row(); 89 $PageList = GetPageList($DbRow[0]); 90 91 $Output .= $PageList['Output']; 92 93 $DbResult = $this->System->Database->query('SELECT `ForumText`.`Text`, `ForumText`.`Date`, `ForumText`.`UserName`,'. 94 '`ForumThread`.`Text` as `ThreadName`,`ForumText`.`Thread` FROM `ForumText` '.$join.' WHERE '.$where.' ORDER BY `ForumText`.`Date` DESC '.$PageList['SQLLimit']); 95 while($Line = $DbResult->fetch_assoc()) 96 $Output .= '<div><a href="'.$this->System->Link('/forum/?Thread='.$Line['Thread']).'">'.$Line['ThreadName'].'</a><br /><strong>'.$Line['UserName'].'</strong> ('.HumanDate($Line['Date']).'): '.$parser->qparse($Line['Text']).'</div> '; 97 $Output .= '</div>'.$PageList['Output']; 98 return($Output); 99 100 return($Output); 101 } 102 64 103 function ShowListThread() 65 104 { … … 74 113 $DbResult = $this->System->Database->query('SELECT * FROM `ForumThread` WHERE 1 ORDER BY `ID` DESC '.$PageList['SQLLimit']); 75 114 while($Line = $DbResult->fetch_assoc()) 76 $Output .= '<div><a href="?Thread='.$Line['ID'].'">'. MakeActiveLinks(str_replace("\n", '',$Line['Text'])).'</a> (<strong>'.$Line['UserName'].'</strong>) - '.HumanDate($Line['Date']).'</div>';115 $Output .= '<div><a href="?Thread='.$Line['ID'].'">'.str_replace("\n", '',$Line['Text']).'</a> (<strong>'.$Line['UserName'].'</strong>) - '.HumanDate($Line['Date']).'</div>'; 77 116 $Output .= '</div>'.$PageList['Output']; 78 117 return($Output); … … 82 121 { 83 122 $Output = ''; 123 124 $parser = new HTML_BBCodeParser2(array('filters' => array('Basic','Extended','Images','Links','Lists','Email'))); 125 // echo $parser->qparse('[youtube]http://www.youtube.com/watch?v=hwgO6p2Jh-A[/youtube][img]http://www.bbcode.org/images/lubeck_small.jpg[/img]normal [i][b]bold[/b][/i] [img]http://imageshack.com/a/img203/7462/6ctg.jpg[/img] and normal again'); 126 84 127 if(array_key_exists('search', $_GET)) $_SESSION['search'] = $_GET['search']; 85 128 else if(!array_key_exists('search', $_SESSION)) $_SESSION['search'] = ''; … … 103 146 $DbResult = $this->System->Database->query('SELECT * FROM `ForumText` WHERE `Thread` = '.$_GET['Thread'].' '.$SearchQuery.' ORDER BY `ID` DESC '.$PageList['SQLLimit']); 104 147 while($Line = $DbResult->fetch_assoc()) 105 $Output .= '<div><strong>'.$Line['UserName'].'</strong> ('.HumanDate($Line['Date']).'): '. MakeActiveLinks($Line['Text']).'</div> ';148 $Output .= '<div><strong>'.$Line['UserName'].'</strong> ('.HumanDate($Line['Date']).'): '.$parser->qparse($Line['Text']).'</div> '; 106 149 $Output .= '</div>'.$PageList['Output']; 107 150 return($Output); … … 118 161 if($this->System->User->Licence(LICENCE_USER)) $Output .= '<b>'.$this->System->User->Name.'</b><br />'; 119 162 else $Output .= '<input type="text" name="user" /><br />'; 120 $Output .= 'Text zprávy: <br/>'.121 '<textarea onkeydown="ResizeTextArea(this)" name="text" cols=" 40"></textarea> <br/>'.163 $Output .= 'Text zprávy: (Můžete využít <a href="http://www.bbcode.org/reference.php">BB kód</a>)<br/>'. 164 '<textarea onkeydown="ResizeTextArea(this)" name="text" cols="80"></textarea> <br/>'. 122 165 '<input type="hidden" name="a" value="add2"/>'. 123 166 '<input type="submit" value="Odeslat" /><br /></fieldset>'.
Note:
See TracChangeset
for help on using the changeset viewer.