changeset 488:532cebd9c9f2

Move some functions to site module.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 07 Dec 2013 15:23:01 +0200
parents 289692a0169c
children aa65fe63072e
files compos.inc.php msite.inc.php
diffstat 2 files changed, 48 insertions(+), 48 deletions(-) [+]
line wrap: on
line diff
--- a/compos.inc.php	Sat Dec 07 15:17:43 2013 +0200
+++ b/compos.inc.php	Sat Dec 07 15:23:01 2013 +0200
@@ -6,53 +6,6 @@
 //
 echo stGetSetting("compoDescription");
 
-function stConvSwitchMode(&$str, &$mode, $newMode)
-{
-  if ($newMode != $mode)
-  {
-    if ($mode != "")
-      $str .= "\n</".$mode.">\n";
-
-    $mode = $newMode;
-
-    if ($mode != "")
-      $str .= "<".$mode.">\n";
-  }
-}
-
-
-function stConvertCompoDesc($desc)
-{
-  global $stDescConversion;
-  $str = "";
-  $mode = "";
-
-  foreach (explode("\n", $desc) as $line)
-  {
-    if (preg_match("/^\s*\s*\*(.+)$/", $line, $m))
-    {
-      stConvSwitchMode($str, $mode, "ol");
-      $str .= "<li>".$m[1]."</li>\n";
-    }
-    else
-    if (preg_match("/^\s*-\s*(.+)$/", $line, $m))
-    {
-      stConvSwitchMode($str, $mode, "ul");
-      $str .= "<li>".$m[1]."</li>\n";
-    }
-    else
-    {
-      stConvSwitchMode($str, $mode, "p");
-      $str .= $line;
-    }
-  }
-
-  stConvSwitchMode($str, $mode, "");
-
-  return $str;
-}
-
-
 $sql = "SELECT id,name FROM compos WHERE visible<>0 ORDER BY id ASC";
 
 if (($res = stExecSQL($sql)) !== FALSE)
@@ -75,7 +28,7 @@
     echo
     "<div id=\"compo".$item["id"]."\">\n".
     "<h2>".chentities($item["name"])."</h2>\n".
-    stConvertCompoDesc($item["description"]).
+    stConvertCommonDesc($item["description"]).
     "</div>\n";
   }
 }
--- a/msite.inc.php	Sat Dec 07 15:17:43 2013 +0200
+++ b/msite.inc.php	Sat Dec 07 15:23:01 2013 +0200
@@ -312,8 +312,55 @@
 }
 
 
+function stConvSwitchMode(&$str, &$mode, $newMode)
+{
+  if ($newMode != $mode)
+  {
+    if ($mode != "")
+      $str .= "\n</".$mode.">\n";
+
+    $mode = $newMode;
+
+    if ($mode != "")
+      $str .= "<".$mode.">\n";
+  }
+}
+
+
+function stConvertCommonDesc($desc)
+{
+  $str = "";
+  $mode = "";
+
+  foreach (explode("\n", $desc) as $line)
+  {
+    if (preg_match("/^\s*\s*\*(.+)$/", $line, $m))
+    {
+      stConvSwitchMode($str, $mode, "ol");
+      $str .= "<li>".$m[1]."</li>\n";
+    }
+    else
+    if (preg_match("/^\s*-\s*(.+)$/", $line, $m))
+    {
+      stConvSwitchMode($str, $mode, "ul");
+      $str .= "<li>".$m[1]."</li>\n";
+    }
+    else
+    {
+      stConvSwitchMode($str, $mode, "p");
+      $str .= $line;
+    }
+  }
+
+  stConvSwitchMode($str, $mode, "");
+
+  return $str;
+}
+
+
 function stNormalizeListSlideOrder($list_id)
 {
 }
 
+
 ?>
\ No newline at end of file