Exemple #1
0
function viewcontacts_content(&$a)
{
    if (!count($a->profile) || $a->profile['hide-friends']) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    $o .= '<h3>' . t('View Contacts') . '</h3>';
    $r = q("SELECT COUNT(*) as `total` FROM `contact` WHERE `blocked` = 0 AND `pending` = 0");
    if (count($r)) {
        $a->set_pager_total($r[0]['total']);
    }
    $r = q("SELECT * FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 ORDER BY `name` ASC LIMIT %d , %d ", intval($a->pager['start']), intval($a->pager['itemspage']));
    if (!count($r)) {
        notice(t('No contacts.') . EOL);
        return $o;
    }
    $tpl = file_get_contents("view/viewcontact_template.tpl");
    foreach ($r as $rr) {
        if ($rr['self']) {
            continue;
        }
        $o .= replace_macros($tpl, array('$id' => $rr['id'], '$alt_text' => t('Visit ') . $rr['name'] . t('\'s profile'), '$thumb' => $rr['thumb'], '$name' => $rr['name'], '$url' => $rr['url']));
    }
    $o .= '<div id="view-contact-end"></div>';
    $o .= paginate($a);
    return $o;
}
Exemple #2
0
 private function limit()
 {
     if (isLang()) {
         if (segment(1) === "videos" and segment(2) > 0) {
             $start = segment(2) * _maxLimitVideos - _maxLimitVideos;
         } else {
             $start = 0;
         }
     } else {
         if (segment(0) === "videos" and segment(1) > 0) {
             $start = segment(2) * _maxLimitVideos - _maxLimitVideos;
         } else {
             $start = 0;
         }
     }
     $limit = $start . ", " . _maxLimitVideos;
     $count = $this->Videos_Model->count();
     $URL = path("videos/");
     if ($count > _maxLimitVideos) {
         $this->pagination = paginate($count, _maxLimitVideos, $start, $URL);
     } else {
         $this->pagination = NULL;
     }
     return $limit;
 }
Exemple #3
0
function dirfind_content(&$a)
{
    $search = notags(trim($_REQUEST['search']));
    if (strpos($search, '@') === 0) {
        $search = substr($search, 1);
    }
    $o = '';
    $o .= '<h2>' . t('People Search') . ' - ' . $search . '</h2>';
    if ($search) {
        $p = $a->pager['page'] != 1 ? '&p=' . $a->pager['page'] : '';
        if (strlen(get_config('system', 'directory_submit_url'))) {
            $x = fetch_url('http://dir.friendica.com/lsearch?f=' . $p . '&search=' . urlencode($search));
        }
        //TODO fallback local search if global dir not available.
        //		else
        //			$x = post_url($a->get_baseurl() . '/lsearch', $params);
        $j = json_decode($x);
        if ($j->total) {
            $a->set_pager_total($j->total);
            $a->set_pager_itemspage($j->items_page);
        }
        if (count($j->results)) {
            $tpl = get_markup_template('match.tpl');
            foreach ($j->results as $jj) {
                $o .= replace_macros($tpl, array('$url' => zrl($jj->url), '$name' => $jj->name, '$photo' => $jj->photo, '$tags' => $jj->tags));
            }
        } else {
            info(t('No matches') . EOL);
        }
    }
    $o .= '<div class="clear"></div>';
    $o .= paginate($a);
    return $o;
}
Exemple #4
0
 public function display($id = null, $name = null, $page = null, $pid = null)
 {
     global $lang_common, $lang_post, $lang_topic, $lang_bbeditor, $pd;
     if ($this->user->g_read_board == '0') {
         message($lang_common['No view'], '403');
     }
     // Load the viewtopic.php language file
     require FEATHER_ROOT . 'lang/' . $this->user->language . '/topic.php';
     // Load the post.php language file
     require FEATHER_ROOT . 'lang/' . $this->user->language . '/post.php';
     // Antispam feature
     require FEATHER_ROOT . 'lang/' . $this->user->language . '/antispam.php';
     $index_questions = rand(0, count($lang_antispam_questions) - 1);
     // BBcode toolbar feature
     require FEATHER_ROOT . 'lang/' . $this->user['language'] . '/bbeditor.php';
     // Load the viewtopic.php model file
     require_once FEATHER_ROOT . 'model/viewtopic.php';
     // Fetch some informations about the topic TODO
     $cur_topic = $this->model->get_info_topic($id);
     // Sort out who the moderators are and if we are currently a moderator (or an admin)
     $mods_array = $cur_topic['moderators'] != '' ? unserialize($cur_topic['moderators']) : array();
     $is_admmod = $this->user->g_id == FEATHER_ADMIN || $this->user->g_moderator == '1' && array_key_exists($this->user->username, $mods_array) ? true : false;
     if ($is_admmod) {
         $admin_ids = get_admin_ids();
     }
     // Can we or can we not post replies?
     $post_link = $this->model->get_post_link($id, $cur_topic['closed'], $cur_topic['post_replies'], $is_admmod);
     // Add/update this topic in our list of tracked topics
     if (!$this->user->is_guest) {
         $tracked_topics = get_tracked_topics();
         $tracked_topics['topics'][$id] = time();
         set_tracked_topics($tracked_topics);
     }
     // Determine the post offset (based on $_GET['p'])
     $num_pages = ceil(($cur_topic['num_replies'] + 1) / $this->user->disp_posts);
     $p = !isset($page) || $page <= 1 || $page > $num_pages ? 1 : intval($page);
     $start_from = $this->user->disp_posts * ($p - 1);
     $url_topic = url_friendly($cur_topic['subject']);
     $url_forum = url_friendly($cur_topic['forum_name']);
     // Generate paging links
     $paging_links = '<span class="pages-label">' . $lang_common['Pages'] . ' </span>' . paginate($num_pages, $p, 'topic/' . $id . '/' . $url_topic . '/#');
     if ($this->config['o_censoring'] == '1') {
         $cur_topic['subject'] = censor_words($cur_topic['subject']);
     }
     $quickpost = $this->model->is_quickpost($cur_topic['post_replies'], $cur_topic['closed'], $is_admmod);
     $subscraction = $this->model->get_subscraction($cur_topic['is_subscribed'], $id);
     // Add relationship meta tags
     $page_head = $this->model->get_page_head($id, $num_pages, $p, $url_topic);
     $page_title = array(feather_escape($this->config['o_board_title']), feather_escape($cur_topic['forum_name']), feather_escape($cur_topic['subject']));
     define('FEATHER_ALLOW_INDEX', 1);
     define('FEATHER_ACTIVE_PAGE', 'viewtopic');
     $this->header->setTitle($page_title)->setPage($p)->setPagingLinks($paging_links)->setPageHead($page_head)->display();
     $forum_id = $cur_topic['forum_id'];
     require FEATHER_ROOT . 'include/parser.php';
     $this->feather->render('viewtopic.php', array('id' => $id, 'p' => $p, 'post_data' => $this->model->print_posts($id, $start_from, $cur_topic, $is_admmod), 'lang_common' => $lang_common, 'lang_topic' => $lang_topic, 'lang_post' => $lang_post, 'lang_bbeditor' => $lang_bbeditor, 'cur_topic' => $cur_topic, 'subscraction' => $subscraction, 'is_admmod' => $is_admmod, 'feather_config' => $this->config, 'paging_links' => $paging_links, 'post_link' => $post_link, 'start_from' => $start_from, 'lang_antispam' => $lang_antispam, 'pid' => $pid, 'quickpost' => $quickpost, 'index_questions' => $index_questions, 'lang_antispam_questions' => $lang_antispam_questions, 'url_forum' => $url_forum, 'url_topic' => $url_topic, 'feather' => $this->feather));
     // Increment "num_views" for topic
     $this->model->increment_views($id);
     $this->footer->display('viewtopic', $id, $p, $pid, $cur_topic['forum_id'], $num_pages);
 }
Exemple #5
0
/**
 * @brief Controller for /match.
 *
 * It takes keywords from your profile and queries the directory server for
 * matching keywords from other profiles.
 *
 * @param App &$a
 * @return void|string
 */
function match_content(&$a)
{
    $o = '';
    if (!local_user()) {
        return;
    }
    $a->page['aside'] .= findpeople_widget();
    $a->page['aside'] .= follow_widget();
    $_SESSION['return_url'] = $a->get_baseurl() . '/' . $a->cmd;
    $r = q("SELECT `pub_keywords`, `prv_keywords` FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1", intval(local_user()));
    if (!count($r)) {
        return;
    }
    if (!$r[0]['pub_keywords'] && !$r[0]['prv_keywords']) {
        notice(t('No keywords to match. Please add keywords to your default profile.') . EOL);
        return;
    }
    $params = array();
    $tags = trim($r[0]['pub_keywords'] . ' ' . $r[0]['prv_keywords']);
    if ($tags) {
        $params['s'] = $tags;
        if ($a->pager['page'] != 1) {
            $params['p'] = $a->pager['page'];
        }
        if (strlen(get_config('system', 'directory'))) {
            $x = post_url(get_server() . '/msearch', $params);
        } else {
            $x = post_url($a->get_baseurl() . '/msearch', $params);
        }
        $j = json_decode($x);
        if ($j->total) {
            $a->set_pager_total($j->total);
            $a->set_pager_itemspage($j->items_page);
        }
        if (count($j->results)) {
            $id = 0;
            foreach ($j->results as $jj) {
                $match_nurl = normalise_link($jj->url);
                $match = q("SELECT `nurl` FROM `contact` WHERE `uid` = '%d' AND nurl='%s' LIMIT 1", intval(local_user()), dbesc($match_nurl));
                if (!count($match)) {
                    $jj->photo = str_replace("http:///photo/", get_server() . "/photo/", $jj->photo);
                    $connlnk = $a->get_baseurl() . '/follow/?url=' . $jj->url;
                    $photo_menu = array(array(t("View Profile"), zrl($jj->url)));
                    $photo_menu[] = array(t("Connect/Follow"), $connlnk);
                    $contact_details = get_contact_details_by_url($jj->url, local_user());
                    $entry = array('url' => zrl($jj->url), 'itemurl' => $contact_details['addr'] != "" ? $contact_details['addr'] : $jj->url, 'name' => $jj->name, 'details' => $contact_details['location'], 'tags' => $contact_details['keywords'], 'about' => $contact_details['about'], 'account_type' => $contact_details['community'] ? t('Forum') : '', 'thumb' => proxy_url($jj->photo, false, PROXY_SIZE_THUMB), 'inttxt' => ' ' . t('is interested in:'), 'conntxt' => t('Connect'), 'connlnk' => $connlnk, 'img_hover' => $jj->tags, 'photo_menu' => $photo_menu, 'id' => ++$id);
                    $entries[] = $entry;
                }
            }
            $tpl = get_markup_template('viewcontact_template.tpl');
            $o .= replace_macros($tpl, array('$title' => t('Profile Match'), '$contacts' => $entries, '$paginate' => paginate($a)));
        } else {
            info(t('No matches') . EOL);
        }
    }
    return $o;
}
/**
 * Funkcija generise HTML ul listu 
 *
 * @param  array    $array  Niz (data) 
 * @return HTML lista sa vrijednostima arraya 
 */
function generateHTMLList($items)
{
    $paginatedItems = paginate($items, 5);
    printf('<ul>');
    foreach ($paginatedItems as $item) {
        printf('<li> %s </li>', $item);
    }
    printf('</ul>');
    return TRUE;
}
Exemple #7
0
 /**
  * The main page of the blog, show the most recent blog psots
  */
 public function index()
 {
     if ($this->session->userdata('confirmation')) {
         $this->session->unset_userdata('confirmation');
     }
     $posts = $this->post_model->get_posts();
     if ($posts['count'] == 0) {
         // if there are no posts we don't want to load the regular posts view file or we'll get an error
         $data['view_file'] = 'posts/no-posts';
     } else {
         $data['posts'] = $posts['list'];
         // ------------------------------------------------------------------------
         // Pagination
         // ------------------------------------------------------------------------
         // config for the pagination of the content (posts)
         $data['posts_per_page'] = 3;
         $offset = $this->uri->segment(3);
         $data['offset'] = (bool) $offset === FALSE ? '' : $offset;
         // If the offset is invalid or NULL (in which case the user goes back to the first page anyway)
         // the user is sent back to the first page and a feedback message is displayed
         if ((!is_valid_number($data['offset']) || !array_key_exists($data['offset'], $posts['list'])) && !empty($data['offset'])) {
             $this->session->set_flashdata('notice', 'Invalid Request');
             redirect('posts/index/0');
         }
         $this->load->library('pagination');
         $config['base_url'] = site_url('/posts/index');
         $config['total_rows'] = $posts['count'];
         $config['per_page'] = $data['posts_per_page'];
         $config['num_links'] = 10;
         $config['uri_segment'] = 3;
         $config['full_tag_open'] = '<div class="pagination-links">';
         $config['full_tag_close'] = '</div>';
         $this->pagination->initialize($config);
         $data['pagination_links'] = $this->pagination->create_links();
         // Dynamically generate the posts pagination everytime the user clicks on a pagination link
         $data['posts'] = paginate($posts['list'], $posts['count'], $data['posts_per_page'], $data['offset']);
         // ------------------------------------------------------------------------
         // ------------------------------------------------------------------------
         // Breadcrumbs
         // ------------------------------------------------------------------------
         // the page number segment of the breadcrumbs will only appear if there is at least two pages
         if ($posts['count'] > $config['per_page']) {
             $_seg_title = 'page ' . get_page_number($data['offset'], $data['posts_per_page']);
             $_seg_url = 'posts/index/' . $data['offset'];
             $breadcrumbs = $this->azbraz->new_segment($_seg_title, $_seg_url);
         } else {
             $breadcrumbs = '';
         }
         $data['breadcrumbs'] = $this->azbraz->generate($breadcrumbs);
         // ------------------------------------------------------------------------
         $data['view_file'] = 'posts/index';
     }
     $this->load->view($this->main_view, $data);
 }
Exemple #8
0
function match_content(&$a)
{
    $o = '';
    if (!local_user()) {
        return;
    }
    $a->page['aside'] .= follow_widget();
    $a->page['aside'] .= findpeople_widget();
    $_SESSION['return_url'] = $a->get_baseurl() . '/' . $a->cmd;
    $o .= replace_macros(get_markup_template("section_title.tpl"), array('$title' => t('Profile Match')));
    $r = q("SELECT `pub_keywords`, `prv_keywords` FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1", intval(local_user()));
    if (!count($r)) {
        return;
    }
    if (!$r[0]['pub_keywords'] && !$r[0]['prv_keywords']) {
        notice(t('No keywords to match. Please add keywords to your default profile.') . EOL);
        return;
    }
    $params = array();
    $tags = trim($r[0]['pub_keywords'] . ' ' . $r[0]['prv_keywords']);
    if ($tags) {
        $params['s'] = $tags;
        if ($a->pager['page'] != 1) {
            $params['p'] = $a->pager['page'];
        }
        if (strlen(get_config('system', 'directory'))) {
            $x = post_url(get_server() . '/msearch', $params);
        } else {
            $x = post_url($a->get_baseurl() . '/msearch', $params);
        }
        $j = json_decode($x);
        if ($j->total) {
            $a->set_pager_total($j->total);
            $a->set_pager_itemspage($j->items_page);
        }
        if (count($j->results)) {
            $tpl = get_markup_template('match.tpl');
            foreach ($j->results as $jj) {
                $match_nurl = normalise_link($jj->url);
                $match = q("SELECT `nurl` FROM `contact` WHERE `uid` = '%d' AND nurl='%s' LIMIT 1", intval(local_user()), dbesc($match_nurl));
                if (!count($match)) {
                    $jj->photo = str_replace("http:///photo/", get_server() . "/photo/", $jj->photo);
                    $connlnk = $a->get_baseurl() . '/follow/?url=' . $jj->url;
                    $o .= replace_macros($tpl, array('$url' => zrl($jj->url), '$name' => $jj->name, '$photo' => proxy_url($jj->photo), '$inttxt' => ' ' . t('is interested in:'), '$conntxt' => t('Connect'), '$connlnk' => $connlnk, '$tags' => $jj->tags));
                }
            }
        } else {
            info(t('No matches') . EOL);
        }
    }
    $o .= cleardiv();
    $o .= paginate($a);
    return $o;
}
function generateHTMLImage($items)
{
    $paginatedItems = paginate($items, 2);
    foreach ($paginatedItems as $item) {
        printf('<br>');
        printf('<img src=%s width="500px">', $item);
        printf('<br>');
        printf('<a href=%s> %s </a>', $item, $item);
        printf('<br>');
    }
}
function showManyArticles($articles, $params, $count)
{
    if (!empty($articles)) {
        foreach ($articles as $article) {
            $rating = Ratings_getByID($article['id_art']);
            include VIEWS_ROOT . '/little_article.php';
        }
        paginate($params, $count);
    } else {
        echo "<h1>404 PAGE NOT FOUND!</h1>";
    }
}
Exemple #11
0
 public function get_by_name($order = 'ASC', $page = 1, $limit = 10)
 {
     $limits = paginate($page, $limit);
     $query = $this->db->query('SELECT ' . $this->primary_key . ' FROM ' . $this->table . ' ORDER BY name ' . $order . ' LIMIT ' . $limits[0] . ', ' . $limits[1]);
     if ($query !== false) {
         $ids = array();
         while ($id = $query->fetch()) {
             $ids[] = (int) $id[$this->primary_key];
         }
         return $ids;
     }
 }
Exemple #12
0
function allfriends_content(&$a)
{
    $o = '';
    if (!local_user()) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    if ($a->argc > 1) {
        $cid = intval($a->argv[1]);
    }
    if (!$cid) {
        return;
    }
    $uid = $a->user[uid];
    $c = q("SELECT `name`, `url`, `photo` FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($cid), intval(local_user()));
    if (!count($c)) {
        return;
    }
    $a->page['aside'] = "";
    profile_load($a, "", 0, get_contact_details_by_url($c[0]["url"]));
    $total = count_all_friends(local_user(), $cid);
    if (count($total)) {
        $a->set_pager_total($total);
    }
    $r = all_friends(local_user(), $cid, $a->pager['start'], $a->pager['itemspage']);
    if (!count($r)) {
        $o .= t('No friends to display.');
        return $o;
    }
    $id = 0;
    foreach ($r as $rr) {
        //get further details of the contact
        $contact_details = get_contact_details_by_url($rr['url'], $uid);
        $photo_menu = '';
        // $rr[cid] is only available for common contacts. So if the contact is a common one, use contact_photo_menu to generate the photo_menu
        // If the contact is not common to the user, Connect/Follow' will be added to the photo menu
        if ($rr[cid]) {
            $rr[id] = $rr[cid];
            $photo_menu = contact_photo_menu($rr);
        } else {
            $connlnk = $a->get_baseurl() . '/follow/?url=' . $rr['url'];
            $photo_menu = array(array(t("View Profile"), zrl($rr['url'])));
            $photo_menu[] = array(t("Connect/Follow"), $connlnk);
        }
        $entry = array('url' => $rr['url'], 'itemurl' => $contact_details['addr'] != "" ? $contact_details['addr'] : $rr['url'], 'name' => htmlentities($rr['name']), 'thumb' => proxy_url($rr['photo'], false, PROXY_SIZE_THUMB), 'img_hover' => htmlentities($rr['name']), 'details' => $contact_details['location'], 'tags' => $contact_details['keywords'], 'about' => $contact_details['about'], 'account_type' => $contact_details['community'] ? t('Forum') : '', 'network' => network_to_name($contact_details['network'], $contact_details['url']), 'photo_menu' => $photo_menu, 'conntxt' => t('Connect'), 'connlnk' => $connlnk, 'id' => ++$id);
        $entries[] = $entry;
    }
    $tab_str = contacts_tab($a, $cid, 3);
    $tpl = get_markup_template('viewcontact_template.tpl');
    $o .= replace_macros($tpl, array('$tab_str' => $tab_str, '$contacts' => $entries, '$paginate' => paginate($a)));
    return $o;
}
Exemple #13
0
function community_content(&$a, $update = 0)
{
    $o = '';
    if (get_config('system', 'block_public') && !local_user() && !remote_user()) {
        notice(t('Public access denied.') . EOL);
        return;
    }
    if (get_config('system', 'no_community_page')) {
        notice(t('Not available.') . EOL);
        return;
    }
    require_once "include/bbcode.php";
    require_once 'include/security.php';
    require_once 'include/conversation.php';
    $o .= '<h3>' . t('Community') . '</h3>';
    if (!$update) {
        nav_set_selected('community');
    }
    if (x($a->data, 'search')) {
        $search = notags(trim($a->data['search']));
    } else {
        $search = x($_GET, 'search') ? notags(trim(rawurldecode($_GET['search']))) : '';
    }
    // Here is the way permissions work in this module...
    // Only public posts can be shown
    // OR your own posts if you are a logged in member
    if (!get_config('alt_pager', 'global') && !get_pconfig(local_user(), 'system', 'alt_pager')) {
        $r = q("SELECT COUNT(distinct(`item`.`uri`)) AS `total`\n\t\t\tFROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` LEFT JOIN `user` ON `user`.`uid` = `item`.`uid`\n\t\t\tWHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0\n\t\t\tAND `item`.`allow_cid` = ''  AND `item`.`allow_gid` = '' \n\t\t\tAND `item`.`deny_cid`  = '' AND `item`.`deny_gid`  = ''\n\t\t\tAND `item`.`private` = 0 AND `item`.`wall` = 1 AND `user`.`hidewall` = 0 \n\t\t\tAND `contact`.`blocked` = 0 AND `contact`.`pending` = 0");
        if (count($r)) {
            $a->set_pager_total($r[0]['total']);
        }
        if (!$r[0]['total']) {
            info(t('No results.') . EOL);
            return $o;
        }
    }
    //$r = q("SELECT distinct(`item`.`uri`)
    $r = q("SELECT `item`.`uri`, `item`.*, `item`.`id` AS `item_id`, \n\t\t`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`rel`,\n\t\t`contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`, \n\t\t`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`,\n\t\t`user`.`nickname`, `user`.`hidewall`\n\t\tFROM `item` FORCE INDEX (`received`) LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`\n\t\tLEFT JOIN `user` ON `user`.`uid` = `item`.`uid`\n\t\tWHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0\n\t\tAND `item`.`allow_cid` = ''  AND `item`.`allow_gid` = ''\n\t\tAND `item`.`deny_cid`  = '' AND `item`.`deny_gid`  = '' \n\t\tAND `item`.`private` = 0 AND `item`.`wall` = 1 AND `item`.`id` = `item`.`parent`\n\t\tAND `user`.`hidewall` = 0\n\t\tAND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `contact`.`self`\n\t\tORDER BY `received` DESC LIMIT %d, %d ", intval($a->pager['start']), intval($a->pager['itemspage']));
    //		group by `item`.`uri`
    if (!count($r)) {
        info(t('No results.') . EOL);
        return $o;
    }
    // we behave the same in message lists as the search module
    $o .= conversation($a, $r, 'community', $update);
    if (get_config('alt_pager', 'global') || get_pconfig(local_user(), 'system', 'alt_pager')) {
        $o .= alt_pager($a, count($r));
    } else {
        $o .= paginate($a);
    }
    return $o;
}
Exemple #14
0
function notes_content(&$a, $update = false)
{
    if (!local_user()) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    require_once "include/bbcode.php";
    require_once 'include/security.php';
    require_once 'include/conversation.php';
    require_once 'include/acl_selectors.php';
    $groups = array();
    $o = '';
    $remote_contact = false;
    $contact_id = $_SESSION['cid'];
    $contact = $a->contact;
    $is_owner = true;
    $o = "";
    $o .= profile_tabs($a, True);
    if (!$update) {
        $o .= '<h3>' . t('Personal Notes') . '</h3>';
        $commpage = false;
        $commvisitor = false;
        $celeb = false;
        $x = array('is_owner' => $is_owner, 'allow_location' => $a->user['allow_location'] ? true : false, 'default_location' => $a->user['default-location'], 'nickname' => $a->user['nickname'], 'lockstate' => 'lock', 'acl' => '', 'bang' => '', 'visitor' => 'block', 'profile_uid' => local_user(), 'button' => t('Save'), 'acl_data' => '');
        $o .= status_editor($a, $x, $a->contact['id']);
    }
    // Construct permissions
    // default permissions - anonymous user
    $sql_extra = " AND `allow_cid` = '<" . $a->contact['id'] . ">' ";
    $r = q("SELECT COUNT(*) AS `total`\n\t\tFROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`\n\t\tWHERE `item`.`uid` = %d AND `item`.`visible` = 1 and `item`.`moderated` = 0 \n\t\tAND `item`.`deleted` = 0 AND `item`.`type` = 'note'\n\t\tAND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `contact`.`self` = 1\n\t\tAND `item`.`id` = `item`.`parent` AND `item`.`wall` = 0\n\t\t{$sql_extra} ", intval(local_user()));
    if (count($r)) {
        $a->set_pager_total($r[0]['total']);
        $a->set_pager_itemspage(40);
    }
    $r = q("SELECT `item`.`id` AS `item_id`, `contact`.`uid` AS `contact-uid`\n\t\tFROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`\n\t\tWHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 \n\t\tand `item`.`moderated` = 0 AND `item`.`type` = 'note'\n\t\tAND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `contact`.`self` = 1\n\t\tAND `item`.`id` = `item`.`parent` AND `item`.`wall` = 0\n\t\t{$sql_extra}\n\t\tORDER BY `item`.`created` DESC LIMIT %d ,%d ", intval(local_user()), intval($a->pager['start']), intval($a->pager['itemspage']));
    $parents_arr = array();
    $parents_str = '';
    if (count($r)) {
        foreach ($r as $rr) {
            $parents_arr[] = $rr['item_id'];
        }
        $parents_str = implode(', ', $parents_arr);
        $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, \n\t\t\t`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`network`, `contact`.`rel`, \n\t\t\t`contact`.`thumb`, `contact`.`self`, `contact`.`writable`, \n\t\t\t`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`\n\t\t\tFROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`\n\t\t\tWHERE `item`.`uid` = %d AND `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0\n\t\t\tAND `contact`.`blocked` = 0 AND `contact`.`pending` = 0\n\t\t\tAND `item`.`parent` IN ( %s )\n\t\t\t{$sql_extra}\n\t\t\tORDER BY `parent` DESC, `gravity` ASC, `item`.`id` ASC ", intval(local_user()), dbesc($parents_str));
        if (count($r)) {
            $items = conv_sort($r, "`commented`");
            $o .= conversation($a, $items, 'notes', $update);
        }
    }
    $o .= paginate($a);
    return $o;
}
Exemple #15
0
function match_content(&$a)
{
    $o = '';
    if (!local_user()) {
        return;
    }
    $_SESSION['return_url'] = $a->get_baseurl() . '/' . $a->cmd;
    $o .= '<h2>' . t('Profile Match') . '</h2>';
    $r = q("SELECT `pub_keywords`, `prv_keywords` FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1", intval(local_user()));
    if (!count($r)) {
        return;
    }
    if (!$r[0]['pub_keywords'] && !$r[0]['prv_keywords']) {
        notice(t('No keywords to match. Please add keywords to your default profile.') . EOL);
        return;
    }
    $params = array();
    $tags = trim($r[0]['pub_keywords'] . ' ' . $r[0]['prv_keywords']);
    if ($tags) {
        $params['s'] = $tags;
        if ($a->pager['page'] != 1) {
            $params['p'] = $a->pager['page'];
        }
        if (strlen(get_config('system', 'directory_submit_url'))) {
            $x = post_url('http://dir.friendica.com/msearch', $params);
        } else {
            $x = post_url($a->get_baseurl() . '/msearch', $params);
        }
        $j = json_decode($x);
        if ($j->total) {
            $a->set_pager_total($j->total);
            $a->set_pager_itemspage($j->items_page);
        }
        if (count($j->results)) {
            $tpl = get_markup_template('match.tpl');
            foreach ($j->results as $jj) {
                $connlnk = $a->get_baseurl() . '/follow/?url=' . $jj->url;
                $o .= replace_macros($tpl, array('$url' => zrl($jj->url), '$name' => $jj->name, '$photo' => $jj->photo, '$inttxt' => ' ' . t('is interested in:'), '$conntxt' => t('Connect'), '$connlnk' => $connlnk, '$tags' => $jj->tags));
            }
        } else {
            info(t('No matches') . EOL);
        }
    }
    $o .= cleardiv();
    $o .= paginate($a);
    return $o;
}
function display_adminlogs()
{
    global $currentmessage, $admin;
    if ($_SESSION["status"] == "Admin") {
        $total = mysql_query("SELECT count(*) as total FROM logs ORDER BY time DESC");
        $total = mysql_fetch_array($total);
        $total = $total["total"];
        if (isset($admin["logpage"])) {
            $limit = $admin["logpage"];
        } else {
            $limit = 25;
        }
        if (isset($_GET["page"]) && is_numeric($_GET["page"])) {
            $page = max(0, $_GET["page"]);
        } else {
            $page = 0;
        }
        $x = paginate("display=adminlogs", $total, $limit);
        $page = $x[0];
        $pagenav = $x[1];
        echo "<center><h2>Administrator Options : Access Logs</h2><style>table.adminlogs td { font-size:10px; padding:2px; }</style>";
        echo "{$pagenav}<br><br><table class='adminlogs'><tr><th>Date & Time</th><th>IP Address</th><th>Team ID/Name</th><th>Request</th></tr>";
        $teams = mysql_query("SELECT tid,teamname FROM teams");
        while ($team = mysql_fetch_array($teams)) {
            $teamnames[$team["tid"]] = $team["teamname"];
        }
        $logs = mysql_query("SELECT * FROM logs ORDER BY time DESC LIMIT " . ($page - 1) * $limit . "," . $limit);
        if (is_resource($logs)) {
            while ($log = mysql_fetch_array($logs)) {
                if (isset($teamnames[$log["tid"]])) {
                    $teamname = "{$log['tid']} : " . $teamnames[$log["tid"]];
                } else {
                    $teamname = $log["tid"] . " : Anonymous";
                }
                echo "<tr><td>" . date("d M Y, H:i:s", $log["time"]) . "</td><td>{$log['ip']}</td><td>" . $teamname . "</td><td>" . str_replace(",", ", ", $log["request"]) . "</td></tr>";
            }
        }
        echo "</table><br>{$pagenav}</center>";
        //else echo "</table><br><a href='?display=adminlogs&all=1'>View Complete Access Log</a></center>";
    } else {
        $_SESSION["message"] = $currentmessage;
        $_SESSION["message"][] = "Access Denied : You need to be an Administrator to access that page.";
        echo "<script>window.location='?display=faq';</script>";
        return;
    }
}
Exemple #17
0
 public function display($id, $name = null, $page = null)
 {
     global $lang_common, $lang_forum;
     if ($this->user->g_read_board == '0') {
         message($lang_common['No view'], '403');
     }
     if ($id < 1) {
         message($lang_common['Bad request'], '404');
     }
     // Load the viewforum.php language file
     require FEATHER_ROOT . 'lang/' . $this->user->language . '/forum.php';
     // Fetch some informations about the forum
     $cur_forum = $this->model->get_info_forum($id);
     // Is this a redirect forum? In that case, redirect!
     if ($cur_forum['redirect_url'] != '') {
         header('Location: ' . $cur_forum['redirect_url']);
         exit;
     }
     // Sort out who the moderators are and if we are currently a moderator (or an admin)
     $mods_array = $cur_forum['moderators'] != '' ? unserialize($cur_forum['moderators']) : array();
     $is_admmod = $this->user->g_id == FEATHER_ADMIN || $this->user->g_moderator == '1' && array_key_exists($this->user->username, $mods_array) ? true : false;
     $sort_by = $this->model->sort_forum_by($cur_forum['sort_by']);
     // Can we or can we not post new topics?
     if ($cur_forum['post_topics'] == '' && $this->user->g_post_topics == '1' || $cur_forum['post_topics'] == '1' || $is_admmod) {
         $post_link = "\t\t\t" . '<p class="postlink conr"><a href="' . get_link('post/new-topic/' . $id . '/') . '">' . $lang_forum['Post topic'] . '</a></p>' . "\n";
     } else {
         $post_link = '';
     }
     // Determine the topic offset (based on $page)
     $num_pages = ceil($cur_forum['num_topics'] / $this->user->disp_topics);
     $p = !isset($page) || $page <= 1 || $page > $num_pages ? 1 : intval($page);
     $start_from = $this->user->disp_topics * ($p - 1);
     $url_forum = url_friendly($cur_forum['forum_name']);
     // Generate paging links
     $paging_links = '<span class="pages-label">' . $lang_common['Pages'] . ' </span>' . paginate($num_pages, $p, 'forum/' . $id . '/' . $url_forum . '/#');
     $forum_actions = $this->model->get_forum_actions($id, $this->config['o_forum_subscriptions'], $cur_forum['is_subscribed']);
     $page_title = array(feather_escape($this->config['o_board_title']), feather_escape($cur_forum['forum_name']));
     define('FEATHER_ALLOW_INDEX', 1);
     define('FEATHER_ACTIVE_PAGE', 'viewforum');
     $page_head = $this->model->get_page_head($id, $num_pages, $p, $url_forum);
     $this->header->setTitle($page_title)->setPage($p)->setPagingLinks($paging_links)->setPageHead($page_head)->display();
     $this->feather->render('viewforum.php', array('id' => $id, 'forum_data' => $this->model->print_topics($id, $sort_by, $start_from), 'lang_common' => $lang_common, 'lang_forum' => $lang_forum, 'cur_forum' => $cur_forum, 'paging_links' => $paging_links, 'post_link' => $post_link, 'is_admmod' => $is_admmod, 'start_from' => $start_from, 'url_forum' => $url_forum, 'forum_actions' => $forum_actions));
     $this->footer->display('viewforum', $id, $p, '', $id, $num_pages);
 }
Exemple #18
0
function community_content(&$a, $update = 0)
{
    $o = '';
    if (get_config('system', 'block_public') && !local_user() && !remote_user()) {
        notice(t('Public access denied.') . EOL);
        return;
    }
    if (get_config('system', 'no_community_page')) {
        notice(t('Not available.') . EOL);
        return;
    }
    require_once "include/bbcode.php";
    require_once 'include/security.php';
    require_once 'include/conversation.php';
    $o .= '<h3>' . t('Community') . '</h3>';
    if (!$update) {
        nav_set_selected('community');
        $o .= '<div id="live-community"></div>' . "\r\n";
        $o .= "<script> var profile_uid = -1; var netargs = '/?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
    }
    if (x($a->data, 'search')) {
        $search = notags(trim($a->data['search']));
    } else {
        $search = x($_GET, 'search') ? notags(trim(rawurldecode($_GET['search']))) : '';
    }
    // Here is the way permissions work in this module...
    // Only public wall posts can be shown
    // OR your own posts if you are a logged in member
    $r = q("SELECT COUNT(*) AS `total`\n\t\tFROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` LEFT JOIN `user` ON `user`.`uid` = `item`.`uid`\n\t\tWHERE `item`.`visible` = 1 AND `item`.`deleted` = 0\n\t\tAND `wall` = 1 AND `item`.`allow_cid` = ''  AND `item`.`allow_gid` = '' \n\t\tAND `item`.`deny_cid`  = '' AND `item`.`deny_gid`  = '' AND `user`.`hidewall` = 0 \n\t\tAND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 ");
    if (count($r)) {
        $a->set_pager_total($r[0]['total']);
    }
    if (!$r[0]['total']) {
        info(t('No results.') . EOL);
        return $o;
    }
    $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, \n\t\t`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,\n\t\t`contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`, \n\t\t`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`,\n\t\t`user`.`nickname`, `user`.`hidewall`\n\t\tFROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`\n\t\tLEFT JOIN `user` ON `user`.`uid` = `item`.`uid`\n\t\tWHERE `item`.`visible` = 1 AND `item`.`deleted` = 0\n\t\tAND `wall` = 1 AND `item`.`allow_cid` = ''  AND `item`.`allow_gid` = '' \n\t\tAND `item`.`deny_cid`  = '' AND `item`.`deny_gid`  = '' AND `user`.`hidewall` = 0 \n\t\tAND `contact`.`blocked` = 0 AND `contact`.`pending` = 0\n\t\tORDER BY `received` DESC LIMIT %d, %d ", intval($a->pager['start']), intval($a->pager['itemspage']));
    // we behave the same in message lists as the search module
    $o .= conversation($a, $r, 'community', false);
    $o .= paginate($a);
    $o .= '<div class="cc-license">' . t('Shared content is covered by the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license.') . '</div>';
    return $o;
}
Exemple #19
0
function viewcontacts_content(&$a)
{
    require_once "mod/proxy.php";
    if (get_config('system', 'block_public') && !local_user() && !remote_user()) {
        notice(t('Public access denied.') . EOL);
        return;
    }
    if (!count($a->profile) || $a->profile['hide-friends']) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    $o = "";
    // tabs
    $o .= profile_tabs($a, $is_owner, $a->data['user']['nickname']);
    $r = q("SELECT COUNT(*) AS `total` FROM `contact`\n\t\tWHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0\n\t\t\tAND `network` IN ('%s', '%s', '%s')", intval($a->profile['uid']), dbesc(NETWORK_DFRN), dbesc(NETWORK_DIASPORA), dbesc(NETWORK_OSTATUS));
    if (count($r)) {
        $a->set_pager_total($r[0]['total']);
    }
    $r = q("SELECT * FROM `contact`\n\t\tWHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0\n\t\t\tAND `network` IN ('%s', '%s', '%s')\n\t\tORDER BY `name` ASC LIMIT %d, %d", intval($a->profile['uid']), dbesc(NETWORK_DFRN), dbesc(NETWORK_DIASPORA), dbesc(NETWORK_OSTATUS), intval($a->pager['start']), intval($a->pager['itemspage']));
    if (!count($r)) {
        info(t('No contacts.') . EOL);
        return $o;
    }
    $contacts = array();
    foreach ($r as $rr) {
        if ($rr['self']) {
            continue;
        }
        $url = $rr['url'];
        // route DFRN profiles through the redirect
        $is_owner = local_user() && $a->profile['profile_uid'] == local_user() ? true : false;
        if ($is_owner && $rr['network'] === NETWORK_DFRN && $rr['rel']) {
            $url = 'redir/' . $rr['id'];
        } else {
            $url = zrl($url);
        }
        $contact_details = get_contact_details_by_url($rr['url'], $a->profile['uid']);
        $contacts[] = array('id' => $rr['id'], 'img_hover' => sprintf(t('Visit %s\'s profile [%s]'), $rr['name'], $rr['url']), 'photo_menu' => contact_photo_menu($rr), 'thumb' => proxy_url($rr['thumb'], false, PROXY_SIZE_THUMB), 'name' => htmlentities(substr($rr['name'], 0, 20)), 'username' => htmlentities($rr['name']), 'details' => $contact_details['location'], 'tags' => $contact_details['keywords'], 'about' => $contact_details['about'], 'account_type' => $contact_details['community'] ? t('Forum') : '', 'url' => $url, 'sparkle' => '', 'itemurl' => $contact_details['addr'] != "" ? $contact_details['addr'] : $rr['url'], 'network' => network_to_name($rr['network'], $rr['url']));
    }
    $tpl = get_markup_template("viewcontact_template.tpl");
    $o .= replace_macros($tpl, array('$title' => t('Contacts'), '$contacts' => $contacts, '$paginate' => paginate($a)));
    return $o;
}
Exemple #20
0
function viewconnections_content(&$a)
{
    if (get_config('system', 'block_public') && !local_channel() && !remote_channel()) {
        notice(t('Public access denied.') . EOL);
        return;
    }
    if (!count($a->profile) || $a->profile['hide_friends']) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    if (!perm_is_allowed($a->profile['uid'], get_observer_hash(), 'view_contacts')) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    $is_owner = local_channel() && local_channel() == $a->profile['uid'] ? true : false;
    $abook_flags = ABOOK_FLAG_PENDING | ABOOK_FLAG_SELF;
    $xchan_flags = XCHAN_FLAGS_ORPHAN | XCHAN_FLAGS_DELETED;
    if (!$is_owner) {
        $abook_flags = $abook_flags | ABOOK_FLAG_HIDDEN;
        $xchan_flags = $xchan_flags | XCHAN_FLAGS_HIDDEN;
    }
    $r = q("SELECT count(*) as total FROM abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d and not (abook_flags & %d )>0 and not ( xchan_flags & %d )>0 ", intval($a->profile['uid']), intval($abook_flags), intval($xchan_flags));
    if ($r) {
        $a->set_pager_total($r[0]['total']);
    }
    $r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d and not ( abook_flags & %d )>0 and not ( xchan_flags & %d )>0 order by xchan_name LIMIT %d OFFSET %d ", intval($a->profile['uid']), intval($abook_flags), intval($xchan_flags), intval($a->pager['itemspage']), intval($a->pager['start']));
    if (!$r) {
        info(t('No connections.') . EOL);
        return $o;
    }
    $contacts = array();
    foreach ($r as $rr) {
        $url = chanlink_url($rr['xchan_url']);
        if ($url) {
            $contacts[] = array('id' => $rr['abook_id'], 'archived' => $rr['abook_flags'] & ABOOK_FLAG_ARCHIVED ? true : false, 'img_hover' => sprintf(t('Visit %s\'s profile [%s]'), $rr['xchan_name'], $rr['xchan_url']), 'thumb' => $rr['xchan_photo_m'], 'name' => substr($rr['xchan_name'], 0, 20), 'username' => $rr['xchan_addr'], 'link' => $url, 'sparkle' => '', 'itemurl' => $rr['url'], 'network' => '');
        }
    }
    $tpl = get_markup_template("viewcontact_template.tpl");
    $o .= replace_macros($tpl, array('$title' => t('View Connections'), '$contacts' => $contacts, '$paginate' => paginate($a)));
    return $o;
}
Exemple #21
0
function nogroup_content(&$a)
{
    if (!local_user()) {
        notice(t('Permission denied.') . EOL);
        return '';
    }
    require_once 'include/Contact.php';
    $r = contacts_not_grouped(local_user());
    if (count($r)) {
        $a->set_pager_total($r[0]['total']);
    }
    $r = contacts_not_grouped(local_user(), $a->pager['start'], $a->pager['itemspage']);
    if (count($r)) {
        foreach ($r as $rr) {
            $contacts[] = array('img_hover' => sprintf(t('Visit %s\'s profile [%s]'), $rr['name'], $rr['url']), 'edit_hover' => t('Edit contact'), 'photo_menu' => contact_photo_menu($rr), 'id' => $rr['id'], 'alt_text' => $alt_text, 'dir_icon' => $dir_icon, 'thumb' => $rr['thumb'], 'name' => $rr['name'], 'username' => $rr['name'], 'sparkle' => $sparkle, 'itemurl' => $rr['url'], 'url' => $url, 'network' => network_to_name($rr['network']));
        }
    }
    $tpl = get_markup_template("nogroup-template.tpl");
    $o .= replace_macros($tpl, array('$header' => t('Contacts who are not members of a group'), '$contacts' => $contacts, '$paginate' => paginate($a)));
    return $o;
}
Exemple #22
0
function search_content(&$a)
{
    if (get_config('system', 'block_public') && !local_user() && !remote_user()) {
        notice(t('Public access denied.') . EOL);
        return;
    }
    nav_set_selected('search');
    require_once "include/bbcode.php";
    require_once 'include/security.php';
    require_once 'include/conversation.php';
    $o = '<div id="live-search"></div>' . "\r\n";
    $o .= '<h3>' . t('Search This Site') . '</h3>';
    if (x($a->data, 'search')) {
        $search = notags(trim($a->data['search']));
    } else {
        $search = x($_GET, 'search') ? notags(trim(rawurldecode($_GET['search']))) : '';
    }
    $o .= search($search, 'search-box', '/search', local_user() ? true : false);
    if (!$search) {
        return $o;
    }
    // Here is the way permissions work in the search module...
    // Only public wall posts can be shown
    // OR your own posts if you are a logged in member
    $s_regx = sprintf("AND ( `item`.`body` REGEXP '%s' OR `item`.`tag` REGEXP '%s' )", dbesc(preg_quote($search)), dbesc('\\]' . preg_quote($search) . '\\['));
    $search_alg = $s_regx;
    $r = q("SELECT COUNT(*) AS `total`\n\t\tFROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` LEFT JOIN `user` ON `user`.`uid` = `item`.`uid`\n\t\tWHERE `item`.`visible` = 1 AND `item`.`deleted` = 0\n\t\tAND (( `wall` = 1 AND `item`.`allow_cid` = ''  AND `item`.`allow_gid` = '' AND `item`.`deny_cid`  = '' AND `item`.`deny_gid`  = '' AND `user`.`hidewall` = 0) \n\t\t\tOR `item`.`uid` = %d )\n\t\tAND `contact`.`blocked` = 0 AND `contact`.`pending` = 0\n\t\t{$search_alg} ", intval(local_user()));
    if (count($r)) {
        $a->set_pager_total($r[0]['total']);
    }
    if (!$r[0]['total']) {
        info(t('No results.') . EOL);
        return $o;
    }
    $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, \n\t\t`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,\n\t\t`contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`, \n\t\t`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`,\n\t\t`user`.`nickname`\n\t\tFROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`\n\t\tLEFT JOIN `user` ON `user`.`uid` = `item`.`uid`\n\t\tWHERE `item`.`visible` = 1 AND `item`.`deleted` = 0\n\t\tAND (( `wall` = 1 AND `item`.`allow_cid` = ''  AND `item`.`allow_gid` = '' AND `item`.`deny_cid`  = '' AND `item`.`deny_gid`  = '' AND `user`.`hidewall` = 0 ) \n\t\t\tOR `item`.`uid` = %d )\n\t\tAND `contact`.`blocked` = 0 AND `contact`.`pending` = 0\n\t\t{$search_alg}\n\t\tORDER BY `received` DESC LIMIT %d , %d ", intval(local_user()), intval($a->pager['start']), intval($a->pager['itemspage']));
    $o .= '<h2>Search results for: ' . $search . '</h2>';
    $o .= conversation($a, $r, 'search', false);
    $o .= paginate($a);
    return $o;
}
Exemple #23
0
function viewcontacts_content(&$a)
{
    require_once "mod/proxy.php";
    if (get_config('system', 'block_public') && !local_user() && !remote_user()) {
        notice(t('Public access denied.') . EOL);
        return;
    }
    if (!count($a->profile) || $a->profile['hide-friends']) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    $r = q("SELECT COUNT(*) as `total` FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0 ", intval($a->profile['uid']));
    if (count($r)) {
        $a->set_pager_total($r[0]['total']);
    }
    $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0 ORDER BY `name` ASC LIMIT %d , %d ", intval($a->profile['uid']), intval($a->pager['start']), intval($a->pager['itemspage']));
    if (!count($r)) {
        info(t('No contacts.') . EOL);
        return $o;
    }
    $contacts = array();
    foreach ($r as $rr) {
        if ($rr['self']) {
            continue;
        }
        $url = $rr['url'];
        // route DFRN profiles through the redirect
        $is_owner = local_user() && $a->profile['profile_uid'] == local_user() ? true : false;
        if ($is_owner && $rr['network'] === NETWORK_DFRN && $rr['rel']) {
            $url = 'redir/' . $rr['id'];
        } else {
            $url = zrl($url);
        }
        $contacts[] = array('id' => $rr['id'], 'img_hover' => sprintf(t('Visit %s\'s profile [%s]'), $rr['name'], $rr['url']), 'thumb' => proxy_url($rr['thumb']), 'name' => substr($rr['name'], 0, 20), 'username' => $rr['name'], 'url' => $url, 'sparkle' => '', 'itemurl' => $rr['url'], 'network' => network_to_name($rr['network'], $rr['url']));
    }
    $tpl = get_markup_template("viewcontact_template.tpl");
    $o .= replace_macros($tpl, array('$title' => t('View Contacts'), '$contacts' => $contacts, '$paginate' => paginate($a)));
    return $o;
}
Exemple #24
0
function viewcontacts_content(&$a)
{
    if (get_config('system', 'block_public') && !local_user() && !remote_user()) {
        notice(t('Public access denied.') . EOL);
        return;
    }
    if (!count($a->profile) || $a->profile['hide-friends']) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    $o .= '<h3>' . t('View Contacts') . '</h3>';
    $r = q("SELECT COUNT(*) as `total` FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 ", intval($a->profile['uid']));
    if (count($r)) {
        $a->set_pager_total($r[0]['total']);
    }
    $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 ORDER BY `name` ASC LIMIT %d , %d ", intval($a->profile['uid']), intval($a->pager['start']), intval($a->pager['itemspage']));
    if (!count($r)) {
        info(t('No contacts.') . EOL);
        return $o;
    }
    $tpl = get_markup_template("viewcontact_template.tpl");
    foreach ($r as $rr) {
        if ($rr['self']) {
            continue;
        }
        $url = $rr['url'];
        // route DFRN profiles through the redirect
        $is_owner = local_user() && $a->profile['profile_uid'] == local_user() ? true : false;
        if ($is_owner && $rr['network'] === NETWORK_DFRN && $rr['rel']) {
            $url = 'redir/' . $rr['id'];
        }
        $o .= replace_macros($tpl, array('$id' => $rr['id'], '$alt_text' => sprintf(t('Visit %s\'s profile [%s]'), $rr['name'], $rr['url']), '$thumb' => $rr['thumb'], '$name' => substr($rr['name'], 0, 20), '$username' => $rr['name'], '$url' => $url));
    }
    $o .= '<div id="view-contact-end"></div>';
    $o .= paginate($a);
    return $o;
}
Exemple #25
0
function community_content(&$a, $update = 0)
{
    $o = '';
    if (get_config('system', 'block_public') && !local_user() && !remote_user()) {
        notice(t('Public access denied.') . EOL);
        return;
    }
    if (get_config('system', 'community_page_style') == CP_NO_COMMUNITY_PAGE) {
        notice(t('Not available.') . EOL);
        return;
    }
    require_once "include/bbcode.php";
    require_once 'include/security.php';
    require_once 'include/conversation.php';
    $o .= '<h3>' . t('Community') . '</h3>';
    if (!$update) {
        nav_set_selected('community');
    }
    if (x($a->data, 'search')) {
        $search = notags(trim($a->data['search']));
    } else {
        $search = x($_GET, 'search') ? notags(trim(rawurldecode($_GET['search']))) : '';
    }
    // Here is the way permissions work in this module...
    // Only public posts can be shown
    // OR your own posts if you are a logged in member
    if (get_config('system', 'old_pager')) {
        $r = q("SELECT COUNT(distinct(`item`.`uri`)) AS `total`\n\t\t\tFROM `item` INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`\n\t\t\tAND `contact`.`blocked` = 0 AND `contact`.`pending` = 0\n\t\t\tINNER JOIN `user` ON `user`.`uid` = `item`.`uid` AND `user`.`hidewall` = 0\n\t\t\tWHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0\n\t\t\tAND `item`.`allow_cid` = ''  AND `item`.`allow_gid` = ''\n\t\t\tAND `item`.`deny_cid`  = '' AND `item`.`deny_gid`  = ''\n\t\t\tAND `item`.`private` = 0 AND `item`.`wall` = 1");
        if (count($r)) {
            $a->set_pager_total($r[0]['total']);
        }
        if (!$r[0]['total']) {
            info(t('No results.') . EOL);
            return $o;
        }
    }
    $r = community_getitems($a->pager['start'], $a->pager['itemspage']);
    if (!count($r)) {
        info(t('No results.') . EOL);
        return $o;
    }
    $maxpostperauthor = get_config('system', 'max_author_posts_community_page');
    if ($maxpostperauthor != 0) {
        $count = 1;
        $previousauthor = "";
        $numposts = 0;
        $s = array();
        do {
            foreach ($r as $row => $item) {
                if ($previousauthor == $item["author-link"]) {
                    ++$numposts;
                } else {
                    $numposts = 0;
                }
                $previousauthor = $item["author-link"];
                if ($numposts < $maxpostperauthor and sizeof($s) < $a->pager['itemspage']) {
                    $s[] = $item;
                }
            }
            if (sizeof($s) < $a->pager['itemspage']) {
                $r = community_getitems($a->pager['start'] + $count * $a->pager['itemspage'], $a->pager['itemspage']);
            }
        } while (sizeof($s) < $a->pager['itemspage'] and ++$count < 50 and sizeof($r) > 0);
    } else {
        $s = $r;
    }
    // we behave the same in message lists as the search module
    $o .= conversation($a, $s, 'community', $update);
    if (!get_config('system', 'old_pager')) {
        $o .= alt_pager($a, count($r));
    } else {
        $o .= paginate($a);
    }
    return $o;
}
Exemple #26
0
    echo $record[$i]->id;
    ?>
" class="edit" title="编辑" style="cursor:pointer"><img src="/images/admin/btn_edit.png" border="0"></a>
						<span style="cursor:pointer;color:#FF0000" class="del" title="删除" name="<?php 
    echo $record[$i]->id;
    ?>
"><img src="/images/admin/btn_delete.png" border="0"></span>
					</td>
				</tr>
		<?php 
}
?>
		<tr class="btools">
			<td colspan=10>
				<?php 
paginate("", null, "page", true);
?>
				<input type="hidden" id="db_table" value="fb_investor_sign">
			</td>
		</tr>
		</table>	
	</div>
	</body>
</html>
<script>
$(function(){
	$(".sau_search").keypress(function(event){
		if (event.keyCode == 13) {
			sea();
		}
	});
Exemple #27
0
        if (isset($_GET['sort'])) {
            $sort_list = $_GET['sort'];
            $var_query .= '&sort=' . $sort_list;
            if (isset($_GET['desc'])) {
                $sort_list .= ' DESC';
                $var_query .= '&desc=1';
            }
        } else {
            $sort_list = 'last_post DESC';
        }
        // Determine the topic offset (based on $_GET['p'])
        $num_pages = ceil($num_topics / $pun_user['disp_topics']);
        $p = !isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages ? 1 : $_GET['p'];
        $start_from = $pun_user['disp_topics'] * ($p - 1);
        // Generate paging links
        $paging_links = $lang_common['Pages'] . ': ' . paginate($num_pages, $p, 'movepost.php?id=' . $post_id . $var_query);
        //The topic query
        $result_topic = $db->query('SELECT id, subject, poster, last_post, num_replies FROM ' . $db->prefix . 'topics WHERE moved_to IS NULL AND forum_id=' . $fid . ' AND id <> ' . $old_topic_id . ' ORDER BY ' . $sort_list . ' LIMIT ' . $start_from . ',' . $pun_user['disp_topics']) or error('Unable to find topics in forum', __FILE__, __LINE__, $db->error());
        require PUN_ROOT . 'header.php';
        ?>
<div class="blockform">
	<h2><span><?php 
        echo $lang_movepost['Mod move post'];
        ?>
</span></h2>
	<div class="box">
		<form id="qjump" method="get" action="movepost.php?id=<?php 
        echo $post_id;
        ?>
">
			<p><strong><?php 
Exemple #28
0
    $ps = $db->run('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name FROM ' . $db->prefix . 'categories AS c INNER JOIN ' . $db->prefix . 'forums AS f ON c.id = f.cat_id WHERE f.redirect_url IS NULL ORDER BY c.disp_position, c.id, f.disp_position');
    foreach ($ps as $cur_forum) {
        if (!isset($categories[$cur_forum['cid']])) {
            $categories[$cur_forum['cid']] = array('name' => $cur_forum['cat_name'], 'id' => $cur_forum['cid']);
        }
        $forums[] = array('id' => $cur_forum['fid'], 'name' => $cur_forum['forum_name'], 'category_id' => $cur_forum['cid']);
    }
    $tpl = load_template('edit_action.tpl');
    echo $tpl->render(array('lang_admin_moderate' => $lang_admin_moderate, 'lang_admin_common' => $lang_admin_common, 'lang_common' => $lang_common, 'csrf_token' => generate_csrf_token(PANTHER_ADMIN_DIR . '/moderate.php'), 'form_action' => $action == 'add' ? panther_link($panther_url['admin_moderate_add']) : panther_link($panther_url['admin_moderate_edit'], array($id)), 'action' => $cur_action, 'categories' => $categories, 'forums' => $forums));
} else {
    if ($action == 'delete' && $id > '0') {
        $tpl = load_template('delete_action.tpl');
        echo $tpl->render(array('lang_admin_moderate' => $lang_admin_moderate, 'lang_admin_common' => $lang_admin_common, 'lang_common' => $lang_common, 'form_action' => panther_link($panther_url['admin_moderate_delete'], array($id)), 'csrf_token' => generate_csrf_token(PANTHER_ADMIN_DIR . '/moderate.php')));
    } else {
        $ps = $db->select('multi_moderation', 'COUNT(id)');
        $total = $ps->fetchColumn();
        $num_pages = ceil($total / 15);
        if ($page > $num_pages) {
            $page = 1;
        }
        $start_from = 15 * ($page - 1);
        $ps = $db->select('multi_moderation', 'title, id', array(), '', 'id DESC LIMIT ' . $start_from . ', ' . $panther_config['o_disp_topics_default']);
        $actions = array();
        foreach ($ps as $action) {
            $actions[] = array('title' => $action['title'], 'edit_link' => panther_link($panther_url['admin_moderate_edit'], array($action['id'])), 'delete_link' => panther_link($panther_url['admin_moderate_delete'], array($action['id'])));
        }
        $tpl = load_template('admin_moderate.tpl');
        echo $tpl->render(array('lang_admin_common' => $lang_admin_common, 'lang_admin_moderate' => $lang_admin_moderate, 'lang_common' => $lang_common, 'add_link' => panther_link($panther_url['admin_moderate_add']), 'pagination' => paginate($num_pages, $page, $panther_url['admin_moderate'] . '?'), 'actions' => $actions));
    }
}
require PANTHER_ROOT . 'footer.php';
Exemple #29
0
			}
		?>
		<?php
			for($i=0;$i<$count_record;$i++)	{
		?>
				<tr class=tr3>
					<td><input type="checkbox" id="<?php echo $record[$i]->id;?>" value="<?php echo $record[$i]->id;?>" name="subject" style="width:12px;"></td>
					<td><?php echo $record[$i]->name;?></td>
					<td><?php echo $record[$i]->code;?></td>					
					<td><?php echo $record[$i]->g_name;?></td>
				</tr>
		<?php
			}
		?>
		<tr class=tr3>
				<td colspan="4"><?php paginate('','result_box');?></td>
		</tr>
		<tr class=tr3>
				<td colspan="4"><button id="button_ok" style="width:150px">确定</button><button id="clean" style="width:150px">取消所有关联</button>
				</td>
		</tr>		
	</table>
</div>
<script>
		$('#list input:checkbox').click(function(){
			if($(this).attr('checked')){
				add_related_ad($(this).attr('id'));
			}else{
				remove_related_ad($(this).attr('id'));
			}
		});
session_start();
error_reporting(E_ALL & ~E_NOTICE);
include_once "login_check.inc.php";
include_once "queryfunctions.php";
include_once "functions.php";
access("reservation");
//check if user is allowed to access this page
$conn = db_connect(HOST, USER, PASS, DB, PORT);
if (isset($_GET["search"]) && !empty($_GET["search"])) {
    find($_GET["search"]);
}
if (isset($_POST['Navigate'])) {
    //echo $_SESSION["strOffSet"];
    $nRecords = num_rows(mkr_query("select * from guests", $conn), $conn);
    paginate($nRecords);
    free_result($results);
    find($_SESSION["strOffSet"]);
}
$guestid = $_POST['guestid'];
if (isset($_POST['Submit'])) {
    $action = $_POST['Submit'];
    switch ($action) {
        case 'Guest Reservation':
            //if guest has not been selected exit
            // instantiate form validator object
            $fv = new formValidator();
            //from functions.php
            if (empty($_POST["guestid"])) {
                //if no guest has been selected no point in displaying other errors
                $fv->validateEmpty('guestid', 'No guest has been selected for reservation.');