本文整理汇总了PHP中GetPostOrGet函数的典型用法代码示例。如果您正苦于以下问题:PHP GetPostOrGet函数的具体用法?PHP GetPostOrGet怎么用?PHP GetPostOrGet使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetPostOrGet函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: LoadPage
/**
* @access public
* @param integer PageID
* @return boolean Is true on success
*/
function LoadPage($PageID)
{
$imageID = GetPostOrGet('imageID');
//$page = GetPostOrGet('page');
if (is_numeric($imageID)) {
return $this->LoadImagePage($PageID, $imageID);
} else {
return $this->LoadGalleryPage($PageID);
}
}
示例2: GetPage
/**
* This function returns the text of the actual modulpage
* @author ComaWStefan
* @access public
* @param string Action This is the action to tell the modul what to do next
* @return string Textpage of the module to be set into the template
*/
function GetPage($Action)
{
$out = "<h2>Sitemap</h2>\r\n";
$topNode = GetPostOrGet('TopNode');
if (!is_integer($topNode)) {
$topNode = 0;
}
switch ($Action) {
default:
$out .= $this->_ShowStructure($topNode);
break;
}
return $out;
}
示例3: _sendMail
/**
* @param string MailTo The reciever of the mail
*/
function _sendMail($MailTo)
{
$mailFromName = GetPostOrGet('contact_mail_from_name');
$mailFrom = GetPostOrGet('contact_mail_from');
$message = GetPostOrGet('contact_message');
$mailError = '';
// no email
if ($mailFrom == '') {
$mailError = $this->_Lang['the_email_address_must_be_indicated'];
} else {
if (!isEMailAddress($mailFrom)) {
$mailError = $this->_Lang['this_is_a_invalid_email_address'];
}
}
$nameError = '';
// empty name
if ($mailFromName == '') {
$nameError = $this->_Lang['the_name_must_be_indicated'];
}
$messageError = '';
// empty message
if ($message == '') {
$messageError = $this->_Lang['please_enter_your_message'];
}
// if no errors occured
if ($nameError == '' && $mailError == '' && $messageError == '') {
// who is the 'real' sender
$from = $this->_Config->Get('administrator_emailaddress', 'administrator@comacms');
// the information about the sender
$fromInfo = $mailFromName . ' <' . $mailFrom . '>';
// the title of the message
$title = sprintf($this->_Lang['new_email_from_a_visitor_of_%homepage%'], $this->_Config->Get('pagename', 'homepage'));
//generate the message
$messageContent = sprintf($this->_Lang['contact_message_%from%_%message'], $fromInfo, $message);
$output = "</p><fieldset><legend>{$this->_Lang['contact']}</legend>";
// try to send the email
if (sendmail($MailTo, $from, $title, $messageContent)) {
$output .= $this->_Lang['your_message_was_sent_succesdfully'];
} else {
// TODO: try to give some hints what to do
$output .= $this->_Lang['an_error_occured_on_sending_this_message'];
}
$output .= '</fieldset><p>';
return $output;
} else {
// otherwise show the mailform to make it possible to correct the input
return $this->_mailForm($mailFromName, $mailFrom, $message, $mailError, $nameError, $messageError);
}
}
示例4: GetPage
/**
* Available actions (value of <var>$Action</var>):
* - register
* - checkRegistration
* - registerError
* - insert new user
* - complete registration
* @access public
* @param string Action text
* @return sting Pagetext
*/
function GetPage($Action)
{
$out = "";
switch ($Action) {
case 'checkRegistration':
$out .= $this->_checkRegistration(GetPostOrGet('showname'), GetPostOrGet('name'), GetPostOrGet('email'), GetPostOrGet('password'), GetPostOrGet('password_repetition'));
break;
case 'activateRegistration':
$out .= $this->_activateRegistration(GetPostOrGet('code'));
break;
default:
$out .= $this->_register();
}
return $out;
}
示例5: GetPage
/**
* Returns the code of the page
* @access public
* @param string Action Gives the name of the subpage to call
* @return string Pagedata
*/
function GetPage($Action = '')
{
$out = '';
// Get external parameters
$style = GetPostOrGet('style');
if (empty($style)) {
$style = $this->_Config->Get('style', 'comacms');
}
$save = GetPostOrGet('save');
if (!empty($save)) {
$Action = 'saveStyle';
}
switch ($Action) {
case 'saveStyle':
$this->_PagePreview->SaveStyle($style);
case 'style':
$out .= $this->_Style($style);
break;
default:
$out .= $this->_PagePreview();
break;
}
return $out;
}
示例6: _saveImage
/**
* @access public
* @return string
*/
function _saveImage()
{
$file_path = GetPostOrGet('image_path');
$article_id = GetPostOrGet('article_id');
if (file_exists($file_path)) {
$sql = "UPDATE " . DB_PREFIX . "articles SET \n\t\t\t\t\tarticle_image= '{$file_path}'\n\t\t\t\t\tWHERE article_id={$article_id}";
db_result($sql);
}
}
示例7: addGroup
/**
* @param array admin_lang
* @access private
*/
function addGroup($admin_lang)
{
// get the needed vars
$group_name = GetPostOrGet('group_name');
$group_manager = GetPostOrGet('group_manager');
$group_description = GetPostOrGet('group_description');
if ($group_name == '') {
// go back there is no group name!
header("Location: admin.php?page=groups&action=new_group&error=empty_name&group_manager={$group_manager}&group_description={$group_description}");
die;
} else {
if (is_numeric($group_manager)) {
// is this a valid call?
// check that there is no group with the same name
$sql = "SELECT *\t\r\n\t\t\t\t\tFROM " . DB_PREFIX . "groups\r\n\t\t\t\t\tWHERE group_name='{$group_name}'";
$exist_result = db_result($sql);
if ($exist = mysql_fetch_object($exist_result)) {
header("Location: admin.php?page=groups&action=new_group&error=name&group_name={$group_name}&group_manager={$group_manager}&group_description={$group_description}");
die;
}
// create the group
$sql = "INSERT INTO " . DB_PREFIX . "groups (group_name, group_manager, group_description)\r\n\t\t\t\t\tVALUES ('{$group_name}', {$group_manager}, '{$group_description}')";
db_result($sql);
// add the user to the group
$group_id = mysql_insert_id();
$sql = "INSERT INTO " . DB_PREFIX . "group_users (group_id, user_id)\r\n\t\t\t\t\tVALUES({$group_id}, {$group_manager})";
db_result($sql);
}
}
header('Location: admin.php?page=groups');
die;
}
示例8: _homePage
/**
* mainpage with an overview over all files and a form to select 3 files for an upload
* @access private
*/
function _homePage()
{
$path = GetPostOrGet('path');
if (substr($path, -1, 1) == '/') {
$path = substr($path, 0, -1);
}
$pathPart = explode('/', $path);
array_pop($pathPart);
$uppath = implode('/', $pathPart);
$pathLen = strlen($path);
$out = "\t\t\t<fieldset>\n\t \t\t\t<legend>" . $this->_Translation->GetTranslation('upload') . "</legend>\n\t\t\t\t<form enctype=\"multipart/form-data\" action=\"admin.php?page=files\" method=\"post\">\n\t\t\t\t\t<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"1600000\" />\n\t\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"upload\" />\n\t\t\t\t\t<input type=\"hidden\" name=\"path\" value=\"" . $path . "\" />\n\t\t\t\t\t<div class=\"row\">\n\t\t\t\t\t\t<label>\n\t\t\t\t\t\t\t<strong>" . $this->_Translation->GetTranslation('file') . " 1:</strong>\n\t\t\t\t\t\t</label>\n\t\t\t\t\t\t<input name=\"uploadfile0\" type=\"file\" />\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"row\">\n\t\t\t\t\t\t<label>\n\t\t\t\t\t\t\t<strong>" . $this->_Translation->GetTranslation('file') . " 2:</strong>\n\t\t\t\t\t\t</label>\n\t\t\t\t\t\t<input name=\"uploadfile1\" type=\"file\" />\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"row\">\n\t\t\t\t\t\t<label>\n\t\t\t\t\t\t\t<strong>" . $this->_Translation->GetTranslation('file') . " 3:</strong>\n\t\t\t\t\t\t</label>\n\t\t\t\t\t\t<input name=\"uploadfile2\" type=\"file\" />\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"row\">\n\t\t\t\t\t\t<input type=\"submit\" class=\"button\" value=\"" . $this->_Translation->GetTranslation('upload_files') . "\"/>\n\t\t\t\t\t</div>\n\t\t\t\t</form>\n\t\t\t\t<div class=\"row\">\n\t\t\t\t\t<a href=\"admin.php?page=files&action=check_new_files\" class=\"button\">" . $this->_Translation->GetTranslation('check_for_changes') . "</a>\n\t\t\t\t</div>\n\t\t\t</fieldset>\n\t\t\t<fieldset>\n\t \t\t\t<legend>" . $this->_Translation->GetTranslation('create_directory') . "</legend>\n\t\t\t\t<form action=\"admin.php?page=files\" method=\"post\">\n\t\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"new_dir\" />\n\t\t\t\t\t<input type=\"hidden\" name=\"path\" value=\"" . $path . "\" />\n\t\t\t\t\t<div class=\"row\">\n\t\t\t\t\t\t<label>\n\t\t\t\t\t\t\t<strong>" . $this->_Translation->GetTranslation('directory') . " </strong>\n\t\t\t\t\t\t</label>\n\t\t\t\t\t\t<input name=\"dirname\" type=\"text\" />\n\t\t\t\t\t</div>\n\t\t\t\t\t\n\t\t\t\t\t<div class=\"row\">\n\t\t\t\t\t\t<input type=\"submit\" class=\"button\" value=\"" . $this->_Translation->GetTranslation('create_directory') . "\"/>\n\t\t\t\t\t</div>\n\t\t\t\t</form>\n\t\t\t</fieldset>\t<h3>Pfad: /" . $path . "</h3>";
if ($pathLen > 0) {
$out .= "\n\t\t\t\t<div class=\"row\">\n\t\t\t\t\t<a href=\"admin.php?page=files&path=" . $uppath . "\" class=\"button\">" . $this->_Translation->GetTranslation('directory_up') . "</a>\n\t\t\t\t</div>";
}
$out .= "\n\t\t\t<table id=\"files\" class=\"text_table full_width\">\n\t\t\t\t<thead>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th>\n\t\t\t\t\t\t\t" . $this->_Translation->GetTranslation('preview') . "\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<th>\n\t\t\t\t\t\t\t<a href=\"admin.php?page=files&order=filename#files\" title=\"" . @sprintf($this->_Translation->GetTranslation('sort_ascending_by_%name%'), $this->_Translation->GetTranslation('filename')) . "\"><img alt=\"[" . @sprintf($this->_Translation->GetTranslation('sort_ascending_by_%name%'), $this->_Translation->GetTranslation('filename')) . "]\" src=\"img/up.png\"/></a>\n\t\t\t\t\t\t\t" . $this->_Translation->GetTranslation('filename') . "\n\t\t\t\t\t\t\t<a href=\"admin.php?page=files&order=filename&desc=1#files\" title=\"" . @sprintf($this->_Translation->GetTranslation('sort_descending_by_%name%'), $this->_Translation->GetTranslation('filename')) . "\"><img alt=\"[" . @sprintf($this->_Translation->GetTranslation('sort_descending_by_%name%'), $this->_Translation->GetTranslation('filename')) . "]\" src=\"img/down.png\"/></a>\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<th class=\"small_width\">\n\t\t\t\t\t\t\t<a href=\"admin.php?page=files&order=filesize#files\" title=\"" . sprintf($this->_Translation->GetTranslation('sort_ascending_by_%name%'), $this->_Translation->GetTranslation('filesize')) . "\"><img alt=\"[" . sprintf($this->_Translation->GetTranslation('sort_ascending_by_%name%'), $this->_Translation->GetTranslation('filesize')) . "]\" src=\"img/up.png\"/></a>\n\t\t\t\t\t\t\t" . $this->_Translation->GetTranslation('filesize') . "\n\t\t\t\t\t\t\t<a href=\"admin.php?page=files&order=filesize&desc=1#files\" title=\"" . sprintf($this->_Translation->GetTranslation('sort_descending_by_%name%'), $this->_Translation->GetTranslation('filesize')) . "\"><img alt=\"[" . sprintf($this->_Translation->GetTranslation('sort_descending_by_%name%'), $this->_Translation->GetTranslation('filesize')) . "]\" src=\"img/down.png\"/></a>\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<th class=\"table_date_width_plus\">\n\t\t\t\t\t\t\t<a href=\"admin.php?page=files&order=filedate#files\" title=\"" . sprintf($this->_Translation->GetTranslation('sort_ascending_by_%name%'), $this->_Translation->GetTranslation('date')) . "\"><img alt=\"[" . sprintf($this->_Translation->GetTranslation('sort_ascending_by_%name%'), $this->_Translation->GetTranslation('date')) . "]\" src=\"img/up.png\"/></a>\n\t\t\t\t\t\t\t" . $this->_Translation->GetTranslation('uploaded_on') . "\n\t\t\t\t\t\t\t<a href=\"admin.php?page=files&order=filedate&desc=1#files\" title=\"" . sprintf($this->_Translation->GetTranslation('sort_descending_by_%name%'), $this->_Translation->GetTranslation('date')) . "\"><img alt=\"[" . sprintf($this->_Translation->GetTranslation('sort_descending_by_%name%'), $this->_Translation->GetTranslation('date')) . "]\" src=\"img/down.png\"/></a>\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<th class=\"small_width\">\n\t\t\t\t\t\t\t<a href=\"admin.php?page=files&order=filetype#files\" title=\"" . sprintf($this->_Translation->GetTranslation('sort_ascending_by_%name%'), $this->_Translation->GetTranslation('filetype')) . "\"><img alt=\"[" . sprintf($this->_Translation->GetTranslation('sort_ascending_by_%name%'), $this->_Translation->GetTranslation('filetype')) . "]\" src=\"img/up.png\"/></a>\n\t\t\t\t\t\t\t" . $this->_Translation->GetTranslation('filetype') . "\n\t\t\t\t\t\t\t<a href=\"admin.php?page=files&order=filetype&desc=1#files\" title=\"" . sprintf($this->_Translation->GetTranslation('sort_descending_by_%name%'), $this->_Translation->GetTranslation('filetype')) . "\"><img alt=\"[" . sprintf($this->_Translation->GetTranslation('sort_descending_by_%name%'), $this->_Translation->GetTranslation('filetype')) . "]\" src=\"img/down.png\"/></a>\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<th class=\"table_mini_width\">\n\t\t\t\t\t\t\t<a href=\"admin.php?page=files&order=filedownloads#files\" title=\"" . sprintf($this->_Translation->GetTranslation('sort_ascending_by_%name%'), $this->_Translation->GetTranslation('downloads')) . "\"><img alt=\"[" . sprintf($this->_Translation->GetTranslation('sort_ascending_by_%name%'), $this->_Translation->GetTranslation('downloads')) . "]\" src=\"img/up.png\"/></a>\n\t\t\t\t\t\t\t<abbr title=\"" . $this->_Translation->GetTranslation('downloads') . "\">" . $this->_Translation->GetTranslation('downl') . "</abbr>\n\t\t\t\t\t\t\t<a href=\"admin.php?page=files&order=filedownloads&desc=1#files\" title=\"" . sprintf($this->_Translation->GetTranslation('sort_descending_by_%name%'), $this->_Translation->GetTranslation('downloads')) . "\"><img alt=\"[" . sprintf($this->_Translation->GetTranslation('sort_descending_by_%name%'), $this->_Translation->GetTranslation('downloads')) . "]\" src=\"img/down.png\"/></a>\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<th class=\"actions\">" . $this->_Translation->GetTranslation('actions') . "</th>\n\t\t\t\t\t</tr>\n\t\t\t\t</thead>\n\t\t\t\t\r\n";
$dateDayFormat = $this->_Config->Get('date_day_format', 'd.m.Y');
$dateTimeFormat = $this->_Config->Get('date_time_format', 'H:i:s');
$dateFormat = $dateDayFormat . ' ' . $dateTimeFormat;
$thumbnailfolder = $this->_Config->Get('thumbnailfolder', 'data/thumbnails/');
$files = new Files($this->_SqlConnection, $this->_User);
$order = FILES_NAME;
$ascending = true;
$orderByGet = GetPostOrGet('order');
$desc = GetPostOrGet('desc');
switch ($orderByGet) {
case 'filesize':
$order = FILES_SIZE;
break;
case 'filedate':
$order = FILES_DATE;
break;
case 'filetype':
$order = FILES_TYPE;
break;
case 'filedownloads':
$order = FILES_DOWNLOADS;
break;
case 'filename':
default:
$order = FILES_NAME;
break;
}
// descending or ascending?
if ($desc == 1) {
$ascending = false;
}
// get all files from the database/ which are registered in the database
$filesArrayTmp = $files->FillArray($order, $ascending);
//print str_replace(' ',' ',nl2br(print_r($fileArray, true)));
//die();
$filesCount = count($filesArrayTmp);
$filesArray = array();
for ($i = 0; $i < $filesCount; $i++) {
$fileArray = $filesArrayTmp[$i];
if (substr($fileArray['FILE_NAME'], 0, $pathLen) == $path && strlen($fileArray['FILE_NAME']) > $pathLen && !strpos($fileArray['FILE_NAME'], '/', $pathLen + 1)) {
$fileArray['FILE_SIZE'] = kbormb($fileArray['FILE_SIZE']);
$fileArray['FILE_DATE'] = date($dateFormat, $fileArray['FILE_DATE']);
$fileArray['FILE_DOWNLOAD_FILE'] = sprintf($this->_Translation->GetTranslation('download_file_%file%'), $fileArray['FILE_NAME']);
$fileArray['FILE_DELETE_FILE'] = sprintf($this->_Translation->GetTranslation('delete_file_%file%'), $fileArray['FILE_NAME']);
$fileArray['FILE_MOVE_FILE'] = sprintf($this->_Translation->GetTranslation('move_file_%file%'), $fileArray['FILE_NAME']);
$preview = '';
if (strpos($fileArray['FILE_TYPE'], 'image/') === 0) {
$image = new ImageConverter($fileArray['FILE_PATH']);
// max: 100px;
$maximum = 100;
$size = $image->CalcSizeByMax($maximum);
$imageUrl = $image->SaveResizedTo($size[0], $size[1], $thumbnailfolder, $size[0] . 'x' . $size[1] . '_');
if (file_exists($imageUrl)) {
$preview = "<img alt=\"{$fileArray['FILE_NAME']}\" src=\"" . generateUrl($imageUrl) . "\" />";
}
}
$fileArray['FILE_PREVIEW'] = $preview;
if ($pathLen > 0) {
$fileArray['FILE_NAME'] = substr($fileArray['FILE_NAME'], $pathLen + 1);
}
if ($fileArray['FILE_TYPE'] == 'dir') {
$det = $pathLen > 0 ? '/' : '';
$fileArray['FILE_NAME'] = '<a href="admin.php?page=files&path=' . $path . $det . $fileArray['FILE_NAME'] . '">' . $fileArray['FILE_NAME'] . '</a>';
}
$fileArray['FILE_ACTION'] = '';
if ($fileArray['FILE_TYPE'] != 'dir') {
$file_id = $fileArray['FILE_ID'];
$fileArray['FILE_ACTION'] .= '<a href="download.php?file_id=' . $file_id . '" ><img src="img/download.png" alt="[' . $fileArray['FILE_DOWNLOAD_FILE'] . ']" title="' . $fileArray['FILE_DOWNLOAD_FILE'] . '"/></a>';
$fileArray['FILE_ACTION'] .= '<a href="admin.php?page=files&action=move&file_id=' . $file_id . '" ><img src="img/restore.png" alt="[' . $fileArray['FILE_MOVE_FILE'] . ']" title="' . $fileArray['FILE_MOVE_FILE'] . '"/></a>';
}
$filesArray[] = $fileArray;
}
}
$this->_ComaLate->SetReplacement('FILES', $filesArray);
$this->_ComaLate->SetReplacement('SIZE_COUNT', kbormb($files->SizeCount));
$this->_ComaLate->SetReplacement('LANG_ALTOGETHER', $this->_Translation->GetTranslation('altogether'));
$out .= '<FILES:loop>
<tr>
<td>{FILE_PREVIEW}</td>
<td>{FILE_NAME}</td>
<td>{FILE_SIZE}</td>
//.........这里部分代码省略.........
示例9: LoadPage
/**
* @return void
*/
function LoadPage($pagename)
{
$load_old = false;
$change = GetPostOrGet('change');
if (is_numeric($change) && $this->_User->IsLoggedIn && $change != 0) {
$load_old = true;
} else {
$change = 0;
}
if ($load_old) {
$sql = "SELECT *\r\n\t\t\t\t\tFROM " . DB_PREFIX . "pages_history\r\n\t\t\t\t\tWHERE page_id={$pagename}\r\n\t\t\t\t\tORDER BY page_date ASC\r\n\t\t\t\t\tLIMIT " . ($change - 1) . ",1";
} else {
$sql = "SELECT *\r\n\t\t\t\t\t\tFROM " . DB_PREFIX . "pages\r\n\t\t\t\t\t\tWHERE page_name='{$pagename}' AND page_lang='{$this->_Translation->OutputLanguage}'";
}
$page_result = $this->_SqlConnection->SqlQuery($sql);
if (!($page_data = mysql_fetch_object($page_result))) {
$sql = "SELECT *\r\n\t\t\t\t\t\tFROM " . DB_PREFIX . "pages\r\n\t\t\t\t\t\tWHERE page_name='{$pagename}'";
$page_result = $this->_SqlConnection->SqlQuery($sql);
if (!($page_data = mysql_fetch_object($page_result))) {
$sql = "SELECT *\r\n\t\t\t\t\t\t\tFROM " . DB_PREFIX . "pages\r\n\t\t\t\t\t\t\tWHERE page_id='{$pagename}'";
$page_result = $this->_SqlConnection->SqlQuery($sql);
if (!($page_data = mysql_fetch_object($page_result))) {
header("Location: special.php?page=404&want={$pagename}");
die;
}
}
}
//TODO: access deleted pages
if (!$load_old && $page_data->page_access == 'deleted') {
header("Location: special.php?page=410&want={$pagename}");
//HTTP 410 Gone
die;
}
//TODO: generate a warning if an 'old' page is shown
$this->Title = $page_data->page_title;
$this->PositionOfPage($page_data->page_id);
$this->PageID = $page_data->page_id;
$this->Language = $page_data->page_lang;
if ($page_data->page_type == 'text') {
include __ROOT__ . '/classes/page/page_text.php';
$page = new Page_Text($this->_SqlConnection, $this->_Config, $this->_Translation, $this->_ComaLate, $this->_User);
if (!is_numeric($change)) {
$change = 0;
}
$page->LoadPageFromRevision($page_data->page_id, $change);
$this->Text = $page->HTML;
} elseif ($page_data->page_type == 'gallery') {
include __ROOT__ . '/classes/page/page_gallery.php';
$page = new Page_Gallery($this->_SqlConnection, $this->_Config, $this->_Translation, $this->_ComaLate, $this->_User);
$page->LoadPage($page_data->page_id);
$this->Text = $page->HTML;
}
if ($load_old || $page_data->page_access == 'deleted') {
$this->Text = "\n<div class=\"warning\">Sie befinden sich auf einer Seite, die so wie Sie sie sehen, nicht mehr existiert.</div>\n\n" . $this->Text;
}
}
示例10: _RemoveAllUsers
/**
* Removes all users from a group after asking for confirmation
*
* @access private
* @return string A template for the confirmation formular
*/
function _RemoveAllUsers()
{
// Get external parameters
$GroupID = GetPostOrGet('group_id');
$Confirmation = GetPostOrGet('confirmation');
if ($GroupID != 0 && $Confirmation == 1) {
// we got a group... check wether it got any users and if remove all of them
$sql = 'SELECT *
FROM ' . DB_PREFIX . "group_users\n\t\t\t\t\t\tWHERE group_id='{$GroupID}'";
$result = $this->_SqlConnection->SqlQuery($sql);
if (mysql_fetch_object($result)) {
// The group got some users... remove them!
mysql_free_result($result);
$sql = 'DELETE
FROM ' . DB_PREFIX . "group_users\n\t\t\t\t\t\t\tWHERE group_id='{$GroupID}'";
$this->_SqlConnection->SqlQuery($sql);
$template = "\r\n\t\t\t\t" . $this->_ViewGroup($GroupID);
return $template;
} else {
// Nothing to do... there are no users in the group...
$template = "\r\n\t\t\t\t" . $this->_ViewGroup($GroupID);
return $template;
}
} elseif ($GroupID != 0) {
// Get some information about the group
$sql = 'SELECT group_name
FROM ' . DB_PREFIX . "groups\n\t\t\t\t\t\tWHERE group_id={$GroupID}";
$result = $this->_SqlConnection->SqlQuery($sql);
$group = mysql_fetch_object($result);
$group = $group->group_name;
mysql_free_result($result);
// Generate a formular to find a new user for the group
$formMaker = new FormMaker($this->_Translation->GetTranslation('todo'), $this->_SqlConnection);
$formMaker->AddForm('remove_all_users', 'admin.php', $this->_Translation->GetTranslation('remove'), $this->_Translation->GetTranslation('remove_all_users'), 'post');
$formMaker->AddHiddenInput('remove_all_users', 'page', 'groups');
$formMaker->AddHiddenInput('remove_all_users', 'action', 'remove_all_users');
$formMaker->AddHiddenInput('remove_all_users', 'group_id', $GroupID);
$formMaker->AddInput('remove_all_users', 'confirmation', 'select', $this->_Translation->GetTranslation('remove_users'), sprintf($this->_Translation->GetTranslation('do_you_really_want_to_remove_all_users_from_the_group_%group%?'), $group));
$formMaker->AddSelectEntry('remove_all_users', 'confirmation', true, 0, $this->_Translation->GetTranslation('no'));
$formMaker->AddSelectEntry('remove_all_users', 'confirmation', false, 1, $this->_Translation->GetTranslation('yes'));
// Generate the template to correct the inputs
$template = "\r\n\t\t\t\t" . $formMaker->GenerateSingleFormTemplate($this->_ComaLate, false);
return $template;
} else {
// Set the user back to the homepage
$template = "\r\n\t\t\t\t" . $this->_HomePage();
return $template;
}
}
示例11: UseModule
function UseModule($Identifer, $Parameters)
{
$Parameters = explode('&', $Parameters);
$all = false;
$count = 6;
$location = '%';
// parse all parameters
foreach ($Parameters as $parameter) {
$parameter = explode('=', $parameter, 2);
if (empty($parameter[1])) {
$parameter[1] = true;
}
${$parameter}[0] = $parameter[1];
}
$dates = new Dates($this->_SqlConnection, $this->_ComaLib, $this->_User, $this->_Config);
// we want to get "all" dates
if ($all) {
$count = -1;
}
$datesArray = array();
$found = 0;
// get the count of all possible matches
// if location is set, it is a conditional request
if ($location != '%') {
$found = $dates->GetExtendedCount($location);
} else {
$found = $dates->GetCount();
}
$start = 0;
$linksArray = array();
$linksTemplate = '';
$links = uniqid('LINKS_');
// it is usefull to use "page links"
if ($found > $count && $count > 1) {
$parts = $found / $count;
$max = round($parts, 0);
$max = $max >= $parts ? $max : $max + 1;
$linksTemplate = '<' . $links . ':loop>
<a href="?page={PAGE_ID}&page_nr={LINK_NR}">{LINK_TEXT}</a> {LINK_MINUS}
</' . $links . '>';
$pageNr = GetPostOrGet('page_nr');
if (!is_numeric($pageNr)) {
$pageNr = 0;
}
if ($pageNr > 0) {
$linksTemplate = '<a href="?page={PAGE_ID}&page_nr=' . ($pageNr - 1) . '">{LANG_PREVIOUS}</a> -' . $linksTemplate;
}
if ($pageNr < $max - 1) {
$linksTemplate .= ' - <a href="?page={PAGE_ID}&page_nr=' . ($pageNr + 1) . '">{LANG_NEXT}</a>';
}
for ($i = 0; $i < $parts; $i++) {
$linksArray[$i] = array('LINK_NR' => $i, 'LINK_TEXT' => $i + 1, 'LINK_MINUS' => '-');
}
$linksArray[$max - 1]['LINK_MINUS'] = '';
$this->_ComaLate->SetReplacement($links, $linksArray);
$this->_ComaLate->SetReplacement('LANG_NEXT', $this->_Translation->GetTranslation('next'));
$this->_ComaLate->SetReplacement('LANG_PREVIOUS', $this->_Translation->GetTranslation('previous'));
$linksTemplate = '<div>' . $linksTemplate . '</div>';
$start = $count * $pageNr;
if ($start > $found) {
$start = ($max - 1) * $count;
}
}
// Get the array with the dates
if ($location != '%') {
$datesArray = $dates->ExtendedFillArray($location, $count, $start);
} else {
$datesArray = $dates->FillArray($count, $start);
}
$name = uniqid('EVENTS_');
$this->_ComaLate->SetReplacement($name, $datesArray);
$this->_ComaLate->SetReplacement('PAGE_ID', GetPostOrGet('page'));
$this->_ComaLate->SetReplacement('LANG_DATE', $this->_Translation->GetTranslation('date'));
$this->_ComaLate->SetReplacement('LANG_LOCATION', $this->_Translation->GetTranslation('location'));
$this->_ComaLate->SetReplacement('LANG_TOPIC', $this->_Translation->GetTranslation('topic'));
$template = '</p>' . $linksTemplate . '
<table class="full_width">
<thead>
<tr>
<th class="table_date_width">
{LANG_DATE}
</th>
<th class="small_width">
{LANG_LOCATION}
</th>
<th>
{LANG_TOPIC}
</th>
</tr>
</thead>
<tbody>
<' . $name . ':loop>
<tr>
<td>
{EVENT_DATE}
</td>
<td>
{EVENT_LOCATION}
</td>
<td>
//.........这里部分代码省略.........
示例12: page_users
/**
*
* string page_users()
* returns the user-admin-page where you can add, change and delete users
*
*/
function page_users()
{
global $_GET, $_POST, $PHP_SELF, $admin_lang, $actual_user_id, $actual_user_passwd_md5, $actual_user_online_id, $actual_user_online_id, $_SERVER, $user;
$out = "";
if (isset($_GET['action']) || isset($_POST['action'])) {
if (isset($_GET['action'])) {
$action = $_GET['action'];
} else {
$action = $_POST['action'];
}
$user_id = GetPostOrGet('user_id', 0);
$user_name = GetPostOrGet('user_name', '');
$user_showname = GetPostOrGet('user_showname', '');
$user_email = GetPostOrGet('user_email', '');
$user_icq = GetPostOrGet('user_icq', '');
$user_admin = GetPostOrGet('user_admin', '');
$user_password = GetPostOrGet('user_password', '');
$user_password_confirm = GetPostOrGet('user_password_confirm', '');
if ($action == "add") {
if ($user_name == "" || $user_showname == "" || $user_password == "" || $user_password != $user_password_confirm) {
$action = "add-error";
} elseif ($user_email != "" && !isEMailAddress($user_email)) {
$action = "add-error";
} elseif ($user_icq != "" && !isIcqNumber($user_icq)) {
$action = "add-error";
} else {
if ($user_admin == "on") {
$user_admin = "y";
} else {
$user_admin = "n";
}
$user_icq = str_replace("-", "", $user_icq);
$user_password = md5($user_password);
$sql = "INSERT INTO " . DB_PREFIX . "users\r\n\t\t\t\t\t\t(user_showname, user_name, user_password, user_registerdate, user_admin, user_icq, user_email)\r\n\t\t\t\t\t\tVALUES ('{$user_showname}', '{$user_name}', '{$user_password}', '" . mktime() . "', '{$user_admin}', '{$user_icq}', '{$user_email}')";
db_result($sql);
}
} elseif ($action == "save") {
if ($user_name == "" || $user_showname == "" || $user_password != $user_password_confirm) {
$action = "save-error";
} elseif ($user_email != "" && !isEMailAddress($user_email)) {
$action = "save-error";
} elseif ($user_icq != "" && !isIcqNumber($user_icq)) {
$action = "save-error";
} else {
if ($user_password != "") {
$user_password = ", user_password= '" . md5($user_password) . "'";
}
if ($user_admin == "on") {
$user_admin = "user_admin= 'y', ";
} else {
$user_admin = "user_admin= 'n', ";
}
$user_icq = str_replace("-", "", $user_icq);
if ($user_id == $user->ID) {
if ($user_password_confirm != "") {
$actual_user_passwd_md5 = md5($user_password_confirm);
}
$actual_user_name = $user_name;
setcookie("CMS_user_cookie", $actual_user_online_id . "|" . $actual_user_name . "|" . $actual_user_passwd_md5, time() + 14400);
}
$sql = "UPDATE " . DB_PREFIX . "users\r\n\t\t\t\t\tSET user_showname='{$user_showname}', user_name='{$user_name}', user_email='{$user_email}', {$user_admin} user_icq='{$user_icq}'{$user_password}\r\n\t\t\t\t\tWHERE user_id={$user_id}";
db_result($sql);
}
} elseif ($action == "delete") {
if (isset($_GET['sure']) || isset($_POST['sure'])) {
if (isset($_GET['sure'])) {
$sure = $_GET['sure'];
} else {
$sure = $_POST['sure'];
}
if ($sure == 1 && $user_id != $user->ID) {
$sql = "SELECT *\r\n\t\t\t\t\t\t\tFROM " . DB_PREFIX . "users\r\n\t\t\t\t\t\t\tWHERE user_id={$user_id}";
$result = db_result($sql);
$user_data = mysql_fetch_object($result);
$sql = "DELETE FROM " . DB_PREFIX . "users\r\n\t\t\t\t\t\t\tWHERE user_id={$user_id}";
db_result($sql);
$out .= "Der Benutzer "" . $user_data->user_showname . "" ist nun unwiederuflich gelöscht worden!<br />";
}
} else {
$sql = "SELECT *\r\n\t\t\t\t\t\tFROM " . DB_PREFIX . "users\r\n\t\t\t\t\t\tWHERE user_id={$user_id}";
$result = db_result($sql);
$user = mysql_fetch_object($result);
$out .= "Den Benutzer "" . $user->user_showname . "" unwiederruflich löschen?<br />\r\n\t\t\t\t<a href=\"admin.php?page=users&action=delete&user_id=" . $user_id . "&sure=1\" title=\"Wirklich Löschen\" class=\"button\">" . $admin_lang['yes'] . "</a>\r\n\t\t\t\t<a href=\"admin.php?page=users\" title=\"Nicht Löschen\" class=\"button\">" . $admin_lang['no'] . "</a>";
return $out;
}
}
if ($action == "edit" || $action == "new" || $action == "add-error" || $action == "save-error") {
if ($user_id != 0 || $action == "new" || $action == "add-error" || $action == "save-error") {
if ($user_id != 0) {
$sql = "SELECT *\r\n\t\t\t\t\t\t\tFROM " . DB_PREFIX . "users\r\n\t\t\t\t\t\t\tWHERE user_id={$user_id}";
$user_result = db_result($sql);
if (($user = mysql_fetch_object($user_result)) || $action == "new") {
if ($action != "save-error") {
$user_showname = $user->user_showname;
//.........这里部分代码省略.........
示例13: _DeactivatePage
/**
* Dectivates the page which is transmitted in $GET/POST['name']
* @access private
* @return srting
*/
function _DeactivatePage()
{
$moduleName = GetPostOrGet('name');
// is the module existent?
if (file_exists("modules/{$moduleName}/{$moduleName}_info.php")) {
// get the 'other' modules
$modulesActivated = unserialize($this->_Config->Get('modules_activated'));
// no data was saved...
if (is_array($modulesActivated)) {
// is the module activated?
if (in_array($moduleName, $modulesActivated)) {
// 'deactivate' it!
unset($modulesActivated[array_search($moduleName, $modulesActivated)]);
// Save these changes
$this->_Config->Save('modules_activated', serialize($modulesActivated));
}
}
// Go back to the default-view
return $this->_HomePage();
}
}
示例14: _EditPageMoveUp
function _EditPageMoveUp($PageID)
{
$imageID = GetPostOrGet('imageID');
$sql = "SELECT gallery.gallery_id\n\t\t\t\t\tFROM (" . DB_PREFIX . "pages page\n\t\t\t\t\tLEFT JOIN " . DB_PREFIX . "pages_gallery gallery ON page.page_id = gallery.page_id)\n\t\t\t\t\tWHERE page.page_id={$PageID} AND page.page_type='gallery'\n\t\t\t\t\tLIMIT 1";
$pageResult = $this->_SqlConnection->SqlQuery($sql);
$pageData = mysql_fetch_object($pageResult);
$galleryID = $pageData->gallery_id;
$sql = "SELECT *\n\t\t \t\t\tFROM " . DB_PREFIX . "gallery\n\t\t \t\t\tWHERE gallery_id={$galleryID} AND gallery_file_id={$imageID}";
$firstImageResult = $this->_SqlConnection->SqlQuery($sql);
$firstImage = mysql_fetch_object($firstImageResult);
$firstID = $firstImage->gallery_file_id;
$firstOrderid = $firstImage->gallery_orderid;
$sql = "SELECT *\n\t\t \t\t\tFROM " . DB_PREFIX . "gallery\n\t\t \t\t\tWHERE gallery_id={$galleryID} AND gallery_orderid < {$firstOrderid}\n\t\t \t\t\tORDER BY gallery_orderid DESC";
$secondImageResult = $this->_SqlConnection->SqlQuery($sql);
if ($secondImage = mysql_fetch_object($secondImageResult)) {
$secondID = $secondImage->gallery_file_id;
$secondOrderid = $secondImage->gallery_orderid;
$sql = "UPDATE " . DB_PREFIX . "gallery\n\t\t \t\t\t\tSET gallery_orderid={$secondOrderid} \n\t\t \t\t\t\tWHERE gallery_id={$galleryID} AND gallery_file_id={$firstID}";
$this->_SqlConnection->SqlQuery($sql);
$sql = "UPDATE " . DB_PREFIX . "gallery\n\t\t \t\t\t\tSET gallery_orderid={$firstOrderid} \n\t\t \t\t\t\tWHERE gallery_id={$galleryID} AND gallery_file_id={$secondID}";
$this->_SqlConnection->SqlQuery($sql);
}
return $this->_EditPageOverview($PageID);
}
示例15: ComaLib
include 'classes/inlinemenu.php';
include 'classes/module.php';
include 'functions.php';
include 'lib/comalate/comalate.class.php';
$lib = new ComaLib();
$extern_page = GetPostOrGet('page');
$queries_count = 0;
define('DB_PREFIX', $d_pre);
$sqlConnection = new Sql($d_user, $d_pw, $d_server);
$sqlConnection->Connect($d_base);
$config = new Config();
$config->LoadAll();
$user = new User($sqlConnection);
$output = new ComaLate();
$styleName = $config->Get('style', 'default');
$headerStyleName = GetPostOrGet('style');
if (!empty($headerStyleName)) {
$styleName = $headerStyleName;
}
$output->LoadTemplate('./styles/', $styleName);
$output->SetMeta('generator', 'ComaCMS v0.2 (http://comacms.berlios.de)');
$output->SetCondition('notinadmin', true);
if (!isset($extern_page) && endsWith($_SERVER['PHP_SELF'], 'index.php')) {
$extern_page = $config->Get('default_page', 'home');
} elseif (!isset($extern_page)) {
$extern_page = '';
}
if (startsWith($extern_page, 'a:')) {
header('Location: admin.php?page=' . substr($extern_page, 2));
die;
} elseif (startsWith($extern_page, 's:')) {