Beispiel #1
0
 function _formFooter()
 {
     if (!$this->getIdValue()) {
         return false;
     }
     $renderer = new AMPDisplay_HTML();
     return $renderer->inSpan(AMP_TEXT_SYSTEM_LINK_NAV_LAYOUT_EDIT, array('class' => 'intitle')) . AMP_navCountDisplay_Introtext($this->getIdValue());
 }
Beispiel #2
0
 function _formFooter()
 {
     if (isset($_REQUEST['id']) || isset($_REQUEST['file'])) {
         return false;
     }
     require_once 'AMP/Content/Display/HTML.inc.php';
     $renderer = new AMPDisplay_HTML();
     return $renderer->link(AMP_url_add_vars(AMP_SYSTEM_URL_IMAGES, 'action=megaupload'), 'Alternate upload page');
 }
Beispiel #3
0
 function _formFooter()
 {
     $article =& $this->_get_model();
     if (!$article) {
         return false;
     }
     $id = $article->getArticleId();
     $renderer = new AMPDisplay_HTML();
     $output = $renderer->inSpan(sprintf(AMP_TEXT_CURRENT_ACTION, AMP_TEXT_EDIT, sprintf(AMP_TEXT_VERSION_ID, $article->id)), array('class' => 'page_result'));
     require_once 'AMP/Content/Article/Version/List.inc.php';
     $list = new Article_Version_List(AMP_Registry::getDbcon(), array('article' => $id));
     return $output . $list->execute();
 }
Beispiel #4
0
 function execute($options = array())
 {
     $options = array_merge($this->getOptions(), $options);
     require_once 'AMP/UserData/Lookups.inc.php';
     $index_title = AMP_pluralize($this->udm->name) . " By " . $options['index_name'];
     $index_set =& FormLookup_Variant::instance($options['index_field'], $this->udm->instance);
     #$index['state']['sql'].="SELECT count(userdata.id) as qty, userdata.State as item_key, states.statename as item_name from userdata, states WHERE userdata.State=states.state and modin=".$_REQUEST['modin']." GROUP BY userdata.State ";
     $translated_values = isset($this->_region_lookups[$options['index_field']]) ? AMPSystem_Lookup::locate($this->_region_lookups[$options['index_field']]) : AMPSystem_Lookup::locate(array('instance' => AMP_pluralize($options['index_field'])));
     require_once 'AMP/Content/Display/HTML.inc.php';
     $renderer = new AMPDisplay_HTML();
     $output = $renderer->bold($index_title) . $renderer->newline();
     foreach ($index_set as $index_value => $index_count) {
         $display_value = $translated_values && isset($translated_values[$index_value]) ? $translated_values[$index_value] : $index_value;
         $display_value .= ' (' . $index_count . ')';
         $link_value = AMP_URL_AddVars($_SERVER['PHP_SELF'], array($options['index_field'] => strtolower($options['index_field']) . '=' . $index_value, 'modin' => 'modin=' . $this->udm->instance));
         $output .= $renderer->link($link_value, $display_value) . $renderer->newline();
         #$output .= '<a href="'.$_SERVER['PHP_SELF'].'?'.$options['index_field'].'='.$index_value.'&modin='.$_REQUEST['modin'].'">'.$index_item['item_name'].'</a> ('.$index_item['qty'].')<BR>';
     }
     return $output;
 }
Beispiel #5
0
function AMP_navCalendarSearchState()
{
    $renderer = new AMPDisplay_HTML();
    $add_link = $renderer->link(AMP_CONTENT_URL_EVENT_ADD, 'Post an Event', array('class' => 'homeeventslink'));
    $search_link = $renderer->link(AMP_CONTENT_URL_EVENT_SEARCH, 'Search Events', array('class' => 'homeeventslink'));
    $state_values = AMPSystem_Lookup::instance('Regions_US');
    $select_values = array('' => 'Select Your State');
    if ($state_values) {
        $select_values = $select_values + $state_values;
    }
    return $search_link . $renderer->newline() . '<form method="GET" action="' . AMP_CONTENT_URL_EVENT_LIST . '">' . AMP_buildSelect('state', $select_values, null, $renderer->makeAttributes(array('onChange' => 'if ( this.value != "") this.form.submit( );'))) . '<input name="search" value="Search" type="hidden">' . '</form>' . $renderer->newline() . $add_link . $renderer->newline();
}
Beispiel #6
0
 function _readIntroText($id, $merge_fields = false)
 {
     $system_texts = AMPSystem_Lookup::instance('introTexts');
     if (!isset($system_texts[$id])) {
         return $id;
     }
     $textdata =& new AMPSystem_IntroText($this->dbcon, $id);
     if ($textdata->isHtml()) {
         $this->containsHTML(true);
     }
     if ($merge_fields) {
         $merged_text = $textdata->mergeBodyFields($merge_fields);
     } else {
         $merged_text = $textdata->getBody();
     }
     return AMPDisplay_HTML::_activateIncludes($merged_text) . "\n\n";
 }
Beispiel #7
0
 function _processInclude($code)
 {
     if (!($filename = AMPDisplay_HTML::_getIncludeFilename($code))) {
         return false;
     }
     ob_start();
     include $filename;
     $include_value = ob_get_contents();
     ob_end_clean();
     return $include_value;
 }
 function AMP_publicPagePublishButton($id, $linkfield)
 {
     static $renderer = false;
     if (!$renderer) {
         require_once 'AMP/Content/Display/HTML.inc.php';
         $renderer = new AMPDisplay_HTML();
     }
     return $renderer->link(AMP_Url_AddVars(AMP_SYSTEM_URL_PUBLIC_PAGE_PUBLISH, array($linkfield . '=' . $id)), ucfirst(AMP_TEXT_PUBLISH));
     /* using POST is not required , and is kinda messy
        return '<form name="publish_Page_'.$id .'" method="POST" action="/system/module_contentadd.php">'
            . '<input type="hidden" name="'.$linkfield.'" value="'. $id . '">'
            . '<input type="submit" value="Publish" class="searchform_element"></form>';
            */
 }
Beispiel #9
0
<?php

require_once "AMP/BaseDB.php";
require_once 'AMP/Content/Display/HTML.inc.php';
#declare what is needed for each request
$allowed_lookups = array('author', 'source', 'title', 'event');
foreach ($allowed_lookups as $test_lookup) {
    if (!(isset($_REQUEST[$test_lookup]) && $_REQUEST[$test_lookup])) {
        continue;
    }
    $partial_value = $_REQUEST[$test_lookup];
    $desired_lookup = 'AMPContentLookup_' . ucfirst($test_lookup);
}
$result_set = call_user_func(array($desired_lookup, 'instance'), $partial_value);
$display = new AMPDisplay_HTML();
print $display->_HTML_UL($result_set);
Beispiel #10
0
 function _addElementCaptcha($name, $field_def)
 {
     $false = false;
     if ($this->_has_captcha) {
         return $false;
     }
     $this->_has_captcha = true;
     // use recaptcha if its set up
     if (defined('RECAPTCHA_PRIVATE_KEY') && RECAPTCHA_PRIVATE_KEY) {
         require 'recaptcha/recaptchalib.php';
         $error_html = "";
         if (isset($_POST['recaptcha_response_field']) && !AMPForm::validate_recaptcha()) {
             $error_html = "<!-- BEGIN error --><span style=\"color: #ff0000\">" . AMP_TEXT_ERROR_FORM_CAPTCHA_FAILED . "</span><br /><!-- END error -->\t";
         }
         $fRef = $this->form->addElement('static', 'captcha_' . $name, "", $error_html . recaptcha_get_html(RECAPTCHA_PUBLIC_KEY));
         $this->form->addElement('hidden', 'recaptcha_response_field');
         $this->form->addRule('recaptcha_response_field', AMP_TEXT_ERROR_REQUIRED_FIELD_MISSING, 'required');
         $rule_config = array('AMPForm', 'validate_recaptcha');
         $this->form->addRule('recaptcha_response_field', AMP_TEXT_ERROR_FORM_CAPTCHA_FAILED, 'callback', $rule_config);
         return $fRef;
         // use craptastic captcha otherwise
     } else {
         $this->_addUniqueIdValue();
         require_once 'AMP/Content/Display/HTML.inc.php';
         $renderer = new AMPDisplay_HTML();
         $this->form->addElement('static', 'captcha_' . $name, "", $renderer->image(AMP_Url_AddVars(AMP_CONTENT_URL_CAPTCHA, array('key=' . AMP_SYSTEM_UNIQUE_VISITOR_ID)), array('align' => 'center')));
         $defaults = $this->_getDefault($name);
         $fRef = $this->form->addElement('text', $name, $field_def['label'], $defaults);
         require_once 'AMP/Form/Element/Captcha.inc.php';
         $captcha_demo = new PhpCaptcha(array());
         $rule_config = array($captcha_demo, 'Validate');
         $this->form->addRule($name, AMP_TEXT_ERROR_FORM_CAPTCHA_FAILED, 'callback', $rule_config);
         return $fRef;
     }
 }
Beispiel #11
0
 function _commit_crop_thumbnail($real_sizes)
 {
     $target_path = AMP_image_path($this->_model->getName(), AMP_IMAGE_CLASS_CROP);
     #AMP_mkdir( substr( $target_path, 0, strlen( $target_path ) - strlen( $this->_model->getName() - 1)));
     AMP_mkdir(dirname($target_path));
     $new_image =& $this->_model->crop($real_sizes['start_x'], $real_sizes['start_y'], $real_sizes['start_x'] + $real_sizes['width'], $real_sizes['start_y'] + $real_sizes['height']);
     if (!$new_image) {
         return $this->_commit_crop_failure();
     }
     $this->_model->write_image_resource($new_image, $target_path);
     $cropped_image = new AMP_System_File_Image($target_path);
     if (!$cropped_image->width) {
         return $this->_commit_crop_failure();
     }
     $target_path = AMP_image_path($this->_model->getName(), AMP_IMAGE_CLASS_THUMB);
     $thumb_ratio = AMP_IMAGE_WIDTH_THUMB / $cropped_image->width;
     $thumb_sizes = $this->_resize_ratio(array('height' => $cropped_image->height, 'width' => $cropped_image->width), $thumb_ratio);
     $thumb_image =& $cropped_image->resize($thumb_sizes['width'], $thumb_sizes['height']);
     if (!$thumb_image) {
         return $this->_commit_crop_failure(AMP_TEXT_THUMBNAIL);
     }
     $cropped_image->write_image_resource($thumb_image, $target_path);
     $renderer = new AMPDisplay_HTML();
     $this->message($renderer->image(AMP_image_url($this->_model->getName(), AMP_IMAGE_CLASS_CROP), array('border' => 1)) . $renderer->newline(2) . sprintf(AMP_TEXT_DATA_SAVE_SUCCESS, $cropped_image->getName() . $renderer->space() . AMP_TEXT_CROP), $this->_unique_action_key(), $this->_model->get_url_edit());
     return true;
 }