Skip to content

Commit

Permalink
Added alpha version of Mobile style
Browse files Browse the repository at this point in the history
  • Loading branch information
MightyGorgon committed Aug 25, 2011
1 parent 204b424 commit 1e8d8ba
Show file tree
Hide file tree
Showing 323 changed files with 3,873 additions and 39 deletions.
45 changes: 44 additions & 1 deletion includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2215,6 +2215,7 @@ function setup_style($style_id, $current_default_style)
unset($row);
$all_styles_array[$style_id] = $template_row;
$row = $template_row;

$template_path = 'templates/';
$template_name = $row['template_name'];

Expand Down Expand Up @@ -2244,6 +2245,47 @@ function setup_style($style_id, $current_default_style)
return $row;
}

/**
* Setup the mobile style
*/
function setup_mobile_style()
{
global $db, $config, $template, $images;

$row = array(
'themes_id' => 0,
'template_name' => 'mobile',
'style_name' => 'Mobile',
'head_stylesheet' => 'style_white.css',
'body_background' => 'white',
'body_bgcolor' => '',
'tr_class1' => 'row1',
'tr_class2' => 'row2',
'tr_class3' => 'row3',
'td_class1' => 'row1',
'td_class2' => 'row2',
'td_class3' => 'row3',
);
$template_path = 'templates/';
$template_name = $row['template_name'];

$template = new Template(IP_ROOT_PATH . $template_path . $template_name);

if ($template)
{
$current_template_path = $template_path . $template_name;
$current_template_cfg = IP_ROOT_PATH . $template_path . $template_name . '/' . $template_name . '.cfg';
@include($current_template_cfg);

if (!defined('TEMPLATE_CONFIG'))
{
message_die(CRITICAL_ERROR, "Could not open $current_template_cfg", '', __LINE__, __FILE__);
}
}

return $row;
}

/*
* Checks if a style exists
*/
Expand Down Expand Up @@ -3030,12 +3072,13 @@ function is_mobile()
return false;
}

if (!empty($user)) $user->is_mobile = false;

$browser = (!empty($user) && !empty($user->browser)) ? $user->browser : (!empty($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '');
$browser_lc = strtolower($browser);

if (strpos(strtolower($browser), 'windows') !== false)
{
if (!empty($user)) $user->is_mobile = false;
return false;
}

Expand Down
103 changes: 65 additions & 38 deletions includes/sessions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1513,56 +1513,83 @@ function setup($lang_set = false, $style = false)
$current_default_style = $config['default_style'];
$change_style = false;

if (empty($config['override_user_style']))
$is_mobile = is_mobile();
// For debugging purpose you can force this to true
//$this->data['is_mobile'] = true;

// We need to store somewhere if the user has the mobile style enabled... so we can output a link to switch between mobile style and norma style
$this->data['mobile_style'] = false;
$disable_mobile_style = false;

// MOBILE STYLE DISABLING - BEGIN
// Let's check if the user wants to disable the mobile style
if(isset($_GET['mob']))
{
// Mighty Gorgon - Change Style - BEGIN
// Check cookie as well!!!
$test_style = request_var(STYLE_URL, 0, false, true);
if ($test_style > 0)
$mob_get = (isset($_GET['mob']) && (intval($_GET['mob']) == 0)) ? 0 : 1;
$_GET['mob'] = $mob_get;
@setcookie('mob', $mob_get, time() + 31536000);
$_COOKIE['mob'] = $mob_get;

if (empty($mob_get))
{
$config['default_style'] = urldecode($test_style);
$config['default_style'] = (check_style_exists($config['default_style']) == false) ? $current_default_style : $config['default_style'];
setcookie($config['cookie_name'] . '_style', $config['default_style'], (time() + 86400), $config['cookie_path'], $config['cookie_domain'], $config['cookie_secure']);
$change_style = true;
$disable_mobile_style = true;
}
else
}

$mob_cok = (isset($_COOKIE['mob']) && (intval($_COOKIE['mob']) == 0)) ? false : true;
if (empty($mob_cok))
{
$disable_mobile_style = true;
}
// MOBILE STYLE DISABLING - END

if (empty($disable_mobile_style) && !empty($this->data['is_mobile']) && !defined('IN_CMS') && !defined('IN_ADMIN'))
{
$this->data['mobile_style'] = true;
$theme = setup_mobile_style();
}
else
{
if (empty($config['override_user_style']))
{
if (isset($_COOKIE[$config['cookie_name'] . '_style']) && (check_style_exists($_COOKIE[$config['cookie_name'] . '_style']) != false))
// Mighty Gorgon - Change Style - BEGIN
// Check cookie as well!!!
$test_style = request_var(STYLE_URL, 0, false, true);
if ($test_style > 0)
{
$config['default_style'] = $_COOKIE[$config['cookie_name'] . '_style'];
$config['default_style'] = urldecode($test_style);
$config['default_style'] = (check_style_exists($config['default_style']) == false) ? $current_default_style : $config['default_style'];
setcookie($config['cookie_name'] . '_style', $config['default_style'], (time() + 86400), $config['cookie_path'], $config['cookie_domain'], $config['cookie_secure']);
$change_style = true;
}
}
// Mighty Gorgon - Change Style - END

$style = (($this->data['user_id'] != ANONYMOUS) && ($this->data['user_style'] > 0) && empty($change_style)) ? $this->data['user_style'] : $config['default_style'];
else
{
if (isset($_COOKIE[$config['cookie_name'] . '_style']) && (check_style_exists($_COOKIE[$config['cookie_name'] . '_style']) != false))
{
$config['default_style'] = $_COOKIE[$config['cookie_name'] . '_style'];
}
}
// Mighty Gorgon - Change Style - END

// Temporary: Mobile Style - BEGIN
/*
// Maybe we should move this check above the if (empty($config['override_user_style']))
$is_mobile = is_mobile();
if (!empty($user->is_mobile))
{
$style = 500;
}
*/
// Temporary: Mobile Style - END
$style = (($this->data['user_id'] != ANONYMOUS) && ($this->data['user_style'] > 0) && empty($change_style)) ? $this->data['user_style'] : $config['default_style'];

if ($theme = setup_style($style, $current_default_style))
{
if (($this->data['user_id'] != ANONYMOUS) && !empty($change_style))
if ($theme = setup_style($style, $current_default_style))
{
// user logged in --> save new style ID in user profile
$sql = "UPDATE " . USERS_TABLE . "
SET user_style = " . $theme['themes_id'] . "
WHERE user_id = " . $this->data['user_id'];
$db->sql_query($sql);
$this->data['user_style'] = $theme['themes_id'];
if (($this->data['user_id'] != ANONYMOUS) && !empty($change_style))
{
// user logged in --> save new style ID in user profile
$sql = "UPDATE " . USERS_TABLE . "
SET user_style = " . $theme['themes_id'] . "
WHERE user_id = " . $this->data['user_id'];
$db->sql_query($sql);
$this->data['user_style'] = $theme['themes_id'];
}
return;
}
return;
}
}

$theme = setup_style($config['default_style'], $current_default_style);
$theme = setup_style($config['default_style'], $current_default_style);
}

return;
}
Expand Down
14 changes: 14 additions & 0 deletions templates/mobile/agreement.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{ERROR_BOX}
<form method="post" action="{S_AGREE_ACTION}">
<div class="block">
<h2>{REGISTRATION}</h2>
{AGREEMENT}<br clear="all" /><br /><br />
{L_PRIVACY_DISCLAIMER}<br clear="all" /><br /><br /><br />
<label><input type="checkbox" name="privacy" />&nbsp;{AGREE_CHECKBOX}</label><br clear="all" /><br />
</div>
<div class="block-empty center">
{S_HIDDEN_FIELDS}
<input type="submit" name="not_agreed" value="{DO_NOT_AGREE}" class="liteoption" />
<input type="submit" name="agreed" value="{AGREE_OVER_13}" class="mainoption" />
</div>
</form>
13 changes: 13 additions & 0 deletions templates/mobile/blocks/dyn_menu_block.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<h2>{MAIN_MENU_NAME}</h2>
<ul class="links">
<!-- BEGIN cat_row -->
<li>
<a href="javascript:void(0);" class="gradient">{cat_row.CAT_ITEM}</a>
<ul class="menu">
<!-- BEGIN menu_row -->
<li>{cat_row.menu_row.MENU_URL}</li>
<!-- END menu_row -->
</ul>
</li>
<!-- END cat_row -->
</ul>
11 changes: 11 additions & 0 deletions templates/mobile/blocks/forum_block.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- BEGIN fetchpost_row -->
<div class="block">
<h2><a href="{fetchpost_row.U_VIEW_COMMENTS}" class="forumlink">{fetchpost_row.TITLE}</a></h2>
{fetchpost_row.TEXT}
<p class="post-time">{fetchpost_row.OPEN}<a href="{fetchpost_row.U_READ_FULL}">{fetchpost_row.L_READ_FULL}</a>{fetchpost_row.CLOSE}</p>
{fetchpost_row.ATTACHMENTS}
<p class="post-time">
<a href="{fetchpost_row.U_POST_COMMENT}">{L_REPLY_NEWS}</a>
</p>
</div>
<!-- END fetchpost_row -->
18 changes: 18 additions & 0 deletions templates/mobile/blocks/forum_list_block.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<h2>{TITLE}</h2>
<ul class="links">
<!-- BEGIN cat_row -->
<li>
<a href="javascript:void(0);" class="gradient">{cat_row.CAT_ITEM}</a>
<ul class="menu">
<!-- BEGIN forum_row -->
<li><a href="{cat_row.forum_row.FORUM_LINK}">{cat_row.forum_row.FORUM_ITEM}</a></li>
<!-- END forum_row -->
</ul>
</li>
<!-- END cat_row -->
</ul>
<!-- BEGIN no_forum -->
<p>{no_forum.NO_FORUM}</p>
<!-- END no_forum -->

<div class="clear"></div>
10 changes: 10 additions & 0 deletions templates/mobile/blocks/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Icy Phoenix</title>
</head>
<body>
<br /><br /><br /><br /><br /><br /><br />
<div style="text-align:center;"><h1><a href="http://www.icyphoenix.com">Icy Phoenix</a></h1></div>
</body>
</html>
30 changes: 30 additions & 0 deletions templates/mobile/blocks/index_block.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<table class="nav-div" width="100%" cellspacing="0" cellpadding="0" border="0">
<!-- BEGIN index_row -->

<tr>
<!-- BEGIN index_items -->
<td class="{index_items.ROW_CLASS} row-center-small" width="{index_row.index_items.ROW_WIDTH}%"><b>{index_row.index_items.CAT_ITEM}</b></td>
<!-- END index_items -->
</tr>

<tr>
<!-- BEGIN index_col -->
<td class="{index_row.index_col.ROW_CLASS} row-center-small">
<table class="empty-table" width="100%" cellspacing="5" cellpadding="0" border="0">
<tr>
<td width="50px">{index_row.index_col.CAT_ICON}</td>
<td class="genmed" align="left">
<table class="empty-table" width="100%" cellspacing="5" cellpadding="0" border="0">
<!-- BEGIN menu_row -->
<tr><td><span class="forumlink">{index_row.index_col.menu_row.MENU_URL}<br /></span>{index_row.index_col.menu_row.MENU_DESC}</td></tr>
<!-- END menu_row -->
</table>
</td>
</tr>
</table>
</td>
<!-- END index_col -->
</tr>

<!-- END index_row -->
</table>
1 change: 1 addition & 0 deletions templates/mobile/blocks/nav_header_block.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- INCLUDE nav_header.tpl -->
1 change: 1 addition & 0 deletions templates/mobile/blocks/nav_logo_block.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- INCLUDE nav_logo.tpl -->
7 changes: 7 additions & 0 deletions templates/mobile/blocks/new_downloads_block.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<table class="empty-table" width="100%" cellspacing="0" cellpadding="0" border="0">
<!-- BEGIN dlrow2 -->
<tr>
<td valign="top"><span class="genmed"><b>{dlrow2.NUMBER_LATEST}.</b></span></td><td><span class="genmed"><a href="{dlrow2.FILELINK_LATEST}">{dlrow2.FILENAME_LATEST}</a> ({dlrow2.INFO_LATEST})<br />{dlrow2.DESCRIP_LATEST}</span></td>
</tr>
<!-- END dlrow2 -->
</table>
25 changes: 25 additions & 0 deletions templates/mobile/blocks/news_block.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!-- BEGIN articles -->
<div class="block">
<h2><a href="{articles.U_COMMENT}" class="forumlink">{articles.L_TITLE}</a></h2>
<p class="post-time">{L_POSTED}&nbsp;{L_WORD_ON}&nbsp;{articles.POST_DATE}&nbsp;{L_BY}&nbsp;{articles.L_POSTER}</p>
{articles.BODY}
<p class="post-time">
{articles.READ_MORE_LINK}
<!-- IF not S_BOT -->
<a href="{articles.U_POST_COMMENT}">{L_REPLY_NEWS}</a>
<!-- ENDIF -->
</p>
<p class="post-time">
{L_NEWS_SUMMARY} <!-- IF S_NEWS_VIEWS --><a href="{articles.U_VIEWS}"><!-- ENDIF -->{articles.COUNT_VIEWS} {L_NEWS_VIEWS}<!-- IF S_NEWS_VIEWS --></a><!-- ENDIF -->
{L_NEWS_AND} <!-- IF not S_BOT --><a href="{INDEX_FILE}?{PORTAL_PAGE_ID}topic_id={articles.ID}" rel="nofollow" title="{articles.L_TITLE}"><!-- ENDIF -->{articles.COUNT_COMMENTS} {L_NEWS_COMMENTS}<!-- IF not S_BOT --></a><!-- ENDIF -->
</p>
</div>
<!-- END articles --><!-- BEGIN comments -->
<div class="block">
<h2>{comments.L_TITLE}</h2>
<p class="post-time">
{comments.POST_DATE} {L_BY} {comments.L_POSTER}
</p>
{comments.BODY}
</div>
<!-- END comments --><!-- BEGIN pagination --><div class="pagination">{pagination.PAGINATION}</div><!-- END pagination -->
34 changes: 34 additions & 0 deletions templates/mobile/blocks/recent_articles_block.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<table class="empty-table" width="100%" cellspacing="0" cellpadding="0" border="0">
<?php
global $style_row;
if ( $style_row == 'articles_scroll')
{
?>
<tr><td>
<marquee id="recent_articles" behavior="scroll" direction="up" scrolldelay="100" height="80" scrollamount="2" loop="true" onmouseover="this.stop()" onmouseout="this.start()">
<div>
<br />
<!-- BEGIN articles_scroll -->
<!-- BEGIN recent_articles -->
<b><a href="{recent_articles.U_ARTICLE}" title="{recent_articles.TITLE}" class="gensmall">{recent_articles.TITLE}</a></b><br />
<span class="gensmall">{L_BY}&nbsp;{recent_articles.AUTHOR}&nbsp;{L_ON} {recent_articles.DATE}</span><br /><br />
<!-- END recent_articles -->
<!-- END articles_scroll -->
<br />
</div>
</marquee>
</td></tr>
<?php
}
?>
<!-- BEGIN articles_static -->
<!-- BEGIN recent_articles -->
<tr>
<td>
<b><a href="{recent_articles.U_ARTICLE}" class="gensmall">{recent_articles.TITLE}</a></b><br />
<span class="gensmall">{L_BY}&nbsp;{recent_articles.AUTHOR}&nbsp;{L_ON} {recent_articles.DATE}</span>
</td>
</tr>
<!-- END recent_articles -->
<!-- END articles_static -->
</table>
20 changes: 20 additions & 0 deletions templates/mobile/blocks/recent_topics_block.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<table class="empty-table" width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td align="left"><span class="gensmall">
<!-- BEGIN scroll -->
<marquee id="recent_topics" behavior="scroll" direction="up" height="200" scrolldelay="100" scrollamount="2" loop="true" onmouseover="this.stop()" onmouseout="this.start()">
<!-- BEGIN recent_topic_row -->
<a href="{scroll.recent_topic_row.U_TITLE}" title="{scroll.recent_topic_row.L_TITLE}"><b>{scroll.recent_topic_row.L_TITLE}</b></a><br />
{L_BY} {scroll.recent_topic_row.S_POSTER} {L_ON} {scroll.recent_topic_row.S_POSTTIME}<br /><br />
<!-- END recent_topic_row -->
</marquee>
<!-- END scroll -->
<!-- BEGIN static -->
<!-- BEGIN recent_topic_row -->
<a href="{static.recent_topic_row.U_TITLE}" title="{static.recent_topic_row.L_TITLE}"><b>{static.recent_topic_row.L_TITLE}</b></a><br />
{L_BY} {static.recent_topic_row.S_POSTER} {L_ON} {static.recent_topic_row.S_POSTTIME}<br /><br />
<!-- END recent_topic_row -->
<!-- END static -->
</span></td>
</tr>
</table>
Loading

0 comments on commit 1e8d8ba

Please sign in to comment.