vodarn
New Member
- Jun 15, 2015
- 3
- 0
I really need some help to get revcms runnable with Azure emulator.
The things i want help with:
First: News
Second: Staff page.
My Class.forms.php
The things i want help with:
First: News
Second: Staff page.
My Class.forms.php
PHP:
<?php
namespace Revolution;
if(!defined('IN_INDEX')) { die('Sorry, you cannot access this file.'); }
class forms implements iForms
{
public $error;
final public function setData()
{
global $engine;
foreach($_POST as $key => $value)
{
if($value != null)
{
$this->$key = $engine->secure($value);
}
else
{
$this->error = 'Please fill in all fields';
return;
}
}
}
final public function unsetData()
{
global $template;
foreach($this as $key => $value)
{
unset($this->$key);
}
}
final public function writeData($key)
{
global $template;
echo $this->$key;
}
final public function outputError()
{
global $template;
if(isset($this->error))
{
echo "<div id='message'> " . $this->error . " </div>";
}
}
/* Manage different pages */
final public function getPageNews()
{
global $template, $engine;
if(!isset($_GET['id']) || !is_numeric($_GET['id']))
{
$_GET['id'] = 1;
}
$result = "SELECT title, id FROM cms_news WHERE id != '" . $engine->secure($_GET['id']) . "' ORDER BY id DESC";
while($news1 = $engine->fetch_array($result))
{
$template->setParams('newsList', '« <a href="index.php?url=news&id='.$news1["id"].'">' . $news1['title'] . '</a><br/>');
}
$news = $engine->fetch_assoc("SELECT title, longstory, author, published FROM cms_news WHERE id = '" . $engine->secure($_GET['id']) . "' LIMIT 1");
$template->setParams('newsTitle', $news['title']);
$template->setParams('newsContent', $news['longstory']);
$template->setParams('newsAuthor', $news['author']);
$template->setParams('newsDate', date("d-m-y", $news['published']));
unset($result);
unset($news1);
unset($news);
}
final public function getPageHome()
{
/*
NEEDS TO BE FIXED
global $template, $engine;
$a = 1;
$data = "SELECT title, id, published, shortstory, image FROM cms_news ORDER BY id DESC LIMIT 5";
while($news = $engine->fetch_array($data))
{
$template->setParams('newsTitle-' . $a, $news['title']);
$template->setParams('newsID-' . $a, $news['id']);
$template->setParams('newsDate-' . $a, date("d-m-y", $news['published']));
$template->setParams('newsCaption-' . $a, $news['shortstory']);
$template->setParams('newsIMG-' . $a, $news['image']);
$a++;
}
unset($news);
unset($data);*/
}
}
?>
PHP:
<div class="row">
<div class="span3">
<a href="index.php?url=news&id={newsID-1}"><div class="well" style="background-image: url('{url}/app/tpl/skins/{skin}/news/{newsIMG-1}');height:140px;position:relative;overflow:hidden;">
<p class="newscaption">
<strong>{newsTitle-1}</strong><br />
<em>{newsCaption-1}</em>
</p>
</div></a>
</div></a>
<div class="span3">
<a href="index.php?url=news&id={newsID-2}"><div class="well" style="background-image: url('{url}/app/tpl/skins/{skin}/news/{newsIMG-2}');height:140px;position:relative;overflow:hidden;">
<p class="newscaption">
<strong>{newsTitle-2}</strong><br />
<em>{newsCaption-2}</em>
</p>
</div>
</div></a>
<div class="span3">
<a href="index.php?url=news&id={newsID-3}"><div class="well" style="background-image: url('{url}/app/tpl/skins/{skin}/news/{newsIMG-3}');height:140px;position:relative;overflow:hidden;">
<p class="newscaption">
<strong>{newsTitle-3}</strong><br />
<em>{newsCaption-3}</em>
</p>
</div>
</div></a>
<div class="span3">
<a href="index.php?url=news&id={newsID-4}"><div class="well" style="background-image: url('{url}/app/tpl/skins/{skin}/news/{newsIMG-4}');height:140px;position:relative;overflow:hidden;">
<p class="newscaption">
<strong>{newsTitle-4}</strong><br />
<em>{newsCaption-4}</em>
</p>
</div></a>
</div>
PHP:
<?php include('header.php'); ?>
<div class="row">
<div class="span4">
<div class="well">
<p class="btn2 btn-block boxtitle btn-info2">Who are the staff?</p>
<p>{hotelName} staff are the members of the community who are in charge of running the hotel and ensuring it is safe. They plan competitions, host events and assist users whenever possible. These are the users you should contact for assistance.</p>
<p>If someone claims to be staff, check this list before answering any personal questions.</p>
</div>
<div class="well">
<p class="btn2 btn-block boxtitle btn-info2">Can I be staff?</p>
<p>We hire frequently, and when we do it will be posted on the news. Please do not spam staff with requests to be hired as this will result in you being blacklisted from future application periods.</p>
</div>
</div>
<div class="span8">
<?php
$getRanks = mysql_query("SELECT id, username, rank FROM users WHERE rank = 7 ORDER BY id DESC");
while ($Ranks = mysql_fetch_assoc($getRanks))
{
echo '<div class="well"><p class="btn2 btn-block boxtitle btn-info2">' . $Ranks['name'] . '</p>';
$getMembers = mysql_query("SELECT id,username,motto,look,online,last_online FROM users WHERE rank = '" . $Ranks['id'] . "'");
echo '<div class="box-content">';
if (mysql_num_rows($getMembers) > 0)
{
$oe = 1;
while ($member = mysql_fetch_assoc($getMembers))
{
if ($oe == 2)
{
$oe = 1;
}
else
{
$oe = 2;
}
echo '<table width="100%" style="padding: 5px; margin-left: -15px; background-color: ' . (($oe == 2) ? '#fff' : '#E6E6E6') . ';">
<tbody>
<tr>
<td valign="middle" width="75">
<img style="margin-top: -10px;" src="Cannot be shown on devbest :D' .$member['look'] . '&size=l">
</td>
<td valign="top">
<p style="font-size: 90%;">Username: <strong>' .$member['username'] . '</strong><br>Motto: <strong>' . $member['motto'] . '</strong><br><i>Last Online: '. date("D, d F Y H:i (P)", $member['last_online']) .'</i></p>
<br />';
echo '</td>
<td valign="top" style="float: right;">
' . (($member['online'] == "1") ? '<b>Online</b>': '<b>Offline</b>') . '
</td>
</tr>
</tbody>
</table>';
}
}
else
{
echo '<i>There are no users in this staff group yet.</i>';
}
echo '</div>
</div>';
}
?>
</div>
</div>
<?php include('footer.php'); ?>
Last edited: