Skip to content
This repository has been archived by the owner on May 24, 2021. It is now read-only.

Commit

Permalink
Merge branch 'release/4.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
rdoursenaud committed Jan 20, 2017
2 parents 512f7e8 + 6361fd8 commit 57c1cd8
Show file tree
Hide file tree
Showing 65 changed files with 8,025 additions and 3,083 deletions.
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@
*.jpg binary
*.odt binary
*.odf binary

# Ignore development files for production
/build
/docs
/dev
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,11 @@ build/*.zip
# Doxygen Generated Files
build/html
build/latex
# Google Test Secrets
/secrets
# Composer
/vendor
# Sphinx
/docs/_build
# Gettext
*.mo
6 changes: 0 additions & 6 deletions .gitmodules

This file was deleted.

40 changes: 40 additions & 0 deletions .tx/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[main]
host = https://www.transifex.com
type = PO

[zenfusionoauth.zenfusionoauth]
file_filter = langs/<lang>/zenfusionoauth.lang
source_file = langs/en_US/zenfusionoauth.lang
source_lang = en_US
lang_map = es: es_ES, fr:fr_FR, uz: uz_UZ, vi: vi_VN
type = MOZILLAPROPERTIES

[zenfusionoauth.about]
file_filter = docs/locale/<lang>/LC_MESSAGES/about.po
source_file = docs/_build/locale/about.pot
source_lang = C

[zenfusionoauth.install]
file_filter = docs/locale/<lang>/LC_MESSAGES/install.po
source_file = docs/_build/locale/install.pot
source_lang = C

[zenfusionoauth.user]
file_filter = docs/locale/<lang>/LC_MESSAGES/user.po
source_file = docs/_build/locale/user.pot
source_lang = C

[zenfusionoauth.index]
file_filter = docs/locale/<lang>/LC_MESSAGES/index.po
source_file = docs/_build/locale/index.pot
source_lang = C

[zenfusionoauth.admin]
file_filter = docs/locale/<lang>/LC_MESSAGES/admin.po
source_file = docs/_build/locale/admin.pot
source_lang = C

[zenfusionoauth.sphinx]
file_filter = docs/locale/<lang>/LC_MESSAGES/sphinx.po
source_file = docs/_build/locale/sphinx.pot
source_lang = C
6 changes: 3 additions & 3 deletions CREDITS
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Google APIs Client Library for PHP
(C)2008-2014 Google Inc.
(C)2008-2016 Google Inc.
Apache License 2.0
Contains:
XRDS-Simple library
Apache License 2.0

ZeroClipboard
(C)2014 Jon Rohan, James M. Greene
(C)2009-2016 Jon Rohan, James M. Greene
MIT License

OAuth logo
Expand All @@ -22,4 +22,4 @@ ZenFusion logo
Trade Mark Pending

GPC.solutions logo
(C)2010-2014 GPC.solutions
(C)2010-2017 GPC.solutions
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ZenFusion Oauth
ZenFusion OAuth
===============

This module provides Google APIs OAuth 2 authentication client capabilities to Dolibarr.
Expand All @@ -8,15 +8,23 @@ It is designed to be used with other ZenFusion modules.
License
-------

Copyright (C) 2011-2014 GPC.solutions
Copyright (C) 2011-2016 GPC.solutions

GPLv3 or (at your option) any later version.

See COPYING for more information.

GIT Submodules
--------------
Composer
--------
This project uses composer to manage external dependencies.

This project uses GIT submodules.
Please use `git submodule init` at the project root after clone followed by `git submodule update --recursive`.
Reissue this last command after pulling to update their content.
Please see https://getcomposer.org for more informations.

### First use
Please issue the following command at the project root after clone to install required dependencies:

- Production: `composer install --no-dev`
- Development: `composer install`

### Updates
After pulling, use `composer update` to update the dependencies.
Empty file removed TODO
Empty file.
33 changes: 14 additions & 19 deletions admin/about.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
* ZenFusion OAuth - A Google OAuth authentication module for Dolibarr
* Copyright (C) 2011 Sebastien Bodrero <[email protected]>
* Copyright (C) 2011-2014 Raphaël Doursenaud <[email protected]>
* Copyright (C) 2011-2017 Raphaël Doursenaud <[email protected]>
*
* 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
Expand All @@ -23,17 +23,10 @@
* \ingroup zenfusionoauth
* Module about page
*/
$res = 0;
// from standard dolibarr install
if (!$res && file_exists('../../main.inc.php')) {
$res = @include '../../main.inc.php';
}
// from custom dolibarr install
if (!$res && file_exists('../../../main.inc.php')) {
$res = @include '../../../main.inc.php';
}
if (!$res) {
die("Main include failed");

// Load Dolibarr environment
if (false === (@include '../../main.inc.php')) { // From htdocs directory
require '../../../main.inc.php'; // From "custom" directory
}

require_once '../core/modules/modZenFusionOAuth.class.php';
Expand Down Expand Up @@ -62,7 +55,7 @@
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">'
. $langs->trans("BackToModuleList") . '</a>';
// Folder icon title
print_fiche_titre("ZenFusion", $linkback, 'setup');
print load_fiche_titre("ZenFusion", $linkback, 'setup');

$head = zfPrepareHead();

Expand All @@ -81,7 +74,7 @@
'</h3>';
echo '<em>', $langs->trans("Version"), ' ',
$module->version, '</em><br>';
echo '<em>&copy;2011-2014 GPC.solutions<br><em>';
echo '<em>&copy;2011-2017 GPC.solutions<br><em>';
echo '<a target="_blank" href="http://www.zenfusion.net/">',
'<img src="../img/logo_zf.png" alt="Logo ZenFusion"></a>';

Expand Down Expand Up @@ -112,18 +105,18 @@
echo '<h4>' . $langs->trans("Libraries") . '</h4>';
echo '<ul>',
'<li>',
'<a href="https://code.google.com/p/google-api-php-client/" target="_blank">',
'<a href="https://github.com/google/google-api-php-client" target="_blank">',
'Google APIs Client Library for PHP',
'</a>',
'<br>',
'©2008-2014 Google Inc.',
'©2008-2016 Google Inc.',
'<br>',
'Apache License 2.0',
'<br>',
$langs->trans("Contains"),
'<ul>',
'<li>',
'<a href="http://code.google.com/p/diso/" target="_blank">',
'<a href="https://github.com/diso/diso" target="_blank">',
'XRDS-Simple library',
'</a>',
'<br>',
Expand All @@ -136,7 +129,7 @@
'ZeroClipboard',
'</a>',
'<br>',
'©2014 Jon Rohan, James M. Greene',
'©2009-2016 Jon Rohan, James M. Greene',
'<br>',
'MIT License',
'<br>',
Expand All @@ -160,7 +153,9 @@
'Trademark Pending',
'</li>',
'<li>GPC.solutions logo<br>',
'&copy;2010-2014 GPC.solutions',
'&copy;2010-2017 GPC.solutions',
'</li>',
'</ul>';

dol_fiche_end();
llxFooter();
67 changes: 28 additions & 39 deletions admin/conf.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
* ZenFusion OAuth - A Google OAuth authentication module for Dolibarr
* Copyright (C) 2011 Sebastien Bodrero <[email protected]>
* Copyright (C) 2011-2014 Raphaël Doursenaud <[email protected]>
* Copyright (C) 2011-2016 Raphaël Doursenaud <[email protected]>
* Copyright (C) 2012 Cédric Salvador <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
Expand All @@ -24,17 +24,10 @@
* \ingroup zenfusionoauth
* Module configuration page
*/
$res = 0;
// from standard dolibarr install
if (!$res && file_exists('../../main.inc.php')) {
$res = @include '../../main.inc.php';
}
// from custom dolibarr install
if (!$res && file_exists('../../../main.inc.php')) {
$res = @include '../../../main.inc.php';
}
if (!$res) {
die("Main include failed");

// Load Dolibarr environment
if (false === (@include '../../main.inc.php')) { // From htdocs directory
require '../../../main.inc.php'; // From "custom" directory
}

require_once '../lib/admin.lib.php';
Expand All @@ -52,16 +45,17 @@

// Build javascript origin URI
$javascript_origin = 'http';
if (array_key_exists('HTTPS', $_SERVER) && $_SERVER['HTTPS'] == 'on') { // HTTPS?
// HTTPS support
if (array_key_exists('HTTPS', $_SERVER) && $_SERVER['HTTPS'] == 'on') {
$javascript_origin .= 's';
}
$javascript_origin .= '://';
$javascript_origin .= $_SERVER['HTTP_HOST'];
if (
array_key_exists('SERVER_PORT' ,$_SERVER)
$javascript_origin .= $_SERVER['SERVER_NAME'];
if (array_key_exists('SERVER_PORT', $_SERVER)
&& $_SERVER['SERVER_PORT'] != 80 // Standard HTTP
&& $_SERVER['SERVER_PORT'] != 443 // Standard HTTPS
) { // Non standard port?
) {
// Add non standard port
$javascript_origin .= ':' . $_SERVER['SERVER_PORT'];
}

Expand All @@ -84,20 +78,18 @@
if ($action == 'upload') {
$file = file_get_contents($_FILES['jsonConfig']['tmp_name']);
$params = json_decode($file, true);
// TODO: write a file verification function to have better error messages for each case
if (
$params === null ||
! in_array($callback_url, $params['web']['redirect_uris']) ||
! in_array($javascript_origin, $params['web']['javascript_origins'])
) {
$error++;
// Check file is valid
if ($params === null) {
$mesg = '<div class="error">' . $langs->trans("BadOrEmptyFile") . '</div>';
} elseif (!in_array($callback_url, $params['web']['redirect_uris'])) {
$mesg = '<div class="error">' . $langs->trans("WrongOrMissingRedirectURI", $callback_url) . '</div>';
} elseif (!in_array($javascript_origin, $params['web']['javascript_origins'])) {
$mesg = '<div class="error">' . $langs->trans("WrongOrMissingJSOrigin", $javascript_origin) . '</div>';
} else {
// File OK
$client_id = $params['web']['client_id'];
$client_secret = $params['web']['client_secret'];
}
if ($error) {
$mesg = '<div class="error">' . $langs->trans("BadFile") . '</div>';
}
}

if ($action == 'update') {
Expand Down Expand Up @@ -146,12 +138,13 @@
* view
*/
llxHeader();
dol_htmloutput_mesg($msg);
// Error / confirmation messages
dol_htmloutput_mesg($mesg);
$form = new Form($db);
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">'
. $langs->trans("BackToModuleList") . '</a>';
// Folder icon title
print_fiche_titre("ZenFusion", $linkback, 'setup');
print load_fiche_titre("ZenFusion", $linkback, 'setup');

$head = zfPrepareHead();
dol_fiche_head(
Expand All @@ -162,14 +155,10 @@
'oauth@zenfusionoauth'
);

// Error / confirmation messages
dol_htmloutput_mesg($mesg);

print_titre($langs->trans("GoogleApiConfig"));
print load_fiche_titre($langs->trans("GoogleApiConfig"));

// Import configuration from google's api console json file
echo '<p>',
$langs->trans("Instructions1");
echo $langs->trans("Instructions1");
// TODO: derive table from installed modules
echo '<table class="border">
<tr class="liste_titre">
Expand All @@ -184,7 +173,7 @@
<td>ZenFusion Drive</td>
<td>Drive API<br>Google Picker API</td>
</tr>
<table>
</table>
<br>';
echo $langs->trans("Instructions2");
echo zfInitCopyToClipboardButton();
Expand Down Expand Up @@ -217,10 +206,9 @@
'</fieldset>',
'</form>',
'<br>';
echo $langs->trans("Instructions4"),
'</p>';
echo $langs->trans("Instructions4");

print_titre($langs->trans("ManualConfiguration"));
print load_fiche_titre($langs->trans("ManualConfiguration"));

echo '<form method="POST" action="', $_SERVER['PHP_SELF'], '">',
'<input type="hidden" name="token" value="', $_SESSION['newtoken'], '">',
Expand All @@ -244,4 +232,5 @@
'</table>',
'</form>';

dol_fiche_end();
llxFooter();
Loading

0 comments on commit 57c1cd8

Please sign in to comment.