本文整理汇总了PHP中Common::getPostArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Common::getPostArray方法的具体用法?PHP Common::getPostArray怎么用?PHP Common::getPostArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Common
的用法示例。
在下文中一共展示了Common::getPostArray方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onVote
private function onVote(GWF_VoteMulti $poll, $user)
{
$opts = Common::getPostArray('opt', array());
$taken = array();
$max = $poll->getNumChoices();
foreach ($opts as $i => $stub) {
$i = (int) $i;
if ($i < 1 || $i > $max) {
continue;
}
if (!in_array($i, $taken, true)) {
$taken[] = $i;
}
}
$count = count($taken);
// if ($count === 0) {
// return $this->module->error('err_no_options');
// }
if (!$poll->isMultipleChoice() && $count !== 1) {
return $this->module->error('err_no_multi');
}
if (false === $poll->onVote($user, $taken)) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
return $this->module->message('msg_voted', array(htmlspecialchars(GWF_Session::getLastURL())));
}
示例2: execute
public function execute()
{
$user = GWF_Session::getUser();
if (false === ($this->group = GWF_Group::getByID(Common::getGet('gid')))) {
return $this->module->error('err_unk_group');
}
$group = $this->group;
$groupname = $group->getVar('group_name');
if (!$user->isInGroupName($groupname)) {
return $this->module->error('err_unk_group');
}
// $gid = $group->getID();
// $groups = $user->getGroups();
// $ugo = $groups[(string)($gid)]['ug_options'];
$ugo = $user->getUserGroupOptions($group->getID());
// var_dump($ugo);
if (($ugo & (GWF_UserGroup::LEADER | GWF_UserGroup::CO_LEADER)) === 0) {
return $this->module->error('err_unk_group');
}
if (false !== ($array = Common::getPostArray('kick'))) {
return $this->onKick($group, $array) . $this->templateEdit($group);
}
if (false !== ($array = Common::getPostArray('accept'))) {
return $this->onAccept($group, $array) . $this->templateEdit($group);
}
if (false !== ($array = Common::getPostArray('co'))) {
return $this->onSetPriv($group, $array, GWF_UserGroup::CO_LEADER, true);
}
if (false !== ($array = Common::getPostArray('unco'))) {
return $this->onSetPriv($group, $array, GWF_UserGroup::CO_LEADER, false);
}
if (false !== ($array = Common::getPostArray('mod'))) {
return $this->onSetPriv($group, $array, GWF_UserGroup::MODERATOR, true);
}
if (false !== ($array = Common::getPostArray('unmod'))) {
return $this->onSetPriv($group, $array, GWF_UserGroup::MODERATOR, false);
}
if (false !== ($array = Common::getPostArray('hide'))) {
return $this->onSetPriv($group, $array, GWF_UserGroup::HIDDEN, true);
}
if (false !== ($array = Common::getPostArray('unhide'))) {
return $this->onSetPriv($group, $array, GWF_UserGroup::HIDDEN, false);
}
if (false !== Common::getPost('invite')) {
return $this->onInvite($group);
}
if (false !== Common::getPost('edit')) {
return $this->onEdit($group);
}
if (false !== Common::getPost('delete')) {
return $this->onDelete($group);
}
if (false !== Common::getPost('del_confirm')) {
return $this->onDeleteConfirm($group);
}
return $this->templateEdit($group);
}
示例3: onDeleteFolders
private function onDeleteFolders()
{
if (false !== ($error = GWF_Form::validateCSRF_WeakS())) {
return GWF_HTML::error('PM', $error, false);
}
$back = '';
foreach (Common::getPostArray('folder', array()) as $folderid => $stub) {
$back .= $this->onDeleteFolder($folderid);
}
return $back;
}
示例4: execute
public function execute()
{
GWF_Module::loadModuleDB('Forum', true);
if (false !== ($array = Common::getPostArray('part'))) {
return $this->onPart($array) . $this->templateGroups();
}
if (false !== ($array = Common::getPostArray('join'))) {
return $this->onJoin($array) . $this->templateGroups();
}
return $this->templateGroups();
}
示例5: onSolve
private function onSolve()
{
$take = array();
foreach (Common::getPostArray('password', array()) as $flagid => $pass) {
if ($pass !== '') {
$take[$flagid] = $pass;
}
}
$back = '';
if (count($take) === 1) {
$back .= $this->onSolveB(key($take), $take[key($take)]);
} elseif (count($take) > 1) {
$back .= 'ONE AT A TIME!';
}
return $back . $this->templateOverview();
}
示例6: execute
/**
* @todo try to get Navi-Name
* @todo rethink
*/
public function execute()
{
$nid = Common::getGetInt('nid');
$name = Common::getGetString('nname', 'unknown');
$back = '';
# Delete a Navigation?
if ('delete' === ($action = Common::getGet('action'))) {
if ($nid <= 0 || false === $this->onDelete($nid)) {
# couldnt delete the navi! does it exists?
$back = $this->module->error('err_delete', $name);
} else {
$back = $this->module->message('succ_delete', $name);
}
} elseif ('copy' === $action) {
$back = $this->onCopy();
} elseif (false !== ($delete = Common::getPostArray('delete'))) {
$back .= $this->onEdit($delete);
}
return $back . $this->templateAdmin();
}
示例7: multi
public static function multi($name, $selected = true, $allow_empty = true, $own_groups_only = true)
{
$user = GWF_User::getStaticOrGuest();
if (false === ($groups = GDO::table('GWF_Group')->select('group_id, group_name'))) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
if ($selected === true) {
$selected = Common::getPostArray($name, array());
}
$data = array();
if ($allow_empty) {
$data[] = array('0', GWF_HTML::lang('sel_group'));
}
while (false !== ($group = GDO::table('GWF_Group')->fetch($groups, GDO::ARRAY_N))) {
if ($own_groups_only && !$user->isInGroupName($group[1])) {
continue;
}
$data[] = $group;
}
return GWF_Select::multi($name, $data, $selected);
}
示例8: wizard_6_1
public static function wizard_6_1()
{
$names = Common::getPostArray('mod', array());
// Nothing to install Oo
if (count($names) === 0) {
return self::wizard_error('err_no_mods_selected') . self::wizard_6();
}
$back = self::wizard_h2('6_1');
$modules = GWF_ModuleLoader::loadModulesFS();
$names = Common::getPostArray('mod', array());
foreach ($modules as $id => $module) {
$module instanceof GWF_Module;
$name = $module->getName();
if (!isset($names[$name]) && !$module->isCoreModule()) {
unset($modules[$id]);
}
}
GWF_ModuleLoader::sortModules($modules, 'module_priority', 'ASC');
$back .= GWF_InstallFunctions::modules($modules, false);
$back .= self::wizard_btn('7');
return $back;
}
示例9: onAddPoll
private function onAddPoll()
{
$form = $this->getForm();
if (false !== ($errors = $form->validate($this->module))) {
return $errors . $this->templateAddPoll();
}
$opts = Common::getPostArray('opt', array());
if (count($opts) === 0) {
return $this->module->error('err_no_options') . $this->templateAddPoll();
}
$user = GWF_Session::getUser();
$name = GWF_VoteMulti::createPollName(GWF_Session::getUser());
$title = $form->getVar('title');
$gid = $form->getVar('gid');
$level = $form->getVar('level');
$reverse = isset($_POST['reverse']);
$is_multi = isset($_POST['multi']);
$guest_votes = isset($_POST['guests']);
$is_public = isset($_POST['public']);
$result = (int) $form->getVar('view');
if ($is_public && !$this->module->mayAddGlobalPoll($user)) {
return $this->module->error('err_global_poll') . $this->templateAddPoll();
}
GWF_Session::remove(self::SESS_OPTIONS);
return Module_Votes::installPollTable($user, $name, $title, $opts, $gid, $level, $is_multi, $guest_votes, $is_public, $result, $reverse);
}
示例10: getPostLangID
private function getPostLangID($field)
{
if (false === ($lid = Common::getPostArray($field, false))) {
return false;
}
unset($_POST[$field]);
$lid = key($lid);
if (false === GWF_Language::getByID($lid)) {
return false;
}
return (int) $lid;
}
示例11: onAdd
private function onAdd()
{
$form = $this->formAdd();
if (false !== ($error = $form->validate($this->module))) {
return $error . $this->templateAdd();
}
$page = $this->getPageObject($form);
$gstring = $page->getVar('page_groups');
$tags = $page->getVar('page_meta_tags');
if (false === $page->insert()) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
if (false === $page->saveVars(array('page_otherid' => $page->getID()))) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
if (false === GWF_PageGID::updateGIDs($page, Common::getPostArray('groups', array()))) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
if (false === GWF_PageTags::updateTags($page, $tags, $form->getVar('lang'))) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
if (isset($_POST['home_page']) && $this->is_author) {
$this->module->setHomePage($page->getID());
}
if (false === $this->module->writeHTA()) {
return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__));
}
if ($this->locked_mode) {
$this->module->sendModMails($page);
} else {
GWF_PageHistory::push($page);
}
return $this->locked_mode ? $this->module->message('msg_added_locked') : $this->module->message('msg_added', array(GWF_WEB_ROOT . $page->getVar('page_url'), $page->getVar('page_title')));
}
示例12: mergePostVars
private static function mergePostVars()
{
$errors = array();
$postvars = Common::getPostArray(self::POSTVARS, array());
foreach ($postvars as $key => $value) {
$value = trim($value);
if (!isset(self::$vars[$key])) {
$errors[] = self::$lang->lang('err_unknown_var', array(htmlspecialchars($key)));
continue;
}
if (false !== ($error = self::testVar($key, $value))) {
$errors[] = $error;
continue;
}
self::setVar($key, $value);
}
if (count($errors) > 0) {
echo GWF_HTML::error(self::$lang->lang('wizard'), $errors);
}
}