本文整理汇总了PHP中CoreUtils类的典型用法代码示例。如果您正苦于以下问题:PHP CoreUtils类的具体用法?PHP CoreUtils怎么用?PHP CoreUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CoreUtils类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: checkUserPermissionsForRecord
protected function checkUserPermissionsForRecord()
{
if ($this->currentUser['adminRole'] < $this->adminRoles['adminRoleSuperadmin'] && $this->currentUser['id'] != $this->record['id']) {
CoreServices2::getDB()->transactionCommit();
CoreUtils::redirect($this->getListPageAddress());
}
}
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:7,代码来源:AdminCMSEditController.class.php
示例2: prepareData
public function prepareData()
{
parent::prepareData();
if (CoreServices2::getRequest()->getFromGet('_sm')) {
$this->successMessage = 1;
return;
}
$this->dao = new UserDAO();
$this->initRecord();
$this->initForm();
$this->createFormFields();
if (empty($this->record['id'])) {
// @TODO: własciwie w tym wypadku powinno sie przejść z powrotem do pierwszego
// formularza i rozpocząć całą procedurę od nowa
$this->errorMessageContainer = new CoreFormValidationMessageContainer();
$this->errorMessageContainer->addMessage('errorInvalidCode');
return;
}
if ($this->form->isSubmitted()) {
$this->addFormValidators();
$this->form->setFieldValuesFromRequest();
$this->handleRequest();
} else {
$this->setFormFieldValuesFromRecord();
}
if (!empty($this->redirectAddress)) {
CoreUtils::redirect($this->redirectAddress);
}
}
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:29,代码来源:UserWebsitePasswordRecovery2Controller.class.php
示例3: process
/**
* Processes a preference item's new value
*
* @param string $key
*
* @return mixed
*/
static function process($key)
{
$value = isset($_POST['value']) ? CoreUtils::trim($_POST['value']) : null;
switch ($key) {
case "cg_itemsperpage":
$thing = 'Color Guide items per page';
if (!is_numeric($value)) {
throw new \Exception("{$thing} must be a number");
}
$value = intval($value, 10);
if ($value < 7 || $value > 20) {
throw new \Exception("{$thing} must be between 7 and 20");
}
break;
case "p_vectorapp":
if (!empty($value) && !isset(CoreUtils::$VECTOR_APPS[$value])) {
throw new \Exception("The specified app is invalid");
}
break;
case "p_hidediscord":
case "p_disable_ga":
case "cg_hidesynon":
case "cg_hideclrinfo":
$value = $value ? 1 : 0;
break;
case "discord_token":
Response::fail("You cannot change the {$key} setting");
}
return $value;
}
开发者ID:ponydevs,项目名称:MLPVC-RR,代码行数:37,代码来源:UserPrefs.php
示例4: initRecord
protected function initRecord()
{
parent::initRecord();
if (empty($this->record['id']) || $this->record['subpageModule'] != 'Subpage' || $this->record['subpageMode'] != 'Website') {
CoreUtils::redirect($this->getListPageAddress());
}
}
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:7,代码来源:SubpageCMSEditController.class.php
示例5: getTimeRemaining
/**
* Ta funkcja zwraca na razie liczbę dni, godzin, minut, sekund
* pozostających do momentu podanego w parametrze. Podanie ilości
* miesięcy i lat to trochę gorsza sprawa (szczególnie z miesiącami
* jest problem koncepcyjny).
* @param string
* @return array
*/
public function getTimeRemaining($time)
{
$timeSeconds = strtotime($time) - strtotime(CoreUtils::getDateTime());
if ($timeSeconds <= 0) {
return null;
}
return array('timeSeconds' => $timeSeconds, 's' => $timeSeconds % 60, 'm' => floor($timeSeconds / 60) % 60, 'h' => floor($timeSeconds / (60 * 60)) % 24, 'D' => floor($timeSeconds / (60 * 60 * 24)));
}
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:16,代码来源:CoreTime.class.php
示例6: eventFinish
public function eventFinish($category, $eventName)
{
$eventId = $this->getIdByName($eventName);
if (empty($this->info[$category]['events'][$eventId]['eventName'])) {
$this->info[$category]['events'][$eventId]['eventName'] = $eventName;
}
$this->info[$category]['events'][$eventId]['finishTime'] = CoreUtils::getTimeMicroseconds() - $this->startTime;
}
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:8,代码来源:CoreDebug.class.php
示例7: initParams
protected function initParams(&$params)
{
CoreUtils::checkConstraint(is_null($params) || is_array($params));
if (!empty($params)) {
$this->params = $params;
} else {
$this->params = array();
}
}
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:9,代码来源:MailAbstractContent.class.php
示例8: validate
public function validate($messageManager)
{
$field = $this->form->getField($this->fieldName);
$fieldValue = $field->getValue();
if (!is_null($fieldValue)) {
if (date('Y-m-d', strtotime($fieldValue)) < CoreUtils::getDate()) {
$messageManager->addMessage('dateInThePast', array($this->fieldName => $field->getCaption()));
}
}
}
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:10,代码来源:CoreFormValidatorDateNotInThePast.class.php
示例9: logAction
protected function logAction($action)
{
$logRecord = $this->logDAO->getRecordTemplate();
$logRecord['adminId'] = CoreServices2::getAccess()->getCurrentUserId();
$logRecord['recordType'] = $this->recordType;
$logRecord['recordId'] = CoreServices2::getAccess()->getCurrentUserId();
$logRecord['logTime'] = CoreUtils::getDateTime();
$logRecord['logIP'] = CoreServices2::getRequest()->getRealIP();
$logRecord['logOperation'] = $action;
$this->logDAO->save($logRecord);
}
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:11,代码来源:AdminLoginController.class.php
示例10: checkHTTPS
/**
* Teoretycznie jest to odporne na thickboxy.
*/
protected function checkHTTPS()
{
$httpsOn = CoreServices2::getUrl()->isHTTPSOn();
$httpsRequired = CoreConfig::get('Environment', 'httpsForWebsite');
if ($httpsRequired && !$httpsOn) {
CoreUtils::redirect(CoreServices2::getUrl()->getCurrentExactAddress('https'));
}
if (!$httpsRequired && $httpsOn) {
CoreUtils::redirect(CoreServices2::getUrl()->getCurrentExactAddress('http'));
}
}
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:14,代码来源:WebsiteAbstractController.class.php
示例11: redirectToPage
protected function redirectToPage($url, $layoutType)
{
switch ($layoutType) {
case 'standard':
CoreUtils::redirect(CoreServices2::getUrl()->createAddress('_m', 'Helper', '_o', 'WebsiteThickboxParentRedirect', 'url', $url));
case 'thickbox':
CoreUtils::redirect($url);
default:
throw new CoreException('Invalid layout type ' . $layoutType);
}
}
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:11,代码来源:WebsiteAbstractControllerThickboxLayout.class.php
示例12: handleRequest
protected function handleRequest()
{
$this->errorMessageContainer = $this->form->getValidationResults();
if (!$this->errorMessageContainer->isAnyErrorMessage()) {
$this->setRecordValuesFromForm();
$this->record['userEraseRequestTime'] = CoreUtils::getDateTime();
$this->record['userState'] = 'forDeletion';
$this->dao->save($this->record);
CoreServices2::getAccess()->logout();
$this->redirectToStep2();
}
}
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:12,代码来源:UserWebsiteDeleteController.class.php
示例13: add
public static function add($pointName = '')
{
if (self::$index == 0) {
self::$timePoints = array();
}
self::$timePoints[self::$index] = array();
$currentTime = CoreUtils::getTimeMicroseconds();
self::$timePoints[self::$index]['diff'] = self::$index != 0 ? $currentTime - self::$timePoints[self::$index - 1]['time'] : 0;
self::$timePoints[self::$index]['time'] = $currentTime;
self::$timePoints[self::$index]['name'] = $pointName;
self::$index++;
}
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:12,代码来源:CoreTestTime.class.php
示例14: getChildrenCount
public function getChildrenCount(&$record)
{
CoreUtils::checkConstraint(!empty($record['id']));
$db = CoreServices2::getDB();
$sql = '
SELECT COUNT(*) AS num
FROM subpage
WHERE
subpageParentId = ' . $db->prepareInputValue($record['id']);
$row = $db->getRow($sql);
return $row['num'];
}
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:12,代码来源:SubpageDAO.class.php
示例15: prepareData
public function prepareData()
{
if (!$this->isCLI()) {
CoreUtils::redirect(CoreServices::get('url')->createAddress());
}
$this->garbageCollector = new TmpRecordGarbageCollector();
try {
$this->garbageCollector->clean();
} catch (Exception $e) {
$this->reportError($e->getMessage());
}
}
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:12,代码来源:TmpRecordCronDeleteController.class.php
示例16: prepareData
public function prepareData()
{
$this->checkHTTPS();
$this->adminRoles = array_flip(CoreConfig::get('Data', 'adminRoles'));
$this->currentUser = CoreServices::get('access')->getCurrentUserData();
if (!$this->isControllerUsagePermitted()) {
CoreUtils::redirect($this->getNoPermissionsAddress());
}
$this->initDAO();
$this->initLayout();
$this->initCompany();
$this->initProject();
}
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:13,代码来源:CMSAbstractController.class.php
示例17: isValidToken
/**
* Returns boolean value, not null.
*/
public function isValidToken($token)
{
if (empty($token)) {
return False;
}
$sessionId = CoreServices::get('request')->getSessionId();
$timeMiliseconds = CoreUtils::getTimeMiliseconds();
$db = CoreServices::get('db');
$db->change($this->deleteOldTokensSQL($timeMiliseconds));
$db->change($this->insertTokenSQL($token, $sessionId, $timeMiliseconds));
$row = $db->getRow($this->checkTokenSQL($token, $sessionId));
return $row['num'] == '1';
}
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:16,代码来源:CoreFormTokenManagerDB.class.php
示例18: process
/**
* Processes a configuration item's new value
*
* @param string $key
*
* @return mixed
*/
static function process($key)
{
$value = CoreUtils::trim($_POST['value']);
if ($value === '') {
return null;
}
switch ($key) {
case "reservation_rules":
case "about_reservations":
$value = CoreUtils::sanitizeHtml($value, $key === 'reservation_rules' ? array('li', 'ol') : array('p'));
break;
}
return $value;
}
开发者ID:ponydevs,项目名称:MLPVC-RR,代码行数:21,代码来源:GlobalSettings.php
示例19: prepareData
public function prepareData()
{
parent::prepareData();
$this->initDAO();
$this->initSearchForm();
if ($this->searchForm->isSubmitted()) {
$this->searchForm->setFieldValuesFromRequest();
}
$this->initRecordList();
$this->initDeletionForm();
if ($this->deletionForm->isSubmitted()) {
$this->deletionForm->setFieldValuesFromRequest();
$this->handleDeleteRequest();
CoreUtils::redirect(CoreServices::get('url')->getCurrentPageUrl('_sm', 'MassDelete'));
}
}
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:16,代码来源:UserCMSListForDeletionController.class.php
示例20: addDynamicImageInfo
protected function addDynamicImageInfo(&$imageData)
{
if (count($imageData) < 4 || count($imageData) > 7) {
throw new CoreException('Invalid number of arguments supplied for image from database in email template!');
}
$image = $fileDAO->getRecordById($imageData[1]);
CoreUtils::checkConstraint(!empty($image['id']));
$fullName = $image['fileBaseName'] . '.' . $image['fileExtension'];
$options = $this->getDynamicImageOptions($imageData);
$resizedImagePath = $files->getResizedImageDiskPath($image['fileBaseName'], $image['fileExtension'], $options);
if (!file_exists($resizedImagePath)) {
$imagePath = $files->getDiskPath($image['fileBaseName'], $image['fileExtension']);
$files->resizeImage($resizedImagePath, $image['fileBaseName'], $image['fileExtension'], $options);
}
$this->attachments[] = array('cid' => $cid, 'fileName' => $fullName, 'filePath' => $resizedImagePath, 'mimeType' => $image['fileMimeType']);
}
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:16,代码来源:MailAbstractHTMLContent.class.php
注:本文中的CoreUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论