Esempio n. 1
0
function search()
{
    global $logged;
    if (!isset($_POST['submit'])) {
        $Temp = new Template();
        $Temp->dir = $logged['dskin'];
        $Temp->file = "search_find.tpl";
        $Temp->tp(__LINE__, __FILE__);
        return $Temp->html;
    } else {
        $t = $_POST['s'] == 2 ? 1 : 2;
        $type = $_POST['s'] == 2 ? '`topics`' : '`replies`';
        $type_ = $_POST['s'] == 2 ? '`title`' : '`post`';
        $query = htmlspecialchars($_POST['query']);
        $sql = mysql_query("SELECT * FROM " . $type . " WHERE " . $type_ . " LIKE '%" . $query . "%'");
        if (empty($query) || $query == "") {
            pageerror("Search Error", "Something was blank.", "Looks like you left the search field blank, please go back and try again.");
        }
        if (mysql_num_rows($sql) <= 0) {
            pageerror("Search Error", "Not found", "Looks like there wasn't post or topic in the database that matched your query.");
        }
        $content = "";
        while ($row = mysql_fetch_array($sql)) {
            switch ($t) {
                case 1:
                    if (getFP($row['fid'], 1)) {
                        $Temp = new Template();
                        $Temp->dir = $logged['dskin'];
                        $Temp->file = "search_msg.tpl";
                        $Temp->tp(__LINE__, __FILE__);
                        $Temp->tr(array('TID' => $row['id'], 'TNAME' => $row['title'], 'UID' => getid($row['username']), 'DATE' => !empty($row['date']) ? date("m-d-y", $row['date']) : 'unknown', 'MESSAGE' => nl2br(bbcode_format(getFirstPost($row['id']))), 'POSTER' => $row['username']));
                        $content .= $Temp->html;
                    }
                    break;
                case 2:
                    if (getFP(topic_parent_($row['id']), 1)) {
                        $Temp = new Template();
                        $Temp->dir = $logged['dskin'];
                        $Temp->file = "search_msg.tpl";
                        $Temp->tp(__LINE__, __FILE__);
                        $Temp->tr(array('TID' => $row['tid'], 'TNAME' => topicName($row['title']), 'UID' => getid($row['username']), 'DATE' => !empty($row['date']) ? date("m-d-y", $row['date']) : 'unknown', 'MESSAGE' => nl2br(bbcode_format($row['post'])), 'POSTER' => $row['username']));
                        $content .= $Temp->html;
                    }
                    break;
            }
        }
        if (empty($content) || $content == "") {
            pageerror("Search Error", "Not found", "Looks like there wasn't post or topic in the database that matched your query.");
        }
        return $content;
    }
}
Esempio n. 2
0
function getMSGs()
{
    global $PB_FILE;
    $output = '';
    if (file_exists($PB_FILE)) {
        $pblist = file($PB_FILE);
        foreach ($pblist as $ul) {
            $ul = bbcode_format(htmlentities(trim($ul), ENT_COMPAT, "UTF-8"));
            $tul = '';
            $tul = substr($ul, strpos($ul, chr(6)));
            $tul = str_replace(chr(6) . '1' . chr(7), '	<div class="pbm" style="left:', $tul);
            $tul = str_replace(chr(6) . '2' . chr(7), 'px;background:#' . random_hex_colour() . ';">', $tul);
            $tul = str_replace(chr(6) . '3' . chr(7), '</div>' . "\n", $tul);
            $tul = str_replace(chr(6) . chr(6) . chr(6), '<br />', $tul);
            $output .= $tul;
        }
    }
    return $output;
}
Esempio n. 3
0
 public static function HoloText($str, $advanced = false, $bbcode = false)
 {
     if ($advanced == true) {
         return stripslashes($str);
     }
     $str = stripslashes(nl2br(htmlspecialchars($str)));
     if ($bbcode == true) {
         $str = bbcode_format($str);
     }
     return $str;
 }
Esempio n. 4
0
</tr>

<tr>
	<td style="text-align:left;"><?php 
    echo bbcode_format($drills->manifest->news);
    ?>
&nbsp;</td>
</tr>

<tr>
	<th class="header">Notes</th>		
</tr>

<tr>
	<td style="text-align:left;"><?php 
    echo bbcode_format($drills->manifest->notes);
    ?>
&nbsp;</td>
</tr>
</table>

<br />

<table class="rudi" align="center" style="width: 100%;">
<tr>
	<th class="header">Soldier</th>
	<th class="header">Performance Rating</th>
	<th class="header">Initiative Rating</th>
	<th class="header">Excusal</th>
	<th class="header">Excusal Reason</th>
</tr>
Esempio n. 5
0
/**
 * displayNews($data)
 * Function that takes an array of news and displays it as html
 * @param data - associative array of news from the database
 */
function displayNews($data, $short = false)
{
    date_default_timezone_set("America/New_York");
    if (empty($data)) {
        ReportError("Sorry, we found no news using these parameters.");
        echo "<br />";
    }
    foreach ($data as $news) {
        $numComments = getNumOfComments($news['news_id']);
        OpenContent();
        ?>
	
			<div class="contentHeading">
					<table width="100%">
						<tr>
							<td style="text-align:left;"><?php 
        echo $news['title'];
        ?>
</td>
							<td style="text-align:right;">Posted by: <?php 
        echo $news['author'];
        ?>
</td>
						</tr>
					</table>
			</div>
			<div class="content news">
				<img src="modules/news/categories/<?php 
        echo $news['catimage'];
        ?>
" alt="<?php 
        echo $news['catname'];
        ?>
" align="right" />
				<?php 
        if ($short) {
            echo substr(bbcode_format($news['message']), 0, 1000) . "...";
            echo '<br /><br /><a href="?load=news&id=' . $news['news_id'] . '">Continue reading.</a>';
        } else {
            echo bbcode_format($news['message']);
        }
        if (!is_null($news['eauthor'])) {
            echo "<br /><div style=\"text-align:right; font-size: 10px; font-style:italic;\">Last edit: " . date('F j, Y, g:i a T', strtotime($news['edited'])) . " by " . $news['eauthor'] . "</div>";
        }
        ?>
			</div>	
			<div class="contentFooter">
				<table width="100%">
					<tr>
						<td style="text-align:left;">
							View Comments: <a href="<?php 
        echo $_SERVER['PHP_SELF'];
        ?>
?load=news&amp;id=<?php 
        echo $news['news_id'];
        ?>
"><?php 
        echo $numComments;
        ?>
 Comments</a>
						</td>
						<td style="text-align:right;">Posted: <?php 
        echo date('D F j, Y, g:i a T', strtotime($news['date']));
        ?>
</td>
					</tr>
				</table>
			</div>
	
	<?php 
        CloseContent();
        echo "<br />";
    }
}
Esempio n. 6
0
    /* Posting a picture. */
    if ($objAlbum->canPostPicture($objUser)) {
        $objMiniMenu->add('Post Picture', 'index.php?action=upload&' . $objAlbum->getIDPair());
    }
    if ($objUser) {
        $objMiniMenu->add('Mark All as Seen', 'index.php?action=albums&subaction=seen&' . $objAlbum->getIDPair());
    }
    $objTemplate->setText('PAGETITLE', 'Albums' . ($objAlbum->get('id') == 0 ? '' : " -- " . $objAlbum->get('name')));
    /* Get the array of sub albums. */
    $arrSubAlbums = $objAlbum->getSubAlbums($objUser);
    /* This script allows the albums to be expanded/hidden. */
    $objTemplate->setText('SCRIPT', clsAlbum::getSubAlbumScript());
    $objTemplate->setText('SCRIPT', clsAlbum::getAllAlbumScript($arrSubAlbums));
    /* Display the caption  */
    if (strlen($objAlbum->get('caption'))) {
        print "<span class='albumcaption'>" . bbcode_format($objAlbum->get('caption')) . "</span><hr>";
    }
    /* If it's the base album, allow filtering by user. */
    if ($objAlbum->isNew()) {
        print $objAlbum->getUserFilter("Filter by user") . "<hr>";
    }
    /* Display the expand/contract all buttons. */
    print "<a href='#' onClick='expand_all()' class='nounderline'><img src='images/expand.png'> Expand All</a><br>";
    print "<a href='#' onClick='contract_all()' class='nounderline'><img src='images/contract.png'> Hide All</a><br>";
    print "<br>";
    /* Display any sub-albums. */
    clsAlbum::displayAlbums($arrSubAlbums, $objUser);
    /* Display any pictures. */
    clsPicture::displayPictures($objAlbum->getPictures(), $objAlbum->get('id') ? true : false);
}
if ($strSubAction == 'useralbums') {
Esempio n. 7
0
    $objMiniMenu->add('Upload Image', 'index.php?action=upload');
    $objMiniMenu->add('Pending Uploads', 'index.php?action=upload&subaction=preview');
    foreach ($arrNews as $objNews) {
        if ($objUser && $objUser->get('is_admin')) {
            $objNewsTemplate = new clsTemplate('newsitemadmin');
        } else {
            $objNewsTemplate = new clsTemplate('newsitem');
        }
        $objNewsUser = $objNews->getForeignObject('user');
        $objAlbum = $objNews->getForeignObject('album');
        $objNewsTemplate->setText('ID', $objNews->get('id'));
        $objNewsTemplate->setText('USERID', $objNewsUser->get('id'));
        $objNewsTemplate->setText('USERNAME', $objNewsUser->get('username'));
        $objNewsTemplate->setText('DATE', date('Y-m-d', strtotime($objNews->get('date'))));
        $objNewsTemplate->setText('TITLE', $objNews->get('title'));
        $objNewsTemplate->setText('TEXT', bbcode_format($objNews->get('text')));
        echo $objNewsTemplate->get();
    }
} else {
    if (!$objUser || $objUser->get('is_admin') != 1) {
        throw new Exception("exception_accessdenied");
    }
    $objNews = new clsDB('news');
    $objNews->getFromRequest(array('id', 'title', 'text'));
    if ($strSubAction == 'edit') {
        $objNews->load();
        echo "<form action='index.php' method='post'>";
        echo "<input type='hidden' name='subaction' value='save'>";
        echo $objNews->getHiddenField('id');
        echo "Title:<br>";
        echo $objNews->getTextField('title', new clsParameters('size', 40)) . "<br><br>";
Esempio n. 8
0
    } else {
        if ($strSubAction == 'delete') {
            if (!$objComment->canDelete($objUser)) {
                throw new Exception('exception_accessdenied');
            }
            $objComment->delete();
            $objComment->save();
            header("Location: index.php?action=picture&" . $objPicture->getIDPair());
        } else {
            if ($strSubAction = 'viewnew') {
                if (!$objUser) {
                    throw new Exception('exception_accessdenied');
                }
                $arrComments = clsComment::getNewComments($objUser);
                foreach ($arrComments as $objComment) {
                    $objComment = new clsComment($objComment->get('id'));
                    $objPicture = new clsPicture($objComment->get('picture_id'));
                    $objCommentTemplate = new clsTemplate('newcomment');
                    $objCommentTemplate->setText('IMAGE', "<a href='index.php?action=picture&" . $objPicture->getIDPair() . "'>" . $objPicture->getHtmlThumbnail(128, 128) . "</a>");
                    $objCommentTemplate->setText('TITLE', $objComment->get('title') . ' ' . $objComment->getNewIcon($objUser));
                    $objCommentTemplate->setText('USERNAME', $objComment->getUsername());
                    $objCommentTemplate->setText('DATE', time_to_text(strtotime($objComment->get('date'))));
                    $objCommentTemplate->setText('TEXT', bbcode_format($objComment->get('text')));
                    print $objCommentTemplate->get();
                    /* Mark the comment as viewed */
                    $objComment->setViewed($objUser);
                }
            }
        }
    }
}
Esempio n. 9
0
function ListEvents($date)
{
    global $db;
    ?>
 	
 	<table width="100%"><tr><td>
 	<h3>Events for: <?php 
    echo date_format(date_create($date), 'F jS, Y');
    ?>
</h3>
 	</td><td align="right">
 	<a href="?op=calendar&create=true&date=<?php 
    echo $date;
    ?>
"><img src="images/add.png" /> Add New Event</a>
 	</td></tr></table>
<?php 
    echo "<table width=\"100%\">";
    $result = $db->Query("SELECT * FROM bayonet_events WHERE `date` = '{$date}' ORDER BY `time`");
    $row = $db->Fetch($result);
    foreach ($row as $event) {
        $tmp = true;
        $datetime = date_create($date . ' ' . $event['time']);
        $time = date_format($datetime, 'g:ia');
        //gets time in hour:minutes am|pm
        ?>

<tr>
	<td><strong><?php 
        echo $time . " - " . $event['title'];
        ?>
</strong></td>
	<td><span style="border:1px solid black;background-color:<?php 
        echo $event['color'];
        ?>
;">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
	<td>
		<a href="?op=calendar&month=<?php 
        echo $_GET['month'];
        ?>
&year=<?php 
        echo $_GET['year'];
        ?>
&edit=<?php 
        echo $event['event_id'];
        ?>
">Edit</a>
		&nbsp;|&nbsp;
		<a href="?op=calendar&delete=<?php 
        echo $event['event_id'];
        ?>
">Delete</a>
	</td>
</tr>
<tr>
	<td><?php 
        echo bbcode_format($event['text']);
        ?>
<br /><br /></td>
</tr>
		
<tr>
	<td colspan="2" style="border-top:1px solid black;"><br /></td>
</tr>
<?php 
    }
    if (!isset($tmp)) {
        echo "<tr><td>There are no events posted for this day.</td></tr>";
    }
    echo "</table>";
}
Esempio n. 10
0
    // return 1;
    $id = 1;
    //makes it so that the default page is the home page
} else {
    $id = $_GET['id'];
}
// {{{ XXX: FIXME -- Needs to be re-written
$result = $db->Query("SELECT u.username AS author, p.page_created, p.title, p.text FROM `bayonet_pages` AS p LEFT OUTER JOIN `bayonet_users` AS u ON u.user_id = p.author_id WHERE p.page_id = '{$id}'");
$proceed = $db->Rows($result);
if ($proceed > 0) {
    $page = $db->FetchRow($result);
    OpenContent();
    echo "<div class=\"contentHeading\">{$page['title']}</div>";
    echo "<div class=\"content\">";
    //echo "<h3>".$article['title']."</h3>";
    echo bbcode_format($page['text']);
    echo "</div>";
    echo "</div>";
    CloseContent();
    ?>
  <?php 
    // echo bbcode_format($page['text'])
    ?>
  <!-- <tr><th><?php 
    echo $page['author'];
    ?>
</th></tr> -->
  <?php 
} else {
    ReportError("Page does not exist.<br>\n");
}
Esempio n. 11
0
<?php

global $db;
$result = $db->Query("SELECT `text` FROM `bayonet_announcements` LIMIT 1");
$row = $db->FetchRow($result);
echo bbcode_format($row['text']);
Esempio n. 12
0
 public function display($objUser)
 {
     $objAlbumOwner = $this->getForeignObject('user');
     $intPictureCount = sizeof($this->getPictures());
     $intSubAlbumCount = sizeof($this->getSubAlbums($objUser));
     if ($intPictureCount == 0 && $intAlbumCount == 0 && $objUser && $objUser->get('show_empty') == 0) {
         return '';
     }
     $objAlbumTemplate = new clsTemplate('album');
     $objAlbumTemplate->setText('NAME', "<a href='index.php?action=albums&" . $this->getIDPair() . "' class='albumentrylink'>" . $this->get('name') . "</a> " . $this->getNewIcon($objUser));
     $objAlbumTemplate->setText('ID', $this->get('id'));
     $objAlbumTemplate->setText('USERNAME', $objAlbumOwner->get('username'));
     $objAlbumTemplate->setText('CAPTION', bbcode_format($this->get('caption')));
     $objAlbumTemplate->setText('EXPANDCLICK', "toggle_album(\"" . $this->get('id') . "\");");
     $objAlbumTemplate->setText('LASTUPDATED', $this->getLastUpdated());
     $objAlbumTemplate->setText('PICTURECOUNT', $intPictureCount);
     $objAlbumTemplate->setText('ALBUMCOUNT', $intSubAlbumCount);
     if ($intPictureCount == 0 && $intSubAlbumCount == 0) {
         $objAlbumTemplate->setText('ISEMPTY', '(empty)');
     }
     $strPreview = "";
     $arrPictures = $this->getTopPictures(ALBUM_NUMPREVIEW);
     foreach ($arrPictures as $objPicture) {
         $objAlbumTemplate->setText('PREVIEW', $objPicture->getHtmlThumbnail(ALBUM_PREVIEWSIZE, ALBUM_PREVIEWSIZE));
     }
     print $objAlbumTemplate->get();
 }
Esempio n. 13
0
function RUN_Topic()
{
    global $logged, $permissions;
    if (is_numeric($_GET['id']) and !empty($_GET['id'])) {
        $id = intval(htmlspecialchars($_GET['id']));
    } else {
        pageerror("Topic Error", "", "Sorry, but there wasn't a topic id present.");
    }
    if (!getFP(topic_parent_($id), 1)) {
        pageerror("Permission Error", "", "Sorry, but you don't have permissions viewing this topic.");
    }
    //do some post stuff
    //total replies pagination limit
    $ppt = mysql_query("SELECT `postpertopic` FROM `boardstatus` LIMIT 1");
    $p_p_t = mysql_fetch_array($ppt);
    $total_limit = $p_p_t['postpertopic'];
    topic_pagination($id, $total_limit);
    $main = mysql_query("SELECT * FROM `topics` WHERE `id` = '" . $id . "' ");
    $tmain = mysql_fetch_array($main);
    $umain = mysql_query("SELECT * FROM `users` WHERE `username` = '" . $tmain['username'] . "'");
    $fuser = mysql_fetch_array($umain);
    $isSticked = $tmain['sticky'] == 1 ? "<a href='mode.php?type=sticktopic&tid=" . $id . "'>Sticky</a>" : "<a href='mode.php?type=unsticktopic&tid=" . $id . "'>Un-Sticky</a>";
    $isLocked = $tmain['closed'] == 1 ? "<a href='mode.php?type=closetopic&tid=" . $id . "'>Lock</a>" : "<a href='mode.php?type=opentopic&tid=" . $id . "'>Un-Lock</a>";
    //check if user has permissions
    if ($permissions['admin'] == 't' || $permissions['e_topic'] == 't') {
        $modet = "<a href='mode.php?type=edit&post=topic&id=" . $id . "'>Edit</a> | <a href='mode.php?type=move&post=topic&id=" . $id . "'>Move Topic</a> | " . $isSticked . " | " . $isLocked;
    } elseif ($logged['username'] == $tmain['username'] && $permissions['e_topic'] == 't') {
        $modet = "<a href='mode.php?type=edit&post=topic&id=" . $id . "'>Edit</a>";
    } else {
        $modet = "";
    }
    echo "<br />" . run_buttons($id);
    $Temp = new Template();
    $Temp->dir = $logged['dskin'];
    $Temp->file = "topic_title.tpl";
    $Temp->tp();
    $Temp->tr(array('TITLE' => $tmain['title']));
    echo $Temp->html;
    //if($_GET['p'] == 1 || !isset($_GET['p']) )
    //	{
    echo '
						<tr>
							<td colspan="2" class="small_title"><span style="float:left;"><b>Posted On:</b> ' . timezone_stamp($tmain['timestamp'], $logged['timezone']) . '</span><span style="float:right" class="small_title_link">' . $modet . '</span></td>
						</tr>
				';
    //}
    if (!isset($_GET['p']) || empty($_GET['p']) || $_GET['p'] == 0) {
        $page = 1;
    } else {
        if (!is_numeric($_GET['p'])) {
            pageerror("Page Error", "", "Didn't specify a correct page id.");
        } else {
            $page = intval(mysql_real_escape_string($_GET['p']));
        }
    }
    $limit_start = $page * $total_limit - $total_limit;
    //get replies
    $replies = mysql_query("SELECT * FROM `replies` WHERE `tid` = '" . $id . "' ORDER BY `id` LIMIT {$limit_start},{$total_limit}") or die(mysql_error(__FILE__, __LINE__));
    $has_replys = mysql_num_rows($replies);
    if ($has_replys != 0) {
        //check to see if there are any replies :D
        while ($replys = mysql_fetch_array($replies)) {
            //check if user has permissions
            if ($permissions['admin'] == 't' || $permissions['d_post'] == 't') {
                $modep = "<a href='mode.php?type=edit&post=reply&id=" . $replys['id'] . "&tid=" . $id . "'>Edit</a> | <a href='mode.php?type=delete&post=reply&id=" . $replys['id'] . "&tid=" . $id . "'>Delete</a>";
            } elseif ($logged['username'] == $replys['username']) {
                $modep = "<a href='mode.php?type=edit&post=reply&id=" . $replys['id'] . "&tid=" . $id . "'>Edit</a>";
            } else {
                $modep = "";
            }
            $usez = mysql_query("SELECT * FROM `users` WHERE `username` = '" . $replys['username'] . "'");
            $useri = mysql_fetch_array($usez);
            //show replies
            $Temp = new Template();
            $Temp->dir = $logged['dskin'];
            $Temp->file = "topic_post.tpl";
            $Temp->tp();
            $Temp->tr(array('OPTIONS' => $modep, 'POSTER' => $replys['username'], 'AVY' => !empty($useri['avatar']) ? '<img width="100" height="100" src="' . $useri['avatar'] . '" alt="" /><br />' : '', 'DATE' => timezone_stamp($replys['date'], $logged['timezone']), 'GROUP' => group($useri['level']), 'UID' => $useri['id'], 'UPOST' => $useri['post'], 'POST' => nl2br(bbcode_format($replys['post'])) . "<br />__________________<br />" . ($useri['signature'] == '' ? '&nbsp;' : nl2br(bbcode_format($useri['signature'])))));
            echo $Temp->html;
        }
    } else {
        echo "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width='100%' class='rows' align='center'><em>There isn't any posts in this topic</em></td>\n\t\t\t\t\t</tr>\n\t\t\t\t";
    }
    echo ' </table> ' . run_buttons($id) . '<br />';
    topic_pagination($id, $total_limit);
    add_views($id);
}