aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--boot.php6
-rw-r--r--include/conversation.php14
-rw-r--r--include/identity.php11
-rw-r--r--include/text.php33
-rw-r--r--index.php30
-rwxr-xr-xmod/mood.php142
-rwxr-xr-xmod/poke.php2
-rw-r--r--mod/zentity.php91
-rw-r--r--version.inc2
-rw-r--r--view/css/mod_zentity.css17
-rw-r--r--view/js/mod_zentity.js17
-rw-r--r--view/php/default.php1
-rw-r--r--view/tpl/mood_content.tpl20
-rw-r--r--view/tpl/zentity.tpl51
14 files changed, 291 insertions, 146 deletions
diff --git a/boot.php b/boot.php
index cf9aa3d57..8bcceff88 100644
--- a/boot.php
+++ b/boot.php
@@ -268,6 +268,7 @@ define ( 'ACTIVITY_TAG', NAMESPACE_ACTIVITY_SCHEMA . 'tag' );
define ( 'ACTIVITY_FAVORITE', NAMESPACE_ACTIVITY_SCHEMA . 'favorite' );
define ( 'ACTIVITY_POKE', NAMESPACE_ZOT . '/activity/poke' );
+define ( 'ACTIVITY_MOOD', NAMESPACE_ZOT . '/activity/mood' );
define ( 'ACTIVITY_OBJ_COMMENT', NAMESPACE_ACTIVITY_SCHEMA . 'comment' );
define ( 'ACTIVITY_OBJ_NOTE', NAMESPACE_ACTIVITY_SCHEMA . 'note' );
@@ -1481,7 +1482,10 @@ if(! function_exists('proc_run')) {
$args[$x] = escapeshellarg($args[$x]);
$cmdline = implode($args," ");
- proc_close(proc_open($cmdline." &",array(),$foo));
+ if(get_config('system','proc_windows'))
+ proc_close(proc_open('start /b ' . $cmdline,array(),$foo));
+ else
+ proc_close(proc_open($cmdline." &",array(),$foo));
}
}
diff --git a/include/conversation.php b/include/conversation.php
index 3bbaf0cba..59f2f2ed8 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -206,6 +206,20 @@ function localize_item(&$item){
$item['body'] = sprintf($txt, $A, $B). "\n\n\n" . $Bphoto;
}
+ if (stristr($item['verb'],ACTIVITY_MOOD)) {
+ $verb = urldecode(substr($item['verb'],strpos($item['verb'],'#')+1));
+ if(! $verb)
+ return;
+
+ $Aname = $item['author-name'];
+ $Alink = $item['author-link'];
+ $A = '[url=' . zrl($Alink) . ']' . $Aname . '[/url]';
+
+ $txt = t('%1$s is currently %2$s');
+
+ $item['body'] = sprintf($txt, $A, t($verb));
+ }
+
if ($item['verb']===ACTIVITY_TAG){
$r = q("SELECT * from `item`,`contact` WHERE
`item`.`contact-id`=`contact`.`id` AND `item`.`uri`='%s';",
diff --git a/include/identity.php b/include/identity.php
index 5164b5eae..8f906228f 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -1,6 +1,17 @@
<?php
+function create_identity($arr) {
+
+
+
+
+}
+
+
+
+
+
class simple_identity {
diff --git a/include/text.php b/include/text.php
index d49b2269c..feafafd06 100644
--- a/include/text.php
+++ b/include/text.php
@@ -670,6 +670,39 @@ function get_poke_verbs() {
return $arr;
}
+function get_mood_verbs() {
+
+ // index is present tense verb
+ // value is array containing past tense verb, translation of present, translation of past
+
+ $arr = array(
+ 'happy' => t('happy'),
+ 'sad' => t('sad'),
+ 'mellow' => t('mellow'),
+ 'tired' => t('tired'),
+ 'perky' => t('perky'),
+ 'angry' => t('angry'),
+ 'stupefied' => t('stupified'),
+ 'puzzled' => t('puzzled'),
+ 'interested' => t('interested'),
+ 'bitter' => t('bitter'),
+ 'cheerful' => t('cheerful'),
+ 'alive' => t('alive'),
+ 'annoyed' => t('annoyed'),
+ 'anxious' => t('anxious'),
+ 'cranky' => t('cranky'),
+ 'disturbed' => t('disturbed'),
+ 'frustrated' => t('frustrated'),
+ 'motivated' => t('motivated'),
+ 'relaxed' => t('relaxed'),
+ 'surprised' => t('surprised'),
+ );
+
+ call_hooks('mood_verbs', $arr);
+ return $arr;
+}
+
+
/**
*
* Function: smilies
diff --git a/index.php b/index.php
index 84fa1593a..8f7f8fa92 100644
--- a/index.php
+++ b/index.php
@@ -2,7 +2,7 @@
/**
*
- * Friendica
+ * Friendica Red
*
*/
@@ -244,13 +244,13 @@ if($a->module_loaded) {
$func = str_replace('-','_',current_theme()) . '_init';
$func($a);
}
-// elseif (x($a->theme_info,"extends") && file_exists("view/theme/".$a->theme_info["extends"]."/theme.php")) {
-// require_once("view/theme/".$a->theme_info["extends"]."/theme.php");
-// if(function_exists(str_replace('-','_',$a->theme_info["extends"]) . '_init')) {
-// $func = str_replace('-','_',$a->theme_info["extends"]) . '_init';
-// $func($a);
-// }
-// }
+ elseif (x($a->theme_info,"extends") && file_exists("view/theme/".$a->theme_info["extends"]."/theme.php")) {
+ require_once("view/theme/".$a->theme_info["extends"]."/theme.php");
+ if(function_exists(str_replace('-','_',$a->theme_info["extends"]) . '_init')) {
+ $func = str_replace('-','_',$a->theme_info["extends"]) . '_init';
+ $func($a);
+ }
+ }
if(($_SERVER['REQUEST_METHOD'] === 'POST') && (! $a->error)
&& (function_exists($a->module . '_post'))
@@ -298,16 +298,6 @@ if(stristr( implode("",$_SESSION['sysmsg']), t('Permission denied'))) {
call_hooks('page_end', $a->page['content']);
-
-/**
- *
- * Add a place for the pause/resume Ajax indicator
- *
- */
-
-$a->page['content'] .= '<div id="pause"></div>';
-
-
/**
*
* Add the navigation (menu) template
@@ -348,10 +338,6 @@ head_add_js('mod_' . $a->module . '.js');
'$baseurl' => $a->get_baseurl(),
'$local_user' => local_user(),
'$generator' => FRIENDICA_PLATFORM . ' ' . FRIENDICA_VERSION,
- '$delitem' => t('Delete this item?'),
- '$comment' => t('Comment'),
- '$showmore' => t('show more'),
- '$showfewer' => t('show fewer'),
'$update_interval' => $interval,
'$head_css' => head_get_css(),
'$head_js' => head_get_js(),
diff --git a/mod/mood.php b/mod/mood.php
new file mode 100755
index 000000000..7a793c71e
--- /dev/null
+++ b/mod/mood.php
@@ -0,0 +1,142 @@
+<?php
+
+require_once('include/security.php');
+require_once('include/bbcode.php');
+require_once('include/items.php');
+
+
+function mood_init(&$a) {
+
+ if(! local_user())
+ return;
+
+ $uid = local_user();
+ $verb = notags(trim($_GET['verb']));
+
+ if(! $verb)
+ return;
+
+ $verbs = get_mood_verbs();
+
+ if(! in_array($verb,$verbs))
+ return;
+
+ $activity = ACTIVITY_MOOD . '#' . urlencode($verb);
+
+ $parent = ((x($_GET,'parent')) ? intval($_GET['parent']) : 0);
+
+
+ logger('mood: verb ' . $verb, LOGGER_DEBUG);
+
+
+ if($parent) {
+ $r = q("select uri, private, allow_cid, allow_gid, deny_cid, deny_gid
+ from item where id = %d and parent = %d and uid = %d limit 1",
+ intval($parent),
+ intval($parent),
+ intval($uid)
+ );
+ if(count($r)) {
+ $parent_uri = $r[0]['uri'];
+ $private = $r[0]['private'];
+ $allow_cid = $r[0]['allow_cid'];
+ $allow_gid = $r[0]['allow_gid'];
+ $deny_cid = $r[0]['deny_cid'];
+ $deny_gid = $r[0]['deny_gid'];
+ }
+ }
+ else {
+
+ $private = 0;
+
+ $allow_cid = $a->user['allow_cid'];
+ $allow_gid = $a->user['allow_gid'];
+ $deny_cid = $a->user['deny_cid'];
+ $deny_gid = $a->user['deny_gid'];
+ }
+
+ $poster = $a->contact;
+
+ $uri = item_new_uri($a->get_hostname(),$uid);
+
+ $action = sprintf( t('%1$s is currently %2$s'), '[url=' . $poster['url'] . ']' . $poster['name'] . '[/url]' , $verbs[$verb]);
+
+ $arr = array();
+
+ $arr['uid'] = $uid;
+ $arr['uri'] = $uri;
+ $arr['parent-uri'] = (($parent_uri) ? $parent_uri : $uri);
+ $arr['type'] = 'activity';
+ $arr['wall'] = 1;
+ $arr['contact-id'] = $poster['id'];
+ $arr['owner-name'] = $poster['name'];
+ $arr['owner-link'] = $poster['url'];
+ $arr['owner-avatar'] = $poster['thumb'];
+ $arr['author-name'] = $poster['name'];
+ $arr['author-link'] = $poster['url'];
+ $arr['author-avatar'] = $poster['thumb'];
+ $arr['title'] = '';
+ $arr['allow_cid'] = $allow_cid;
+ $arr['allow_gid'] = $allow_gid;
+ $arr['deny_cid'] = $deny_cid;
+ $arr['deny_gid'] = $deny_gid;
+ $arr['last-child'] = 1;
+ $arr['visible'] = 1;
+ $arr['verb'] = $activity;
+ $arr['private'] = $private;
+
+ $arr['origin'] = 1;
+ $arr['body'] = $action;
+
+ $item_id = item_store($arr);
+ if($item_id) {
+ q("UPDATE `item` SET `plink` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1",
+ dbesc($a->get_baseurl() . '/display/' . $poster['nickname'] . '/' . $item_id),
+ intval($uid),
+ intval($item_id)
+ );
+ proc_run('php',"include/notifier.php","tag","$item_id");
+ }
+
+
+ call_hooks('post_local_end', $arr);
+
+ proc_run('php',"include/notifier.php","like","$post_id");
+
+ return;
+}
+
+
+
+function mood_content(&$a) {
+
+ if(! local_user()) {
+ notice( t('Permission denied.') . EOL);
+ return;
+ }
+
+ $parent = ((x($_GET,'parent')) ? intval($_GET['parent']) : '0');
+
+
+
+ $verbs = get_mood_verbs();
+
+ $shortlist = array();
+ foreach($verbs as $k => $v)
+ if($v !== 'NOTRANSLATION')
+ $shortlist[] = array($k,$v);
+
+
+ $tpl = get_markup_template('mood_content.tpl');
+
+ $o = replace_macros($tpl,array(
+ '$title' => t('Mood'),
+ '$desc' => t('Set your current mood and tell your friends'),
+ '$verbs' => $shortlist,
+ '$parent' => $parent,
+ '$submit' => t('Submit'),
+ ));
+
+ return $o;
+
+} \ No newline at end of file
diff --git a/mod/poke.php b/mod/poke.php
index bb062308f..a4ccc517a 100755
--- a/mod/poke.php
+++ b/mod/poke.php
@@ -76,7 +76,7 @@ function poke_init(&$a) {
$poster = $a->contact;
- $uri = item_new_uri($a->get_hostname(),$owner_uid);
+ $uri = item_new_uri($a->get_hostname(),$uid);
$arr = array();
diff --git a/mod/zentity.php b/mod/zentity.php
index 011ae8e79..794ac0ecb 100644
--- a/mod/zentity.php
+++ b/mod/zentity.php
@@ -35,7 +35,7 @@ function zentity_init(&$a) {
if($cmd === 'checkaddr.json') {
require_once('library/urlify/URLify.php');
$result = array('error' => false, 'message' => '');
- $n = trim($_REQUEST['addr']);
+ $n = trim($_REQUEST['nick']);
$x = strtolower(URLify::transliterate($n));
@@ -56,71 +56,6 @@ function zentity_init(&$a) {
}
-
-
-// print_r($test);
-
-// if(! allowed_email($email))
-// $result['message'] = t('Your email domain is not among those allowed on this site');
-// if((! valid_email($email)) || (! validate_email($email)))
-// $result['message'] .= t('Not a valid email address') . EOL;
-// if($result['message'])
-// $result['error'] = true;
-
-// header('content-type: application/json');
-// echo json_encode($result);
-// killme();
-
-
- $pw1 = t("Password too short");
- $pw2 = t("Passwords do not match");
-
- $a->page['htmlhead'] .= <<< EOT
-<script>
- function zFormError(elm,x) {
- if(x) {
- $(elm).addClass("zform-error");
- $(elm).removeClass("zform-ok");
- }
- else {
- $(elm).addClass("zform-ok");
- $(elm).removeClass("zform-error");
- }
- }
- $(document).ready(function() {
- $("#zregister-email").blur(function() {
- var zreg_email = $("#zregister-email").val();
- $.get("zregister/email_check.json?f=&email=" + encodeURIComponent(zreg_email),function(data) {
- $("#zregister-email-feedback").html(data.message);
- zFormError("#zregister-email-feedback",data.error);
- });
- });
- $("#zregister-password").blur(function() {
- if(($("#zregister-password").val()).length < 6 ) {
- $("#zregister-password-feedback").html("$pw1");
- zFormError("#zregister-password-feedback",true);
- }
- else {
- $("#zregister-password-feedback").html("");
- zFormError("#zregister-password-feedback",false);
- }
- });
- $("#zregister-password2").blur(function() {
- if($("#zregister-password").val() != $("#zregister-password2").val()) {
- $("#zregister-password2-feedback").html("$pw2");
- zFormError("#zregister-password2-feedback",true);
- }
- else {
- $("#zregister-password2-feedback").html("");
- zFormError("#zregister-password2-feedback",false);
- }
- });
- });
-
-</script>
-
-EOT;
-
}
@@ -309,7 +244,7 @@ function zentity_content(&$a) {
if(get_config('system','no_age_restriction'))
$label_tos = sprintf( t('I accept the %s for this website'), $toslink);
else
- $label_tos = t('Check this box to import an existing identity file from another location');
+ $label_tos =
$email = ((x($_REQUEST,'email')) ? $_REQUEST['email'] : "" );
@@ -322,20 +257,14 @@ function zentity_content(&$a) {
$o = replace_macros(get_markup_template('zentity.tpl'), array(
'$title' => t('Create Identity'),
- '$registertext' => t('An identity is a profile container for a personal profile, blog, public or private group/forum, celebrity page, and more.<br />You may create as many of these as your hub provider allows.'),
- '$invitations' => get_config('system','invitation_only'),
- '$invite_desc' => t('Membership on this site is by invitation only.'),
- '$label_invite' => t('Please enter your invitation code'),
- '$invite_id' => $invite_id,
-
- '$label_email' => t('Full name'),
- '$label_pass1' => t('Choose a short nickname'),
- '$label_pass2' => t('Your nickname will be used to create an easily remembered web address ("webbie") for your profile.'),
- '$label_tos' => $label_tos,
-
- '$email' => $email,
- '$pass1' => $password,
- '$pass2' => $password2,
+ '$desc' => t('An identity is a profile container for a personal profile, blog, public or private group/forum, celebrity page, and more. You may create as many of these as your provider allows.'),
+
+ '$label_name' => t('Full name'),
+ '$label_nick' => t('Choose a short nickname'),
+ '$nick_desc' => t('Your nickname will be used to create an easily remembered web address ("webbie") for your profile.'),
+ '$label_import' => t('Check this box to import an existing identity file from another location'),
+ '$name' => $name,
+ '$nickname' => $nickname,
'$submit' => t('Create')
));
diff --git a/version.inc b/version.inc
index 750c54773..2fc7661a2 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2012-08-22.54
+2012-08-23.55
diff --git a/view/css/mod_zentity.css b/view/css/mod_zentity.css
index 2edb9e9a9..402572a38 100644
--- a/view/css/mod_zentity.css
+++ b/view/css/mod_zentity.css
@@ -4,29 +4,36 @@ h2 {
margin-top: 15%;
}
-#zregister-form {
+#zentity-form {
font-size: 1.4em;
margin-left: 15%;
margin-top: 5%;
+ width: 50%;
}
-.zregister-label {
+#zentity-form .descriptive-paragraph {
+ color: #888;
+ margin-left: 20px;
+ margin-bottom: 25px;
+}
+
+.zentity-label {
float: left;
width: 275px;
}
-.zregister-input {
+.zentity-input {
float: left;
width: 275px;
padding: 5px;
}
-.zregister-feedback {
+.zentity-feedback {
float: left;
margin-left: 5px;
}
-.zregister-field-end {
+.zentity-field-end {
clear: both;
margin-bottom: 20px;
}
diff --git a/view/js/mod_zentity.js b/view/js/mod_zentity.js
new file mode 100644
index 000000000..ad78db7d4
--- /dev/null
+++ b/view/js/mod_zentity.js
@@ -0,0 +1,17 @@
+ $(document).ready(function() {
+ $("#zentity-name").blur(function() {
+ var zreg_name = $("#zentity-name").val();
+ $.get("zentity/autofill.json?f=&name=" + encodeURIComponent(zreg_name),function(data) {
+ $("#zentity-nickname").val(data);
+ zFormError("#zentity-name-feedback",data.error);
+ });
+ });
+ $("#zentity-nickname").blur(function() {
+ var zreg_nick = $("#zentity-nickname").val();
+ $.get("zentity/checkaddr.json?f=&nick=" + encodeURIComponent(zreg_nick),function(data) {
+ $("#zentity-nickname").val(data);
+ zFormError("#zentity-nickname-feedback",data.error);
+ });
+ });
+
+ });
diff --git a/view/php/default.php b/view/php/default.php
index 61f5f6863..80c8070b2 100644
--- a/view/php/default.php
+++ b/view/php/default.php
@@ -10,6 +10,7 @@
<aside><?php if(x($page,'aside')) echo $page['aside']; ?></aside>
<section><?php if(x($page,'content')) echo $page['content']; ?>
<div id="page-footer"></div>
+ <div id="pause"></div>
</section>
<right_aside><?php if(x($page,'right_aside')) echo $page['right_aside']; ?></right_aside>
<footer><?php if(x($page,'footer')) echo $page['footer']; ?></footer>
diff --git a/view/tpl/mood_content.tpl b/view/tpl/mood_content.tpl
new file mode 100644
index 000000000..9349c56ae
--- /dev/null
+++ b/view/tpl/mood_content.tpl
@@ -0,0 +1,20 @@
+<h3>$title</h3>
+
+<div id="mood-desc">$desc</div>
+
+<form action="mood" method="get">
+<br />
+<br />
+
+<input id="mood-parent" type="hidden" value="$parent" name="parent" />
+
+<select name="verb" id="mood-verb-select" >
+{{ for $verbs as $v }}
+<option value="$v.0">$v.1</option>
+{{ endfor }}
+</select>
+<br />
+<br />
+<input type="submit" name="submit" value="$submit" />
+</form>
+
diff --git a/view/tpl/zentity.tpl b/view/tpl/zentity.tpl
index f34042d05..f41578117 100644
--- a/view/tpl/zentity.tpl
+++ b/view/tpl/zentity.tpl
@@ -1,46 +1,27 @@
<h2>$title</h2>
-<form action="zregister" method="post" id="zregister-form">
+<form action="zentity" method="post" id="zentity-form">
-{{ if $registertext }}
-<div id="zregister-desc" style="color: #888; margin-bottom: 50px;" class="descriptive-paragraph">$registertext</div>
-{{ endif }}
+ <div id="zentity-desc" class="descriptive-paragraph">$desc</div>
-{{ if $invitations }}
- <p id="register-invite-desc">$invite_desc</p>
+ <label for="zentity-name" id="label-zentity-name" class="zentity-label" >$label_name</label>
+ <input type="text" name="name" id="zentity-name" class="zentity-input" value="$name" />
+ <div id="zentity-name-feedback" class="zentity-feedback"></div>
+ <div id="zentity-name-end" class="zentity-field-end"></div>
- <label for="zregister-invite" id="label-zregister-invite" class="zregister-label">$label_invite</label>
- <input type="text" maxlength="72" size="32" name="invite_id" id="zregister-invite" class="zregister-input" value="$invite_id" >
- </div>
- <div id="zregister-invite-feedback" class="zregister-feedback"></div>
- <div id="zregister-invite-end" class="zregister-field-end"></div>
+ <label for="zentity-nickname" id="label-zentity-nickname" class="zentity-label" >$label_nick</label>
+ <input type="text" name="nickname" id="zentity-nickname" class="zentity-input" value="$nickname" />
+ <div id="zentity-nickname-feedback" class="zentity-feedback"></div>
+ <div id="zentity-nickname-end" class="zentity-field-end"></div>
-{{ endif }}
+ <div id="zentity-nick-desc" class="descriptive-paragraph">$nick_desc</div>
- <label for="zregister-email" id="label-zregister-email" class="zregister-label" >$label_email</label>
- <input type="text" maxlength="72" size="32" name="email" id="zregister-email" class="zregister-input" value="$email" >
- <div id="zregister-email-feedback" class="zregister-feedback"></div>
- <div id="zregister-email-end" class="zregister-field-end"></div>
+ <input type="checkbox" name="import" id="zentity-import" value="1" />
+ <label for="zentity-import" id="label-zentity-import">$label_import</label>
+ <div id="zentity-import-end" class="zentity-field-end"></div>
- <label for="zregister-password" id="label-zregister-password" class="zregister-label" >$label_pass1</label>
- <input type="text" maxlength="72" size="32" name="password" id="zregister-password" class="zregister-input" value="$pass1" >
- <div id="zregister-password-feedback" class="zregister-feedback"></div>
- <div id="zregister-password-end" class="zregister-field-end"></div>
-
- <div class="clear">
- <div style="color: #888;">$label_pass2</div>
- <div id="zregister-password2-end" class="zregister-field-end"></div>
-
- <div style="margin-bottom: 25px;">&nbsp;</div>
-
-
- <input type="checkbox" name="tos" id="zregister-tos" value="1" >
- <label for="zregister-tos" id="label-zregister-tos">$label_tos</label>
- <div id="zregister-tos-feedback" class="zregister-feedback"></div>
- <div id="zregister-tos-end" class="zregister-field-end"></div>
-
- <input type="submit" name="submit" id="zregister-submit-button" value="$submit" />
- <div id="zregister-submit-end" class="zregister-field-end"></div>
+ <input type="submit" name="submit" id="zentity-submit-button" value="$submit" />
+ <div id="zentity-submit-end" class="zentity-field-end"></div>
</form>