|
OPEN: ip_root/language/your_language/lang_main_settings.php
FIND:
$lang['JOINED_DATE_FORMAT'] = 'F Y'; // Date format of Joined date, php date() format
REPLACE WITH:
$lang['JOINED_DATE_FORMAT'] = 'M d, Y g:i a'; // Date format of Joined date, php date() format
This will produce this result:
If you would like to remove the exact time a user registered and just keep the Month/Day/Year, try this.
OPEN: ip_root/language/your_language/lang_main_settings.php
FIND:
$lang['JOINED_DATE_FORMAT'] = 'F Y'; // Date format of Joined date, php date() format
REPLACE WITH:
$lang['JOINED_DATE_FORMAT'] = 'M d, Y'; // Date format of Joined date, php date() format
This will produce this result:
For more PHP date formats, please visit: http://us.php.net/date
|
|
Since some users are asking how to destroy their sites... I've decided to help them in this task.
Here is a way to enable IFRAME and more generally full HTML code in posts... I'm strongly against this modification, and I strongly invite all of you to not apply this unless you know very well what you are doing and the risk you are facing.
There will be no support for this... and I take no responsibility for all the damage that may arise on your site and your PC... yes your PC as well could be attacked and damaged by enabling this.
Creating IFRAME BBCode:
OPEN includes/bbcode.php
FIND
'align' => array(
'nested' => true,
'inurl' => false,
'allow_empty' => false,
),
BEFORE ADD
'iframe' => array(
'nested' => true,
'inurl' => true,
'allow_empty' => false,
),
FIND
// IMG
if($tag === 'img')
{
if($this->is_sig)
BEFORE ADD
// IFRAME
if($tag === 'iframe')
{
if(isset($item['params']['param']))
{
$params['src'] = $item['params']['param'];
}
elseif(isset($item['params']['src']))
{
$params['src'] = $item['params']['src'];
}
elseif(!empty($content))
{
$params['src'] = $content;
}
if(isset($item['params']['scrolling']))
{
$params['scrolling'] = $item['params']['scrolling'];
}
else
{
$params['scrolling'] = 'no';
}
if(isset($item['params']['width']))
{
$params['width'] = $item['params']['width'];
}
else
{
$params['width'] = '100%';
}
if(isset($item['params']['height']))
{
$params['height'] = $item['params']['height'];
}
else
{
$params['height'] = '600';
}
foreach($params as $var => $value)
{
if ($this->process_text($value) != '')
{
$html .= ' ' . $var . '="' . $this->process_text($value) . '"';
}
}
$extras = $this->allow_styling ? array('style', 'class') : array('class');
$html = '<iframe' . $html . '>';
return array(
'valid' => true,
'start' => $html,
'end' => '</iframe>'
);
}
Enabling HTML tags:
Enter in ACP ed add IFRAME tag in the allowed tags.
OPEN includes/bbcode.php
FIND
var $allowed_html = array(
'b' => array(
'nested' => true,
'inurl' => true,
'allow_empty' => false,
),
AFTER ADD
'iframe' => array(
'nested' => true,
'inurl' => true,
'allow_empty' => false,
),
How to generally allow full HTML in posts:
OPEN includes/functions_post.php
FIND
// This function will prepare a posted message for entry into the database.
function prepare_message($message, $html_on, $bbcode_on, $smile_on, $bbcode_uid = 0)
{
global $board_config, $html_entities_match, $html_entities_replace;
// Clean up the message
$message = trim($message);
if ($html_on)
{
// If HTML is on, we try to make it safe
// This approach is quite agressive and anything that does not look like a valid tag
// is going to get converted to HTML entities
$message = stripslashes($message);
$html_match = '#<[^w<]*(w+)((?:"[^"]*"|'[^']*'|[^<>'"])+)?>#';
$matches = array();
$message_split = preg_split($html_match, $message);
preg_match_all($html_match, $message, $matches);
$message = '';
foreach ($message_split as $part)
{
$tag = array(array_shift($matches[0]), array_shift($matches[1]), array_shift($matches[2]));
$message .= preg_replace($html_entities_match, $html_entities_replace, $part) . clean_html($tag);
//$message .= preg_replace($html_entities_match, $html_entities_replace, $part) . $tag;
}
$message = addslashes($message);
$message = str_replace('"', '"', $message);
}
else
{
$message = preg_replace($html_entities_match, $html_entities_replace, $message);
}
return $message;
}
REPLACE WITH
// This function will prepare a posted message for entry into the database.
function prepare_message($message, $html_on, $bbcode_on, $smile_on, $bbcode_uid = 0)
{
return trim($message);
}
Read again carefully the first lines of this post before proceding... do you really want to proceed? The whole risk is up to you... Good Luck!!! :roll:
|
|
Here is a Demo of an API you can use to fetch content within Icy Phoenix.
This demo is just to fetch the content of a topic:
<?php
/**
*
* @package Icy Phoenix
* @version $Id$
* @copyright (c) 2008 Icy Phoenix
* @license http://opensource.org/licenses/GPL-license.php GNU Public License
*
*/
define('IN_ICYPHOENIX', true);
if (!defined('IP_ROOT_PATH')) define('IP_ROOT_PATH', './../');
if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
include(IP_ROOT_PATH . 'common.' . PHP_EXT);
// Define constant to keep page_header.php from sending headers
define('AJAX_HEADERS', true);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
// End session management
// Usage examples
/*
Display topic content
mode => topic
http://localhost/ip/api/api.php?mode=topic&topic_id=2
topic_id = topic id
*/
// CLASS API - BEGIN
/**
* Class to provide data to other features/app
*/
class class_api
{
/**
* Class init
*/
function class_api()
{
}
/**
* Get Forums
*/
function get_forums($forums_array)
{
global $db, $cache, $config, $template, $user, $lang;
$sql = "SELECT f.* FROM " . FORUMS_TABLE . " f WHERE " . $db->sql_in_set('f.forum_id', $forums_array);
$result = $db->sql_query($sql, 86400, 'forums_list_', FORUMS_CACHE_FOLDER);
$forums_data = array();
while($row = $db->sql_fetchrow($result))
{
$forums_data[$row['forum_id']] = $row;
}
$db->sql_freeresult($result);
return $forums_data;
}
/**
* Get topic
*/
function get_topic($topic_id)
{
global $db, $cache, $config, $template, $user, $lang;
$sql = "SELECT t.*, p.*, u.*
FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p, " . USERS_TABLE . " u
WHERE t.topic_id = " . $topic_id . "
AND p.post_id = t.topic_first_post_id
AND u.user_id = t.topic_poster
LIMIT 1";
$result = $db->sql_query($sql);
$topic_data = array();
if (!empty($result))
{
$topic_data = $db->sql_fetchrow($result);
}
$db->sql_freeresult($result);
return $topic_data;
}
}
$class_api = new class_api();
// CLASS API - END
// CONFIG - BEGIN
$full_server_url = create_server_url();
$table_fields = array(
'tag_count' => array('lang_key' => 'TAG_COUNT', 'view_level' => AUTH_ALL),
'tag_text' => array('lang_key' => 'TAG_TEXT', 'view_level' => AUTH_ALL),
);
// CONFIG - END
// VARS - BEGIN
$topic_id = request_var('topic_id', 0);
$mode_types = array('main', 'cats', 'cat', 'tags', 'tags_all', 'authors', 'authors_topics', 'topic');
$mode = request_var('mode', $mode_types[0]);
$mode = check_var_value($mode, $mode_types);
$start = request_var('start', 0);
$start = ($start < 0) ? 0 : $start;
$per_page = request_var('per_page', 0);
$per_page = (empty($per_page) || ($per_page < 10) || ($per_page > 200)) ? $config['topics_per_page'] : $per_page;
$s_hidden_fields = '';
// SORT ORDER - BEGIN
$sort_order_array = array();
switch ($mode)
{
case 'authors':
$sort_order_array = array('alpha', 'number');
break;
default:
$sort_order_array = array();
break;
}
$sort_order = request_var('sort_order', $sort_order_array[0]);
$sort_order = (in_array($sort_order, $sort_order_array) ? $sort_order : $sort_order_array[0]);
// SORT ORDER - END
// SORT DIR - BEGIN
$sort_dir = request_var('sort_dir', 'DESC');
$sort_dir = (strtoupper($sort_dir) == 'ASC') ? 'ASC' : 'DESC';
// SORT DIR - END
// VARS - END
// ARRAY BASICS - BEGIN
$result_array = array();
$post_url_empty = $full_server_url . CMS_PAGE_VIEWTOPIC . '?' . POST_POST_URL . '={POST_ID}';
$print_url_empty = $full_server_url . 'printview.' . PHP_EXT . '?' . POST_POST_URL . '={POST_ID}';
$single_post_url_empty = $full_server_url . 'show_post.' . PHP_EXT . '?mob=1&light_view=1&' . POST_POST_URL . '={POST_ID}';
$result_array['url_post'] = $post_url_empty;
$result_array['url_print'] = $print_url_empty;
$result_array['url_single_post'] = $single_post_url_empty;
// ARRAY BASICS - END
if ($mode == 'topic')
{
if (!empty($topic_id))
{
include_once(IP_ROOT_PATH . 'includes/bbcode.' . PHP_EXT);
$topic_data = $class_api->get_topic($topic_id);
$forum_id = $topic_data['forum_id'];
$topic_id = $topic_data['topic_id'];
$post_id = $topic_data['topic_first_post_id'];
$forum_id_append = (!empty($forum_id) ? (POST_FORUM_URL . '=' . $forum_id) : '');
$topic_id_append = (!empty($topic_id) ? (POST_TOPIC_URL . '=' . $topic_id) : '');
$post_id_append = (!empty($post_id) ? (POST_POST_URL . '=' . $post_id) : '');
$views = $topic_data['topic_views'];
$replies = $topic_data['topic_replies'];
$topic_title = $topic_data['topic_title'];
// Convert and clean special chars!
$topic_title = htmlspecialchars_clean($topic_title);
$first_time = create_date_ip($lang['DATE_FORMAT_VF'], $topic_data['topic_time'], $config['board_timezone'], true);
$last_time = create_date_ip($config['default_dateformat'], $topic_data['topic_last_post_time'], $config['board_timezone']);
$forum_url = $full_server_url . CMS_PAGE_VIEWFORUM . '?' . $forum_id_append;
$topic_url = $full_server_url . CMS_PAGE_VIEWTOPIC . '?' . $forum_id_append . '&' . $topic_id_append;
$post_url = $full_server_url . CMS_PAGE_VIEWTOPIC . '?' . $post_id_append;
$single_post_url = $single_post_url_empty . $post_id;
$cat_id = $cis_reverse_cats[$forum_id];
$is_gf = in_array($forum_id, $cats_all_gf) ? true : false;
$topic_img = $full_server_url . '_api/' . $cat_id . ($is_gf ? '_gf' : '') . '.png';
$forum_title = ucwords(str_replace('_', ' ', $cat_id));
$message = $topic_data['post_text'];
$message_compiled = (empty($topic_data['post_text_compiled']) || !empty($config['posts_precompiled'])) ? false : $topic_data['post_text_compiled'];
$message = censor_text($message);
$bbcode->allow_html = (($config['allow_html'] && $topic_data['enable_html']) ? true : false);
$bbcode->allow_bbcode = (($config['allow_bbcode'] && $topic_data['enable_bbcode']) ? true : false);
$bbcode->allow_smilies = (($config['allow_smilies'] && $topic_data['enable_smilies']) ? true : false);
if($message_compiled === false)
{
$bbcode->code_post_id = $topic_data['post_id'];
$message = $bbcode->parse($message);
$bbcode->code_post_id = 0;
if (empty($bbcode->allow_bbcode))
{
$message = str_replace("\n", "<br />", preg_replace("/\r\n/", "\n", $message));
}
}
else
{
$message = $message_compiled;
}
/*
if ($topic_data['enable_autolinks_acronyms'])
{
$message = $bbcode->acronym_pass($message);
$message = $bbcode->autolink_text($message, $forum_id);
}
*/
if (!empty($strip_tags))
{
$allowed_tags = '<p><b><i><u><a><ul><ol><li><h1><h2><h3><h4><h5><h6>';
$message = strip_tags($message, $allowed_tags);
}
$result_array['items'][] = array(
'forum_id' => $forum_id,
'topic_id' => $topic_id,
'post_id' => $post_id,
'gf' => ($is_gf ? 1 : 0),
'category' => $forum_title,
'title' => $topic_title,
'url' => $topic_url,
'single_post_url' => $single_post_url,
'message' => $message,
'thumb' => $topic_img,
'replies' => $replies,
'views' => $views,
'tags' => $topic_data['topic_tags'],
'first_time' => $first_time,
'first_author' => $topic_data['topic_first_poster_name'],
'last_time' => $last_time,
'last_author' => $topic_data['topic_last_poster_name'],
);
$result_array['email_text'] = $api_lang['email_text'];
$result_array['count'] = sizeof($result_array['items']);
}
}
AJAX_headers(true);
echo json_encode($result_array) . "\n\n";
flush();
garbage_collection();
exit_handler();
exit;
?>
|
|
[DOC] How To Add Tables To Database
So you've found a new modification that you'd like to use on your Icy Phoenix website? Many modifications you'll find here and on other websites will have special instructions letting you know you'll be adding new or altering some tables to your database. For those type of modifications to work, you'll need to update your database.
Assuming you know how to access your Icy Phoenix database, look to see what your tables are prefixed with. If you installed Icy Phoenix using the default prefix, your database tables will have " ip_" in front of them. Many users are used to prefixing their tables with the " phpbb_" prefix. In fact, it doesn't matter what you use as your prefix when installing a fresh copy of Icy Phoenix. What matters is you are consistent and remember to name all future prefixes the way you started.
When viewing the install instructions inside a modification folder, you may see something similar to this:
CREATE TABLE `ip_medal` (
`medal_id` mediumint(8) UNSIGNED NOT NULL auto_increment,
`cat_id` mediumint(8) UNSIGNED NOT NULL default '1',
`medal_name` varchar(40) NOT NULL,
`medal_description` varchar(255) NOT NULL,
`medal_image` varchar(40) NULL,
PRIMARY KEY (`medal_id`)
);
CREATE TABLE `ip_medal_user` (
`issue_id` mediumint(8) UNSIGNED NOT NULL auto_increment,
`medal_id` mediumint(8) UNSIGNED NOT NULL,
`user_id` mediumint(8) UNSIGNED NOT NULL,
`issue_reason` varchar(255) NOT NULL,
`issue_time` int(11) NOT NULL,
PRIMARY KEY (`issue_id`)
);
CREATE TABLE `ip_medal_mod` (
`mod_id` mediumint(8) UNSIGNED NOT NULL auto_increment,
`medal_id` mediumint(8) UNSIGNED NOT NULL,
`user_id` mediumint(8) UNSIGNED NOT NULL,
PRIMARY KEY (`mod_id`)
);
CREATE TABLE `ip_medal_cat` (
`cat_id` mediumint(8) UNSIGNED NOT NULL auto_increment,
`cat_title` varchar(100) NOT NULL,
`cat_order` mediumint(8) UNSIGNED NOT NULL default '0',
PRIMARY KEY (`cat_id`),
KEY `cat_order` (`cat_order`)
);
INSERT INTO `ip_config` VALUES ('allow_medal_display', '0');
INSERT INTO `ip_config` VALUES ('medal_display_row', '1');
INSERT INTO `ip_config` VALUES ('medal_display_col', '3');
INSERT INTO `ip_config` VALUES ('medal_display_width', '');
INSERT INTO `ip_config` VALUES ('medal_display_height', '');
INSERT INTO `ip_config` VALUES ('medal_display_order', '');
INSERT INTO `ip_medal_cat` VALUES ('1', 'Default', '10');
Notice the lines that detail the prefixes such as:
CREATE TABLE `ip_medal` (
CREATE TABLE `ip_medal_user` (
CREATE TABLE `ip_medal_mod` (
CREATE TABLE `ip_medal_cat` (
INSERT INTO `ip_config` VALUES ('allow_medal_display', '0');
INSERT INTO `ip_config` VALUES ('medal_display_row', '1');
INSERT INTO `ip_config` VALUES ('medal_display_col', '3');
INSERT INTO `ip_config` VALUES ('medal_display_width', '');
INSERT INTO `ip_config` VALUES ('medal_display_height', '');
INSERT INTO `ip_config` VALUES ('medal_display_order', '');
INSERT INTO `ip_medal_cat` VALUES ('1', 'Default', '10');
Clearly the prefix that is used in this example is " ip_". What if your database prefixes are not " ip_"? You simply change the " ip_" prefix in the install instructions to whatever your prefix is.
If your table prefix is " ilovedogs_", you would need to turn these install instructions into this:
CREATE TABLE `ilovedogs_medal` (
`medal_id` mediumint(8) UNSIGNED NOT NULL auto_increment,
`cat_id` mediumint(8) UNSIGNED NOT NULL default '1',
`medal_name` varchar(40) NOT NULL,
`medal_description` varchar(255) NOT NULL,
`medal_image` varchar(40) NULL,
PRIMARY KEY (`medal_id`)
);
CREATE TABLE `ilovedogs_medal_user` (
`issue_id` mediumint(8) UNSIGNED NOT NULL auto_increment,
`medal_id` mediumint(8) UNSIGNED NOT NULL,
`user_id` mediumint(8) UNSIGNED NOT NULL,
`issue_reason` varchar(255) NOT NULL,
`issue_time` int(11) NOT NULL,
PRIMARY KEY (`issue_id`)
);
CREATE TABLE `ilovedogs_medal_mod` (
`mod_id` mediumint(8) UNSIGNED NOT NULL auto_increment,
`medal_id` mediumint(8) UNSIGNED NOT NULL,
`user_id` mediumint(8) UNSIGNED NOT NULL,
PRIMARY KEY (`mod_id`)
);
CREATE TABLE `ilovedogs_medal_cat` (
`cat_id` mediumint(8) UNSIGNED NOT NULL auto_increment,
`cat_title` varchar(100) NOT NULL,
`cat_order` mediumint(8) UNSIGNED NOT NULL default '0',
PRIMARY KEY (`cat_id`),
KEY `cat_order` (`cat_order`)
);
INSERT INTO `ilovedogs_config` VALUES ('allow_medal_display', '0');
INSERT INTO `ilovedogs_config` VALUES ('medal_display_row', '1');
INSERT INTO `ilovedogs_config` VALUES ('medal_display_col', '3');
INSERT INTO `ilovedogs_config` VALUES ('medal_display_width', '');
INSERT INTO `ilovedogs_config` VALUES ('medal_display_height', '');
INSERT INTO `ilovedogs_config` VALUES ('medal_display_order', '');
INSERT INTO `ilovedogs_medal_cat` VALUES ('1', 'Default', '10');
In the picture to the right, my database tables are prefixed with " phpbb_". Since my table prefix is " phpbb_", I must make sure that I change these install instructions to fit my prefix.
Once you have changed the prefixes to suit your needs, we're ready to add them to the database. Using MySQL, click the SQL tab at the top of the page. Copy and paste the whole command or just copy each block separately. I took the following SQL, added it, and you can do the same:
CREATE TABLE `phpbb_medal` (
`medal_id` mediumint(8) UNSIGNED NOT NULL auto_increment,
`cat_id` mediumint(8) UNSIGNED NOT NULL default '1',
`medal_name` varchar(40) NOT NULL,
`medal_description` varchar(255) NOT NULL,
`medal_image` varchar(40) NULL,
PRIMARY KEY (`medal_id`)
);
I was then told " Your SQL query has been executed successfully (Query took 0.0137 sec)".
Keep following the special SQL instructions in the install file until you are finished.
|
|
Hi all,
this short message just to announce that today I have upgraded this site with an optimized version of Icy Phoenix which should better manage memory loads in non-forum pages... so you should notice some improvements in navigating.
Since I made so many modifications there could be some new bugs... :roll:
Should you encounter some new bugs, plese write here.
Thank you.
|
|
|
|