本文整理汇总了PHP中isc_strtoupper函数的典型用法代码示例。如果您正苦于以下问题:PHP isc_strtoupper函数的具体用法?PHP isc_strtoupper怎么用?PHP isc_strtoupper使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isc_strtoupper函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildOutput
/**
* Output the service XML
*
* Method will construct the XML string using the information stored in $this->xmlNode and return the XML string
*
* @access protected
* @param bool $isQuery TRUE if this service is a query, FALSE if not (add, mod, etc). Default is FALSE
* @return string The constructed XML string
*/
protected function buildOutput($isQuery = false)
{
/**
* Add the replacement for the client's qbXML version
*/
$clientVersion = $this->quickbooks->getAccountingSessionKey('QBXML_VERSION');
$clientCountry = $this->quickbooks->getAccountingSessionKey('CLIENT_COUNTRY');
/**
* If this version 2-3 and where are UK/CA then we need to prepend the country code in the version
*/
if ((isc_strtolower($clientCountry) == "uk" || isc_strtolower($clientCountry) == "ca") && version_compare($clientVersion, "3.0") !== 1) {
$version = isc_strtoupper($clientCountry) . (string) $clientVersion;
} else {
$version = (string) $clientVersion;
}
$GLOBALS['VersionNo'] = $version;
$GLOBALS['EntityType'] = $this->data->service;
$GLOBALS['EntityXML'] = $this->xmlNode->outputMemory(true);
$xml = $this->quickbooks->ParseTemplate('module.quickbooks.qbxml', true);
/**
* If this is a query then remove the <$this->data->service> tags. Why can't everything be the same
*/
if ($isQuery) {
$xml = str_replace('<' . $this->data->service . '>', '', $xml);
$xml = str_replace('</' . $this->data->service . '>', '', $xml);
}
return $xml;
}
示例2: GenerateLogo
public function GenerateLogo()
{
$this->NewLogo($this->FileType); // defaults to png. can use jpg or gif as well
$this->FontPath = dirname(__FILE__) . '/fonts/';
$imageHeight = 50;
$textLeft = 0;
$textSize = 28;
// we need the height of the text box to position the image and then caculate the text position
$t_box = $this->TextBox($this->Text[0], 'ITCAvantGardeStd-Bold.otf', '4e4e42', $textSize, 0, 0);
// determine the y position for the text
$y_pos = 8+(($imageHeight - $t_box['height'])/2);
if(strlen($this->Text[0]) > 0) {
// AddText() - text, font, fontcolor, fontSize (pt), x, y, center on this width
$this->Text[0] = isc_strtoupper($this->Text[0]);
$text_position = $this->AddText($this->Text[0], 'ITCAvantGardeStd-Bold.otf', 'ffffff', $textSize, $textLeft-1, $y_pos-1);
$text_position = $this->AddText($this->Text[0], 'ITCAvantGardeStd-Bold.otf', 'ffffff', $textSize, $textLeft-1, $y_pos+1);
$text_position = $this->AddText($this->Text[0], 'ITCAvantGardeStd-Bold.otf', 'ffffff', $textSize, $textLeft+1, $y_pos-1);
$text_position = $this->AddText($this->Text[0], 'ITCAvantGardeStd-Bold.otf', 'ffffff', $textSize, $textLeft+1, $y_pos+1);
$text_position = $this->AddText($this->Text[0], 'ITCAvantGardeStd-Bold.otf', '4e4e42', $textSize, $textLeft, $y_pos);
}
if(strlen($this->Text[1]) > 0) {
$this->Text[1] = isc_strtoupper($this->Text[1]);
// put in our second bit of text
$left = $text_position['top_right_x']+10;
$text_position2 = $this->AddText($this->Text[1], 'ITCAvantGardeStd-Bold.otf', 'ffffff', $textSize, $left-1, $y_pos-1);
$text_position2 = $this->AddText($this->Text[1], 'ITCAvantGardeStd-Bold.otf', 'ffffff', $textSize, $left-1, $y_pos+1);
$text_position2 = $this->AddText($this->Text[1], 'ITCAvantGardeStd-Bold.otf', 'ffffff', $textSize, $left+1, $y_pos-1);
$text_position2 = $this->AddText($this->Text[1], 'ITCAvantGardeStd-Bold.otf', 'ffffff', $textSize, $left+1, $y_pos+1);
$text_position2 = $this->AddText($this->Text[1], 'ITCAvantGardeStd-Bold.otf', 'a88b67', $textSize, $left, $y_pos);
$top_right = $text_position2['top_right_x'];
}
else {
$top_right = $text_position['top_right_x'];
}
$this->TransparentBackground = true;
$this->SetImageSize($top_right+20, $imageHeight);
$this->CropImage = true;
return $this->MakeLogo();
}
示例3: includeFormFieldCode
/**
* Include the form field code file
*
* Method will include (once) the form field code file
*
* @access private
* @param string $fieldType The field type to include
* @return string The class name of the field class if the code source file was found and
* included successfully, FALSE if not
*/
private function includeFormFieldCode($fieldType)
{
$typeToLower = isc_strtolower($fieldType);
if ($typeToLower == '' || $typeToLower == 'base' || preg_match('/[^a-z]+/', $typeToLower)) {
return false;
}
$filepath = $this->fieldPath . '/formfield.' . $typeToLower . '.php';
if (!file_exists($filepath) || !is_file($filepath)) {
return false;
}
$className = "ISC_FORMFIELD_" . isc_strtoupper($fieldType);
if (!class_exists($className)) {
include_once $filepath;
}
return $className;
}
示例4: _ImportStep2
/**
* Generic second step of the importer. Handles uploaded files, parses out first row and shows field matching page.
*/
protected function _ImportStep2()
{
$importer = new ISC_ADMIN_CSVPARSER;
// Haven't been to this step before, need to parse CSV file
if (!isset($this->ImportSession['FieldSeparator'])) {
if (isset($_POST['Headers'])) {
$this->ImportSession['Headers'] = $_POST['Headers'];
}
if (isset($_POST['OverrideDuplicates'])) {
$this->ImportSession['OverrideDuplicates'] = $_POST['OverrideDuplicates'];
}
// Using a file off the server
if (isset($_POST['serverfile']) && $_POST['serverfile'] != "") {
$_POST['serverfile'] = basename($_POST['serverfile']);
if (!is_file($this->ServerImportDirectory . "/". $_POST['serverfile'])) {
$this->_ImportStep1(GetLang('ImportInvalidServerFile'), MSG_ERROR);
$GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter();
exit;
}
$newfilename = $this->ServerImportDirectory . '/' . $_POST['serverfile'];
} else {
if (!isset($_FILES['importfile'])) {
$this->_ImportStep1($this->_GetUploadError(0), MSG_ERROR);
$GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter();
exit;
}
if (!is_uploaded_file($_FILES['importfile']['tmp_name']) || $_FILES['importfile']['error']) {
$this->_ImportStep1($this->_GetUploadError($_FILES['importfile']['error']), MSG_ERROR);
$GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter();
exit;
}
// Move the uploaded file to the cache directory temporarily with a new unique name
while(true) {
$newfilename = ISC_TMP_IMPORT_DIRECTORY . '/' . $this->type . '-import-' . md5(uniqid(rand(), true));
if (!is_file($newfilename)) {
break;
}
}
if (!move_uploaded_file($_FILES['importfile']['tmp_name'], $newfilename)) {
$this->_ImportStep1(GetLang('ImportUploadMoveFailed'), MSG_ERROR);
$GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter();
exit;
}
}
$separator = html_entity_decode($_POST['FieldSeparator']);
// convert to actual tab separator
if (trim(isc_strtoupper($separator)) == "TAB") {
$separator = " ";
}
$this->ImportSession['FieldEnclosure'] = html_entity_decode($_POST['FieldEnclosure']);
$this->ImportSession['FieldSeparator'] = $separator;
if (isset($this->ImportSession['FieldSeparator']) && $this->ImportSession['FieldSeparator'] != "") {
$importer->FieldSeparator = $this->ImportSession['FieldSeparator'];
}
if (isset($this->ImportSession['FieldEnclosure']) && $this->ImportSession['FieldEnclosure'] != "") {
$importer->FieldEnclosure = $this->ImportSession['FieldEnclosure'];
}
$this->ImportSession['ImportFile'] = $newfilename;
$importer->OpenCSVFile($newfilename);
$header = $importer->FetchNextRecord();
$importer->CloseCSVFile();
$this->ImportSession['TotalFileSize'] = filesize($newfilename);
$this->ImportSession['LastPosition'] = 0;
$this->ImportSession['PageSize'] = 3000;
if (!$header) {
$this->_ImportStep1('Invalid file', MSG_ERROR);
$GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter();
exit;
}
if (isset($_POST['Headers']) && $_POST['Headers'] == 1) {
$this->ImportSession['Header'] = $header;
}
}
// Already been past this step once, no need to reparse CSV file
else {
$importer->OpenCSVFile($this->ImportSession['ImportFile']);
$header = $importer->FetchNextRecord();
$importer->CloseCSVFile();
}
$this->_PreFieldMatch($header);
$fieldlist = '';
//.........这里部分代码省略.........
示例5: VerifyOrderPayment
public function VerifyOrderPayment()
{
$callertoken = $_REQUEST['CallerTokenId'];
$receipttoken = $_REQUEST['RecipientTokenId'];
$sendertoken = $_REQUEST['tokenID'];
$status = $_REQUEST['status'];
$orderid = $_REQUEST['Order'];
$key = $_REQUEST['Key'];
$sessionId = $_REQUEST['SessionId'];
$amount = $_REQUEST['PaymentAmount'];
if(empty($status)) {
return false;
}
if (!in_array(isc_strtoupper($status), array('SA', 'SB', 'SC'))) {
$amazonStatusCodes = $this->getStatusCodes();
if(isset($amazonStatusCodes[$status])) {
$amazonSaid = "Amazon Said: ". $amazonStatusCodes[$status];
} else {
$amazonSaid = "Unknown status '" . isc_htmlencode($status) ."' returned from Amazon.";
}
$GLOBALS['ISC_CLASS_LOG']->LogSystemError(array('payment', $this->GetName()), GetLang('AmazonFpsPaymentError'), 'Status returned unsuccessful. '. $amazonSaid . '<br />' . '<pre>' . isc_htmlencode(var_export($_REQUEST, true)) . '</pre>');
return false;
}
if ($this->GetCombinedOrderId() != $orderid) {
$GLOBALS['ISC_CLASS_LOG']->LogSystemError(array('payment', $this->GetName()), GetLang('AmazonFpsErrorOrderId'), '<pre>' . isc_htmlencode(var_export($_REQUEST, true)) . '</pre>');
return false;
}
if ($this->GetGatewayAmount() != $amount) {
$GLOBALS['ISC_CLASS_LOG']->LogSystemError(array('payment', $this->GetName()), GetLang('AmazonFpsErrorGatewayAmount'), '<pre>' . isc_htmlencode(var_export($_REQUEST, true)) . '</pre>');
return false;
}
if (md5($this->GetValue("accessid").$orderid.$sessionId.$amount.$callertoken.$receipttoken) != $key) {
$GLOBALS['ISC_CLASS_LOG']->LogSystemError(array('payment', $this->GetName()), GetLang('AmazonFpsErrorHash'), '<pre>' . isc_htmlencode(var_export($_REQUEST, true)) . '</pre>');
return false;
}
$chargeFeeTo = 'Recipient';
$date = date('Y-m-d')."T".date('H:i:s');
$callerReference = 'Order-'.$orderid.microtime(true);
$timestamp = gmdate("Y-m-d\TH:i:s\Z");
$params = array(
'Action' => 'Pay',
'CallerTokenId' => $callertoken,
'SenderTokenId' => $sendertoken,
'RecipientTokenId' => $receipttoken,
'TransactionAmount.Amount' => round($amount,2),
'TransactionAmount.CurrencyCode' => 'USD',
'TransactionDate' => $date,
'ChargeFeeTo' => $chargeFeeTo,
'CallerReference' => $callerReference,
'Timestamp' => $timestamp,
'Version' => '2007-01-08',
'AWSAccessKeyId' => $this->GetValue('accessid'),
);
if ($this->GetValue('testmode') == "YES") {
$url = 'https://fps.sandbox.amazonaws.com/';
}
else {
$url = 'https://fps.amazonaws.com/';
}
if(function_exists("curl_exec")) {
// Use CURL if it's available
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->getSignedParamString($url, $params, 'POST'));
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
@curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
// Setup the proxy settings if there are any
if (GetConfig('HTTPProxyServer')) {
curl_setopt($ch, CURLOPT_PROXY, GetConfig('HTTPProxyServer'));
if (GetConfig('HTTPProxyPort')) {
curl_setopt($ch, CURLOPT_PROXYPORT, GetConfig('HTTPProxyPort'));
}
}
if (GetConfig('HTTPSSLVerifyPeer') == 0) {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
}
$result = curl_exec($ch);
if(curl_errno($ch)) {
$this->SetError(GetLang($this->_languagePrefix."SomethingWentWrong") . $this->GetValue('displayname') . ":" .curl_error($ch));
return false;
}
}
//.........这里部分代码省略.........
示例6: GetModuleById
/**
* Return the object of a module based on the passed ID.
*
* @param string The type of module that needs to be loaded.
* @param object The object of the module, returned by reference.
* @param string The ID of the module to load.
* @return boolean True if successful, false if not.
*/
function GetModuleById($type, &$returned_module, $id)
{
$valid_types = array('accounting', 'analytics', 'checkout', 'notification', 'shipping', 'currency', 'livechat', 'addon', 'rule');
if (!in_array($type, $valid_types)) {
return false;
}
// Try and load the module
$idPieces = explode('_', $id, 2);
if (isset($idPieces[1])) {
$id = basename($idPieces[1]);
}
// Filter to allowable characters (a-zA-Z0-9-_)
$id = preg_replace('#[^a-z0-9\\-_]#i', '', $id);
if ($type == 'addon') {
$moduleFile = ISC_BASE_PATH . '/addons/' . $id . '/addon.' . $id . '.php';
} else {
$moduleFile = ISC_BASE_PATH . '/modules/' . $type . '/' . $id . '/module.' . $id . '.php';
}
$className = isc_strtoupper($type . '_' . $id);
if (!file_exists($moduleFile)) {
return false;
}
include_once $moduleFile;
if (!class_exists($className)) {
return false;
}
$returned_module = new $className();
return true;
}
示例7: unsetAccountingSession
/**
* Unset the transaction session
*
* Method will unset the transaction session
*
* @access protected
* @param string $moduleid The module ID
* @return bool TRUE if the session was unset, FALSE on error
*/
protected function unsetAccountingSession($moduleid)
{
if ($moduleid == '') {
return false;
}
$modkey = isc_strtoupper($moduleid);
if (isset($_SESSION[$modkey])) {
unset($_SESSION[$modkey]);
}
return !isset($_SESSION[$modkey]);
}
示例8: ValidateInput
/**
* Validates the posted form data
*
* @param int $templateid The template used when checking for existing template name
*/
private function ValidateInput($templateid = 0)
{
// check for template name
if (!isset($_POST["templateName"]) || !trim($_POST["templateName"])) {
throw new Exception(GetLang("NoTemplateName"));
} else {
$templatename = trim($_POST["templateName"]);
// check for existing template
$query = "SELECT * FROM [|PREFIX|]import_templates WHERE UCASE(importtemplatename) = '" . $GLOBALS['ISC_CLASS_DB']->Quote(isc_strtoupper($templatename)) . "'";
if ($templateid) {
$query .= " AND importtemplateid != '" . $GLOBALS['ISC_CLASS_DB']->Quote($templateid) . "'";
}
$vendorid = $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId();
$query .= " AND vendorid = '" . $GLOBALS['ISC_CLASS_DB']->Quote($vendorid) . "'";
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
if ($GLOBALS['ISC_CLASS_DB']->CountResult($result)) {
throw new Exception(sprintf(GetLang("TemplateAlreadyExists"), $templatename));
}
}
}
示例9: convert_accounting_spool
public function convert_accounting_spool()
{
$query = "ALTER TABLE [|PREFIX|]accountingref MODIFY `accountingreftype` enum('customer','customergroup','product','order','salestaxcode','account','inventorylevel','orderlineitem') NOT NULL";
if (!$GLOBALS['ISC_CLASS_DB']->Query($query)) {
$this->SetError($GLOBALS['ISC_CLASS_DB']->GetErrorMsg());
return false;
}
if (!$this->TableExists('accountingspool')) {
$query = "\n\t\t\t\tCREATE TABLE `[|PREFIX|]accountingspool` (\n\t\t\t\t `accountingspoolid` int(10) unsigned NOT NULL auto_increment,\n\t\t\t\t `accountingspoolparentid` int(10) unsigned NOT NULL default '0',\n\t\t\t\t `accountingspoolmoduleid` varchar(100) NOT NULL default '',\n\t\t\t\t `accountingspoolnodeid` int(10) unsigned NOT NULL default '0',\n\t\t\t\t `accountingspoolserial` text,\n\t\t\t\t `accountingspooltype` enum('customer','customergroup','product','order','salestaxcode','account','inventorylevel') NOT NULL,\n\t\t\t\t `accountingspoolservice` enum('add','edit','query') NOT NULL,\n\t\t\t\t `accountingspoollock` char(36) NOT NULL default '',\n\t\t\t\t `accountingspoolstatus` tinyint(1) default '0',\n\t\t\t\t `accountingspooldisabled` tinyint(1) NOT NULL default '0',\n\t\t\t\t `accountingspoolerrmsg` tinytext,\n\t\t\t\t `accountingspoolerrno` int(10) unsigned NOT NULL default '0',\n\t\t\t\t `accountingspoolreturn` text,\n\t\t\t\t PRIMARY KEY (`accountingspoolid`),\n\t\t\t\t KEY `i_accountingspool_accountingspoolparentid` (`accountingspoolparentid`),\n\t\t\t\t KEY `i_accountingspool_accountingspoolmoduleid` (`accountingspoolmoduleid`),\n\t\t\t\t KEY `i_accountingspool_accountingspoolnodeid` (`accountingspoolnodeid`),\n\t\t\t\t KEY `i_accountingspool_accountingspooltype` (`accountingspooltype`)\n\t\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
if (!$GLOBALS['ISC_CLASS_DB']->Query($query)) {
$this->SetError($GLOBALS['ISC_CLASS_DB']->GetErrorMsg());
return false;
}
/**
* If this table already exists and it has records in it then DO NOT import the spool files as order will double up and could potentially duplciate
* products and customers
*/
} else {
$result = $GLOBALS['ISC_CLASS_DB']->Query("SELECT * FROM [|PREFIX|]accountingspool");
if ($result && $GLOBALS['ISC_CLASS_DB']->CountResult($result) > 0) {
return true;
}
}
/**
* Now convert the existsing spool files into database accountingspool records. Force out the mandatory account spools just in case
*/
$accounting = GetClass('ISC_ACCOUNTING');
$initdata = array(array('type' => 'account', 'service' => 'add', 'data' => array('Name' => GetLang('QuickBooksIncomeAccountName'), 'AccountType' => 'Income')), array('type' => 'account', 'service' => 'add', 'data' => array('Name' => GetLang('QuickBooksCOGSAccountName'), 'AccountType' => 'CostOfGoodsSold')), array('type' => 'account', 'service' => 'add', 'data' => array('Name' => GetLang('QuickBooksAssetAccountName'), 'AccountType' => 'FixedAsset')));
foreach ($initdata as $data) {
$accounting->createServiceRequest($data['type'], $data['service'], $data['data']);
}
/**
* Now for the rest. These will be in the spool cache file so you'll need to read the files from there
*/
$files = scandir(ISC_BASE_PATH . '/cache/spool');
foreach ($files as $file) {
$realfile = ISC_BASE_PATH . '/cache/spool/' . $file;
if (!is_file($realfile) || !is_readable($realfile) || substr($file, 0, 6) !== 'spool.') {
continue;
}
$spooldata = null;
@(include_once $realfile);
if (!is_array($spooldata)) {
continue;
}
/**
* Find out if this entity exists. If not then do not import it
*/
if (isId($spooldata['nodeid'])) {
$className = "ISC_ENTITY_" . isc_strtoupper($spooldata['type']);
$entity = new $className();
if (!$entity->exists($spooldata['nodeid'])) {
continue;
}
/**
* Save it using the data array instead of the nodeid as they might delete that entity before they import
*/
$savedata = $entity->get($spooldata['nodeid']);
if (!$savedata) {
continue;
}
} else {
continue;
}
switch (isc_strtolower($spooldata['type'])) {
case 'order':
/**
* We need to check if the customer and all of the products for this order still exist
*/
$query = "SELECT IF(EXISTS(SELECT * FROM [|PREFIX|]customers c WHERE o.ordcustid=c.customerid), 1, 0) AS CustomerExists,\n\t\t\t\t\t\t\t\t\t(SELECT COUNT(*) FROM [|PREFIX|]order_products op1 WHERE op1.orderorderid=o.orderid) AS TotalProducts,\n\t\t\t\t\t\t\t\t\t(SELECT COUNT(*) FROM [|PREFIX|]order_products op2 JOIN [|PREFIX|]products p ON op2.ordprodid=p.productid WHERE op2.orderorderid=o.orderid) AS ValidProducts\n\t\t\t\t\t\t\t\tFROM [|PREFIX|]orders o\n\t\t\t\t\t\t\t\tWHERE o.orderid=" . (int) $spooldata['nodeid'];
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
if (!$result) {
break;
}
$row = $GLOBALS['ISC_CLASS_DB']->Fetch($result);
if (!$row) {
break;
}
if (!$row['CustomerExists'] || $row['TotalProducts'] !== $row['ValidProducts']) {
break;
}
$accounting->createServiceRequest('order', 'add', $savedata, 'order_create');
break;
case 'product':
case 'customer':
case 'customergroup':
/**
* Find out if this is an add or mod. If query then skip
*/
if (substr(isc_strtolower($spooldata['service']), -3) == 'add') {
$permission = 'create';
$service = 'add';
} else {
if (substr(isc_strtolower($spooldata['service']), -3) == 'mod') {
$permission = 'edit';
$service = 'edit';
} else {
break;
}
}
//.........这里部分代码省略.........
示例10: GetCurrencyDataFromPost
private function GetCurrencyDataFromPost()
{
$data = array(
'currencyname' => $_POST['currencyname'],
'currencycode' => isc_strtoupper($_POST['currencycode']),
'currencyconvertercode' => $_POST['currencyconverter'],
'currencyexchangerate' => $_POST['currencyexchangerate'],
'currencystringposition' => isc_strtoupper($_POST['currencystringposition']),
'currencystring' => $_POST['currencystring'],
'currencydecimalstring' => $_POST['currencydecimalstring'],
'currencythousandstring' => $_POST['currencythousandstring'],
'currencydecimalplace' => $_POST['currencydecimalplace'],
'currencylastupdated' => time()
);
if (strtolower($_POST['currencyorigintype']) == "country") {
$data['currencycouregid'] = null;
$data['currencycountryid'] = $_POST["currencyorigin"];
} else if (strtolower($_POST['currencyorigintype']) == "region") {
$data['currencycouregid'] = $_POST["currencyorigin"];
$data['currencycountryid'] = null;
}
if (isset($_POST['currencystatus'])) {
$data['currencystatus'] = 1;
}
else {
$data['currencystatus'] = 0;
}
return $data;
}
示例11: ManageProductsGrid
//.........这里部分代码省略.........
if($percent > 100) {
$percent = 100;
}
if($percent > 75) {
$stockClass = 'InStock';
$orderMore = GetLang('SNo');
}
else if($percent > 50) {
$stockClass = 'StockWarning';
$orderMore = GetLang('Soon');
}
else {
$stockClass = 'LowStock';
$orderMore = GetLang('SYes');
}
$width = ceil(($percent/100)*72);
$stockInfo = sprintf(GetLang('CurrentStockLevel').': %s<br />'.GetLang('LowStockLevel1').': %s<br />'.GetLang('OrderMore').': '.$orderMore, $row['currentinv'], $row['prodlowinv'], $orderMore);
$GLOBALS['StockInfo'] = sprintf("<div class=\"StockLevelIndicator\" onmouseover=\"ShowQuickHelp(this, '%s', '%s')\" onmouseout=\"HideQuickHelp(this)\"><span class=\"%s\" style=\"width: %spx\"></span></div>", GetLang('StockLevel'), $stockInfo, $stockClass, $width);
}
// If they have permission to edit products, they can change
// the visibility status of a product by clicking on the icon
if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Edit_Products)) {
if ($row['prodvisible'] == 1) {
$GLOBALS['Visible'] = sprintf("<a title='%s' href='index.php?ToDo=editProductVisibility&prodId=%d&visible=0' onclick=\"quickToggle(this, 'visible'); return false;\"><img border='0' src='images/tick.gif' alt='tick'></a>", GetLang('ClickToHide'), $row['productid']);
} else {
$GLOBALS['Visible'] = sprintf("<a title='%s' href='index.php?ToDo=editProductVisibility&prodId=%d&visible=1' onclick=\"quickToggle(this, 'visible'); return false;\"><img border='0' src='images/cross.gif' alt='cross'></a>", GetLang('ClickToShow'), $row['productid']);
}
} else {
if ($row['prodvisible'] == 1) {
$GLOBALS['Visible'] = '<img border="0" src="images/tick.gif" alt="tick">';
} else {
$GLOBALS['Visible'] = '<img border="0" src="images/cross.gif" alt="cross">';
}
}
// If they have permission to edit products, they can change
// the featured status of a product by clicking on the icon
if($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) {
$featuredColumn = 'prodvendorfeatured';
}
else {
$featuredColumn = 'prodfeatured';
}
if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Edit_Products)) {
if ($row[$featuredColumn] == 1) {
$GLOBALS['Featured'] = sprintf("<a title='%s' href='index.php?ToDo=editProductFeatured&prodId=%d&featured=0' onclick=\"quickToggle(this, 'featured'); return false;\"><img border='0' src='images/tick.gif' alt='tick'></a>", GetLang('ClickToHide'), $row['productid']);
} else {
$GLOBALS['Featured'] = sprintf("<a title='%s' href='index.php?ToDo=editProductFeatured&prodId=%d&featured=1' onclick=\"quickToggle(this, 'featured'); return false;\"><img border='0' src='images/cross.gif' alt='cross'></a>", GetLang('ClickToShow'), $row['productid']);
}
} else {
if ($row[$featuredColumn] == 1) {
$GLOBALS['Featured'] = '<img border="0" src="images/tick.gif" alt="tick">';
} else {
$GLOBALS['Featured'] = '<img border="0" src="images/cross.gif" alt="cross">';
}
}
// Workout the edit link -- do they have permission to do so?
if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Edit_Products)) {
$GLOBALS['EditProductLink'] = sprintf("<a title='%s' class='Action' href='index.php?ToDo=editProduct&productId=%d'>%s</a>", GetLang('ProductEdit'), $row['productid'], GetLang('Edit'));
} else {
$GLOBALS['EditProductLink'] = sprintf("<a class='Action' disabled>%s</a>", GetLang('Edit'));
}
$allowpurchases = (int)$row['prodallowpurchases'];
$prodpreorder = (int)$row['prodpreorder'];
$status = GetLang('CatalogueOnly');
if ($allowpurchases) {
if ($prodpreorder) {
$status= GetLang('PreOrder');
} else {
$status = GetLang('Selling');
}
}
$GLOBALS['Status'] = $status;
$GLOBALS['CopyProductLink'] = "<a title='".GetLang('ProductCopy')."' class='Action' href='index.php?ToDo=copyProduct&productId=".$row['productid']."'>".GetLang('Copy')."</a>";
$GLOBALS['ProductGrid'] .= $this->template->render('product.manage.row.tpl');
}
}
if($GLOBALS['ProductGrid'] == '') {
if(isset($_REQUEST['letter'])) {
$GLOBALS['ProductGrid'] = sprintf('<tr>
<td colspan="11" style="padding:10px"><em>%s</em></td>
</tr>', sprintf(GetLang('LetterSortNoResults'), isc_strtoupper($_REQUEST['letter'])));
}
}
return $this->template->render('products.manage.grid.tpl');
}
示例12: ExportVendorPayments
/**
* Export vendor payments (for all vendors or a specific vendor) to a CSV or XML file.
*/
private function ExportVendorPayments()
{
// Validate the sort order
if (isset($_REQUEST['sortOrder']) && $_REQUEST['sortOrder'] == 'asc') {
$sortOrder = 'asc';
} else {
$sortOrder = 'desc';
}
// Which fields can we sort by?
$validSortFields = array('paymentid', 'paymentfrom', 'vendorname', 'paymentamount', 'paymentmethod', 'paymentdate');
if (isset($_REQUEST['sortField']) && in_array($_REQUEST['sortField'], $validSortFields)) {
$sortField = $_REQUEST['sortField'];
SaveDefaultSortField('ManageVendorPayments', $_REQUEST['sortField'], $sortOrder);
} else {
list($sortField, $sortOrder) = GetDefaultSortField('ManageVendorPayments', 'paymentid', $sortOrder);
}
ob_end_clean();
// Grab the queries we'll be executing
$paymentQueries = $this->BuildVendorPaymentSearchQuery(0, $sortField, $sortOrder, false);
$numPayments = $GLOBALS['ISC_CLASS_DB']->FetchOne($paymentQueries['countQuery']);
if (!$numPayments) {
header('Location: index.php?ToDo=viewVendorPayments');
exit;
}
// Set up the list of columns
$columns = array('paymentid' => 'PAYMENT ID', 'paymentfrom' => 'PAYMENT FROM', 'paymentto' => 'PAYMENT TO', 'paymentvendorid' => 'PAYMENT VENDOR ID', 'vendorname' => 'PAYMENT VENDOR NAME', 'paymentamount' => 'PAYMENT AMOUNT', 'paymentforwardbalance' => 'OUTSTANDING BALANCE', 'paymentdate' => 'PAYMENT DATE', 'paymentmethod' => 'PAYMENT METHOD', 'paymentcomments' => 'PAYMENT COMMENTS');
if (!isset($_GET['format']) || $_GET['format'] == "csv") {
$ext = 'csv';
} else {
$ext = 'xml';
}
$GLOBALS['ISC_CLASS_LOG']->LogAdminAction(isc_strtoupper($_REQUEST['format']));
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Disposition: attachment; filename=\"payments-" . isc_date("Y-m-d") . "." . $ext . "\";");
if ($ext == 'csv') {
$row = '';
foreach ($columns as $field) {
$row .= EXPORT_FIELD_ENCLOSURE . $field . EXPORT_FIELD_ENCLOSURE . EXPORT_FIELD_SEPARATOR;
}
echo rtrim($row, EXPORT_FIELD_SEPARATOR);
echo EXPORT_RECORD_SEPARATOR;
} else {
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<payments>\n";
}
// Export the payments
$result = $GLOBALS['ISC_CLASS_DB']->Query($paymentQueries['query']);
while ($payment = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
// If CSV export, handle that now
if ($ext == 'csv') {
$row = '';
foreach ($columns as $k => $v) {
switch ($k) {
case 'paymentfrom':
case 'paymentto':
case 'paymentdate':
$value = isc_date(GetConfig('ExportDateFormat'), $payment[$k]);
break;
case 'paymentamount':
case 'paymentforwardbalance':
$value = FormatPrice($payment[$k]);
default:
$value = $payment[$k];
}
$value = str_replace(EXPORT_FIELD_ENCLOSURE, EXPORT_FIELD_ENCLOSURE . EXPORT_FIELD_ENCLOSURE, $value);
$row .= EXPORT_FIELD_ENCLOSURE . $value . EXPORT_FIELD_ENCLOSURE . EXPORT_FIELD_SEPARATOR;
}
echo rtrim($row, EXPORT_FIELD_SEPARATOR);
echo EXPORT_RECORD_SEPARATOR;
@flush();
} else {
echo "\t<payment paymentid=\"" . $payment['paymentid'] . "\">\n";
foreach ($columns as $k => $v) {
switch ($k) {
case 'paymentfrom':
case 'paymentto':
case 'paymentdate':
$value = isc_date(GetConfig('ExportDateFormat'), $payment[$k]);
break;
case 'paymentamount':
case 'paymentforwardbalance':
$value = FormatPrice($payment[$k]);
default:
$value = $payment[$k];
}
echo "\t\t<" . $k . "><![CDATA[" . $value . "]]></" . $k . ">\n";
flush();
}
echo "\t</payment>\n";
}
}
if ($ext == 'xml') {
echo "</payments>";
}
exit;
//.........这里部分代码省略.........
示例13: ValidateInput
/**
* Validates the posted form data
*
* @param int $templateid The template used when checking for existing template name
*/
private function ValidateInput($templateid = 0)
{
// check for template name
if (!isset($_POST["templateName"]) || !trim($_POST["templateName"])) {
throw new Exception(GetLang("NoTemplateName"));
} else {
$templatename = trim($_POST["templateName"]);
// check for existing template
$query = "SELECT * FROM [|PREFIX|]export_templates WHERE builtin = 0 AND UCASE(exporttemplatename) = '" . $GLOBALS['ISC_CLASS_DB']->Quote(isc_strtoupper($templatename)) . "'";
if ($templateid) {
$query .= " AND exporttemplateid != '" . $GLOBALS['ISC_CLASS_DB']->Quote($templateid) . "'";
}
$vendorid = $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId();
$query .= " AND vendorid = '" . $GLOBALS['ISC_CLASS_DB']->Quote($vendorid) . "'";
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
if ($GLOBALS['ISC_CLASS_DB']->CountResult($result)) {
throw new Exception(sprintf(GetLang("TemplateAlreadyExists"), $templatename));
}
}
// ensure at least one file is selected
if (!isset($_POST["includeType"])) {
throw new Exception(GetLang("NoFilesSelected"));
}
// check for valid date format
if (!array_key_exists($_POST['dateFormat'], $this->GetDateFormats())) {
throw new Exception(GetLang("NoDateFormat"));
}
// check for valid price format
if (!array_key_exists($_POST['priceFormat'], $this->GetPriceFormats())) {
throw new Exception(GetLang("NoPriceFormat"));
}
// check for valid bool format
if (!array_key_exists($_POST['boolFormat'], $this->GetBoolFormats())) {
throw new Exception(GetLang("NoBoolFormat"));
}
// validate each type
foreach ($_POST['includeType'] as $type => $blah) {
// check that at least one field is checked for the type
if (!isset($_POST[$type . "Field"])) {
throw new Exception(sprintf(GetLang("NoFields"), $type));
}
// check that ticked fields have a header
$filetype = ISC_ADMIN_EXPORTFILETYPE_FACTORY::GetExportFileType($type);
$fields = $filetype->FlattenFields($filetype->LoadFields());
foreach ($_POST[$type . "Field"] as $field => $val) {
if (!isset($_POST[$type . "Header"][$field]) || !trim($_POST[$type . "Header"][$field])) {
throw new Exception(GetLang("FieldNoHeader") . '"' . $fields[$field]['label'] . '"');
}
}
}
}
示例14: SaveModuleSettings
public function SaveModuleSettings($settings=array(), $deleteFirst=true)
{
// validate the prefix
$prefix = trim($settings['referenceprefix']);
if ($prefix) {
$prefix = isc_strtoupper(isc_substr($prefix, 0, 1));
if (!preg_match("/[a-zA-Z0-9]/", $prefix)) {
$this->SetError(GetLang('BPAYInvalidPrefix'));
$prefix = "";
}
}
$settings['referenceprefix'] = $prefix;
$return = parent::SaveModuleSettings($settings, $deleteFirst);
if ($this->HasErrors()) {
return false;
}
else {
return $ret;
}
}
示例15: findModuleClass
/**
* Get the file path and the class name of a class file
*
* Method will return an array where "file" will be the file path and "name" will be the class name
*
* @access public
* @param string $type The class type ("classes", "handlers", "services" or "entities")
* @param string $class The class name (Not the full name)
* @param bool $includeParentBase TRUE to also find and include the base parent. Default is TRUE
* @return array An array with the class file path and full class name on success, NULL if no result, FALSE on error
*/
public function findModuleClass($type, $class, $includeParentBase=true)
{
if (trim($type) == '' || trim($class) == '') {
return false;
}
$filePathPrefix = dirname(__FILE__) . "/includes";
$classNamePrefix = "ACCOUNTING_QUICKBOOKS_";
switch (isc_strtolower($type)) {
case "classes":
$filePathPrefix .= "/classes/class.";
$classNamePrefix .= "CLASS_";
break;
case "handlers":
$filePathPrefix .= "/handlers/handler.";
$classNamePrefix .= "HANDLER_";
break;
case "services":
$filePathPrefix .= "/services/service.";
$classNamePrefix .= "SERVICE_";
break;
case "entities":
$filePathPrefix .= "/entities/entity.";
$classNamePrefix .= "ENTITY_";
break;
default:
return null;
}
$filePath = realpath($filePathPrefix . isc_strtolower($class) . ".php");
$className = $classNamePrefix . isc_strtoupper($class);
if ($filePath == '' || !file_exists($filePath)) {
$xargs = func_get_args();
$this->logError("Cannot find module class file", $xargs);
return null;
}
if ($includeParentBase) {
$basePath = realpath(realpath($filePathPrefix . "base.php"));
if ($basePath == '' || !file_exists($basePath)) {
$xargs = func_get_args();
$this->logError("Cannot find module base class file", $xargs);
return null;
} else {
@include_once($basePath);
}
}
return array("file" => $filePath, "class" => $className);
}