Skip to content
Snippets Groups Projects
Commit 10d2f23d authored by Seth Meranda's avatar Seth Meranda
Browse files

Added plugin for mobile site!

parent 53b7c3fa
No related branches found
No related tags found
No related merge requests found
Showing
with 1985 additions and 0 deletions
plugins/mobile/graphics/elgg_toolbar_logo.gif

677 B

plugins/mobile/graphics/toptoolbar_background.gif

1.98 KiB

<?php
/**
* Elgg Mobile
* A Mobile Client For Elgg
*
* @package Elgg
* @subpackage Core
* @author Mark Harding
* @link http://maestrozone.com
*
*/
/**
* Start the Elgg engine
*/
define('externalpage',true);
require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
//Load the front page
global $CONFIG;
set_input('view', 'mobile');
$content = elgg_view_layout('two_column_left_sidebar', elgg_view("account/forms/login"));
page_draw(null, $content);
?>
<?xml version="1.0" encoding="UTF-8"?>
<plugin_manifest>
<field key="author" value="Mark Harding" />
<field key="version" value="0.3" />
<field key="description" value="Elgg Mobile" />
<field key="website" value="http://www.maestrozone.com/" />
<field key="copyright" value="(C) Mark Harding 2010" />
<field key="licence" value="GNU Public License version 2" />
<field key="elgg_version" value="2009072201" />
</plugin_manifest>
\ No newline at end of file
<?php
/**
* Elgg Mobile
* A Mobile Client For Elgg
*
* @package Elgg
* @subpackage Core
* @author Mark Harding
* @link http://maestrozone.com
*
*/
function mobile_init(){
extend_view('metatags','mobile/metatags');
// Close the mobile_init
}
// Initialise log browser
register_elgg_event_handler('init','system','mobile_init');
//elgg_register_simplecache_view(mobile);
register_action("mobile/login",false,$CONFIG->pluginspath . "mobile/actions/login.php", true);
?>
<?php
/**
* Elgg Mobile
* A Mobile Client For Elgg
*
* @package Elgg
* @subpackage Core
* @author Mark Harding
* @link http://maestrozone.com
*
*/
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
$current = curPageURL();
$useragent=$_SERVER['HTTP_USER_AGENT'];
if(preg_match('/android|avantgo|blackberry|blazer|elaine|hiptop|ip(hone|od)|kindle|midp|mmp|mobile|o2|opera mini|palm( os)?|pda|plucker|pocket|psp|smartphone|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce; (iemobile|ppc)|xiino/i',$useragent)||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|e\-|e\/|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|xda(\-|2|g)|yas\-|your|zeto|zte\-/i',substr($useragent,0,4))){
if (isloggedin()) {
?> <script type="text/javascript">window.location ="<?php echo $current;?>?view=mobile"</script> <?php } else { ?> <script type="text/javascript">window.location ="<?php echo $vars['url']; ?>mod/mobile/index.php?view=mobile"</script>
<?php }}?>
\ No newline at end of file
<?php
/**
* Elgg Mobile
* A Mobile Client For Elgg
*
* @package Elgg
* @subpackage Core
* @author Mark Harding
* @link http://maestrozone.com
*
*/
global $CONFIG;
$form_body = "<p class=\"loginbox\"><label>" . elgg_echo('username') . "<br />" . elgg_view('input/text', array('internalname' => 'username', 'class' => 'login-textarea')) . "</label>";
$form_body .= "<br />";
$form_body .= "<label>" . elgg_echo('password') . "<br />" . elgg_view('input/password', array('internalname' => 'password', 'class' => 'login-textarea')) . "</label><br />";
$form_body .= elgg_view('login/extend');
$form_body .= elgg_view('input/submit', array('value' => elgg_echo('login'))) . " <div id=\"persistent_login\"><label><input type=\"checkbox\" name=\"persistent\" value=\"true\" />".elgg_echo('user:persistent')."</label></div></p>";
$login_url = $vars['url'];
if ((isset($CONFIG->https_login)) && ($CONFIG->https_login)) {
$login_url = str_replace("http", "https", $vars['url']);
}
?>
<div id="login-box">
<?php
echo elgg_view('input/form', array('body' => $form_body, 'action' => "{$login_url}action/login"));
?>
</div>
<div id="login-controls">
<p>Need an account? <a href="<?php echo $vars['url']; ?>account/register.php?view=mobile"> Sign up here. </a></p>
</div>
\ No newline at end of file
<?php
/**
* Elgg register form
*
* @package Elgg
* @subpackage Core
* @author Curverider Ltd
* @link http://elgg.org/
*/
$username = get_input('u');
$email = get_input('e');
$name = get_input('n');
$admin_option = false;
if (($_SESSION['user']->admin) && ($vars['show_admin'])) {
$admin_option = true;
}
$form_body = "<p><label>" . elgg_echo('name') . "<br />" . elgg_view('input/text' , array('internalname' => 'name', 'class' => "register-textarea", 'value' => $name)) . "</label><br />";
$form_body .= "<label>" . elgg_echo('email') . "<br />" . elgg_view('input/text' , array('internalname' => 'email', 'class' => "register-textarea", 'value' => $email)) . "</label><br />";
$form_body .= "<label>" . elgg_echo('username') . "<br />" . elgg_view('input/text' , array('internalname' => 'username', 'class' => "register-textarea", 'value' => $username)) . "</label><br />";
$form_body .= "<label>" . elgg_echo('password') . "<br />" . elgg_view('input/password' , array('internalname' => 'password', 'class' => "register-textarea")) . "</label><br />";
$form_body .= "<label>" . elgg_echo('passwordagain') . "<br />" . elgg_view('input/password' , array('internalname' => 'password2', 'class' => "register-textarea")) . "</label><br />";
// view to extend to add more fields to the registration form
$form_body .= elgg_view('register/extend');
// Add captcha hook
$form_body .= elgg_view('input/captcha');
if ($admin_option) {
$form_body .= elgg_view('input/checkboxes', array('internalname' => "admin", 'options' => array(elgg_echo('admin_option'))));
}
$form_body .= elgg_view('input/hidden', array('internalname' => 'friend_guid', 'value' => $vars['friend_guid']));
$form_body .= elgg_view('input/hidden', array('internalname' => 'invitecode', 'value' => $vars['invitecode']));
$form_body .= elgg_view('input/hidden', array('internalname' => 'action', 'value' => 'register'));
$form_body .= elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('register'))) . "</p>";
?>
<div id="register-box">
<h2><?php echo elgg_echo('register'); ?></h2>
<?php echo elgg_view('input/form', array('action' => "{$vars['url']}action/register", 'body' => $form_body)) ?>
</div>
\ No newline at end of file
<?php
/**
* Elgg default layout
*
* @package Elgg
* @subpackage Core
* @author Curverider Ltd
* @link http://elgg.org/
*/
for ($i = 1; $i < 8; $i++) {
if (isset($vars["area{$i}"])) {
echo $vars["area{$i}"];
}
}
\ No newline at end of file
<?php
/**
* Elgg 2 column left sidebar canvas layout
*
* @package Elgg
* @subpackage Core
* @author Curverider Ltd
* @link http://elgg.org/
*/
?>
<div id="two_column_left_sidebar_maincontent">
<?php if (isset($vars['area2'])) echo $vars['area2']; ?>
</div><!-- /two_column_left_sidebar_maincontent -->
<?php
/**
* Elgg 2 column left sidebar with boxes
*
* @package Elgg
* @subpackage Core
* @author Curverider Ltd
* @link http://elgg.org/
*/
?>
<!-- left sidebar -->
<div id="two_column_left_sidebar_boxes">
<?php if (isset($vars['area1'])) echo $vars['area1']; ?>
<?php if (isset($vars['area3'])) echo $vars['area3']; ?>
</div><!-- /two_column_left_sidebar -->
<!-- main content -->
<div id="two_column_left_sidebar_maincontent_boxes">
<?php if (isset($vars['area2'])) echo $vars['area2']; ?>
</div><!-- /two_column_left_sidebar_maincontent -->
<?php
/**
* Elgg 2 column left sidebar canvas layout
*
* @package Elgg
* @subpackage Core
* @author Curverider Ltd
* @link http://elgg.org/
*/
?>
<!-- left sidebar -->
<div id="two_column_left_sidebar">
<?php
set_input('view', 'mobile');
echo elgg_view('page_elements/owner_block',array('content' => $vars['area1']));
?>
<?php if (isset($vars['area3'])) echo $vars['area3']; ?>
</div><!-- /two_column_left_sidebar -->
<!-- main content -->
<div id="two_column_left_sidebar_maincontent">
<?php if (isset($vars['area2'])) echo $vars['area2']; ?>
</div><!-- /two_column_left_sidebar_maincontent -->
<?php if (isset($vars['area1'])) echo $vars['area1']; ?><?php if (isset($vars['area3'])) echo $vars['area3']; ?>
\ No newline at end of file
<?php
/**
* Elgg default layout
*
* @package Elgg
* @subpackage Core
* @author Curverider Ltd
* @link http://elgg.org/
*/
if (isset($vars['group_name'])) {
$groupname = $vars['group_name'];
} else {
$groupname = "main";
}
if (isset($vars['submenu'])) {
$submenu = "<ul>" . $vars['submenu'] . "</ul>";
echo "<div class=\"submenu_group\"><div class=\"submenu_group_{$groupname}\">{$submenu}</div></div>";
}
\ No newline at end of file
<?php
/**
* Elgg default layout
*
* @package Elgg
* @subpackage Core
* @author Curverider Ltd
* @link http://elgg.org/
*/
if (isset($vars['selected']) && $vars['selected'] == true) {
$selected = "class=\"selected\"";
} else {
$selected = "";
}
if (isset($vars['onclick']) && $vars['onclick'] == true) {
$onclick = "onclick=\"javascript:return confirm('". elgg_echo('deleteconfirm') . "')\"";
} else {
$onclick = "";
}
?>
<li <?php echo $selected; ?>><a href="<?php echo $vars['href']; ?>" <?php echo $onclick; ?>><?php echo $vars['label']; ?></a></li>
\ No newline at end of file
This diff is collapsed.
<?php
/**
* Elgg Mobile
* A Mobile Client For Elgg
*
* @package Elgg
* @subpackage Core
* @author Mark Harding
* @link http://maestrozone.com
*
*/
?>
<div style="height:5px;"> </div>
<div id="statusupdate">
What's on your mind?
<form action="<?php echo $vars['url']; ?>action/thewire/add" method="post" name="noteForm">
<?php
$owner = $_SESSION['user']->getGUID();
$latest_wire = get_entities("object", "thewire", $owner, "", 1, 0, false, 0, null);
foreach($latest_wire as $lw){
$status = $lw->description;}
$display .= "<textarea name='note' id=\"thewire_publisherInputBox\" class=\"statusbox\">
</textarea>";
echo $display;
?>
<input type="hidden" name="method" value="site" />
<input type="hidden" name="location" value="activity" />
<input type="hidden" name="access_id" value="2" />
<input type="submit" value="<?php echo elgg_echo('Share!'); ?>" id="submit_mobile"/>
</form>
<h3>Activity Stream</h3>
</div>
<?php
/**
* Elgg river for dashboard.
*
* @package Elgg
* @author Curverider Ltd
* @link http://elgg.com/
*/
/// Extract the river
$river = $vars['river'];
?>
<div id="river">
<?php
$type = '';
$subtype = '';
$relationship_type = "";
$subject_guid = 0;
echo elgg_view_river_items($subject_guid, 0, $relationship_type, $type, $subtype, '');
?>
</div>
\ No newline at end of file
<?php
/**
* View a list of entities
*
* @package Elgg
* @author Curverider Ltd <info@elgg.com>
* @link http://elgg.com/
*
*/
$context = $vars['context'];
$offset = $vars['offset'];
$entities = $vars['entities'];
$limit = $vars['limit'];
$count = $vars['count'];
$baseurl = $vars['baseurl'];
$context = $vars['context'];
$viewtype = $vars['viewtype'];
$pagination = $vars['pagination'];
$fullview = $vars['fullview'];
$html = "";
$nav = "";
if (isset($vars['viewtypetoggle'])) {
$viewtypetoggle = $vars['viewtypetoggle'];
} else {
$viewtypetoggle = true;
}
if ($context == "search" && $count > 0 && $viewtypetoggle) {
$nav .= elgg_view('navigation/viewtype', array(
'baseurl' => $baseurl,
'offset' => $offset,
'count' => $count,
'viewtype' => $viewtype,
));
}
if ($pagination) {
$nav .= elgg_view('navigation/pagination',array(
'baseurl' => $baseurl,
'offset' => $offset,
'count' => $count,
'limit' => $limit,
));
}
$html .= $nav;
if ($viewtype == 'list') {
if (is_array($entities) && sizeof($entities) > 0) {
foreach($entities as $entity) {
$html .= elgg_view_entity($entity, $fullview);
}
}
} else {
if (is_array($entities) && sizeof($entities) > 0) {
$html .= elgg_view('entities/gallery', array('entities' => $entities));
}
}
if ($count) {
$html .= $nav;
}
echo $html;
\ No newline at end of file
<?php
/**
* Elgg entity listing
*
* @package Elgg
* @subpackage Core
* @author Curverider Ltd
* @link http://elgg.org/
*/
?>
<div class="search_listing">
<div class="search_listing_icon">
<?php
echo $vars['icon'];
?>
</div>
<div class="search_listing_info">
<?php
echo $vars['info'];
?>
</div>
</div>
<?php
/**
* Elgg gallery view
*
* @package Elgg
* @subpackage Core
* @author Curverider Ltd
* @link http://elgg.org/
*/
$entities = $vars['entities'];
if (is_array($entities) && sizeof($entities) > 0) {
?>
<table class="entity_gallery">
<?php
$col = 0;
foreach($entities as $entity) {
if ($col == 0) {
echo "<tr>";
}
echo "<td class=\"entity_gallery_item\">";
echo elgg_view_entity($entity);
echo "</td>";
$col++;
if ($col > 1) {
echo "</tr>";
$col = 0;
}
}
if ($col > 0) echo "</tr>";
?>
</table>
<?php
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment