Changeset 873 for trunk/Modules/Wiki/Wiki.php
- Timestamp:
- Apr 6, 2020, 11:17:40 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Wiki/Wiki.php
r825 r873 60 60 { 61 61 $DbResult = $this->Database->select('WikiPage', '*', 'VisibleInMenu=1'); 62 while ($DbRow = $DbResult->fetch_assoc())62 while ($DbRow = $DbResult->fetch_assoc()) 63 63 { 64 64 $this->System->RegisterPage($DbRow['NormalizedName'], 'PageWiki'); … … 82 82 function Show() 83 83 { 84 if (array_key_exists('Action', $_GET))85 { 86 if ($_GET['Action'] == 'Edit') $Output = $this->EditContent();87 else if ($_GET['Action'] == 'EditSave') $Output = $this->SaveContent();88 else if ($_GET['Action'] == 'History') $Output = $this->ShowHistory();84 if (array_key_exists('Action', $_GET)) 85 { 86 if ($_GET['Action'] == 'Edit') $Output = $this->EditContent(); 87 else if ($_GET['Action'] == 'EditSave') $Output = $this->SaveContent(); 88 else if ($_GET['Action'] == 'History') $Output = $this->ShowHistory(); 89 89 else $Output = $this->ShowContent(); 90 90 } else $Output = $this->ShowContent(); 91 return ($Output);91 return ($Output); 92 92 } 93 93 … … 96 96 $PageName = $this->System->PathItems[count($this->System->PathItems) - 1]; 97 97 $DbResult = $this->Database->select('WikiPage', 'Name, Id', 'NormalizedName="'.$PageName.'"'); 98 if ($DbResult->num_rows > 0)98 if ($DbResult->num_rows > 0) 99 99 { 100 100 $DbRow = $DbResult->fetch_assoc(); 101 if (array_key_exists('ver', $_GET))101 if (array_key_exists('ver', $_GET)) 102 102 { 103 103 $DbResult2 = $this->Database->select('WikiPageContent', '*', 'Page='.$DbRow['Id'].' AND Id='.$_GET['ver']*1); 104 if ($DbResult2->num_rows > 0)104 if ($DbResult2->num_rows > 0) 105 105 { 106 106 $DbRow2 = $DbResult2->fetch_assoc(); 107 107 $Output = '<h3>Archív stránky '.$DbRow['Name'].' ('.HumanDateTime($DbRow2['Time']).')</h3>'; 108 108 $Output .= $DbRow2['Content']; 109 if ($this->System->User->Licence(LICENCE_MODERATOR))109 if ($this->System->User->Licence(LICENCE_MODERATOR)) 110 110 $Output .= '<div><a href="?Action=Edit">Upravit nejnovější</a> <a href="?Action=History">Historie</a></div>'; 111 111 } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL); … … 113 113 { 114 114 $DbResult2 = $this->Database->select('WikiPageContent', '*', 'Page='.$DbRow['Id'].' ORDER BY Time DESC LIMIT 1'); 115 if ($DbResult2->num_rows > 0)115 if ($DbResult2->num_rows > 0) 116 116 { 117 117 $DbRow2 = $DbResult2->fetch_assoc(); 118 118 $Output = '<h3>'.$DbRow['Name'].'</h3>'; 119 119 $Output .= $DbRow2['Content']; 120 if ($this->System->User->Licence(LICENCE_MODERATOR))120 if ($this->System->User->Licence(LICENCE_MODERATOR)) 121 121 $Output .= '<div><a href="?Action=Edit">Upravit</a> <a href="?Action=History">Historie</a></div>'; 122 122 } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL); 123 123 } 124 124 } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL); 125 return ($Output);125 return ($Output); 126 126 } 127 127 128 128 function EditContent() 129 129 { 130 if ($this->System->User->Licence(LICENCE_MODERATOR))130 if ($this->System->User->Licence(LICENCE_MODERATOR)) 131 131 { 132 132 $PageName = $this->System->PathItems[count($this->System->PathItems) - 1]; 133 133 $DbResult = $this->Database->select('WikiPage', 'Name, Id', 'NormalizedName="'.$PageName.'"'); 134 if ($DbResult->num_rows > 0)134 if ($DbResult->num_rows > 0) 135 135 { 136 136 $DbRow = $DbResult->fetch_assoc(); 137 137 $Output = '<h3>Úprava '.$DbRow['Name'].'</h3>'; 138 138 $DbResult2 = $this->Database->select('WikiPageContent', '*', 'Page='.$DbRow['Id'].' ORDER BY Time DESC LIMIT 1'); 139 if ($DbResult2->num_rows > 0)139 if ($DbResult2->num_rows > 0) 140 140 { 141 141 $DbRow2 = $DbResult2->fetch_assoc(); … … 148 148 } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL); 149 149 } else $Output = ShowMessage('Nemáte oprávnění', MESSAGE_CRITICAL); 150 return ($Output);150 return ($Output); 151 151 } 152 152 153 153 function SaveContent() 154 154 { 155 if ($this->System->User->Licence(LICENCE_MODERATOR))155 if ($this->System->User->Licence(LICENCE_MODERATOR)) 156 156 { 157 157 $PageName = $this->System->PathItems[count($this->System->PathItems) - 1]; 158 158 $DbResult = $this->Database->select('WikiPage', 'Name, Id', 'NormalizedName="'.$PageName.'"'); 159 if ($DbResult->num_rows > 0)159 if ($DbResult->num_rows > 0) 160 160 { 161 161 $DbRow = $DbResult->fetch_assoc(); 162 if (array_key_exists('content', $_POST) and array_key_exists('save', $_POST))162 if (array_key_exists('content', $_POST) and array_key_exists('save', $_POST)) 163 163 { 164 164 $DbResult2 = $this->Database->insert('WikiPageContent', array('Content' => stripslashes($_POST['content']), … … 169 169 } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL); 170 170 } else $Output = ShowMessage('Nemáte oprávnění', MESSAGE_CRITICAL); 171 return ($Output);171 return ($Output); 172 172 } 173 173 174 174 function ShowHistory() 175 175 { 176 if ($this->System->User->Licence(LICENCE_MODERATOR))176 if ($this->System->User->Licence(LICENCE_MODERATOR)) 177 177 { 178 178 $PageName = $this->System->PathItems[count($this->System->PathItems) - 1]; 179 179 $DbResult = $this->Database->select('WikiPage', 'Name, Id', 'NormalizedName="'.$PageName.'"'); 180 if ($DbResult->num_rows > 0)180 if ($DbResult->num_rows > 0) 181 181 { 182 182 $DbRow = $DbResult->fetch_assoc(); … … 202 202 ' FROM `WikiPageContent` WHERE Page='. 203 203 $DbRow['Id'].' '.$Order['SQL'].$PageList['SQLLimit']); 204 while ($PageContent = $DbResult2->fetch_assoc())204 while ($PageContent = $DbResult2->fetch_assoc()) 205 205 { 206 206 $Output .= '<tr>'. … … 215 215 } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL); 216 216 } else $Output = ShowMessage('Nemáte oprávnění', MESSAGE_CRITICAL); 217 return ($Output);217 return ($Output); 218 218 } 219 219 … … 242 242 $text = str_replace("\r\n", '<br/>', $text); 243 243 $text = '<p>'.$text.'</p>'; 244 return ($text);244 return ($text); 245 245 } 246 246 }
Note:
See TracChangeset
for help on using the changeset viewer.