Skip to content

Commit

Permalink
3.0.0-alpha-20171230
Browse files Browse the repository at this point in the history
  • Loading branch information
benkeen committed Dec 31, 2017
1 parent 102bc4b commit 438de4d
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion global/code/Core.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ class Core {
/**
* The release date: YYYYMMDD
*/
private static $releaseDate = "20171225";
private static $releaseDate = "20171230";

/**
* The minimum required PHP version needed to run Form Tools.
Expand Down
4 changes: 2 additions & 2 deletions global/code/FieldValidation.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,8 @@ public static function generateSubmissionJsValidation($grouped_fields, $settings
foreach ($field_info["validation"] as $rule_info) {
$rsv_rule = $rule_info["rsv_rule"];
$placeholders = array(
"field" => $field_title,
"field_name" => $field_name
"field" => $field_title,
"field_name" => $field_name
);
$message = General::evalSmartyString($rule_info["error_message"], $placeholders);

Expand Down
5 changes: 3 additions & 2 deletions global/code/Forms.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@
namespace FormTools;


use PDO, PDOException;
use PDO, Exception;


class Forms
{
/**
* Returns all forms. Should only be called by adminstrators.
* *** N.B. This doesn't return offline forms. ***
* @return array
*/
public static function getForms()
Expand Down Expand Up @@ -63,7 +64,7 @@ public static function cacheFormStats($form_id = "")
$db->execute();
$count = $db->fetch(PDO::FETCH_COLUMN);
Sessions::set("form_{$form_id}_num_submissions", $count);
} catch (PDOException $e) {
} catch (Exception $e) {
// need a softer error here. If the form table doesn't exist, we need to log the issue.
// Errors::queryError(__CLASS__, __FILE__, __LINE__, $e->getMessage());
// exit;
Expand Down
6 changes: 5 additions & 1 deletion global/code/General.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1194,7 +1194,11 @@ public static function getSubmissionPlaceholders($form_id, $submission_id, $cont
if (in_array($field_type_id, $file_field_type_ids)) {
$field_settings = Fields::getFieldSettings($field_id);
$placeholders["FILENAME_$field_name"] = $field_info["content"];
$placeholders["FILEURL_$field_name"] = "{$field_settings["folder_url"]}/{$field_info["content"]}";

// not sure under what condition this value isn't set but it was throwing a notice on the edit submission page
if (isset($field_settings["folder_url"])) {
$placeholders["FILEURL_$field_name"] = "{$field_settings["folder_url"]}/{$field_info["content"]}";
}
} else {
$detailed_field_info = array();
foreach ($form_fields as $curr_field_info) {
Expand Down
4 changes: 2 additions & 2 deletions global/code/Module.abstract.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function upgrade($module_id, $old_module_version) {

// non-overridable getters

public final function displayPage($template, $page_vars = array()) {
public final function displayPage($template, $page_vars = array(), $theme = "", $swatch = "") {

// add in the JS and CSS files
if (!isset($page_vars["js_files"])) {
Expand All @@ -131,7 +131,7 @@ public final function displayPage($template, $page_vars = array()) {
$page_vars["js_files"] = array_merge($page_vars["js_files"], self::getJSFiles());
$page_vars["css_files"] = array_merge($page_vars["css_files"], self::getCSSFiles());

Themes::displayModulePage($this->getModuleFolder(), $template, $page_vars);
Themes::displayModulePage($this->getModuleFolder(), $template, $page_vars, $theme, $swatch);
}

// note that this method and the following actually returns the values from the CURRENT LANG FILE, not the private
Expand Down
2 changes: 1 addition & 1 deletion global/code/Modules.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ public static function initModulePage($auth = "")
return self::getModuleInstance($module_folder);
}

// should only be called after isValidModule() has been called first
// should only be called after isValidModule() has been called first
public static function getModuleInstance($module_folder) {
if (array_key_exists($module_folder, self::$moduleInstances)) {
return self::$moduleInstances[$module_folder];
Expand Down
3 changes: 3 additions & 0 deletions global/code/User.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,14 @@ public function checkAuth($required_account_type, $auto_logout = true)
$account_id = $this->accountId;
$account_type = $this->accountType;

// This will all be refactored when we introduce role-based auth
// ----------------
// some VERY complex logic here. The "user" account permission type is included so that people logged in
// via the Submission Accounts can still view certain pages, e.g. pages with the Pages module. This checks that
// IF the minimum account type of the page is a "user", it EITHER has the user account info set (i.e. the submission ID)
// or it's a regular client or admin account with the account_id set. Crumby, but it'll have to suffice for now.
if ($this->accountType == "user") {

if ((!Sessions::exists("account.submission_id") || General::isEmpty(Sessions::get("account.submission_id"))) &&
General::isEmpty(Sessions::get("account.account_id"))) {
if ($auto_logout) {
Expand Down
2 changes: 1 addition & 1 deletion global/smarty_plugins/function.edit_custom_field.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function smarty_function_edit_custom_field($params, &$smarty)
$root_url = Core::getRootUrl();
$multi_val_delimiter = Core::getMultiFieldValDelimiter();

if (!Templates::hasRequiredParams($smarty, $params, array("form_id", "field_info", "field_types", "settings"))) {
if (!Templates::hasRequiredParams($smarty, $params, array("form_id", "field_info", "field_types"))) {
return;
}

Expand Down
4 changes: 1 addition & 3 deletions tests/nightwatch/nightwatch.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
"log_path" : "",
"port" : 4444,
"cli_args" : {
"webdriver.chrome.driver" : "",
"webdriver.gecko.driver" : "",
"webdriver.edge.driver" : ""
"webdriver.chrome.driver" : "./drivers/chromedriver"
}
},

Expand Down
6 changes: 3 additions & 3 deletions themes/default/header.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<body>
<div id="container">
<div id="header">
{if $is_logged_in}
{if $is_logged_in && isset($settings.program_version)}
<div style="float:right">
<table cellspacing="0" cellpadding="0" height="25">
<tr>
Expand All @@ -57,9 +57,9 @@
{/if}
<span style="float:left; padding-top: 8px; padding-right: 10px">
{if isset($settings) && $settings.logo_link}
{if isset($settings) && isset($settings.logo_link)}
<a href="{$settings.logo_link}">{/if}<img src="{$theme_url}/images/logo_{$swatch}.jpg" border="0" width="220" height="61" />
{if isset($settings) && $settings.logo_link}</a>{/if}
{if isset($settings) && isset($settings.logo_link)}</a>{/if}
</span>
</div>
<div id="content">
Expand Down

0 comments on commit 438de4d

Please sign in to comment.