From 7f1253ed112d318a25c22b267354b94af599af38 Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Fri, 15 Nov 2013 15:44:23 +0000 Subject: Still use page_display.tpl for pages. --- mod/page.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/mod/page.php b/mod/page.php index 403016eb2..38f40ddd6 100644 --- a/mod/page.php +++ b/mod/page.php @@ -112,7 +112,16 @@ function page_content(&$a) { xchan_query($r); $r = fetch_post_tags($r,true); - $o .= prepare_body($r[0],true); - return $o; + $body = prepare_body($r[0],true); + + return $o . replace_macros(get_markup_template('page_display.tpl'),array( + '$author' => (($naked) ? '' : $item['author']['xchan_name']), + '$auth_url' => (($naked) ? '' : $item['author']['xchan_url']), + '$date' => (($naked) ? '' : datetime_convert('UTC',date_default_timezone_get(),$item['created'],'Y-m-d H:i')), + '$title' => smilies(bbcode($item['title'])), + '$body' => $body + )); } + + -- cgit v1.2.3 From 733cb37ef14eb4dd5408e1a8c453f13cd41952eb Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Fri, 15 Nov 2013 19:23:00 +0000 Subject: Copy paste from one terminal to another changed tab to whitespace. --- mod/page.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mod/page.php b/mod/page.php index 38f40ddd6..fdb8ee38f 100644 --- a/mod/page.php +++ b/mod/page.php @@ -115,13 +115,13 @@ function page_content(&$a) { $body = prepare_body($r[0],true); - return $o . replace_macros(get_markup_template('page_display.tpl'),array( - '$author' => (($naked) ? '' : $item['author']['xchan_name']), - '$auth_url' => (($naked) ? '' : $item['author']['xchan_url']), - '$date' => (($naked) ? '' : datetime_convert('UTC',date_default_timezone_get(),$item['created'],'Y-m-d H:i')), - '$title' => smilies(bbcode($item['title'])), - '$body' => $body - )); + return $o . replace_macros(get_markup_template('page_display.tpl'),array( + '$author' => (($naked) ? '' : $item['author']['xchan_name']), + '$auth_url' => (($naked) ? '' : $item['author']['xchan_url']), + '$date' => (($naked) ? '' : datetime_convert('UTC',date_default_timezone_get(),$item['created'],'Y-m-d H:i')), + '$title' => smilies(bbcode($item['title'])), + '$body' => $body + )); } -- cgit v1.2.3 From c4b4f277963af2a3ef782dc14d369cbfe3b46a2e Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Sun, 22 Dec 2013 20:47:57 +0000 Subject: Some sys chan stuff --- boot.php | 12 ++++++------ include/identity.php | 49 ++++++++++++++----------------------------------- install/update.php | 18 +++++++++++++++++- 3 files changed, 37 insertions(+), 42 deletions(-) diff --git a/boot.php b/boot.php index 1fc65d78f..6b3499a05 100755 --- a/boot.php +++ b/boot.php @@ -46,7 +46,7 @@ define ( 'RED_PLATFORM', 'Red Matrix' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R'); define ( 'ZOT_REVISION', 1 ); -define ( 'DB_UPDATE_VERSION', 1084 ); +define ( 'DB_UPDATE_VERSION', 1085 ); define ( 'EOL', '
' . "\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); @@ -363,7 +363,7 @@ define ( 'HUBLOC_FLAGS_PRIMARY', 0x0001); define ( 'HUBLOC_FLAGS_UNVERIFIED', 0x0002); define ( 'HUBLOC_FLAGS_DELETED', 0x1000); - +define ( 'XCHAN_FLAGS_NORMAL', 0x0000); define ( 'XCHAN_FLAGS_HIDDEN', 0x0001); define ( 'XCHAN_FLAGS_ORPHAN', 0x0002); define ( 'XCHAN_FLAGS_CENSORED', 0x0004); @@ -496,10 +496,11 @@ define ( 'ITEM_MODERATED', 0x0004); define ( 'ITEM_SPAM', 0x0008); define ( 'ITEM_DELETED', 0x0010); define ( 'ITEM_UNPUBLISHED', 0x0020); -define ( 'ITEM_WEBPAGE', 0x0040); // is a static web page, not a conversational item +define ( 'ITEM_WEBPAGE', 0x0040); // is a static web page, not a conversational item define ( 'ITEM_DELAYED_PUBLISH', 0x0080); -define ( 'ITEM_BUILDBLOCK', 0x0100); // Named thusly to make sure nobody confuses this with ITEM_BLOCKED -define ( 'ITEM_PDL', 0x0200); // Page Description Language - e.g. Comanche +define ( 'ITEM_BUILDBLOCK', 0x0100); // Named thusly to make sure nobody confuses this with ITEM_BLOCKED +define ( 'ITEM_PDL', 0x0200); // Page Description Language - e.g. Comanche +define ( 'ITEM_BUG', 0x0400); // Is a bug, can be used by the internal bug tracker /** * Item Flags */ @@ -518,7 +519,6 @@ define ( 'ITEM_MENTIONSME', 0x0400); define ( 'ITEM_NOCOMMENT', 0x0800); // commenting/followups are disabled define ( 'ITEM_OBSCURED', 0x1000); // bit-mangled to protect from casual browsing by site admin define ( 'ITEM_VERIFIED', 0x2000); // Signature verification was successful - /** * * Reverse the effect of magic_quotes_gpc if it is enabled. diff --git a/include/identity.php b/include/identity.php index 80f02a9c5..b44c77e6e 100644 --- a/include/identity.php +++ b/include/identity.php @@ -71,22 +71,21 @@ function validate_channelname($name) { /** - * @function create_dir_account() + * @function create_sys_account() * Create a system channel - which has no account attached * - * Currently unused. * */ -function create_dir_account() { - create_identity(array( - 'account_id' => 'xxx', // This will create an identity with an (integer) account_id of 0, but account_id is required - 'nickname' => 'dir', - 'name' => 'Directory', - 'pageflags' => PAGE_DIRECTORY_CHANNEL|PAGE_HIDDEN, - 'publish' => 0 - )); -} +//function create_sys_channel() { +// create_identity(array( +// 'nickname' => 'sys', +// 'name' => 'System', +// 'pageflags' => PAGE_SYSTEM, +// 'publish' => 0, +// 'xchanflags' => XCHAN_FLAGS_SYSTEM +// )); +//} /** * @channel_total() @@ -145,7 +144,7 @@ function create_identity($arr) { $name = escape_tags($arr['name']); $pageflags = ((x($arr,'pageflags')) ? intval($arr['pageflags']) : PAGE_NORMAL); - + $xchanflags = ((x($arr,'xchanflags')) ? intval($arr['xchanflags']) : XCHAN_FLAGS_NORMAL); $name_error = validate_channelname($arr['name']); if($name_error) { $ret['message'] = $name_error; @@ -243,7 +242,7 @@ function create_identity($arr) { $newuid = $ret['channel']['channel_id']; - $r = q("insert into xchan ( xchan_hash, xchan_guid, xchan_guid_sig, xchan_pubkey, xchan_photo_l, xchan_photo_m, xchan_photo_s, xchan_addr, xchan_url, xchan_follow, xchan_connurl, xchan_name, xchan_network, xchan_photo_date, xchan_name_date ) values ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')", + $r = q("insert into xchan ( xchan_hash, xchan_guid, xchan_guid_sig, xchan_pubkey, xchan_photo_l, xchan_photo_m, xchan_photo_s, xchan_addr, xchan_url, xchan_follow, xchan_connurl, xchan_name, xchan_network, xchan_photo_date, xchan_name_date, xchan_flags ) values ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%d')", dbesc($hash), dbesc($guid), dbesc($sig), @@ -258,7 +257,8 @@ function create_identity($arr) { dbesc($ret['channel']['channel_name']), dbesc('zot'), dbesc(datetime_convert()), - dbesc(datetime_convert()) + dbesc(datetime_convert()), + intval($xchanflags) ); // Not checking return value. @@ -1109,24 +1109,3 @@ function get_theme_uid() { } return $uid; } - -/** - * @function get_default_profile_photo($size = 175) - * Retrieves the path of the default_profile_photo for this system - * with the specified size. - * @param int $size - * one of (175, 80, 48) - * @returns string - * - */ - -function get_default_profile_photo($size = 175) { - $scheme = get_config('system','default_profile_photo'); - if(! $scheme) - $scheme = 'rainbow_man'; - return 'images/default_profile_photos/' . $scheme . '/' . $size . '.jpg'; -} - - - - \ No newline at end of file diff --git a/install/update.php b/install/update.php index f498ec042..05bddba42 100644 --- a/install/update.php +++ b/install/update.php @@ -1,6 +1,6 @@ Date: Sun, 22 Dec 2013 20:51:49 +0000 Subject: xref --- mod/xref.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 mod/xref.php diff --git a/mod/xref.php b/mod/xref.php new file mode 100644 index 000000000..566de1998 --- /dev/null +++ b/mod/xref.php @@ -0,0 +1,20 @@ + 2) + $url = argv(2); + + goaway (z_root() . '/' . $url); + +} -- cgit v1.2.3 From 57bf80fff09541845f1b9d4a915d832e4f146d20 Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Sun, 22 Dec 2013 20:54:31 +0000 Subject: Achievements --- mod/achievements.php | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 mod/achievements.php diff --git a/mod/achievements.php b/mod/achievements.php new file mode 100644 index 000000000..1910def73 --- /dev/null +++ b/mod/achievements.php @@ -0,0 +1,84 @@ + 1) + $which = argv(1); + else { + notice( t('Requested profile is not available.') . EOL ); + return; +} + + $profile = 0; + $profile = argv(1); + profile_load($a,$which,$profile); + + $r = q("select channel_id from channel where channel_address = '%s'", + dbesc($which) + ); + if($r) { + $owner = intval($r[0]['channel_id']); + } + + $observer = $a->get_observer(); + $ob_hash = (($observer) ? $observer['xchan_hash'] : ''); + $perms = get_all_perms($owner,$ob_hash); + if(! $perms['view_profile']) { + notice( t('Permission denied.') . EOL); + return; + } + +// By default, all badges are false + $contactbadge = false; + $profilebadge = false; + $keywordsbadge = false; + +// Check number of contacts. Award a badge if over 10 +// We'll figure these out on each page load instead of +// writing them to the DB because that will mean one needs +// to retain their achievements - eg, you can't add +// a bunch of channels just to get your badge, and then +// delete them all again. If these become popular or +// used in profiles or something, we may need to reconsider +// and add a table for this - because this won't scale. + + $r = q("select * from abook where abook_channel = %d", + intval($owner) + ); + + if (count($r)) + $contacts = count($r); + // We're checking for 11 to adjust for the abook record for self + if ($contacts >= 11) + $contactbadge = true; + +// Check if an about field in the profile has been created. + + $r = q("select * from profile where uid = %d and about <> ''", + intval($owner) + ); + + if ($r) + $profilebadge = 1; + +// Check if keywords have been set + + $r = q("select * from profile where uid = %d and keywords <> ''", + intval($owner) + ); + + if($r) + $keywordsbadge = 1; + +// FIXME - stick ths in a template, and make it look pretty. + $o .= "Template not implemented"; + $o .= "If this is one, you get the profile badge" . $profilebadge . "
"; + $o .= "If this is one, you get the contact badge" . $contactbadge . "
"; + $o .= "If this is one you get the keywords badge" . $keywordsbadge . "
"; + $o .= "I haven't done the top level posts badge yet" . $toplevelpostsbadge . "
"; + $o .= "I haven't done the number of channels badge yet" . $channelsbadge; + + +return $o; + +} -- cgit v1.2.3 From 569e93d6e13e59528867b0a715b33f8f10610add Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Sun, 22 Dec 2013 20:54:41 +0000 Subject: Ooops, also update the DB --- install/database.sql | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/install/database.sql b/install/database.sql index ef79862c3..915cecdba 100644 --- a/install/database.sql +++ b/install/database.sql @@ -1029,3 +1029,11 @@ CREATE TABLE IF NOT EXISTS `xtag` ( KEY `xtag_hash` (`xtag_hash`), KEY `xtag_flags` (`xtag_flags`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +CREATE TABLE if not exists `sys_perms` ( + `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , + `cat` CHAR( 255 ) NOT NULL , + `k` CHAR( 255 ) NOT NULL , + `v` MEDIUMTEXT NOT NULL, + `public_perm` TINYINT( 1 ) UNSIGNED NOT NULL +) ENGINE = MYISAM DEFAULT CHARSET = utf8"); -- cgit v1.2.3 From 2074bd0a3bf13a2d5d77f43489092a1230447213 Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Sun, 22 Dec 2013 21:13:24 +0000 Subject: Must have broken that in a merge - put it back --- include/identity.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/identity.php b/include/identity.php index b44c77e6e..568eae8c0 100644 --- a/include/identity.php +++ b/include/identity.php @@ -1109,3 +1109,20 @@ function get_theme_uid() { } return $uid; } + +/** +* @function get_default_profile_photo($size = 175) +* Retrieves the path of the default_profile_photo for this system +* with the specified size. +* @param int $size +* one of (175, 80, 48) +* @returns string +* +*/ + +function get_default_profile_photo($size = 175) { + $scheme = get_config('system','default_profile_photo'); + if(! $scheme) + $scheme = 'rainbow_man'; + return 'images/default_profile_photos/' . $scheme . '/' . $size . '.jpg'; +} -- cgit v1.2.3 From 0d5c5187f9123e6ac9490408544e4816234adf17 Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Sun, 22 Dec 2013 21:15:13 +0000 Subject: Style --- include/identity.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/identity.php b/include/identity.php index 568eae8c0..2226cdb19 100644 --- a/include/identity.php +++ b/include/identity.php @@ -1112,17 +1112,17 @@ function get_theme_uid() { /** * @function get_default_profile_photo($size = 175) -* Retrieves the path of the default_profile_photo for this system -* with the specified size. +* Retrieves the path of the default_profile_photo for this system +* with the specified size. * @param int $size -* one of (175, 80, 48) +* one of (175, 80, 48) * @returns string * */ function get_default_profile_photo($size = 175) { - $scheme = get_config('system','default_profile_photo'); - if(! $scheme) - $scheme = 'rainbow_man'; - return 'images/default_profile_photos/' . $scheme . '/' . $size . '.jpg'; + $scheme = get_config('system','default_profile_photo'); + if(! $scheme) + $scheme = 'rainbow_man'; + return 'images/default_profile_photos/' . $scheme . '/' . $size . '.jpg'; } -- cgit v1.2.3