本文整理汇总了PHP中create_guid函数的典型用法代码示例。如果您正苦于以下问题:PHP create_guid函数的具体用法?PHP create_guid怎么用?PHP create_guid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_guid函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addDashlet
function addDashlet()
{
if (!is_file($GLOBALS['sugar_config']['cache_dir'] . 'dashlets/dashlets.php')) {
require_once 'include/Dashlets/DashletCacheBuilder.php';
$dc = new DashletCacheBuilder();
$dc->buildCache();
}
require_once $GLOBALS['sugar_config']['cache_dir'] . 'dashlets/dashlets.php';
global $current_user;
if (isset($_REQUEST['id'])) {
$pages = $current_user->getPreference('pages', $this->type);
$dashlets = $current_user->getPreference('dashlets', $this->type);
$guid = create_guid();
if (isset($_REQUEST['type_module'])) {
$dashlet_module = $_REQUEST['type_module'];
} elseif (isset($dashletsFiles[$_REQUEST['id']]['module'])) {
$dashlet_module = $dashletsFiles[$_REQUEST['id']]['module'];
} else {
$dashlet_module = 'Home';
}
$dashlets[$guid] = array('className' => $dashletsFiles[$_REQUEST['id']]['class'], 'module' => $dashlet_module, 'fileLocation' => $dashletsFiles[$_REQUEST['id']]['file']);
// add to beginning of the array
array_unshift($pages[$_REQUEST['activeTab']]['columns'][0]['dashlets'], $guid);
$current_user->setPreference('dashlets', $dashlets, 0, $this->type);
echo $guid;
} else {
echo 'ofdaops';
}
}
示例2: pre_save
public function pre_save()
{
require_once 'include/upload_file.php';
$upload_file = new UploadFile('filename_file');
if (isset($_FILES['filename_file']) && $upload_file->confirm_upload()) {
$filename = $upload_file->get_stored_file_name();
$file_ext = $upload_file->file_ext;
if (empty($this->bean->id)) {
$this->bean->id = create_guid();
$this->bean->new_with_id = true;
}
$account = null;
if (isset($_POST['xphotobucketaccount_id'])) {
$account = BeanFactory::getBean('xPhotobucketAccounts', $_POST['xphotobucketaccount_id']);
}
// $resp = $account->upload_media('image', $upload_file->temp_file_location, "{$this->bean->id}.{$file_ext}", $_POST['name']);
$resp = $account->upload_media('base64', base64_encode(file_get_contents($upload_file->temp_file_location)), "{$this->bean->id}.{$file_ext}", $_POST['name']);
$this->bean->browse_url = $resp['browseurl'];
$this->bean->image_url = $resp['url'];
$this->bean->thumb_url = $resp['thumb'];
} else {
echo "Upload file error";
sugar_cleanup(true);
}
parent::pre_save();
}
示例3: createUser
protected function createUser($userData)
{
$user = new User();
$user->user_name = $userData['email'];
$user->email = $userData['email'];
$user->email1 = $userData['email'];
$user->first_name = $userData['first_name'];
$user->last_name = $userData['last_name'];
$user->status = 'Active';
$user->is_admin = 0;
$user->external_auth_only = 1;
$user->system_generated_password = 0;
$user->authenticate_id = $userData['remote_id'];
$user->receive_notifications = 0;
if (!empty($userData['photo'])) {
$picid = create_guid();
if (copy($userData['photo'], "upload://{$picid}")) {
$user->picture = $picid;
}
}
$user->id = 'rmt-' . md5($userData['remote_id']);
$user->new_with_id = true;
$user->save();
$user->setPreference('ut', 1);
$user->savePreferencesToDB();
return $user->id;
}
示例4: testRepairXSSNotDuplicating
public function testRepairXSSNotDuplicating()
{
$this->note1 = new Note();
$this->note1->id = create_guid();
$this->note1->new_with_id = true;
$this->note1->name = "[Bug47069] Not deleted Note";
$this->note1->description = "This note shouldn't be deleted.";
$this->note1->save();
$this->note2 = new Note();
$this->note2->id = create_guid();
$this->note2->new_with_id = true;
$this->note2->name = "[Bug47069] Deleted Note";
$this->note2->description = "This note should be deleted.";
$this->note2->deleted = 1;
$this->note2->save();
ob_start();
$_REQUEST['adminAction'] = 'refreshEstimate';
$_REQUEST['bean'] = 'Notes';
require_once 'modules/Administration/Async.php';
$firstEstimate = $out;
ob_end_clean();
ob_start();
$_REQUEST['adminAction'] = 'repairXssExecute';
$_REQUEST['bean'] = 'Notes';
$_REQUEST['id'] = json_encode(array($this->note1->id, $this->note2->id));
require_once 'modules/Administration/Async.php';
ob_end_clean();
ob_start();
$_REQUEST['adminAction'] = 'refreshEstimate';
$_REQUEST['bean'] = 'Notes';
require_once 'modules/Administration/Async.php';
$secondEstimate = $out;
ob_end_clean();
$this->assertEquals($firstEstimate['count'], $secondEstimate['count'], 'The record count should not increase after a repair XSS');
}
示例5: generateLayout
public function generateLayout($thisLayout, $height)
{
$layoutGuid = create_guid();
//$layoutString = '<script type="text/javascript" src="modules/KReports/javascript/kreportsvisualizationmanager.js"></script>';
// write the registry
if (count($this->pluginRegistry) > 0) {
$layoutString .= '<script type="text/javascript">K.kreports.visualizationmanager.myID="vis' . $layoutGuid . '";K.kreports.visualizationmanager.registeredPlugins=' . json_encode($this->pluginRegistry) . '</script>';
}
// write the header data
foreach ($this->headerData as $plugin => $pluginData) {
$layoutString .= $pluginData['object']->getHeader();
}
$layoutString .= "<div id='vis" . $layoutGuid . "' style='margin-top: 5px;position: relative;height:" . $height . "px;'>";
for ($i = 0; $i < count($this->layouts[$thisLayout]['items']); $i++) {
if (isset($this->itemData[$i + 1])) {
$layoutString .= "<div id='" . $this->itemData[$i + 1]['divID'] . "' style='position:absolute;" . "top:" . $this->layouts[$thisLayout]['items'][$i]['top'] . ";" . "left:" . $this->layouts[$thisLayout]['items'][$i]['left'] . ";" . "height:" . $this->layouts[$thisLayout]['items'][$i]['height'] . ";" . "width:" . $this->layouts[$thisLayout]['items'][$i]['width'] . ($this->layouts[$thisLayout]['items'][$i]['style'] != '' ? '; ' . $this->layouts[$thisLayout]['items'][$i]['style'] : '') . "'></div>";
$layoutString .= $this->itemData[$i + 1]['addDivData'];
$layoutString .= $this->itemData[$i + 1]['content'];
} else {
$layoutString .= "<div id='vis" . $layoutGuid . "_" . $i . "' style='position:absolute;border: 2px solid white;background:grey;" . "top:" . $this->layouts[$thisLayout]['items'][$i]['top'] . ";" . "left:" . $this->layouts[$thisLayout]['items'][$i]['left'] . ";" . "height:" . $this->layouts[$thisLayout]['items'][$i]['height'] . ";" . "width:" . $this->layouts[$thisLayout]['items'][$i]['width'] . ($this->layouts[$thisLayout]['items'][$i]['style'] != '' ? '; ' . $this->layouts[$thisLayout]['items'][$i]['style'] : '') . "'></div>";
}
}
$layoutString .= "</div>";
return $layoutString;
}
示例6: run
public function run()
{
// are we coming from 6.7 but before 7.0
if (!version_compare($this->from_version, '6.7.0', '>=') || !version_compare($this->from_version, '7.0', '<')) {
return;
}
// we need to anything other than ENT and ULT
if (!$this->fromFlavor('pro')) {
return;
}
$this->log('Creating Forecast Worksheet Draft Records');
$sql = "SELECT '' as id, " . "fw.name, " . "fw.date_entered, " . "fw.date_modified, " . "fw.modified_user_id, " . "fw.created_by, " . "fw.description, " . "fw.deleted, " . "fw.assigned_user_id, " . "fw.team_id, " . "fw.team_set_id, " . "fw.parent_id, " . "fw.parent_type, " . "fw.likely_case, " . "fw.best_case, " . "fw.worst_case, " . "fw.base_rate, " . "fw.currency_id, " . "fw.date_closed, " . "fw.date_closed_timestamp, " . "fw.sales_stage, " . "fw.probability, " . "fw.commit_stage, " . "1 as draft, " . "fw.opportunity_id, " . "fw.opportunity_name, " . "fw.account_name, " . "fw.account_id, " . "fw.campaign_id, " . "fw.campaign_name, " . "fw.product_template_id, " . "fw.product_template_name, " . "fw.category_id, " . "fw.category_name, " . "fw.sales_status, " . "fw.next_step, " . "fw.lead_source, " . "fw.product_type, " . "fw.list_price, " . "fw.cost_price, " . "fw.discount_price, " . "fw.discount_amount, " . "fw.quantity, " . "fw.total_amount " . "FROM forecast_worksheets fw " . "LEFT JOIN forecast_worksheets fw2 " . "ON fw.parent_type = fw2.parent_type " . "AND fw.parent_id = fw2.parent_id " . "AND fw2.draft = 1 " . "WHERE fw.deleted = 0 " . "AND fw.draft = 0 " . "AND fw2.id IS NULL";
$results = $this->db->query($sql);
$insertSQL = 'INSERT INTO forecast_worksheets ';
/* @var $fw ForecastWorksheet */
$fw = BeanFactory::getBean('ForecastWorksheets');
while ($row = $this->db->fetchByAssoc($results)) {
$row['id'] = create_guid();
foreach ($row as $key => $value) {
$fieldDefs = $fw->getFieldDefinition($key);
$convertedValue = $this->db->fromConvert($value, $this->db->getFieldType($fieldDefs));
$row[$key] = $this->db->massageValue($convertedValue, $fieldDefs);
}
$this->db->query($insertSQL . '(' . join(',', array_keys($row)) . ') VALUES (' . join(',', $row) . ');');
}
$this->log('Done Creating Forecast Worksheet Draft Records');
}
示例7: mapQuoteToOpportunity
/**
* Maps Quote Values to the Opportunity
*
* @param Quote $quote
* @param Opportunity $opp
*/
protected function mapQuoteToOpportunity(Quote $quote, Opportunity $opp)
{
// @codeCoverageIgnoreStart
global $app_list_strings;
// @codeCoverageIgnoreEnd
$forecastConfig = $this->getForecastConfig();
$opp->id = create_guid();
$opp->new_with_id = true;
$opp->assigned_user_id = $quote->assigned_user_id;
$opp->date_closed = $quote->date_quote_expected_closed;
$opp->name = $quote->name;
$opp->assigned_user_name = $quote->assigned_user_name;
$opp->lead_source = isset($app_list_strings['lead_source_dom']['Self Generated']) ? 'Self Generated' : null;
$opp->opportunity_type = isset($app_list_strings['opportunity_type_dom']['New Business']) ? $app_list_strings['opportunity_type_dom']['New Business'] : null;
$opp->team_id = $quote->team_id;
// TODO: this will need to change when we have the switch for Opportunities,
// TODO: but since that is not done yet this will use the forecast_by.
if ($forecastConfig['forecast_by'] == 'Opportunities') {
// just setting sales_stage will now set probability correctly
$opp->sales_stage = isset($app_list_strings['sales_stage_dom']['Proposal/Price Quote']) ? 'Proposal/Price Quote' : null;
$opp->amount = $quote->total;
}
$opp->quote_id = $quote->id;
$opp->currency_id = $quote->currency_id;
$opp->base_rate = $quote->base_rate;
$opp->account_id = $quote->billing_account_id;
// save the opp so we can add the products to it.
$opp->save();
}
示例8: setUp
public function setUp()
{
$GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser();
$this->_account = new Account();
$this->_account->name = 'Account_' . create_guid();
$this->_account->save();
}
示例9: saveFilePut
/**
* Saves a file to a module field using the PUT method
*
* @param ServiceBase $api The service base
* @param array $args Arguments array built by the service base
* @param string $stream
*
* @throws SugarApiExceptionMissingParameter
* @return array
*/
public function saveFilePut($api, $args, $stream = 'php://input')
{
// Mime type, set to null for grabbing it later if not sent
$filetype = isset($_SERVER['HTTP_CONTENT_TYPE']) ? $_SERVER['HTTP_CONTENT_TYPE'] : null;
// Set the filename, first from the passed args then from the request itself
if (isset($args['filename'])) {
$filename = $args['filename'];
} else {
$filename = isset($_SERVER['HTTP_FILENAME']) ? $_SERVER['HTTP_FILENAME'] : create_guid();
}
// Legacy support for base64 encoded file data
$encoded = $this->isFileEncoded($api, $args);
// Create a temp name for our file to begin mocking the $_FILES array
$tempfile = $this->getTempFileName();
$this->createTempFileFromInput($tempfile, $stream, $encoded);
// Now validate our file
$filesize = filesize($tempfile);
$this->checkPutRequestBody($filesize);
// Now get our actual mime type from our internal methodology if it wasn't passed
if (empty($filetype)) {
require_once 'include/download_file.php';
$dl = new DownloadFileApi($api);
$filetype = $dl->getMimeType($tempfile);
}
// Mock a $_FILES array member, adding in _SUGAR_API_UPLOAD to allow file uploads
$_FILES[$args['field']] = array('name' => $filename, 'type' => $filetype, 'tmp_name' => $tempfile, 'error' => 0, 'size' => $filesize, '_SUGAR_API_UPLOAD' => true);
// Now that we are set up, hand this off to the POST save handler
$return = $this->saveFilePost($api, $args);
// Handle temp file cleanup
if (file_exists($tempfile)) {
unlink($tempfile);
}
// Send back our result
return $return;
}
示例10: start
function start()
{
$this->db = DBManagerFactory::getInstance();
$this->userDemoData = new UserDemoData($this->user, false);
$this->trackerManager = TrackerManager::getInstance();
foreach ($this->modules as $mod) {
$query = "select id from {$mod}";
$result = $this->db->limitQuery($query, 0, 50);
$ids = array();
while ($row = $this->db->fetchByAssoc($result)) {
$ids[] = $row['id'];
}
//while
$this->beanIdMap[$mod] = $ids;
}
while ($this->monitorIds-- > 0) {
$this->monitorId = create_guid();
$this->trackerManager->setMonitorId($this->monitorId);
$this->user = $this->userDemoData->guids[array_rand($this->userDemoData->guids)];
$this->module = $this->modules[array_rand($this->modules)];
$this->action = $this->actions[array_rand($this->actions)];
$this->date = $this->randomTimestamp();
$this->populate_tracker();
$this->populate_tracker_perf();
$this->populate_tracker_sessions();
$this->populate_tracker_queries();
$this->trackerManager->save();
}
}
示例11: save
public function save(&$bean, $params, $field, $vardef, $prefix = '')
{
$fakeDisplayParams = array();
$this->fillInOptions($vardef, $fakeDisplayParams);
require_once 'include/upload_file.php';
$upload_file = new UploadFile($prefix . $field . '_file');
//remove file
if (isset($_REQUEST['remove_file_' . $field]) && $params['remove_file_' . $field] == 1) {
$upload_file->unlink_file($bean->{$field});
$bean->{$field} = "";
}
$move = false;
if (isset($_FILES[$prefix . $field . '_file']) && $upload_file->confirm_upload()) {
if ($this->verify_image($upload_file)) {
$bean->{$field} = $upload_file->get_stored_file_name();
$move = true;
} else {
//not valid image.
$GLOBALS['log']->fatal("Image Field : Not a Valid Image.");
$temp = $vardef['vname'];
$temp = translate($temp, $bean->module_name);
SugarApplication::appendErrorMessage($temp . " Field : Not a valid image format.");
}
}
if (empty($bean->id)) {
$bean->id = create_guid();
$bean->new_with_id = true;
}
if ($move) {
$upload_file->final_move($bean->id . '_' . $field);
//BEAN ID IS THE FILE NAME IN THE INSTANCE.
$upload_file->upload_doc($bean, $bean->id, $params[$prefix . $vardef['docType']], $bean->{$field}, $upload_file->mime_type);
} else {
if (!empty($old_id)) {
// It's a duplicate, I think
if (empty($params[$prefix . $vardef['docUrl']])) {
$upload_file->duplicate_file($old_id, $bean->id, $bean->{$field});
} else {
$docType = $vardef['docType'];
$bean->{$docType} = $params[$prefix . $field . '_old_doctype'];
}
} else {
if (!empty($params[$prefix . $field . '_remoteName'])) {
// We aren't moving, we might need to do some remote linking
$displayParams = array();
$this->fillInOptions($vardef, $displayParams);
if (isset($params[$prefix . $vardef['docId']]) && !empty($params[$prefix . $vardef['docId']]) && isset($params[$prefix . $vardef['docType']]) && !empty($params[$prefix . $vardef['docType']])) {
$bean->{$field} = $params[$prefix . $field . '_remoteName'];
require_once 'include/utils/file_utils.php';
$extension = get_file_extension($bean->{$field});
if (!empty($extension)) {
$bean->file_ext = $extension;
$bean->file_mime_type = get_mime_content_type_from_filename($bean->{$field});
}
}
}
}
}
}
示例12: testIsOwner
/**
* Test asserts that fetched row has more priority then property
*
* @group 60442
* @return void
*/
public function testIsOwner()
{
$bean = new SugarBean();
$bean->id = create_guid();
$bean->fetched_row['assigned_user_id'] = 1;
$bean->assigned_user_id = 2;
$this->assertTrue($bean->isOwner(1), 'Incorrect ownership');
}
示例13: Node
function Node($id, $label, $show_expanded = false)
{
$this->_label = $label;
$this->_properties['label'] = $label;
$this->uid = create_guid();
$this->set_property('id', $id);
$this->expanded = $show_expanded;
}
示例14: insertDefaults
/**
* inserts default (usually US Dollar) as default currency
*/
function insertDefaults()
{
global $sugar_config;
$insert = true;
if ($insert) {
$q = "INSERT INTO currencies (id, name, symbol, iso4217, conversion_rate, status, deleted, date_entered, date_modified, created_by)\n\t\t\t\t\tVALUES('" . create_guid() . "', \n\t\t\t\t\t\t'{$sugar_config['default_currency_name']}',\n\t\t\t\t\t\t'{$sugar_config['default_currency_symbol']}',\n\t\t\t\t\t\t'{$sugar_config['default_currency_iso4217']}',\n\t\t\t\t\t\t1.0, 'Active', 0, '" . date($GLOBALS['timedate']->get_db_date_time_format()) . "', '" . date($GLOBALS['timedate']->get_db_date_time_format()) . "', '1')";
}
}
示例15: setRelationship
function setRelationship($fit_id, $account_id)
{
global $db;
$id = create_guid();
// Tao ID cho relate record theo chuan cua Sugar
$queryIns = " INSERT INTO accounts_fits_c\r\n VALUES (\r\n '" . $id . "',\r\n NOW(),\r\n 0,\r\n '" . $account_id . "',\r\n '" . $fit_id . "'\r\n )";
$db->query($queryIns);
}