What's new

PHP [NICAW] ChangeLog

Status
Not open for further replies.

TenTypSwir

NNSTORY.EU Developer
Joined
Jun 8, 2010
Messages
1,657
Reaction score
117
Na wstepie chcialem zaznaczyc ze jestem autorem tego skryptu i warunek uzywania tego jest prosty :)
ZOSTAW STOPKE!


No to zaczynamy ~~ w folderze z acc robimy plik changelog.php i wklejamy
PHP:
<?php
include ("include.inc.php");

/*
    By Swirus/Kabak of Death
*/

if (isset($_GET['RSS2'])){
header("Content-type: application/rss+xml");

$mysql = AAC::$SQL;
$sql = $mysql->myQuery('SELECT * FROM `changelog` ORDER BY `date` DESC LIMIT 10');

while ($a = $mysql->fetch_array()){
  echo '<item>';
  echo '<guid>http://'.htmlspecialchars($cfg['server_url'].$_SERVER['PHP_SELF'].'?id='.$a['id']).'</guid>';
  echo '<name>'.htmlspecialchars($a['name']).'</name>';
  echo '<id>'.htmlspecialchars($a['id']).'</id>';
  echo '<pubDate>'.date('D, d M Y H:i:s O',$a['date']).'</pubDate>';
  echo '<dc:type>'.htmlspecialchars($a['type']).'</dc:type>';
  if ((bool)(int)$a['html']){
    echo '<content:encoded>'.htmlspecialchars($a['description']).'</content:encoded>';
  }else{
    require_once('class/simple_bb_code.php');
    $bb = new Simple_BB_Code();
    echo '<content:encoded>'.htmlspecialchars($bb->parse($a['description'])).'</content:encoded>';
  }
  echo '</item>';
}
echo '</channel></rss>';

}else{
$ptitle= "ChangeLog - $cfg[server_name]";
include ("header.inc.php");
?>
<div id="content">
<div class="top">ChangeLog</div>
<div class="mid">
<br/><b><table><TR><TD width="25">ID:</TD><TD width="45"><center>Type:</center></TD><TD width="80"><center>Name:</center></TD><TD width="279"><center>Description:</center></TD><TD width="75"><center>Date:</center></TD></TR></table></b>
 
<?php 
$mysql = AAC::$SQL;
if (isset($_GET['id']))
	$mysql->myQuery('SELECT * FROM `changelog` WHERE `id` = \''.mysql_escape_string((int)$_GET['id']).'\'');
else
	$mysql->myQuery('SELECT * FROM `changelog` ORDER BY `date` DESC LIMIT 10');

while ($a = $mysql->fetch_array()){
 echo '<table><TR><TD width="25">'.htmlspecialchars($a['id']).'.</TD><TD width="50"><center><img src="changelog/'.htmlspecialchars($a['type']).'.png"></center></TD><TD width="85"><center>'.htmlspecialchars($a['name']).'</center></TD><TD width="310"><center>'.htmlspecialchars($a['description']).'</center></TD><TD width="80"><center>'.date("jS F Y",$a['date']).'</center></TD></TR></table>';
}
?>
<br/></br><b><i><center>By <a href="http://tibia.net.pl/members/267982-KabakOfDeath"><font color="silver">$wirus</font></a></center></i></b>
</div>
<div class="bot"></div>
</div>
<?php include ("footer.inc.php");}?>

Nastepnie otwieramy admin.php i pod
Code:
<li onclick="ajax('form','tools/news_create.php','',true)" style=" background-image: url(resource/rss_add.png);">Create News</li>
dodajemy
Code:
<li onclick="ajax('form','tools/changelog_create.php','',true)" style=" background-image: url(resource/information.png);">Create ChangeLog</li>

wchodzimy do folderu tools/ i robimy plik changelog_create.php nastepnie wklejamy do niego
PHP:
<?php 
include ("../include.inc.php");
require ('check.php');

try {
//retrieve post data
    $form = new Form('addrss');
    //insert news
    $sql = AAC::$SQL;
    $sql->myInsert('changelog',array('id' => null, 'name' => $form->attrs['name'], 'type' => $form->attrs['type'], 'date' => time(), 'description' => $form->attrs['description']));

} catch(FormNotFoundException $e) {
//create new form
    $form = new IOBox('addrss');
    $form->target = $_SERVER['PHP_SELF'];
    $form->addLabel('Create ChangeLog');
	$form->addSelect('type',array(dodane => 'Dodane', usuniete => 'Usuniete', zmienione => 'Zmienione'));
	$form->addSelect('name',array(serwer => 'Serwer', strona => 'Strona'));
    $form->addTextBox('description');
    $form->addClose('Cancel');
    $form->addSubmit('Save');
    $form->show();
}
?>

Pobieramy z View attachment 6025 / folder changelog i wpakowujemy go do acc'a

Otwieramy navigation.xml i dodajemy
[xml]<item href="changelog.php">ChangeLog</item>[/xml]

I na koniec wysylamy zapytanie do bazy:

[sql]CREATE TABLE IF NOT EXISTS `changelog` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(6) NOT NULL,
`type` text NOT NULL,
`description` text NOT NULL,
`date` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;[/sql]

Aby wstawic cos do change loga wejdz na localhost/admin.php

For Lazy Humans


Gotowa paczka --> wgraj + wykonaj zapytanie --> dzialaj

SCREENY:
pj2n.png

htwm.png


Zabraniam kopiowania na inne strony + pamietaj o stopce :)
 

smolarek2

Advanced User
Joined
Aug 1, 2009
Messages
217
Reaction score
3
Odp: [NICAW] ChangeLog

Zajebi*** [NICAW] ChangeLog polecam !!
 

SanninStory

https://www.twitch.tv/sdrn
Joined
Oct 13, 2012
Messages
1,778
Reaction score
119
Odp: [NICAW] ChangeLog

Ciekawy skrypt.
Mo?e wykorzystam.

Pozdrawiam.
 

Kajlu

Advanced User
Joined
Jun 24, 2010
Messages
250
Reaction score
10
Odp: [NICAW] ChangeLog

no dobre, polecam :)
 
Status
Not open for further replies.
Top