changeset 151:4e25150aa868

Change js_path configuration setting to js_file.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 06 Sep 2017 17:34:36 +0300
parents 28a2b6e6b527
children 606b05c31d5e
files example.cfg mgallery.inc.php mgallery.php
diffstat 3 files changed, 18 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/example.cfg	Wed Sep 06 16:49:01 2017 +0300
+++ b/example.cfg	Wed Sep 06 17:34:36 2017 +0300
@@ -20,8 +20,8 @@
 album_icon           = "/mgallery/album_sm.png"
 ;urchin_file         = "urchin.inc.php"
 
-; Relative path to Javascript files used by MGallery (mgallery.js)
-js_path              = "/mgallery/"
+; Relative path+filename to mgallery.js
+js_file              = "/mgallery/mgallery.js"
 
 ; Use image from sub-album as album cover image?
 ; If disabled, album_icon will be always used for cover image
--- a/mgallery.inc.php	Wed Sep 06 16:49:01 2017 +0300
+++ b/mgallery.inc.php	Wed Sep 06 17:34:36 2017 +0300
@@ -76,8 +76,9 @@
   "title_prefix"     => [MG_STR, ""],
   "title_sep"        => [MG_STR, " - "],
   "page_info"        => [MG_STR, "<b>MGallery ".$mgProgVersion."</b> &copy; Copyright ".$mgProgCopyright],
+
   "css"              => [MG_STR, NULL],
-  "js_path"          => [MG_STR, NULL],
+  "js_file"          => [MG_STR, NULL],
   "urchin_file"      => [MG_STR, FALSE],
 
   "global_flags"     => [MG_FLAGS, MGF_JAVASCRIPT | MGF_BREADCRUMBS | MGF_CAPTIONS, &$mgGFlags],
--- a/mgallery.php	Wed Sep 06 16:49:01 2017 +0300
+++ b/mgallery.php	Wed Sep 06 17:34:36 2017 +0300
@@ -103,7 +103,7 @@
 
 function mgPrintPageHeader($pageTitle, $pageExtra = "")
 {
-  global $pageCSS, $pageCharset, $pageUrchin, $pageJSPath;
+  global $pageCSS, $pageCharset, $pageUrchin, $pageJSFile;
 
   echo
   "<!DOCTYPE html>\n".
@@ -111,7 +111,7 @@
   "<head>\n".
   "  <meta charset=\"".$pageCharset."\">\n".
   "  <meta http-equiv=\"Content-type\" content=\"text/html;charset=".$pageCharset."\">\n".
-  "  <script type=\"text/javascript\" src=\"".$pageJSPath."mgallery.js\"></script>\n".
+  "  <script type=\"text/javascript\" src=\"".$pageJSFile."\"></script>\n".
   "  <title>".strip_tags($pageTitle)."</title>\n".
   $pageExtra;
 
@@ -181,21 +181,6 @@
 }
 
 
-function mgGetLanguageSelector()
-{
-  global $pageLang, $pageLanguages;
-  if (isset($pageLanguages) && count($pageLanguages) > 0)
-  {
-    $str = "<div id=\"languages\">";
-    foreach ($pageLanguages as $id => $lang)
-      $str .= "<a class=\"lang_".$id."\" href=\"?lang=".$id."\">".$lang."</a>";
-    return $str."</div>\n";
-  }
-  else
-    return "";
-}
-
-
 function mgGetNaviActive(&$galIndex, $index, $delta, &$res, &$url, $entities)
 {
   global $galPath;
@@ -389,7 +374,17 @@
 
 function mgGetPageInfoHeaderEnd()
 {
-  return mgGetLanguageSelector()."</div>";
+  global $pageLang, $pageLanguages;
+
+  $str = "<div id=\"languages\">";
+
+  if (isset($pageLanguages) && is_array($pageLanguages))
+  {
+    foreach ($pageLanguages as $id => $lang)
+      $str .= "<a class=\"lang_".$id."\" href=\"?lang=".$id."\">".$lang."</a>";
+  }
+
+  return $str."</div></div>";
 }
 
 
@@ -456,7 +451,7 @@
 mgReadSettings();
 
 $pageCSS = mgGetSetting("css");
-$pageJSPath = mgGetSetting("js_path");
+$pageJSFile = mgGetSetting("js_file");
 $pageUrchin = mgGetSetting("urchin_file");
 $galBasePath = mgGetSetting("base_path");
 $galBaseURL = mgGetSetting("base_url");