* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * \file htdocs/public/payment/newpayment.php * \ingroup core * \brief File to offer a way to make a payment for a particular Dolibarr object */ if (!defined('NOLOGIN')) { define("NOLOGIN", 1); // This means this output page does not require to be logged. } if (!defined('NOCSRFCHECK')) { define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. } if (!defined('NOIPCHECK')) { define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip } if (!defined('NOBROWSERNOTIF')) { define('NOBROWSERNOTIF', '1'); } // For MultiCompany module. // Do not use GETPOST here, function is not defined and get of entity must be done before including main.inc.php // Because 2 entities can have the same ref. $entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : (!empty($_GET['e']) ? (int) $_GET['e'] : (!empty($_POST['e']) ? (int) $_POST['e'] : 1)))); if (is_numeric($entity)) { define("DOLENTITY", $entity); } // Load Dolibarr environment require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php'; // Hook to be used by external payment modules (ie Payzen, ...) $hookmanager = new HookManager($db); $hookmanager->initHooks(array('newpayment')); // For encryption global $dolibarr_main_url_root; // Load translation files $langs->loadLangs(array("main", "other", "dict", "bills", "companies", "errors", "paybox", "paypal", "stripe")); // File with generic data // Security check // No check on module enabled. Done later according to $validpaymentmethod $errmsg = ''; $action = GETPOST('action', 'aZ09'); $id = GETPOST('id'); $securekeyreceived = GETPOST("securekey"); $securekeytocompare = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY') . 'conferenceorbooth'.$id, 'md5'); if ($securekeytocompare != $securekeyreceived) { print $langs->trans('MissingOrBadSecureKey'); exit; } $listofvotes = explode(',', $_SESSION["savevotes"]); // Define $urlwithroot //$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); //$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file $urlwithroot = DOL_MAIN_URL_ROOT; // This is to use same domain name than current. For Paypal payment, we can use internal URL like localhost. $project = new Project($db); $resultproject = $project->fetch($id); if ($resultproject < 0) { $error++; $errmsg .= $project->error; } // Security check if (empty($conf->eventorganization->enabled)) { httponly_accessforbidden('Module Event organization not enabled'); } /* * Actions */ $tmpthirdparty = new Societe($db); $listOfConferences = ''.$langs->trans('Label').''; $listOfConferences .= ''.$langs->trans('Type').''; $listOfConferences .= ''.$langs->trans('ThirdParty').''; $listOfConferences .= ''.$langs->trans('Note').''; $sql = "SELECT a.id, a.fk_action, a.datep, a.datep2, a.label, a.fk_soc, a.note, ca.libelle as label FROM ".MAIN_DB_PREFIX."actioncomm as a INNER JOIN ".MAIN_DB_PREFIX."c_actioncomm as ca ON (a.fk_action=ca.id) WHERE a.status<2"; $sqlforconf = $sql." AND ca.module='conference@eventorganization'"; //$sqlforbooth = $sql." AND ca.module='booth@eventorganization'"; // For conferences $result = $db->query($sqlforconf); $i = 0; while ($i < $db->num_rows($result)) { $obj = $db->fetch_object($result); if (!empty($obj->fk_soc)) { $resultthirdparty = $tmpthirdparty->fetch($obj->fk_soc); if ($resultthirdparty) { $thirdpartyname = $tmpthirdparty->name; } else { $thirdpartyname = ''; } } else { $thirdpartyname = ''; } $listOfConferences .= ''.$obj->label.''.$obj->label.''.$thirdpartyname.''.$obj->note.''; $listOfConferences .= ''; $i++; } // For booths /* $result = $db->query($sqlforbooth); $i = 0; while ($i < $db->num_rows($result)) { $obj = $db->fetch_object($result); if (!empty($obj->fk_soc)) { $resultthirdparty = $tmpthirdparty->fetch($obj->fk_soc); if ($resultthirdparty) { $thirdpartyname = $tmpthirdparty->name; } else { $thirdpartyname = ''; } } else { $thirdpartyname = ''; } $listOfBooths .= ''.$obj->label.''.$obj->libelle.''.$obj->datep.''.$obj->datep2.''.$thirdpartyname.''.$obj->note.''; $listOfBooths .= ''; $i++; } */ // Get vote result $idvote = GETPOST("vote"); $hashedvote = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY') . 'vote'.$idvote); if (strlen($idvote)) { if (in_array($hashedvote, $listofvotes)) { // Has already voted $votestatus = 'ko'; } else { // Has not already voted $conforbooth = new ActionComm($db); $resultconforbooth = $conforbooth->fetch($idvote); if ($resultconforbooth <= 0) { $error++; $errmsg .= $conforbooth->error; } else { // Process to vote $conforbooth->num_vote++; $resupdate = $conforbooth->update($user); if ($resupdate) { $votestatus = 'ok'; $_SESSION["savevotes"] = $hashedvote.','.(empty($_SESSION["savevotes"]) ? '' : $_SESSION["savevotes"]); // Save voter } else { //Error during update $votestatus = 'err'; } } } if ($votestatus == "ok") { setEventMessage($langs->trans("VoteOk"), 'mesgs'); } elseif ($votestatus == "ko") { setEventMessage($langs->trans("AlreadyVoted"), 'warnings'); } elseif ($votestatus == "err") { setEventMessage($langs->trans("VoteError"), 'warnings'); } header("Refresh:0;url=".dol_buildpath('/public/project/viewandvote.php?id='.$id.'&securekey=', 1).$securekeyreceived); exit; } /* * View */ $head = ''; if (getDolGlobalString('ONLINE_PAYMENT_CSS_URL')) { $head = ''."\n"; } $conf->dol_hide_topmenu = 1; $conf->dol_hide_leftmenu = 1; $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
' : '').'
'; llxHeader($head, $langs->trans("SuggestForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea); print ''."\n"; print '
'."\n"; print '
'."\n"; print ''."\n"; print ''."\n"; print ''."\n"; //print ''."\n"; print ''."\n"; print ''."\n"; print ''; print ''; print "\n"; // Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo) // Define logo and logosmall $logosmall = $mysoc->logo_small; $logo = $mysoc->logo; $paramlogo = 'ONLINE_PAYMENT_LOGO_'.$suffix; if (getDolGlobalString($paramlogo)) { $logosmall = getDolGlobalString($paramlogo); } elseif (getDolGlobalString('ONLINE_PAYMENT_LOGO')) { $logosmall = getDolGlobalString('ONLINE_PAYMENT_LOGO'); } //print ''."\n"; // Define urllogo $urllogo = ''; $urllogofull = ''; if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) { $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); } elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) { $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); } // Output html code for logo if ($urllogo) { print '
'; print '
'; print ''; print '
'; if (!getDolGlobalString('MAIN_HIDE_POWERED_BY')) { print ''; } print '
'; } if (getDolGlobalString('PROJECT_IMAGE_PUBLIC_SUGGEST_BOOTH')) { print '
'; print ''; print '
'; } print ''."\n"; $text = ''."\n"; $text .= ''."\n"; $text .= ''."\n"; print $text; print '

'.$langs->trans("EvntOrgRegistrationWelcomeMessage").'
'.$langs->trans("EvntOrgVoteHelpMessage").' : "'.$project->title.'".

'.$project->note_public.'
'."\n"; print ''."\n"; print ''; print $listOfConferences.'
'; print '
'.$langs->trans("ListOfSuggestedConferences").'
'."\n"; /* print '
'; print ''."\n"; print ''; print $listOfBooths.'
'; print '
'.$langs->trans("ListOfSuggestedBooths").'
'."\n"; */ $object = null; htmlPrintOnlineFooter($mysoc, $langs, 1, $suffix, $object); llxFooter('', 'public'); $db->close();