function commit_save() { if (!$this->_form->isBuilt) { $this->_form->Build(); } //check if form validation succeeds if (!$this->_form->validate()) { $flash = AMP_System_Flash::instance(); $flash->add_error(AMP_TEXT_ERROR_FORM_DATA_INVALID); $intro =& $this->_map->getPublicPage('input'); $this->_set_public_page($intro); $this->_display->add($this->_form, 'form'); return true; } $this->notify('beforeUpdate'); if (!isset($this->_model->id)) { $this->_model->setDefaults(); } $this->_model->mergeData($this->get_form_data()); $this->notify('beforeSave'); //attempt to save the submitted data if (!$this->_model->save()) { $this->error($this->_model->getErrors()); $this->_display->add($this->_form); return false; } $this->_model_id = $this->_model->id; /* $success_message = AMP_TEXT_DATA_SAVE_SUCCESS; $this->message( sprintf( $success_message, $this->_model->getName( ))); */ $this->_form->postSave($this->_model->getData()); $this->display_response(); return true; }
function validate($data, $options) { $flash = AMP_System_Flash::instance(); if ($options['allowed_sections']) { $allowed_sections = explode(',', $options['allowed_sections']); if (isset($data['section'])) { if (array_search($data['section'], $allowed_sections) === FALSE) { $flash->add_error('Publishing to requested section not allowed'); return false; } } else { $data['section'] = $allowed_sections[0]; } } else { $data['section'] = AMP_CONTENT_MAP_ROOT_SECTION; } if ($options['allowed_classes']) { $allowed_classes = explode(',', $options['allowed_classes']); if (isset($data['class'])) { if (array_search($data['class'], $allowed_classes) === FALSE) { $flash->add_error('Publishing to requested class not allowed'); return false; } } else { $data['class'] = $allowed_classes[0]; } } if (isset($options['auto_publish'])) { $data['publish'] = $options['auto_publish']; } return $data; }
function validate() { $section_id = isset($_REQUEST['type']) && $_REQUEST['type'] ? $_REQUEST['type'] : false; if ($section_id && !AMP_allow('access', 'section', $section_id)) { $flash = AMP_System_Flash::instance(); $flash->add_error(sprintf(AMP_TEXT_ERROR_ACTION_NOT_ALLOWED, AMP_TEXT_SAVE)); return false; } return parent::validate(); }
function execute() { $output = ""; if ($this->udm->hasErrors()) { $output .= $this->_outputErrors(); } if ($this->udm->hasResults()) { $output .= $this->_outputResults(); } $flash =& AMP_System_Flash::instance(); return $output . $flash->execute(); }
function _initFormPublishItem(&$form, &$publish_item, $class_id = AMP_CONTENT_CLASS_DEFAULT, $title = null) { if (!isset($title)) { $title = $publish_item->getName(); } $form_values = array('title' => $title, 'blurb' => $publish_item->getBlurb(), 'class' => $class_id, 'link' => $publish_item->getURL()); if (!$form_values['link']) { require_once 'AMP/System/Flash.php'; $flash =& AMP_System_Flash::instance(); $flash->add_message(AMP_TEXT_CONTENT_PUBLIC_NO_LINK); } $form->setValues($form_values); }
function update() { require_once 'FeedOnFeeds/init_adodb.php'; if (!($url = $this->getURL())) { return false; } $count = fof_update_feed($this->getURL()); if (!$count) { $count = '0'; } $flash =& AMP_System_Flash::instance(); $flash->add_message(sprintf(AMP_TEXT_CONTENT_RSS_ITEMS_ADDED, $count, $this->getName())); return true; }
function commitAction(&$target, $action, $args = null) { if (!method_exists($target, $action)) { trigger_error(sprintf(AMP_TEXT_ERROR_METHOD_NOT_SUPPORTED, get_class($target), $action, get_class($this))); return false; } if (!$this->allow($action, $target)) { $flash =& AMP_System_Flash::instance(); $flash->add_message(sprintf(AMP_TEXT_ERROR_ACTION_NOT_ALLOWED, $action) . " " . $target->getShortName()); return false; } $local_args = $this->_getSpecificArgs($target, $action, $args); return call_user_func_array(array($target, $action), $local_args); }
function subscribe(&$target_set, $args = null) { $lists = AMP_lookup('lists'); if (!(isset($args['list_id']) && $args['list_id'] && isset($lists[$args['list_id']]))) { $flash =& AMP_System_Flash::instance(); $flash->add_error(sprintf(AMP_TEXT_ERROR_NO_SELECTION, AMP_TEXT_LIST)); return false; } $emails = array(); foreach ($target_set as $target) { $emails[] = $target->getEmail(); } return AMP_subscribe_to_list($emails, $args['list_id']); }
function restore() { $target_id = $this->getData('id'); if (!$target_id) { return false; } require_once 'AMP/Content/Template.inc.php'; $template =& new AMPContent_Template($this->dbcon, $target_id); $template->save_version(); $template->mergeData($this->getData()); $result = $template->save(); if (!$result) { return false; } AMP_flush_common_cache(); $flash =& AMP_System_Flash::instance(); $flash->add_message(sprintf(AMP_TEXT_DATA_RESTORE_SUCCESS, $this->getName())); ampredirect(AMP_url_update(AMP_SYSTEM_URL_TEMPLATE, array('id' => $target_id))); return $result; }
function read_request($options = array()) { $options = array_merge($this->getOptions(), $options); if (isset($_POST['list_action']) && $_POST['list_action'] && $options['allow_' . $_POST['list_action']]) { $this->action = $_POST['list_action']; $action = $this->action . '_set'; if (method_exists($this, $action)) { $count = $this->{$action}($_POST['list_action_id']); if (is_numeric($count)) { $message = "{$count} item(s) " . AMP_past_participle($this->action) . ".<BR>"; } else { $message = $count; } $this->message = $message; if (isset($this->message)) { $flash =& AMP_System_Flash::instance(); $flash->add_message($this->message); } } } }
function validate() { $validation_okay = true; $flash =& AMP_System_Flash::instance(); foreach ($this->_rules as $rule_key => $rule_def) { $rule_method = $this->get_rule_method($rule_def['name']); $value = array($this->get($rule_def['field'])); $result = call_user_func_array($rule_method, $value); trigger_error(($result ? 'OK: ' : 'BOO: ') . $rule_method[1] . ' ## ' . $value); if (!$result) { $flash->add_error('There was a problem with some fields on this form', 'form_errors'); $label = $this->get_field_def($rule_def['field'], 'label'); $this->_rules_errors[$rule_def['field']] = $rule_def['name']; $this->_rules_error_messages[$rule_def['field']] = sprintf($rule_def['alert'], $label); trigger_error($this->_rules_error_messages[$rule_def['field']]); $validation_okay = false; } } return $validation_okay; }
function error($error_item, $key = null) { $error_set = is_array($error_item) ? $error_item : array($error_item); $flash =& AMP_System_Flash::instance(); foreach ($error_set as $error_message) { $flash->add_error($error_message, $key); } }
function read_request() { $this->setupRegion(); $options = $this->getOptions(); // CHECK FOR SEARCH CRITERIA //ByDate //looks for records changed after the specified date if (isset($_REQUEST['bydate']) && $_REQUEST['bydate']) { $sql_criteria[] = '`timestamp` >= ' . $this->dbcon->qstr($_REQUEST['bydate']); } //Zip Code Search Request if (isset($_REQUEST['zip']) && isset($_REQUEST['distance']) && $_REQUEST['zip'] && $_REQUEST['distance']) { $srch_options['zip'] = $_REQUEST['zip']; $srch_options['distance'] = $_REQUEST['distance']; $srch_loc = new Geo($this->dbcon, NULL, NULL, NULL, $_REQUEST['zip']); if ($ziplist = $srch_loc->zip_radius($_REQUEST['distance'])) { $zipset = "(" . $_REQUEST['zip']; foreach ($ziplist as $zindex => $zinfo) { if (strlen($zindex) == 4) { $zindex = '0' . $zindex; } $zipset .= "," . $this->dbcon->qstr($zindex); } $zipset .= ")"; $sql_criteria[] = "zip IN {$zipset}"; } else { $flash = AMP_System_Flash::instance(); $flash->add_message("Sorry, no match found for that zip code"); //$this->udm->errorMessage("Sorry, no match found for that zip code"); } } //State Request from index page if (isset($_REQUEST['state']) && $_REQUEST['state']) { $sql_criteria[] = "State=" . $this->dbcon->qstr($_REQUEST['state']); $this->lookups['city']['LookupWhere'] = " modin=" . $this->udm->instance . " AND State=" . $this->dbcon->qstr($_REQUEST['state']); $this->setupLookup('city'); $city_value = isset($_REQUEST['city']) && $_REQUEST['city'] ? $_REQUEST['city'] : null; $this->fields_def['city'] = array('type' => 'select', 'label' => 'Select City', 'values' => $this->lookups['city']['Set'], 'value' => $city_value); } //city Request from index page if (isset($_REQUEST['city']) && $_REQUEST['city']) { $sql_criteria[] = "city=" . $this->dbcon->qstr($_REQUEST['city']); } //Area Request from pulldown if (isset($_REQUEST['area']) && $_REQUEST['area']) { $this->setupLookup('area'); if ($state_name = $this->lookups['area']['Set'][$_REQUEST['area']]) { $state_code = array_search($state_name, $this->lookups['state']['Set']); if ($state_code) { $sql_criteria[] = "State=" . $this->dbcon->qstr($state_code); } } } //Country if (isset($_REQUEST['country']) && $_REQUEST['country']) { //check to see if the search is by code if (strlen($_REQUEST['country']) == 3 && ($country_name = $this->lookups['country']['Set'][$_REQUEST['country']])) { $criteria_code = "Country=" . $this->dbcon->qstr($_REQUEST['country']); } else { if ($country_code = array_search($_REQUEST['country'], $this->regionset->regions['WORLD'])) { $criteria_code = "Country=" . $this->dbcon->qstr($country_code); } } $sql_criteria[] = "( " . $criteria_code . " OR ( Country=" . $this->dbcon->qstr($_REQUEST['country']) . "))"; } //Keyword - fulltext search if (isset($_REQUEST['keyword']) && $_REQUEST['keyword']) { //Create a set of phrases to search for $kwsearch = $_REQUEST['keyword']; if (substr_count($kwsearch, '"') >= 2) { //extract quoted phrases //method kudos to insipience.com preg_match_all("/\"([\\w\\s]+)(\"|\$)/", $kwsearch, $matches, PREG_PATTERN_ORDER); $phrases = $matches[1]; $terms = explode(" ", preg_replace("/\"[\\w\\s]*(\"|\$)/", "", $kwsearch)); $phrase_set = array_merge($terms, $phrases); } else { $phrase_set = split(' ', $kwsearch); } //determine the fields to include in the search $db_fields = $this->udm->dbcon->MetaColumnNames('userdata'); foreach ($this->udm->fields as $fname => $fdef) { if ($fdef['type'] == 'text' || $fdef['type'] == 'textarea') { $textfields[] = $fname; } } if (is_array($textfields)) { $src_fields = array_intersect($db_fields, $textfields); //SQL should be case-insensitive by default //but it's acting weird, so let's force the issue. foreach ($src_fields as $key => $value) { $src_fields[$key] = "if(isnull(`" . $value . "`),'',`" . $value . "`)"; } $src_name = "Lower(Concat( " . join(',', $src_fields) . "))"; foreach ($phrase_set as $keyword) { //make sure it's not an empty phrase if ($keyword) { $sql_criteria[] = "{$src_name} LIKE " . $this->dbcon->qstr('%' . strtolower($keyword) . '%'); } } } } //Company if (isset($_REQUEST['Company']) && $_REQUEST['Company']) { $sql_criteria[] = "Company LIKE" . $this->dbcon->qstr('%' . $_REQUEST['Company'] . '%'); } //Modin if (isset($_REQUEST['modin']) && $_REQUEST['modin']) { $sql_criteria['modin'] = "modin=" . $_REQUEST['modin']; } //Uid or Creator_id if (isset($_REQUEST['uid']) && $_REQUEST['uid']) { if (is_array($_REQUEST['uid'])) { //allow for multiple ids $sql_criteria[] = "id in(" . join(",", $_REQUEST['uid']) . ")"; } else { $sql_criteria[] = "id=" . $this->dbcon->qstr($_REQUEST['uid']); } } //Publish status if (isset($_REQUEST['publish']) && is_numeric($_REQUEST['publish'])) { if ($_REQUEST['publish']) { $sql_criteria[] = "publish=1"; } else { $sql_criteria[] = "(isnull(publish) OR publish!=1)"; } } //tags if (isset($_REQUEST['tag']) && $_REQUEST['tag']) { $tagged_forms = AMPSystem_Lookup::instance('formsByTag', $_REQUEST['tag']); if (!$tagged_forms || empty($tagged_forms)) { $sql_criteria[] = 'FALSE'; } else { $sql_criteria[] = 'id in( ' . join(",", array_keys($tagged_forms)) . ')'; } } //name if (isset($_REQUEST['name']) && $_REQUEST['name']) { $sql_criteria[] = 'Concat( if( isnull( First_Name ), "", First_Name ), if ( isnull( Last_Name ), "", Last_Name ), if ( isnull( Company ), "", Company )) LIKE ' . $this->dbcon->qstr('%' . str_replace(' ', '%', $_REQUEST['name']) . '%'); } //arbitrary "extra" fields sql if (isset($options['search_extra_fields_sql']) && $options['search_extra_fields_sql'] && function_exists($options['search_extra_fields_sql'])) { $extra_sql_function = $options['search_extra_fields_sql']; $extra_criteria = $extra_sql_function($this); if ($extra_criteria) { $sql_criteria = array_merge($sql_criteria, $extra_criteria); } } $specified_fields = array('publish', 'search', 'sortby', 'qty', 'offset', 'uid', 'modin', 'country', 'area', 'city', 'state', 'zip', 'distance', 'bydate', 'tag', 'name', 'keyword'); foreach ($this->_included_fields as $fieldname) { if (!isset($this->udm->fields[$fieldname])) { continue; } if (array_search($fieldname, $specified_fields) !== FALSE) { continue; } if (!(isset($_REQUEST[$fieldname]) && $_REQUEST[$fieldname])) { continue; } if (is_int($_REQUEST[$fieldname])) { //do precise search for numeric values $sql_criteria[] = $fieldname . ' = ' . $this->dbcon->qstr($_REQUEST[$fieldname]); } elseif (is_array($_REQUEST[$fieldname]) && $this->udm->fields[$fieldname]['type'] == 'date') { $date_preferences = 'form.' . $this->udm->instance . '.date.search.inc.php'; if (!file_exists_incpath($date_preferences)) { $request_year = isset($_REQUEST[$fieldname]['Y']) && $_REQUEST[$fieldname]['Y'] ? $_REQUEST[$fieldname]['Y'] : false; $request_month = isset($_REQUEST[$fieldname]['M']) && $_REQUEST[$fieldname]['M'] ? $_REQUEST[$fieldname]['M'] : false; //if ( $request_month && $request_year ) { //$sql_criteria[] = $fieldname . ' > ' . $this->dbcon->qstr( $]['Y'] . '-' . str_pad( $_REQUEST[$fieldname]['M'], 2, '0', STR_PAD_LEFT) . '-01' ); //$sql_criteria[] = $fieldname . ' < ' . $this->dbcon->qstr( $_REQUEST[$fieldname]['Y'] . '-' . str_pad( $_REQUEST[$fieldname]['M'], 2, '0', STR_PAD_LEFT) . '-32' ); //} if ($request_year) { $sql_criteria[] = 'YEAR( ' . $fieldname . ') = ' . $this->dbcon->qstr($_REQUEST[$fieldname]['Y']); } if ($request_month) { $sql_criteria[] = 'MONTH( ' . $fieldname . ') = ' . $this->dbcon->qstr($_REQUEST[$fieldname]['M']); } } else { $date_crit_method = 'form_' . $this->udm->instance . '_date_search'; include_once $date_preferences; $sql_criteria[] = $date_crit_method($fieldname); } } else { //do string 'contains' search $sql_criteria[] = $fieldname . ' LIKE ' . $this->dbcon->qstr('%' . $_REQUEST[$fieldname] . '%'); } } //Vet valid URL data $vetted_set = array(); $criteria_set = $this->udm->getURLCriteria(); foreach ($this->fields_def as $field => $fdef) { if (!isset($criteria_set[$field])) { continue; } if (!($criteria_set[$field] || $criteria_set[$field] === '0')) { continue; } $vetted_set[$field] = $criteria_set[$field]; } $this->udm->url_criteria = $vetted_set; return $sql_criteria; }
function save($data) { $data = $this->udm->getData(); foreach ($data as $key => $value) { if ($field = $this->checkPrefix($key)) { $plugin[$field] = $value; } } $options = $this->getOptions(); require_once 'PayPal.php'; require_once 'PayPal/Profile/API.php'; require_once 'PayPal/Profile/Handler.php'; require_once 'PayPal/Profile/Handler/Array.php'; require_once 'PayPal/Type/DoDirectPaymentRequestType.php'; require_once 'PayPal/Type/DoDirectPaymentRequestDetailsType.php'; require_once 'PayPal/Type/DoDirectPaymentResponseType.php'; require_once 'PayPal/Type/BasicAmountType.php'; require_once 'PayPal/Type/PaymentDetailsType.php'; require_once 'PayPal/Type/AddressType.php'; require_once 'PayPal/Type/CreditCardDetailsType.php'; require_once 'PayPal/Type/PayerInfoType.php'; require_once 'PayPal/Type/PersonNameType.php'; $pid =& ProfileHandler::generateID(); $handler =& ProfileHandler_Array::getInstance(array('username' => $options['api_username'], 'password' => $options['api_password'], 'certificateFile' => $options['cert_file'], 'subject' => null, 'environment' => $options['environment'])); $profile =& APIProfile::getInstance($pid, $handler); $dp_request =& PayPal::getType('DoDirectPaymentRequestType'); $firstName = $data['First_Name']; $lastName = $data['Last_Name']; $creditCardType = $plugin['cc_type']; $creditCardNumber = $plugin['cc_number']; $expDateMonth = $plugin['cc_expiration']['m']; // Month must be padded with leading zero $padDateMonth = str_pad($expDateMonth, 2, '0', STR_PAD_LEFT); $expDateYear = $plugin['cc_expiration']['Y']; $cvv2Number = $plugin['cc_cvv2']; $address1 = $data['Street']; $address2 = isset($data['Street_1']) ? $data['Street_1'] : null; $city = $data['City']; $state = $data['State']; $zip = $data['Zip']; $amount = $plugin['amount']; $OrderTotal =& PayPal::getType('BasicAmountType'); $OrderTotal->setattr('currencyID', 'USD'); $OrderTotal->setval($amount, 'iso-8859-1'); $PaymentDetails =& PayPal::getType('PaymentDetailsType'); $PaymentDetails->setOrderTotal($OrderTotal); $shipTo =& PayPal::getType('AddressType'); $shipTo->setName($firstName . ' ' . $lastName); $shipTo->setStreet1($address1); $shipTo->setStreet2($address2); $shipTo->setCityName($city); $shipTo->setStateOrProvince($state); $shipTo->setCountry('US'); $shipTo->setPostalCode($zip); $PaymentDetails->setShipToAddress($shipTo); $dp_details =& PayPal::getType('DoDirectPaymentRequestDetailsType'); $dp_details->setPaymentDetails($PaymentDetails); // Credit Card info $card_details =& PayPal::getType('CreditCardDetailsType'); $card_details->setCreditCardType($creditCardType); $card_details->setCreditCardNumber($creditCardNumber); $card_details->setExpMonth($padDateMonth); $card_details->setExpYear($expDateYear); $card_details->setCVV2($cvv2Number); $payer =& PayPal::getType('PayerInfoType'); $person_name =& PayPal::getType('PersonNameType'); $person_name->setFirstName($firstName); $person_name->setLastName($lastName); $payer->setPayerName($person_name); $payer->setPayerCountry('US'); $payer->setAddress($shipTo); if (isset($data['Email'])) { $payer->setPayer($data['Email']); } $card_details->setCardOwner($payer); $dp_details->setCreditCard($card_details); $dp_details->setIPAddress($_SERVER['SERVER_ADDR']); $dp_details->setPaymentAction('Sale'); $dp_request->setDoDirectPaymentRequestDetails($dp_details); $caller =& PayPal::getCallerServices($profile); if (PEAR::isError($caller)) { trigger_error($caller->getMessage()); return false; } $response = $caller->DoDirectPayment($dp_request); $ack = $response->getAck(); define('ACK_SUCCESS', 'Success'); define('ACK_SUCCESS_WITH_WARNING', 'SuccessWithWarning'); switch ($ack) { case ACK_SUCCESS: case ACK_SUCCESS_WITH_WARNING: if (isset($options['response']) && $options['response']) { $response_code = 'Transaction ID: ' . $response->getTransactionID() . "\n" . 'Completed AVS Code: ' . $response->getAVSCode() . "\n" . 'CVV2 Code: ' . $response->getCVV2Code(); require_once 'AMP/System/User/Profile/Profile.php'; $profile =& new AMP_System_User_Profile($this->dbcon, $this->udm->uid); if ($profile->hasData()) { $update = array($options['response'] => $response_code); $profile->mergeData($update); $profile->save(); } else { trigger_error('cannot update profile with paypal response: ' . $response_code); } } return true; default: require_once 'PayPal/Type/AbstractResponseType.php'; require_once 'PayPal/Type/ErrorType.php'; require_once 'PayPal/Type/DoDirectPaymentResponseType.php'; $errors =& $response->getErrors(); if (!is_array($errors)) { $errors = array($errors); } foreach ($errors as $error) { trigger_error($error->getShortMessage() . ' : ' . $error->getLongMessage()); $flash =& AMP_System_Flash::instance(); $flash->add_error($error->getLongMessage()); } } return false; }
function setMessage($text, $key = null) { if (isset($this->suppress['messages']) && $this->suppress['messages']) { return false; } if (isset($this->_controller) && method_exists($this->_controller, 'setMessage')) { return $this->_controller->setMessage($text); } if (isset($this->_controller) && method_exists($this->_controller, 'message')) { return $this->_controller->message($text, $key); } require_once 'AMP/System/Flash.php'; $flash = AMP_System_Flash::instance(); $flash->add_message($text, $key); $this->message .= $text . '<BR>'; }
function message($message_text) { if ($this->_suppress_messages) { return false; } $flash = AMP_System_Flash::instance(); $flash->add_message($message_text); }
function output_Content() { $flash =& AMP_System_Flash::instance(); return $flash->execute() . $this->_page->contentManager->output(); }
function AMP_flashMessage($message, $is_error = false) { require_once 'AMP/System/Flash.php'; $flash = AMP_System_Flash::instance(); if ($is_error) { return $flash->add_error($message); } $flash->add_message($message); }
function showMessages() { $output = ""; foreach ($this->page->getErrors() as $error) { $output .= "<span class=\"page_error\">{$error}</span>\n"; } foreach ($this->page->getResults() as $result) { $output .= "<span class=\"page_result\">{$result}</span>\n"; } $flash =& AMP_System_Flash::instance(); return $output . $flash->execute(); }
function navify() { require_once "AMP/Content/Nav.inc.php"; $new_nav = new NavigationElement($this->dbcon); if ($existing_navs = $new_nav->find(array('badge_id' => $this->id))) { $found_nav = current($existing_navs); $flash = AMP_System_Flash::instance(); $flash->add_message($this->getName() . ' already has a nav', get_class($this) . '_navify_message', $found_nav->get_url_edit()); return false; } $new_nav->setDefaults(); $nav_data = array('name' => $this->getName(), 'titletext' => $this->getName(), 'badge_id' => $this->id, 'modid' => AMP_MODULE_ID_CONTENT); $new_nav->mergeData($nav_data); return $new_nav->save(); }
function formInvalidCallback() { require_once 'AMP/System/Flash.php'; $flash =& AMP_System_Flash::instance(); $flash->add_error(AMP_TEXT_ERROR_FORM_DATA_INVALID); foreach ($this->getFormCallbacks('AMP_UDM_FORM_INVALID') as $callback) { call_user_func_array($callback['callback'], $this); } }
} elseif (!$sub && $uid) { // Fetch the user data for $uid if there is no submitted data // and the user is authenticated. $udm->getUser($uid); } /* 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. By default, the form will include AMP's base template code, and any database-backed intro text to the appropriate module. */ $mod_id = $udm->modTemplateID; //require_once( 'header.php' ); require_once 'AMP/Content/Buffer.php'; require_once 'AMP/System/Page/Display.php'; $page_output = "<h2>Add/Edit " . $udm->name . "</h2>" . "<font color = \"red\">" . $udm->outputErrors() . "</font>" . $udm->output(); $display = new AMP_Content_Buffer(); $display->add($page_output); $flash = AMP_System_Flash::instance(); $fake_controller = $flash; $complete_page =& AMP_System_Page_Display::instance($fake_controller); $complete_page->add($flash, AMP_CONTENT_DISPLAY_KEY_FLASH); $complete_page->add($display); print $complete_page->execute(); // Append the footer and clean up. //require_once( 'footer.php' );
function getSourceFields() { if (isset($this->_source_fields)) { return $this->_source_fields; } $fp = $this->_load_source(); if (!$fp) { return $fp; } //get the field definitions //$this->_source_fields = fgetcsv( $fp, 32000 ); $source_fields_base = fgetcsv($fp, 32000); if (!$source_fields_base) { $flash = AMP_System_Flash::instance(); $flash->add_message('no fields found for ' . $this->_import_filename); return false; } foreach ($source_fields_base as $field_name) { $this->_source_fields[$field_name] = $field_name; } fclose($fp); return $this->_source_fields; }