]> git.mxchange.org Git - friendica.git/commitdiff
contact search + sync to personal edition, installer db check + curl proxy
authorMike Macgirvin <mike@macgirvin.com>
Wed, 18 Aug 2010 01:44:13 +0000 (18:44 -0700)
committerMike Macgirvin <mike@macgirvin.com>
Wed, 18 Aug 2010 01:44:13 +0000 (18:44 -0700)
boot.php
include/dba.php
include/notifier.php
mod/contacts.php
mod/directory.php
mod/install.php
view/contacts-top.tpl
view/dfrn.gif [deleted file]
view/theme/default/dfrn.gif [new file with mode: 0644]
view/theme/default/style.css

index 5d476649d8f66b9feaf697484f762758db48fc6e..eae44c672955a9c3c78c892bbf9523e36a567827 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -241,6 +241,14 @@ function fetch_url($url,$binary = false) {
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION,true);
        curl_setopt($ch, CURLOPT_MAXREDIRS,8);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
+       $prx = get_config('system','proxy');
+       if(strlen($prx)) {
+               curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
+               curl_setopt($ch, CURLOPT_PROXY, $prx);
+               $prxusr = get_config('system','proxyuser');
+               if(strlen($prxusr))
+                       curl_setopt($ch, CURLOPT_PROXYUSERPWD, $prxusr);
+       }
        if($binary)
                curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
 
@@ -261,6 +269,14 @@ function post_url($url,$params) {
        curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
        curl_setopt($ch, CURLOPT_POST,1);
        curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
+       $prx = get_config('system','proxy');
+       if(strlen($prx)) {
+               curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
+               curl_setopt($ch, CURLOPT_PROXY, $prx);
+               $prxusr = get_config('system','proxyuser');
+               if(strlen($prxusr))
+                       curl_setopt($ch, CURLOPT_PROXYUSERPWD, $prxusr);
+       }
 
        $s = curl_exec($ch);
        curl_close($ch);
index 0500682306fe7c141e2c1c808131f5a3235147a2..9e44db5fbb85188e4bcbf589f34e3c6192b61704 100644 (file)
@@ -46,7 +46,7 @@ class dba {
                        else
                                $mesg = $result->num_rows.' results' . EOL;
         
-                       $str =  'SQL = ' . $sql . EOL . 'SQL returned ' . $mesg . EOL;
+                       $str =  'SQL = ' . printable($sql) . EOL . 'SQL returned ' . $mesg . EOL;
 
                        switch($this->debug) {
                                case 3:
index dcc772454780ae4fc28d3778c0551ef75831e180..149ce765cbf12271179c16d8309bb74c25616b76 100644 (file)
@@ -1,21 +1,21 @@
 <?php
 
-$debugging = false;
+       $debugging = false;
 
-require_once("boot.php");
+       require_once("boot.php");
 
-$a = new App;
+       $a = new App;
 
-@include(".htconfig.php");
-require_once("dba.php");
-$db = new dba($db_host, $db_user, $db_pass, $db_data, $install);
-       unset($db_host, $db_user, $db_pass, $db_data);
+       @include(".htconfig.php");
+       require_once("dba.php");
+       $db = new dba($db_host, $db_user, $db_pass, $db_data, $install);
+               unset($db_host, $db_user, $db_pass, $db_data);
 
-require_once("session.php");
-require_once("datetime.php");
+       require_once("session.php");
+       require_once("datetime.php");
 
-if($argc < 2)
-       exit;
+       if($argc < 3)
+               exit;
 
        $a->set_baseurl(get_config('system',url'));
 
index 2a767102fac5a8d5e431e987e6ca4007b964d3ae..45c0040c8f8501c1f46ea999f6869a62376b8c59 100644 (file)
@@ -209,17 +209,31 @@ function contacts_content(&$a) {
 
        }
 
+
        if(($a->argc == 2) && ($a->argv[1] == 'all'))
                $sql_extra = '';
        else
                $sql_extra = " AND `blocked` = 0 ";
 
+       $search = ((x($_GET,'search')) ? notags(trim($_GET['search'])) : '');
+
        $tpl = file_get_contents("view/contacts-top.tpl");
        $o .= replace_macros($tpl,array(
                '$hide_url' => ((strlen($sql_extra)) ? 'contacts/all' : 'contacts' ),
-               '$hide_text' => ((strlen($sql_extra)) ? t('Show Blocked Connections') : t('Hide Blocked Connections'))
+               '$hide_text' => ((strlen($sql_extra)) ? t('Show Blocked Connections') : t('Hide Blocked Connections')),
+               '$search' => $search,
+               '$finding' => (strlen($search) ? '<h4>' . t('Finding: ') . "'" . $search . "'" . '</h4>' : ""),
+               '$submit' => t('Find'),
+               '$cmd' => $a->cmd
+
+
        )); 
 
+       if($search)
+               $search = dbesc($search.'*');
+       $sql_extra .= ((strlen($search)) ? " AND MATCH `name` AGAINST ('$search' IN BOOLEAN MODE) " : "");
+
+
        switch($sort_type) {
                case DIRECTION_BOTH :
                        $sql_extra2 = " AND `dfrn-id` != '' AND `issued-id` != '' ";
@@ -242,8 +256,11 @@ function contacts_content(&$a) {
        if(count($r))
                $a->set_pager_total($r[0]['total']);
 
-       $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `pending` = 0 $sql_extra $sql_extra2 ",
-               intval($_SESSION['uid']));
+       $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `pending` = 0 $sql_extra $sql_extra2 ORDER BY `name` ASC LIMIT %d , %d ",
+               intval($_SESSION['uid']),
+               intval($a->pager['start']),
+               intval($a->pager['itemspage'])
+       );
 
        if(count($r)) {
 
@@ -283,8 +300,8 @@ function contacts_content(&$a) {
                        ));
                }
                $o .= '<div id="contact-edit-end"></div>';
-               $o .= paginate($a);
 
        }
+       $o .= paginate($a);
        return $o;
 }
\ No newline at end of file
index dd80ef2b8ab994d2e2e2783a583ae0fc1a89e547..8b7f34c415bf901af1c2866ca9a1cc300c58142d 100644 (file)
@@ -11,7 +11,7 @@ function directory_content(&$a) {
 
        $o .= replace_macros($tpl, array(
                '$search' => $search,
-               '$finding' => (strlen($search) ? "<h4>Finding: '$search'</h4>" : "")
+               '$finding' => (strlen($search) ? '<h4>' . t('Finding: ') . "'" . $search . "'" . '</h4>' : "")
        ));
 
        if($search)
index cb23b31ed5132a94748f4df9240a524b39118d56..dafc86ee69897126bc131b4e3cd61748cb69a478 100644 (file)
@@ -16,7 +16,7 @@ function install_post(&$a) {
 
        $db = new dba($dbhost, $dbuser, $dbpass, $dbdata, $true);
 
-       if(! $db->getdb()) {
+       if(mysqli_connect_errno()) {
                notice( t('Could not connect to database.') . EOL);
                return;
        }
index 20740ad87a38e9c44373e14e2acebcb8f54a4e33..2e56fa2ead438c34892400cb167fc8322495ac36 100644 (file)
@@ -1,5 +1,17 @@
 <h1>Contacts</h1>
 
+$finding
+
+<div id="contacts-search-wrapper">
+<form id="contacts-search-form" action="$cmd" method="get" >
+<input type="text" name="search" id="contacts-search" class="search-input" onfocus="this.select();" value="$search" />
+<input type="submit" name="submit" id="contacts-search-submit" value="$submit" />
+</form>
+</div>
+<div id="contacts-search-end"></div>
+
+
+
 <div id="contacts-main" >
 <a href="$hide_url" id="contacts-show-hide-link">$hide_text</a>
 </div>
diff --git a/view/dfrn.gif b/view/dfrn.gif
deleted file mode 100644 (file)
index 104f42e..0000000
Binary files a/view/dfrn.gif and /dev/null differ
diff --git a/view/theme/default/dfrn.gif b/view/theme/default/dfrn.gif
new file mode 100644 (file)
index 0000000..104f42e
Binary files /dev/null and b/view/theme/default/dfrn.gif differ
index 456465a744bd9f5c2cbd652e2b61273c000a7495..59ec1dd1e82a3453b5a7add318714ee54e0cb218 100644 (file)
@@ -556,6 +556,7 @@ input#dfrn-url {
 }
 
 #contacts-main {
+       margin-top: 20px;
        margin-bottom: 20px;
 }