public function actionIndex() { //$needHelp = filter_input(INPUT_COOKIE, 'no-help', FILTER_VALIDATE_INT) ?: 0; //if ($needHelp === 0) $this->redirect('/about/'); Session::del('auth'); Session::destroy(); //$this->scripts[] = 'auth'; //$this->render('form'); if (isPOST()) { return $this->actionOpenID(); } $this->redirect('http://openid.asu.ngres/'); }
public function actionPassword() { if (!$this->authdata) { $this->redirect(); } $uid = get_param($this->authdata, 'id'); if (isPOST()) { // Submit формы (сохранение пароля) $pw = filter_input(INPUT_POST, 'pass', FILTER_SANITIZE_STRING); $ok = $this->model->changePassword($uid, $pw); $this->preparePopup($ok ? 'Пароль успешно изменен.' : 'Не удалось изменить пароль!', 'alert-info'); $this->redirect(); return; } $this->scripts[] = 'auth'; $this->data['username'] = get_param($this->authdata, 'fullname'); $this->render('change'); }
$postEntry['tags'] = $addedTags; saveEntry('posts', $post, $postEntry); foreach ($addedTags as $tag) { $tagEntry = readEntry('tags', $tag); $tagEntry['posts'][$post] = $post; saveEntry('tags', $tag, $tagEntry); } deleteEntry('drafts', $draft); redirect('view.php?post=' . $post); } else { $draftEntry = readEntry('drafts', $draft); $tagOptions = array(); foreach (listEntry('tags') as $tag) { $tagEntry = readEntry('tags', $tag); $tagOptions[$tag] = $tagEntry['name']; } $out['title'] = $lang['publishPost'] . ': ' . $draftEntry['title']; $out['content'] .= '<form action="./publish.php?draft=' . $draft . '" method="post"> <p>' . text('title', $draftEntry['title']) . '</p> <p>' . text('id', substr($draft, 20)) . '</p> <p>' . textarea('content', clean($draftEntry['content'])) . '</p> <p>' . select('locked', array('yes' => $lang['yes'], 'no' => $lang['no']), $postEntry['locked'] ? 'yes' : 'no') . '</p> <p>' . multiselect('tags', $tagOptions, $postEntry['tags']) . '</p> <p>' . submitAdmin($lang['confirm']) . '</p> </form>'; $out['content'] .= isPOST('content') ? box(cleanMagic($_POST['content'])) : ''; } } else { home(); } require 'templates/page.php';
function GETPOST($key, $def = "") { return isPOST($key) ? POST($key, $def) : GET($key, $def); }
* User: mkahn * Date: 1/5/16 * Time: 3:14 PM */ //Uncomment these lines of code to echo PHP errors during debug. //ini_set('display_errors', 1); //ini_set('display_startup_errors', 1); //error_reporting(E_ALL); require '../shared/shared.php'; function dpathFor($appId) { return 'appdata/' . $appId; } //Get the JSON body $entityBody = file_get_contents('php://input'); if (isPOST() || isPUT()) { if (isset($_REQUEST['appid'])) { $appId = $_REQUEST['appid']; $dataToSave = array("payload" => json_decode($entityBody), "lastUpdated" => getMSTime()); saveJSON(dpathFor($appId), $dataToSave); jsonOut($entityBody); } else { badReq('missing appid'); } } elseif (isDELETE()) { if (isset($_REQUEST['appid'])) { $rmRes = rmJSON(dpathFor($_REQUEST['appid'])); if ($rmRes) { echo 'deleted'; } else { badReq('No data for that app');
function checkBot() { global $lang; if (!isPOST('captcha')) { return false; } if (isset($_SESSION['captcha']) && cleanMagic($_POST['captcha']) === $_SESSION['captcha']) { return true; } message($lang['errorBot'] . ' "' . cleanMagic($_POST['captcha']) . '" needed "' . $_SESSION['captcha'] . '"'); return false; }
} } else { badReq('Wrong verb or no appid'); } break; case 'move': if (isPOST() && isset($_REQUEST['appid'])) { $res = moveApp($_REQUEST['appid']); header('Content-Type: application/json'); jsonOut(json_encode($res)); } else { badReq('Wrong verb or no appid'); } break; case 'moveToSlot': if (isPOST() && isset($_REQUEST['appid']) && isset($_REQUEST['slot'])) { $res = moveAppToSlot($_REQUEST['appid'], $_REQUEST['slot']); header('Content-Type: application/json'); jsonOut(json_encode($res)); } else { badReq('Wrong verb or no appid or no slot, dick ' . $_REQUEST['appid']); } break; case 'appsbystate': header('Content-Type: application/json'); jsonOut(json_encode(appsByState())); break; } } else { badReq('no command parameter, dipshit'); }