function mystery_search_query($table, $data, $pk, $glue = ' AND ', $connection = 'dbh') { // This function performs an SELECT query // matching any rows that match the $data array, using the // $glue to determine whether or not to boolean AND or OR // // Need to add the search options here, contains, between, in, etc. // global $_MYSTERY; if (!is_array($pk)) { $pk = array($pk); } if (!is_array($pk_value)) { $pk_value = array($pk_value); } mystery_db_connect($connection); $conditions = array(); for ($i = 0; $i < count($pk); $i++) { $conditions[] = $pk[$i] . ' = ' . $_MYSTERY[$connection]->quoteSmart($pk_value[$i]); } $condition = implode(' AND ', $conditions); $result = $_MYSTERY[$connection]->autoExecute($table, $data, DB_AUTOQUERY_UPDATE, $condition); $_MYSTERY['query_list'][] = $_MYSTERY[$connection]->last_query; if (DB::isError($result)) { trigger_error('Problem with UPDATE query: ' . $result->getMessage() . "\n\n" . $result->getDebugInfo(), E_USER_WARNING); return 0; } else { $affected_rows = $_MYSTERY[$connection]->affectedRows(); if (DB::isError($affected_rows)) { trigger_error('Problem getting affected rows: ' . $affected_rows->getMessage() . "\n\n" . $affected_rows->getDebugInfo(), E_USER_WARNING); return 0; } else { // this works around the issue of mysql not updating rows if the info is the same if ($affected_rows == 0) { $affected_rows = 1; } return $affected_rows; } } }
function mystery_session_open($save_path, $session_name) { global $_MYSTERY; mystery_db_connect(); return true; }
The $_PORTAL array is typically like this: $_PORTAL['section'] $_PORTAL['activity'] $_PORTAL['action'] $_PORTAL['params'] **********************/ $_PORTAL = array(); $_PORTAL = portal_parse_uri(@$_SERVER['REQUEST_URI']); $_PORTAL['errors'] = array(); // Get a database connection to the servers used in the application mystery_db_connect('portal_dbh', $portal_config['portal_database_connection']); mystery_db_connect('sunflower_dbh', $portal_config['sunflower_database_connection']); mystery_db_connect('rails_dbh', $portal_config['rails_database_connection']); // Setup custom authentication using the Mystery auth framework. $_MYSTERY['external_auth_functions'][] = 'portal_auth'; // Setup configuration values for this session $_PORTAL['project'] = portal_get_project_key(); $_PORTAL['project_info'] = portal_get_project_info_by_key($_PORTAL['project']); portal_convert_project_settings_to_local($_PORTAL['project']); // Revert the project key to get activities working correctly if this is a special -dev project $_PORTAL['project'] = str_replace('-dev', '', $_PORTAL['project']); // setup any contstants we want to use $portal_image_types = array(1 => 'GIF', 2 => 'JPG', 3 => 'PNG', 4 => 'SWF', 5 => 'PSD', 6 => 'BMP', 7 => 'TIFF(intel byte order)', 8 => 'TIFF(motorola byte order)', 9 => 'JPC', 10 => 'JP2', 11 => 'JPX', 12 => 'JB2', 13 => 'SWC', 14 => 'IFF', 15 => 'WBMP', 16 => 'XBM'); //mystery_db_connect('lhh_dbh', $lhh_config['lhh_database_connection']); // Setup the LHH array //$_PORTAL['school_info'] = portal_get_school_info(''); $portal_required = '<span class="required">*</span>'; $portal_required_legend = $portal_required . ' = Required Field';