gruffen commited on 2011-05-27 04:38:57
Showing 4 changed files, with 47 additions and 22 deletions.
... | ... |
@@ -0,0 +1,28 @@ |
1 |
+<?xml version="1.0"?> |
|
2 |
+<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification"> |
|
3 |
+<modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/"> |
|
4 |
+ <id>SimpleDeskTeam:SimpleDesk</id> |
|
5 |
+ <version>2.0</version> |
|
6 |
+ |
|
7 |
+ <file name="$sourcedir/Subs.php"><!-- bbcode handler changes --> |
|
8 |
+ <operation><!-- expand the quote link= parameter --> |
|
9 |
+ <search position="before"><![CDATA[(?:topic|threadid)=[\dmsg#\./]{1,40}(?:;start=[\dmsg#\./]{1,40})?]]></search> |
|
10 |
+ <add><![CDATA[|action=helpdesk;sa=ticket;ticket=[\dmsg#\./]{1,40}(?:;start=[\dmsg#\./]{1,40})?]]></add> |
|
11 |
+ </operation> |
|
12 |
+ <operation><!-- Force the log of disabled tags to be reset if we're calling it in such a condition as it is being re-evaluated anyway --> |
|
13 |
+ <search position="before"><![CDATA[ if (!empty($modSettings['disabledBBC'])) |
|
14 |
+ {]]></search> |
|
15 |
+ <add><![CDATA[ |
|
16 |
+ $disabled = array(); // SimpleDesk added! Forces reset of $disabled if we're calling in an unusual way |
|
17 |
+]]></add> |
|
18 |
+ </operation> |
|
19 |
+ <operation><!-- Add wikistyle links for tickets --> |
|
20 |
+ <search position="after"><![CDATA[ // Shall we take the time to cache this?]]></search> |
|
21 |
+ <add><![CDATA[ // Add SimpleDesk wikilinks |
|
22 |
+ if (!empty($modSettings['helpdesk_active']) && !empty($modSettings['shd_allow_wikilinks']) && function_exists('shd_parse_wikilinks')) |
|
23 |
+ shd_parse_wikilinks($message); |
|
24 |
+ |
|
25 |
+]]></add> |
|
26 |
+ </operation> |
|
27 |
+ </file> |
|
28 |
+</modification> |
|
0 | 29 |
\ No newline at end of file |
... | ... |
@@ -166,20 +166,6 @@ |
166 | 166 |
</operation> |
167 | 167 |
</file> |
168 | 168 |
|
169 |
- <file name="$sourcedir/Subs.php"><!-- reconfigure the main menu somewhat --> |
|
170 |
- <operation><!-- expand the quote link= parameter --> |
|
171 |
- <search position="before"><![CDATA[(?:topic|threadid)=[\dmsg#\./]{1,40}(?:;start=[\dmsg#\./]{1,40})?]]></search> |
|
172 |
- <add><![CDATA[|action=helpdesk;sa=ticket;ticket=[\dmsg#\./]{1,40}(?:;start=[\dmsg#\./]{1,40})?]]></add> |
|
173 |
- </operation> |
|
174 |
- <operation><!-- Force the log of disabled tags to be reset if we're calling it in such a condition as it is being re-evaluated anyway --> |
|
175 |
- <search position="before"><![CDATA[ if (!empty($modSettings['disabledBBC'])) |
|
176 |
- {]]></search> |
|
177 |
- <add><![CDATA[ |
|
178 |
- $disabled = array(); // SimpleDesk added! Forces reset of $disabled if we're calling in an unusual way |
|
179 |
-]]></add> |
|
180 |
- </operation> |
|
181 |
- </file> |
|
182 |
- |
|
183 | 169 |
<file name="$sourcedir/Profile-Modify.php"><!-- Ensure things get uncached if we change groups (which means permissions) --> |
184 | 170 |
<operation> |
185 | 171 |
<search position="after"><![CDATA[ // The account page allows the change of your id_group - but not to a protected group!]]></search> |
... | ... |
@@ -19,6 +19,7 @@ |
19 | 19 |
<modification format="xml" type="file">install-xml/install-attachments.xml</modification> |
20 | 20 |
<modification format="xml" type="file">install-xml/install-trackip.xml</modification> |
21 | 21 |
<modification format="xml" type="file">install-xml/install-packages.xml</modification> |
22 |
+ <modification format="xml" type="file">install-xml/install-parsebbc.xml</modification> |
|
22 | 23 |
|
23 | 24 |
<!-- language files --> |
24 | 25 |
<require-dir name="sd_language" destination="$themes_dir/default/languages" /> |
... | ... |
@@ -65,6 +66,7 @@ |
65 | 66 |
<modification format="xml" type="file" reverse="true">install-xml/install-attachments.xml</modification> |
66 | 67 |
<modification format="xml" type="file" reverse="true">install-xml/install-trackip.xml</modification> |
67 | 68 |
<modification format="xml" type="file" reverse="true">install-xml/install-packages.xml</modification> |
69 |
+ <modification format="xml" type="file" reverse="true">install-xml/install-parsebbc.xml</modification> |
|
68 | 70 |
|
69 | 71 |
<!-- language files, removed --> |
70 | 72 |
<remove-dir name="$themes_dir/default/languages/sd_language" /> |
... | ... |
@@ -772,11 +772,12 @@ function shd_load_ticket($ticket = 0) |
772 | 772 |
function shd_format_text($text, $smileys = true, $cache = '') |
773 | 773 |
{ |
774 | 774 |
global $modSettings, $scripturl, $smcFunc; |
775 |
- static $wikilinks = array(); |
|
776 | 775 |
static $smf_disabled = false, $shd_disabled = false; |
777 | 776 |
|
778 | 777 |
if (empty($modSettings['shd_allow_ticket_bbc'])) |
779 | 778 |
{ |
779 |
+ if (!empty($modSettings['shd_allow_wikilinks'])) |
|
780 |
+ shd_parse_wikilinks($text); |
|
780 | 781 |
if (!empty($modSettings['shd_allow_ticket_smileys']) && $smileys) |
781 | 782 |
parsesmileys($text); |
782 | 783 |
} |
... | ... |
@@ -825,11 +826,21 @@ function shd_format_text($text, $smileys = true, $cache = '') |
825 | 826 |
} |
826 | 827 |
} |
827 | 828 |
|
828 |
- if (!empty($modSettings['shd_allow_wikilinks'])) |
|
829 |
- { |
|
830 |
- // Check for wiki syntax links - first figure out what links match in this text |
|
831 |
- preg_match_all('~\[\[ticket\:([0-9]+)\]\]~iU', $text, $matches, PREG_SET_ORDER); |
|
829 |
+ return $text; |
|
830 |
+} |
|
832 | 831 |
|
832 |
+/** |
|
833 |
+ * Processes the incoming message for wiki-links. |
|
834 |
+ * |
|
835 |
+ * @param string &$message The message to be parsed. |
|
836 |
+ * @since 2.0 |
|
837 |
+*/ |
|
838 |
+function shd_parse_wikilinks(&$message) |
|
839 |
+{ |
|
840 |
+ global $modSettings, $smcFunc, $scripturl; |
|
841 |
+ static $wikilinks = array(); |
|
842 |
+ if (preg_match_all('~\[\[ticket\:([0-9]+)\]\]~iU', $message, $matches, PREG_SET_ORDER)) |
|
843 |
+ { |
|
833 | 844 |
// Step through the matches, check if it's one we already had in $wikilinks (where persists through the life of this page) |
834 | 845 |
$ticketlist = array(); |
835 | 846 |
$ticketcount = count($matches); |
... | ... |
@@ -871,10 +882,8 @@ function shd_format_text($text, $smileys = true, $cache = '') |
871 | 882 |
$replacements[$matches[$i][0]] = '<a href="' . $scripturl . '?action=helpdesk;sa=ticket;ticket=' . $id . '.0">[' . str_pad($id, $modSettings['shd_zerofill'], '0', STR_PAD_LEFT) . '] ' . $wikilinks[$id] . '</a>'; |
872 | 883 |
} |
873 | 884 |
|
874 |
- $text = str_replace(array_keys($replacements), array_values($replacements), $text); |
|
885 |
+ $message = str_replace(array_keys($replacements), array_values($replacements), $message); |
|
875 | 886 |
} |
876 |
- |
|
877 |
- return $text; |
|
878 | 887 |
} |
879 | 888 |
|
880 | 889 |
/** |
881 | 890 |