Тема: Мод Знаки Зодиака
Никто не встречал такой мод?
Т.е. когда юзер может выбрать из 12 Знаков Зодиака свой, и его символ демонстрируется под его никнеймом...
Добавлено 02.05.2007 12:02:03:
Впринципе можно переделать мод пола.
Ещё добавить 10 пунктов нужно и будет мод Зодиаков.
Может кто доделает:
Ридми:
##
##
## Mod title: MaleFemale
##
## Mod version: 1.0
## Works on PunBB: 1.2.11
## Release date: 06-05-7
## Author: Louner [www.dragonrider.com.pl]
##
## Description: You can show your sex to everybody. :D
##
## Affects DB: Yes
##
##
## DISCLAIMER: Please note that "mods" are not officially supported by
## PunBB. Installation of this modification is done at your
## own risk. Backup your forum database and any and all
## applicable files before proceeding.
##
##
#
#---------[ 0. UPLOAD ]-------------------------------------------------------
#
male.gif , female.gif to ./img
#
#---------[ 1. UPLOAD ]-------------------------------------------------------
#
install_mod.php to ./
#
#---------[ 2. RUN ]---------------------------------------------------------
#
install_mod.php
#
#---------[ 3. DELETE ]----------------------------------------------------
#
install_mod.php
#
#---------[ 4. OPEN ]----------------------------------------------------
#
/lang/your_language/common.php
#
#---------[ 5. FIND ]----------------------------------------------------
#
// The date/time a topic was started
#
#---------[ 6. AFTER, ADD ]----------------------------------------------------
#
'MaleFemale' => 'Pіeж',
'Male' => 'Mкїczyzna',
'Female' => 'Kobieta',
#
#---------[ 7. OPEN ]----------------------------------------------------
#
register.php
#
#---------[ 8. FIND ]----------------------------------------------------
#
\''.get_remote_address().'\', '.$now.')')
#
#---------[ 9. REPLACE WITH ]----------------------------------------------------
#
\''.get_remote_address().'\', '.$now.', '.$malefemale.')')
#
#---------[ 10. FIND ]----------------------------------------------------
#
$password_hash = pun_hash($password1);
#
#---------[ 11. AFTER, ADD ]----------------------------------------------------
#
$malefemale = intval($_POST['malefemale']);
#
#---------[ 12. FIND ]----------------------------------------------------
#
<label><strong><?php echo $lang_common['Username'] ?></strong><br /><input type="text" name="req_username" size="25" maxlength="25" /><br /></label>
#
#---------[ 13. AFTER, ADD ]----------------------------------------------------
#
<label><strong><?php echo $lang_common['MaleFemale'] ?></strong><br /></label>
<label><input type="radio" name="malefemale" value="1" /><?php echo $lang_common['Male'] ?><br /></label>
<label><input type="radio" name="malefemale" value="2" /><?php echo $lang_common['Female'] ?><br /></label>
#
#---------[ 14. OPEN ]----------------------------------------------------
#
profile.php
#
#---------[ 15. FIND ]----------------------------------------------------
#
<dd><?php echo ($user['realname'] !='') ? pun_htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['realname']) : $user['realname']) : $lang_profile['Unknown']; ?></dd>
#---------[ 16. AFTER, ADD ]----------------------------------------------------
#
<dt><?php echo $lang_common['MaleFemale'] ?>: </dt>
<?php $user['malefemale'] = str_replace("1", $lang_common['Male'], $user['malefemale']); $user['malefemale'] = str_replace("2", $lang_common['Female'], $user['malefemale']); ?>
<dd><?php echo ($user['malefemale'] !='') ? pun_htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['malefemale']) : $user['malefemale']) : $lang_profile['Unknown']; ?></dd>
#
#---------[ 17. FIND ]----------------------------------------------------
#
$form = extract_elements(array('realname', 'url', 'location'));
#
#---------[ 18. REPLACE WITH ]----------------------------------------------------
#
$form = extract_elements(array('realname', 'url', 'location', 'malefemale'));
#
#---------[ 19. FIND ]----------------------------------------------------
#
u.registration_ip, u.last_visit, u.admin_note,
#
#---------[ 20. AFTER, ADD ]----------------------------------------------------
#
u.malefemale,
#
#---------[ 21. FIND ]----------------------------------------------------
#
<label><?php echo $lang_profile['Realname'] ?><br /><input type="text" name="form[realname]" value="<?php echo pun_htmlspecialchars($user['realname']) ?>" size="40" maxlength="40" /><br /></label>
#
#---------[ 22. AFTER, ADD ]----------------------------------------------------
#
<label><?php echo $lang_common['MaleFemale'] ?><br />
<?php
switch($user['malefemale'])
{
case '1':
echo('<input type="radio" name="form[malefemale]" value="1" checked="checked" /> '.$lang_common['Male'].'<br />');
echo('<input type="radio" name="form[malefemale]" value="2" /> '.$lang_common['Female'].'<br />');
echo('<input type="radio" name="form[malefemale]" value="0" /> '.$lang_profile['Unknown'].'<br />');
break;
case '2':
echo('<input type="radio" name="form[malefemale]" value="1" /> '.$lang_common['Male'].'<br />');
echo('<input type="radio" name="form[malefemale]" value="2" checked="checked" /> '.$lang_common['Female'].'<br />');
echo('<input type="radio" name="form[malefemale]" value="0" /> '.$lang_profile['Unknown'].'<br />');
break;
default:
echo('<input type="radio" name="form[malefemale]" value="1" /> '.$lang_common['Male'].'<br />');
echo('<input type="radio" name="form[malefemale]" value="2" /> '.$lang_common['Female'].'<br />');
echo('<input type="radio" name="form[malefemale]" value="0" checked="checked" /> '.$lang_profile['Unknown'].'<br />');
break;
}
?>
</label>
#
#---------[ 23. OPEN ]----------------------------------------------------
#
viewtopic.php
#
#---------[ 24. FIND ]----------------------------------------------------
#
require PUN_ROOT.'lang/'.$pun_user['language'].'/topic.php';
#
#---------[ 25. AFTER, ADD ]----------------------------------------------------
#
require PUN_ROOT.'lang/'.$pun_user['language'].'/common.php';
#
#---------[ 26. FIND ]----------------------------------------------------
#
// Retrieve the posts (and their respective poster/online status)
$result = $db->query('SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note,
#
#---------[ 27. AFTER, ADD ]----------------------------------------------------
#
u.malefemale,
#
#---------[ 28. FIND ]----------------------------------------------------
#
$username = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><span style="color:'.$cur_post['g_color'].'">' . pun_htmlspecialchars($cur_post['username']) . '</span></a>';
#
#---------[ 29. REPLACE WITH ]----------------------------------------------------
#
$username = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><span style="color:'.$cur_post['g_color'].'">' . pun_htmlspecialchars($cur_post['username']) . '</span></a>'.$cur_post['malefemale'];
#
#---------[ 30. BEFORE, ADD ]----------------------------------------------------
#
$cur_post['malefemale'] = str_replace("0", "", $cur_post['malefemale']);
$cur_post['malefemale'] = str_replace("1", "<img src=\"./img/male.gif\" />", $cur_post['malefemale']);
$cur_post['malefemale'] = str_replace("2", "<img src=\"./img/female.gif\" />", $cur_post['malefemale']);
#
#---------[ 31. ENJOY! :D ]----------------------------------------------------
#Файл инсталяции:
<?php
/***********************************************************************/
// Some info about your mod.
$mod_title = 'Male / Female';
$mod_version = '1.0';
$release_date = '06-05-7';
$author = 'Louner [www.dragonrider.com.pl]';
$author_email = 'fieldsmor@gmail.com';
// One or more versions of PunBB that this mod works on. The version names must match exactly!
$punbb_versions = array('1.2.11');
// Set this to false if you haven't implemented the restore function (see below)
$mod_restore = true;
// This following function will be called when the user presses the "Install" button.
function install()
{
global $db, $db_type, $pun_config;
switch ($db_type)
{
case 'mysql':
case 'mysqli':
$sql = 'ALTER TABLE '.$db->prefix.'users ADD malefemale text';
break;
}
$db->query($sql) or error('Unable to alter table '.$db->prefix.'users.', __FILE__, __LINE__, $db->error());
$d = dir(PUN_ROOT.'cache');
while (($entry = $d->read()) !== false)
{
if (substr($entry, strlen($entry)-4) == '.php')
@unlink(PUN_ROOT.'cache/'.$entry);
}
$db->close();
}
// This following function will be called when the user presses the "Restore" button (only if $mod_uninstall is true (see above))
function restore()
{
global $db, $db_type, $pun_config;
switch ($db_type)
{
case 'mysql':
case 'mysqli':
$sql = 'ALTER TABLE '.$db->prefix.'users DROP COLUMN malefemale';
break;
}
$db->query($sql) or error('Unable to alter table '.$db->prefix.'users.', __FILE__, __LINE__, $db->error());
$d = dir(PUN_ROOT.'cache');
while (($entry = $d->read()) !== false)
{
if (substr($entry, strlen($entry)-4) == '.php')
@unlink(PUN_ROOT.'cache/'.$entry);
}
$db->close();
}
/***********************************************************************/
// DO NOT EDIT ANYTHING BELOW THIS LINE!
// Circumvent maintenance mode
define('PUN_TURN_OFF_MAINT', 1);
define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';
// We want the complete error message if the script fails
if (!defined('PUN_DEBUG'))
define('PUN_DEBUG', 1);
// Make sure we are running a PunBB version that this mod works with
if(!in_array($pun_config['o_cur_version'], $punbb_versions))
exit('You are running a version of PunBB ('.$pun_config['o_cur_version'].') that this mod does not support. This mod supports PunBB versions: '.implode(', ', $punbb_versions));
$style = (isset($cur_user)) ? $cur_user['style'] : $pun_config['o_default_style'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?php echo $mod_title ?> installation</title>
<link rel="stylesheet" type="text/css" href="style/<?php echo $pun_config['o_default_style'].'.css' ?>" />
</head>
<body>
<div id="punwrap">
<div id="puninstall" class="pun" style="margin: 10% 20% auto 20%">
<?php
if (isset($_POST['form_sent']))
{
if (isset($_POST['install']))
{
// Run the install function (defined above)
install();
?>
<div class="block">
<h2><span>Installation successful</span></h2>
<div class="box">
<div class="inbox">
<p>Your database has been successfully prepared for <?php echo pun_htmlspecialchars($mod_title) ?>. See readme.txt for further instructions.</p>
</div>
</div>
</div>
<?php
}
else
{
// Run the restore function (defined above)
restore();
?>
<div class="block">
<h2><span>Restore successful</span></h2>
<div class="box">
<div class="inbox">
<p>Your database has been successfully restored.</p>
</div>
</div>
</div>
<?php
}
}
else
{
?>
<div class="blockform">
<h2><span>Mod installation</span></h2>
<div class="box">
<form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>?foo=bar">
<div><input type="hidden" name="form_sent" value="1" /></div>
<div class="inform">
<p>This script will update your database to work with the following modification:</p>
<p><strong>Mod title:</strong> <?php echo pun_htmlspecialchars($mod_title).' '.$mod_version ?></p>
<p><strong>Author:</strong> <?php echo pun_htmlspecialchars($author) ?> (<a href="mailto:<?php echo pun_htmlspecialchars($author_email) ?>"><?php echo pun_htmlspecialchars($author_email) ?></a>)</p>
<p><strong>Disclaimer:</strong> Mods are not officially supported by PunBB. Mods generally can't be uninstalled without running SQL queries manually against the database. Make backups of all data you deem necessary before installing.</p>
<?php if ($mod_restore): ?> <p>If you've previously installed this mod and would like to uninstall it, you can click the restore button below to restore the database.</p>
<?php endif; ?> </div>
<p><input type="submit" name="install" value="Install" /><?php if ($mod_restore): ?><input type="submit" name="restore" value="Restore" /><?php endif; ?></p>
</form>
</div>
</div>
<?php
}
?>
</div>
</div>
</body>
</html>