From 5327292fa55602ece14d2cc3dca5a5373093aa9e Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Sun, 4 Nov 2012 21:53:53 +0000 Subject: [PATCH 1/5] Forumdirectory plugin - add a new site directory for forums, with verbose descriptions. --- forumdirectory/forumdirectory.css | 67 +++++++++ forumdirectory/forumdirectory.php | 201 +++++++++++++++++++++++++ forumdirectory/forumdirectory_item.tpl | 42 ++++++ 3 files changed, 310 insertions(+) create mode 100644 forumdirectory/forumdirectory.css create mode 100644 forumdirectory/forumdirectory.php create mode 100755 forumdirectory/forumdirectory_item.tpl diff --git a/forumdirectory/forumdirectory.css b/forumdirectory/forumdirectory.css new file mode 100644 index 000000000..c3c848569 --- /dev/null +++ b/forumdirectory/forumdirectory.css @@ -0,0 +1,67 @@ + +section .forumdirectory-item dl { + height: auto; + overflow: auto; +} + +section .forumdirectory-item dt { + float: left; + margin-left: 0px; + text-align: right; + color: #999; +} +section .forumdirectory-item dd { + float: left; + margin-left: 5px; +} +.forumdirectory-profile-wrapper { + float: left; + /*max-height: 178px; */ + overflow: hidden; + width: 500px; + margin: 0px 20px; +} +.forumdirectory-copy-wrapper { + float: left; + overflow: hidden; +} + +.forumdirectory-item { + float: left; + width: 800px; + /* height: 200px; */ + box-shadow: 8px 8px 4px #000; + margin-top: 30px; + border: solid 1px #222; +} +section .forumdirectory-photo-wrapper { + float: left; + height: 200px; + width: 165px; +} + +.forumcontact-name { + font-size: 18px; + font-weight: bold; + margin-bottom: -3px; + text-align: left; +} + +.page-type { + font-size: 10px; + font-style: italic; +} +.directory-detailscolumn-wrapper { + float: left; + width: 305px; + margin-right: 10px; +} +.directory-profile-wrapper dl { + margin-top: 3px; + margin-bottom: 3px; +} +.directory-profile-title { + font-weight: bold; + margin-bottom: 3px; + font-size: 14px; +} diff --git a/forumdirectory/forumdirectory.php b/forumdirectory/forumdirectory.php new file mode 100644 index 000000000..344846abd --- /dev/null +++ b/forumdirectory/forumdirectory.php @@ -0,0 +1,201 @@ +page['htmlhead'] .= ''; + + $a->set_pager_itemspage(60); + + if(local_user()) { + require_once('include/contact_widgets.php'); + + $a->page['aside'] .= findpeople_widget(); + + } + else + unset($_SESSION['theme']); + + +} + + +function forumdirectory_post(&$a) { + if(x($_POST,'search')) + $a->data['search'] = $_POST['search']; +} + + + +function forumdirectory_content(&$a) { + + if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) { + notice( t('Public access denied.') . EOL); + return; + } + + $o = ''; + nav_set_selected('directory'); + + if(x($a->data,'search')) + $search = notags(trim($a->data['search'])); + else + $search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : ''); + + $tpl = get_markup_template('directory_header.tpl'); + + $globaldir = ''; + $gdirpath = dirname(get_config('system','directory_submit_url')); + if(strlen($gdirpath)) { + $globaldir = ''; + } + + $admin = ''; + + $o .= replace_macros($tpl, array( + '$search' => $search, + '$globaldir' => $globaldir, + '$desc' => t('Find on this site'), + '$admin' => $admin, + '$finding' => (strlen($search) ? '

' . t('Finding: ') . "'" . $search . "'" . '

' : ""), + '$sitedir' => t('Site Directory'), + '$submit' => t('Find') + )); + + if($search) + $search = dbesc($search); + $sql_extra = ((strlen($search)) ? " AND MATCH (`profile`.`name`, `user`.`nickname`, `pdesc`, `locality`,`region`,`country-name`,`gender`,`marital`,`sexual`,`about`,`romance`,`work`,`education`,`pub_keywords`,`prv_keywords` ) AGAINST ('$search' IN BOOLEAN MODE) " : ""); + + $publish = ((get_config('system','publish_all')) ? '' : " AND `publish` = 1 " ); + + + $r = q("SELECT COUNT(*) AS `total` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 AND `page-flags` = 2 $sql_extra "); + if(count($r)) + $a->set_pager_total($r[0]['total']); + + $order = " ORDER BY `name` ASC "; + + + $r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`, `user`.`timezone` , `user`.`page-flags` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 AND `page-flags` = 2 $sql_extra $order LIMIT %d , %d ", + intval($a->pager['start']), + intval($a->pager['itemspage']) + ); + if(count($r)) { + + if(in_array('small', $a->argv)) + $photo = 'thumb'; + else + $photo = 'photo'; + + foreach($r as $rr) { + + + $profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']); + + $pdesc = (($rr['pdesc']) ? $rr['pdesc'] . '
' : ''); + + $details = ''; + if(strlen($rr['locality'])) + $details .= $rr['locality']; + if(strlen($rr['region'])) { + if(strlen($rr['locality'])) + $details .= ', '; + $details .= $rr['region']; + } + if(strlen($rr['country-name'])) { + if(strlen($details)) + $details .= ', '; + $details .= $rr['country-name']; + } + if(strlen($rr['dob'])) { + if(($years = age($rr['dob'],$rr['timezone'],'')) != 0) + $details .= '
' . t('Age: ') . $years ; + } + if(strlen($rr['gender'])) + $details .= '
' . t('Gender: ') . $rr['gender']; + + if($rr['page-flags'] == PAGE_NORMAL) + $page_type = "Personal Profile"; + if($rr['page-flags'] == PAGE_SOAPBOX) + $page_type = "Fan Page"; + if($rr['page-flags'] == PAGE_COMMUNITY) + $page_type = "Community Forum"; + if($rr['page-flags'] == PAGE_FREELOVE) + $page_type = "Open Forum"; + if($rr['page-flags'] == PAGE_PRVGROUP) + $page_type = "Private Group"; + + $profile = $rr; + + if((x($profile,'address') == 1) + || (x($profile,'locality') == 1) + || (x($profile,'region') == 1) + || (x($profile,'postal-code') == 1) + || (x($profile,'country-name') == 1)) + $location = t('Location:'); + + $gender = ((x($profile,'gender') == 1) ? t('Gender:') : False); + + $marital = ((x($profile,'marital') == 1) ? t('Status:') : False); + + $homepage = ((x($profile,'homepage') == 1) ? t('Homepage:') : False); + + $about = ((x($profile,'about') == 1) ? t('About:') : False); + + $tpl = file_get_contents( dirname(__file__).'/forumdirectory_item.tpl'); + + $entry = replace_macros($tpl,array( + '$id' => $rr['id'], + '$profile-link' => $profile_link, + '$photo' => $a->get_cached_avatar_image($rr[$photo]), + '$alt-text' => $rr['name'], + '$name' => $rr['name'], + '$details' => $pdesc . $details, + '$page-type' => $page_type, + '$profile' => $profile, + '$location' => template_escape($location), + '$gender' => $gender, + '$pdesc' => $pdesc, + '$marital' => $marital, + '$homepage' => $homepage, + '$about' => $about, + + )); + + $arr = array('contact' => $rr, 'entry' => $entry); + + call_hooks('directory_item', $arr); + + unset($profile); + unset($location); + + $o .= $entry; + + } + + $o .= "
\r\n"; + $o .= paginate($a); + + } + else + info( t("No entries \x28some entries may be hidden\x29.") . EOL); + + return $o; +} diff --git a/forumdirectory/forumdirectory_item.tpl b/forumdirectory/forumdirectory_item.tpl new file mode 100755 index 000000000..3b24d25f2 --- /dev/null +++ b/forumdirectory/forumdirectory_item.tpl @@ -0,0 +1,42 @@ + +
+
+
+ + $alt-text + +
+
+
+
$name
+
$page-type
+ {{ if $pdesc }}
$profile.pdesc
{{ endif }} +
+
+ {{ if $location }} +
$location
+
+ {{ if $profile.address }}
$profile.address
{{ endif }} + + $profile.locality{{ if $profile.locality }}, {{ endif }} + $profile.region + $profile.postal-code + + {{ if $profile.country-name }}$profile.country-name{{ endif }} +
+
+ {{ endif }} + + {{ if $gender }}
$gender
$profile.gender
{{ endif }} +
+
+ {{ if $marital }}
$marital
$profile.marital
{{ endif }} + + {{ if $homepage }}
$homepage
$profile.homepage
{{ endif }} +
+
+
+ {{ if $about }}
$about
$profile.about
{{ endif }} +
+
+
From 25ec225c44458f2bb3fadd13badf258700d32411 Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Sun, 4 Nov 2012 22:06:33 +0000 Subject: [PATCH 2/5] Add a link to the blame. --- forumdirectory/forumdirectory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forumdirectory/forumdirectory.php b/forumdirectory/forumdirectory.php index 344846abd..bbf2bd8e4 100644 --- a/forumdirectory/forumdirectory.php +++ b/forumdirectory/forumdirectory.php @@ -3,7 +3,7 @@ * Name: Forum Directory * Description: Add a directory of forums hosted on your server, with verbose descriptions. * Version: 1.0 -* Author: Thomas Willingham +* Author: Thomas Willingham */ function forumdirectory_install() { From d4172d94921ace086300f75bcbf4b72ed136fbc5 Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Sun, 4 Nov 2012 22:18:24 +0000 Subject: [PATCH 3/5] Uh, and add the app link instead of just registering it. --- forumdirectory/forumdirectory.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/forumdirectory/forumdirectory.php b/forumdirectory/forumdirectory.php index bbf2bd8e4..02981813c 100644 --- a/forumdirectory/forumdirectory.php +++ b/forumdirectory/forumdirectory.php @@ -3,7 +3,7 @@ * Name: Forum Directory * Description: Add a directory of forums hosted on your server, with verbose descriptions. * Version: 1.0 -* Author: Thomas Willingham +* Author: Thomas Willingham */ function forumdirectory_install() { @@ -18,6 +18,10 @@ function forumdirectory_module() { return; } +function forumdirectory_app_menu($a,&$b) { +$b['app_menu'][] = ''; +} + function forumdirectory_init(&$a) { $a->page['htmlhead'] .= ''; From 2eb56e4748db3ba4c86d36b57a2a7844de3c40f7 Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Sun, 4 Nov 2012 22:23:28 +0000 Subject: [PATCH 4/5] Sigh...get both corrections in at the same time this time. --- forumdirectory/forumdirectory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forumdirectory/forumdirectory.php b/forumdirectory/forumdirectory.php index 02981813c..83f19d011 100644 --- a/forumdirectory/forumdirectory.php +++ b/forumdirectory/forumdirectory.php @@ -3,7 +3,7 @@ * Name: Forum Directory * Description: Add a directory of forums hosted on your server, with verbose descriptions. * Version: 1.0 -* Author: Thomas Willingham +* Author: Thomas Willingham */ function forumdirectory_install() { From b79caf5a888f7c068c427eb967420215883475ac Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Wed, 7 Nov 2012 20:04:17 +0000 Subject: [PATCH 5/5] Provide forumdirectory tarball. --- forumdirectory.tgz | Bin 0 -> 3412 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 forumdirectory.tgz diff --git a/forumdirectory.tgz b/forumdirectory.tgz new file mode 100644 index 0000000000000000000000000000000000000000..09fcb4ce9db4189b230611884834b684a24cae94 GIT binary patch literal 3412 zcmV-a4Xg4WiwFRKzM4<~1MM1VbKABuU*%tcs(K;i(djc$Y<1j3ar4HuJht1uPLh!+ z5t2CORS@)%)c^hM;^1Xk&YPy!JYvQcu~_VlT>#`fV6kUAjLvw#?z+$Zh}MI)yS#d?nsfF@m`getml&C9BpT|ix%F>+$KDTDP?OPr#rGf)u>ac;2TDBaK&|1(ozY8fKCC>@w z=g-8MlSXLMXh!buzd$QtC!{6&9WhnX17g&-f!_W78iBUTNH*n`R0j z<0_JETVq=`t4m1%&Yr~_a8yBQ3CwA(U|RK@bC%R% zygqy`exp~)5t_CzPsTc$lF09=g;MMi6J4XSx1CIR(}wO#%E3H!g5`~Ob348H;o+~n_UZ9TI8?{9AR z`i1@fPH$(s+W-FPtzcx#7;>?9U%P^WsxA;@ARO15c6fg z2IK+~i4~Eb9TyVJVrh9~Z^?NW4Z7Vc>k8OF?en^7ZFQ%RdF{K{cWx;guB~_1*5qV5{n%&`1NJO|-+gjvAZmd@LZ$g??f!8& zK-P>TvHw@f;sti>Qe_ezGk+zvCTcdU*7L>`XEmnpQ;9#m|48 z4y2cIML-W_W8!`#!bfwb*Ti9GZi)@-B!=Zek0CsdjG2{XaX zMDM`B+*z1LbO)=*Gg`(JtavpE^T|o_TEQJJjxoxEzg-z%=L`xoB#*QELPk{ov`EZ(UE&(Ghh)dTN`7orbk?HCRen zrC=-B0a74|wTMj49M61c!6piz+?UQVg$E8tSqG5sa-^7b1Ho)lJfTS3EYT(zfDS^) z1`k~zi8h8U>Qx+0z`mgiN3@JS6I@=D;YFdEwQz%}e;(Bdc`JmHC@+;J(< zD4u!_pMac(&=c$hhfJ6HWJFkdoj?j_mRJS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