本文整理汇总了PHP中vtlib_purify函数的典型用法代码示例。如果您正苦于以下问题:PHP vtlib_purify函数的具体用法?PHP vtlib_purify怎么用?PHP vtlib_purify使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vtlib_purify函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save_module
function save_module()
{
global $adb;
//in ajax save we should not call this function, because this will delete all the existing product values
if ($_REQUEST['action'] != 'QuotesAjax' && $_REQUEST['ajxaction'] != 'DETAILVIEW' && $_REQUEST['action'] != 'MassEditSave' && $_REQUEST['action'] != 'ProcessDuplicates' && $_REQUEST['action'] != 'SaveAjax' && $this->isLineItemUpdate != false) {
//Based on the total Number of rows we will save the product relationship with this entity
saveInventoryProductDetails($this, 'Quotes');
}
// Update the currency id and the conversion rate for the quotes
$update_query = "update vtiger_quotes set currency_id=?, conversion_rate=? where quoteid=?";
$update_params = array($this->column_fields['currency_id'], $this->column_fields['conversion_rate'], $this->id);
$adb->pquery($update_query, $update_params);
$tot_no_prod = $_REQUEST['totalProductCount'];
$calculationList = array();
for ($i = 1; $i <= $tot_no_prod; $i++) {
$calculationsid = vtlib_purify($_REQUEST['calculationId' . $i]);
$calculationsid_old = vtlib_purify($_REQUEST['old_calculationId' . $i]);
if ($calculationsid_old != '' && !in_array($calculationsid_old, $calculationList) && $calculationsid != $calculationsid_old) {
$this->delete_related_module('Quotes', $this->id, 'Calculations', $calculationsid_old);
}
if ($calculationsid != '') {
$calculationList[] = $calculationsid;
$this->save_related_module('Quotes', $this->id, 'Calculations', $calculationsid);
}
}
}
示例2: requestForgotPassword
public function requestForgotPassword($request)
{
$request = new Vtiger_Request($request);
$adb = PearDatabase::getInstance();
$username = vtlib_purify($request->get('user_name'));
$result = $adb->pquery('select id,email1 from vtiger_users where user_name = ? ', array($username));
if ($adb->num_rows($result) > 0) {
$email = $adb->query_result($result, 0, 'email1');
}
if (strcasecmp($request->get('emailId'), $email) === 0) {
$userId = $adb->query_result($result, 0, 'id');
$time = time();
$options = array('handler_path' => 'modules/Users/handlers/ForgotPassword.php', 'handler_class' => 'Users_ForgotPassword_Handler', 'handler_function' => 'changePassword', 'handler_data' => array('username' => $username, 'email' => $email, 'time' => $time, 'hash' => md5($username . $time)));
$trackURL = Vtiger_ShortURL_Helper::generateURL($options);
$data = ['sysname' => 'UsersForgotPassword', 'to_email' => $email, 'module' => 'Users', 'record' => $userId, 'trackURL' => $trackURL];
$recordModel = Vtiger_Record_Model::getCleanInstance('OSSMailTemplates');
$status = $recordModel->sendMailFromTemplate($data);
$site_URL = vglobal('site_URL') . 'index.php?modules=Users&view=Login';
if ($status === 1) {
header('Location: ' . $site_URL . '&status=1');
} else {
header('Location: ' . $site_URL . '&statusError=1');
}
} else {
$site_URL = vglobal('site_URL') . 'index.php?modules=Users&view=Login';
header('Location: ' . $site_URL . '&fpError=1');
}
}
示例3: vtDeleteWorkflow
function vtDeleteWorkflow($adb, $request)
{
$util = new VTWorkflowUtils();
$module = new VTWorkflowApplication("deltetask");
$mod = return_module_language($current_language, $module->name);
if (!$util->checkAdminAccess()) {
$errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NOT_ADMIN']);
$util->redirectTo($errorUrl, $mod['LBL_ERROR_NOT_ADMIN']);
return;
}
$wm = new VTTaskManager($adb);
$wm->deleteTask($request['task_id']);
if (isset($request["return_url"])) {
$returnUrl = vtlib_purify($request["return_url"]);
} else {
$returnUrl = $module->editWorkflowUrl($wf->id);
}
?>
<script type="text/javascript" charset="utf-8">
window.location="<?php
echo $returnUrl;
?>
";
</script>
<a href="<?php
echo $returnUrl;
?>
">Return</a>
<?php
}
示例4: RBSearch
function RBSearch($module)
{
global $log;
$log->debug("Entering RBSearch(" . $module . ") method ...");
$url_string = '';
if (isset($_REQUEST['search_field']) && $_REQUEST['search_field'] != "") {
$search_column = vtlib_purify($_REQUEST['search_field']);
}
if (isset($_REQUEST['search_text']) && $_REQUEST['search_text'] != "") {
$search_string = $_REQUEST['search_text'];
}
if (isset($_REQUEST['searchtype']) && $_REQUEST['searchtype'] != "") {
$search_type = vtlib_purify($_REQUEST['searchtype']);
if ($search_type == "BasicSearch") {
$where = basicRBsearch($module, $search_column, $search_string);
} else {
}
$url_string = "&search_field=" . $search_column . "&search_text=" . $search_string . "&searchtype=BasicSearch";
if (isset($_REQUEST['type']) && $_REQUEST['type'] != '') {
$url_string .= "&type=" . vtlib_purify($_REQUEST['type']);
}
return $where . "#@@#" . $url_string;
$log->debug("Exiting RBSearch method ...");
}
}
示例5: getRelationQuery
/**
* Function to get relation query for particular module with function name
* @param <record> $recordId
* @param <String> $functionName
* @param Vtiger_Module_Model $relatedModule
* @return <String>
*/
public function getRelationQuery($recordId, $functionName, $relatedModule, $relationModel = false)
{
if ($functionName === 'get_activities') {
$userNameSql = getSqlForNameInDisplayFormat(array('first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'), 'Users');
$query = "SELECT CASE WHEN (vtiger_users.user_name not like '') THEN {$userNameSql} ELSE vtiger_groups.groupname END AS user_name,\n\t\t\t\t\t\tvtiger_crmentity.*, vtiger_activity.activitytype, vtiger_activity.subject, vtiger_activity.date_start, vtiger_activity.time_start,\n\t\t\t\t\t\tvtiger_activity.recurringtype, vtiger_activity.due_date, vtiger_activity.time_end, vtiger_activity.visibility,\n\t\t\t\t\t\tCASE WHEN (vtiger_activity.activitytype = 'Task') THEN (vtiger_activity.status) ELSE (vtiger_activity.eventstatus) END AS status\n\t\t\t\t\t\tFROM vtiger_activity\n\t\t\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_activity.activityid\n\t\t\t\t\t\tLEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid\n\t\t\t\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\t\t\t\t\tWHERE vtiger_crmentity.deleted = 0 AND vtiger_activity.process = " . $recordId;
$time = vtlib_purify($_REQUEST['time']);
if ($time == 'current') {
$query .= " AND ((vtiger_activity.activitytype='Task' and vtiger_activity.status not in ('Completed','Deferred'))\n\t\t\t\tOR (vtiger_activity.activitytype not in ('Emails','Task') and vtiger_activity.eventstatus not in ('','Held')))";
}
if ($time == 'history') {
$query .= " AND ((vtiger_activity.activitytype='Task' and vtiger_activity.status in ('Completed','Deferred'))\n\t\t\t\tOR (vtiger_activity.activitytype not in ('Emails','Task') and vtiger_activity.eventstatus in ('','Held')))";
}
$relatedModuleName = $relatedModule->getName();
$query .= $this->getSpecificRelationQuery($relatedModuleName);
$instance = CRMEntity::getInstance($relatedModuleName);
$securityParameter = $instance->getUserAccessConditionsQuerySR($relatedModuleName);
if ($securityParameter != '') {
$sql .= $securityParameter;
}
} elseif ($functionName === 'get_mails' && $relatedModule->getName() == 'OSSMailView') {
$query = OSSMailView_Record_Model::getMailsQuery($recordId, $relatedModule->getName());
} else {
$query = parent::getRelationQuery($recordId, $functionName, $relatedModule, $relationModel);
}
return $query;
}
示例6: getRelationQuery
/**
* Function to get relation query for particular module with function name
* @param <record> $recordId
* @param <String> $functionName
* @param Vtiger_Module_Model $relatedModule
* @return <String>
*/
public function getRelationQuery($recordId, $functionName, $relatedModule, $relationModel = false)
{
if ($functionName === 'get_activities') {
$focus = CRMEntity::getInstance($this->getName());
$focus->id = $recordId;
$entityIds = $focus->getRelatedContactsIds();
$entityIds[] = $recordId;
$entityIds = implode(',', $entityIds);
$userNameSql = getSqlForNameInDisplayFormat(array('first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'), 'Users');
$query = "SELECT CASE WHEN (vtiger_users.user_name not like '') THEN {$userNameSql} ELSE vtiger_groups.groupname END AS user_name,\n\t\t\t\t\t\tvtiger_crmentity.*, vtiger_activity.activitytype, vtiger_activity.subject, vtiger_activity.date_start, vtiger_activity.time_start,\n\t\t\t\t\t\tvtiger_activity.recurringtype, vtiger_activity.due_date, vtiger_activity.time_end, vtiger_activity.visibility, \n\t\t\t\t\t\tvtiger_activity.status AS status\n\t\t\t\t\t\tFROM vtiger_activity\n\t\t\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_activity.activityid\n\t\t\t\t\t\tLEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid\n\t\t\t\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\t\t\t\tWHERE vtiger_crmentity.deleted = 0 AND vtiger_activity.link IN (" . $entityIds . ')';
$time = vtlib_purify($_REQUEST['time']);
if ($time == 'current') {
$stateActivityLabels = Calendar_Module_Model::getComponentActivityStateLabel('current');
$query .= " AND (vtiger_activity.activitytype NOT IN ('Emails') AND vtiger_activity.status IN ('" . implode("','", $stateActivityLabels) . "'))";
}
if ($time == 'history') {
$stateActivityLabels = Calendar_Module_Model::getComponentActivityStateLabel('history');
$query .= " AND (vtiger_activity.activitytype NOT IN ('Emails') AND vtiger_activity.status IN ('" . implode("','", $stateActivityLabels) . "'))";
}
$relatedModuleName = $relatedModule->getName();
$query .= $this->getSpecificRelationQuery($relatedModuleName);
$instance = CRMEntity::getInstance($relatedModuleName);
$securityParameter = $instance->getUserAccessConditionsQuerySR($relatedModuleName, false, $recordId);
if ($securityParameter != '') {
$query .= $securityParameter;
}
// There could be more than one contact for an activity.
$query .= ' GROUP BY vtiger_activity.activityid';
} elseif ($functionName === 'get_mails' && $relatedModule->getName() == 'OSSMailView') {
$query = OSSMailView_Record_Model::getMailsQuery($recordId, $relatedModule->getName());
} else {
$query = parent::getRelationQuery($recordId, $functionName, $relatedModule, $relationModel);
}
return $query;
}
示例7: process
/**
* Process the request for Folder opertions
* @global <type> $list_max_entries_per_page
* @param MailManager_Request $request
* @return MailManager_Response
*/
function process(MailManager_Request $request)
{
global $list_max_entries_per_page, $current_user;
$response = new Vtiger_Response();
if ('open' == $request->getOperationArg()) {
$q = $request->get('q');
$foldername = $request->get('_folder');
$type = $request->get('type');
$connector = $this->getConnector($foldername);
$folder = $connector->folderInstance($foldername);
if (empty($q)) {
$connector->folderMails($folder, intval($request->get('_page', 0)), $list_max_entries_per_page);
} else {
if (empty($type)) {
$type = 'ALL';
}
if ($type == 'ON') {
$dateFormat = $current_user->date_format;
if ($dateFormat == 'mm-dd-yyyy') {
$dateArray = explode('-', $q);
$temp = $dateArray[0];
$dateArray[0] = $dateArray[1];
$dateArray[1] = $temp;
$q = implode('-', $dateArray);
}
$query = date('d M Y', strtotime($q));
$q = '' . $type . ' "' . vtlib_purify($query) . '"';
} else {
$q = '' . $type . ' "' . vtlib_purify($q) . '"';
}
$connector->searchMails($q, $folder, intval($request->get('_page', 0)), $list_max_entries_per_page);
}
$folderList = $connector->getFolderList();
$viewer = $this->getViewer();
$viewer->assign('TYPE', $type);
$viewer->assign('QUERY', $request->get('q'));
$viewer->assign('FOLDER', $folder);
$viewer->assign('FOLDERLIST', $folderList);
$viewer->assign('SEARCHOPTIONS', self::getSearchOptions());
$viewer->assign("JS_DATEFORMAT", parse_calendardate(getTranslatedString('NTC_DATE_FORMAT')));
$response->setResult($viewer->fetch($this->getModuleTpl('FolderOpen.tpl')));
} elseif ('drafts' == $request->getOperationArg()) {
$q = $request->get('q');
$type = $request->get('type');
$page = intval($request->get('_page', 0));
$connector = $this->getConnector('__vt_drafts');
$folder = $connector->folderInstance();
if (empty($q)) {
$draftMails = $connector->getDrafts($page, $list_max_entries_per_page, $folder);
} else {
$draftMails = $connector->searchDraftMails($q, $type, $page, $list_max_entries_per_page, $folder);
}
$viewer = $this->getViewer();
$viewer->assign('MAILS', $draftMails);
$viewer->assign('FOLDER', $folder);
$viewer->assign('SEARCHOPTIONS', MailManager_DraftController::getSearchOptions());
$response->setResult($viewer->fetch($this->getModuleTpl('FolderDrafts.tpl')));
}
return $response;
}
示例8: show_error_import
/** function used to show the error message occured during import process
* @param string $message - Error message to display in the screen, where the passed error message will be displayed in screen using Importerror.tpl file
*/
function show_error_import($message)
{
global $import_mod_strings;
global $theme;
global $log;
global $mod_strings;
global $app_strings;
$theme_path = "themes/" . $theme . "/";
$image_path = $theme_path . "images/";
$log->info("Upload Error");
$smarty = new vtigerCRM_Smarty();
$smarty->assign("MOD", $mod_strings);
$smarty->assign("APP", $app_strings);
if (isset($_REQUEST['return_module'])) {
$smarty->assign("RETURN_MODULE", vtlib_purify($_REQUEST['return_module']));
}
if (isset($_REQUEST['return_action'])) {
$smarty->assign("RETURN_ACTION", vtlib_purify($_REQUEST['return_action']));
}
$smarty->assign("THEME", $theme);
$category = getParenttab();
$smarty->assign("CATEGORY", $category);
$smarty->assign("IMAGE_PATH", $image_path);
$smarty->assign("PRINT_URL", "phprint.php?jt=" . session_id() . $GLOBALS['request_string']);
$smarty->assign("MODULE", vtlib_purify($_REQUEST['module']));
$smarty->assign("MESSAGE", $message);
$smarty->display('Importerror.tpl');
}
示例9: get
/**
* Get key value (otherwise default value)
*/
function get($key, $defvalue = '')
{
$value = $defvalue;
if (isset($this->valuemap[$key])) {
$value = $this->valuemap[$key];
}
if ($value === '' && isset($this->defaultmap[$key])) {
$value = $this->defaultmap[$key];
}
$isJSON = false;
if (is_string($value)) {
// NOTE: Zend_Json or json_decode gets confused with big-integers (when passed as string)
// and convert them to ugly exponential format - to overcome this we are performin a pre-check
if (strpos($value, "[") === 0 || strpos($value, "{") === 0) {
$isJSON = true;
}
}
if ($isJSON) {
$oldValue = Zend_Json::$useBuiltinEncoderDecoder;
Zend_Json::$useBuiltinEncoderDecoder = false;
$decodeValue = Zend_Json::decode($value);
if (isset($decodeValue)) {
$value = $decodeValue;
}
Zend_Json::$useBuiltinEncoderDecoder = $oldValue;
}
//Handled for null because vtlib_purify returns empty string
if (!empty($value)) {
$value = vtlib_purify($value);
}
return $value;
}
示例10: process
function process(Mobile_API_Request $request)
{
$mode = $request->get('mode');
$module = $this->cachedModule($request->get('module'));
$searchIn = $this->cachedSearchFields($module->name());
if ($mode == 'update') {
$searchIn = array();
foreach ($_REQUEST as $k => $v) {
if (preg_match("/field_(.*)/i", $k, $m)) {
$searchIn[] = vtlib_purify($m[1]);
}
}
$this->cacheSearchFields($module->name(), $searchIn);
header("Location: index.php?_operation=listModuleRecords&module={$module->name()}&mode=search");
exit;
}
$request->setDefault('record', "{$module->id()}x0");
$wsResponse = parent::process($request);
$wsResponseResult = $wsResponse->getResult();
$templateRecord = Mobile_UI_ModuleRecordModel::buildModelFromResponse($wsResponseResult['record']);
$viewer = new Mobile_UI_Viewer();
$viewer->assign('_MODULE', $module);
$viewer->assign('_RECORD', $templateRecord);
$viewer->assign('_SEARCHIN', $searchIn);
$viewer->assign('_SEARCHIN_ALL', empty($searchIn));
$response = $viewer->process('generic/SearchConfig.tpl');
return $response;
}
示例11: vtSaveWorkflowTemplate
function vtSaveWorkflowTemplate($adb, $request)
{
$util = new VTWorkflowUtils();
$module = new VTWorkflowApplication("savetemplate");
$mod = return_module_language($current_language, $module->name);
if (!$util->checkAdminAccess()) {
$errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NOT_ADMIN']);
$util->redirectTo($errorUrl, $mod['LBL_ERROR_NOT_ADMIN']);
return;
}
$title = vtlib_purifyForSql($request['title']);
$workflowId = $request['workflow_id'];
$wfs = new VTworkflowManager($adb);
$workflow = $wfs->retrieve($workflowId);
$tm = new VTWorkflowTemplateManager($adb);
$tpl = $tm->newTemplate($title, $workflow);
$tm->saveTemplate($tpl);
$returnUrl = vtlib_purify($request['return_url']);
?>
<script type="text/javascript" charset="utf-8">
window.location="<?php
echo $returnUrl;
?>
";
</script>
<a href="<?php
echo $returnUrl;
?>
">Return</a>
<?php
}
示例12: process
public function process(Vtiger_Request $request)
{
// SalesPlatform.ru begin
require_once 'includes/SalesPlatform/NetIDNA/idna_convert.class.php';
// SalesPlatform.ru end
$outgoingServerSettingsModel = Settings_Vtiger_Systems_Model::getInstanceFromServerType('email', 'OutgoingServer');
$loadDefaultSettings = $request->get('default');
if ($loadDefaultSettings == "true") {
$outgoingServerSettingsModel->loadDefaultValues();
} else {
$outgoingServerSettingsModel->setData($request->getAll());
}
$response = new Vtiger_Response();
// SalesPlatform.ru begin
$idn = new idna_convert();
$server_username = $idn->encode(vtlib_purify($request->get('server')));
$from_email_field = $idn->encode(vtlib_purify($request->get('from_email_field')));
$request->set('server_username', $server_username);
$request->set('from_email_field', $from_email_field);
// SalesPlatform.ru end
try {
$id = $outgoingServerSettingsModel->save($request);
$data = $outgoingServerSettingsModel->getData();
$response->setResult($data);
} catch (Exception $e) {
$response->setError($e->getCode(), $e->getMessage());
}
$response->emit();
}
示例13: vtSaveTask
function vtSaveTask($adb, $request)
{
$util = new VTWorkflowUtils();
$module = new VTWorkflowApplication("savetask");
$mod = return_module_language($current_language, $module->name);
if (!$util->checkAdminAccess()) {
$errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NOT_ADMIN']);
$util->redirectTo($errorUrl, $mod['LBL_ERROR_NOT_ADMIN']);
return;
}
$tm = new VTTaskManager($adb);
if (isset($request["task_id"])) {
$task = $tm->retrieveTask($request["task_id"]);
} else {
$taskType = vtlib_purifyForSql($request["task_type"]);
$workflowId = $request["workflow_id"];
$task = $tm->createTask($taskType, $workflowId);
}
$task->summary = $request["summary"];
if ($request["active"] == "true") {
$task->active = true;
} else {
if ($request["active"] == "false") {
$task->active = false;
}
}
if (isset($request['check_select_date'])) {
$trigger = array('days' => ($request['select_date_direction'] == 'after' ? 1 : -1) * (int) $request['select_date_days'], 'field' => $request['select_date_field']);
$task->trigger = $trigger;
} else {
$task->trigger = null;
}
$fieldNames = $task->getFieldNames();
foreach ($fieldNames as $fieldName) {
$task->{$fieldName} = $request[$fieldName];
if ($fieldName == 'calendar_repeat_limit_date') {
$task->{$fieldName} = DateTimeField::convertToDBFormat($request[$fieldName]);
}
}
$tm->saveTask($task);
if (isset(vtlib_purify($request["return_url"]))) {
$returnUrl = vtlib_purify($request["return_url"]);
} else {
$returnUrl = $module->editTaskUrl($task->id);
}
?>
<script type="text/javascript" charset="utf-8">
window.location="<?php
echo $returnUrl;
?>
";
</script>
<a href="<?php
echo $returnUrl;
?>
">Return</a>
<?php
}
示例14: vtWorkflowSave
function vtWorkflowSave($adb, $request)
{
$util = new VTWorkflowUtils();
$module = new VTWorkflowApplication("saveworkflow");
$mod = return_module_language($current_language, $module->name);
$request = vtlib_purify($request);
// this cleans all values of the array
if (!$util->checkAdminAccess()) {
$errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NOT_ADMIN']);
$util->redirectTo($errorUrl, $mod['LBL_ERROR_NOT_ADMIN']);
return;
}
$description = from_html($request["description"]);
$moduleName = $request["module_name"];
$conditions = $request["conditions"];
$taskId = $request["task_id"];
$saveType = $request["save_type"];
$executionCondition = $request['execution_condition'];
$wm = new VTWorkflowManager($adb);
if ($saveType == 'new') {
$wf = $wm->newWorkflow($moduleName);
$wf->description = $description;
$wf->test = $conditions;
$wf->taskId = $taskId;
$wf->executionConditionAsLabel($executionCondition);
$wm->save($wf);
} else {
if ($saveType == 'edit') {
$wf = $wm->retrieve($request["workflow_id"]);
$wf->description = $description;
$wf->test = $conditions;
$wf->taskId = $taskId;
$wf->executionConditionAsLabel($executionCondition);
$wm->save($wf);
} else {
throw new Exception();
}
}
if (isset($request["return_url"])) {
$returnUrl = $request["return_url"];
} else {
$returnUrl = $module->editWorkflowUrl($wf->id);
}
?>
<script type="text/javascript" charset="utf-8">
window.location="<?php
echo $returnUrl;
?>
";
</script>
<a href="<?php
echo $returnUrl;
?>
">Return</a>
<?php
}
示例15: get
function get($key, $defvalue = '', $purify = true)
{
if (isset($this->valuemap[$key])) {
return $purify ? vtlib_purify($this->valuemap[$key]) : $this->valuemap[$key];
}
if ($defvalue === '' && isset($this->defaultmap[$key])) {
$defvalue = $this->defaultmap[$key];
}
return $defvalue;
}