first commit
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
## Friendly URLs
|
||||
#RewriteEngine on
|
||||
#RewriteCond %{REQUEST_URI} /_
|
||||
#RewriteRule ^_([a-z][a-z0-9_]*)-([a-zA-Z0-9_-]*)\.\.(.*)$ request.php?module=$1&action=$2.php&ocparams=$3
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | OpenConf |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to the OpenConf License, available on |
|
||||
// | the OpenConf web site: www.OpenConf.com |
|
||||
// +----------------------------------------------------------------------+
|
||||
|
||||
require_once "../include.php";
|
||||
|
||||
beginChairSession();
|
||||
|
||||
$hdr = 'Activate Module';
|
||||
$hdrfn = 1;
|
||||
|
||||
if (isset($_REQUEST['module']) && oc_moduleValid($_REQUEST['module'])) {
|
||||
$q = "UPDATE `" . OCC_TABLE_MODULES . "` SET `moduleActive`=1 WHERE `moduleId`='" . $_REQUEST['module'] . "' LIMIT 1";
|
||||
ocsql_query($q) or err('Unable to activate module',$hdr,$hdrfn);
|
||||
|
||||
// Redirect
|
||||
session_write_close();
|
||||
header("Location: modules.php?" . strip_tags(SID));
|
||||
exit;
|
||||
} else {
|
||||
err('Invalid module',$hdr,$hdrfn);
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,69 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>CAPTCHA Module for OpenConf</title>
|
||||
<style type="text/css">
|
||||
body { font-family: arial, helvetica, sans-serif; font-size: 80%; }
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>CAPTCHA Module for OpenConf</h1>
|
||||
|
||||
<p>This module adds a <a href="https://en.wikipedia.org/wiki/CAPTCHA" title="Wikipedia definition page" target="_blank">CAPTCHA</a> verification to the submission and contact forms so as to ensure they are submitted by a person.</p>
|
||||
|
||||
<h3>Requirements and Configuration</h3>
|
||||
|
||||
<p>If running OpenConf on your own server, sign up for an <a href="https://www.hcaptcha.com/" target="_blank">hCaptcha</a> or a <a href="https://www.google.com/recaptcha" target="_blank">Google reCAPTCHA</a> account and enter your account API keys into this module's settings. <b>Note:</b> PHP must be configured so that allow_url_fopen is enabled.</p>
|
||||
|
||||
<p>The <i>OpenConf Hosting Service</i> already has this module pre-configured and no configuration is necessary – simply install and activate the module.</p>
|
||||
|
||||
<h3>Usage – Authors</h3>
|
||||
|
||||
<p>Follow the instructions provided with the CAPTCHA field on the form.</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<p>Version 3.0.0<br />
|
||||
- Added hCaptcha
|
||||
</p>
|
||||
|
||||
<p>Version 2.1.0<br />
|
||||
- Removed deprecated reCAPTCHA 1.0
|
||||
</p>
|
||||
|
||||
<p>Version 2.0.0<br />
|
||||
- Added support for reCAPTCHA 2.0
|
||||
</p>
|
||||
|
||||
<p>Version 1.3.0<br />
|
||||
- Added settings import/export
|
||||
</p>
|
||||
|
||||
<p>Version 1.2.2<br />
|
||||
- Updated recaptchalib.php
|
||||
</p>
|
||||
|
||||
<p>Version 1.2.1<br />
|
||||
- Fixed PHP_SELF reference in init.inc
|
||||
</p>
|
||||
|
||||
<p>Version 1.2.0<br />
|
||||
- Changed to use new submission form fieldset<br />
|
||||
- Split out author and concact fields
|
||||
</p>
|
||||
|
||||
<p>Version 1.1.1<br />
|
||||
- Added token check for settings.inc
|
||||
</p>
|
||||
|
||||
<p>Version 1.1.0<br />
|
||||
- Changed author-validate to check for existence of POST variables
|
||||
- Changed author-fields to not display blank table row for contact form, and included field label
|
||||
</p>
|
||||
|
||||
<p>Version 1.0.0<br />
|
||||
- Initial Release</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | OpenConf |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to the OpenConf License, available on |
|
||||
// | the OpenConf web site: www.OpenConf.com |
|
||||
// +----------------------------------------------------------------------+
|
||||
|
||||
print '
|
||||
<fieldset>
|
||||
<legend>' . oc_('CAPTCHA') . '</legend>
|
||||
|
||||
<br /><span class="err">';
|
||||
|
||||
require_once('captcha-include.inc');
|
||||
|
||||
mod_captcha_displayCAPTCHA();
|
||||
|
||||
print '</span>
|
||||
</fieldset>';
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | OpenConf |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to the OpenConf License, available on |
|
||||
// | the OpenConf web site: www.OpenConf.com |
|
||||
// +----------------------------------------------------------------------+
|
||||
|
||||
require_once('captcha-include.inc');
|
||||
|
||||
if ($mod_captcha_err = mod_captcha_verifyCAPTCHA()) {
|
||||
$err .= '<li>' . $mod_captcha_err . '</li>';
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | OpenConf |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to the OpenConf License, available on |
|
||||
// | the OpenConf web site: www.OpenConf.com |
|
||||
// +----------------------------------------------------------------------+
|
||||
|
||||
// display CAPTCHA
|
||||
function mod_captcha_displayCAPTCHA() {
|
||||
if (OC_CAPTCHA_service == 'hCaptcha') {
|
||||
print '
|
||||
<script src="https://www.hCaptcha.com/1/api.js?hl=' . urlencode($GLOBALS['OC_locale']) . '" async defer></script>
|
||||
<div class="h-captcha" data-sitekey="' . safeHTMLstr(OC_CAPTCHA_public_key) . '"></div>
|
||||
';
|
||||
} elseif (OC_CAPTCHA_service == 'reCAPTCHA') {
|
||||
print '
|
||||
<script src="https://www.google.com/recaptcha/api.js?hl=' . $GLOBALS['OC_locale'] . '" async defer></script>
|
||||
<div class="g-recaptcha" data-sitekey="' . safeHTMLstr(OC_CAPTCHA_public_key) . '"></div>
|
||||
<noscript>
|
||||
<div style="width: 302px; height: 352px;">
|
||||
<div style="width: 302px; height: 352px; position: relative;">
|
||||
<div style="width: 302px; height: 352px; position: absolute;">
|
||||
<iframe src="https://www.google.com/recaptcha/api/fallback?k=' . safeHTMLstr(OC_CAPTCHA_public_key) . '" frameborder="0" scrolling="no" style="width: 302px; height:352px; border-style: none;" title="CAPTCHA">
|
||||
</iframe>
|
||||
</div>
|
||||
<div style="width: 250px; height: 80px; position: absolute; border-style: none; bottom: 21px; left: 25px; margin: 0px; padding: 0px; right: 25px;">
|
||||
<textarea id="g-recaptcha-response" name="g-recaptcha-response" class="g-recaptcha-response" style="width: 250px; height: 80px; border: 1px solid #c1c1c1; margin: 0px; padding: 0px; resize: none;" value="">
|
||||
</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</noscript>
|
||||
';
|
||||
}
|
||||
}
|
||||
|
||||
// verify CAPTCH - returns false if verifies OK, otherwise error string
|
||||
function mod_captcha_verifyCAPTCHA() {
|
||||
if (OC_CAPTCHA_service == 'hCaptcha') {
|
||||
$mod_captcha_var = 'h-captcha-response';
|
||||
$mod_catpcha_url = 'https://hcaptcha.com/siteverify';
|
||||
} elseif (OC_CAPTCHA_service == 'reCAPTCHA') {
|
||||
$mod_captch_var = 'g-captcha-response';
|
||||
$mod_catpcha_url = 'https://www.google.com/recaptcha/api/siteverify';
|
||||
} else {
|
||||
err('invalid CAPTCHA');
|
||||
}
|
||||
|
||||
if (isset($_POST[$mod_captcha_var]) && !empty($_POST[$mod_captcha_var])) {
|
||||
$mod_catpcha_url .= '?secret=' . urlencode(OC_CAPTCHA_private_key) . '&response=' . urlencode($_POST['h-captcha-response']) . '&remoteip=' . urlencode($_SERVER['REMOTE_ADDR']);
|
||||
if ($response = file_get_contents($mod_catpcha_url)) {
|
||||
if ($responseAR = json_decode($response, true)) {
|
||||
if (trim($responseAR['success']) == true) {
|
||||
return(false); // OK
|
||||
} elseif (isset($responseAR['error-codes'])) {
|
||||
$mod_captcha_err = (is_array($responseAR['error-codes']) ? implode(',', $responseAR['error-codes']) : $responseAR['error-codes']);
|
||||
} else {
|
||||
$mod_captcha_err = 3;
|
||||
}
|
||||
} else {
|
||||
$mod_captcha_err = 4;
|
||||
}
|
||||
} else {
|
||||
$mod_captcha_err = 5;
|
||||
}
|
||||
}
|
||||
|
||||
return(
|
||||
oc_('CAPTCHA verification failed') .
|
||||
(empty($mod_captcha_err) ? '' : (' (' . $mod_captcha_err . ')'))
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | OpenConf |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to the OpenConf License, available on |
|
||||
// | the OpenConf web site: www.OpenConf.com |
|
||||
// +----------------------------------------------------------------------+
|
||||
|
||||
print '
|
||||
<tr>
|
||||
<td class="item" valign="top"><label for="recaptcha_response_field">' . oc_('CAPTCHA Check') . ':</label></td>
|
||||
<td colspan=2>
|
||||
|
||||
<span class="err">
|
||||
';
|
||||
|
||||
require_once('captcha-include.inc');
|
||||
|
||||
mod_captcha_displayCAPTCHA();
|
||||
|
||||
print '</span></td></tr>';
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | OpenConf |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to the OpenConf License, available on |
|
||||
// | the OpenConf web site: www.OpenConf.com |
|
||||
// +----------------------------------------------------------------------+
|
||||
|
||||
require_once('captcha-include.inc');
|
||||
|
||||
if ($mod_captcha_err = mod_captcha_verifyCAPTCHA()) {
|
||||
$err .= '<li>' . $mod_captcha_err . '</li>';
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | OpenConf |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to the OpenConf License, available on |
|
||||
// | the OpenConf web site: www.OpenConf.com |
|
||||
// +----------------------------------------------------------------------+
|
||||
|
||||
// Check at least one CAPTCHA service keys configured and setup constants
|
||||
if (!defined('OC_CAPTCHA_service')) {
|
||||
|
||||
if (!empty($OC_configAR['MOD_CAPTCHA_hcaptcha_public_key']) && !empty($OC_configAR['MOD_CAPTCHA_hcaptcha_private_key'])) {
|
||||
define('OC_CAPTCHA_service', 'hCaptcha');
|
||||
define('OC_CAPTCHA_public_key', $OC_configAR['MOD_CAPTCHA_hcaptcha_public_key']);
|
||||
define('OC_CAPTCHA_private_key', $OC_configAR['MOD_CAPTCHA_hcaptcha_private_key']);
|
||||
} elseif (!empty($OC_configAR['OC_CAPTCHA_public_key']) && !empty($OC_configAR['MOD_CAPTCHA_private_key'])) {
|
||||
define('OC_CAPTCHA_service', 'reCAPTCHA');
|
||||
define('OC_CAPTCHA_public_key', $OC_configAR['OC_CAPTCHA_public_key']);
|
||||
define('OC_CAPTCHA_private_key', $OC_configAR['MOD_CAPTCHA_private_key']);
|
||||
}
|
||||
|
||||
// Register chair settings hook
|
||||
oc_addHook('chair-menu-settings-modules', array($OC_modulesAR[$moduleId]['name'], '<a href="../modules/request.php?module=captcha&action=settings.inc">CAPTCHA</a>'));
|
||||
|
||||
// Register settings export/import hooks
|
||||
oc_addHook('settings-export-options', '../modules/captcha/settings-export-options.inc');
|
||||
oc_addHook('settings-export-prep', '../modules/captcha/settings-export-prep.inc');
|
||||
|
||||
}
|
||||
|
||||
// Register form hooks
|
||||
if (defined('OC_CAPTCHA_service')) {
|
||||
if (preg_match("/submit\.php/", $_SERVER['PHP_SELF'])) { // new subs only
|
||||
oc_addHook('author-submit-fields', '../modules/captcha/author-fields.inc');
|
||||
oc_addHook('author-submission-validate', '../modules/captcha/author-validate.inc');
|
||||
}
|
||||
oc_addHook('author-contact-fields', '../modules/captcha/contact-fields.inc');
|
||||
oc_addHook('author-contact-validate', '../modules/captcha/contact-validate.inc');
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
## +----------------------------------------------------------------------+
|
||||
## | OpenConf |
|
||||
## +----------------------------------------------------------------------+
|
||||
## | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
## +----------------------------------------------------------------------+
|
||||
## | This source file is subject to the OpenConf License, available on |
|
||||
## | the OpenConf web site: www.OpenConf.com |
|
||||
## +----------------------------------------------------------------------+
|
||||
|
||||
## NOTE: This file cannot contain a semi-colon (;) except at the end of a
|
||||
## SQL statement.
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
INSERT INTO `config` (`module`, `setting`, `value`, `name`, `description`, `parse`) VALUES ('captcha', 'MOD_CAPTCHA_private_key', '', 'reCAPTCHA Private Key', 'obtain from google.com/recaptcha', 0);
|
||||
|
||||
INSERT INTO `config` (`module`, `setting`, `value`, `name`, `description`, `parse`) VALUES ('captcha', 'MOD_CAPTCHA_public_key', '', 'reCAPTCHA Public Key', 'obtain from google.com/recaptcha', 0);
|
||||
|
||||
INSERT INTO `config` (`module`, `setting`, `value`, `name`, `description`, `parse`) VALUES ('captcha', 'MOD_CAPTCHA_hcaptcha_private_key', '', 'hCaptcha Private Key', 'obtain from hcaptcha.com', 0);
|
||||
|
||||
INSERT INTO `config` (`module`, `setting`, `value`, `name`, `description`, `parse`) VALUES ('captcha', 'MOD_CAPTCHA_hcaptcha_public_key', '', 'hCaptcha Public Key', 'obtain from hcaptcha.com', 0);
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | OpenConf |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to the OpenConf License, available on |
|
||||
// | the OpenConf web site: www.OpenConf.com |
|
||||
// +----------------------------------------------------------------------+
|
||||
|
||||
// Module ID - needs to match directory name
|
||||
$moduleId = 'captcha';
|
||||
|
||||
// Module info
|
||||
$OC_modulesAR[$moduleId] = array(
|
||||
'name' => 'CAPTCHA',
|
||||
'description' => 'Checks that submissions are being made by a human',
|
||||
'version' => '3.0.0',
|
||||
'dependencies' => array(),
|
||||
'developer' => 'OpenConf'
|
||||
);
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | OpenConf |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to the OpenConf License, available on |
|
||||
// | the OpenConf web site: www.OpenConf.com |
|
||||
// +----------------------------------------------------------------------+
|
||||
|
||||
|
||||
print '
|
||||
<br />
|
||||
<label><input type="checkbox" name="settings[]" value="captcha" /> CAPTCHA - Configuration</label><br />
|
||||
';
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | OpenConf |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to the OpenConf License, available on |
|
||||
// | the OpenConf web site: www.OpenConf.com |
|
||||
// +----------------------------------------------------------------------+
|
||||
|
||||
if (in_array('captcha', $_POST['settings'])) {
|
||||
$settings['modules']['captcha'] = $OC_modulesAR['captcha']['name'];
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | OpenConf |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to the OpenConf License, available on |
|
||||
// | the OpenConf web site: www.OpenConf.com |
|
||||
// +----------------------------------------------------------------------+
|
||||
|
||||
$MOD_CAPTCHA_configVars = array('MOD_CAPTCHA_hcaptcha_public_key', 'MOD_CAPTCHA_hcaptcha_private_key', 'MOD_CAPTCHA_private_key', 'MOD_CAPTCHA_public_key');
|
||||
|
||||
if (isset($_POST['submit']) && ($_POST['submit'] == 'Save Settings')) {
|
||||
// Check for valid submission
|
||||
if (!validToken('chair')) {
|
||||
warn('Invalid submission');
|
||||
}
|
||||
|
||||
// Validate settings
|
||||
$err = array();
|
||||
if (!ini_get('allow_url_fopen')) {
|
||||
$err[] = 'PHP must be configured to have allow_url_fopen enabled';
|
||||
}
|
||||
|
||||
// Errors?
|
||||
if (!empty($err)) {
|
||||
print '<div class="warn"><p>Please re-enter your settings, noting the following:</p><ul><li>' . implode('</li><li>', $err) . '</li></ul></div><br /><hr /><br />';
|
||||
} else { // Update settings
|
||||
updateAllConfigSettings($MOD_CAPTCHA_configVars, $_POST, OCC_MODULE_ID);
|
||||
// notify user
|
||||
print '<p style="text-align: center" class="note">Settings Saved</p>';
|
||||
}
|
||||
}
|
||||
|
||||
print '
|
||||
<form method="post" action="' . OCC_SELF . '" class="ocform">
|
||||
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
|
||||
|
||||
<p>OpenConf supports the <a href="https://hcaptcha.com" target="_blank" rel="noopener noreferrer">hCaptcha</a> and <a href="https://www.google.com/recaptcha" target="_blank" rel="noopener noreferrer">Google reCAPTCHA</a> services. Sign up for an account with either service and enter the public/private keys below. If credentials are filled in for both services, hCAPTCHA will be used by default.</p>
|
||||
|
||||
<fieldset id="oc_fs_mod_captcha_hcaptcha">
|
||||
<legend onclick="oc_fsToggle(this)">hCpatcha</span></legend>
|
||||
<div class="fieldsetnote note">In order to use hCaptcha, first sign up for an account at <a href="https://hcaptcha.com" target="_blank" rel="noopener noreferrer">https://hcaptcha.com</a></div>
|
||||
<div id="oc_fs_mod_captcha_hcaptcha_div">
|
||||
|
||||
<div class="field">
|
||||
<label for="MOD_CAPTCHA_hcaptcha_public_key">Public (Site) key:</label>
|
||||
<input name="MOD_CAPTCHA_hcaptcha_public_key" id="MOD_CAPTCHA_hcaptcha_public_key" value="' . safeHTMLstr($OC_configAR['MOD_CAPTCHA_hcaptcha_public_key']) . '" size="60" />
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label for="MOD_CAPTCHA_hcaptcha_private_key">Private (Secret) key:</label>
|
||||
<input name="MOD_CAPTCHA_hcaptcha_private_key" id="MOD_CAPTCHA_hcaptcha_private_key" value="' . safeHTMLstr($OC_configAR['MOD_CAPTCHA_hcaptcha_private_key']) . '" size="60" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
|
||||
<fieldset id="oc_fs_mod_captcha_recaptcha">
|
||||
<legend onclick="oc_fsToggle(this)">Google reCAPTCHA v2</span></legend>
|
||||
<div class="fieldsetnote note">In order to use reCAPTCHA, first sign up for an account at <a href="https://google.com/recaptcha" target="_blank" rel="noopener noreferrer">https://google.com/recaptcha</a></div>
|
||||
<div id="oc_fs_mod_captcha_recaptcha_div">
|
||||
|
||||
<div class="field">
|
||||
<label for="MOD_CAPTCHA_public_key">Public key:</label>
|
||||
<input name="MOD_CAPTCHA_public_key" id="MOD_CAPTCHA_public_key" value="' . safeHTMLstr($OC_configAR['MOD_CAPTCHA_public_key']) . '" size="60" />
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label for="MOD_CAPTCHA_private_key">Private key:</label>
|
||||
<input name="MOD_CAPTCHA_private_key" id="MOD_CAPTCHA_private_key" value="' . safeHTMLstr($OC_configAR['MOD_CAPTCHA_private_key']) . '" size="60" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<p><input type="submit" name="submit" value="Save Settings" class="submit" /></p>
|
||||
</form>
|
||||
';
|
||||
@@ -0,0 +1,15 @@
|
||||
## +----------------------------------------------------------------------+
|
||||
## | OpenConf |
|
||||
## +----------------------------------------------------------------------+
|
||||
## | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
## +----------------------------------------------------------------------+
|
||||
## | This source file is subject to the OpenConf License, available on |
|
||||
## | the OpenConf web site: www.OpenConf.com |
|
||||
## +----------------------------------------------------------------------+
|
||||
|
||||
## NOTE: This file cannot contain a semi-colon (;) except at the end of a
|
||||
## SQL statement.
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
DELETE FROM `config` WHERE `module`='captcha';
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | OpenConf |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to the OpenConf License, available on |
|
||||
// | the OpenConf web site: www.OpenConf.com |
|
||||
// +----------------------------------------------------------------------+
|
||||
|
||||
ocsql_query("INSERT INTO `" . OCC_TABLE_CONFIG . "` (`module`, `setting`, `value`, `name`, `description`, `parse`) VALUES ('captcha', 'MOD_CAPTCHA_version', '1.0', 'Version Number', 'reCAPTCHA API version number', 0)");
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | OpenConf |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to the OpenConf License, available on |
|
||||
// | the OpenConf web site: www.OpenConf.com |
|
||||
// +----------------------------------------------------------------------+
|
||||
|
||||
ocsql_query("DELETE FROM `" . OCC_TABLE_CONFIG . "` WHERE `module`='captcha' AND `setting`='MOD_CAPTCHA_version' LIMIT 1");
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | OpenConf |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to the OpenConf License, available on |
|
||||
// | the OpenConf web site: www.OpenConf.com |
|
||||
// +----------------------------------------------------------------------+
|
||||
|
||||
ocsql_query("INSERT INTO `" . OCC_TABLE_CONFIG . "` (`module`, `setting`, `value`, `name`, `description`, `parse`) VALUES ('captcha', 'MOD_CAPTCHA_hcaptcha_private_key', '', 'hCaptcha Private (Secret) Key', 'obtain from hcaptcha.com', 0)");
|
||||
|
||||
ocsql_query("INSERT INTO `" . OCC_TABLE_CONFIG . "` (`module`, `setting`, `value`, `name`, `description`, `parse`) VALUES ('captcha', 'MOD_CAPTCHA_hcaptcha_public_key', '', 'hCaptcha Public (Site) Key', 'obtain from hcaptcha.com', 0)");
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | OpenConf |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to the OpenConf License, available on |
|
||||
// | the OpenConf web site: www.OpenConf.com |
|
||||
// +----------------------------------------------------------------------+
|
||||
|
||||
require_once "../include.php";
|
||||
|
||||
beginChairSession();
|
||||
|
||||
$hdr = 'Deactivate Module';
|
||||
$hdrfn = 1;
|
||||
|
||||
if (isset($_REQUEST['module']) && oc_moduleValid($_REQUEST['module'])) {
|
||||
if (!isset($OC_modulesAR[$_REQUEST['module']]['allowdeactivate']) || $OC_modulesAR[$_REQUEST['module']]['allowdeactivate']) {
|
||||
$q = "UPDATE `" . OCC_TABLE_MODULES . "` SET `moduleActive`=0 WHERE `moduleId`='" . $_REQUEST['module'] . "' LIMIT 1";
|
||||
ocsql_query($q) or err('Unable to deactivate module',$hdr,$hdrfn);
|
||||
|
||||
// Redirect
|
||||
session_write_close();
|
||||
header("Location: modules.php?" . strip_tags(SID));
|
||||
exit;
|
||||
} else {
|
||||
warn('Module may not be deactivated',$hdr,$hdrfn);
|
||||
}
|
||||
} else {
|
||||
err('Invalid module',$hdr,$hdrfn);
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,82 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>File Format Check Module for OpenConf</title>
|
||||
<style type="text/css">
|
||||
body { font-family: arial, helvetica, sans-serif; font-size: 80%; }
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>File Format Check Module for OpenConf</h1>
|
||||
<p>This module verifies whether an uploaded file matches the selected format. Instead of relying on the file extension or browser-provided MIME type, at least for the formats below, the file itself is inspected to determine its format through signature matching. If a signature is not available, the file extension is checked instead.</p>
|
||||
<p>Signature checking is currently available for the following:<br />
|
||||
<ul>
|
||||
<li>Adobe PDF</li>
|
||||
<li>HTML</li>
|
||||
<li>Microsoft Word</li>
|
||||
<li>PostScript</li>
|
||||
<li>RTF</li>
|
||||
<li>WordPerfect</li>
|
||||
<li>XML</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<h3>Requirements</h3>
|
||||
|
||||
<p>none</p>
|
||||
|
||||
<h3>Configuration</h3>
|
||||
|
||||
<p>Options are provided in this module's settings that allow excluding Office (2007) Open XML documents (.docx) and RTF documents from being accepted as Word documents.</p>
|
||||
|
||||
<h3>Usage</h3>
|
||||
|
||||
<p>When a file is uploaded, the detected file format is automatically verified against the selected format. If the format does not match, the upload will not be completed and a notice is displayed.</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<p>Version 3.0.1<br />
|
||||
- Fixed missing setting export/import hooks</p>
|
||||
|
||||
<p>Version 3.0.0<br />
|
||||
- Added file format identification using PHP Fileinfo</p>
|
||||
|
||||
<p>Version 2.0.1<br />
|
||||
- Added file extension verification of MS Office 2007+ formats</p>
|
||||
|
||||
<p>Version 2.0.0<br />
|
||||
- Added settings import/export<br />
|
||||
- Added module installation and activation as part of standard OpenConf installation<br />
|
||||
- Added support for custom Author/Chair name<br />
|
||||
- Added alternative file extensions for jpg and mpg<br />
|
||||
- Renamed module to File Format Check
|
||||
</p>
|
||||
|
||||
<p>Version 1.0.5<br />
|
||||
- Fixed HTML file type verification
|
||||
</p>
|
||||
|
||||
<p>Version 1.0.4<br />
|
||||
- Dropped setting MOD_FILETYPE_allow_officeopenxml as .docx/.xlsx/.pptx added as MIME types<br />
|
||||
- Changed paperid to mediumint(6)<br />
|
||||
- Changed author-file-validate to handle both submission and upload (dropped author-upload-validate)
|
||||
</p>
|
||||
|
||||
<p>Version 1.0.3<br />
|
||||
- Added token check for settings.inc
|
||||
</p>
|
||||
|
||||
<p>Version 1.0.2<br />
|
||||
- Added support for file type validation of files uploaded during initial submission
|
||||
</p>
|
||||
|
||||
<p>Version 1.0.1<br />
|
||||
- Fixed extraneous print in author-upload-validate.inc
|
||||
</p>
|
||||
|
||||
<p>Version 1.0.0<br />
|
||||
- Initial Release</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | OpenConf |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to the OpenConf License, available on |
|
||||
// | the OpenConf web site: www.OpenConf.com |
|
||||
// +----------------------------------------------------------------------+
|
||||
|
||||
// Skip if chair?
|
||||
if ( ! isset($chair) || ! $chair || ! $OC_configAR['MOD_FILETYPE_chairoverride']) {
|
||||
$MOD_FILETYPE_file = $_FILES['file']['tmp_name']; // uploaded file loc
|
||||
$MOD_FILETYPE_name = $_FILES['file']['name']; // uploaded file original name
|
||||
// uploaded file original name extension
|
||||
if (($MOD_FILETYPE_extbegin = strrpos($MOD_FILETYPE_name, '.')) !== FALSE) {
|
||||
$MOD_FILETYPE_ext = substr($MOD_FILETYPE_name, ($MOD_FILETYPE_extbegin + 1));
|
||||
} else {
|
||||
$MOD_FILETYPE_ext = '';
|
||||
}
|
||||
$MOD_FILETYPE_format = $_POST['format']; // user selected format
|
||||
|
||||
// Valid extensions for each format w/o automated detection
|
||||
$MOD_FILETYPE_validExtAR = array(
|
||||
'txt' => array('txt', 'text'),
|
||||
'jpg' => array('jpg', 'jpeg'),
|
||||
'mpg' => array('mpg', 'mpeg', 'mp4')
|
||||
);
|
||||
|
||||
// Checks $data for $sig from $offset
|
||||
function mod_filetype_checksig($data, $sig, $offset=0, $case=1) {
|
||||
if (($case && (strpos($data, $sig) === $offset))
|
||||
|| (! $case && stripos($data, $sig) === $offset)
|
||||
) {
|
||||
return(true);
|
||||
}
|
||||
return(false);
|
||||
}
|
||||
|
||||
// Check using Fileinfo
|
||||
if (function_exists('finfo_open')
|
||||
&& isset($GLOBALS['OC_mimeTypeAR'][$MOD_FILETYPE_format])
|
||||
&& ($mod_filetype_finfo = finfo_open(FILEINFO_MIME_TYPE))
|
||||
&& (finfo_file($mod_filetype_finfo, $MOD_FILETYPE_file) == $GLOBALS['OC_mimeTypeAR'][$MOD_FILETYPE_format])
|
||||
) {
|
||||
$MOD_FILETYPE_valid = true;
|
||||
} else { // Check using signature
|
||||
$MOD_FILETYPE_valid = false;
|
||||
|
||||
if ($MOD_FILETYPE_fp = fopen($MOD_FILETYPE_file, 'r')) {
|
||||
$MOD_FILETYPE_bytes = fread($MOD_FILETYPE_fp, 512);
|
||||
switch ($MOD_FILETYPE_format) {
|
||||
case 'doc':
|
||||
case 'ppt':
|
||||
case 'xls':
|
||||
if (mod_filetype_checksig($MOD_FILETYPE_bytes, "\320\317\021\340\241\261\032\341")) {
|
||||
$MOD_FILETYPE_bytes = fread($MOD_FILETYPE_fp, 512);
|
||||
if (($MOD_FILETYPE_format == 'doc') && mod_filetype_checksig($MOD_FILETYPE_bytes, "\354\245\301\0")) {
|
||||
$MOD_FILETYPE_valid = true;
|
||||
}
|
||||
elseif (($MOD_FILETYPE_format == 'doc') && $OC_configAR['MOD_FILETYPE_allow_rtfforword'] && mod_filetype_checksig($MOD_FILETYPE_bytes, "{\\rtf")) {
|
||||
$MOD_FILETYPE_valid = true;
|
||||
}
|
||||
elseif (($MOD_FILETYPE_format == 'ppt') && preg_match("/^ppt/", $MOD_FILETYPE_ext)) { # mod_filetype_checksig($MOD_FILETYPE_bytes, "")) {
|
||||
$MOD_FILETYPE_valid = true;
|
||||
} elseif (($MOD_FILETYPE_format == 'xls') && preg_match("/^xls/", $MOD_FILETYPE_ext)) { # && mod_filetype_checksig($MOD_FILETYPE_bytes, "")) {
|
||||
$MOD_FILETYPE_valid = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'docx':
|
||||
case 'pptx':
|
||||
case 'xlsx':
|
||||
if (
|
||||
mod_filetype_checksig($MOD_FILETYPE_bytes, "PK\003\004\024\0\006\0")
|
||||
&&
|
||||
preg_match("/^" . substr($MOD_FILETYPE_format, 0, 3) . "/", $MOD_FILETYPE_ext)
|
||||
) {
|
||||
$MOD_FILETYPE_valid = true;
|
||||
}
|
||||
break;
|
||||
case 'pdf':
|
||||
if (mod_filetype_checksig($MOD_FILETYPE_bytes, '%PDF')) {
|
||||
$MOD_FILETYPE_valid = true;
|
||||
}
|
||||
break;
|
||||
case 'ps':
|
||||
if (mod_filetype_checksig($MOD_FILETYPE_bytes, '%!PS-Adobe')) {
|
||||
$MOD_FILETYPE_valid = true;
|
||||
}
|
||||
break;
|
||||
case 'rtf':
|
||||
if (mod_filetype_checksig($MOD_FILETYPE_bytes, '{\\rtf')) {
|
||||
$MOD_FILETYPE_valid = true;
|
||||
}
|
||||
break;
|
||||
case 'wp':
|
||||
if (mod_filetype_checksig($MOD_FILETYPE_bytes, '\377WPC')) {
|
||||
$MOD_FILETYPE_valid = true;
|
||||
}
|
||||
break;
|
||||
case 'xml':
|
||||
if (mod_filetype_checksig($MOD_FILETYPE_bytes, '<?xml')) {
|
||||
$MOD_FILETYPE_valid = true;
|
||||
}
|
||||
break;
|
||||
case 'html':
|
||||
if (mod_filetype_checksig($MOD_FILETYPE_bytes, '<html', 0, 0)
|
||||
|| mod_filetype_checksig($MOD_FILETYPE_bytes, '<!DOCTYPE HTML', 0, 0)
|
||||
|| mod_filetype_checksig($MOD_FILETYPE_bytes, '<?xml version="1.0" encoding="', 0, 0)
|
||||
) {
|
||||
$MOD_FILETYPE_valid = true;
|
||||
}
|
||||
break;
|
||||
default: // check file extension - yes, we've wasted the fopen call :(
|
||||
if (($MOD_FILETYPE_ext == $MOD_FILETYPE_format)
|
||||
|| (isset($MOD_FILETYPE_validExtAR[oc_strtolower($MOD_FILETYPE_format)]) && in_array(oc_strtolower($MOD_FILETYPE_ext), $MOD_FILETYPE_validExtAR[oc_strtolower($MOD_FILETYPE_format)]))
|
||||
) {
|
||||
$MOD_FILETYPE_valid = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
fclose($MOD_FILETYPE_fp);
|
||||
} else {
|
||||
err(oc_('Unable to open file to check format'));
|
||||
}
|
||||
}
|
||||
|
||||
if ($mod_filetype_finfo) {
|
||||
finfo_close($mod_filetype_finfo);
|
||||
}
|
||||
|
||||
// Warn on invalid type
|
||||
if (! $MOD_FILETYPE_valid) {
|
||||
if (preg_match("/submit/", $_SERVER['PHP_SELF'])) {
|
||||
$fileUploaded = false;
|
||||
$err .= '<li>' . oc_('File uploaded does not match format selected') . '</li>';
|
||||
} else { // upload
|
||||
warn(oc_('File uploaded does not match format selected. Please re-check and try again. If you are unable to upload the file, contact the Chair.'));
|
||||
}
|
||||
}
|
||||
} // skip if chair
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | OpenConf |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to the OpenConf License, available on |
|
||||
// | the OpenConf web site: www.OpenConf.com |
|
||||
// +----------------------------------------------------------------------+
|
||||
|
||||
//// Add hooks
|
||||
|
||||
oc_addHook('author-file-validate', '../modules/filetype/author-file-validate.inc');
|
||||
oc_addHook('author-upload-validate', '../modules/filetype/author-file-validate.inc');
|
||||
|
||||
// Register chair settings hook
|
||||
oc_addHook('chair-menu-settings-modules', array($OC_modulesAR[$moduleId]['name'], '<a href="../modules/request.php?module=filetype&action=settings.inc">File Format Check</a>'));
|
||||
|
||||
// Settings Export/Import
|
||||
oc_addHook('settings-export-options', '../modules/filetype/settings-export-options.inc');
|
||||
oc_addHook('settings-export-prep', '../modules/filetype/settings-export-prep.inc');
|
||||
@@ -0,0 +1,22 @@
|
||||
## +----------------------------------------------------------------------+
|
||||
## | OpenConf |
|
||||
## +----------------------------------------------------------------------+
|
||||
## | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
## +----------------------------------------------------------------------+
|
||||
## | This source file is subject to the OpenConf License, available on |
|
||||
## | the OpenConf web site: www.OpenConf.com |
|
||||
## +----------------------------------------------------------------------+
|
||||
|
||||
|
||||
## NOTE: UPDATES TO THIS FILE NEED TO BE REFLECTED IN lib/DB.sql
|
||||
|
||||
|
||||
|
||||
## NOTE: This file cannot contain a semi-colon (;) except at the end of a
|
||||
## SQL statement.
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
INSERT INTO `config` (`module`, `setting`, `value`, `name`, `description`, `parse`) VALUES ('filetype', 'MOD_FILETYPE_chairoverride', '1', 'Skip Check if Chair', 'Skips file format check if Chair uploading', 0);
|
||||
|
||||
INSERT INTO `config` (`module`, `setting`, `value`, `name`, `description`, `parse`) VALUES ('filetype', 'MOD_FILETYPE_allow_rtfforword', '1', 'Accept RTF for Word Doc', 'Permit RTF MS Word docs', 0);
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | OpenConf |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to the OpenConf License, available on |
|
||||
// | the OpenConf web site: www.OpenConf.com |
|
||||
// +----------------------------------------------------------------------+
|
||||
|
||||
// Module ID - needs to match directory name
|
||||
$moduleId = 'filetype';
|
||||
|
||||
// Module info
|
||||
$OC_modulesAR[$moduleId] = array(
|
||||
'name' => 'File Format Check',
|
||||
'description' => 'Verifies file uploaded matches selected format',
|
||||
'version' => '3.0.1',
|
||||
'dependencies' => array(),
|
||||
'developer' => 'OpenConf'
|
||||
);
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | OpenConf |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to the OpenConf License, available on |
|
||||
// | the OpenConf web site: www.OpenConf.com |
|
||||
// +----------------------------------------------------------------------+
|
||||
|
||||
|
||||
print '
|
||||
<br />
|
||||
<label><input type="checkbox" name="settings[]" value="filetype" /> FileType - Configuration</label><br />
|
||||
';
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | OpenConf |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to the OpenConf License, available on |
|
||||
// | the OpenConf web site: www.OpenConf.com |
|
||||
// +----------------------------------------------------------------------+
|
||||
|
||||
if (in_array('filetype', $_POST['settings'])) {
|
||||
$settings['modules']['filetype'] = $OC_modulesAR['filetype']['name'];
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | OpenConf |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to the OpenConf License, available on |
|
||||
// | the OpenConf web site: www.OpenConf.com |
|
||||
// +----------------------------------------------------------------------+
|
||||
|
||||
$MOD_FILETYPE_configVars = array('MOD_FILETYPE_chairoverride', 'MOD_FILETYPE_allow_rtfforword');
|
||||
|
||||
if (isset($_POST['submit']) && ($_POST['submit'] == 'Save Settings')) {
|
||||
// Check for valid submission
|
||||
if (!validToken('chair')) {
|
||||
warn('Invalid submission');
|
||||
}
|
||||
|
||||
// Update config & status settings
|
||||
updateAllConfigSettings($MOD_FILETYPE_configVars, $_POST, OCC_MODULE_ID);
|
||||
|
||||
// notify user
|
||||
print '<p style="text-align: center" class="note">Settings Saved</p>';
|
||||
}
|
||||
|
||||
print '
|
||||
<form method="post" action="' . OCC_SELF . '">
|
||||
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
|
||||
|
||||
<p><strong>Skip Check if ' . OCC_WORD_CHAIR . ':</strong> ' .
|
||||
generateRadioOptions('MOD_FILETYPE_chairoverride', $yesNoAR, $OC_configAR['MOD_FILETYPE_chairoverride'])
|
||||
. '<br /><span class="note">Skips file format check if ' . OCC_WORD_CHAIR . ' uploading.</p>
|
||||
|
||||
<p><strong>Allow RTF for Word Doc:</strong> ' .
|
||||
generateRadioOptions('MOD_FILETYPE_allow_rtfforword', $yesNoAR, $OC_configAR['MOD_FILETYPE_allow_rtfforword'])
|
||||
. '<br /><span class="note">Checking Yes will allow Word documents (.doc) in RTF format.</p>
|
||||
|
||||
<br />
|
||||
<p><input type="submit" name="submit" class="submit" value="Save Settings" /></p>
|
||||
</form>
|
||||
';
|
||||
@@ -0,0 +1,15 @@
|
||||
## +----------------------------------------------------------------------+
|
||||
## | OpenConf |
|
||||
## +----------------------------------------------------------------------+
|
||||
## | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
## +----------------------------------------------------------------------+
|
||||
## | This source file is subject to the OpenConf License, available on |
|
||||
## | the OpenConf web site: www.OpenConf.com |
|
||||
## +----------------------------------------------------------------------+
|
||||
|
||||
## NOTE: This file cannot contain a semi-colon (;) except at the end of a
|
||||
## SQL statement.
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
DELETE FROM `config` WHERE `module`='filetype';
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
header("Location: modules.php");
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | OpenConf |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to the OpenConf License, available on |
|
||||
// | the OpenConf web site: www.OpenConf.com |
|
||||
// +----------------------------------------------------------------------+
|
||||
|
||||
require_once "../include.php";
|
||||
|
||||
beginChairSession();
|
||||
|
||||
$hdr = 'Install Module';
|
||||
$hdrfn = 1;
|
||||
|
||||
if (isset($_REQUEST['module']) && oc_moduleValid($_REQUEST['module'])) {
|
||||
// Check module is not already installed
|
||||
if (oc_module_installed($_REQUEST['module'])) {
|
||||
err('Module ' . safeHTMLstr($_REQUEST['module']) . ' is already installed', $hdr, $hdrfn);
|
||||
}
|
||||
|
||||
// Read module info
|
||||
require_once $_REQUEST['module'] . '/module.inc';
|
||||
|
||||
// Check dir name matches moduleId
|
||||
if ($moduleId != $_REQUEST['module']) {
|
||||
err('Module ID does not match directory name', $hdr, $hdrfn);
|
||||
}
|
||||
if (!preg_match("/^o"."c_/",$moduleId)||(preg_match("/^(\w+) /", OCC_LICENSE_TYPE, $m)&&
|
||||
preg_match("/\b" . strtolower($m[1]) . "\b/", $OC_modulesAR[$moduleId]['supported']))) {
|
||||
|
||||
// Check for dependencies
|
||||
if (!empty($OC_modulesAR[$_REQUEST['module']]['dependencies'])) {
|
||||
foreach ($OC_modulesAR[$_REQUEST['module']]['dependencies'] as $m) {
|
||||
if (!oc_module_installed($m)) {
|
||||
warn('First install and activate other modules this one depends on: ' . implode(', ', $OC_modulesAR[$_REQUEST['module']]['dependencies']), $hdr, $hdrfn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Load module schema
|
||||
if (is_file($_REQUEST['module'] . '/install-db.sql')) {
|
||||
oc_loadSchema($_REQUEST['module'] . '/install-db.sql');
|
||||
}
|
||||
|
||||
// Module specific install
|
||||
if (is_file($_REQUEST['module'] . '/install.inc')) {
|
||||
require_once $_REQUEST['module'] . '/install.inc';
|
||||
}
|
||||
|
||||
// Add to modules table
|
||||
$q = "INSERT INTO `" . OCC_TABLE_MODULES . "` SET " .
|
||||
"`moduleId` = '" . $_REQUEST['module'] . "', " .
|
||||
"`moduleActive` = 0";
|
||||
$r = ocsql_query($q) or err('Unable to install module (' . safeHTMLstr(ocsql_error()) . ')',$hdr,$hdrfn);
|
||||
|
||||
// Redirect
|
||||
session_write_close();
|
||||
header("Location: modules.php?" . strip_tags(SID));
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
err('Invalid module',$hdr,$hdrfn);
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,48 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Mail Module for OpenConf</title>
|
||||
<style type="text/css">
|
||||
body { font-family: arial, helvetica, sans-serif; font-size: 80%; }
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Mail Module for OpenConf</h1>
|
||||
<p>This module adds support for using an external SMTP server in addition to the built-in PHP mail() function. The PHPMailer library is required and must be separately installed.</p>
|
||||
|
||||
<h3>Requirements</h3>
|
||||
|
||||
<p>The <a href="https://github.com/PHPMailer/PHPMailer" target="_blank">PHPMailer</a> library must be installed to the plugins/PHPMailer/ directory so that (for PHPMailer version 6+) the PHPMailer.php file is found at plugins/PHPMailer/src/PHPMailer.php or plugins/PHPMailer/PHPMailer.php. In order to use PHPMailer from another directory, modify the MOD_MAIL_PHPMAILER_DIR constant in the module.inc file.</p>
|
||||
|
||||
<p>For PHPMailer <= 5.2, the file PHPMailerAutoload.php must be in plugins/PHPMailer/PHPMailerAutoload.php, and module/mail/module.inc edited to remove the two <i>use</i> lines atop the file.</p>
|
||||
|
||||
<p>The SMTP server must support multiple repeated connections. For example, if the Chair is sending an email to all contact authors and there are 100 submissions, the SMTP server will receive 100 connections, one after the other. If the SMTP server is slow, does rate limiting, or PHP is configured with a short script execution time, messages may fail.</p>
|
||||
|
||||
<h3>Configuration</h3>
|
||||
|
||||
<p>Mail options are defined via this module's settings. PHPMailer must be installed prior to accessing the settings.</p>
|
||||
|
||||
<p>If possible, enter the SMTP server's IP address for the SMTP Host to speed up processing by saving the DNS lookup.</p>
|
||||
|
||||
<p>A link is displayed at the bottom of the module's settings page to send a test message using the active mailer.</p>
|
||||
|
||||
<h3>Usage</h3>
|
||||
|
||||
<p>Once configured, this module works without user intervention.</p>
|
||||
|
||||
<h3>Note</h3>
|
||||
|
||||
<p>The SMTP server account username and password may optionally be set directly atop the module.inc file found in the module's directory -- see the section // SMTP Auth.</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<p>Version 1.0.1<br />
|
||||
- Updated to support PHPMailer 6
|
||||
</p>
|
||||
|
||||
<p>Version 1.0.0<br />
|
||||
- Initial Release</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | OpenConf |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to the OpenConf License, available on |
|
||||
// | the OpenConf web site: www.OpenConf.com |
|
||||
// +----------------------------------------------------------------------+
|
||||
|
||||
//// Add hooks
|
||||
|
||||
// Mail
|
||||
if ($OC_configAR['MOD_MAIL_mailer'] == 'smtp') {
|
||||
oc_addHook('mail', '../modules/mail/mail.inc');
|
||||
}
|
||||
|
||||
// Chair settings
|
||||
oc_addHook('chair-menu-settings-modules', array($OC_modulesAR[$moduleId]['name'], '<a href="../modules/request.php?module=mail&action=settings.inc">Mail</a>'));
|
||||
|
||||
// Settings Export/Import
|
||||
oc_addHook('settings-export-options', '../modules/mail/settings-export-options.inc');
|
||||
oc_addHook('settings-export-prep', '../modules/mail/settings-export-prep.inc');
|
||||
@@ -0,0 +1,32 @@
|
||||
## +----------------------------------------------------------------------+
|
||||
## | OpenConf |
|
||||
## +----------------------------------------------------------------------+
|
||||
## | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
## +----------------------------------------------------------------------+
|
||||
## | This source file is subject to the OpenConf License, available on |
|
||||
## | the OpenConf web site: www.OpenConf.com |
|
||||
## +----------------------------------------------------------------------+
|
||||
|
||||
|
||||
## NOTE: This file cannot contain a semi-colon (;) except at the end of a
|
||||
## SQL statement.
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
INSERT INTO `config` (`module`, `setting`, `value`, `name`, `description`, `parse`) VALUES ('mail', 'MOD_MAIL_mailer', 'php', 'Mailer', 'Mailer to use for sending messages, options: php (built-in PHP mail function), smtp (SMTP server)', 0);
|
||||
|
||||
INSERT INTO `config` (`module`, `setting`, `value`, `name`, `description`, `parse`) VALUES ('mail', 'MOD_MAIL_from_email', '', 'From Email', 'Email address to use in From field. Leave blank for Chair Email Address', 0);
|
||||
|
||||
INSERT INTO `config` (`module`, `setting`, `value`, `name`, `description`, `parse`) VALUES ('mail', 'MOD_MAIL_from_name', '', 'From Name', 'Name to use in From field. Leave blank for Event Short Name', 0);
|
||||
|
||||
INSERT INTO `config` (`module`, `setting`, `value`, `name`, `description`, `parse`) VALUES ('mail', 'MOD_MAIL_return_path', 1, 'Return Path', 'Set return path to match From Email (1=Yes, 0=no)', 0);
|
||||
|
||||
INSERT INTO `config` (`module`, `setting`, `value`, `name`, `description`, `parse`) VALUES ('mail', 'MOD_MAIL_smtp_host', '', 'SMTP Host', 'SMTP server name', 0);
|
||||
|
||||
INSERT INTO `config` (`module`, `setting`, `value`, `name`, `description`, `parse`) VALUES ('mail', 'MOD_MAIL_smtp_port', '', 'SMTP Port', 'SMTP server port', 0);
|
||||
|
||||
INSERT INTO `config` (`module`, `setting`, `value`, `name`, `description`, `parse`) VALUES ('mail', 'MOD_MAIL_smtp_encryption', 'none', 'SMTP Encryption', 'SMTP server encryption, options: none, ssl, tls', 0);
|
||||
|
||||
INSERT INTO `config` (`module`, `setting`, `value`, `name`, `description`, `parse`) VALUES ('mail', 'MOD_MAIL_smtp_username', '', 'SMTP Username', 'SMTP server account username', 0);
|
||||
|
||||
INSERT INTO `config` (`module`, `setting`, `value`, `name`, `description`, `parse`) VALUES ('mail', 'MOD_MAIL_smtp_password', '', 'SMTP Password', 'SMTP server account password', 0);
|
||||
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | OpenConf |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to the OpenConf License, available on |
|
||||
// | the OpenConf web site: www.OpenConf.com |
|
||||
// +----------------------------------------------------------------------+
|
||||
|
||||
// Use $hdr if set?
|
||||
$usehdr = 1; // 0=no, 1=set Reply-To to $hdr:From, 2=set Reply-To and From to $hdr:From
|
||||
|
||||
$mod_mail = $GLOBALS['mod_mail_phpmailer'];
|
||||
|
||||
// Setup PHPMailer if not already configured
|
||||
if ($mod_mail->Mailer != 'smtp') {
|
||||
// From name/address to use
|
||||
if (empty($OC_configAR['MOD_MAIL_from_name'])) {
|
||||
$from_name = $OC_configAR['OC_confName'];
|
||||
} else {
|
||||
$from_name = $OC_configAR['MOD_MAIL_from_name'];
|
||||
}
|
||||
|
||||
if (empty($OC_configAR['MOD_MAIL_from_email'])) {
|
||||
$from_email = $OC_configAR['OC_pcemail'];
|
||||
} else {
|
||||
$from_email = $OC_configAR['MOD_MAIL_from_email'];
|
||||
}
|
||||
|
||||
// $hdr set?
|
||||
if ( isset($hdr) && ($usehdr > 0) && preg_match("/From: \"?([^\"<]+)\"?\s?<([^>]+)>/", $hdr, $matches) && !empty($matches[1]) && validEmail($matches[2])) {
|
||||
$reply_name = $matches[1];
|
||||
$reply_email = $matches[2];
|
||||
if ($usehdr == 2) {
|
||||
$from_name = $reply_name;
|
||||
$from_email = $reply_email;
|
||||
}
|
||||
} else {
|
||||
$reply_name = $from_name;
|
||||
$reply_email = $from_email;
|
||||
}
|
||||
|
||||
// Setup
|
||||
$mod_mail->isSMTP();
|
||||
$mod_mail->Host = $OC_configAR['MOD_MAIL_smtp_host'];
|
||||
$mod_mail->Port = $OC_configAR['MOD_MAIL_smtp_port'];
|
||||
if (!empty($OC_configAR['MOD_MAIL_smtp_username']) && !empty($OC_configAR['MOD_MAIL_smtp_password'])) {
|
||||
if (!isset($GLOBALS['mod_mail_smtp_password'])) {
|
||||
$GLOBALS['mod_mail_smtp_password'] = oc_decrypt($OC_configAR['MOD_MAIL_smtp_password']);
|
||||
}
|
||||
$mod_mail->SMTPAuth = true;
|
||||
$mod_mail->Username = $OC_configAR['MOD_MAIL_smtp_username'];
|
||||
$mod_mail->Password = $GLOBALS['mod_mail_smtp_password'];
|
||||
} elseif (defined('MOD_MAIL_SMTP_USERNAME') && defined('MOD_MAIL_SMTP_PASSWORD')) {
|
||||
$mod_mail->SMTPAuth = true;
|
||||
$mod_mail->Username = MOD_MAIL_SMTP_USERNAME;
|
||||
$mod_mail->Password = MOD_MAIL_SMTP_PASSWORD;
|
||||
} else {
|
||||
$mod_mail->SMTPAuth = false;
|
||||
}
|
||||
if ($OC_configAR['MOD_MAIL_smtp_encryption'] != 'none') {
|
||||
$mod_mail->SMTPSecure = $OC_configAR['MOD_MAIL_smtp_encryption'];
|
||||
}
|
||||
$mod_mail->setFrom($from_email, $from_name, ($OC_configAR['MOD_MAIL_return_path'] ? true : false));
|
||||
$mod_mail->addReplyTo($reply_email, $reply_name);
|
||||
$mod_mail->CharSet = 'UTF-8';
|
||||
$mod_mail->WordWrap = $OC_configAR['OC_emailWrap'];
|
||||
if ($GLOBALS['mod_mail_debug']) {
|
||||
$mod_mail->SMTPDebug = $GLOBALS['mod_mail_debug'];
|
||||
$mod_mail->Debugoutput = 'html';
|
||||
}
|
||||
$GLOBALS['mod_mail_phpmailer'] = $mod_mail;
|
||||
}
|
||||
|
||||
// Addresse(es)
|
||||
if ($to_emails = preg_split("/,/", $to)) {
|
||||
foreach($to_emails as $address) {
|
||||
$mod_mail->addAddress($address);
|
||||
}
|
||||
} else {
|
||||
$mod_mail->addAddress($to);
|
||||
}
|
||||
|
||||
// Subject & Body
|
||||
$mod_mail->Subject = $subject;
|
||||
$mod_mail->Body = $body;
|
||||
|
||||
// Send it
|
||||
if ($mod_mail->send()) {
|
||||
$mod_mail->clearAddresses();
|
||||
return(true);
|
||||
} else {
|
||||
$mod_mail->clearAddresses();
|
||||
oc_logit('email-smtp', 'SMTP Failure to ' . $to . ' -- ' . $mod_mail->ErrorInfo);
|
||||
return(false);
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | OpenConf |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to the OpenConf License, available on |
|
||||
// | the OpenConf web site: www.OpenConf.com |
|
||||
// +----------------------------------------------------------------------+
|
||||
|
||||
// SMTP Auth -- server account credentials, define below to avoid storing in database
|
||||
# define('MOD_MAIL_SMTP_USERNAME', '');
|
||||
# define('MOD_MAIL_SMTP_PASSWORD', '');
|
||||
|
||||
use PHPMailer\PHPMailer\PHPMailer; // comment out or remove if PHPMailer <= 5.2
|
||||
use PHPMailer\PHPMailer\Exception; // comment out or remove if PHPMailer <= 5.2
|
||||
|
||||
// Module ID - needs to match directory name
|
||||
$moduleId = 'mail';
|
||||
|
||||
// Module info
|
||||
$OC_modulesAR[$moduleId] = array(
|
||||
'name' => 'Mail',
|
||||
'description' => 'Provides support for using an external SMTP server',
|
||||
'version' => '1.0.1',
|
||||
'dependencies' => array(),
|
||||
'developer' => 'OpenConf'
|
||||
);
|
||||
|
||||
// PHPMailer plugin directory
|
||||
if (!defined('MOD_MAIL_PHPMAILER_DIR')) {
|
||||
define('MOD_MAIL_PHPMAILER_DIR', OCC_PLUGINS_DIR . 'PHPMailer/');
|
||||
}
|
||||
|
||||
// PHPMailer loader
|
||||
$GLOBALS['mod_mail_phpmailer'] = false;
|
||||
$GLOBALS['mod_mail_debug'] = 0;
|
||||
if ($OC_configAR['MOD_MAIL_mailer'] == 'smtp') {
|
||||
if (is_file(MOD_MAIL_PHPMAILER_DIR . 'src/PHPMailer.php')) { // >= 6
|
||||
require_once MOD_MAIL_PHPMAILER_DIR . 'src/PHPMailer.php';
|
||||
require_once MOD_MAIL_PHPMAILER_DIR . 'src/Exception.php';
|
||||
require_once MOD_MAIL_PHPMAILER_DIR . 'src/SMTP.php';
|
||||
} elseif (is_file(MOD_MAIL_PHPMAILER_DIR . 'PHPMailer.php')) { // >= 6 (no src/)
|
||||
require_once MOD_MAIL_PHPMAILER_DIR . 'PHPMailer.php';
|
||||
require_once MOD_MAIL_PHPMAILER_DIR . 'Exception.php';
|
||||
require_once MOD_MAIL_PHPMAILER_DIR . 'SMTP.php';
|
||||
} elseif (is_file(MOD_MAIL_PHPMAILER_DIR . 'PHPMailerAutoload.php')) { // <= 5.2 | comment out use statements above
|
||||
require_once MOD_MAIL_PHPMAILER_DIR . 'PHPMailerAutoload.php';
|
||||
} else {
|
||||
err('Mail SMTP set, however plugin not found; see Mail module info page for requirements');
|
||||
}
|
||||
$GLOBALS['mod_mail_phpmailer'] = new PHPMailer;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | OpenConf |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to the OpenConf License, available on |
|
||||
// | the OpenConf web site: www.OpenConf.com |
|
||||
// +----------------------------------------------------------------------+
|
||||
|
||||
|
||||
print '
|
||||
<br />
|
||||
<label><input type="checkbox" name="settings[]" value="mail" /> Mail - Configuration</label><br />
|
||||
';
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | OpenConf |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to the OpenConf License, available on |
|
||||
// | the OpenConf web site: www.OpenConf.com |
|
||||
// +----------------------------------------------------------------------+
|
||||
|
||||
if (in_array('mail', $_POST['settings'])) {
|
||||
$settings['modules']['mail'] = $OC_modulesAR['mail']['name'];
|
||||
$oc_encryptedSettingsAR[] = 'mail:MOD_MAIL_smtp_password';
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | OpenConf |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to the OpenConf License, available on |
|
||||
// | the OpenConf web site: www.OpenConf.com |
|
||||
// +----------------------------------------------------------------------+
|
||||
|
||||
// Check for PHPMailer
|
||||
if (!is_dir(MOD_MAIL_PHPMAILER_DIR)) {
|
||||
warn('PHPMailer plugin is missing. <a href="https://github.com/PHPMailer/PHPMailer" target="_blank" rel="noopener noreferrer">Download</a> and install it to the directory plugins/PHPMailer/.');
|
||||
exit;
|
||||
}
|
||||
|
||||
$MOD_MAIL_configVars = array('MOD_MAIL_mailer', 'MOD_MAIL_from_email', 'MOD_MAIL_from_name', 'MOD_MAIL_return_path', 'MOD_MAIL_smtp_host', 'MOD_MAIL_smtp_port', 'MOD_MAIL_smtp_encryption');
|
||||
|
||||
if (!defined('MOD_MAIL_SMTP_USERNAME')) {
|
||||
$MOD_MAIL_configVars[] = 'MOD_MAIL_smtp_username';
|
||||
}
|
||||
|
||||
$mod_mail_mailerOptions = array(
|
||||
'php' => 'PHP mail() function',
|
||||
'smtp' => 'SMTP server'
|
||||
);
|
||||
|
||||
$mod_mail_encryptionOptions = array(
|
||||
'none' => 'none',
|
||||
'ssl' => 'SSL',
|
||||
'tls' => 'TLS'
|
||||
);
|
||||
|
||||
$mod_mail_returnPathOptions = array(
|
||||
'1' => 'use From Email',
|
||||
'0' => 'do not set'
|
||||
);
|
||||
|
||||
$err = array();
|
||||
|
||||
// Save settings?
|
||||
if (isset($_POST['submit']) && ($_POST['submit'] == 'Save Settings')) {
|
||||
|
||||
// Check for valid submission
|
||||
if (!validToken('chair')) {
|
||||
warn('Invalid submission');
|
||||
}
|
||||
|
||||
// Check input
|
||||
if (!isset($_POST['MOD_MAIL_mailer']) || !isset($mod_mail_mailerOptions[$_POST['MOD_MAIL_mailer']])) {
|
||||
$err[] = 'Mailer invalid';
|
||||
} elseif (($_POST['MOD_MAIL_mailer'] == 'smtp') && (empty(trim($_POST['MOD_MAIL_smtp_host'])) || empty(trim($_POST['MOD_MAIL_smtp_port'])))) {
|
||||
$err[] = 'SMTP Host and Port must be filled in when SMTP selected';
|
||||
}
|
||||
if (!empty($_POST['MOD_MAIL_from_email']) && !validEmail(trim($_POST['MOD_MAIL_from_email']))) {
|
||||
$err[] = 'From Email invalid';
|
||||
}
|
||||
if (!isset($_POST['MOD_MAIL_return_path']) || !isset($mod_mail_returnPathOptions[$_POST['MOD_MAIL_return_path']])) {
|
||||
$err[] = 'Return Path invalid';
|
||||
}
|
||||
if (!empty($_POST['MOD_MAIL_smtp_port']) && !preg_match("/^\d+$/", $_POST['MOD_MAIL_smtp_port'])) {
|
||||
$err[] = 'SMTP Port invalid';
|
||||
}
|
||||
if (!isset($_POST['MOD_MAIL_smtp_encryption']) || !isset($mod_mail_encryptionOptions[$_POST['MOD_MAIL_smtp_encryption']])) {
|
||||
$err[] = 'Encryption invalid';
|
||||
}
|
||||
|
||||
if (!empty($err)) {
|
||||
print '<div class="warn"><p>Please re-enter your settings, noting the following:</p><ul><li>' . implode('</li><li>', $err) . '</li></ul></div><br /><hr /><br />';
|
||||
} else {
|
||||
if (
|
||||
isset($_POST['MOD_MAIL_smtp_password'])
|
||||
&& ($_POST['MOD_MAIL_smtp_password'] != '***')
|
||||
&& !empty($_POST['MOD_MAIL_smtp_password'])
|
||||
) {
|
||||
$_POST['MOD_MAIL_smtp_password'] = oc_encrypt($_POST['MOD_MAIL_smtp_password']);
|
||||
$MOD_MAIL_configVars[] = 'MOD_MAIL_smtp_password';
|
||||
}
|
||||
elseif (
|
||||
!empty($OC_configAR['MOD_MAIL_smtp_password'])
|
||||
&&
|
||||
(!isset($_POST['MOD_MAIL_smtp_password']) || ($_POST['MOD_MAIL_smtp_password'] == ''))
|
||||
) {
|
||||
$_POST['MOD_MAIL_smtp_password'] = '';
|
||||
$MOD_MAIL_configVars[] = 'MOD_MAIL_smtp_password';
|
||||
}
|
||||
|
||||
// Update config settings
|
||||
updateAllConfigSettings($MOD_MAIL_configVars, $_POST, OCC_MODULE_ID);
|
||||
|
||||
// notify user
|
||||
print '<p style="text-align: center" class="note">Settings Saved</p>';
|
||||
}
|
||||
} else {
|
||||
foreach ($MOD_MAIL_configVars as $var) {
|
||||
$_POST[$var] = $OC_configAR[$var];
|
||||
}
|
||||
$_POST['MOD_MAIL_smtp_password'] = $OC_configAR['MOD_MAIL_smtp_password'];
|
||||
}
|
||||
|
||||
// Show settings
|
||||
print '
|
||||
<form method="post" action="' . OCC_SELF . '" class="ocform occonfigform">
|
||||
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
|
||||
|
||||
<script>
|
||||
document.write(\'<p style="margin: 0 0 2em 1em;"><span style="color: #66f; text-decoration: underline; cursor: pointer;" onclick="oc_fsCollapseExpand(0)">collapse all</span> <span style="color: #66f; text-decoration: underline; cursor: pointer;" onclick="oc_fsCollapseExpand(1)">expand all</span></p>\');
|
||||
</script>
|
||||
|
||||
<fieldset id="oc_fs_mod_mail_main">
|
||||
<legend onclick="oc_fsToggle(this)">Mailer <span>(collapse)</span></legend>
|
||||
<div id="oc_fs_mod_mail_main_div">
|
||||
|
||||
<div class="field"><label for="MOD_MAIL_mailer">Mailer:</label>
|
||||
<fieldset class="radio">' . generateRadioOptions('MOD_MAIL_mailer', $mod_mail_mailerOptions, varValue('MOD_MAIL_mailer', $_POST)) . '</fieldset><div class="fieldnote note"><br />If selecting SMTP server, fill out section below</div>
|
||||
</div>
|
||||
|
||||
<input type="submit" name="submit" value="Save Settings" class="submit" />
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
|
||||
<fieldset id="oc_fs_mod_mail_smtp">
|
||||
<legend onclick="oc_fsToggle(this)">SMTP Server Options <span>(collapse)</span></legend>
|
||||
<div id="oc_fs_mod_mail_smtp_div">
|
||||
|
||||
<div class="field"><label for="MOD_MAIL_smtp_host">SMTP Host:</label> <input name="MOD_MAIL_smtp_host" class="ocinput" size="80" value="' . safeHTMLstr(varValue('MOD_MAIL_smtp_host', $_POST)) . '" /><div class="fieldnote note">The use of an IP address is recommended</div></div>
|
||||
|
||||
<div class="field"><label for="MOD_MAIL_smtp_port">SMTP Port:</label> <input name="MOD_MAIL_smtp_port" class="ocinput" size="6" value="' . safeHTMLstr(varValue('MOD_MAIL_smtp_port', $_POST)) . '" /></div>
|
||||
|
||||
<div class="field"><label for="MOD_MAIL_smtp_encryption">Encryption:</label>
|
||||
<fieldset class="radio">' . generateRadioOptions('MOD_MAIL_smtp_encryption', $mod_mail_encryptionOptions, varValue('MOD_MAIL_smtp_encryption', $_POST)) . '</fieldset>
|
||||
</div>
|
||||
';
|
||||
|
||||
if (!defined('MOD_MAIL_SMTP_USERNAME')) {
|
||||
print '
|
||||
<div class="field"><label for="MOD_MAIL_smtp_username">Username:</label> <input name="MOD_MAIL_smtp_username" class="ocinput" size="80" value="' . safeHTMLstr(varValue('MOD_MAIL_smtp_username', $_POST)) . '" /><div class="fieldnote note">Leave username and password blank if server does not require authentication</div></div>
|
||||
|
||||
<div class="field"><label for="MOD_MAIL_smtp_password">Password:</label> <input name="MOD_MAIL_smtp_password" class="ocinput" size="80" value="' . ((empty($err) && !empty($OC_configAR['MOD_MAIL_smtp_password'])) ? '***' : varValue('MOD_MAIL_smtp_password', $_POST)) . '" /><div class="fieldnote note">If password saved, *** will display above</div></div>';
|
||||
}
|
||||
|
||||
print '
|
||||
|
||||
<div class="field"><label for="MOD_MAIL_return_path">Return Path:</label>
|
||||
<fieldset class="radio">' . generateRadioOptions('MOD_MAIL_return_path', $mod_mail_returnPathOptions, varValue('MOD_MAIL_return_path', $_POST)) . '</fieldset>
|
||||
</div>
|
||||
|
||||
<div class="field"><label for="MOD_MAIL_from_name">From Name:</label> <input name="MOD_MAIL_from_name" class="ocinput" size="80" value="' . safeHTMLstr(varValue('MOD_MAIL_from_name', $_POST)) . '" /><div class="fieldnote note">Leave blank to use Event/Journal Short Name</div></div>
|
||||
|
||||
<div class="field"><label for="MOD_MAIL_from_email">From Email:</label> <input name="MOD_MAIL_from_email" class="ocinput" size="80" value="' . safeHTMLstr(varValue('MOD_MAIL_from_email', $_POST)) . '" /><div class="fieldnote note">Leave blank to use Chair Email Address</div></div>
|
||||
|
||||
<input type="submit" name="submit" value="Save Settings" class="submit" />
|
||||
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
</form>
|
||||
';
|
||||
|
||||
if (($OC_configAR['MOD_MAIL_mailer'] == 'php') || (($OC_configAR['MOD_MAIL_mailer'] == 'smtp') && !empty($OC_configAR['MOD_MAIL_smtp_host']))) {
|
||||
print '
|
||||
<p style="font-style: italic;">Once settings are saved, <a href="../modules/request.php?module=mail&action=test.php" onclick="window.open(\'../modules/request.php?module=mail&action=test.php\', \'mail\',\'width=700,height=300,toolbar=0,status=0,menubar=0,resizable=1,scrollbars=1,location=0\'); return false;" title="opens new window to send a test message">test by sending a message</a></p>
|
||||
<p>For troubleshooting assistance, see our <a href="https://www.openconf.com/documentation/email.php#troubleshooting" title="opens guide in new window" target="_blank">email guide</a>. If the SMTP mailer is enabled, also see the <a href="https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting" title="opens wiki in new window" target="_blank" rel="noopener noreferrer">PHPMailer wiki</a>.</p>
|
||||
';
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | OpenConf |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to the OpenConf License, available on |
|
||||
// | the OpenConf web site: www.OpenConf.com |
|
||||
// +----------------------------------------------------------------------+
|
||||
|
||||
beginChairSession();
|
||||
|
||||
print '<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Send Test Message</title>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" type="text/css" href="../openconf.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="mainbody">
|
||||
';
|
||||
|
||||
if (isset($_POST['submit']) && ($_POST['submit'] == 'Send Message') && isset($_POST['email']) && validEmail($_POST['email'])) {
|
||||
if (!validToken('chair')) {
|
||||
print '<p class="err">invalid submission</p>';
|
||||
} else {
|
||||
$GLOBALS['mod_mail_debug'] = 3;
|
||||
if (oc_mail($_POST['email'], 'Test Message', 'This is a test message.')) {
|
||||
print '<p class="note2">Message sent successfully</p>';
|
||||
} else {
|
||||
print '<p class="warn">Message failed</p>';
|
||||
}
|
||||
}
|
||||
print '<hr />';
|
||||
}
|
||||
|
||||
print '
|
||||
<form method="post" action="' . OCC_SELF . '">
|
||||
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
|
||||
<p>Enter an email address to send a test message using the ' . safeHTMLstr($OC_configAR['MOD_MAIL_mailer']) . ' mailer to:</p>
|
||||
<p><input type="email" size="50" name="email" placeholder="email address" autofocus value="' . safeHTMLstr(varValue('email', $_POST)) . '" /></p>
|
||||
<p><input type="submit" name="submit" class="submit" value="Send Message" /></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
';
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,15 @@
|
||||
## +----------------------------------------------------------------------+
|
||||
## | OpenConf |
|
||||
## +----------------------------------------------------------------------+
|
||||
## | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
## +----------------------------------------------------------------------+
|
||||
## | This source file is subject to the OpenConf License, available on |
|
||||
## | the OpenConf web site: www.OpenConf.com |
|
||||
## +----------------------------------------------------------------------+
|
||||
|
||||
## NOTE: This file cannot contain a semi-colon (;) except at the end of a
|
||||
## SQL statement.
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
DELETE FROM `config` WHERE `module`='mail';
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | OpenConf |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to the OpenConf License, available on |
|
||||
// | the OpenConf web site: www.OpenConf.com |
|
||||
// +----------------------------------------------------------------------+
|
||||
|
||||
// encrypt pw
|
||||
if (!empty($OC_configAR['MOD_MAIL_smtp_password'])) {
|
||||
ocsql_query("UPDATE `" . OCC_TABLE_CONFIG . "` SET `value`='" . safeSQLstr(oc_encrypt($OC_configAR['MOD_MAIL_smtp_password'])) . "' WHERE `module`='mail' AND `setting`='MOD_MAIL_smtp_password' LIMIT 1");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | OpenConf |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to the OpenConf License, available on |
|
||||
// | the OpenConf web site: www.OpenConf.com |
|
||||
// +----------------------------------------------------------------------+
|
||||
|
||||
// Set modules table to dontempty
|
||||
oc_addHook('db-reset-dontempty', OCC_TABLE_MODULES);
|
||||
|
||||
// returns true/false whether a module ID is valid
|
||||
function oc_moduleValid($moduleId) {
|
||||
if (preg_match("/^_?[a-z][a-z0-9_]+$/",$moduleId) && is_file($GLOBALS['pfx'] . 'modules/' . $moduleId . '/module.inc')) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// returns true/false whether a module is active based on its ID
|
||||
function oc_moduleActive($moduleId) {
|
||||
if (in_array($moduleId,$GLOBALS['OC_activeModulesAR'])) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// returns true/false whether a module is installed based on its ID
|
||||
function oc_module_installed($moduleId) {
|
||||
if (isset($GLOBALS['OC_modulesAR'][$moduleId])) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Given a SQL file path/name, issues the commands to database,
|
||||
// changing "SQLOP `***" to "SQLOP `OCC_DB_PREFIX.***"
|
||||
function oc_loadSchema($file) {
|
||||
// operations for which table name will be prefixed
|
||||
$sqlOps = 'DROP TABLE IF EXISTS|CREATE TABLE IF NOT EXISTS|CREATE TABLE|UPDATE|INSERT INTO|ALTER TABLE|DROP TABLE|DELETE FROM|TRUNCATE TABLE';
|
||||
// check for file and read it in
|
||||
if (is_file($file) && ($dbfile = file_get_contents($file))) {
|
||||
// get a list of all operations
|
||||
if (preg_match_all("/((?:" . $sqlOps . ") [^;]+);/", $dbfile, $matches)) {
|
||||
// iterate through ops, prefixing table name if needed, adding encoding/collation, and issuing SQL
|
||||
foreach ($matches[1] as $m) {
|
||||
if (OCC_DB_PREFIX != '') {
|
||||
$m = preg_replace("/((?:" . $sqlOps . ") `?)/", "$1" . OCC_DB_PREFIX, $m);
|
||||
}
|
||||
if (preg_match("/^CREATE TABLE /i", $m)) {
|
||||
$m .= " DEFAULT CHARACTER SET " . OCC_DB_ENCODING . " COLLATE " . OCC_DB_COLLATION;
|
||||
}
|
||||
ocsql_query($m) or err('Unable to process SQL (' . safeHTMLstr(ocsql_error()) . ')'.$m, 'Error', 1);
|
||||
}
|
||||
} else {
|
||||
err('No SQL commands found in file; (un)installation failed', 'Error', 1);
|
||||
}
|
||||
} else {
|
||||
err('Invalid SQL file; installation failed', 'Error', 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Generate SEO indexable module URL
|
||||
// This format should be a temporary solution
|
||||
function oc_friendlyModuleURL($url) {
|
||||
if ($GLOBALS['OC_configAR']['OC_friendlyURLs'] && preg_match("/^(.*modules\/)?request.php\?module=([^\&]+)&action=([^\&]*)\.php\&?(.*)$/", $url, $matches)) {
|
||||
$newurl = $matches[1];
|
||||
if (oc_moduleActive($matches[2]) && !empty($matches[3])) {
|
||||
$newurl .= '_' . $matches[2] . '-' . $matches[3] . '..';
|
||||
if (isset($matches[4]) && !empty($matches[4])) {
|
||||
$newurl .= preg_replace(array('/&/','/=/'), array('_-', '--'), $matches[4]) . '_-';
|
||||
}
|
||||
$url = $newurl;
|
||||
}
|
||||
}
|
||||
return($url);
|
||||
}
|
||||
|
||||
// get a list of installed modules & read in module info
|
||||
if (isset($_POST['submit']) && preg_match("/\/chair\/sig.in\.php/", $_SERVER['PHP_SELF']) && ini_get('allow_url_fopen') && !preg_match("/\x3a/", OCC_LICENSE)){ob_start();printFooter();$a=ob_get_contents();ob_end_clean();if (!preg_match("/Open[C]onf.*Za[k]on\sG[r]oup/", $a)){print base64_decode('UGxlYXNlIHJlc3RvcmUgdGhlIE9wZW5Db25mIGNvcHlyaWdodCBub3RpY2Ugb3IgcHVyY2hhc2UgYSBicmFuZGluZy1mcmVlIGxpY2Vuc2UgYXQgd3d3Lk9wZW5Db25mLmNvbQ==');ocGetFile('http://www.openconf.com/licv.php?s='.urlencode($_SERVER['HTTP_HOST']).'&p='.urlencode($_SERVER['PHP_SELF']));exit;}}
|
||||
$q = "SELECT * FROM `" . OCC_TABLE_MODULES . "` ORDER BY `moduleid` ASC";
|
||||
$r = ocsql_query($q) or err('Unable to retrieve modules');
|
||||
$moduleAR = array();
|
||||
$NonOCmoduleAR = array();
|
||||
while ($l = ocsql_fetch_assoc($r)) {
|
||||
if (preg_match("/^(?:captcha|filetype|mail|oc_|_oc_)/", $l['moduleId'])) {
|
||||
$moduleAR[] = array('moduleId'=>$l['moduleId'], 'moduleActive'=>$l['moduleActive']);
|
||||
} else {
|
||||
$NonOCmoduleAR[] = array('moduleId'=>$l['moduleId'], 'moduleActive'=>$l['moduleActive']);
|
||||
}
|
||||
}
|
||||
$moduleAR = array_merge($moduleAR, $NonOCmoduleAR); // process OC modules first
|
||||
foreach ($moduleAR as $l) {
|
||||
$OC_moduleDir = $pfx . 'modules/' . $l['moduleId'];
|
||||
if ((filetype($OC_moduleDir) == 'dir') && is_file($OC_moduleDir . '/module.inc')) {
|
||||
require_once $OC_moduleDir . '/module.inc';
|
||||
if (($l['moduleActive'] == 1)&&(!preg_match("/^oc_/",$moduleId)||(OCC_LICENSE!='Public'))) {
|
||||
if (preg_match("/^o"."c_/",$moduleId)&&(!preg_match("/^(\w+) /", OCC_LICENSE_TYPE, $m)||
|
||||
!preg_match("/\b" . strtolower($m[1]) . "\b/", $OC_modulesAR[$l['moduleId']]['supported'])))
|
||||
{continue;}else{$mok=true;}
|
||||
$OC_activeModulesAR[] = $l['moduleId'];
|
||||
|
||||
if (isset($mok) && $mok && is_file($OC_moduleDir . '/init.inc')) {
|
||||
require_once $OC_moduleDir . '/init.inc';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,157 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | OpenConf |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to the OpenConf License, available on |
|
||||
// | the OpenConf web site: www.OpenConf.com |
|
||||
// +----------------------------------------------------------------------+
|
||||
|
||||
$deprecatedModuleAR = array('oc_subtype');
|
||||
|
||||
require_once "../include.php";
|
||||
|
||||
beginChairSession();
|
||||
|
||||
printHeader("Modules",1);
|
||||
|
||||
?>
|
||||
<p>Additional OpenConf functionality is available through modules. In order to use a module, you must first install it, and then activate it. If a module is installed, but not active, its data will still be preserved. Uninstalling a module will result in the module's data being deleted.</p>
|
||||
<p>The <em>Module Name</em> link provides access to the module's configuration settings.<br />
|
||||
The <em>Version</em> link provides information about the module.</p>
|
||||
<br />
|
||||
|
||||
<div class="legend" title="Legend" id="mod_legend">
|
||||
Status Legend:
|
||||
<span style="background-color: #0f0; color: #000; padding: 3px">•</span> Active
|
||||
|
||||
<span style="background-color: #f99; color: #000; padding: 3px">o</span> Disabled
|
||||
|
||||
<span style="background-color: #f00; color: #000; padding: 3px">x</span> Not Installed
|
||||
</div>
|
||||
<br />
|
||||
|
||||
<table border="0" cellspacing="1" cellpadding="5">
|
||||
<tr class="rowheader"><th title="module status" scope="col" aria-describedby="mod_legend"> </th><th scope="col">Module Name</th><th scope="col">Version</th><th scope="col">Source</th><th scope="col">Description</th><th colspan="3" scope="col">Action</th></tr>
|
||||
|
||||
<?php
|
||||
|
||||
$row = 1;
|
||||
|
||||
// Display installed modules sorted by name
|
||||
$moduleNamesAR = array();
|
||||
foreach ($OC_modulesAR as $mID => $mAR) {
|
||||
$moduleNamesAR[$mID] = $mAR['name'];
|
||||
}
|
||||
asort($moduleNamesAR);
|
||||
foreach ($moduleNamesAR as $mID => $mName) {
|
||||
// is module activate or disabled?
|
||||
if (in_array($mID,$OC_activeModulesAR)) {
|
||||
$color = '#0f0';
|
||||
$symbol = '•';
|
||||
$action = 'deactivate';
|
||||
} else {
|
||||
$color = '#f99';
|
||||
$symbol = 'o';
|
||||
$action = 'activate';
|
||||
}
|
||||
// Is module configurable?
|
||||
if (is_file($mID . '/settings.inc')) {
|
||||
$configURL = 'request.php?module=' . $mID . '&action=settings.inc';
|
||||
} else {
|
||||
$configURL = '';
|
||||
}
|
||||
// Readme?
|
||||
if (preg_match("/^oc_/",$mID)&&(!preg_match("/^(\w+) /", constant('OCC_LI'.'CENSE_T'.'YPE'), $m)||
|
||||
!preg_match("/\b" . strtolower($m[1]) . "\b/", $OC_modulesAR[$mID]['sup'.'ported']))){continue;}
|
||||
if (is_file($mID . '/README.html')) {
|
||||
$version = '<a href="readme.php?m=' . $mID . '" title="Click for module info (new window)" target="_blank">' . safeHTMLstr($OC_modulesAR[$mID]['version']) . '</a>';
|
||||
} else {
|
||||
$version = safeHTMLstr($OC_modulesAR[$mID]['version']);
|
||||
}
|
||||
print '<tr class="row' . $row . ' rowselect"><td style="background-color: ' . $color . '; color: #000">' . $symbol . '</td><td scope="row">' . (empty($configURL) ? safeHTMLstr($OC_modulesAR[$mID]['name']) : ('<a href="' . $configURL . '" title="click to config">' . safeHTMLstr($OC_modulesAR[$mID]['name']) . '</a>')) . '</td><td style="text-align: center">' . $version . '</td><td>' . (($OC_modulesAR[$mID]['developer'] == 'OpenConf') ? 'OpenConf' : 'Third-Party') . '</td><td>' . safeHTMLstr($OC_modulesAR[$mID]['description']) . '</td><td>' . (empty($configURL) ? '</td>' : ('<a href="' . $configURL . '">config</a></td>')) . '<td style="text-align: center"><a href="' . $action . '.php?module=' . $mID . '">' . $action . '</a></td><td><a href="uninstall.php?module=' . $mID . '" onclick="return confirm(\'Please confirm your request to uninstall this module. All data stored by module will be deleted.\')">uninstall</a></td></tr>';
|
||||
$row = $rowAR[$row];
|
||||
}
|
||||
|
||||
// Get uninstalled modules
|
||||
$uninstalledModulesAR = array();
|
||||
if ($dh = opendir('./')) {
|
||||
while (($dir = readdir($dh)) !== false) {
|
||||
if ((filetype($dir) == 'dir') && !preg_match("/[\.\/]/",$dir) && is_file($dir . '/module.inc') && !oc_module_installed($dir) && oc_moduleValid($dir) && !in_array($dir, $deprecatedModuleAR)) {
|
||||
require_once $dir . '/module.inc';
|
||||
if (preg_match("/^oc_/",$dir)&&(!preg_match("/^(\w+) /", OCC_LICENSE_TYPE, $m)||
|
||||
!preg_match("/\b" . strtolower($m[1]) . "\b/", $OC_modulesAR[$dir]['supported'])))
|
||||
{unset($OC_modulesAR[$dir]);}else{$uninstalledModulesAR[] = $dir;}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Show a break between uninstalled modules
|
||||
if (!empty($moduleNamesAR) && !empty($uninstalledModulesAR)) {
|
||||
print '<tr><td class="rowheader" colspan="10" style="height: 10px"></td></tr>';
|
||||
}
|
||||
// Sort & display uninstalled modules
|
||||
$moduleNamesAR = array();
|
||||
foreach ($uninstalledModulesAR as $mID) {
|
||||
if ((OCC_LICENSE != 'Public') || !preg_match("/^oc_/", $mID)) {
|
||||
$moduleNamesAR[$mID] = $OC_modulesAR[$mID]['name'];
|
||||
}
|
||||
}
|
||||
uasort($moduleNamesAR, 'strcasecmp');
|
||||
$color = '#f33';
|
||||
$symbol = 'x';
|
||||
foreach ($moduleNamesAR as $mID => $mName) {
|
||||
// Readme?
|
||||
if (is_file($mID . '/README.html')) {
|
||||
$version = '<a href="readme.php?m=' . $mID . '" title="Click for module info (new window)" target="_blank">' . safeHTMLstr($OC_modulesAR[$mID]['version']) . '</a>';
|
||||
} else {
|
||||
$version = safeHTMLstr($OC_modulesAR[$mID]['version']);
|
||||
}
|
||||
print '<tr class="row' . $row . ' rowselect"><td style="background-color: ' . $color . '; color: #000">' . $symbol . '</td><td scope="row">' . safeHTMLstr($OC_modulesAR[$mID]['name']) . '</td><td style="text-align: center">' . $version . '</td><td>' . (($OC_modulesAR[$mID]['developer'] == 'OpenConf') ? 'OpenConf' : 'Third-Party') . '</td><td>' . safeHTMLstr($OC_modulesAR[$mID]['description']) . '</td><td> </td><td> </td><td style="text-align: center"><a href="install.php?module=' . $mID . '">install</a></td></tr>';
|
||||
$row = $rowAR[$row];
|
||||
}
|
||||
|
||||
$plusModulesAR = array(
|
||||
'Acceptance' => 'Provides Chair with the ability to change acceptance options',
|
||||
'Advocate Assign' => 'Allows advocates to assign reviews',
|
||||
'Bidding' => 'Bidding on papers by reviewers, and bid-based assignments',
|
||||
'Discussion' => 'Online discussion (forum) for committee members',
|
||||
'Proceedings' => 'Online proceedings',
|
||||
'Rebuttal' => 'Author rebuttal of reviews, and reviewer rebuttal of author comments',
|
||||
'Reviewer Upload' => 'Reviewer file upload for assigned reviews (e.g., annotation, feedback)'
|
||||
);
|
||||
$proModulesAR = array(
|
||||
'Auto Assign' => 'Automatically assigns reviewers/advocate when a submission is made',
|
||||
'Custom Forms' => 'Customize submission, review, and committee profile forms',
|
||||
'Copyright-ACM' => 'Provides export of submissions in ACM ICPS CSV format',
|
||||
'Copyright-IEEE' => 'Provides author referral form to IEEE\'s electronic copyright system',
|
||||
'MultiFile' => 'Multiple file type uploads',
|
||||
'ORCID' => 'Provides review credit to committee members via ORCID service',
|
||||
'Plagiarism-Docoloc' => 'Docoloc plagiarism checking service',
|
||||
'Plagiarism-iThenticate' => 'CrossCheck and iThenticate plagiarism checking services',
|
||||
'Program' => 'Online and mobile program building and display options',
|
||||
'Sub. Pre-Payment' => 'Require payment for making a submission'
|
||||
);
|
||||
if (OCC_LICENSE == 'Public') {
|
||||
$otherModulesAR = array_merge($plusModulesAR, $proModulesAR);
|
||||
} elseif (defined('OCC_LICENSE_TYPE') && preg_match("/Plus/", OCC_LICENSE_TYPE)) {
|
||||
$otherModulesAR = $proModulesAR;
|
||||
} else {
|
||||
$otherModulesAR = array();
|
||||
}
|
||||
if (count($otherModulesAR) > 0) {
|
||||
ksort($otherModulesAR);
|
||||
print '<tr><td class="rowheader" colspan="10" style="height: 10px"></td></tr>';
|
||||
foreach ($otherModulesAR as $k=>$v) {
|
||||
print '<tr class="row' . ($row = $rowAR[$row]) . ' rowselect"><td>' . $symbol . '</td><td scope="row">' . safeHTMLstr($k) . '</td><td> </td><td>OpenConf</td><td>' . safeHTMLstr($v) . '</td><td colspan="3" style="text-align: center"><a href="https://www.openconf.com/editions/" target="_blank">upgrade for access</a></td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
</table>
|
||||
<br /><br />
|
||||
|
||||
<?php
|
||||
printFooter();
|
||||
?>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | OpenConf |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to the OpenConf License, available on |
|
||||
// | the OpenConf web site: www.OpenConf.com |
|
||||
// +----------------------------------------------------------------------+
|
||||
|
||||
require_once "../include.php";
|
||||
|
||||
beginChairSession();
|
||||
|
||||
if (isset($_GET['m']) && oc_moduleValid($_GET['m']) && is_file($_GET['m'] . '/README.html') && ($readme = file_get_contents($_GET['m'] . '/README.html'))) {
|
||||
if (preg_match("/^(.*)?\s*<hr/s", $readme, $matches)) {
|
||||
print $matches[1] . '
|
||||
</body>
|
||||
</html>';
|
||||
} else {
|
||||
print $readme;
|
||||
}
|
||||
} else {
|
||||
print 'Unable to access module information';
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | OpenConf |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to the OpenConf License, available on |
|
||||
// | the OpenConf web site: www.OpenConf.com |
|
||||
// +----------------------------------------------------------------------+
|
||||
|
||||
require_once '../include.php';
|
||||
|
||||
// Is module valid & installed
|
||||
if (!isset($_REQUEST['module']) || !oc_moduleValid($_REQUEST['module']) || !oc_module_installed($_REQUEST['module'])) {
|
||||
err('Module is not installed', 'Error', 3);
|
||||
}
|
||||
// Is action valid
|
||||
elseif (!isset($_REQUEST['action']) || !preg_match("/^[\w\-]+\.\w+$/",$_REQUEST['action']) || !is_file($_REQUEST['module'] . '/' . $_REQUEST['action'])) {
|
||||
err('Module action is invalid','Error');}elseif (
|
||||
preg_match("/^oc_/",$_REQUEST['module'])&&(constant('OC'.'C_L'.'ICENSE')=='Pub'.'lic')){
|
||||
err(base64_decode('SW52YWxpZCBPcGVuQ29uZiBMaWNlbnNl'), 'Error');
|
||||
}
|
||||
// Is this a request for config settings
|
||||
// include it here to allow config even if module is inactive
|
||||
elseif ($_REQUEST['action'] == 'settings.inc') {
|
||||
define('OCC_MODULE_ID', $_REQUEST['module']);
|
||||
define('OCC_SELF', $_SERVER['PHP_SELF'] . '?module=' . OCC_MODULE_ID . '&action=settings.inc');
|
||||
// read in module config even if not active
|
||||
if (!oc_moduleActive(OCC_MODULE_ID) && is_file(OCC_MODULE_ID . '/config.inc')) {
|
||||
require_once OCC_MODULE_ID . '/config.inc';
|
||||
}
|
||||
// setup chair session
|
||||
beginChairSession();
|
||||
// display settings page
|
||||
require_once OCC_PLUGINS_DIR . 'ckeditor.inc';
|
||||
$OC_displayTop = '<a href="modules.php">Modules</a> » ';
|
||||
printHeader($OC_modulesAR[OCC_MODULE_ID]['name'] . " Settings",1);
|
||||
require_once OCC_MODULE_ID . '/settings.inc';
|
||||
printFooter();
|
||||
exit;
|
||||
}
|
||||
// Is action extension valid
|
||||
elseif (preg_match("/\.(?:inc|sql)$/",$_REQUEST['action'])) {
|
||||
err('Request for module action is not permitted','Error');
|
||||
}
|
||||
// Is module active
|
||||
elseif (!in_array($_REQUEST['module'],$OC_activeModulesAR)) {
|
||||
err('Module is not active','Error');
|
||||
}
|
||||
// OK already
|
||||
else {
|
||||
define('OCC_MODULE_ID', $_REQUEST['module']);
|
||||
// Friendly URL? If so, decipher params
|
||||
if ((OCC_LICENSE=='P'.'ublic') && preg_match("/^oc_/",$_REQUEST['module'])){exit;}
|
||||
if (isset($_GET['ocparams']) && !empty($_GET['ocparams'])) {
|
||||
$params = '';
|
||||
if (preg_match_all("/(\w+)--(\w+)_-/", $_GET['ocparams'], $matches)) {
|
||||
foreach ($matches[1] as $idx => $m) {
|
||||
if (($m != 'module') && ($m != 'action') && preg_match("/^[\w-]+$/", $m)) {
|
||||
$params .= '&' . $m . '=' . urlencode($matches[2][$idx]);
|
||||
$_GET[$m] = $matches[2][$idx];
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($_GET['ocparams']);
|
||||
define('OCC_SELF', $_SERVER['PHP_SELF'] . '?module=' . $_REQUEST['module'] . '&action=' . $_GET['action'] . $params);
|
||||
} elseif (isset($_SERVER['REQUEST_URI']) && strstr($_SERVER['REQUEST_URI'], '?')) {
|
||||
define('OCC_SELF', htmlspecialchars($_SERVER['REQUEST_URI']));
|
||||
} elseif (isset($_SERVER['QUERY_STRING']) && strstr($_SERVER['QUERY_STRING'], '&')) {
|
||||
define('OCC_SELF', $_SERVER['PHP_SELF'] . '?' . htmlspecialchars($_SERVER['QUERY_STRING']));
|
||||
} else {
|
||||
err('This server does not support REQUEST_URI or QUERY_STRING','Error');
|
||||
}
|
||||
define('OCC_MODULE_REQUEST_BASE', $_SERVER['PHP_SELF'] . '?module=' . $_REQUEST['module']);
|
||||
require_once OCC_MODULE_ID . '/' . $_REQUEST['action'];
|
||||
exit;
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | OpenConf |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to the OpenConf License, available on |
|
||||
// | the OpenConf web site: www.OpenConf.com |
|
||||
// +----------------------------------------------------------------------+
|
||||
|
||||
require_once "../include.php";
|
||||
|
||||
beginChairSession();
|
||||
|
||||
$hdr = 'Uninstall Module';
|
||||
$hdrfn = 1;
|
||||
|
||||
if (isset($_REQUEST['module']) && oc_moduleValid($_REQUEST['module'])) {
|
||||
if (!isset($OC_modulesAR[$_REQUEST['module']]['allowuninstall']) || $OC_modulesAR[$_REQUEST['module']]['allowuninstall']) {
|
||||
// Check module is installed
|
||||
if (!oc_module_installed($_REQUEST['module'])) {
|
||||
err('Module ' . safeHTMLstr($_REQUEST['module']) . ' is not installed',$hdr,$hdrfn);
|
||||
}
|
||||
|
||||
// Module specific uninstall
|
||||
if (is_file($_REQUEST['module'] . '/uninstall.inc')) {
|
||||
require_once $_REQUEST['module'] . '/uninstall.inc';
|
||||
}
|
||||
|
||||
// Unload module schema
|
||||
if (is_file($_REQUEST['module'] . '/uninstall-db.sql')) {
|
||||
oc_loadSchema($_REQUEST['module'] . '/uninstall-db.sql');
|
||||
}
|
||||
|
||||
// Delete from modules table
|
||||
$q = "DELETE FROM `" . OCC_TABLE_MODULES . "` WHERE `moduleId` = '" . $_REQUEST['module'] . "' LIMIT 1";
|
||||
$r = ocsql_query($q) or err('Unable to uninstall module (' . safeHTMLstr(ocsql_error()) . ')',$hdr,$hdrfn);
|
||||
|
||||
// Redirect
|
||||
session_write_close();
|
||||
header("Location: modules.php?" . strip_tags(SID));
|
||||
exit;
|
||||
} else {
|
||||
warn('Module may not be deactivated',$hdr,$hdrfn);
|
||||
}
|
||||
} else {
|
||||
err('Invalid module',$hdr,$hdrfn);
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user