Example #1
0
#/usr/local/bin/php
<?php 
include_once dirname(dirname(__FILE__)) . '/configs/crowdfunding.inc.php';
include_once dirname(__FILE__) . '/Crowdfunding.php';
$crowdfunding = new Crowdfunding();
$result = $crowdfunding->collect_all();
Example #2
0
 public function savevaluesAction()
 {
     //error_log('savevaluesAction REQUEST: '.print_r($_REQUEST, true));
     global $mySession;
     $db = new Db();
     $this->_helper->layout->setLayout('myaccount');
     $url = $this->getRequest()->getParam('url');
     $myform1 = new Form_Buy();
     $sql = $db->runquery("select * from " . LAUNCHCAMPAIGN . " where url='" . $url . "'");
     $shhpng = $db->runquery("select * from " . TSHIRT_PRICE . " where campagin_id='" . $sql[0]['SelectedProduct'] . "'");
     $shhpprice = $shhpng[0]['shipping_price'];
     $price = $sql[0]['selling_price'];
     if ($_REQUEST['countdiv'] == 0) {
         $pricetot = $_REQUEST['total_Value_text'];
     } else {
         $pricetot = $_REQUEST['total_Value_text'] + $shhpprice;
     }
     $cnt = $_REQUEST['countdiv'];
     $qua = 0;
     $size = '';
     for ($i = 1; $i <= $cnt; $i++) {
         $qua += $_REQUEST['qty_' . $i];
         $size .= $_REQUEST['qty_' . $i] . "*" . $_REQUEST['size' . $i] . ",";
     }
     $qua += $_REQUEST['qty'];
     $size .= $_REQUEST['qty'] . "*" . $_REQUEST['size'];
     $qq = $_REQUEST['totquanty'];
     $this->view->url = $url;
     $mySession->sizes = $size;
     $mySession->totalquantity = $qq;
     $mySession->amount = $price;
     $mySession->totalamt = $pricetot;
     $mySession->url = $url;
     if ($_REQUEST['paypalchk'] == 1) {
         $Data = $db->runQuery("select * from " . LAUNCHCAMPAIGN . " WHERE url='" . $url . "'");
         // X004 getting parameter for the payment of tees
         $payment_params = array("user" => $mySession->TeeLoggedID, "sizes" => $mySession->sizes, "cart_details" => $_REQUEST, "camp_details" => $Data);
         require_once dirname(dirname(__FILE__)) . '/configs/crowdfunding.inc.php';
         require_once dirname(dirname(__FILE__)) . '/crowdfunding/Crowdfunding.php';
         $crowdfunding = new Crowdfunding();
         $prekey = $crowdfunding->create_preapproval($payment_params);
         die;
         /*
         echo "<h1 align='center'>You are redirecting Please wait...</h1>";
         
         echo '<form action="https://www.paypal.com/cgi-bin/webscr" name="payment_frm" id="payment_frm" method="post">';
         
         //echo '<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" name="payment_frm" id="payment_frm" method="post">';
         
         //echo '<input type="hidden" name="cmd" value="_xclick">';
         echo '<input type="hidden" name="cmd" value="_ext-enter">';
         echo '<input type="hidden" name="redirect_cmd" value="_xclick">';
         
         
         
         //echo '<input type="hidden" name="business" value="*****@*****.**">';
         echo '<input type="hidden" name="business" value="'.PAYPAL_EMAIL.'">';
         
         echo '<input type="hidden" name="no_note" value="1">';
         echo '<input type="hidden" name="image_url" value="'.APPLICATION_URL.'images/logo.png">';
         echo '<input type="hidden" name="item_name" value="'.$sql[0]['url'].'">';
         echo '<input type="hidden" name="package_name" value="">';
         
         echo '<input type="hidden" name="email" value="'.$_REQUEST['cemail'].'">';
         echo '<input type="hidden" name="first_name" value="'.$_REQUEST['cfname'].'">';
         echo '<input type="hidden" name="last_name" value="'.$_REQUEST['clname'].'">';
         
         //echo '<input type="hidden" name="amount" value="0.01">';
         echo '<input type="hidden" name="amount" value="'.$mySession->totalamt.'">';
         
         echo '<input type="hidden" name="currency_code" value="USD">';
         echo '<input type="hidden" name="charset" value="utf-8">';
         echo '<input type="hidden" name="rm" value="2" >';
         echo '<input type="hidden" name="cs" value="1" >';
         echo '<input type="hidden" name="custom" value="'.$url.'" >';
         echo '<input type="hidden" name="upload" value="1">';
         
         
         echo '<input type="hidden" name="return" id="return" value="'.APPLICATION_URL.'payment/success/Return/1"/>';
         echo '<input type="hidden" name="cancel_return" value="'.APPLICATION_URL.'payment/success/Return/2/url/'.$url.'">';
         //echo '<input type="hidden" name="notify_url"  value="'.APPLICATION_URL.'payment/notify"/>';
         
         
         
         echo '<input type="submit" value="Paypal" name="btn" style="display:none;" />';
         
         echo '</form>';
         echo '<script>window.document.payment_frm.submit();</script>';
         */
     }
 }
Example #3
0
<?php

include_once dirname(dirname(__FILE__)) . '/configs/crowdfunding.inc.php';
include_once dirname(__FILE__) . '/Crowdfunding.php';
$crowdfunding = new Crowdfunding();
$result = $crowdfunding->collect_payments($_GET);
echo $result['attempts'] . ' to collect money, ' . $result['errors'] . ' errors.';
 public function launchAction()
 {
     //echo "launch"; die;
     global $mySession;
     $db = new Db();
     $this->_helper->layout->setLayout('main');
     $cid = $this->getRequest()->getParam('cid');
     $lid = $this->getRequest()->getParam('lid');
     //$myform=new Form_Setgoal();
     $this->view->lid = $lid;
     $this->view->cid = $cid;
     //echo "camp id : when launched :".$cid; die;
     //echo "JSK last id : ".$lid; die;
     $myform = new Form_Adddescription();
     $this->view->myform = $myform;
     if ($this->getRequest()->isPost()) {
         $request = $this->getRequest();
         $myform = new Form_Adddescription();
         if ($myform->isValid($request->getPost())) {
             $dataForm = $myform->getValues();
             //echo "inside post";
             //$checkboxval=$_REQUEST['add_checkbox'];
             //echo "value of CB===".$checkboxval; die;
             //pr($dataForm);
             $myObj = new Launchcampaigndb();
             if ($mySession->camptitl != "" && $mySession->setgoalvalues != "" && $mySession->showurl != "") {
                 //echo $mySession->campaign_category."JSK"; prd($mySession);
                 //echo "launch action session values"; die;
                 $data1 = $myObj->saveall();
                 #get followers
                 $followers = '';
                 $getfollowers = $db->runquery("select * from " . FOLLOW . " where following_id='" . $mySession->TeeLoggedID . "' ");
                 if (count($getfollowers) > 0) {
                     foreach ($getfollowers as $follow) {
                         $followers .= $follow['follower_id'] . ",";
                     }
                     #save for notification
                     $savenotification = array('n_camp_id' => $data1, 'n_user_id' => $followers, 'n_date' => date('Y-M-d H:i:s'));
                     $db->save(NOTIFICATION, $savenotification);
                     $campvalue = $db->runQuery("select title,url,campaign_id from " . LAUNCHCAMPAIGN . " where campaign_id='" . $data1 . "'");
                     $urlPathcapmp = '<a href="' . APPLICATION_URL . urlencode($campvalue[0]['url']) . '">' . APPLICATION_URL . urlencode($campvalue[0]['url']) . '</a>';
                     $DatauserDetail = $db->runQuery("select * from " . USERS . " where user_id='" . $mySession->TeeLoggedID . "'");
                     $urlPathprofile = '<a href="' . APPLICATION_URL . 'user/view/user_id/' . $DatauserDetail[0]['user_id'] . '">' . APPLICATION_URL . 'user/view/user_id/' . $DatauserDetail[0]['user_id'] . '</a>';
                     foreach ($getfollowers as $follow) {
                         $Data = $db->runQuery("select * from " . USERS . " where user_id='" . $follow['follower_id'] . "'");
                         $emaid = $Data[0]['emailid'];
                         $templateData = $db->runQuery("select * from " . EMAIL_TEMPLATES . " where template_id='19'");
                         $messageText = $templateData[0]['email_body'];
                         $subject = $templateData[0]['email_subject'];
                         $messageText = str_replace("[NAME]", $emaid, $messageText);
                         $messageText = str_replace("[UNAME]", $DatauserDetail[0]['emailid'] . '(' . $DatauserDetail[0]['public_name'] . ')', $messageText);
                         $messageText = str_replace("[CAMPAIGN_TITLE]", $campvalue[0]['title'] . '', $messageText);
                         $messageText = str_replace("[CAMPAIGN_LINK]", $urlPathcapmp, $messageText);
                         $messageText = str_replace("[PROFILE_LINK]", $urlPathprofile, $messageText);
                         $messageText = str_replace("[SITENAME]", SITE_NAME, $messageText);
                         SendEmail($emaid, $subject, $messageText);
                     }
                     $this->_redirect(APPLICATION_URL . urlencode($dataForm['url']));
                 }
             }
             if ($cid != "") {
                 //echo "here is cid ".$cid; die;
                 $data = $myObj->relaunchcampaign($dataForm, $cid);
             } else {
                 //echo "JSK last id : ".$lid; die;
                 $data = $myObj->savecampaign($dataForm, $lid);
                 #get followers
                 $followers = '';
                 $getfollowers = $db->runquery("select * from " . FOLLOW . " where following_id='" . $mySession->TeeLoggedID . "' ");
                 if (count($getfollowers) > 0) {
                     foreach ($getfollowers as $follow) {
                         $followers .= $follow['follower_id'] . ",";
                     }
                     #save for notification
                     $savenotification = array('n_camp_id' => $lid, 'n_user_id' => $followers, 'n_date' => date('Y-M-d H:i:s'));
                     $db->save(NOTIFICATION, $savenotification);
                     $campvalue = $db->runQuery("select title,url,campaign_id from " . LAUNCHCAMPAIGN . " where campaign_id='" . $lid . "'");
                     $urlPathcapmp = '<a href="' . APPLICATION_URL . urlencode($campvalue[0]['url']) . '">' . APPLICATION_URL . urlencode($campvalue[0]['url']) . '</a>';
                     $DatauserDetail = $db->runQuery("select * from " . USERS . " where user_id='" . $mySession->TeeLoggedID . "'");
                     $urlPathprofile = '<a href="' . APPLICATION_URL . 'user/view/user_id/' . $DatauserDetail[0]['user_id'] . '">' . APPLICATION_URL . 'user/view/user_id/' . $DatauserDetail[0]['user_id'] . '</a>';
                     foreach ($getfollowers as $follow) {
                         $Data = $db->runQuery("select * from " . USERS . " where user_id='" . $follow['follower_id'] . "'");
                         $emaid = $Data[0]['emailid'];
                         $templateData = $db->runQuery("select * from " . EMAIL_TEMPLATES . " where template_id='19'");
                         $messageText = $templateData[0]['email_body'];
                         $subject = $templateData[0]['email_subject'];
                         $messageText = str_replace("[NAME]", $emaid, $messageText);
                         $messageText = str_replace("[UNAME]", $DatauserDetail[0]['emailid'] . '(' . $DatauserDetail[0]['public_name'] . ')', $messageText);
                         $messageText = str_replace("[CAMPAIGN_TITLE]", $campvalue[0]['title'] . '', $messageText);
                         $messageText = str_replace("[CAMPAIGN_LINK]", $urlPathcapmp, $messageText);
                         $messageText = str_replace("[PROFILE_LINK]", $urlPathprofile, $messageText);
                         $messageText = str_replace("[SITENAME]", SITE_NAME, $messageText);
                         SendEmail($emaid, $subject, $messageText);
                     }
                 }
                 //	$db->save(LAUNCHCAMPAIGN,$data_insert);
             }
             //echo "else";die;
             if ($data == 1) {
                 // X001 Preparing the parameters
                 $postvals = $request->getPost();
                 $payment_params = array("lid" => $lid, "creator" => $mySession->TeeLoggedID, "length" => $postvals["no_ofdays"], "tees" => $mySession->no_of_t, "baseprice" => 0, "sellprice" => $mySession->setgoalvalues["sellingprice"], "url" => $postvals["url"], "valuekm" => $mySession->selectedIdValueKM);
                 // End of X001
                 $mySession->errorMsg = "Campaign Launched successfully";
                 $sql = $db->runquery("select * from " . LAUNCHCAMPAIGN . " where user_id='" . $mySession->TeeLoggedID . "' and draft_status='1'");
                 //echo "select * from ".LAUNCHCAMPAIGN." where user_id='".$mySession->TeeLoggedID."'";
                 //echo "url is: ".$dataForm['url']; die;
                 $mySession->setgoalvalues = "";
                 unset($mySession->setgoalvalues);
                 $mySession->no_of_t = "";
                 unset($mySession->no_of_t);
                 $mySession->baseprice = "";
                 unset($mySession->baseprice);
                 $mySession->camptitl = "";
                 unset($mySession->camptitl);
                 $mySession->descrip = "";
                 unset($mySession->descrip);
                 $mySession->camplength = "";
                 unset($mySession->camplength);
                 $mySession->showurl = "";
                 unset($mySession->showurl);
                 $mySession->campaign_category = "";
                 unset($mySession->campaign_category);
                 $mySession->recreation_product = "";
                 unset($mySession->recreation_product);
                 $mySession->setBackImageIcon = "";
                 unset($mySession->setBackImageIcon);
                 $mySession->setFrontImageIcon = "";
                 unset($mySession->setFrontImageIcon);
                 $mySession->customimage = "";
                 unset($mySession->customimage);
                 $mySession->dataURLDbback = "";
                 unset($mySession->dataURLDbback);
                 $mySession->dataURLDbfront = "";
                 unset($mySession->dataURLDbfront);
                 //$this->_redirect('launchcampaign/showcampaign/name/'.$dataForm['url']);
                 // X002 getting parameters
                 require_once dirname(dirname(__FILE__)) . '/configs/crowdfunding.inc.php';
                 require_once dirname(dirname(__FILE__)) . '/crowdfunding/Crowdfunding.php';
                 $sel = $db->runquery("select * from " . TSHIRT_PRICE . " where campagin_id='" . $payment_params["valuekm"] . "'");
                 $sql = $db->runquery("select * from " . TSHIRT_DISCOUNT . " where no_of_tee='" . $payment_params["tees"] . "'");
                 if (count($sql) > 0) {
                     $bprice = $sel[0]['base_price'] * $sql[0]['discount_per'] / 100;
                     $bprice = $sel[0]['base_price'] - $bprice;
                 } else {
                     $sql1 = $db->runquery("select * from " . TSHIRT_DISCOUNT . " where no_of_tee <'" . $payment_params["tees"] . "' && no_of_tee!=0");
                     $cnt = count($sql1);
                     $discount = $sql1[$cnt - 1]['discount_per'];
                     $bprice = $sel[0]['base_price'] * $discount / 100;
                     $bprice = $sel[0]['base_price'] - $bprice;
                 }
                 $payment_params["baseprice"] = $bprice;
                 $crowdfunding = new Crowdfunding();
                 $crowdfunding->create_campaign($payment_params);
                 // End of X002
                 $this->_redirect(APPLICATION_URL . urlencode($dataForm['url']));
             }
         } else {
             //echo"else of in valid";
             $this->view->myform = $myform;
             $this->render('adddescription');
         }
     } else {
         //echo"else of is post"; die;
         $this->_redirect('launchcampaign/adddescription');
     }
     //pr($mySession->camplength);
     //prd($mySession->showurl);
 }
 public function endprocessAction()
 {
     global $mySession;
     $db = new Db();
     $cid = $this->getRequest()->getParam('cid');
     // X004 releasing the finds
     require_once dirname(dirname(__FILE__)) . '/configs/crowdfunding.inc.php';
     require_once dirname(dirname(__FILE__)) . '/crowdfunding/Crowdfunding.php';
     $crowdfunding = new Crowdfunding();
     $crowdfunding->end_campaign(array("cid" => $cid));
     // X004 END
     $data_update['campaign_status'] = 0;
     $data_update['campaign_length'] = 0;
     $condition = "campaign_id='" . $cid . "'";
     $db->modify(LAUNCHCAMPAIGN, $data_update, $condition);
     $mySession->errorMsg = "Campaign Ended";
     $this->_redirect('myaccount/activecampaign');
 }
Example #6
0
<?php

include_once dirname(dirname(__FILE__)) . '/configs/crowdfunding.inc.php';
include_once dirname(__FILE__) . '/Crowdfunding.php';
//print_r ($_GET);
$crowdfunding = new Crowdfunding();
$crowdfunding->cancel_preapproval($_GET);
header('Location: ' . $_GET['redirect']);
Example #7
0
<?php

//file_put_contents("out", print_r($_POST, 1));
include_once dirname(dirname(__FILE__)) . '/configs/crowdfunding.inc.php';
include_once dirname(__FILE__) . '/Crowdfunding.php';
$crowdfunding = new Crowdfunding();
$crowdfunding->confirm_preapproval($_POST);