From 2ca74b90e1640644fc7c7d301c1e82a018fbc066 Mon Sep 17 00:00:00 2001
From: Chuck Scott There is missing database information for plugin/add-on '.$a['name']."."
+ ." Failure installing database tables for the '.$a['name']
+ .' New database tables installed for the '.$a['name'].' plugin. Failure installing database tables for the '.$a['name']
+ .' Failure installing database tables for the '.$a['name']
- .'
Incorrect plugin/add-on configuration is suspected. Check add-on registration data array for this add-on.
No database version set:
Database Creation Script not found: '.$sqlFile.'
Database Installation Error: '.print_r($queryError,1)
- .''.$q.'
New database tables installed for the '.$a['name'].' plugin.
'; + + // Save the version of the installed database + update_option($a['database']['dbActiveVersionOption'], $dbVersion); + + // Indicate that we were successfull + $db_setup_status = true; + + } else { + $startupNotices .= 'Failure installing database tables for the '.$a['name']
+ .'
Database Installation Error: '.print_r($queryError,1)
+ .'
'.$q.''; + } + + } // db creation file check + + } // db version check // Otherwise, check if we need to update the database } elseif ($dbVersion != $a['database']['dbCurrentVersion']) { diff --git a/controllers/admin.php b/controllers/admin.php index f1496584..fab3f2c4 100644 --- a/controllers/admin.php +++ b/controllers/admin.php @@ -696,7 +696,11 @@ class glmMembersAdmin extends GlmPluginSupport do { if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { - $this->addNotice("Requested Action: Menu item = $menuItem, Action = $action", 'Process'); + $option = ''; + if (isset($_REQUEST['option'])) { + $option = ', Option = '.$_REQUEST['option']; + } + $this->addNotice("Requested Action: Menu item = $menuItem, Action = $action".$option, 'Process'); } $modelRedirect = false; diff --git a/css/admin.css b/css/admin.css index 99a94723..5c3d988b 100644 --- a/css/admin.css +++ b/css/admin.css @@ -41,6 +41,9 @@ .glm-clear { clear: both; } +.glm-nowrap { + white-space: nowrap; +} .glm-hidden { display: none !important; } diff --git a/glm-member-db.php b/glm-member-db.php deleted file mode 100644 index 704dab0d..00000000 --- a/glm-member-db.php +++ /dev/null @@ -1,441 +0,0 @@ - - * @license http://www.gaslightmedia.com Gaslightmedia - * @version 1.0.47 - */ - -/* - * Plugin and Database Versions - * - * Database updates for the main plugin and add-ons must also be - * listed in the /setup/databaseScripts/dbVersions.php file of - * the corresponding plugin/add-on. The table in that file - * determines which version is installed for a new activation - * and which update scrips are run to bring the database up to - * the current version. - * - * We check the plugin version stored in the WordPress option below - * so that we're sure the other add-ons see an up to date - * version from this plugin. - * - */ - -define('GLM_MEMBERS_PLUGIN_VERSION', '1.0.58'); -define('GLM_MEMBERS_PLUGIN_DB_VERSION', '1.1.2'); - -// Check if plugin version is not current in WordPress option and if needed updated it -if (GLM_MEMBERS_PLUGIN_VERSION != get_option('glmMembersDatabasePluginVersion')) { - update_option('glmMembersDatabasePluginVersion', GLM_MEMBERS_PLUGIN_VERSION); -} - -/* - * Copyright 2014 Charles Scott (email : cscott@gaslightmedia.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2, as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * ******************************************************************************* - * - * *** Directory and File Structure *** - * - * index.php - * - * Index file for this plugin. All plugin processing starts here. (See - * "Process Flow" below.) - * - * controllers - * - * Directory containing any controllers. Typically there - * would be admin and front controllers in this directory. - * These controllers do the general setup for the plugin, - * determine and call the appropriate model, determine the - * appropriate view, then merge any data returned by the model - * with the view and output the result as appropriate. - * - * When executed, a model may determine that it cannot handle - * the current request and return such a notice to the controller - * possibly with a suggested model to execute. Models may also - * return a desired view back to the controller based on the - * result of processing, but should do so in a generic way so - * as to permit multi-lingual output and use of multiple "skins" - * (but not to the exception of appropriate use of WordPress - * Themes). - * - * css - * - * Directory containing any css files specific to this plugin. - * The use of additional styling should be kept to a minimum - * so as to not interfere with the application of WordPress - * default styling and Themes. - * - * js - * - * Directory containing any JAVAscript files specific to this - * Plugin. This directory should be reserved for general script - * files that provide functionality that can be used in various - * views. Any JAVAscript that is specific to a view should be - * located along with the associated view as it is logically - * part of the view. - * - * lib - * - * Directory containing any class or function libraries that - * are used generally by this plugin. Any class or other code - * that is specific to a particular model should be located - * in, or along with, that model since it is logically - * associated only with that model. - * - * misc - * - * Directory containing ancillary directories and files. This - * might be used for things like cach directories. An example - * might be the "smarty" directory for Smaarty Templates. - * - * models - * - * Directory containing model files that execute a specific - * process in this plugin. If this is a simple plugin, then - * the model files can be placed directly in this directory. - * If it's a more complex plugin, then there should be sub- - * directories for various groupings of related model files. - * - * An individual model may consist of a grouping of files, - * such as additional class files, that are specific only to - * that model. In that case, these should be located in a - * subdirectory under where the model file called by the - * controller is located and that directory should be named - * so as to be obviously associated with that model. - * - * There are three special files in the models directory. These - * are activate.php, deactivate.php, and uninstall.php. These - * are called via hooks setup in this file and should always - * be here. If they do not provide any real functionality, they - * should at least be a shell that can be called for those - * situations. - * - * views - * - * Directory containing view files for producing output upon - * request of a model file in the models directory. If this - * is a simply plugin, then the view files can be placed - * directly in this directory. If it's a more complex plugin, - * then there should be sub-directories for the various - * groupings of related view files. If using sub-directories, - * those should generally match the associated model directories. - * It may also be wise to use separate front and admin - * directories under views to keep things organized. - * - * Additionally, views may be grouped in such a way that they - * support the selection of various "skins" that output in - * different ways, although any styling should be provided by - * WordPress Themes or use default WordPress styling. - * - * *** Process Flow *** - * - * WordPress calls the plugin index file. All plugin processing starts here. - * - * The plugin index file performs the following operations ... - * - Sets-up any required plugin-wide defines and data - * - Instatiates any plugin-wide classes and objects - * - Sets-up any plugin-wide WordPress hooks - * - Determines which controller is to be executed - * - Executes the selected controller - * - * The selected controller performs the following operations ... - * - Sets-up any controller specific defines and data - * - Instatiates any controller specific classes and objects - * - Sets-up any controller specific WordPress hooks - * - Determines which model process is to be executed - * - Executes the selected model - * - * The selected model performs the following operations ... - * - Sets-up any model specific defines and data - * - Instatiates any model specific classes and objects - * - Sets-up any model specific WordPress hooks - * - Performs any specific processing required of the model - * - Determines which view is to be used to generate output - * - Generates output based on model data and the selected view - * - * WordPress wraps everything up - * - * ******************************************************************************** - */ - -// Check that we're being called by WordPress. -if (!defined('ABSPATH')) { - die("Please do not call this code directly!"); -} - -/* - * - * Some initial setup and tests - * - */ - -$startupNotices = ''; - -// Get standard defined parameters -require_once('defines.php'); - -// Get configuration -require_once('config.php'); - -// Try to set the DB version option to false (new plugin) - If it's already set this won't do anything. -add_option('glmMembersDatabaseDbVersion', false); - -/* - * - * Hook in add-ons and integrate their actions - * - * Each add-on should add an array element to the supplied array using the following structure. - * - * $addOns[{slug for add-on}] = array( - * 'dir' => {path to add-on directory}, - * 'name' => {text name for add-on}, - * 'short_name' => {an abreviated name for the add-on}, - * 'slug' => {slug for add-on}, - * 'config' => {optional array of config data to be merged into $config}, - * 'actions' => array( - * 'adminActions => array( - * '{menu name}' => array( - * '{action}' => '{add-on slug}', - * ... additional actions ... - * ), - * ... additional menu names ... - * 'frontActions' => array( - * '{page}' => array( - * '{action name}' => '{add-on slug}', - * ... addional actions --- - * ), - * ... additional pages ... - * ) - * ), - * 'shortcodes' => array( - * '{shortcode} => array( - * 'plugin' => {plugin slug}, - * 'menu' => '{menu}, - * 'action' => '{action}', - * 'table' => {table name where default values for 'attributes' are stored}, - * 'adttributes' => array({array of attributes that might be in the shortcode}) - * ), - * ... additional shortcodes ... - * ), - * // if the add-on is adding database tables use this, otherwise FALSE - * 'database' => array( - * 'dbPrefix' => '{database prefix to use}', - * 'dbCurrentVersion' => '{current add-on database version number}', - * 'dbActiveVersionOption' => '{option name used to get current active database version}', - * 'dbScriptPath' => '{full path to add-on database scripts directory}', - * 'dbVersions' => array( - * '{version#}' => array('version' => '{version#}', 'tables' => {# of tables}, - * ... additional versions in order of version number - highest is last --- - * ) - * - * ) - * - * Note that the database prefix must not start with 'glm_members_'. It can however be something - * like 'glm_membersPackaging_', otherwise the tables will be counted along with those of the main - * plugin and database checks will fail. - * - * Also note that the default array includes information on the main member db plugin. This is - * done for consistency, particularly for database maintenance - */ -require_once(GLM_MEMBERS_PLUGIN_SETUP_PATH.'/validActions.php'); -require_once(GLM_MEMBERS_PLUGIN_SETUP_PATH.'/shortcodes.php'); -require_once(GLM_MEMBERS_PLUGIN_DB_SCRIPTS.'/dbVersions.php'); -$config['addOns'] = array( - GLM_MEMBERS_PLUGIN_SLUG => array( - 'dir' => GLM_MEMBERS_PLUGIN_PATH, - 'name' => GLM_MEMBERS_PLUGIN_NAME, - 'short_name' => GLM_MEMBERS_PLUGIN_SHORT_NAME, - 'slug' => GLM_MEMBERS_PLUGIN_SLUG, - 'actions' => $glmMembersValidActions, - 'shortcodes' => $glmMembersShortcodes, - 'shortcodesDescription' => $glmMembersShortcodesDescription, - 'database' => array( - 'dbPrefix' => GLM_MEMBERS_PLUGIN_DB_PREFIX, - 'dbCurrentVersion' => GLM_MEMBERS_PLUGIN_DB_VERSION, - 'dbActiveVersionOption' => GLM_MEMBERS_PLUGIN_ACTIVE_DB_OPTION, - 'dbScriptPath' => GLM_MEMBERS_PLUGIN_DB_SCRIPTS, - 'dbVersions' => $glmMembersDbVersions - ) - ) -); - -// Create hook for registering add-on plugins and their features -$config['addOns'] = apply_filters('glm-member-db-register-addon', $config['addOns']); - -// If any add-ons have registered -$config['validActions'] = array(); -$config['shortcodes'] = array(); -if (count($config['addOns']) > 0) { - - // For each add-on that's registered - foreach ($config['addOns'] as $a) { - - // Add their valid actions to the main validActions config array - if (isset($a['actions'])) { - $config['validActions'] = array_merge_recursive($config['validActions'], $a['actions']); - } - - // Add their shortcodes to the main shortcodes config array - if (isset($a['shortcodes'])) { - $config['shortcodes'] = array_merge_recursive($config['shortcodes'], $a['shortcodes']); - } - - // If the add-on has supplied additional config parameters when registering - if (isset($a['config'])) { - $config = array_merge_recursive($config, $a['config']); - } - - // If the add-on has additional config parameters in a plugin.ini file - $iniFile = GLM_MEMBERS_WORDPRESS_PLUGIN_PATH.'/'.$a['slug'].'/config/plugin.ini'; - if (isset($iniFile)) { - - // Parse the add-on's configuration file - $addOnIni = parse_ini_file($iniFile); - - // Replace parameters that are in the theme ini file - $config = array_replace($config, $addOnIni); - - } - } -} - -/* - * - * Activate and Deactivate hooks - * - */ - -// Activate -function glmMembersPluginActivate () -{ - global $wpdb, $config; - require_once (GLM_MEMBERS_PLUGIN_PATH . '/activate.php'); - new glmMembersPluginActivate($wpdb, $config); -} -register_activation_hook(__FILE__, 'glmMembersPluginActivate'); - -// Deactivate -function glmMembersPluginDeactivate () -{ - global $wpdb, $config; - require_once (GLM_MEMBERS_PLUGIN_PATH . '/deactivate.php'); - $x = new glmMembersPluginDeactivate($wpdb, $config); - return false; -} -register_deactivation_hook(__FILE__, 'glmMembersPluginDeactivate'); - -/* - * - * Load any other common files needed - * - */ - -// Load data abstract -require_once(GLM_MEMBERS_PLUGIN_LIB_PATH.'/GlmDataAbstract/DataAbstract.php'); - -// Load glmPluginSupport class -require_once (GLM_MEMBERS_PLUGIN_PATH . '/classes/glmPluginSupport.php'); - -// Load Smarty Template Support -require_once (GLM_MEMBERS_PLUGIN_PATH . '/lib/smartyTemplateSupport.php'); - -/* - * Hook through which an add-on may supply additional logged in user information and - * have that data stored in the config array. Typically it would be the - * glm-members-db-contacts add-on supplying the information. - * - * This hook provides default data with the current WordPress user 'data' object - * as a 'wpUser' sub-array if a WordPress user is logged in. If not 'wpUser' will - * be false. The supplied data is the basic information on the WordPress user - * provided by the 'data' object from wp_get_current_user(). - * - * To permit more than one routine to access this filter and therefore to supply - * additional information on the logged in user, code may merge it's own data or may - * add another sub-array containing user information specific to an add-on (i.e. - * contacts add-on might supply a 'contactUser' sub-array). - * - */ -if (function_exists('is_user_logged_in')) { - $config['loggedInUser'] = array( - 'wpUser' => false - ); - if (is_user_logged_in()) { - $config['loggedInUser']['wpUser'] = (array) wp_get_current_user()->data; - } - $config['loggedInUser'] = apply_filters('glm_members_current_logged_in_user', $config['loggedInUser']); -} - -/* - * - * Determine which controller to load - * - */ - -// If the call to this code is to display a separate debug window -if (isset($_REQUEST['glmDebugWindow']) && $_REQUEST['glmDebugWindow'] == true) { - glmMembersAdminNotices(true); - exit; - -// Otherwise select appropriate controller -} elseif (is_admin()) { - require_once (GLM_MEMBERS_PLUGIN_PATH . '/controllers/admin.php'); - new glmMembersAdmin($wpdb, $config); -} else { - require_once (GLM_MEMBERS_PLUGIN_PATH . '/controllers/front.php'); - new glmMembersFront($wpdb, $config); -} - -/* - * Display any notices? - */ - -// Display any notices that need to be displayed at the top of the admin content area -function glmMembersWordpressAdminNotices() { - global $startupNotices; - echo '
".print_r($sql,1).""; + + // If $start and $limit, we're doing paging + $paging = false; + if ($start !== false && $limit > 0) { + $sql .= "limit ".($start-1).", $limit"; + $paging = true; + } + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE && class_exists('glmMembersAdmin')) { $this->addDataAbstractNotice($sql, 'DataBlock', "DataAbstract - getList() query"); } @@ -3121,8 +3140,10 @@ abstract class GlmDataAbstract return false; } - // Process field output data for each result - use ID field as key + // Setup result array $newList = array(); + + // Process field output data for each result - use ID field as key while (list($k, $v) = each($list)) { $newList[$v['id']] = $this->processOutputData($v, 'l'); } @@ -3131,6 +3152,20 @@ abstract class GlmDataAbstract $this->addDataAbstractNotice($newList, 'DataBlock', "getList() data"); } + + // If we're doing paging, return that data along with the list + if ($paging) { + $c = count($list); + return array( + 'start' => $start, + 'limit' => $limit, + 'returned' => $c, + 'last' => $start + count($list) - 1, + 'list' => $newList + ); + } + + // Since we're not doing paging, return the list only return $newList; } @@ -3140,29 +3175,37 @@ abstract class GlmDataAbstract * @return void * @access public */ - public function getEntry($id, $idfield = 'id', $where = '', $fieldVals = false) + public function getEntry($id, $idfield = 'id', $where = 'true', $fieldVals = false) { - if ($id-0 == 0) { -// echo "DataAbstract.php - getEntry() called with invalid ID"; - return false; - } + // If there's an ID supplied, add that to the query + $idWhere = ''; + if ($id-0 > 0) { + $idWhere = "AND $idfield = $id"; + } - $this->buildFieldsList('g'); + // If there's no ID supplied and there's no where clause, what are we doing here? + if ($idWhere == '' and $where == 'true') { + return false; + } + + $this->buildFieldsList('g'); + // Get only the first result $sql = "SELECT $this->select FROM $this->table T - WHERE $idfield = $id - $where + WHERE $where + $idWhere + LIMIT 1 ;"; $detail = $this->wpdb->get_row($sql, ARRAY_A); $this->addDataAbstractNotice($sql, 'DataBlock', "DataAbstract - getEntry() query"); // If nothing was found, simply return false - if ($detail == false) { - return false; - } + if ($detail == false) { + return false; + } // Process individual fields $detail = $this->processOutputData($detail, 'g', $fieldVals); diff --git a/lib/GlmDataAbstract/documentation.odt b/lib/GlmDataAbstract/documentation.odt index 21f30b1fc85e24b2caf5f0a42552124ff5af1982..033ff2c493796a36624091725381f33c0af9d380 100644 GIT binary patch delta 37311 zcmc$_Wo+M1>^~M}YN$!Wj14!;4RbzWW~PQY?=VBd%*@Qp%*@OUGw=J;q)B@+ZPNbR zN!Hy1%O~BP?X&%IOC^Ng0tB*xG$a%z7#JKFSbKazEV9(M|0W6P-pI`sJ}|KVA)I)P zIK0>ZGJp?|6cJK(%ee4{)yES3{AyaZ(v{R5m9`^?LKnWG@P&Y&4JCCjv@6~!J$CNY zU98VE6R0&35($^O>Ldq`6GWf$y!F_;&0h8XkNME&*n#q8dbqvD&ei42%&hA!GxaKY zj}zs$AR6kzQzm#|E{q5bRIDF$5HSl{A({vbkca6%BA6hIh8qfkBZX8%5Hco~A_+zM zKXd)BV*>tP+RsQrDg5bI=sssZ6aBb9qCYu2en@j~%oi
?0gO@{|
zRH0Zrl_4c38_0E_kL2I29iEqStPK;daLb5-zlej;n(}=UygZ?g0i$q_4lie~YcA2w
ziy~s5ukBi{xHjTl(dcFoUi%Mc)UXGti~^NEu=4|slG7p#o7@F_@YIbFS~KY2jzk3a
z2_Wg`p^Gj>0go>!X`)J#OmY=LoR8wB#oohA*uS=kL%Uz)wHj4-s8NRMwjA(eHl!gz
z&&{Ft(wQ0a_Z7y56V6IcUhjr5SnwhYTM-p=X}Xp`pMGDiK!I;0cf0=7O>xEbq+wv+
zLJWY$etUh9GGmVZ8nv&Xg5?vbpa}{$1M>Jwo?*z~a~F4?eooxERhz$uOz{ZD+@Kc?
z_698c9HCQNOW6^Y?|DGVGbDD5Ahn^mGgOh+mZd0CI$}?RPZT<
zjcA?SbG|Rw=~AQ)$}uh$>K+mOZrO9OV)!i*{Jxu*mT5Y)8sykfZ%g0gBzs+$1DwK5
zvl)EAo*z%Pf8}v5t4ViYn4A>xB$<8sADBhf%rR`IH9RMvufeDi6Kpg&emz^TDx>EC
z)sS?MRcdI+i&(!dK5> alEB*+ZlMP%6}^$z)CwmZrgkwr<0r1m%+Yy#JY
zxvAPD|9ZdPf|?a^4W_)8W;^-J3YU$G1-%jGx%w7%^~^}yB2&&0 Mi?J4m9L;heOTOyYdMrrp?mRohq3=9xN
zX_R=vC+0q8eB!&3MeuSW*x9d$RA>R6X`~?>cNq){l>`adR1F?Cgu~-lCj&~r?ubsV
zBzc&>y`0?au+G*gBZ!Fz0_UBo5l@#?dy_80S3Y`mYJkpPo19?n~G!9$j5}%ChTTH9~q+2sX)41!i}VZ0s0F3cCnz4
z6q5z#vb@e8Yo;|bNBZr=wZ>>5|Ie)`
z5k5Qjl)BApGI