瀏覽代碼

Work on website module.

Laurent Destailleur 9 年之前
父節點
當前提交
5823055cdf

+ 11 - 3
htdocs/core/filemanagerdol/connectors/php/config.php

@@ -67,7 +67,7 @@ $Config['SecureImageUploads'] = true;
 $Config['ConfigAllowedCommands'] = array('QuickUpload', 'FileUpload', 'GetFolders', 'GetFoldersAndFiles', 'CreateFolder');
 
 // Allowed Resource Types.
-$Config['ConfigAllowedTypes'] = array('File', 'Image', 'Flash', 'Media');
+$Config['ConfigAllowedTypes'] = array('File', 'Image', 'Media');
 
 // For security, HTML is allowed in the first Kb of data for files having the
 // following extensions only.
@@ -78,11 +78,19 @@ $Config['HtmlExtensions'] = array("html", "htm", "xml", "xsd", "txt", "js");
 // If possible, it is recommended to set more restrictive permissions, like 0755.
 // Set to 0 to disable this feature.
 // Note: not needed on Windows-based servers.
-$Config['ChmodOnUpload'] = 0775 ;
+$newmask = '0644';
+if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
+$Config['ChmodOnUpload'] = $newmask;
 
 // See comments above.
 // Used when creating folders that does not exist.
-$Config['ChmodOnFolderCreate'] = 0775 ;
+$newmask = '0755';
+$dirmaskdec=octdec($newmask);
+if (! empty($conf->global->MAIN_UMASK)) $dirmaskdec=octdec($conf->global->MAIN_UMASK);
+$dirmaskdec |= octdec('0200');  // Set w bit required to be able to create content for recursive subdirs files
+$newmask = decoct($dirmaskdec);
+
+$Config['ChmodOnFolderCreate'] = $newmask;
 
 /*
 	Configuration settings for each Resource Type

+ 2 - 1
htdocs/langs/en_US/website.lang

@@ -16,4 +16,5 @@ Website=Web site
 AddPage=Add page
 Page=Page
 PreviewOfSiteNotYetAvailable=Preview of your website <strong>%s</strong> not yet available. You must first add a page.
-PageDeleted=Page %s of website %s deleted
+PageDeleted=Page %s of website %s deleted
+ViewInNewTab=View in new tab

+ 20 - 2
htdocs/public/websites/index.php

@@ -1,5 +1,5 @@
 <?php
-/* Copyright (C) 2009 Laurent Destailleur  <eldy@users.sourceforge.net>
+/* Copyright (C) 2016 Laurent Destailleur  <eldy@users.sourceforge.net>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
  */
 
 /**
- *     	\file       htdocs/public/paypal/index.php
+ *     	\file       htdocs/public/websites/index.php
  *		\ingroup    core
  *		\brief      A redirect page to an error
  *		\author	    Laurent Destailleur
@@ -64,6 +64,24 @@ if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli=$conf->global->MAIN_AP
 
 //print 'Directory with '.$appli.' websites.<br>';
 
+if (empty($pageid))
+{
+    require_once DOL_DOCUMENT_ROOT.'/websites/class/website.class.php';
+    require_once DOL_DOCUMENT_ROOT.'/websites/class/websitepage.class.php';
+    
+    $object=new Website($db);
+    $object->fetch(0, $website);
+    
+    $objectpage=new WebsitePage($db);
+    $array=$objectpage->fetchAll($object->id);
+    
+    if (count($array) > 0)
+    {
+        $firstrep=reset($array);
+        $pageid=$firstrep->id;
+    }
+}
+
 
 // Security: Delete string ../ into $original_file
 global $dolibarr_main_data_root;

+ 2 - 2
htdocs/websites/class/websitepage.class.php

@@ -307,7 +307,7 @@ class WebsitePage extends CommonObject
 
 			while ($obj = $this->db->fetch_object($resql)) 
 			{
-				$record = new Websitepage($this->db);
+				$record = new WebsitePage($this->db);
 
 				$record->id = $obj->rowid;
 				$record->fk_website = $obj->fk_website;
@@ -320,7 +320,7 @@ class WebsitePage extends CommonObject
 				$record->date_creation = $this->db->jdate($obj->date_creation);
 				$record->date_modification = $this->db->jdate($obj->date_modification);
 				$record->tms = $this->db->jdate($obj->tms);
-
+				//var_dump($record->id);
 				$records[$record->id] = $record;
 			}
 			$this->db->free($resql);

+ 6 - 0
htdocs/websites/index.php

@@ -420,6 +420,7 @@ if (count($object->records) > 0)
     print $langs->trans("Website").': ';
     print '</div>';
     
+    // List of websites
     print '<div class="websiteselection">';
     $out='';
     $out.='<select name="website">';
@@ -441,8 +442,13 @@ if (count($object->records) > 0)
     print $out;
     print '<input type="submit" class="button" name="refresh" value="'.$langs->trans("Refresh").'">';
     
+    if ($website)
+    {
+        print '<a href="'.DOL_URL_ROOT.'/public/websites/index.php?website='.$website.'" target="tab'.$website.'">'.$langs->trans("ViewInNewTab").'</a>';
+    }
     print '</div>';
     
+    // Button for websites
     print '<div class="websitetools">';
     
     if ($action == 'preview')