本文整理汇总了PHP中ST类的典型用法代码示例。如果您正苦于以下问题:PHP ST类的具体用法?PHP ST怎么用?PHP ST使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ST类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: storeRequest
public function storeRequest($vks_id)
{
try {
$vks = Vks::with('tech_support_requests')->findOrFail($vks_id);
} catch (Exception $e) {
$this->error('404');
}
$request = $this->request->request;
$this->validator->validate(['Сообщение' => [$request->get('user_message'), 'max(255)'], 'Точка' => [$request->get('att_id'), 'required|int']]);
//if no passes
if (!$this->validator->passes()) {
$this->backWithData($this->validator->errors()->all());
}
$request_new = new TechSupportRequest(array('att_id' => $request->get('att_id'), 'vks_id' => $vks->id, 'owner_id' => App::$instance->user->id, 'user_message' => $request->get('user_message'), 'status' => $vks->status == VKS_STATUS_APPROVED ? TechSupportRequest::STATUS_READY_FOR_SEND : TechSupportRequest::STATUS_WAIT_VKS_DECISION));
$flag = false;
if (count($vks->tech_support_requests)) {
foreach ($vks->tech_support_requests as $request) {
if ($request_new->att_id == $request->att_id) {
$flag = true;
}
}
}
if (!$flag) {
$request_new->save();
}
App::$instance->MQ->setMessage("Запрос успешно создан");
ST::redirectToRoute('TechSupport/showRequests/' . $vks->id);
}
示例2: store
public function store()
{
Token::checkToken();
$xml = new SimpleXMLElement('<root/>');
// dump($this->request->request->get('modules'));
// die;
if ($this->request->request->has('modules')) {
foreach ($this->request->request->get('modules') as $module) {
$this->validator->validate(['name' => [$module['name'], 'required|max(255)'], 'description' => [$module['description'], 'required|max(560)'], 'help' => [$module['help'], 'required|max(1000)'], 'value' => [$module['value'], 'between(0,1)']]);
//if no passes
if (!$this->validator->passes()) {
$this->putUserDataAtBackPack($this->request);
App::$instance->MQ->setMessage($this->validator->errors()->all());
ST::redirect("back");
}
$srvXml = $xml->addChild('module');
$srvXml->addAttribute('name', $module['name']);
$srvXml->addAttribute('description', $module['name']);
$srvXml->addAttribute('help', $module['help']);
$srvXml->addAttribute('value', intval($module['value']));
}
}
$xml->asXML("config/modules-cfg.xml");
App::$instance->MQ->setMessage('Список обновлен');
App::$instance->log->logWrite(LOG_CONFIG_CHANGE, 'Изменен список модулей системы');
ST::redirect("back");
}
示例3: run
public function run()
{
//add counter
$params = count($this->params) ? "/" . implode("/", $this->params) : "";
$mskTime = date_create()->setTimezone(new DateTimeZone(App::$instance->opt->ca_timezone));
Counter::create(['origin' => MY_NODE, 'ip' => App::$instance->user->ip, 'request' => $this->controller . "/" . $this->action . urlencode($params), 'type' => ST::isAjaxRequest() ? REQUEST_AJAX : REQUEST_REGULAR, 'created_at' => $mskTime, 'updated_at' => $mskTime]);
call_user_func_array(array(new $this->controller(), $this->action), $this->params);
}
示例4: isDefaultUserIteractBlock
private function isDefaultUserIteractBlock($id)
{
Auth::isAdminOrDie(App::$instance);
if (in_array($id, [1])) {
App::$instance->MQ->setMessage('Нелья редактировать системныe записи');
ST::redirect("back");
}
}
示例5: unmark
public function unmark($caVksId)
{
Auth::isAdminOrDie(App::$instance);
foreach (AdminCaNote::where('vks_id', $caVksId)->get() as $caVks) {
$caVks->delete();
}
App::$instance->MQ->setMessage("У ВКС ЦА {$caVksId} удален флаг");
ST::redirect('back');
}
示例6: show
function show()
{
// $this->render("test/
$s = ST::microtime_float();
$start = '2015-11-30';
$end = '2016-01-11';
$events = Vks::where('start_date_time', ">=", $start)->where('start_date_time', '<=', $end)->where('status', VKS_STATUS_APPROVED)->get();
$e = ST::microtime_float();
print $e - $s;
}
示例7: logout
public function logout()
{
global $_TB_IDENTITY;
if (Auth::isLogged(App::$instance)) {
setcookie(md5("logged" . $_TB_IDENTITY[App::$instance->user->origin]['serviceName']), false, time() - 3600, '/', Null, 0);
} else {
App::$instance->MQ->setMessage('Вы не авторизированы');
}
ST::redirectToRoute("Index/index");
}
示例8: isAdminOrDie
static function isAdminOrDie($init)
{
if ($init->user->isLogged && ($init->user->role == ROLE_ADMIN || $init->user->role == ROLE_ADMIN_MODERATOR)) {
return true;
} else {
App::$instance->log->logWrite(LOG_SECURITY, "Restricted access: Try to enter admin only allowed zone");
ST::routeToErrorPage('only-admin');
exit;
}
}
示例9: search
public function search($phrase)
{
if (ST::isAjaxRequest()) {
$vksWSC = new Vks_controller();
$result = [];
$result['ws'] = Vks::where("id", $phrase)->whereIn('status', [VKS_STATUS_APPROVED, VKS_STATUS_PENDING])->take(1)->get();
foreach ($result['ws'] as $vks) {
$vksWSC->humanize($vks);
}
print json_encode($result);
}
}
示例10: MenuChanger
static function MenuChanger()
{
if (Auth::isAdmin(App::$instance)) {
ST::deployTemplate('menus/admin.inc');
} else {
ST::deployTemplate('menus/user.inc');
}
//под меню добавить слушателя сообщений
ExceptionHandler::messageException();
//выдать путь для js, $init должен быть инициирован выше
ST::setVarPhptoJS(App::$instance->opt->appHttpPath, "appHttpPath");
}
示例11: isExist
public function isExist($key)
{
$result = false;
if (file_exists(self::SAVE_PATH . App::$instance->user->id . "_" . $key)) {
$result = true;
}
if (!ST::isAjaxRequest()) {
return $result;
} else {
print json_encode($result);
}
}
示例12: sendDeleteMail
public function sendDeleteMail($vks, $toRequester = true)
{
$vks->link = ST::linkToVksPage($vks->id, false, true);
$vksArray = $vks->toArray();
$message = App::$instance->twig->render('mails/v2/vks-delete.twig', array('vks' => $vksArray, 'http_path' => HTTP_BASE_PATH, 'appHttpPath' => NODE_HTTP_PATH));
if (!$toRequester) {
Mail::sendMailToStack($vks->owner->email, "Ваша ВКС #{$vks['id']} аннулирована", $message);
} else {
Mail::sendMailToStack(App::$instance->user->email, "ВКС #{$vks['id']} аннулирована", $message);
}
App::$instance->log->logWrite(LOG_MAIL_SENDED, "VKS WS #{$vks['id']} аннулирована");
}
示例13: delete
public function delete($id)
{
Auth::isAdminOrDie(App::$instance);
if ($id == 1) {
App::$instance->MQ->setMessage("Это удалить нельзя, просто переименуйте как вам нужно");
ST::redirect('back');
}
$department = Department::findorFail($id);
$department->delete();
App::$instance->MQ->setMessage("Успешно удалено");
App::$instance->log->logWrite(LOG_CONFIG_CHANGE, 'Подразделение удалено' . $department->name);
ST::redirectToRoute('Departments/index');
}
示例14: put
function put($adress, $theme, $message)
{
$this->validator->validate(['address' => [$adress, 'required|max(160)'], 'theme' => [$theme, 'required|max(512)'], 'message' => [$message, 'required']]);
//if no passes
if (!$this->validator->passes()) {
foreach ($this->validator->errors()->all() as $message) {
App::$instance->log->logWrite(LOG_MAIL_SENDED, $message);
}
return false;
}
$mailToStack = new MailStack();
$mailToStack->address = $adress;
$mailToStack->theme = ST::cleanUpText($theme);
$mailToStack->message = ST::cleanUpText($message);
$mailToStack->owner_ip = 0;
$mailToStack->save();
return true;
}
示例15: checkToken
static function checkToken()
{
return true;
if (!isset($_SESSION['token']) || is_null($_SESSION['token']) || is_null(Request::createFromGlobals()->get('csrf_token'))) {
throw new RuntimeException("Bad Token initialization");
}
$flag = false;
foreach ($_SESSION['token'] as $key => $token) {
if ($token === Request::createFromGlobals()->get('csrf_token')) {
$flag = true;
//drop this token
unset($_SESSION['token'][$key]);
}
}
if ($flag) {
return true;
} else {
ST::routeToErrorPage('bad-token');
}
}