本文整理汇总了PHP中FWValidator类的典型用法代码示例。如果您正苦于以下问题:PHP FWValidator类的具体用法?PHP FWValidator怎么用?PHP FWValidator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FWValidator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: handleRequest
/**
* @override
*/
public function handleRequest()
{
// HTTP headers for no cache etc
header('Content-type: text/plain; charset=UTF-8');
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
// Get parameters
$chunk = isset($_REQUEST["chunk"]) ? $_REQUEST["chunk"] : 0;
$chunks = isset($_REQUEST["chunks"]) ? $_REQUEST["chunks"] : 0;
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
$fileCount = $_GET['files'];
if (\FWValidator::is_file_ending_harmless($fileName)) {
try {
$this->addChunk($fileName, $chunk, $chunks);
} catch (UploaderException $e) {
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "' . $e->getMessage() . '"}, "id" : "id"}');
}
} else {
if ($chunk == 0) {
// only count first chunk
// TODO: there must be a way to cancel the upload process on the client side
$this->addHarmfulFileToResponse($fileName);
}
}
if ($chunk == $chunks - 1) {
//upload finished
$this->handleCallback($fileCount);
}
die('{"jsonrpc" : "2.0", "result" : null, "id" : "id"}');
}
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:36,代码来源:PlUploader.class.php
示例2: handleRequest
/**
* @override
*/
public function handleRequest()
{
global $_FILES;
//get a writable directory
$targetDir = '/upload_' . $this->uploadId;
$tempPath = $_SESSION->getTempPath();
$webTempPath = $_SESSION->getWebTempPath();
//make sure target directory exists
if (!file_exists($tempPath . $targetDir)) {
\Cx\Lib\FileSystem\FileSystem::make_folder($webTempPath . $targetDir);
}
//move all uploaded file to this upload's temp directory
foreach ($_FILES["uploaderFiles"]["error"] as $key => $error) {
if ($error == UPLOAD_ERR_OK) {
$tmpName = $_FILES["uploaderFiles"]["tmp_name"][$key];
$name = $_FILES["uploaderFiles"]["name"][$key];
if (!\FWValidator::is_file_ending_harmless($name)) {
die('Error:' . sprintf('The file %s was refused due to its file extension which is not allowed!', htmlentities($name, ENT_QUOTES, CONTREXX_CHARSET)));
}
//TODO: Uploader::addChunk does this also -> centralize in function
// remember the "raw" file name, we want to store all original
// file names in the session.
$originalFileName = $name;
// Clean the fileName for security reasons
// we're using a-zA-Z0-9 instead of \w because of the umlauts.
// linux excludes them from \w, windows includes them. we do not want different
// behaviours on different operating systems.
$name = preg_replace('/[^a-zA-Z0-9\\._-]+/', '', $name);
$originalFileNames = array();
if (isset($_SESSION['upload']['handlers'][$this->uploadId]['originalFileNames'])) {
$originalFileNames = $_SESSION['upload']['handlers'][$this->uploadId]['originalFileNames'];
}
$originalFileNames[$name] = $originalFileName;
$_SESSION['upload']['handlers'][$this->uploadId]['originalFileNames'] = $originalFileNames;
//end of TODO-region
//move file somewhere we know both the web- and normal path...
@move_uploaded_file($tmpName, ASCMS_TEMP_PATH . '/' . $name);
//...then do a safe-mode-safe (yeah) move operation
\Cx\Lib\FileSystem\FileSystem::move(ASCMS_TEMP_WEB_PATH . '/' . $name, $webTempPath . $targetDir . '/' . $name, true);
}
}
//and call back.
$this->notifyCallback();
//redirect the user where he belongs
$this->redirect();
}
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:49,代码来源:FormUploader.class.php
示例3: getDetailPage
public function getDetailPage()
{
global $_ARRAYLANG, $objDatabase;
$cx = \Cx\Core\Core\Controller\Cx::instanciate();
$file = str_replace($cx->getWebsiteOffsetPath(), '', $_GET["path"]) . $_GET["file"];
$objResult = $objDatabase->Execute("SELECT `id`, `file`, `source`, `hash`, `check`, `expiration_date` FROM " . DBPREFIX . "module_filesharing WHERE `source` = '" . contrexx_raw2db($file) . "'");
$existing = $objResult !== false && $objResult->RecordCount() > 0;
if ($_GET["switch"]) {
if ($existing) {
$objDatabase->Execute("DELETE FROM " . DBPREFIX . "module_filesharing WHERE `source` = '" . contrexx_raw2db($file) . "'");
} else {
$hash = FileSharingLib::createHash();
$check = FileSharingLib::createCheck($hash);
$source = str_replace($cx->getWebsiteOffsetPath(), '', $_GET["path"]) . $_GET["file"];
$objDatabase->Execute("INSERT INTO " . DBPREFIX . "module_filesharing (`file`, `source`, `hash`, `check`) VALUES ('" . contrexx_raw2db($source) . "', '" . contrexx_raw2db($source) . "', '" . contrexx_raw2db($hash) . "', '" . contrexx_raw2db($check) . "')");
}
$existing = !$existing;
}
if ($existing) {
$this->_objTpl->setVariable(array('FILE_STATUS' => $_ARRAYLANG["TXT_FILESHARING_SHARED"], 'FILE_STATUS_SWITCH' => $_ARRAYLANG["TXT_FILESHARING_STOP_SHARING"], 'FILE_STATUS_SWITCH_HREF' => 'index.php?cmd=Media&archive=FileSharing&act=filesharing&path=' . $_GET["path"] . '&file=' . $_GET["file"] . '&switch=1'));
$this->_objTpl->touchBlock('shared');
} else {
$this->_objTpl->setVariable(array('FILE_STATUS' => $_ARRAYLANG["TXT_FILESHARING_NOT_SHARED"], 'FILE_STATUS_SWITCH' => $_ARRAYLANG["TXT_FILESHARING_START_SHARING"], 'FILE_STATUS_SWITCH_HREF' => 'index.php?cmd=Media&archive=FileSharing&act=filesharing&path=' . $_GET["path"] . '&file=' . $_GET["file"] . '&switch=1'));
$this->_objTpl->hideBlock('shared');
}
if ($_POST["shareFiles"]) {
$emails = array();
foreach (preg_split('/[;,\\s]+/', $_POST["email"]) as $email) {
if (\FWValidator::isEmail($email)) {
$emails[] = contrexx_input2raw($email);
}
}
if (count($emails) > 0) {
FileSharingLib::sendMail($objResult->fields["id"], $_POST["subject"], $emails, $_POST["message"]);
}
} elseif ($_POST["saveExpiration"]) {
if ($_POST["expiration"]) {
$objDatabase->Execute("UPDATE " . DBPREFIX . "module_filesharing SET `expiration_date` = NULL WHERE `id` = " . $objResult->fields["id"]);
} else {
$objDatabase->Execute("UPDATE " . DBPREFIX . "module_filesharing SET `expiration_date` = '" . date('Y-m-d H:i:s', strtotime($_POST["expirationDate"])) . "' WHERE `id` = " . $objResult->fields["id"]);
}
}
$objResult = $objDatabase->Execute("SELECT `id`, `hash`, `check`, `expiration_date` FROM " . DBPREFIX . "module_filesharing WHERE `source` = '" . contrexx_raw2db($file) . "'");
$this->_objTpl->setVariable(array('FORM_ACTION' => 'index.php?cmd=Media&archive=FileSharing&act=filesharing&path=' . $_GET["path"] . '&file=' . $_GET["file"], 'FORM_METHOD' => 'POST', 'FILESHARING_INFO' => $_ARRAYLANG['TXT_FILESHARING_INFO'], 'FILESHARING_LINK_BACK_HREF' => 'index.php?cmd=Media&archive=FileSharing&path=' . $_GET["path"], 'FILESHARING_LINK_BACK' => $_ARRAYLANG['TXT_FILESHARING_LINK_BACK'], 'FILESHARING_DOWNLOAD_LINK' => $_ARRAYLANG['TXT_FILESHARING_DOWNLOAD_LINK'], 'FILE_DOWNLOAD_LINK_HREF' => FileSharingLib::getDownloadLink($objResult->fields["id"]), 'FILE_DELETE_LINK_HREF' => FileSharingLib::getDeleteLink($objResult->fields["id"]), 'FILESHARING_DELETE_LINK' => $_ARRAYLANG['TXT_FILESHARING_DELETE_LINK'], 'FILESHARING_STATUS' => $_ARRAYLANG['TXT_FILESHARING_STATUS'], 'FILESHARING_EXPIRATION' => $_ARRAYLANG['TXT_FILESHARING_EXPIRATION'], 'FILESHARING_NEVER' => $_ARRAYLANG['TXT_FILESHARING_NEVER'], 'FILESHARING_EXPIRATION_CHECKED' => htmlentities($objResult->fields["expiration_date"] == NULL ? 'checked="checked"' : '', ENT_QUOTES, CONTREXX_CHARSET), 'FILESHARING_EXPIRATION_DATE' => htmlentities($objResult->fields["expiration_date"] != NULL ? date('d.m.Y H:i', strtotime($objResult->fields["expiration_date"])) : date('d.m.Y H:i', time() + 3600 * 24 * 7), ENT_QUOTES, CONTREXX_CHARSET), 'FILESHARING_SEND_MAIL' => $_ARRAYLANG['TXT_FILESHARING_SEND_MAIL'], 'FILESHARING_EMAIL' => $_ARRAYLANG["TXT_FILESHARING_EMAIL"], 'FILESHARING_EMAIL_INFO' => $_ARRAYLANG["TXT_FILESHARING_EMAIL_INFO"], 'FILESHARING_SUBJECT' => $_ARRAYLANG["TXT_FILESHARING_SUBJECT"], 'FILESHARING_SUBJECT_INFO' => $_ARRAYLANG["TXT_FILESHARING_SUBJECT_INFO"], 'FILESHARING_MESSAGE' => $_ARRAYLANG["TXT_FILESHARING_MESSAGE"], 'FILESHARING_MESSAGE_INFO' => $_ARRAYLANG["TXT_FILESHARING_MESSAGE_INFO"], 'FILESHARING_SEND' => $_ARRAYLANG["TXT_FILESHARING_SEND"], 'FILESHARING_SAVE' => $_ARRAYLANG["TXT_FILESHARING_SAVE"], 'TXT_CORE_MAILTEMPLATE_NOTE_TO' => $_ARRAYLANG['TXT_CORE_MAILTEMPLATE_NOTE_TO']));
}
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:45,代码来源:FileSharingManager.class.php
示例4: handleRequest
/**
* @override
*/
public function handleRequest()
{
// Get parameters
$chunk = $_POST['partitionIndex'];
$chunks = $_POST['partitionCount'];
$fileName = contrexx_stripslashes($_FILES['file']['name']);
$fileCount = $_GET['files'];
// check if the file has a valid file extension
if (\FWValidator::is_file_ending_harmless($fileName)) {
try {
$this->addChunk($fileName, $chunk, $chunks);
} catch (UploaderException $e) {
die('Error:' . $e->getMessage());
}
if ($chunk == $chunks - 1) {
//upload of current file finished
$this->handleCallback($fileCount);
}
} else {
$this->addHarmfulFileToResponse($fileName);
}
die(0);
}
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:26,代码来源:JumpUploader.class.php
示例5: sendMail
/**
* Sends an email with the contact details to the responsible persons
*
* This methode sends an email to all email addresses that are defined in the
* option "Receiver address(es)" of the requested contact form.
* @access private
* @global array
* @global array
* @param array Details of the contact request
* @see _getEmailAdressOfString(), phpmailer::From, phpmailer::FromName, phpmailer::AddReplyTo(), phpmailer::Subject, phpmailer::IsHTML(), phpmailer::Body, phpmailer::AddAddress(), phpmailer::Send(), phpmailer::ClearAddresses()
*/
private function sendMail($arrFormData)
{
global $_ARRAYLANG, $_CONFIG;
$plaintextBody = '';
$replyAddress = '';
$firstname = '';
$lastname = '';
$senderName = '';
$isHtml = $arrFormData['htmlMail'] == 1 ? true : false;
// stop send process in case no real data had been submitted
if (!isset($arrFormData['data']) && !isset($arrFormData['uploadedFiles'])) {
return false;
}
// check if we shall send the email as multipart (text/html)
if ($isHtml) {
// setup html mail template
$objTemplate = new \Cx\Core\Html\Sigma('.');
$objTemplate->setErrorHandling(PEAR_ERROR_DIE);
$objTemplate->setTemplate($arrFormData['mailTemplate']);
$objTemplate->setVariable(array('DATE' => date(ASCMS_DATE_FORMAT, $arrFormData['meta']['time']), 'HOSTNAME' => contrexx_raw2xhtml($arrFormData['meta']['host']), 'IP_ADDRESS' => contrexx_raw2xhtml($arrFormData['meta']['ipaddress']), 'BROWSER_LANGUAGE' => contrexx_raw2xhtml($arrFormData['meta']['lang']), 'BROWSER_VERSION' => contrexx_raw2xhtml($arrFormData['meta']['browser'])));
}
// TODO: check if we have to excape $arrRecipients later in the code
$arrRecipients = $this->getRecipients(intval($_GET['cmd']));
// calculate the longest field label.
// this will be used to correctly align all user submitted data in the plaintext e-mail
// TODO: check if the label of upload-fields are taken into account as well
$maxlength = 0;
foreach ($arrFormData['fields'] as $arrField) {
$length = strlen($arrField['lang'][FRONTEND_LANG_ID]['name']);
$maxlength = $maxlength < $length ? $length : $maxlength;
}
// try to fetch a user submitted e-mail address to which we will send a copy to
if (!empty($arrFormData['fields'])) {
foreach ($arrFormData['fields'] as $fieldId => $arrField) {
// check if field validation is set to e-mail
if ($arrField['check_type'] == '2') {
$mail = trim($arrFormData['data'][$fieldId]);
if (\FWValidator::isEmail($mail)) {
$replyAddress = $mail;
break;
}
}
if ($arrField['type'] == 'special') {
switch ($arrField['special_type']) {
case 'access_firstname':
$firstname = trim($arrFormData['data'][$fieldId]);
break;
case 'access_lastname':
$lastname = trim($arrFormData['data'][$fieldId]);
break;
default:
break;
}
}
}
}
if ($arrFormData['useEmailOfSender'] == 1 && (!empty($firstname) || !empty($lastname))) {
$senderName = trim($firstname . ' ' . $lastname);
} else {
$senderName = $_CONFIG['coreGlobalPageTitle'];
}
// a recipient mail address which has been picked by sender
$chosenMailRecipient = null;
// fill the html and plaintext body with the submitted form data
foreach ($arrFormData['fields'] as $fieldId => $arrField) {
if ($fieldId == 'unique_id') {
//generated for uploader. no interesting mail content.
continue;
}
$htmlValue = '';
$plaintextValue = '';
$textAreaKeys = array();
switch ($arrField['type']) {
case 'label':
case 'fieldset':
// TODO: parse TH row instead
// TODO: parse TH row instead
case 'horizontalLine':
// TODO: add visual horizontal line
// we need to use a 'continue 2' here to first break out of the switch and then move over to the next iteration of the foreach loop
continue 2;
break;
case 'file':
case 'multi_file':
$htmlValue = "";
$plaintextValue = "";
if (isset($arrFormData['uploadedFiles'][$fieldId])) {
$htmlValue = "<ul>";
foreach ($arrFormData['uploadedFiles'][$fieldId] as $file) {
//.........这里部分代码省略.........
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:101,代码来源:Contact.class.php
示例6: getCurrencyIdByCrmId
/**
* Get currencyId by crm id
*
* @param integer $crmId crm id
*
* @return mixed null or currencyId
*/
public static function getCurrencyIdByCrmId($crmId)
{
if (\FWValidator::isEmpty($crmId)) {
return null;
}
$db = \Env::get('cx')->getDb()->getAdoDb();
$currencyId = $db->GetOne("SELECT `customer_currency` FROM `" . DBPREFIX . "module_crm_contacts` WHERE `id` = " . intval($crmId));
return $currencyId;
}
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:16,代码来源:CrmLibrary.class.php
示例7: createOrder
/**
* Create a new Order
*
* @param integer $productId productId
* @param object $objUser \User object
* @param string $transactionReference transactionReference
* @param array $subscriptionOptions subscriptionOptions
*
* @return boolean
* @throws OrderRepositoryException
*/
public function createOrder($productId, \Cx\Modules\Crm\Model\Entity\Currency $currency, \User $objUser, $transactionReference, $subscriptionOptions = array())
{
if (\FWValidator::isEmpty($productId) || \FWValidator::isEmpty($subscriptionOptions) || \FWValidator::isEmpty($transactionReference) || \FWValidator::isEmpty($currency)) {
return;
}
$contactId = $objUser->getCrmUserId();
if (\FWValidator::isEmpty($contactId)) {
return;
}
try {
$order = new \Cx\Modules\Order\Model\Entity\Order();
$order->setContactId($contactId);
$order->setCurrency($currency);
$productRepository = \Env::get('em')->getRepository('Cx\\Modules\\Pim\\Model\\Entity\\Product');
$product = $productRepository->findOneBy(array('id' => $productId));
//create subscription
$subscription = $order->createSubscription($product, $subscriptionOptions);
// set discount price for first payment period of subscription
if (!empty($subscriptionOptions['oneTimeSalePrice'])) {
$subscription->setPaymentAmount($subscriptionOptions['oneTimeSalePrice']);
}
$order->billSubscriptions();
$invoices = $order->getInvoices();
if (!empty($invoices)) {
\DBG::msg(__METHOD__ . ": order has invoices");
$paymentRepo = \Env::get('em')->getRepository('\\Cx\\Modules\\Order\\Model\\Entity\\Payment');
foreach ($invoices as $invoice) {
if (!$invoice->getPaid()) {
\DBG::msg(__METHOD__ . ": lookup payment with transaction-reference {$transactionReference} and amount " . $invoice->getAmount());
$payment = $paymentRepo->findOneByCriteria(array('amount' => $invoice->getAmount(), 'transactionReference' => $transactionReference, 'invoice' => null));
if ($payment) {
\DBG::msg(__METHOD__ . ": payment found");
//set subscription-id to Subscription::$externalSubscriptionId
if ($subscription) {
\DBG::msg(__METHOD__ . ": trying to link to new subscription to the external subscription ID");
$referenceArry = explode('|', $payment->getTransactionReference());
if (isset($referenceArry[4]) && !empty($referenceArry[4])) {
$subscription->setExternalSubscriptionId($referenceArry[4]);
}
}
$transactionData = $payment->getTransactionData();
if (!\FWValidator::isEmpty($transactionData) && isset($transactionData['contact']) && isset($transactionData['contact']['id'])) {
\DBG::msg(__METHOD__ . ": set externalPaymentCustomerIdProfileAttributeId of user to " . $transactionData['contact']['id']);
$objUser->setProfile(array(\Cx\Core\Setting\Controller\Setting::getValue('externalPaymentCustomerIdProfileAttributeId', 'MultiSite') => array(0 => $transactionData['contact']['id'])), true);
if (!$objUser->store()) {
\DBG::msg('Order::createOrder() Updating user failed: ' . $objUser->getErrorMsg());
}
}
$invoice->addPayment($payment);
$payment->setInvoice($invoice);
\Env::get('em')->persist($invoice);
\Env::get('em')->persist($payment);
break;
}
}
}
}
\Env::get('em')->persist($order);
\Env::get('em')->flush();
return $order;
} catch (\Exception $e) {
throw new OrderRepositoryException($e->getMessage());
}
}
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:75,代码来源:OrderRepository.class.php
示例8: uploadPage
/**
* creates the upload page for the frontend
*/
private function uploadPage()
{
global $_ARRAYLANG, $objDatabase, $_CONFIG;
$params = $this->objUrl->getParamArray();
// the upload is finished and the script has to send a mail and assign the expiration dates
if (!empty($this->files) && $_POST["accept_terms"]) {
// set expiration time
$cmd = \Env::get("Resolver")->getCmd();
if ($cmd != "downloads") {
$expiration_date = date("Y-m-d H:i:s", time() + $_POST["expiration"]);
$objDatabase->Execute("UPDATE " . DBPREFIX . "module_filesharing SET `expiration_date` = '" . contrexx_raw2db($expiration_date) . "' WHERE `upload_id` = '" . intval($params["uploadId"]) . "'");
}
// send the mail to the reciever
if (\FWValidator::isEmail($_POST["email"])) {
parent::sendMail($params["uploadId"], $_POST["subject"], array($_POST["email"]), $_POST["message"]);
}
// send the mail to the administrator
parent::sendMail($params["uploadId"], null, array($_CONFIG['coreAdminEmail']), $_POST["message"]);
// reset the upload id so the uploads are invisible now
$objDatabase->Execute("UPDATE " . DBPREFIX . "module_filesharing SET `upload_id` = NULL WHERE `upload_id` = " . intval($params["uploadId"]));
$this->getFileList();
} else {
$this->getForm();
}
// set the template-variables for the expiration dates
foreach ($_ARRAYLANG["TXT_FILESHARING_EXPIRATION_DATES"] as $placeholder => $value) {
$this->objTemplate->setVariable(strtoupper($placeholder), $value);
}
}
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:32,代码来源:FileSharing.class.php
示例9: fetchSubmittedData
private function fetchSubmittedData()
{
// set default values
$data['newsText'] = '';
$data['newsTeaserText'] = '';
$data['newsTitle'] = '';
$data['newsRedirect'] = 'http://';
$data['newsSource'] = 'http://';
$data['newsUrl1'] = 'http://';
$data['newsUrl2'] = 'http://';
$data['newsCat'] = '';
$data['newsType'] = '';
$data['newsTypeRedirect'] = 0;
if (!isset($_POST['submitNews'])) {
return array(false, $data);
}
$objValidator = new \FWValidator();
// set POST data
$data['newsTitle'] = contrexx_input2raw(html_entity_decode($_POST['newsTitle'], ENT_QUOTES, CONTREXX_CHARSET));
$data['newsTeaserText'] = contrexx_input2raw(html_entity_decode($_POST['newsTeaserText'], ENT_QUOTES, CONTREXX_CHARSET));
$data['newsRedirect'] = $objValidator->getUrl(contrexx_input2raw(html_entity_decode($_POST['newsRedirect'], ENT_QUOTES, CONTREXX_CHARSET)));
$data['newsText'] = contrexx_remove_script_tags($this->filterBodyTag(contrexx_input2raw(html_entity_decode($_POST['newsText'], ENT_QUOTES, CONTREXX_CHARSET))));
$data['newsSource'] = $objValidator->getUrl(contrexx_input2raw(html_entity_decode($_POST['newsSource'], ENT_QUOTES, CONTREXX_CHARSET)));
$data['newsUrl1'] = $objValidator->getUrl(contrexx_input2raw(html_entity_decode($_POST['newsUrl1'], ENT_QUOTES, CONTREXX_CHARSET)));
$data['newsUrl2'] = $objValidator->getUrl(contrexx_input2raw(html_entity_decode($_POST['newsUrl2'], ENT_QUOTES, CONTREXX_CHARSET)));
$data['newsCat'] = !empty($_POST['newsCat']) ? contrexx_input2raw($_POST['newsCat']) : array();
$data['newsType'] = !empty($_POST['newsType']) ? intval($_POST['newsType']) : 0;
$data['newsTypeRedirect'] = !empty($_POST['newsTypeRedirect']) ? true : false;
$data['enableRelatedNews'] = !empty($this->arrSettings['use_related_news']) ? 1 : 0;
$data['relatedNews'] = !empty($_POST['relatedNews']) ? contrexx_input2raw($_POST['relatedNews']) : array();
$data['enableTags'] = !empty($this->arrSettings['news_use_tags']) ? 1 : 0;
$data['newsTags'] = !empty($_POST['newsTags']) ? contrexx_input2raw($_POST['newsTags']) : array();
return array(true, $data);
}
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:34,代码来源:News.class.php
示例10: saveCam
/**
* Save the cam's settings
*
*/
function saveCam()
{
global $objDatabase;
$id = intval($_POST['id']);
if (!$id) {
return false;
}
$currentImagePath = \Cx\Lib\FileSystem\FileSystem::sanitizePath(contrexx_input2raw($_POST['currentImagePath']));
if (!\FWValidator::isUri($currentImagePath) && strpos($currentImagePath, '/') !== 0) {
$currentImagePath = '/' . $currentImagePath;
}
$maxImageWidth = intval($_POST['maxImageWidth']);
$archivePath = \Cx\Lib\FileSystem\FileSystem::sanitizePath(contrexx_input2raw($_POST['archivePath']));
if (!\FWValidator::isUri($archivePath) && strpos($archivePath, '/') !== 0) {
$archivePath = '/' . $archivePath;
}
$thumbnailPath = \Cx\Lib\FileSystem\FileSystem::sanitizePath(contrexx_input2raw($_POST['thumbnailPath']));
if (!\FWValidator::isUri($thumbnailPath) && strpos($thumbnailPath, '/') !== 0) {
$thumbnailPath = '/' . $thumbnailPath;
}
$thumbMaxSize = intval($_POST['thumbMaxSize']);
$shadowboxActivate = intval($_POST['shadowboxActivate']);
$hourFrom = intval($_POST['hourFrom']);
$hourTill = intval($_POST['hourTill']);
$minuteFrom = intval($_POST['minuteFrom']);
$minuteTill = intval($_POST['minuteTill']);
$showFrom = mktime($hourFrom, $minuteFrom);
$showTill = mktime($hourTill, $minuteTill);
$query = " UPDATE " . DBPREFIX . "module_livecam\n SET currentImagePath = '" . contrexx_raw2db($currentImagePath) . "',\n maxImageWidth = " . $maxImageWidth . ",\n archivePath = '" . contrexx_raw2db($archivePath) . "',\n thumbnailPath = '" . contrexx_raw2db($thumbnailPath) . "',\n thumbMaxSize = " . $thumbMaxSize . ",\n shadowboxActivate = '" . $shadowboxActivate . "',\n showFrom = {$showFrom},\n showTill = {$showTill}\n WHERE id = " . $id;
if ($objDatabase->Execute($query) === false) {
// return a 500 or so
header("HTTP/1.0 500 Internal Server Error");
die;
}
die;
}
开发者ID:Niggu,项目名称:cloudrexx,代码行数:40,代码来源:LivecamManager.class.php
示例11: isEmail
/**
* Validate an E-mail address
*
* @param string unvalidated email string
* @return boolean
* @access public
*/
function isEmail($email)
{
require_once ASCMS_FRAMEWORK_PATH . '/Validator.class.php';
return FWValidator::isEmail($email);
}
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:12,代码来源:common.class.php
示例12: terminateExpiredSubscriptions
/**
* Terminate expired Subscriptions
*
* This method does call the method Subscription::terminate() on all Subscriptions
* that are expired (Subscription::$expirationDate < now), but are still
* active (Subscription::$state = active) or have been cancelled (Subscription::$state = cancelled).
* Expired Subscriptions that are inactive (Subscription::$state = inactive) are not
* terminated as long as they are inactive. This allows a Subscription to be re-activated
* and resetting a new expiration date without having the Subscription automatically
* being terminated.
*/
public function terminateExpiredSubscriptions()
{
$subscriptionRepo = \Env::get('em')->getRepository('Cx\\Modules\\Order\\Model\\Entity\\Subscription');
$subscriptions = $subscriptionRepo->getExpiredSubscriptions(array(\Cx\Modules\Order\Model\Entity\Subscription::STATE_ACTIVE, \Cx\Modules\Order\Model\Entity\Subscription::STATE_CANCELLED));
if (\FWValidator::isEmpty($subscriptions)) {
return;
}
foreach ($subscriptions as $subscription) {
$subscription->terminate();
}
\Env::get('em')->flush();
}
开发者ID:hbdsklf,项目名称:LimeCMS,代码行数:23,代码来源:ComponentController.class.php
示例13: getParsedUserLink
/**
* Get the user details link
*
* @param mixed $user \User or
* \Cx\Core\User\Model\Entity\User or
* $userId (Id of a user)
*
* @return string Returns the parsed user detail link(crm and access)
*/
public static function getParsedUserLink($user)
{
global $_CORELANG;
if ($user instanceof \Cx\Core\User\Model\Entity\User) {
$user = self::getFWUserObject()->objUser->getUser($user->getId());
}
if (!is_object($user)) {
$user = self::getFWUserObject()->objUser->getUser($user);
}
if (!$user instanceof \User) {
return '';
}
$crmDetailImg = '';
if (!\FWValidator::isEmpty($user->getCrmUserId())) {
$crmDetailImg = "<a href='index.php?cmd=Crm&act=customers&tpl=showcustdetail&id={$user->getCrmUserId()}'\n title='{$_CORELANG['TXT_CORE_EDIT_USER_CRM_ACCOUNT']}'>\n <img\n src='../core/Core/View/Media/navigation_level_1_189.png'\n width='16' height='16'\n alt='{$_CORELANG['TXT_CORE_EDIT_USER_CRM_ACCOUNT']}'\n />\n </a>";
}
return "<a href='index.php?cmd=Access&act=user&tpl=modify&id={$user->getId()}'\n title='{$_CORELANG['TXT_EDIT_USER_ACCOUNT']}'>" . self::getParsedUserTitle($user) . "</a>" . $crmDetailImg;
}
开发者ID:hbdsklf,项目名称:LimeCMS,代码行数:27,代码来源:FWUser.class.php
示例14: send
function send()
{
global $objDatabase, $_ARRAYLANG, $_CONFIG;
$this->_objTpl->setTemplate($this->pageContent);
// Initialize variables
$code = substr(md5(rand()), 1, 10);
$url = \Cx\Core\Routing\Url::fromModuleAndCmd('Ecard', 'show', '', array('code' => $code))->toString();
// Initialize POST variables
$id = intval($_POST['selectedEcard']);
$message = contrexx_addslashes($_POST['ecardMessage']);
$recipientSalutation = contrexx_stripslashes($_POST['ecardRecipientSalutation']);
$senderName = contrexx_stripslashes($_POST['ecardSenderName']);
$senderEmail = \FWValidator::isEmail($_POST['ecardSenderEmail']) ? $_POST['ecardSenderEmail'] : '';
$recipientName = contrexx_stripslashes($_POST['ecardRecipientName']);
$recipientEmail = \FWValidator::isEmail($_POST['ecardRecipientEmail']) ? $_POST['ecardRecipientEmail'] : '';
if (empty($senderEmail) || empty($recipientEmail)) {
$this->_objTpl->setVariable(array('STATUS_MESSAGE' => $_ARRAYLANG['TXT_ECARD_SENDING_ERROR']));
return false;
}
$query = "\n SELECT `setting_name`, `setting_value`\n FROM " . DBPREFIX . "module_ecard_settings";
$objResult = $objDatabase->Execute($query);
while (!$objResult->EOF) {
switch ($objResult->fields['setting_name']) {
case 'validdays':
$validdays = $objResult->fields['setting_value'];
break;
// Never used
// case 'greetings':
// $greetings = $objResult->fields['setting_value'];
// break;
// Never used
// case 'greetings':
// $greetings = $objResult->fields['setting_value'];
// break;
case 'subject':
$subject = $objResult->fields['setting_value'];
break;
case 'emailText':
$emailText = strip_tags($objResult->fields['setting_value']);
break;
}
$objResult->MoveNext();
}
$timeToLife = $validdays * 86400;
// Replace placeholders with used in notification mail with user data
$emailText = str_replace('[[ECARD_RECIPIENT_SALUTATION]]', $recipientSalutation, $emailText);
$emailText = str_replace('[[ECARD_RECIPIENT_NAME]]', $recipientName, $emailText);
$emailText = str_replace('[[ECARD_RECIPIENT_EMAIL]]', $recipientEmail, $emailText);
$emailText = str_replace('[[ECARD_SENDER_NAME]]', $senderName, $emailText);
$emailText = str_replace('[[ECARD_SENDER_EMAIL]]', $senderEmail, $emailText);
$emailText = str_replace('[[ECARD_VALID_DAYS]]', $validdays, $emailText);
$emailText = str_replace('[[ECARD_URL]]', $url, $emailText);
$body = $emailText;
// Insert ecard to DB
$query = "\n INSERT INTO `" . DBPREFIX . "module_ecard_ecards` (\n code, date, TTL, salutation,\n senderName, senderEmail,\n recipientName, recipientEmail,\n message\n ) VALUES (\n '" . $code . "',\n '" . time() . "',\n '" . $timeToLife . "',\n '" . addslashes($recipientSalutation) . "',\n '" . addslashes($senderName) . "',\n '" . $senderEmail . "',\n '" . addslashes($recipientName) . "',\n '" . $recipientEmail . "',\n '" . $message . "');";
if ($objDatabase->Execute($query)) {
$query = "\n SELECT setting_value\n FROM " . DBPREFIX . "module_ecard_settings\n WHERE setting_name='motive_{$id}'";
$objResult = $objDatabase->SelectLimit($query, 1);
// Copy motive to new file with $code as filename
$fileExtension = preg_replace('/^.+(\\.[^\\.]+)$/', '$1', $objResult->fields['setting_value']);
$fileName = $objResult->fields['setting_value'];
$objFile = new \File();
if ($objFile->copyFile(ASCMS_ECARD_OPTIMIZED_PATH . '/', $fileName, ASCMS_ECARD_SEND_ECARDS_PATH . '/', $code . $fileExtension)) {
$objMail = new \phpmailer();
// Check e-mail settings
if ($_CONFIG['coreSmtpServer'] > 0 && @(include_once ASCMS_CORE_PATH . '/SmtpSettings.class.php')) {
$objSmtpSettings = new \SmtpSettings();
if (($arrSmtp = $objSmtpSettings->getSmtpAccount($_CONFIG['coreSmtpServer'])) !== false) {
$objMail->IsSMTP();
$objMail->Host = $arrSmtp['hostname'];
$objMail->Port = $arrSmtp['port'];
$objMail->SMTPAuth = true;
$objMail->Username = $arrSmtp['username'];
$objMail->Password = $arrSmtp['password'];
}
}
// Send notification mail to ecard-recipient
$objMail->CharSet = CONTREXX_CHARSET;
$objMail->SetFrom($senderEmail, $senderName);
$objMail->Subject = $subject;
$objMail->IsHTML(false);
$objMail->Body = $body;
$objMail->AddAddress($recipientEmail);
if ($objMail->Send()) {
$this->_objTpl->setVariable(array('STATUS_MESSAGE' => $_ARRAYLANG['TXT_ECARD_HAS_BEEN_SENT']));
} else {
$this->_objTpl->setVariable(array('STATUS_MESSAGE' => $_ARRAYLANG['TXT_ECARD_MAIL_SENDING_ERROR']));
}
}
} else {
$this->_objTpl->setVariable(array('STATUS_MESSAGE' => $_ARRAYLANG['TXT_ECARD_SENDING_ERROR']));
}
}
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:93,代码来源:Ecard.class.php
示例15: showEventList
/**
* Sets the placeholders used for the event list view
*
* @param object $objTpl Template object
* @param integer $type Event type
*
* @return null
*/
function showEventList($objTpl, $type = '')
{
global $objInit, $_ARRAYLANG, $_LANGID;
$this->getFrontendLanguages();
//if($objInit->mode == 'backend') {
$i = 0;
foreach ($this->eventList as $key => $objEvent) {
$objCategory = new \Cx\Modules\Calendar\Controller\CalendarCategory(intval($objEvent->catId));
$showIn = explode(",", $objEvent->showIn);
$languages = '';
if (count(\FWLanguage::getActiveFrontendLanguages()) > 1) {
$langState = array();
foreach ($this->arrFrontendLanguages as $langKey => $arrLang) {
if (in_array($arrLang['id'], $showIn)) {
$langState[$langKey] = 'active';
}
}
$languages = \Html::getLanguageIcons($langState, 'index.php?cmd=Calendar&act=modify_event&id=' . $objEvent->id . '&langId=%1$d' . ($type == 'confirm' ? "&confirm=1" : ""));
if ($type == 'confirm' && $objTpl->blockExists('txt_languages_block_confirm_list')) {
$objTpl->touchBlock('txt_languages_block_confirm_list');
} elseif ($objTpl->blockExists('txt_languages_block')) {
$objTpl->touchBlock('txt_languages_block');
}
} else {
if ($type == 'confirm' && $objTpl->blockExists('txt_languages_block_confirm_list')) {
$objTpl->hideBlock('txt_languages_block_confirm_list');
} elseif ($objTpl->blockExists('txt_languages_block')) {
$objTpl->hideBlock('txt_languages_block');
}
}
list($priority, $priorityImg) = $this->getPriorityImage($objEvent);
$plainDescription = contrexx_html2plaintext($objEvent->description);
if (strlen($plainDescription) > 100) {
$points = '...';
} else {
$points = '';
}
$parts = explode("\n", wordwrap($plainDescription, 100, "\n"));
$attachNamePos = strrpos($objEvent->attach, '/');
$attachNamelength = strlen($objEvent->attach);
$attachName = substr($objEvent->attach, $attachNamePos + 1, $attachNamelength);
$hostUri = '';
$hostTarget = '';
if ($objEvent->external) {
$objHost = new \Cx\Modules\Calendar\Controller\CalendarHost($objEvent->hostId);
if (substr($objHost->uri, -1) != '/') {
$hostUri = $objHost->uri . '/';
} else {
$hostUri = $objHost->uri;
}
if (substr($hostUri, 0, 7) != 'http://') {
$hostUri = "http://" . $hostUri;
}
$hostTarget = 'target="_blank"';
}
$copyLink = '';
if ($objInit->mode == 'backend') {
$editLink = 'index.php?cmd=' . $this->moduleName . '&act=modify_event&id=' . $objEvent->id . ($type == 'confirm' ? "&confirm=1" : "");
$copyLink = $editLink . "&copy=1";
} else {
$editLink = CONTREXX_DIRECTORY_INDEX . '?section=' . $this->moduleName . '&cmd=edit&id=' . $objEvent->id;
}
$picThumb = file_exists(\Env::get('cx')->getWebsitePath() . "{$objEvent->pic}.thumb") ? "{$objEvent->pic}.thumb" : ($objEvent->pic != '' ? $objEvent->pic : '');
$placeWebsite = $objEvent->place_website != '' ? "<a href='" . $objEvent->place_website . "' target='_blank' >" . $objEvent->place_website . "</a>" : "";
$placeWebsiteSource = $objEvent->place_website;
$placeLink = $objEvent->place_link != '' ? "<a href='" . $objEvent->place_link . "' target='_blank' >" . $objEvent->place_link . "</a>" : "";
$placeLinkSource = $objEvent->place_link;
if ($this->arrSettings['placeData'] > 1 && $objEvent->locationType == 2) {
$objEvent->loadPlaceFromMediadir($objEvent->place_mediadir_id, 'place');
list($placeLink, $placeLinkSource) = $objEvent->loadPlaceLinkFromMediadir($objEvent->place_mediadir_id, 'place');
}
$hostWebsite = $objEvent->org_website != '' ? "<a href='" . $objEvent->org_website . "' target='_blank' >" . $objEvent->org_website . "</a>" : "";
$hostWebsiteSource = $objEvent->org_website;
$hostLink = $objEvent->org_link != '' ? "<a href='" . $objEvent->org_link . "' target='_blank' >" . $objEvent->org_link . "</a>" : "";
$hostLinkSource = $objEvent->org_link;
if ($this->arrSettings['placeDataHost'] > 1 && $objEvent->hostType == 2) {
$objEvent->loadPlaceFromMediadir($objEvent->host_mediadir_id, 'host');
list($hostLink, $hostLinkSource) = $objEvent->loadPlaceLinkFromMediadir($objEvent->host_mediadir_id, 'host');
}
$startDate = $objEvent->startDate;
$endDate = $objEvent->endDate;
if ($objEvent->numSubscriber) {
$freeSeats = \FWValidator::isEmpty($objEvent->getFreePlaces()) ? '0 (' . $_ARRAYLANG['TXT_CALENDAR_SAVE_IN_WAITLIST'] . ')' : $objEvent->getFreePlaces();
} else {
$freeSeats = $_ARRAYLANG['TXT_CALENDAR_YES'];
}
if (in_array($objEvent->registration, array(CalendarEvent::EVENT_REGISTRATION_NONE, CalendarEvent::EVENT_REGISTRATION_EXTERNAL))) {
$freeSeats = $_ARRAYLANG['TXT_CALENDAR_NOT_SPECIFIED'];
}
$objTpl->setVariable(array($this->moduleLangVar . '_EVENT_ROW' => $i % 2 == 0 ? 'row1' : 'row2', $this->moduleLangVar . '_EVENT_LED' => $objEvent->status == 0 ? 'red' : 'green', $this->moduleLangVar . '_EVENT_STATUS' => $objEvent->status == 0 ? $_ARRAYLANG['TXT_CALENDAR_INACTIVE'] : $_ARRAYLANG['TXT_CALENDAR_ACTIVE'], $this->moduleLangVar . '_EVENT_ID' => $objEvent->id, $this->moduleLangVar . '_EVENT_TITLE' => $objEvent->title, $this->moduleLangVar . '_EVENT_TEASER' => $objEvent->teaser, $this->moduleLangVar . '_E
|
请发表评论