Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add Partner Dashboard

  • Loading branch information...
commit 9d219a4e492ce027e40e641fff188d2d56967061 1 parent 3d7aa1b
@haraldpdl authored
Showing with 1,362 additions and 0 deletions.
  1. +60 −0 osCommerce/OM/Custom/Site/Website/Application/Services/Action/Dashboard.php
  2. +32 −0 osCommerce/OM/Custom/Site/Website/Application/Services/Action/Dashboard/Edit.php
  3. +325 −0 osCommerce/OM/Custom/Site/Website/Application/Services/Action/Dashboard/Edit/Process.php
  4. +30 −0 osCommerce/OM/Custom/Site/Website/Application/Services/Action/Login.php
  5. +34 −0 osCommerce/OM/Custom/Site/Website/Application/Services/Action/Login/Process.php
  6. +47 −0 osCommerce/OM/Custom/Site/Website/Application/Services/pages/dashboard.html
  7. +220 −0 osCommerce/OM/Custom/Site/Website/Application/Services/pages/dashboard_edit.html
  8. +15 −0 osCommerce/OM/Custom/Site/Website/Application/Services/pages/dashboard_empty.html
  9. +44 −0 osCommerce/OM/Custom/Site/Website/Application/Services/pages/login.html
  10. +2 −0  osCommerce/OM/Custom/Site/Website/Application/Services/pages/main.html
  11. +206 −0 osCommerce/OM/Custom/Site/Website/Invision.php
  12. +86 −0 osCommerce/OM/Custom/Site/Website/Partner.php
  13. +25 −0 osCommerce/OM/Custom/Site/Website/SQL/ANSI/PartnerGetCampaign.php
  14. +24 −0 osCommerce/OM/Custom/Site/Website/SQL/ANSI/PartnerGetCampaigns.php
  15. +31 −0 osCommerce/OM/Custom/Site/Website/SQL/ANSI/PartnerHasCampaign.php
  16. +105 −0 osCommerce/OM/Custom/Site/Website/SQL/ANSI/PartnerSave.php
  17. +70 −0 osCommerce/OM/Custom/Site/Website/languages/en_US/Services.php
  18. +6 −0 public/external/momentjs/moment.min.js
View
60 osCommerce/OM/Custom/Site/Website/Application/Services/Action/Dashboard.php
@@ -0,0 +1,60 @@
+<?php
+/**
+ * osCommerce Website
+ *
+ * @copyright Copyright (c) 2013 osCommerce; http://www.oscommerce.com
+ * @license BSD License; http://www.oscommerce.com/bsdlicense.txt
+ */
+
+ namespace osCommerce\OM\Core\Site\Website\Application\Services\Action;
+
+ use osCommerce\OM\Core\ApplicationAbstract;
+ use osCommerce\OM\Core\OSCOM;
+ use osCommerce\OM\Core\Registry;
+ use osCommerce\OM\Core\Session;
+
+ use osCommerce\OM\Core\Site\Website\Invision;
+ use osCommerce\OM\Core\Site\Website\Partner;
+
+ class Dashboard {
+ public static function execute(ApplicationAbstract $application) {
+ $OSCOM_Template = Registry::get('Template');
+
+ define('SERVICE_SESSION_FORCE_COOKIE_USAGE', 1);
+ Registry::set('Session', Session::load());
+
+ $OSCOM_Session = Registry::get('Session');
+ $OSCOM_Session->start();
+
+ Registry::get('MessageStack')->loadFromSession();
+
+ if ( !isset($_SESSION[OSCOM::getSite()]['Services']) ) {
+ if ( isset($_COOKIE['member_id']) && is_numeric($_COOKIE['member_id']) && ($_COOKIE['member_id'] > 0) && isset($_COOKIE['pass_hash']) && (strlen($_COOKIE['pass_hash']) == 32) ) {
+ $OSCOM_Invision = new Invision();
+
+ if ( $OSCOM_Invision->autoLogin($_COOKIE['member_id'], $_COOKIE['pass_hash']) ) {
+ if ( $OSCOM_Invision->hasAccess() ) {
+ $_SESSION[OSCOM::getSite()]['Services'] = array('id' => $OSCOM_Invision->getUserData('id'),
+ 'name' => $OSCOM_Invision->getUserData('name'));
+ }
+ }
+ }
+ }
+
+ if ( !isset($_SESSION[OSCOM::getSite()]['Services']) ) {
+ OSCOM::redirect(OSCOM::getLink(null, 'Services', 'Login'));
+ }
+
+ if ( Partner::hasCampaign($_SESSION[OSCOM::getSite()]['Services']['id']) ) {
+ $OSCOM_Template->setValue('partner_campaigns', Partner::getCampaigns($_SESSION[OSCOM::getSite()]['Services']['id']));
+ $OSCOM_Template->setValue('partner_date_now', date('Y-m-d H:i:s'));
+
+ $application->setPageContent('dashboard.html');
+ } else {
+ $application->setPageContent('dashboard_empty.html');
+ }
+
+ $application->setPageTitle(OSCOM::getDef('dashboard_html_title'));
+ }
+ }
+?>
View
32 osCommerce/OM/Custom/Site/Website/Application/Services/Action/Dashboard/Edit.php
@@ -0,0 +1,32 @@
+<?php
+/**
+ * osCommerce Website
+ *
+ * @copyright Copyright (c) 2013 osCommerce; http://www.oscommerce.com
+ * @license BSD License; http://www.oscommerce.com/bsdlicense.txt
+ */
+
+ namespace osCommerce\OM\Core\Site\Website\Application\Services\Action\Dashboard;
+
+ use osCommerce\OM\Core\ApplicationAbstract;
+ use osCommerce\OM\Core\OSCOM;
+ use osCommerce\OM\Core\Registry;
+
+ use osCommerce\OM\Core\Site\Website\Partner;
+
+ class Edit {
+ public static function execute(ApplicationAbstract $application) {
+ $OSCOM_Template = Registry::get('Template');
+
+ if ( empty($_GET['Edit']) || !Partner::hasCampaign($_SESSION[OSCOM::getSite()]['Services']['id'], $_GET['Edit']) ) {
+ Registry::get('MessageStack')->add('services', OSCOM::getDef('dashboard_error_campaign_not_available'), 'error');
+
+ OSCOM::redirect(OSCOM::getLink(null, 'Services', 'Dashboard'));
+ }
+
+ $OSCOM_Template->setValue('partner_campaign', Partner::getCampaign($_SESSION[OSCOM::getSite()]['Services']['id'], $_GET['Edit']));
+
+ $application->setPageContent('dashboard_edit.html');
+ }
+ }
+?>
View
325 osCommerce/OM/Custom/Site/Website/Application/Services/Action/Dashboard/Edit/Process.php
@@ -0,0 +1,325 @@
+<?php
+/**
+ * osCommerce Website
+ *
+ * @copyright Copyright (c) 2013 osCommerce; http://www.oscommerce.com
+ * @license BSD License; http://www.oscommerce.com/bsdlicense.txt
+ */
+
+ namespace osCommerce\OM\Core\Site\Website\Application\Services\Action\Dashboard\Edit;
+
+ use osCommerce\OM\Core\ApplicationAbstract;
+ use osCommerce\OM\Core\OSCOM;
+ use osCommerce\OM\Core\Registry;
+ use osCommerce\OM\Core\Upload;
+
+ use osCommerce\OM\Core\Site\Website\Partner;
+
+ class Process {
+ public static function execute(ApplicationAbstract $application) {
+ $OSCOM_MessageStack = Registry::get('MessageStack');
+ $OSCOM_Template = Registry::get('Template');
+
+ $partner = $OSCOM_Template->getValue('partner_campaign');
+
+ $data = array();
+ $error = false;
+
+ if ( !isset($_POST['desc_short']) || empty($_POST['desc_short']) ) {
+ $error = true;
+
+ $OSCOM_MessageStack->add('services', OSCOM::getDef('dashboard_error_desc_short_empty'));
+ } else {
+ $desc_short = trim(str_replace(array("\r\n", "\n", "\r"), '', $_POST['desc_short']));
+
+ if ( strlen($desc_short) > 450 ) {
+ $error = true;
+
+ $OSCOM_MessageStack->add('services', OSCOM::getDef('dashboard_error_desc_short_length'));
+ } else {
+ $data['desc_short'] = $desc_short;
+ }
+ }
+
+ if ( !isset($_POST['desc_long']) || empty($_POST['desc_long']) ) {
+ $error = true;
+
+ $OSCOM_MessageStack->add('services', OSCOM::getDef('dashboard_error_desc_long_empty'));
+ } else {
+ $desc_long = trim($_POST['desc_long']);
+
+ $data['desc_long'] = $desc_long;
+ }
+
+ if ( isset($_POST['address']) ) {
+ $address = trim($_POST['address']);
+
+ if ( strlen($address) > 255 ) {
+ $error = true;
+
+ $OSCOM_MessageStack->add('services', OSCOM::getDef('dashboard_error_address_length'));
+ } else {
+ $data['address'] = !empty($address) ? $address : null;
+ }
+ }
+
+ if ( isset($_POST['telephone']) ) {
+ $telephone = trim(str_replace(array("\r\n", "\n", "\r"), '', $_POST['telephone']));
+
+ if ( strlen($telephone) > 255 ) {
+ $error = true;
+
+ $OSCOM_MessageStack->add('services', OSCOM::getDef('dashboard_error_telephone_length'));
+ } else {
+ $data['telephone'] = !empty($telephone) ? $telephone : null;
+ }
+ }
+
+ if ( isset($_POST['email']) ) {
+ $email = trim(str_replace(array("\r\n", "\n", "\r"), '', $_POST['email']));
+
+ if ( !empty($email) && (filter_var($email, FILTER_VALIDATE_EMAIL) === false) || (strlen($email) > 255) ) {
+ $error = true;
+
+ $OSCOM_MessageStack->add('services', OSCOM::getDef('dashboard_error_email_length'));
+ } else {
+ $data['email'] = !empty($email) ? $email : null;
+ }
+ }
+
+ if ( !isset($_POST['public_url']) || empty($_POST['public_url']) ) {
+ $error = true;
+
+ $OSCOM_MessageStack->add('services', OSCOM::getDef('dashboard_error_public_url_empty'));
+ } else {
+ $public_url = trim(str_replace(array("\r\n", "\n", "\r"), '', $_POST['public_url']));
+
+ if ( strlen($public_url) > 255 ) {
+ $error = true;
+
+ $OSCOM_MessageStack->add('services', OSCOM::getDef('dashboard_error_public_url_length'));
+ } else {
+ $data['public_url'] = $public_url;
+ }
+ }
+
+ if ( !isset($_POST['url']) || empty($_POST['url']) ) {
+ $error = true;
+
+ $OSCOM_MessageStack->add('services', OSCOM::getDef('dashboard_error_url_empty'));
+ } else {
+ $url = trim(str_replace(array("\r\n", "\n", "\r"), '', $_POST['url']));
+
+ if ( strlen($url) > 255 ) {
+ $error = true;
+
+ $OSCOM_MessageStack->add('services', OSCOM::getDef('dashboard_error_url_length'));
+ } else {
+ $data['url'] = $url;
+ }
+ }
+
+ if ( isset($_FILES['image_small']['name']) && !empty($_FILES['image_small']['name']) ) {
+ $Uimage_small = new Upload('image_small', OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'sites/Website/images/partners', null, array('jpg', 'png'), true);
+
+ if ( $Uimage_small->check() ) {
+ $image = getimagesize($_FILES['image_small']['tmp_name']);
+
+ if ( ($image !== false) && ($image[0] == '130') && ($image[1] == '50') ) {
+ $Uimage_small->setFilename($partner['code'] . '.' . $Uimage_small->getExtension());
+ } else {
+ $error = true;
+
+ $OSCOM_MessageStack->add('services', OSCOM::getDef('dashboard_error_image_small_error'));
+ }
+ } else {
+ $error = true;
+
+ $OSCOM_MessageStack->add('services', OSCOM::getDef('dashboard_error_image_small_error'));
+ }
+ }
+
+ if ( $partner['has_gold'] == '1' ) {
+ if ( isset($_FILES['image_big']['name']) && !empty($_FILES['image_big']['name']) ) {
+ $Uimage_big = new Upload('image_big', OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'sites/Website/images/partners', null, array('jpg', 'png'), true);
+
+ if ( $Uimage_big->check() ) {
+ $image = getimagesize($_FILES['image_big']['tmp_name']);
+
+ if ( ($image !== false) && ($image[0] == '940') && ($image[1] == '285') ) {
+ $Uimage_big->setFilename($partner['code'] . '_header.' . $Uimage_big->getExtension());
+ } else {
+ $error = true;
+
+ $OSCOM_MessageStack->add('services', OSCOM::getDef('dashboard_error_image_big_error'));
+ }
+ } else {
+ $error = true;
+
+ $OSCOM_MessageStack->add('services', OSCOM::getDef('dashboard_error_image_big_error'));
+ }
+ }
+
+ if ( isset($_FILES['image_promo']['name']) && !empty($_FILES['image_promo']['name']) ) {
+ $Uimage_promo = new Upload('image_promo', OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'sites/Website/images/partners', null, array('gif', 'jpg', 'png'), true);
+
+ if ( $Uimage_promo->check() ) {
+ $image = getimagesize($_FILES['image_promo']['tmp_name']);
+
+ if ( ($image !== false) && ($image[0] == '150') && ($image[1] == '100') ) {
+ $Uimage_promo->setFilename($partner['code'] . '_promo.' . $Uimage_promo->getExtension());
+ } else {
+ $error = true;
+
+ $OSCOM_MessageStack->add('services', OSCOM::getDef('dashboard_error_image_promo_error'));
+ }
+ } else {
+ $error = true;
+
+ $OSCOM_MessageStack->add('services', OSCOM::getDef('dashboard_error_image_promo_error'));
+ }
+ }
+
+ if ( isset($_POST['image_promo_url']) ) {
+ $image_promo_url = trim(str_replace(array("\r\n", "\n", "\r"), '', $_POST['image_promo_url']));
+
+ if ( strlen($image_promo_url) > 255 ) {
+ $error = true;
+
+ $OSCOM_MessageStack->add('services', OSCOM::getDef('dashboard_error_image_promo_url_length'));
+ } else {
+ $data['image_promo_url'] = !empty($image_promo_url) ? $image_promo_url : null;
+ }
+ }
+
+ if ( isset($_FILES['banner_image_en']['name']) && !empty($_FILES['banner_image_en']['name']) ) {
+ $Ubanner_image_en = new Upload('banner_image_en', OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'sites/Website/images/partners', null, array('gif', 'jpg', 'png'), true);
+
+ if ( $Ubanner_image_en->check() ) {
+ $image = getimagesize($_FILES['banner_image_en']['tmp_name']);
+
+ if ( ($image !== false) && ($image[0] == '468') && ($image[1] == '60') ) {
+ $Ubanner_image_en->setFilename($partner['code'] . '_banner.' . $Ubanner_image_en->getExtension());
+ } else {
+ $error = true;
+
+ $OSCOM_MessageStack->add('services', OSCOM::getDef('dashboard_error_banner_image_en_error'));
+ }
+ } else {
+ $error = true;
+
+ $OSCOM_MessageStack->add('services', OSCOM::getDef('dashboard_error_banner_image_en_error'));
+ }
+ }
+
+ if ( isset($_POST['banner_url_en']) ) {
+ $banner_url_en = trim(str_replace(array("\r\n", "\n", "\r"), '', $_POST['banner_url_en']));
+
+ if ( strlen($banner_url_en) > 255 ) {
+ $error = true;
+
+ $OSCOM_MessageStack->add('services', OSCOM::getDef('dashboard_error_banner_url_en_length'));
+ } else {
+ $data['banner_url_en'] = !empty($banner_url_en) ? $banner_url_en : null;
+ }
+ }
+
+ if ( isset($_POST['twitter_en']) ) {
+ $twitter_en = trim(str_replace(array("\r\n", "\n", "\r"), '', $_POST['twitter_en']));
+
+ if ( strlen($twitter_en) > 255 ) {
+ $error = true;
+
+ $OSCOM_MessageStack->add('services', OSCOM::getDef('dashboard_error_twitter_en_length'));
+ } else {
+ $data['twitter_en'] = !empty($twitter_en) ? $twitter_en : null;
+ }
+ }
+
+ if ( isset($_FILES['banner_image_de']['name']) && !empty($_FILES['banner_image_de']['name']) ) {
+ $Ubanner_image_de = new Upload('banner_image_de', OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'sites/Website/images/partners', null, array('gif', 'jpg', 'png'), true);
+
+ if ( $Ubanner_image_de->check() ) {
+ $image = getimagesize($_FILES['banner_image_de']['tmp_name']);
+
+ if ( ($image !== false) && ($image[0] == '468') && ($image[1] == '60') ) {
+ $Ubanner_image_de->setFilename($partner['code'] . '_banner-de.' . $Ubanner_image_de->getExtension());
+ } else {
+ $error = true;
+
+ $OSCOM_MessageStack->add('services', OSCOM::getDef('dashboard_error_banner_image_de_error'));
+ }
+ } else {
+ $error = true;
+
+ $OSCOM_MessageStack->add('services', OSCOM::getDef('dashboard_error_banner_image_de_error'));
+ }
+ }
+
+ if ( isset($_POST['banner_url_de']) ) {
+ $banner_url_de = trim(str_replace(array("\r\n", "\n", "\r"), '', $_POST['banner_url_de']));
+
+ if ( strlen($banner_url_de) > 255 ) {
+ $error = true;
+
+ $OSCOM_MessageStack->add('services', OSCOM::getDef('dashboard_error_banner_url_de_length'));
+ } else {
+ $data['banner_url_de'] = !empty($banner_url_de) ? $banner_url_de : null;
+ }
+ }
+
+ if ( isset($_POST['twitter_de']) ) {
+ $twitter_de = trim(str_replace(array("\r\n", "\n", "\r"), '', $_POST['twitter_de']));
+
+ if ( strlen($twitter_de) > 255 ) {
+ $error = true;
+
+ $OSCOM_MessageStack->add('services', OSCOM::getDef('dashboard_error_twitter_de_length'));
+ } else {
+ $data['twitter_de'] = !empty($twitter_de) ? $twitter_de : null;
+ }
+ }
+ }
+
+ if ( $error === false ) {
+ if ( isset($_FILES['image_small']['name']) && !empty($_FILES['image_small']['name']) ) {
+ $Uimage_small->save();
+
+ $data['image_small'] = $Uimage_small->getFilename();
+ }
+
+ if ( $partner['has_gold'] == '1' ) {
+ if ( isset($_FILES['image_big']['name']) && !empty($_FILES['image_big']['name']) ) {
+ $Uimage_big->save();
+
+ $data['image_big'] = $Uimage_big->getFilename();
+ }
+
+ if ( isset($_FILES['image_promo']['name']) && !empty($_FILES['image_promo']['name']) ) {
+ $Uimage_promo->save();
+
+ $data['image_promo'] = $Uimage_promo->getFilename();
+ }
+
+ if ( isset($_FILES['banner_image_en']['name']) && !empty($_FILES['banner_image_en']['name']) ) {
+ $Ubanner_image_en->save();
+
+ $data['banner_image_en'] = $Ubanner_image_en->getFilename();
+ }
+
+ if ( isset($_FILES['banner_image_de']['name']) && !empty($_FILES['banner_image_de']['name']) ) {
+ $Ubanner_image_de->save();
+
+ $data['banner_image_de'] = $Ubanner_image_de->getFilename();
+ }
+ }
+
+ Partner::save($_SESSION[OSCOM::getSite()]['Services']['id'], $partner['code'], $data);
+
+ $OSCOM_MessageStack->add('services', OSCOM::getDef('dashboard_success_save', array(':partner_link' => OSCOM::getLink(null, 'Services', $partner['category_code'] . '&' . $partner['code']))), 'success');
+
+ OSCOM::redirect(OSCOM::getLink(null, 'Services', 'Dashboard&Edit=' . $partner['code']));
+ }
+ }
+ }
+?>
View
30 osCommerce/OM/Custom/Site/Website/Application/Services/Action/Login.php
@@ -0,0 +1,30 @@
+<?php
+/**
+ * osCommerce Website
+ *
+ * @copyright Copyright (c) 2013 osCommerce; http://www.oscommerce.com
+ * @license BSD License; http://www.oscommerce.com/bsdlicense.txt
+ */
+
+ namespace osCommerce\OM\Core\Site\Website\Application\Services\Action;
+
+ use osCommerce\OM\Core\ApplicationAbstract;
+ use osCommerce\OM\Core\OSCOM;
+ use osCommerce\OM\Core\Registry;
+ use osCommerce\OM\Core\Session;
+
+ class Login {
+ public static function execute(ApplicationAbstract $application) {
+ define('SERVICE_SESSION_FORCE_COOKIE_USAGE', 1);
+ Registry::set('Session', Session::load());
+
+ $OSCOM_Session = Registry::get('Session');
+ $OSCOM_Session->start();
+
+ Registry::get('MessageStack')->loadFromSession();
+
+ $application->setPageContent('login.html');
+ $application->setPageTitle(OSCOM::getDef('dashboard_html_title'));
+ }
+ }
+?>
View
34 osCommerce/OM/Custom/Site/Website/Application/Services/Action/Login/Process.php
@@ -0,0 +1,34 @@
+<?php
+/**
+ * osCommerce Website
+ *
+ * @copyright Copyright (c) 2013 osCommerce; http://www.oscommerce.com
+ * @license BSD License; http://www.oscommerce.com/bsdlicense.txt
+ */
+
+ namespace osCommerce\OM\Core\Site\Website\Application\Services\Action\Login;
+
+ use osCommerce\OM\Core\ApplicationAbstract;
+ use osCommerce\OM\Core\OSCOM;
+ use osCommerce\OM\Core\Registry;
+
+ use osCommerce\OM\Core\Site\Website\Invision;
+
+ class Process {
+ public static function execute(ApplicationAbstract $application) {
+ if ( isset($_POST['username']) && !empty($_POST['username']) && isset($_POST['password']) && !empty($_POST['password']) ) {
+ $OSCOM_Invision = new Invision($_POST['username'], $_POST['password']);
+ $OSCOM_Invision->perform();
+
+ if ( $OSCOM_Invision->hasAccess() ) {
+ $_SESSION[OSCOM::getSite()]['Services'] = array('id' => $OSCOM_Invision->getUserData('id'),
+ 'name' => $OSCOM_Invision->getUserData('name'));
+
+ OSCOM::redirect(OSCOM::getLink(null, 'Services', 'Dashboard'));
+ } else {
+ Registry::get('MessageStack')->add('services', $OSCOM_Invision->getNoAccessReason(), 'error');
+ }
+ }
+ }
+ }
+?>
View
47 osCommerce/OM/Custom/Site/Website/Application/Services/pages/dashboard.html
@@ -0,0 +1,47 @@
+<script src="public/external/momentjs/moment.min.js"></script>
+
+<div id="highlights">
+ <img src="{publiclink}{raw}highlights_image{raw}{publiclink}" width="940" height="285" />
+</div>
+
+<div class="row">
+ <div id="maincontainer" class="span9">
+ <div id="maincontent">
+ <h1>{lang}dashboard_title{lang}</h1>
+
+ {widget}message_stack|services{widget}
+
+ <p>{lang}dashboard_introduction{lang}</p>
+
+{loop partner_campaigns}
+ <div id="partnerc_#code#">
+ <p class="pcdate label pull-right">%date_end%</p>
+ <p><a href="{link}Services|Website|Dashboard&Edit=%code%{link}">#title#</a> <small>(in %category_title%)</small><br /><span class="pcdays muted"></span></p>
+ </div>
+{loop}
+
+<script>
+var partner_date_now = moment('{value}partner_date_now{value}');
+
+$('[id^=partnerc_]').each(function() {
+ var runsUntil = moment($('.pcdate', this).text());
+
+ $('.pcdate', this).text(runsUntil.format('Do MMM, YYYY'));
+
+ if ( runsUntil.isBefore(partner_date_now) ) {
+ $('.pcdate', this).addClass('label-important');
+
+ $('.pcdays', this).html('<small>(' + partner_date_now.diff(runsUntil, 'days') + ' days ago)</small>');
+ } else {
+ $('.pcdate', this).addClass('label-success');
+
+ $('.pcdays', this).html('<small>(' + runsUntil.diff(partner_date_now, 'days') + ' days remaining)</small>');
+ }
+});
+</script>
+
+ </div>
+ </div>
+
+ {widget}services_sidebar_nav{widget}
+</div>
View
220 osCommerce/OM/Custom/Site/Website/Application/Services/pages/dashboard_edit.html
@@ -0,0 +1,220 @@
+<div id="highlights">
+ <img src="{publiclink}{raw}highlights_image{raw}{publiclink}" width="940" height="285" />
+</div>
+
+<div class="row">
+ <div id="maincontainer" class="span12">
+ <div id="maincontent">
+ <h1>{lang}dashboard_title{lang}</h1>
+
+ {widget}message_stack|services{widget}
+
+ <h3>{value}partner_campaign title{value} <small>(in {value}partner_campaign category_title{value})</small></h3>
+
+ <form action="{link}Services|Website|Dashboard&Edit={raw}partner_campaign code{raw}&Process{link}" method="post" enctype="multipart/form-data" class="form-horizontal">
+ <fieldset>
+ <legend>{lang}dashboard_partner_information_page{lang} <small class="pull-right text-error">{lang}dashboard_required_fields{lang}</small></legend>
+
+ <div class="control-group">
+ <label class="control-label" for="inputDescShort"><strong>{lang}dashboard_field_desc_short_title{lang}</strong> <span class="text-error">*</span></label>
+
+ <div class="controls">
+ <textarea id="inputDescShort" name="desc_short" rows="6" maxlength="450" class="span8">{post}desc_short|partner_campaign desc_short{post}</textarea>
+ <span class="help-block"><small>{lang}dashboard_field_desc_short_desc{lang}</small></span>
+ </div>
+ </div>
+
+ <div class="control-group">
+ <label class="control-label" for="inputDescLong"><strong>{lang}dashboard_field_desc_long_title{lang}</strong> <span class="text-error">*</span></label>
+
+ <div class="controls">
+ <textarea id="inputDescLong" name="desc_long" rows="15" class="span8">{post}desc_long|partner_campaign desc_long{post}</textarea>
+ <span class="help-block"><small>{lang}dashboard_field_desc_long_desc{lang}</small></span>
+ </div>
+ </div>
+
+ <div class="control-group">
+ <label class="control-label" for="inputAddress"><strong>{lang}dashboard_field_address_title{lang}</strong></label>
+
+ <div class="controls">
+ <textarea id="inputAddress" name="address" rows="5" maxlength="255" class="span8">{post}address|partner_campaign address{post}</textarea>
+ <span class="help-block"><small>{lang}dashboard_field_address_desc{lang}</small></span>
+ </div>
+ </div>
+
+ <div class="control-group">
+ <label class="control-label" for="inputTelephone"><strong>{lang}dashboard_field_telephone_title{lang}</strong></label>
+
+ <div class="controls">
+ <input type="text" id="inputTelephone" name="telephone" value="{post}telephone|partner_campaign telephone{post}" class="span8" />
+ </div>
+ </div>
+
+ <div class="control-group">
+ <label class="control-label" for="inputEmail"><strong>{lang}dashboard_field_email_title{lang}</strong></label>
+
+ <div class="controls">
+ <input type="text" id="inputEmail" name="email" value="{post}email|partner_campaign email{post}" class="span8" />
+ </div>
+ </div>
+
+ <div class="control-group">
+ <label class="control-label" for="inputPublicUrl"><strong>{lang}dashboard_field_public_url_title{lang}</strong> <span class="text-error">*</span></label>
+
+ <div class="controls">
+ <input type="text" id="inputPublicUrl" name="public_url" value="{post}public_url|partner_campaign public_url{post}" class="span8" />
+ <span class="help-block"><small>{lang}dashboard_field_public_url_desc{lang}</small></span>
+ </div>
+ </div>
+
+ <div class="control-group">
+ <label class="control-label" for="inputUrl"><strong>{lang}dashboard_field_url_title{lang}</strong> <span class="text-error">*</span></label>
+
+ <div class="controls">
+ <input type="text" id="inputUrl" name="url" value="{post}url|partner_campaign url{post}" class="span8" />
+ <span class="help-block"><small>{lang}dashboard_field_url_desc{lang}</small></span>
+ </div>
+ </div>
+
+ <div class="control-group">
+ <label class="control-label" for="inputImageSmall"><strong>{lang}dashboard_field_image_small_title{lang}</strong></label>
+
+ <div class="controls">
+ <input type="file" id="inputImageSmall" name="image_small" class="span6" />
+
+ {ifvalue partner_campaign image_small}
+ <span class="span2 pull-right"><a href="{publiclink}images/partners/{raw}partner_campaign image_small{raw}{publiclink}" target="_blank"><small>{lang}dashboard_view_current_image{lang}</small></a></span>
+ {ifvalue}
+
+ <span class="help-block"><small>{lang}dashboard_field_image_small_desc{lang}</small></span>
+ </div>
+ </div>
+
+ <div class="partner_gold">
+ <div class="control-group">
+ <label class="control-label" for="inputImageBig"><strong>{lang}dashboard_field_image_big_title{lang}</strong></label>
+
+ <div class="controls">
+ <input type="file" id="inputImageBig" name="image_big" class="span6" />
+
+ {ifvalue partner_campaign image_big}
+ <span class="span2 pull-right"><a href="{publiclink}images/partners/{raw}partner_campaign image_big{raw}{publiclink}" target="_blank"><small>{lang}dashboard_view_current_image{lang}</small></a></span>
+ {ifvalue}
+
+ <span class="help-block"><small>{lang}dashboard_field_image_big_desc{lang}</small></span>
+ </div>
+ </div>
+ </div>
+ </fieldset>
+
+ <div class="partner_gold">
+ <fieldset>
+ <legend>{lang}dashboard_promotion_banner{lang}</legend>
+
+ <div class="control-group">
+ <label class="control-label" for="inputImagePromo"><strong>{lang}dashboard_field_image_promo_title{lang}</strong></label>
+
+ <div class="controls">
+ <input type="file" id="inputImagePromo" name="image_promo" class="span6" />
+
+ {ifvalue partner_campaign image_promo}
+ <span class="span2 pull-right"><a href="{publiclink}images/partners/{raw}partner_campaign image_promo{raw}{publiclink}" target="_blank"><small>{lang}dashboard_view_current_image{lang}</small></a></span>
+ {ifvalue}
+
+ <span class="help-block"><small>{lang}dashboard_field_image_promo_desc{lang}</small></span>
+ </div>
+ </div>
+
+ <div class="control-group">
+ <label class="control-label" for="inputPromoUrl"><strong>{lang}dashboard_field_image_promo_url_title{lang}</strong></label>
+
+ <div class="controls">
+ <input type="text" id="inputPromoUrl" name="image_promo_url" value="{post}image_promo_url|partner_campaign image_promo_url{post}" class="span8" />
+ </div>
+ </div>
+ </fieldset>
+
+ <fieldset>
+ <legend>{lang}dashboard_banner_english{lang}</legend>
+
+ <div class="control-group">
+ <label class="control-label" for="inputBannerImageEn"><strong>{lang}dashboard_field_banner_image_en_title{lang}</strong></label>
+
+ <div class="controls">
+ <input type="file" id="inputBannerImageEn" name="banner_image_en" class="span6" />
+
+ {ifvalue partner_campaign banner_image_en}
+ <span class="span2 pull-right"><a href="{publiclink}images/partners/{raw}partner_campaign banner_image_en{raw}{publiclink}" target="_blank"><small>{lang}dashboard_view_current_image{lang}</small></a></span>
+ {ifvalue}
+
+ <span class="help-block"><small>{lang}dashboard_field_banner_image_en_desc{lang}</small></span>
+ </div>
+ </div>
+
+ <div class="control-group">
+ <label class="control-label" for="inputBannerUrlEn"><strong>{lang}dashboard_field_banner_url_en_title{lang}</strong></label>
+
+ <div class="controls">
+ <input type="text" id="inputBannerUrlEn" name="banner_url_en" value="{post}banner_url_en|partner_campaign banner_url_en{post}" class="span8" />
+ </div>
+ </div>
+
+ <div class="control-group">
+ <label class="control-label" for="inputTwitterEn"><strong>{lang}dashboard_field_twitter_en_title{lang}</strong></label>
+
+ <div class="controls">
+ <input type="text" id="inputTwitterEn" name="twitter_en" value="{post}twitter_en|partner_campaign twitter_en{post}" class="span8" />
+ </div>
+ </div>
+ </fieldset>
+
+ <fieldset>
+ <legend>{lang}dashboard_banner_german{lang}</legend>
+
+ <div class="control-group">
+ <label class="control-label" for="inputBannerImageDe"><strong>{lang}dashboard_field_banner_image_de_title{lang}</strong></label>
+
+ <div class="controls">
+ <input type="file" id="inputBannerImageDe" name="banner_image_de" class="span6" />
+
+ {ifvalue partner_campaign banner_image_de}
+ <span class="span2 pull-right"><a href="{publiclink}images/partners/{raw}partner_campaign banner_image_de{raw}{publiclink}" target="_blank"><small>{lang}dashboard_view_current_image{lang}</small></a></span>
+ {ifvalue}
+
+ <span class="help-block"><small>{lang}dashboard_field_banner_image_de_desc{lang}</small></span>
+ </div>
+ </div>
+
+ <div class="control-group">
+ <label class="control-label" for="inputBannerUrlDe"><strong>{lang}dashboard_field_banner_url_de_title{lang}</strong></label>
+
+ <div class="controls">
+ <input type="text" id="inputBannerUrlDe" name="banner_url_de" value="{post}banner_url_de|partner_campaign banner_url_de{post}" class="span8" />
+ </div>
+ </div>
+
+ <div class="control-group">
+ <label class="control-label" for="inputTwitterDe"><strong>{lang}dashboard_field_twitter_de_title{lang}</strong></label>
+
+ <div class="controls">
+ <input type="text" id="inputTwitterDe" name="twitter_de" value="{post}twitter_de|partner_campaign twitter_de{post}" class="span8" />
+ </div>
+ </div>
+ </fieldset>
+ </div>
+
+ <div class="control-group">
+ <div class="controls">
+ <button type="submit" class="btn btn-success">{lang}dashboard_button_save{lang}</button> <a href="{link}Services|Website|Dashboard{link}" class="btn btn-link">{lang}dashboard_button_cancel{lang}</a>
+ </div>
+ </div>
+ </form>
+ </div>
+ </div>
+</div>
+
+<script>
+if ( {value}partner_campaign has_gold{value} != 1 ) {
+ $('.partner_gold').remove();
+}
+</script>
View
15 osCommerce/OM/Custom/Site/Website/Application/Services/pages/dashboard_empty.html
@@ -0,0 +1,15 @@
+<div id="highlights">
+ <img src="{publiclink}{raw}highlights_image{raw}{publiclink}" width="940" height="285" />
+</div>
+
+<div class="row">
+ <div id="maincontainer" class="span9">
+ <div id="maincontent">
+ <h1>{lang}dashboard_title{lang}</h1>
+
+ <p>{lang}dashboard_empty{lang}</p>
+ </div>
+ </div>
+
+ {widget}services_sidebar_nav{widget}
+</div>
View
44 osCommerce/OM/Custom/Site/Website/Application/Services/pages/login.html
@@ -0,0 +1,44 @@
+<div id="highlights">
+ <img src="{publiclink}{raw}highlights_image{raw}{publiclink}" width="940" height="285" />
+</div>
+
+<div class="row">
+ <div id="maincontainer" class="span9">
+ <div id="maincontent">
+ <h1>{lang}dashboard_title{lang}</h1>
+
+ {widget}message_stack|services{widget}
+
+ {lang}login_introduction{lang}
+
+ <form action="{link}Services|Website|Login&Process{link}" method="post" class="form-horizontal">
+ <div class="control-group">
+ <label class="control-label" for="inputUsername">{lang}login_username_title{lang}</label>
+
+ <div class="controls">
+ <input type="text" id="inputUsername" name="username" value="{post}username{post}" />
+ </div>
+ </div>
+
+ <div class="control-group">
+ <label class="control-label" for="inputPassword">{lang}login_password_title{lang}</label>
+
+ <div class="controls">
+ <input type="password" id="inputPassword" name="password" />
+ <span class="help-block"><small><a href="http://forums.oscommerce.com/index.php?app=core&amp;module=global&amp;section=lostpass" class="muted">{lang}login_password_forgotten_title{lang}</a></small></span>
+ </div>
+ </div>
+
+ <div class="control-group">
+ <div class="controls">
+ <button type="submit" class="btn">{lang}login_button_sign_in{lang}</button>
+ </div>
+ </div>
+ </form>
+
+ <p><small>{lang}login_create_account_text{lang}</small></p>
+ </div>
+ </div>
+
+ {widget}services_sidebar_nav{widget}
+</div>
View
2  osCommerce/OM/Custom/Site/Website/Application/Services/pages/main.html
@@ -20,6 +20,8 @@
{loop}
</div>
+
+ <div class="pull-right"><small><a href="{link}Services|Website|Dashboard{link}">{lang}dashboard_link_title{lang}</a></small></div>
</div>
</div>
View
206 osCommerce/OM/Custom/Site/Website/Invision.php
@@ -0,0 +1,206 @@
+<?php
+/**
+ * osCommerce Website
+ *
+ * @copyright Copyright (c) 2013 osCommerce; http://www.oscommerce.com
+ * @license BSD License; http://www.oscommerce.com/bsdlicense.txt
+ */
+
+ namespace osCommerce\OM\Core\Site\Website;
+
+ use osCommerce\OM\Core\OSCOM;
+
+ class Invision {
+ protected $_login_key;
+ protected $_login_password;
+ protected $_user_data;
+ protected $_user_ip_address;
+ protected $_login_success = false;
+ protected $_has_access = false;
+ protected $_has_no_access_reason = '';
+
+ public function __construct($key = null, $password = null) {
+ $this->_login_key = $key;
+ $this->_login_password = !empty($password) ? md5($password) : null;
+
+ $this->setIPAddress();
+ }
+
+ public function autoLogin($key, $hash) {
+ if ( !empty($key) && !empty($hash) ) {
+ $request = xmlrpc_encode_request('canAutoLogin', array('api_key' => OSCOM::getConfig('community_api_key'),
+ 'api_module' => 'oscommerce',
+ 'member_id' => $key,
+ 'pass_hash' => $hash));
+
+ $response = xmlrpc_decode($this->getResponse($request));
+
+ if ( is_array($response) && !empty($response) && isset($response['result']) && ($response['result'] === true) && isset($response['member'][0]['member_id']) && ($response['member'][0]['member_id'] > 0) && ($response['member'][0]['member_id'] == $key) ) {
+ $user_data = array('id' => (int)$response['member'][0]['member_id'],
+ 'group_id' => (int)$response['member'][0]['member_group_id'],
+ 'email' => $response['member'][0]['email'],
+ 'name' => $response['member'][0]['members_display_name'],
+ 'restrict_post' => $response['member'][0]['restrict_post'],
+ 'mod_posts' => $response['member'][0]['mod_posts'],
+ 'temp_ban' => $response['member'][0]['temp_ban']);
+
+ $this->_user_data = $user_data;
+
+ $this->_login_success = true;
+ }
+ }
+
+ return $this->_login_success;
+ }
+
+ public function perform() {
+ if ( empty($this->_login_key) || empty($this->_login_password) ) {
+ $this->_has_no_access_reason = 'All fields are required.';
+ } else {
+ $request = xmlrpc_encode_request('verifyMember', array('api_key' => OSCOM::getConfig('community_api_key'),
+ 'api_module' => 'oscommerce',
+ 'username' => $this->_login_key,
+ 'password' => $this->_login_password));
+
+ $response = xmlrpc_decode($this->getResponse($request));
+
+ if ( is_array($response) && !empty($response) && isset($response['result']) && ($response['result'] === true) && isset($response['member'][0]['member_id']) && ($response['member'][0]['member_id'] > 0) ) {
+ $user_data = array('id' => (int)$response['member'][0]['member_id'],
+ 'group_id' => (int)$response['member'][0]['member_group_id'],
+ 'email' => $response['member'][0]['email'],
+ 'name' => $response['member'][0]['members_display_name'],
+ 'restrict_post' => $response['member'][0]['restrict_post'],
+ 'mod_posts' => $response['member'][0]['mod_posts'],
+ 'temp_ban' => $response['member'][0]['temp_ban']);
+
+ $this->_user_data = $user_data;
+
+ $this->_login_success = true;
+ } else {
+ $this->_has_no_access_reason = 'Username or password are incorrect.';
+ }
+ }
+
+ return $this->_login_success;
+ }
+
+ public function hasAccess() {
+ if ( ($this->_login_success === true) && !empty($this->_user_data) ) {
+ if ( in_array($this->_user_data['group_id'], array(1, 2, 5)) ) {
+ $this->_has_no_access_reason = 'User account not validated or is currently suspended.';
+ } elseif ( !empty($this->_user_data['restrict_post']) && ($this->_user_data['restrict_post'] != '0') ) {
+ $this->_has_no_access_reason = 'User account currently has restricted posting abilities.';
+ } elseif ( !empty($this->_user_data['mod_posts']) && ($this->_user_data['mod_posts'] != '0') ) {
+ $this->_has_no_access_reason = 'User account currently has review posting abilities.';
+ } elseif ( !empty($this->_user_data['temp_ban']) && ($this->_user_data['temp_ban'] != '0') ) {
+ $this->_has_no_access_reason = 'User account is temporarily suspended.';
+ } else {
+ $this->_has_access = true;
+ }
+ }
+
+ return $this->_has_access;
+ }
+
+ public function logOut() {
+ setcookie('member_id', '-1', time() - 60*60*24*365, '/', '.oscommerce.com');
+ setcookie('pass_hash', '-1', time() - 60*60*24*365, '/', '.oscommerce.com');
+
+ $this->_has_access = false;
+ $this->_has_no_access_reason = 'User has logged out.';
+ $this->_login_success = false;
+ $this->_user_data = null;
+ }
+
+ protected function setIPAddress() {
+ $ip_address = false;
+ $addrs = array();
+
+ if ( isset($_SERVER['HTTP_X_FORWARDED_FOR']) ) {
+ foreach ( array_reverse(explode(',' , $_SERVER['HTTP_X_FORWARDED_FOR'])) as $x_f ) {
+ $x_f = trim($x_f);
+
+ if ( preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $x_f) ) {
+ $addrs[] = $x_f;
+ }
+ }
+ }
+
+ $addrs[] = $_SERVER['REMOTE_ADDR'];
+
+ if ( isset($_SERVER['HTTP_PROXY_USER']) ) {
+ $addrs[] = $_SERVER['HTTP_PROXY_USER'];
+ }
+
+ if ( isset($_SERVER['HTTP_CLIENT_IP']) ) {
+ $addrs[] = $_SERVER['HTTP_CLIENT_IP'];
+ }
+
+ foreach ( $addrs as $ip ) {
+ if ( !empty($ip) ) {
+ $ip_address = preg_replace("/^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/", "\\1.\\2.\\3.\\4", $ip);
+
+ break;
+ }
+ }
+
+ $this->_user_ip_address = $ip_address;
+ }
+
+ public function getUserData($key = null) {
+ if ( isset($key) ) {
+ return $this->_user_data[$key];
+ }
+
+ return $this->_user_data;
+ }
+
+ public function getNoAccessReason() {
+ return $this->_has_no_access_reason;
+ }
+
+ public function getIPAddress() {
+ return $this->_user_ip_address;
+ }
+
+ protected function getResponse($request) {
+ $parameters = array('server' => parse_url(OSCOM::getConfig('community_api_address')),
+ 'parameters' => $request);
+
+ if ( !isset($parameters['server']['port']) ) {
+ $parameters['server']['port'] = ($parameters['server']['scheme'] == 'https') ? 443 : 80;
+ }
+
+ if ( !isset($parameters['server']['path']) ) {
+ $parameters['server']['path'] = '/';
+ }
+
+ $curl = curl_init($parameters['server']['scheme'] . '://' . $parameters['server']['host'] . $parameters['server']['path'] . (isset($parameters['server']['query']) ? '?' . $parameters['server']['query'] : ''));
+
+ $curl_options = array(CURLOPT_PORT => $parameters['server']['port'],
+ CURLOPT_HEADER => false,
+ CURLOPT_HTTPHEADER, array('Content-Type: application/xml; charset=utf-8'),
+ CURLOPT_SSL_VERIFYPEER => true,
+ CURLOPT_SSL_VERIFYHOST => 2,
+ CURLOPT_RETURNTRANSFER => true,
+ CURLOPT_FORBID_REUSE => true,
+ CURLOPT_FRESH_CONNECT => true,
+ CURLOPT_FOLLOWLOCATION => false,
+ CURLOPT_POST => true,
+ CURLOPT_POSTFIELDS => $parameters['parameters']);
+
+ curl_setopt_array($curl, $curl_options);
+ $result = curl_exec($curl);
+
+ if ( $result === false ) {
+ curl_close($curl);
+
+ return false;
+ }
+
+ curl_close($curl);
+
+ return $result;
+ }
+ }
+?>
View
86 osCommerce/OM/Custom/Site/Website/Partner.php
@@ -8,6 +8,7 @@
namespace osCommerce\OM\Core\Site\Website;
+ use osCommerce\OM\Core\Cache;
use osCommerce\OM\Core\OSCOM;
class Partner {
@@ -93,4 +94,89 @@ public static function getPromotions() {
return static::$_promotions;
}
+
+ public static function hasCampaign($id, $code = null) {
+ $data = array('id' => $id);
+
+ if ( isset($code) ) {
+ $data['code'] = $code;
+ }
+
+ return OSCOM::callDB('Website\PartnerHasCampaign', $data, 'Site');
+ }
+
+ public static function getCampaigns($id) {
+ return OSCOM::callDB('Website\PartnerGetCampaigns', array('id' => $id), 'Site');
+ }
+
+ public static function getCampaign($id, $code) {
+ return OSCOM::callDB('Website\PartnerGetCampaign', array('id' => $id, 'code' => $code), 'Site');
+ }
+
+ public static function save($user_id, $code, $partner) {
+ $campaign = static::getCampaign($user_id, $code);
+
+ $data = array('id' => $campaign['id'],
+ 'code' => $code,
+ 'desc_short' => $partner['desc_short'],
+ 'desc_long' => $partner['desc_long'],
+ 'address' => isset($partner['address']) ? $partner['address'] : null,
+ 'telephone' => isset($partner['telephone']) ? $partner['telephone'] : null,
+ 'email' => isset($partner['email']) ? $partner['email'] : null,
+ 'url' => $partner['url'],
+ 'public_url' => $partner['public_url'],
+ 'image_small' => isset($partner['image_small']) ? $partner['image_small'] : null,
+ 'image_big' => (($campaign['has_gold'] == '1') && isset($partner['image_big'])) ? $partner['image_big'] : null,
+ 'image_promo' => null,
+ 'image_promo_url' => null,
+ 'banner_image_en' => null,
+ 'banner_url_en' => null,
+ 'twitter_en' => null,
+ 'banner_image_de' => null,
+ 'banner_url_de' => null,
+ 'twitter_de' => null);
+
+ if ( $campaign['has_gold'] == '1' ) {
+ if ( isset($partner['image_promo_url']) ) {
+ $data['image_promo_url'] = $partner['image_promo_url'];
+
+ if ( isset($partner['image_promo']) ) {
+ $data['image_promo'] = $partner['image_promo'];
+ }
+ }
+
+ if ( isset($partner['banner_url_en']) ) {
+ $data['banner_url_en'] = $partner['banner_url_en'];
+
+ if ( isset($partner['banner_image_en']) ) {
+ $data['banner_image_en'] = $partner['banner_image_en'];
+ }
+
+ if ( isset($partner['twitter_en']) ) {
+ $data['twitter_en'] = $partner['twitter_en'];
+ }
+ }
+
+ if ( isset($partner['banner_url_de']) ) {
+ $data['banner_url_de'] = $partner['banner_url_de'];
+
+ if ( isset($partner['banner_image_de']) ) {
+ $data['banner_image_de'] = $partner['banner_image_de'];
+ }
+
+ if ( isset($partner['twitter_de']) ) {
+ $data['twitter_de'] = $partner['twitter_de'];
+ }
+ }
+ }
+
+ $result = OSCOM::callDB('Website\PartnerSave', $data, 'Site');
+
+ Cache::clear('website_partner-' . $data['code']);
+ Cache::clear('website_partner_promotions');
+ Cache::clear('website_partners');
+
+ return $result;
+ }
}
+?>
View
25 osCommerce/OM/Custom/Site/Website/SQL/ANSI/PartnerGetCampaign.php
@@ -0,0 +1,25 @@
+<?php
+/**
+ * osCommerce Website
+ *
+ * @copyright Copyright (c) 2012 osCommerce; http://www.oscommerce.com
+ * @license BSD License; http://www.oscommerce.com/bsdlicense.txt
+ */
+
+ namespace osCommerce\OM\Core\Site\Website\SQL\ANSI;
+
+ use osCommerce\OM\Core\Registry;
+
+ class PartnerGetCampaign {
+ public static function execute($data) {
+ $OSCOM_PDO = Registry::get('PDO');
+
+ $Qpartner = $OSCOM_PDO->prepare('select p.*, c.code as category_code, c.title as category_title, max(t.date_end) as date_end, t.package_id, if (t.package_id = 3, 1, 0) as has_gold, b1.image as banner_image_en, b1.url as banner_url_en, b1.twitter as twitter_en, b2.image as banner_image_de, b2.url as banner_url_de, b2.twitter as twitter_de from :table_website_partner p left join :table_website_partner_banner b1 on (p.id = b1.partner_id and b1.code = "en") left join :table_website_partner_banner b2 on (p.id = b2.partner_id and b2.code = "de"), :table_website_partner_category c, :table_website_partner_transaction t, :table_website_partner_account a where a.community_account_id = :community_account_id and a.partner_id = p.id and p.code = :code and p.category_id = c.id and p.id = t.partner_id');
+ $Qpartner->bindInt(':community_account_id', $data['id']);
+ $Qpartner->bindValue(':code', $data['code']);
+ $Qpartner->execute();
+
+ return $Qpartner->fetch();
+ }
+ }
+?>
View
24 osCommerce/OM/Custom/Site/Website/SQL/ANSI/PartnerGetCampaigns.php
@@ -0,0 +1,24 @@
+<?php
+/**
+ * osCommerce Website
+ *
+ * @copyright Copyright (c) 2012 osCommerce; http://www.oscommerce.com
+ * @license BSD License; http://www.oscommerce.com/bsdlicense.txt
+ */
+
+ namespace osCommerce\OM\Core\Site\Website\SQL\ANSI;
+
+ use osCommerce\OM\Core\Registry;
+
+ class PartnerGetCampaigns {
+ public static function execute($data) {
+ $OSCOM_PDO = Registry::get('PDO');
+
+ $Qpartner = $OSCOM_PDO->prepare('select p.id, p.title, p.code, c.title as category_title, max(t.date_end) as date_end from :table_website_partner p left join :table_website_partner_transaction t on (p.id = t.partner_id), :table_website_partner_category c, :table_website_partner_account a where a.community_account_id = :community_account_id and a.partner_id = p.id and p.category_id = c.id group by t.partner_id');
+ $Qpartner->bindInt(':community_account_id', $data['id']);
+ $Qpartner->execute();
+
+ return $Qpartner->fetchAll();
+ }
+ }
+?>
View
31 osCommerce/OM/Custom/Site/Website/SQL/ANSI/PartnerHasCampaign.php
@@ -0,0 +1,31 @@
+<?php
+/**
+ * osCommerce Website
+ *
+ * @copyright Copyright (c) 2012 osCommerce; http://www.oscommerce.com
+ * @license BSD License; http://www.oscommerce.com/bsdlicense.txt
+ */
+
+ namespace osCommerce\OM\Core\Site\Website\SQL\ANSI;
+
+ use osCommerce\OM\Core\Registry;
+
+ class PartnerHasCampaign {
+ public static function execute($data) {
+ $OSCOM_PDO = Registry::get('PDO');
+
+ if ( isset($data['code']) ) {
+ $Qcheck = $OSCOM_PDO->prepare('select a.community_account_id from :table_website_partner_account a, :table_website_partner p where a.community_account_id = :community_account_id and a.partner_id = p.id and p.code = :code limit 1');
+ $Qcheck->bindInt(':community_account_id', $data['id']);
+ $Qcheck->bindValue(':code', $data['code']);
+ $Qcheck->execute();
+ } else {
+ $Qcheck = $OSCOM_PDO->prepare('select community_account_id from :table_website_partner_account where community_account_id = :community_account_id limit 1');
+ $Qcheck->bindInt(':community_account_id', $data['id']);
+ $Qcheck->execute();
+ }
+
+ return $Qcheck->fetch() !== false;
+ }
+ }
+?>
View
105 osCommerce/OM/Custom/Site/Website/SQL/ANSI/PartnerSave.php
@@ -0,0 +1,105 @@
+<?php
+/**
+ * osCommerce Website
+ *
+ * @copyright Copyright (c) 2013 osCommerce; http://www.oscommerce.com
+ * @license BSD License; http://www.oscommerce.com/bsdlicense.txt
+ */
+
+ namespace osCommerce\OM\Core\Site\Website\SQL\ANSI;
+
+ use osCommerce\OM\Core\Registry;
+
+ class PartnerSave {
+ public static function execute($data) {
+ $OSCOM_PDO = Registry::get('PDO');
+
+ $partner = array('desc_short' => $data['desc_short'],
+ 'desc_long' => $data['desc_long'],
+ 'address' => $data['address'],
+ 'telephone' => $data['telephone'],
+ 'email' => $data['email'],
+ 'url' => $data['url'],
+ 'public_url' => $data['public_url'],
+ 'image_promo_url' => $data['image_promo_url']);
+
+ if ( isset($data['image_small']) ) {
+ $partner['image_small'] = $data['image_small'];
+ }
+
+ if ( isset($data['image_big']) ) {
+ $partner['image_big'] = $data['image_big'];
+ }
+
+ if ( isset($data['image_promo']) ) {
+ $partner['image_promo'] = $data['image_promo'];
+ } elseif ( !isset($partner['image_promo_url']) ) {
+ $partner['image_promo'] = null;
+ }
+
+ $OSCOM_PDO->save('website_partner', $partner, array('id' => $data['id']));
+
+ $Qcheck = $OSCOM_PDO->prepare('select id from :table_website_partner_banner where partner_id = :partner_id and code = "en"');
+ $Qcheck->bindInt(':partner_id', $data['id']);
+ $Qcheck->execute();
+
+ if ( $Qcheck->fetch() !== false ) {
+ if ( !isset($data['banner_url_en']) ) {
+ $OSCOM_PDO->delete('website_partner_banner', array('id' => $Qcheck->valueInt('id')));
+ } else {
+ $banner = array('url' => $data['banner_url_en'],
+ 'twitter' => $data['twitter_en']);
+
+ if ( isset($data['banner_image_en']) ) {
+ $banner['image'] = $data['banner_image_en'];
+ }
+
+ $OSCOM_PDO->save('website_partner_banner', $banner, array('id' => $Qcheck->valueInt('id')));
+ }
+ } elseif ( isset($data['banner_url_en']) ) {
+ $banner = array('partner_id' => $data['id'],
+ 'code' => 'en',
+ 'url' => $data['banner_url_en'],
+ 'twitter' => $data['twitter_en']);
+
+ if ( isset($data['banner_image_en']) ) {
+ $banner['image'] = $data['banner_image_en'];
+ }
+
+ $OSCOM_PDO->save('website_partner_banner', $banner);
+ }
+
+ $Qcheck = $OSCOM_PDO->prepare('select id from :table_website_partner_banner where partner_id = :partner_id and code = "de"');
+ $Qcheck->bindInt(':partner_id', $data['id']);
+ $Qcheck->execute();
+
+ if ( $Qcheck->fetch() !== false ) {
+ if ( !isset($data['banner_url_de']) ) {
+ $OSCOM_PDO->delete('website_partner_banner', array('id' => $Qcheck->valueInt('id')));
+ } else {
+ $banner = array('url' => $data['banner_url_de'],
+ 'twitter' => $data['twitter_de']);
+
+ if ( isset($data['banner_image_de']) ) {
+ $banner['image'] = $data['banner_image_de'];
+ }
+
+ $OSCOM_PDO->save('website_partner_banner', $banner, array('id' => $Qcheck->valueInt('id')));
+ }
+ } elseif ( isset($data['banner_url_de']) ) {
+ $banner = array('partner_id' => $data['id'],
+ 'code' => 'de',
+ 'url' => $data['banner_url_de'],
+ 'twitter' => $data['twitter_de']);
+
+ if ( isset($data['banner_image_de']) ) {
+ $banner['image'] = $data['banner_image_de'];
+ }
+
+ $OSCOM_PDO->save('website_partner_banner', $banner);
+ }
+
+ return true;
+ }
+ }
+?>
View
70 osCommerce/OM/Custom/Site/Website/languages/en_US/Services.php
@@ -49,3 +49,73 @@
button_visit_partner_website = Visit Partner Website
link_back_to_listing = Back to listing
+
+dashboard_html_title = osCommerce, Partner Dashboard
+dashboard_title = Partner Dashboard
+dashboard_introduction = Please select a campaign to edit:
+dashboard_empty = There are currently no campaigns available. <a href="{link}Services|Website|Info{link}">Send us an enquiry</a> and we'll get back to you.
+dashboard_link_title = Partner Dashboard
+dashboard_partner_information_page = Partner Information Page
+dashboard_promotion_banner = Promotion Banner
+dashboard_banner_english = Forum Banner (English)
+dashboard_banner_german = Forum Banner (German)
+dashboard_required_fields = * Required fields
+dashboard_field_desc_short_title = Short Description
+dashboard_field_desc_short_desc = Max 450 characters; No HTML; Line breaks ignored
+dashboard_field_desc_long_title = Long Description
+dashboard_field_desc_long_desc = No HTML
+dashboard_field_address_title = Address
+dashboard_field_address_desc = Max 255 characters; No HTML
+dashboard_field_telephone_title = Telephone
+dashboard_field_email_title = E-Mail
+dashboard_field_public_url_title = Public URL
+dashboard_field_public_url_desc = Clean URL without custom tracking codes
+dashboard_field_url_title = Target URL
+dashboard_field_url_desc = Target URL including custom tracking codes
+dashboard_field_image_small_title = Company Logo
+dashboard_field_image_small_desc = 130 x 50px; png jpg
+dashboard_field_image_big_title = Header Image
+dashboard_field_image_big_desc = 940 x 285px; png jpg
+dashboard_field_image_promo_title = Promotion Banner
+dashboard_field_image_promo_desc = 150 x 100px; gif png jpg
+dashboard_field_image_promo_url_title = Promotion Banner URL
+dashboard_field_banner_image_en_title = Banner Image
+dashboard_field_banner_image_en_desc = 468 x 60px; gif png jpg
+dashboard_field_banner_url_en_title = Banner URL
+dashboard_field_twitter_en_title = Twitter Account
+dashboard_field_banner_image_de_title = Banner Image
+dashboard_field_banner_image_de_desc = 468 x 60px; gif png jpg; Must be in German!
+dashboard_field_banner_url_de_title = Banner URL
+dashboard_field_twitter_de_title = Twitter Account
+dashboard_view_current_image = View Current
+dashboard_button_save = Save
+dashboard_button_cancel = Cancel
+dashboard_error_campaign_not_available = Campaign not available.
+dashboard_error_desc_short_empty = Short Description must be provided.
+dashboard_error_desc_short_length = Short Description must not be greater than 450 characters.
+dashboard_error_desc_long_empty = Long Description must be provided.
+dashboard_error_address_length = Address must not be greater than 255 characters.
+dashboard_error_telephone_length = Telephone must not be greater than 255 characters.
+dashboard_error_email_length = E-Mail must be valid and not be greater than 255 characters.
+dashboard_error_public_url_empty = Public URL must be provided.
+dashboard_error_public_url_length = Public URL must not be greater than 255 characters.
+dashboard_error_url_empty = Target URL must be provided.
+dashboard_error_url_length = Target URL must not be greater than 255 characters.
+dashboard_error_image_small_error = Company Logo upload failed. Please upload a 130 x 50px png or jpg image.
+dashboard_error_image_big_error = Header Image upload failed. Please upload a 940 x 285px png or jpg image.
+dashboard_error_image_promo_error = Promotion Image upload failed. Please upload a 150 x 100px gif, png, or jpg image.
+dashboard_error_image_promo_url_error = Promotion Image URL must not be greater than 255 characters.
+dashboard_error_banner_image_en_error = Banner Image (English) upload failed. Please upload a 468 x 60px gif, png, or jpg image.
+dashboard_error_banner_url_en_length = Banner URL (English) must not be greater than 255 characters.
+dashboard_error_twitter_en_length = Twitter Account (English) must not be greater than 255 characters.
+dashboard_error_banner_image_de_error = Banner Image (German) upload failed. Please upload a 468 x 60px gif, png, or jpg image.
+dashboard_error_banner_url_de_length = Banner URL (German) must not be greater than 255 characters.
+dashboard_error_twitter_de_length = Twitter Account (German) must not be greater than 255 characters.
+dashboard_success_save = Partner information has been updated! <a href=":partner_link" class="btn btn-small pull-right">View</a>
+
+login_introduction = <p>Please sign in with your <a href="http://forums.oscommerce.com">community profile</a> account.</p>
+login_username_title = Username:
+login_password_title = Password:
+login_password_forgotten_title = Password forgotten?
+login_button_sign_in = Sign In
+login_create_account_text = Don't have a community profile account? <a href="{link}Services|Website|Info{link}">Send us an enquiry</a> and we'll get back to you.
View
6 public/external/momentjs/moment.min.js
@@ -0,0 +1,6 @@
+// moment.js
+// version : 2.0.0
+// author : Tim Wood
+// license : MIT
+// momentjs.com
+(function(e){function O(e,t){return function(n){return j(e.call(this,n),t)}}function M(e){return function(t){return this.lang().ordinal(e.call(this,t))}}function _(){}function D(e){H(this,e)}function P(e){var t=this._data={},n=e.years||e.year||e.y||0,r=e.months||e.month||e.M||0,i=e.weeks||e.week||e.w||0,s=e.days||e.day||e.d||0,o=e.hours||e.hour||e.h||0,u=e.minutes||e.minute||e.m||0,a=e.seconds||e.second||e.s||0,f=e.milliseconds||e.millisecond||e.ms||0;this._milliseconds=f+a*1e3+u*6e4+o*36e5,this._days=s+i*7,this._months=r+n*12,t.milliseconds=f%1e3,a+=B(f/1e3),t.seconds=a%60,u+=B(a/60),t.minutes=u%60,o+=B(u/60),t.hours=o%24,s+=B(o/24),s+=i*7,t.days=s%30,r+=B(s/30),t.months=r%12,n+=B(r/12),t.years=n}function H(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function B(e){return e<0?Math.ceil(e):Math.floor(e)}function j(e,t){var n=e+"";while(n.length<t)n="0"+n;return n}function F(e,t,n){var r=t._milliseconds,i=t._days,s=t._months,o;r&&e._d.setTime(+e+r*n),i&&e.date(e.date()+i*n),s&&(o=e.date(),e.date(1).month(e.month()+s*n).date(Math.min(o,e.daysInMonth())))}function I(e){return Object.prototype.toString.call(e)==="[object Array]"}function q(e,t){var n=Math.min(e.length,t.length),r=Math.abs(e.length-t.length),i=0,s;for(s=0;s<n;s++)~~e[s]!==~~t[s]&&i++;return i+r}function R(e,t){return t.abbr=e,s[e]||(s[e]=new _),s[e].set(t),s[e]}function U(e){return e?(!s[e]&&o&&require("./lang/"+e),s[e]):t.fn._lang}function z(e){return e.match(/\[.*\]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function W(e){var t=e.match(a),n,r;for(n=0,r=t.length;n<r;n++)A[t[n]]?t[n]=A[t[n]]:t[n]=z(t[n]);return function(i){var s="";for(n=0;n<r;n++)s+=typeof t[n].call=="function"?t[n].call(i,e):t[n];return s}}function X(e,t){function r(t){return e.lang().longDateFormat(t)||t}var n=5;while(n--&&f.test(t))t=t.replace(f,r);return C[t]||(C[t]=W(t)),C[t](e)}function V(e){switch(e){case"DDDD":return p;case"YYYY":return d;case"YYYYY":return v;case"S":case"SS":case"SSS":case"DDD":return h;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":case"a":case"A":return m;case"X":return b;case"Z":case"ZZ":return g;case"T":return y;case"MM":case"DD":case"YY":case"HH":case"hh":case"mm":case"ss":case"M":case"D":case"d":case"H":case"h":case"m":case"s":return c;default:return new RegExp(e.replace("\\",""))}}function $(e,t,n){var r,i,s=n._a;switch(e){case"M":case"MM":s[1]=t==null?0:~~t-1;break;case"MMM":case"MMMM":r=U(n._l).monthsParse(t),r!=null?s[1]=r:n._isValid=!1;break;case"D":case"DD":case"DDD":case"DDDD":t!=null&&(s[2]=~~t);break;case"YY":s[0]=~~t+(~~t>68?1900:2e3);break;case"YYYY":case"YYYYY":s[0]=~~t;break;case"a":case"A":n._isPm=(t+"").toLowerCase()==="pm";break;case"H":case"HH":case"h":case"hh":s[3]=~~t;break;case"m":case"mm":s[4]=~~t;break;case"s":case"ss":s[5]=~~t;break;case"S":case"SS":case"SSS":s[6]=~~(("0."+t)*1e3);break;case"X":n._d=new Date(parseFloat(t)*1e3);break;case"Z":case"ZZ":n._useUTC=!0,r=(t+"").match(x),r&&r[1]&&(n._tzh=~~r[1]),r&&r[2]&&(n._tzm=~~r[2]),r&&r[0]==="+"&&(n._tzh=-n._tzh,n._tzm=-n._tzm)}t==null&&(n._isValid=!1)}function J(e){var t,n,r=[];if(e._d)return;for(t=0;t<7;t++)e._a[t]=r[t]=e._a[t]==null?t===2?1:0:e._a[t];r[3]+=e._tzh||0,r[4]+=e._tzm||0,n=new Date(0),e._useUTC?(n.setUTCFullYear(r[0],r[1],r[2]),n.setUTCHours(r[3],r[4],r[5],r[6])):(n.setFullYear(r[0],r[1],r[2]),n.setHours(r[3],r[4],r[5],r[6])),e._d=n}function K(e){var t=e._f.match(a),n=e._i,r,i;e._a=[];for(r=0;r<t.length;r++)i=(V(t[r]).exec(n)||[])[0],i&&(n=n.slice(n.indexOf(i)+i.length)),A[t[r]]&&$(t[r],i,e);e._isPm&&e._a[3]<12&&(e._a[3]+=12),e._isPm===!1&&e._a[3]===12&&(e._a[3]=0),J(e)}function Q(e){var t,n,r,i=99,s,o,u;while(e._f.length){t=H({},e),t._f=e._f.pop(),K(t),n=new D(t);if(n.isValid()){r=n;break}u=q(t._a,n.toArray()),u<i&&(i=u,r=n)}H(e,r)}function G(e){var t,n=e._i;if(w.exec(n)){e._f="YYYY-MM-DDT";for(t=0;t<4;t++)if(S[t][1].exec(n)){e._f+=S[t][0];break}g.exec(n)&&(e._f+=" Z"),K(e)}else e._d=new Date(n)}function Y(t){var n=t._i,r=u.exec(n);n===e?t._d=new Date:r?t._d=new Date(+r[1]):typeof n=="string"?G(t):I(n)?(t._a=n.slice(0),J(t)):t._d=n instanceof Date?new Date(+n):new Date(n)}function Z(e,t,n,r,i){return i.relativeTime(t||1,!!n,e,r)}function et(e,t,n){var i=r(Math.abs(e)/1e3),s=r(i/60),o=r(s/60),u=r(o/24),a=r(u/365),f=i<45&&["s",i]||s===1&&["m"]||s<45&&["mm",s]||o===1&&["h"]||o<22&&["hh",o]||u===1&&["d"]||u<=25&&["dd",u]||u<=45&&["M"]||u<345&&["MM",r(u/30)]||a===1&&["y"]||["yy",a];return f[2]=t,f[3]=e>0,f[4]=n,Z.apply({},f)}function tt(e,n,r){var i=r-n,s=r-e.day();return s>i&&(s-=7),s<i-7&&(s+=7),Math.ceil(t(e).add("d",s).dayOfYear()/7)}function nt(e){var n=e._i,r=e._f;return n===null||n===""?null:(typeof n=="string"&&(e._i=n=U().preparse(n)),t.isMoment(n)?(e=H({},n),e._d=new Date(+n._d)):r?I(r)?Q(e):K(e):Y(e),new D(e))}function rt(e,n){t.fn[e]=t.fn[e+"s"]=function(e){var t=this._isUTC?"UTC":"";return e!=null?(this._d["set"+t+n](e),this):this._d["get"+t+n]()}}function it(e){t.duration.fn[e]=function(){return this._data[e]}}function st(e,n){t.duration.fn["as"+e]=function(){return+this/n}}var t,n="2.0.0",r=Math.round,i,s={},o=typeof module!="undefined"&&module.exports,u=/^\/?Date\((\-?\d+)/i,a=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYY|YYYY|YY|a|A|hh?|HH?|mm?|ss?|SS?S?|X|zz?|ZZ?|.)/g,f=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,l=/([0-9a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+)/gi,c=/\d\d?/,h=/\d{1,3}/,p=/\d{3}/,d=/\d{1,4}/,v=/[+\-]?\d{1,6}/,m=/[0-9]*[a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF]+\s*?[\u0600-\u06FF]+/i,g=/Z|[\+\-]\d\d:?\d\d/i,y=/T/i,b=/[\+\-]?\d+(\.\d{1,3})?/,w=/^\s*\d{4}-\d\d-\d\d((T| )(\d\d(:\d\d(:\d\d(\.\d\d?\d?)?)?)?)?([\+\-]\d\d:?\d\d)?)?/,E="YYYY-MM-DDTHH:mm:ssZ",S=[["HH:mm:ss.S",/(T| )\d\d:\d\d:\d\d\.\d{1,3}/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],x=/([\+\-]|\d\d)/gi,T="Month|Date|Hours|Minutes|Seconds|Milliseconds".split("|"),N={Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6},C={},k="DDD w W M D d".split(" "),L="M D H h m s w W".split(" "),A={M:function(){return this.month()+1},MMM:function(e){return this.lang().monthsShort(this,e)},MMMM:function(e){return this.lang().months(this,e)},D:function(){return this.date()},DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(e){return this.lang().weekdaysMin(this,e)},ddd:function(e){return this.lang().weekdaysShort(this,e)},dddd:function(e){return this.lang().weekdays(this,e)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return j(this.year()%100,2)},YYYY:function(){return j(this.year(),4)},YYYYY:function(){return j(this.year(),5)},a:function(){return this.lang().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.lang().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return~~(this.milliseconds()/100)},SS:function(){return j(~~(this.milliseconds()/10),2)},SSS:function(){return j(this.milliseconds(),3)},Z:function(){var e=-this.zone(),t="+";return e<0&&(e=-e,t="-"),t+j(~~(e/60),2)+":"+j(~~e%60,2)},ZZ:function(){var e=-this.zone(),t="+";return e<0&&(e=-e,t="-"),t+j(~~(10*e/6),4)},X:function(){return this.unix()}};while(k.length)i=k.pop(),A[i+"o"]=M(A[i]);while(L.length)i=L.pop(),A[i+i]=O(A[i],2);A.DDDD=O(A.DDD,3),_.prototype={set:function(e){var t,n;for(n in e)t=e[n],typeof t=="function"?this[n]=t:this["_"+n]=t},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(e){return this._months[e.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(e){return this._monthsShort[e.month()]},monthsParse:function(e){var n,r,i,s;this._monthsParse||(this._monthsParse=[]);for(n=0;n<12;n++){this._monthsParse[n]||(r=t([2e3,n]),i="^"+this.months(r,"")+"|^"+this.monthsShort(r,""),this._monthsParse[n]=new RegExp(i.replace(".",""),"i"));if(this._monthsParse[n].test(e))return n}},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(e){return this._weekdays[e.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(e){return this._weekdaysShort[e.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(e){return this._weekdaysMin[e.day()]},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},longDateFormat:function(e){var t=this._longDateFormat[e];return!t&&this._longDateFormat[e.toUpperCase()]&&(t=this._longDateFormat[e.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(e){return e.slice(1)}),this._longDateFormat[e]=t),t},meridiem:function(e,t,n){return e>11?n?"pm":"PM":n?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[last] dddd [at] LT",sameElse:"L"},calendar:function(e,t){var n=this._calendar[e];return typeof n=="function"?n.apply(t):n},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(e,t,n,r){var i=this._relativeTime[n];return typeof i=="function"?i(e,t,n,r):i.replace(/%d/i,e)},pastFuture:function(e,t){var n=this._relativeTime[e>0?"future":"past"];return typeof n=="function"?n(t):n.replace(/%s/i,t)},ordinal:function(e){return this._ordinal.replace("%d",e)},_ordinal:"%d",preparse:function(e){return e},postformat:function(e){return e},week:function(e){return tt(e,this._week.dow,this._week.doy)},_week:{dow:0,doy:6}},t=function(e,t,n){return nt({_i:e,_f:t,_l:n,_isUTC:!1})},t.utc=function(e,t,n){return nt({_useUTC:!0,_isUTC:!0,_l:n,_i:e,_f:t})},t.unix=function(e){return t(e*1e3)},t.duration=function(e,n){var r=t.isDuration(e),i=typeof e=="number",s=r?e._data:i?{}:e,o;return i&&(n?s[n]=e:s.milliseconds=e),o=new P(s),r&&e.hasOwnProperty("_lang")&&(o._lang=e._lang),o},t.version=n,t.defaultFormat=E,t.lang=function(e,n){var r;if(!e)return t.fn._lang._abbr;n?R(e,n):s[e]||U(e),t.duration.fn._lang=t.fn._lang=U(e)},t.langData=function(e){return e&&e._lang&&e._lang._abbr&&(e=e._lang._abbr),U(e)},t.isMoment=function(e){return e instanceof D},t.isDuration=function(e){return e instanceof P},t.fn=D.prototype={clone:function(){return t(this)},valueOf:function(){return+this._d},unix:function(){return Math.floor(+this._d/1e3)},toString:function(){return this.format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._d},toJSON:function(){return t.utc(this).format("YYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){var e=this;return[e.year(),e.month(),e.date(),e.hours(),e.minutes(),e.seconds(),e.milliseconds()]},isValid:function(){return this._isValid==null&&(this._a?this._isValid=!q(this._a,(this._isUTC?t.utc(this._a):t(this._a)).toArray()):this._isValid=!isNaN(this._d.getTime())),!!this._isValid},utc:function(){return this._isUTC=!0,this},local:function(){return this._isUTC=!1,this},format:function(e){var n=X(this,e||t.defaultFormat);return this.lang().postformat(n)},add:function(e,n){var r;return typeof e=="string"?r=t.duration(+n,e):r=t.duration(e,n),F(this,r,1),this},subtract:function(e,n){var r;return typeof e=="string"?r=t.duration(+n,e):r=t.duration(e,n),F(this,r,-1),this},diff:function(e,n,r){var i=this._isUTC?t(e).utc():t(e).local(),s=(this.zone()-i.zone())*6e4,o,u;return n&&(n=n.replace(/s$/,"")),n==="year"||n==="month"?(o=(this.daysInMonth()+i.daysInMonth())*432e5,u=(this.year()-i.year())*12+(this.month()-i.month()),u+=(this-t(this).startOf("month")-(i-t(i).startOf("month")))/o,n==="year"&&(u/=12)):(o=this-i-s,u=n==="second"?o/1e3:n==="minute"?o/6e4:n==="hour"?o/36e5:n==="day"?o/864e5:n==="week"?o/6048e5:o),r?u:B(u)},from:function(e,n){return t.duration(this.diff(e)).lang(this.lang()._abbr).humanize(!n)},fromNow:function(e){return this.from(t(),e)},calendar:function(){var e=this.diff(t().startOf("day"),"days",!0),n=e<-6?"sameElse":e<-1?"lastWeek":e<0?"lastDay":e<1?"sameDay":e<2?"nextDay":e<7?"nextWeek":"sameElse";return this.format(this.lang().calendar(n,this))},isLeapYear:function(){var e=this.year();return e%4===0&&e%100!==0||e%400===0},isDST:function(){return this.zone()<t([this.year()]).zone()||this.zone()<t([this.year(),5]).zone()},day:function(e){var t=this._isUTC?this._d.getUTCDay():this._d.getDay();return e==null?t:this.add({d:e-t})},startOf:function(e){e=e.replace(/s$/,"");switch(e){case"year":this.month(0);case"month":this.date(1);case"week":case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return e==="week"&&this.day(0),this},endOf:function(e){return this.startOf(e).add(e.replace(/s?$/,"s"),1).subtract("ms",1)},isAfter:function(e,n){return n=typeof n!="undefined"?n:"millisecond",+this.clone().startOf(n)>+t(e).startOf(n)},isBefore:function(e,n){return n=typeof n!="undefined"?n:"millisecond",+this.clone().startOf(n)<+t(e).startOf(n)},isSame:function(e,n){return n=typeof n!="undefined"?n:"millisecond",+this.clone().startOf(n)===+t(e).startOf(n)},zone:function(){return this._isUTC?0:this._d.getTimezoneOffset()},daysInMonth:function(){return t.utc([this.year(),this.month()+1,0]).date()},dayOfYear:function(e){var n=r((t(this).startOf("day")-t(this).startOf("year"))/864e5)+1;return e==null?n:this.add("d",e-n)},isoWeek:function(e){var t=tt(this,1,4);return e==null?t:this.add("d",(e-t)*7)},week:function(e){var t=this.lang().week(this);return e==null?t:this.add("d",(e-t)*7)},lang:function(t){return t===e?this._lang:(this._lang=U(t),this)}};for(i=0;i<T.length;i++)rt(T[i].toLowerCase().replace(/s$/,""),T[i]);rt("year","FullYear"),t.fn.days=t.fn.day,t.fn.weeks=t.fn.week,t.fn.isoWeeks=t.fn.isoWeek,t.duration.fn=P.prototype={weeks:function(){return B(this.days()/7)},valueOf:function(){return this._milliseconds+this._days*864e5+this._months*2592e6},humanize:function(e){var t=+this,n=et(t,!e,this.lang());return e&&(n=this.lang().pastFuture(t,n)),this.lang().postformat(n)},lang:t.fn.lang};for(i in N)N.hasOwnProperty(i)&&(st(i,N[i]),it(i.toLowerCase()));st("Weeks",6048e5),t.lang("en",{ordinal:function(e){var t=e%10,n=~~(e%100/10)===1?"th":t===1?"st":t===2?"nd":t===3?"rd":"th";return e+n}}),o&&(module.exports=t),typeof ender=="undefined"&&(this.moment=t),typeof define=="function"&&define.amd&&define("moment",[],function(){return t})}).call(this);
Please sign in to comment.
Something went wrong with that request. Please try again.