function save($data, $options = array()) { $options = array_merge($this->getOptions(), $options); if (!(isset($options['related_form_id']) && $options['related_form_id'])) { trigger_error(sprintf(AMP_TEXT_ERROR_NOT_DEFINED, get_class($this), 'related_form_id')); return; } foreach ($this->_included_fieldnames as $fieldname) { if ($this->fields[$fieldname]['type'] == 'select') { $data[$fieldname] = $_POST[$this->addPrefix($fieldname)]; } } # this is weak, but deep within quickform our shit is getting # overridden with values from the original udm (constant vs default vs submit values) $temp_post = $_POST; unset($_POST['modin']); $data_sets = $this->convert_to_sets($data); foreach ($data_sets as $values) { if (isset($options['related_form_owner_field']) && $options['related_form_owner_field']) { $values[$options['related_form_owner_field']] = $this->udm->uid; } $udm = new UserDataInput($this->dbcon, $options['related_form_id'], $this->udm->admin); # here's where the lameness comes in foreach (array_keys($values) as $key) { unset($_POST[$key]); # we also have to make everything public, or it won't save $udm->fields[$key]['public'] = 1; } $udm->setData($values); $results[] = $udm->saveUser(); unset($udm); } $_POST = $temp_post; return true; }
function &getDisplay() { require_once 'AMP/UserData/Controller.php'; require_once 'AMP/Content/Display/HTML.inc.php'; $udm = new UserDataInput($this->dbcon, $this->getFormId()); $action_plugin =& $udm->registerPlugin('AMPAction', 'Start'); $action_plugin->setOptions(array('action_id' => $this->id)); $controller = new UserData_Controller($udm); $controller->execute(); return $controller->getDisplay(); }
function readUser($user_ID) { if (!$user_ID) { return false; } if (!($user_record = UserDataInput::returnSingleUser($user_ID, $this->dbcon))) { return; } $this->user_record['Name'] = $user_record['First_Name'] . " " . $user_record['Last_Name']; $this->user_record['Email'] = $user_record['Email']; }
function _make_new_quiz_form($data, $fieldname) { if (!(isset($data[$fieldname]) && $data[$fieldname])) { $new_form = new AMPSystem_UserData(AMP_Registry::getDbcon()); $new_form->setDefaults(); $new_form->mergeData(array('name' => $data['name'], 'publish_form' => $data['publish'])); $new_form->save(); $udm = new UserDataInput(AMP_Registry::getDbcon(), $new_form->id, true); $read_plugin =& $udm->registerPlugin("AMP", 'Save'); $read_plugin->saveRegistration('AMP', 'Save'); $save_plugin =& $udm->registerPlugin('AMP', 'Read'); $save_plugin->saveRegistration('AMP', 'Read'); } else { $udm = new UserDataInput(AMP_Registry::getDbcon(), $data[$fieldname], true); } $this->_udm =& $udm; $override_plugin =& $udm->registerPlugin("QuickForm", 'Override'); if (!$override_plugin->plugin_instance) { $override_plugin->saveRegistration('QuickForm', 'Override'); $override_plugin->saveOption('override_file', "form.{$udm->instance}.quiz.xml"); } return $udm->instance; }
} } if ($modin) { $form_id_nav = $modin; $form_permissions =& AMPSystem_Lookup::instance('PermissionsbyForm'); $tools = AMP_lookup('ToolsbyForm'); $modin_permission = isset($form_permissions[$modin]) && $form_permissions[$modin] ? $form_permissions[$modin] : false; //$modidselect=$dbcon->GetRow("SELECT id, perid from modules where userdatamodid=" . $modin) or DIE($dbcon->ErrorMsg()); //$modid=$modidselect['id']; $modid = isset($tools[$modin]) && $tools[$modin] ? $tools[$modin] : false; } else { ampredirect("modinput4_list.php"); } $admin = AMP_Authorized(AMP_PERMISSION_FORM_DATA_EDIT) && AMP_Authorized($modin_permission); // Fetch the form instance specified by submitted modin value. $udm = new UserDataInput($dbcon, $modin, $admin); // User ID. $udm->authorized = true; $udm->uid = $uid; // Was data submitted via the web? $sub = isset($_REQUEST['btnUdmSubmit']) ? $_REQUEST['btnUdmSubmit'] : false; // Fetch or save user data. if ($sub) { // Save only if submitted data is present, and the user is // authenticated, or if the submission is anonymous (i.e., !$uid) if ($udm->saveUser()) { ampredirect(AMP_SYSTEM_URL_FORM_DATA . "?modin=" . $udm->instance); } $udm->showForm = true; } elseif (!$sub && $uid) { // Fetch the user data for $uid if there is no submitted data
include_once "AMP/BaseDB.php"; include_once "AMP/BaseTemplate.php"; #include_once("AMP/BaseModuleIntro.php"); require_once 'AMP/UserData/Input.inc.php'; require_once 'Modules/Petition/ComponentMap.inc.php'; $pid = isset($_REQUEST['pid']) && $_REQUEST['pid'] ? intval($_REQUEST['pid']) : false; $modin = isset($_REQUEST['modin']) && $_REQUEST['modin'] ? intval($_REQUEST['modin']) : false; $map = new ComponentMap_Petition(); $current_petition = $map->getComponent('source'); if ($modin && !$pid) { $pid = Petition::findByModin($modin); } $current_petition->read($pid); if ($current_petition->id) { // Fetch the form instance specified by submitted modin value. $udm = new UserDataInput($dbcon, $current_petition->getFormId()); // Was data submitted via the web? $sub = isset($_REQUEST['btnUdmSubmit']) && $_REQUEST['btnUdmSubmit']; //OUTPUT THE PAGE echo $current_petition->progressBox(); // Fetch or save user data. if ($udm->submitted) { // Save only if submitted data is present, and the user is // authenticated, or if the submission is anonymous (i.e., !$uid) $save_success = $udm->saveUser(); echo $udm->output(); if ($save_success) { echo $current_petition->petition_signers(); } } if (isset($_REQUEST['signers']) && $_REQUEST['signers']) {
* *****/ //ob_start(); require_once 'AMP/BaseDB.php'; require_once 'AMP/UserData/Input.inc.php'; $modin = $form_id_nav = $_REQUEST['modin']; $tool_set =& AMPSystem_Lookup::instance('ToolsbyForm'); $modid = isset($tool_set[$modin]) ? $tool_set[$modin] : null; /* $modidselect = $dbcon->Execute("SELECT id from modules where userdatamodid=" . $dbcon->qstr( $modin ) ) or die( "Couldn't get module information: " . $dbcon->ErrorMsg() ); $modid = $modidselect->Fields("id"); */ // Fetch the form instance specified by submitted modin value. $udm = new UserDataInput($dbcon, $modin, true); $udm->doPlugin("QuickForm", "BuildAdmin"); $mod_id = $udm->modTemplateID; // Was data submitted via the web? $sub = isset($_REQUEST['btnUdmSubmit']) && $_REQUEST['btnUdmSubmit']; // Fetch or save user data. if ($sub) { $udm->doPlugin('AMPsystem', 'Save'); ampredirect(AMP_url_update($_SERVER['PHP_SELF'], array('modin' => $modin))); } /* Now Output the Form. Any necessary changes to the form should have been registered before now, including any error messages, notices, or complete form overhauls. This can happen either within the $udm object, or from print() or echo() statements.
function _saveSchedulePlugin($namespace, $form_id) { if (!$form_id) { return false; } $udm = new UserDataInput($this->dbcon, $form_id); if (!($plugin = $udm->getPlugin($namespace, 'Start'))) { $plugin = $udm->saveRegisteredPlugin($namespace, 'Start'); return $plugin->saveOption('schedule_id', $this->id); } }
<?php require 'AMP/Base/Config.php'; require_once 'AMP/System/User/Profile/Profile.php'; require_once 'AMP/UserData/Input.inc.php'; require_once 'AMP/Auth/Handler.inc.php'; $AMP_Authen_Handler = new AMP_Authentication_Handler(AMP_Registry::getDbcon(), 'content'); if (!$AMP_Authen_Handler->is_authenticated()) { $AMP_Authen_Handler->do_login(); } $udm = new UserDataInput(AMP_dbcon(), 20); $udm->getUser($AMP_Authen_Handler->getUserId()); // Hide fields that should be present on the signup form, but not on the edit form // Custom1 = username // Custom2 = password // remember users email field so we can use it later when we save $email = $udm->fields['Email']; // Remove non-editable fields so that they don't display on the form $non_editable_fields = array('custom1', 'custom2', 'Email'); foreach ($non_editable_fields as $field_name) { unset($udm->fields[$field_name]); } // if there is POST data, save and redirect back to self. if (isset($_POST['btnUdmSubmit'])) { // add email field back in so DIA syncing works if (empty($udm->fields['Email'])) { $udm->fields['Email'] = $email; //add the email back in the post so that the udm save function doesn't throw a validation error. $_POST['Email'] = $email['value']; } $udm->saveUser();
function _build_preview() { $udm_copy = new UserDataInput($this->dbcon, $this->udm->instance, true); $udm_copy->form = null; $udm_copy->showForm = true; $html = $udm_copy->output('html'); preg_replace("/<[^>]*form[^>]*>/", "", $html); $this->fields['preview'] = array('tab' => array('type' => 'header', 'values' => 'Preview'), 'rendered' => array('type' => 'static', 'values' => $html)); $this->_build_form($this->fields['preview'], 'preview'); }
* (c) 2004 Radical Designs * Written by Blaine Cook, blaine@radicaldesigns.org * *****/ $mod_name = 'calendar'; require_once 'AMP/UserData/Input.inc.php'; require_once 'Connections/freedomrising.php'; require_once 'utility.functions.inc.php'; #set_error_handler( 'e' ); if (!defined(AMP_CALENDAR_ENTRY_FORM_DEFAULT)) { define('AMP_CALENDAR_ENTRY_FORM_DEFAULT', 50); } // Fetch the form instance specified by submitted modin value. $modin = isset($_REQUEST['modin']) ? $_REQUEST['modin'] : AMP_CALENDAR_ENTRY_FORM_DEFAULT; $admin = AMP_Authorized(AMP_PERMISSION_FORM_ADMIN); $udm = new UserDataInput($dbcon, $modin, $admin); $modidselect = $dbcon->Execute("SELECT id, perid from modules where userdatamodid=" . $dbcon->qstr($udm->instance)) or die("Couldn't get module information for form: " . $dbcon->ErrorMsg()); $modid = $modidselect->Fields("id"); $modin_permission = $modidselect->Fields("perid"); // User ID. if (isset($_REQUEST['calid']) && $_REQUEST['calid']) { $uidset = $dbcon->Execute("Select uid from calendar where id=" . $_REQUEST['calid']); $uid = $uidset->Fields("uid"); $calid = $_REQUEST['calid']; } else { $uid = isset($_REQUEST['uid']) ? $_REQUEST['uid'] : false; } $udm->authorized = true; $udm->uid = $uid; // Was data submitted via the web? $sub = isset($_REQUEST['btnUdmSubmit']) ? $_REQUEST['btnUdmSubmit'] : false;
//ob_start(); // Set default module. $intro_id = 57; $modid = 1; require_once 'AMP/BaseDB.php'; require_once 'AMP/UserData/Input.inc.php'; /** * Check for a cached page */ if ($cached_output = AMP_cached_request()) { print $cached_output; exit; } $modin = isset($_REQUEST['modin']) && $_REQUEST['modin'] ? intval($_REQUEST['modin']) : false; // Fetch the form instance specified by submitted modin value. $udm = new UserDataInput($dbcon, $modin); if (!$udm->isLive()) { ampredirect(AMP_CONTENT_URL_INDEX); exit; } // User ID. $uid = isset($_REQUEST['uid']) ? intval($_REQUEST['uid']) : false; $otp = isset($_REQUEST['otp']) ? $_REQUEST['otp'] : null; // Check for duplicates, setting $uid if found. if (!$uid) { $uid = $udm->findDuplicates(); } // Check for authentication, sending authentication mail if necessary. if ($uid) { // Set authentication token if uid present $auth = $udm->authenticate($uid, $otp);
function &returnSingleUser($user_id, &$dbcon) { $sql = "Select modin from userdata where id = " . $user_id; if (!($seek_set = $dbcon->Execute($sql))) { return false; } $instance = new UserDataInput($dbcon, $seek_set->Fields("modin")); $instance->getUser($user_id); return $instance->getData(); }
$modid = 1; require_once 'AMP/BaseDB.php'; require_once 'AMP/UserData/Input.inc.php'; /** * Check for a cached page */ if ($cached_output = AMP_cached_request()) { print $cached_output; exit; } $modin = isset($_REQUEST['modin']) && $_REQUEST['modin'] ? intval($_REQUEST['modin']) : false; if (!$modin) { $modin = isset($_REQUEST['id']) && $_REQUEST['id'] ? intval($_REQUEST['id']) : false; } // Fetch the form instance specified by submitted modin value. $udm = new UserDataInput($dbcon, $modin); if (!$udm->isLive()) { ampredirect(AMP_CONTENT_URL_INDEX); exit; } // User ID. $uid = isset($_REQUEST['uid']) && $_REQUEST['uid'] ? intval($_REQUEST['uid']) : false; $otp = isset($_REQUEST['otp']) ? $_REQUEST['otp'] : null; // Check for duplicates, setting $uid if found. if (!$uid) { $uid = $udm->findDuplicates(); } // Check for authentication, sending authentication mail if necessary. if ($uid) { // Set authentication token if uid present $auth = $udm->authenticate($uid, $otp);
<?php /***** * * AMP UserData Form View * * (c) 2004 Radical Designs * Written by Blaine Cook, blaine@radicaldesigns.org * *****/ ob_start(); require_once 'AMP/BaseDB.php'; require_once 'AMP/UserData/Input.inc.php'; $modin = isset($_REQUEST['modin']) && $_REQUEST['modin'] ? intval($_REQUEST['modin']) : false; // Fetch the form instance specified by submitted modin value. $udm = new UserDataInput($dbcon, $modin); $mod_id = $udm->modTemplateID; require_once 'AMP/BaseTemplate.php'; if (strlen($_REQUEST['Email']) < 5) { unset($_REQUEST['Email']); } // Check fo rduplicates, setting $uid if found. if (!$uid) { $uid = $udm->findDuplicates(); } // Check for authentication, sending authentication mail if necessary. if ($uid) { $oldSelf = $_SERVER['PHP_SELF']; $_SERVER['PHP_SELF'] = "/modinput4.php"; // Set authentication token if uid present $auth = $udm->authenticate($uid);