Exemple #1
0
 function _preview_url($section)
 {
     $base_url = $section->getURL_default();
     if (AMP_CONTENT_HUMANIZE_URLS) {
         $base_url = '/' . AMP_route_for('section', $section->id);
     }
     return AMP_url_add_vars(AmpUtility::current_host() . $base_url, array('preview=1', 'cache=0'));
 }
Exemple #2
0
 function show()
 {
     $this->_before('show');
     $article = $this->current_object = new Article(AMP_dbcon(), $this->params['id']);
     //section headers redirect to sections
     if ($article && $article->hasData() && $article->getData('class') == AMP_CONTENT_CLASS_SECTIONHEADER) {
         return ampredirect(AMP_route_for('section', $article->getParent()));
     }
     if (!($article && AmpUtility::display_okay($article))) {
         return AMP_make_404();
     }
     $this->render($article->getDisplay());
 }
Exemple #3
0
 function show()
 {
     $this->_before('show');
     $section = $this->current_object = new Section(AMP_dbcon(), $this->params['id']);
     if (!($section && AmpUtility::display_okay($section))) {
         return AMP_make_404();
     }
     if ($target = $section->getHeaderRedirect()) {
         ampredirect($target);
     }
     $display =& $section->getDisplay();
     $this->_render_section_header($display);
     $this->render($display);
 }
Exemple #4
0
 function _systemFooterText()
 {
     return sprintf(AMP_TEXT_SYSTEM_INTERFACE_FOOTER, AMP_SYSTEM_VERSION_ID, AMP_SITE_NAME, AmpUtility::deploy_date(), AMP_SITE_ADMIN);
 }
Exemple #5
0
 function render_preview($source)
 {
     return $this->_renderer->link(AmpUtility::current_host() . AMP_route_for('section', $source->id, array('preview' => true)), $this->_renderer->image(AMP_SYSTEM_ICON_PREVIEW, array('class' => 'icon')), array('target' => '_blank', 'title' => AMP_TEXT_PREVIEW_ITEM));
 }
    }
    if ($combo || $winpay->donation_amount == '75' || $winpay->donation_amount == '80') {
        trigger_error('combo payment');
        if ($winpay->donation_amount == '75' || $winpay->donation_amount == '80') {
            trigger_error(var_export($member->dia, true));
            $dia = new DemocracyInAction_API(DIA_API_NODE, DIA_API_USERNAME, DIA_API_PASSWORD);
            $dia->authenticate();
            $member->dia =& $dia;
            $member->dia->save('supporter', array('Email' => $member->data->getData('Email'), 'email_trigger_KEYS' => '0,12374', 'USERNAME' => $member->data->getData('Email')));
        }
        //$member->add_to_group($dia_supporter_key, WIN_COMBO_GROUP );
        $member->data->mergeData(array('region' => true));
    }
    ampredirect(WIN_LOGIN_URL);
} else {
    AmpUtility::bail('Sorry, your payment is no longer valid.  Please contact WIN to resolve this issue.');
}
class WinPaymentVerifier
{
    var $membership_cost = 15;
    function WinPaymentVerifier()
    {
        $this->__construct();
    }
    function __construct()
    {
        $this->dia = new DemocracyInAction_API(DIA_API_NODE, DIA_API_USERNAME, DIA_API_PASSWORD);
        $this->dia->authenticate();
        //recentness is 6 months
        $this->recent_cutoff = 180 * 24 * 3600;
    }
Exemple #7
0
 function _renderPreviewLink($article)
 {
     return $this->_renderer->link(AmpUtility::current_host() . AMP_route_for('article', $article->id, array('preview' => true)), $this->_renderer->image(AMP_SYSTEM_ICON_PREVIEW, array('width' => '16', 'height' => '16', 'border' => '0', 'align' => 'right')), array('target' => 'blank', 'title' => AMP_TEXT_PREVIEW_ITEM));
 }
Exemple #8
0
 function makeCriteriaDisplayable($value, $overrides = array())
 {
     $crit = array();
     $crit['class'] = $this->makeCriteriaDisplayableClass();
     $crit['status'] = $this->makeCriteriaLive();
     if (!AmpUtility::is_preview_mode()) {
         $crit['section_status'] = $this->makeCriteriaLiveParent();
     }
     $crit['allowed'] = $this->makeCriteriaAllowed();
     $crit['public'] = $this->makeCriteriaPublicToUser();
     $final_crit = array_merge($crit, $overrides);
     return join(" AND ", array_filter($final_crit));
 }
 function display_okay($item)
 {
     if (!$item->hasData()) {
         return false;
     }
     return $item->isDisplayable() || AmpUtility::is_preview_mode();
 }
Exemple #10
0
 function _HTML_previewLink($id)
 {
     if (!isset($this->previewlink)) {
         return false;
     }
     return '<a href="' . AmpUtility::current_host() . AMP_route_for('article', $id, array('preview' => 1)) . '" target="_blank" title="' . AMP_TEXT_PREVIEW_ITEM . '">' . '<img src="' . AMP_SYSTEM_ICON_PREVIEW . '" width="16" height="16" border=0></a>';
 }
Exemple #11
0
     * Check if specified article is a section header and redirect to that section
     */
    if (AMP_CONTENT_REDIRECT_SECTIONHEADERS_TO_SECTIONS && $currentArticle->getClass() == AMP_CONTENT_CLASS_SECTIONHEADER) {
        if ($currentSection->hasData()) {
            //drop article id, keep preview or other url vars
            $new_params = $_GET;
            unset($new_params['id']);
            ampredirect(AMP_url_update($currentSection->getURL(), $new_params));
        }
    }
}
/**
 * Check Section List pages for a redirect in the SectionHeader 
 */
if ($currentPage->isList(AMP_CONTENT_LISTTYPE_SECTION) && ($currentSection =& $currentPage->getSection())) {
    if (!AmpUtility::display_okay($currentSection)) {
        AMP_make_404();
    }
    if ($target = $currentSection->getHeaderRedirect()) {
        ampredirect($target);
    }
}
/**
 * Check if a section was specified for class lists 
 */
if ($currentPage->isList(AMP_CONTENT_LISTTYPE_CLASS) && isset($_GET['type']) && ($currentSection =& $currentPage->getSection()) && ($currentClass =& $currentPage->getClass())) {
    $currentClass->addContentsCriteriaSection($currentSection->id);
}
/**
 * Get Listing Display  
 */
Exemple #12
0
<?php

require_once 'AMP/Base/Config.php';
require_once 'AMP/System/User/Profile/Profile.php';
require 'democracyinaction/api.php';
require_once 'win_config.php';
require_once 'WinMember.php';
$email = $_GET['email'];
$donation_key = AMP_params('donation_key');
$member = WinMember::find_by_email($email);
if (!$member) {
    AmpUtility::bail('Sorry we could not find a record with the email: ' . $email . ' Please contact info@winonline.org');
}
$dia = new DemocracyInAction_API(DIA_API_NODE, DIA_API_USERNAME, DIA_API_PASSWORD);
$dia->authenticate();
$member->dia =& $dia;
$dia_supporter_key = $member->dia->save('supporter', array('Email' => $member->data->getData('Email'), 'First_Name' => $member->data->getData('First_Name'), 'Last_Name' => $member->data->getData('Last_Name')));
trigger_error('supporter_key: ' . $dia_supporter_key);
$member->data->mergeData(array(WIN_DIA_SUPPORTER_KEY => $dia_supporter_key));
$member->data->save();
$member->create_or_renew($donation_key);
$member->mark_as_paid_in_dia($dia_supporter_key);
$member->set_membership_status('active');
$member->add_to_group($dia_supporter_key, WIN_CURRENT_MEMBERS);
$member->sync_to_dia();
trigger_error('synced with DIA');
trigger_error($member->data->getData('custom1'));
trigger_error($member->data->getData('custom2'));
$member->dia->save('supporter', array('Email' => $member->data->getData('Email'), 'email_trigger_KEYS' => '0,17001', 'USERNAME' => $member->data->getData('custom1'), 'PASSWORD' => $member->data->getData('custom2'), 'name' => AMP_params('name'), 'recipient_name' => AMP_params('recipient_name'), 'custom_message' => AMP_params('custom_message')));
ampredirect('http://www.winonline.org/article.php?id=443');
 function create_or_renew($donation_key)
 {
     $this->connect_to_dia();
     $donation = $this->dia->get_object('donation', $donation_key);
     if (!$donation) {
         AmpUtility::bail('Sorry, there was a problem with your donation.  Please contact WIN to resolve this issue', WIN_CONTACT_URL);
     }
     if ($this->is_existing_member()) {
         $this->renew_membership($donation_key);
     } else {
         $this->create_membership($donation_key);
     }
     $this->data->save();
 }