| @@ -35,24 +35,24 @@ | ||
| 35 | 35 | global $stripearrayofkeysbyenv; | 
| 36 | 36 | |
| 37 | 37 | $stripearrayofkeysbyenv = array( | 
| 38 | - 0=>array( | |
| 39 | - "secret_key" => $conf->global->STRIPE_TEST_SECRET_KEY, | |
| 40 | - "publishable_key" => $conf->global->STRIPE_TEST_PUBLISHABLE_KEY | |
| 41 | - ), | |
| 42 | - 1=>array( | |
| 43 | - "secret_key" => $conf->global->STRIPE_LIVE_SECRET_KEY, | |
| 44 | - "publishable_key" => $conf->global->STRIPE_LIVE_PUBLISHABLE_KEY | |
| 45 | - ) | |
| 38 | + 0=>array( | |
| 39 | + "secret_key" => $conf->global->STRIPE_TEST_SECRET_KEY, | |
| 40 | + "publishable_key" => $conf->global->STRIPE_TEST_PUBLISHABLE_KEY | |
| 41 | + ), | |
| 42 | + 1=>array( | |
| 43 | + "secret_key" => $conf->global->STRIPE_LIVE_SECRET_KEY, | |
| 44 | + "publishable_key" => $conf->global->STRIPE_LIVE_PUBLISHABLE_KEY | |
| 45 | + ) | |
| 46 | 46 | ); | 
| 47 | 47 | |
| 48 | 48 | $stripearrayofkeys = array(); | 
| 49 | 49 |  if (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox','alpha'))
 | 
| 50 | 50 |  {
 | 
| 51 | - $stripearrayofkeys = $stripearrayofkeysbyenv[0]; // Test | |
| 51 | + $stripearrayofkeys = $stripearrayofkeysbyenv[0]; // Test | |
| 52 | 52 | } | 
| 53 | 53 | else | 
| 54 | 54 |  {
 | 
| 55 | - $stripearrayofkeys = $stripearrayofkeysbyenv[1]; // Live | |
| 55 | + $stripearrayofkeys = $stripearrayofkeysbyenv[1]; // Live | |
| 56 | 56 | } | 
| 57 | 57 | |
| 58 | 58 | \Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']); | 
| @@ -32,90 +32,90 @@ discard block | ||
| 32 | 32 |  {
 | 
| 33 | 33 | |
| 34 | 34 | /** | 
| 35 | - * Constructor. Define names, constants, directories, boxes, permissions | |
| 36 | - * | |
| 37 | - * @param DoliDB $db Database handler | |
| 35 | + * Constructor. Define names, constants, directories, boxes, permissions | |
| 36 | + * | |
| 37 | + * @param DoliDB $db Database handler | |
| 38 | 38 | */ | 
| 39 | 39 | function __construct($db) | 
| 40 | 40 |      {
 | 
| 41 | - global $langs,$conf; | |
| 41 | + global $langs,$conf; | |
| 42 | 42 | |
| 43 | 43 | $this->db = $db; | 
| 44 | 44 | $this->numero = 10000; | 
| 45 | 45 | |
| 46 | - // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' | |
| 47 | - // It is used to group modules in module setup page | |
| 46 | + // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' | |
| 47 | + // It is used to group modules in module setup page | |
| 48 | 48 | $this->family = "portal"; | 
| 49 | 49 | $this->module_position = '50'; | 
| 50 | 50 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) | 
| 51 | 51 |          $this->name = preg_replace('/^mod/i','',get_class($this));
 | 
| 52 | 52 | $this->description = "Enable to build and serve public web sites with CMS features"; | 
| 53 | - // Possible values for version are: 'development', 'experimental', 'dolibarr' or version | |
| 53 | + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version | |
| 54 | 54 | $this->version = 'dolibarr'; | 
| 55 | 55 | // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) | 
| 56 | 56 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); | 
| 57 | 57 | // Name of image file used for this module. | 
| 58 | 58 | $this->picto='globe'; | 
| 59 | 59 | |
| 60 | - // Data directories to create when module is enabled | |
| 61 | -		$this->dirs = array("/website/temp");
 | |
| 60 | + // Data directories to create when module is enabled | |
| 61 | +        $this->dirs = array("/website/temp");
 | |
| 62 | 62 | |
| 63 | 63 | // Config pages | 
| 64 | 64 |          $this->config_page_url = array('website.php');
 | 
| 65 | 65 | |
| 66 | 66 | // Dependencies | 
| 67 | - $this->hidden = ! empty($conf->global->MODULE_WEBSITE_DISABLED); // A condition to disable module | |
| 68 | -		$this->depends = array('modFckeditor');		// List of modules id that must be enabled if this module is enabled
 | |
| 67 | + $this->hidden = ! empty($conf->global->MODULE_WEBSITE_DISABLED); // A condition to disable module | |
| 68 | +        $this->depends = array('modFckeditor');		// List of modules id that must be enabled if this module is enabled
 | |
| 69 | 69 | $this->requiredby = array(); // List of modules id to disable if this one is disabled | 
| 70 | - $this->conflictwith = array(); // List of modules id this module is in conflict with | |
| 71 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module | |
| 70 | + $this->conflictwith = array(); // List of modules id this module is in conflict with | |
| 71 | + $this->phpmin = array(5,4); // Minimum version of PHP required by module | |
| 72 | 72 |          $this->langfiles = array("website");
 | 
| 73 | 73 | |
| 74 | 74 | // Constants | 
| 75 | - $this->const = array(); | |
| 75 | + $this->const = array(); | |
| 76 | 76 | |
| 77 | 77 | // New pages on tabs | 
| 78 | - //$this->tabs[] = array(); // To add a new tab identified by code tabname1 | |
| 78 | + //$this->tabs[] = array(); // To add a new tab identified by code tabname1 | |
| 79 | 79 | |
| 80 | 80 | // Boxes | 
| 81 | 81 | $this->boxes = array(); | 
| 82 | 82 | |
| 83 | - // Permissions | |
| 84 | - $this->rights = array(); // Permission array used by this module | |
| 85 | - $this->rights_class = 'website'; | |
| 86 | - $r=0; | |
| 87 | - | |
| 88 | - $this->rights[$r][0] = 10001; | |
| 89 | - $this->rights[$r][1] = 'Read website content'; | |
| 90 | - $this->rights[$r][3] = 0; | |
| 91 | - $this->rights[$r][4] = 'read'; | |
| 92 | - $r++; | |
| 93 | - | |
| 94 | - $this->rights[$r][0] = 10002; | |
| 95 | - $this->rights[$r][1] = 'Create/modify website content'; | |
| 96 | - $this->rights[$r][3] = 0; | |
| 97 | - $this->rights[$r][4] = 'write'; | |
| 98 | - $r++; | |
| 99 | - | |
| 100 | - $this->rights[$r][0] = 10003; | |
| 101 | - $this->rights[$r][1] = 'Delete website content'; | |
| 102 | - $this->rights[$r][3] = 0; | |
| 103 | - $this->rights[$r][4] = 'delete'; | |
| 104 | - $r++; | |
| 83 | + // Permissions | |
| 84 | + $this->rights = array(); // Permission array used by this module | |
| 85 | + $this->rights_class = 'website'; | |
| 86 | + $r=0; | |
| 87 | + | |
| 88 | + $this->rights[$r][0] = 10001; | |
| 89 | + $this->rights[$r][1] = 'Read website content'; | |
| 90 | + $this->rights[$r][3] = 0; | |
| 91 | + $this->rights[$r][4] = 'read'; | |
| 92 | + $r++; | |
| 93 | + | |
| 94 | + $this->rights[$r][0] = 10002; | |
| 95 | + $this->rights[$r][1] = 'Create/modify website content'; | |
| 96 | + $this->rights[$r][3] = 0; | |
| 97 | + $this->rights[$r][4] = 'write'; | |
| 98 | + $r++; | |
| 99 | + | |
| 100 | + $this->rights[$r][0] = 10003; | |
| 101 | + $this->rights[$r][1] = 'Delete website content'; | |
| 102 | + $this->rights[$r][3] = 0; | |
| 103 | + $this->rights[$r][4] = 'delete'; | |
| 104 | + $r++; | |
| 105 | 105 | |
| 106 | 106 | // Main menu entries | 
| 107 | 107 | $r=0; | 
| 108 | 108 | $this->menu[$r]=array( 'fk_menu'=>'0', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode | 
| 109 | - 'type'=>'top', // This is a Left menu entry | |
| 110 | - 'titre'=>'WebSites', | |
| 109 | + 'type'=>'top', // This is a Left menu entry | |
| 110 | + 'titre'=>'WebSites', | |
| 111 | 111 | 'mainmenu'=>'website', | 
| 112 | - 'url'=>'/website/index.php', | |
| 113 | - 'langs'=>'website', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. | |
| 114 | - 'position'=>100, | |
| 115 | - 'enabled'=>'$conf->website->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. | |
| 116 | - 'perms'=>'$user->rights->website->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules | |
| 117 | - 'target'=>'', | |
| 118 | - 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both | |
| 112 | + 'url'=>'/website/index.php', | |
| 113 | + 'langs'=>'website', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. | |
| 114 | + 'position'=>100, | |
| 115 | + 'enabled'=>'$conf->website->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. | |
| 116 | + 'perms'=>'$user->rights->website->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules | |
| 117 | + 'target'=>'', | |
| 118 | + 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both | |
| 119 | 119 | $r++; | 
| 120 | 120 | |
| 121 | 121 | // Exports | 
| @@ -147,34 +147,34 @@ discard block | ||
| 147 | 147 | */ | 
| 148 | 148 | function init($options='') | 
| 149 | 149 |      {
 | 
| 150 | - global $conf,$langs; | |
| 150 | + global $conf,$langs; | |
| 151 | 151 | |
| 152 | - // Remove permissions and default values | |
| 153 | - $this->remove($options); | |
| 152 | + // Remove permissions and default values | |
| 153 | + $this->remove($options); | |
| 154 | 154 | |
| 155 | - // Copy flags and octicons directoru | |
| 156 | -    	$dirarray=array('common/flags', 'common/octicons');
 | |
| 157 | - foreach($dirarray as $dir) | |
| 158 | -    	{
 | |
| 159 | - $src = DOL_DOCUMENT_ROOT . '/theme/' . $dir; | |
| 155 | + // Copy flags and octicons directoru | |
| 156 | +        $dirarray=array('common/flags', 'common/octicons');
 | |
| 157 | + foreach($dirarray as $dir) | |
| 158 | +        {
 | |
| 159 | + $src = DOL_DOCUMENT_ROOT . '/theme/' . $dir; | |
| 160 | 160 | $dest = DOL_DATA_ROOT . '/medias/image/' . $dir; | 
| 161 | 161 | |
| 162 | 162 | if (is_dir($src)) | 
| 163 | -	    	{
 | |
| 164 | - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; | |
| 165 | - dol_mkdir($dest); | |
| 166 | - $result=dolCopyDir($src,$dest,0,0); | |
| 167 | - if ($result < 0) | |
| 168 | -	    		{
 | |
| 169 | -	    			$langs->load("errors");
 | |
| 170 | -	    			$this->error=$langs->trans('ErrorFailToCopyDir',$src,$dest);
 | |
| 171 | - return 0; | |
| 172 | - } | |
| 173 | - } | |
| 174 | - } | |
| 175 | - | |
| 176 | - $sql = array(); | |
| 177 | - | |
| 178 | - return $this->_init($sql, $options); | |
| 163 | +            {
 | |
| 164 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; | |
| 165 | + dol_mkdir($dest); | |
| 166 | + $result=dolCopyDir($src,$dest,0,0); | |
| 167 | + if ($result < 0) | |
| 168 | +                {
 | |
| 169 | +                    $langs->load("errors");
 | |
| 170 | +                    $this->error=$langs->trans('ErrorFailToCopyDir',$src,$dest);
 | |
| 171 | + return 0; | |
| 172 | + } | |
| 173 | + } | |
| 174 | + } | |
| 175 | + | |
| 176 | + $sql = array(); | |
| 177 | + | |
| 178 | + return $this->_init($sql, $options); | |
| 179 | 179 | } | 
| 180 | 180 | } |