Esempio n. 1
0
File: view.php Progetto: rair/yacs
 if (Surfer::get_id() && !$zoom_type) {
     $link = Users::get_url('section:' . $item['id'], 'track');
     if ($in_watch_list == 'Y') {
         $label = i18n::s('Stop notifications');
     } elseif ($in_watch_list == 'N') {
         $label = i18n::s('Watch this section');
     }
     if ($in_watch_list != 'P') {
         Skin::define_img('TOOLS_WATCH_IMG', 'tools/watch.gif');
         $lines[] = Skin::build_link($link, TOOLS_WATCH_IMG . $label, 'basic', i18n::s('Manage your watch list'));
     }
 }
 // allow to leave the section
 if ($cur_section->is_assigned() && !$cur_section->is_owned(null, false)) {
     Skin::define_img('SECTIONS_ASSIGN_IMG', 'sections/assign.gif');
     $lines[] = Skin::build_link(Users::get_url('section:' . $item['id'], 'leave'), SECTIONS_ASSIGN_IMG . i18n::s('Leave this section'));
 }
 // get news from rss
 if (isset($item['id']) && (!isset($context['skins_general_without_feed']) || $context['skins_general_without_feed'] != 'Y')) {
     $lines[] = Skin::build_link($context['url_to_home'] . $context['url_to_root'] . Sections::get_url($item['id'], 'feed'), i18n::s('Recent pages'), 'xml');
     $lines[] = Skin::build_link($context['url_to_home'] . $context['url_to_root'] . Files::get_url('section:' . $item['id'], 'feed'), i18n::s('Recent files'), 'xml');
     // comments are allowed
     if ($cur_section->allows('creation', 'comment')) {
         $lines[] = Skin::build_link($context['url_to_home'] . $context['url_to_root'] . Comments::get_url('section:' . $item['id'], 'feed'), i18n::s('Recent comments'), 'xml');
     }
 }
 // in a side box
 if (count($lines)) {
     $context['components']['channels'] = Skin::build_box(i18n::s('Monitor'), join(BR, $lines), 'channels', 'feeds');
 }
 // twin pages
Esempio n. 2
0
// the path to this page
$context['path_bar'] = array('users/' => i18n::s('People'));
// the title of the page
if ($item['full_name']) {
    $context['page_title'] = $item['full_name'];
} elseif ($item['nick_name']) {
    $context['page_title'] = $item['nick_name'];
}
// not found
if (!isset($item['id'])) {
    include '../error.php';
    // permission denied
} elseif (!$permitted) {
    // anonymous users are invited to log in or to register
    if (!Surfer::is_logged()) {
        Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'users/login.php?url=' . urlencode(Users::get_url($item['id'], 'fetch_vcard')));
    }
    // permission denied to authenticated user
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation.'));
    // display the user profile
} else {
    // format name components
    $names = $item['full_name'];
    if (preg_match('/^(.+)\\s(.+?)$/', $names, $matches)) {
        $names = $matches[2] . ';' . $matches[1];
    }
    // build the vCard
    $text = 'BEGIN:VCARD' . CRLF . 'VERSION:2.1' . CRLF . 'FN:' . $item['full_name'] . CRLF . 'N:' . $names . CRLF . 'NICKNAME:' . $item['nick_name'] . CRLF;
    // organization, if any
    if (isset($item['vcard_organization']) && $item['vcard_organization']) {
Esempio n. 3
0
 /**
  * build a user profile
  *
  * @param array one user profile
  * @param string a profiling option, including 'prefix', 'suffix', and 'extra'
  * @param string more information
  * @return a string to be returned to the browser
  *
  * @see sections/section.php
  */
 public static function build_profile(&$user, $variant = 'prefix', $more = '')
 {
     global $context;
     // we return some text
     $text = '';
     // label
     $label = isset($user['full_name']) && $user['full_name'] ? $user['full_name'] : $user['nick_name'];
     // link to the user profile
     $url = Users::get_permalink($user);
     // configured styles
     $more_styles = '';
     if (isset($context['classes_for_avatar_images']) && $context['classes_for_avatar_images']) {
         $more_styles = ' ' . encode_field($context['classes_for_avatar_images']);
     }
     // depending of what we want to do
     switch ($variant) {
         // at the beginning of the page
         case 'prefix':
         default:
             // avatar
             $avatar = '';
             if (isset($user['avatar_url']) && $user['avatar_url']) {
                 $thumb = '';
                 if ($position = strrpos($user['avatar_url'], '/')) {
                     $thumb = substr($user['avatar_url'], 0, $position) . '/thumbs' . substr($user['avatar_url'], $position);
                 }
                 if (is_readable($context['path_to_root'] . str_replace($context['url_to_root'], '', $thumb))) {
                     $avatar =& Skin::build_link($url, '<img src="' . $thumb . '" alt="" title="avatar" class="avatar left_image" />', 'basic');
                 } else {
                     $avatar =& Skin::build_link($url, '<img src="' . $user['avatar_url'] . '" alt="" title="avatar" class="avatar left_image' . $more_styles . '" />', 'basic');
                 }
             }
             // several items
             $details = array();
             // date of post
             if ($more) {
                 $details[] = $more;
             }
             // from where
             if (isset($user['from_where']) && $user['from_where']) {
                 $details[] = sprintf(i18n::s('from %s'), Codes::beautify($user['from_where']));
             }
             // display details
             if (count($details)) {
                 $text .= '<span class="details">' . implode(', ', $details) . '</span>' . BR;
             }
             // use the introduction field, if any
             if (isset($user['introduction']) && $user['introduction']) {
                 $text .= Codes::beautify($user['introduction']);
             }
             // suffix after the full name
             if ($text) {
                 $text = ' -- ' . $text;
             }
             $text = '<div class="top">' . $avatar . Skin::build_link($url, $label, 'user') . $text . '</div><br style="clear: left;" />';
             break;
             // at the end of the page
         // at the end of the page
         case 'suffix':
             // avatar
             $avatar = '';
             if (isset($user['avatar_url']) && $user['avatar_url']) {
                 $thumb = '';
                 if ($position = strrpos($user['avatar_url'], '/')) {
                     $thumb = substr($user['avatar_url'], 0, $position) . '/thumbs' . substr($user['avatar_url'], $position);
                 }
                 if (is_readable($context['path_to_root'] . str_replace($context['url_to_root'], '', $thumb))) {
                     $avatar =& Skin::build_link($url, '<img src="' . $thumb . '" alt="" title="avatar" class="avatar left_image" />', 'basic');
                 } else {
                     $avatar =& Skin::build_link($url, '<img src="' . $user['avatar_url'] . '" alt="" title="avatar" class="avatar left_image' . $more_styles . '" />', 'basic');
                 }
             }
             // date of post
             if ($more) {
                 $text .= $more . ' ';
             }
             // from where
             if (isset($user['from_where']) && $user['from_where']) {
                 $text .= sprintf(i18n::s('from %s'), Codes::beautify($user['from_where']));
             }
             // display details
             if ($text) {
                 $text = '<span class="details">' . $text . '</span>' . BR;
             }
             // use the introduction field, if any
             if (isset($user['introduction']) && $user['introduction']) {
                 $text .= Codes::beautify($user['introduction']);
             }
             // suffix after the full name
             if ($text) {
                 $text = ' -- ' . $text;
             }
             $text = '<address>' . $avatar . Skin::build_link($url, $label, 'user') . $text . '</address><br style="clear: left;" />';
             break;
             // in a sidebox
         // in a sidebox
         case 'extra':
             // details attributes
             $details = array();
             // avatar
             if (isset($user['avatar_url']) && $user['avatar_url']) {
                 $details[] =& Skin::build_link($url, '<img src="' . $user['avatar_url'] . '" alt="" title="avatar" class="avatar' . $more_styles . '" />', 'basic');
             } else {
                 if (Surfer::is_empowered()) {
                     Skin::define_img('IMAGES_ADD_IMG', 'images/add.gif');
                     $details[] =& Skin::build_link(Users::get_url($user['id'], 'select_avatar'), IMAGES_ADD_IMG . i18n::s('Add picture'), 'basic');
                 }
             }
             // date of post
             if ($more) {
                 $details[] = $more;
             }
             // from where
             if (isset($user['from_where']) && $user['from_where']) {
                 $details[] = sprintf(i18n::s('from %s'), Codes::beautify($user['from_where']));
             }
             // details first
             if (count($details)) {
                 $text .= '<p class="details">' . join(BR, $details) . '</p>';
             }
             // do not use description because of codes such as location, etc
             if (isset($user['introduction']) && $user['introduction']) {
                 $text .= Codes::beautify($user['introduction']);
             }
             // show contact information
             if (Surfer::may_contact()) {
                 $contacts = Users::build_presence($user);
                 if ($contacts) {
                     $text .= BR . $contacts;
                 }
             }
             // everything in an extra box
             $text = Skin::build_box($label, $text, 'profile');
             break;
     }
     // return by reference
     return $text;
 }
Esempio n. 4
0
 /**
  * list selected activities
  *
  * @param resource result of database query
  * @param string 'compact', etc or object, i.e., an instance of Layout_Interface
  * @return NULL on error, else an ordered array with $url => array ($prefix, $label, $suffix, $type, $icon)
  */
 public static function list_selected($result, $variant = 'raw')
 {
     global $context;
     // no result
     if (!$result) {
         $output = NULL;
         return $output;
     }
     // special layouts
     if (is_object($variant)) {
         $output = $variant->layout($result);
         return $output;
     }
     // one of regular layouts
     switch ($variant) {
         case 'comma':
             $text = '';
             while ($item = SQL::fetch($result)) {
                 if ($text) {
                     $text .= ', ';
                 }
                 $text .= Skin::build_link(Users::get_url($item['edit_id'], 'view', $item['edit_name']), $item['edit_name'], 'user');
             }
             return $text;
         case 'raw':
         default:
             $items = array();
             while ($item = SQL::fetch($result)) {
                 $items[] = $item;
             }
             return $items;
     }
 }
Esempio n. 5
0
File: print.php Progetto: rair/yacs
 if (count($details)) {
     $context['text'] .= '<p class="details">' . implode(BR . "\n", $details) . '</p>';
 }
 // the full name
 if ($item['full_name']) {
     $context['text'] .= '<p>' . sprintf(i18n::s('%s: %s'), i18n::s('Full name'), $item['full_name']) . "</p>\n";
 }
 // web address, if any
 if (isset($item['web_address']) && $item['web_address']) {
     $context['text'] .= '<p>' . sprintf(i18n::s('%s: %s'), i18n::s('Web address'), Skin::build_link($item['web_address'], $item['web_address'], 'external')) . "</p>\n";
 }
 // email address - not showed to anonymous surfers for spam protection
 if (isset($item['email']) && $item['email'] && Surfer::may_mail()) {
     $label = i18n::s('E-mail address: %s %s');
     if (isset($context['with_email']) && $context['with_email'] == 'Y') {
         $url = Users::get_url($id, 'mail');
     } else {
         $url = 'mailto:' . $item['email'];
     }
     if (isset($item['with_newsletters']) && $item['with_newsletters'] == 'Y') {
         $suffix = '';
     } else {
         $suffix = i18n::s('(do not wish to receive newsletters)');
     }
     $context['text'] .= '<p>' . sprintf($label, Skin::build_link($url, $item['email'], 'email'), $suffix) . "</p>\n";
 }
 // the introduction text
 $context['text'] .= Skin::build_block($item['introduction'], 'introduction');
 // the beautified description, which is the actual page body
 $context['text'] .= Skin::build_block($item['description'], 'description');
 //
Esempio n. 6
0
File: view.php Progetto: rair/yacs
 $lines = array();
 // watch command is provided to logged surfers
 if (Surfer::get_id()) {
     $link = Users::get_url('article:' . $item['id'], 'track');
     if ($in_watch_list) {
         $label = i18n::s('Stop notifications');
     } else {
         $label = i18n::s('Watch this page');
     }
     Skin::define_img('TOOLS_WATCH_IMG', 'tools/watch.gif');
     $lines[] = Skin::build_link($link, TOOLS_WATCH_IMG . $label, 'basic', i18n::s('Manage your watch list'));
 }
 // allow to leave the page
 if ($cur_article->is_assigned() && !$cur_article->is_owned(null, false)) {
     Skin::define_img('ARTICLES_ASSIGN_IMG', 'articles/assign.gif');
     $lines[] = Skin::build_link(Users::get_url('article:' . $item['id'], 'leave'), ARTICLES_ASSIGN_IMG . i18n::s('Leave this page'));
 }
 // get news from rss
 if (isset($item['id']) && (!isset($context['skins_general_without_feed']) || $context['skins_general_without_feed'] != 'Y')) {
     // list of attached files
     $lines[] = Skin::build_link($context['url_to_home'] . $context['url_to_root'] . Files::get_url('article:' . $item['id'], 'feed'), i18n::s('Recent files'), 'xml');
     // comments are allowed
     if ($cur_article->allows('creation', 'comment')) {
         $lines[] = Skin::build_link($context['url_to_home'] . $context['url_to_root'] . Comments::get_url('article:' . $item['id'], 'feed'), i18n::s('Recent comments'), 'xml');
     }
 }
 // in a side box
 if (count($lines)) {
     $context['components']['channels'] = Skin::build_box(i18n::s('Monitor'), join(BR, $lines), 'channels', 'feeds');
 }
 // twin pages
Esempio n. 7
0
File: new.php Progetto: rair/yacs
    $input .= '/> ' . i18n::s('Community - Access is granted to any identified surfer') . ' ' . BR . '<input type="radio" name="active" value="N"';
    if (isset($item['active']) && $item['active'] == 'N') {
        $input .= ' checked="checked"';
    }
    $input .= '/> ' . i18n::s('Private - Access is restricted to selected persons');
    $fields[] = array($label, $input);
    // actually build the form
    $context['text'] .= Skin::build_form($fields);
    $fields = array();
    //
    // bottom commands
    //
    $menu = array();
    // the submit button
    $menu[] = Skin::build_submit_button(i18n::s('Submit'), i18n::s('Press [s] to submit data'), 's');
    // cancel button
    if (Surfer::get_id()) {
        $menu[] = Skin::build_link(Users::get_url(Surfer::get_id()), i18n::s('Back to my profile'), 'span');
    }
    // insert the menu in the page
    $context['text'] .= Skin::finalize_list($menu, 'assistant_bar');
    // end of the form
    $context['text'] .= '</div></form>';
    // append the script used for data checking on the browser
    Page::insert_script('func' . 'tion validateDocumentPost(container) {' . "\n" . '	if(!container.title.value) {' . "\n" . '		alert("' . i18n::s('Please provide a meaningful title.') . '");' . "\n" . '		Yacs.stopWorking();' . "\n" . '		return false;' . "\n" . '	}' . "\n" . '	return true;' . "\n" . '}' . "\n" . 'func' . 'tion detectChanges() {' . "\n" . '	$("form#main_form input").each(function () {' . "\n" . '		$(this).change(function() { $("#preferred_editor").attr("disabled", true); });' . "\n" . '	});' . "\n" . "\n" . '	$("form#main_form textarea").each(function () {;' . "\n" . '		$(this).change(function() { $("#preferred_editor").attr("disabled", true); });' . "\n" . '	});' . "\n" . "\n" . '	$("form#main_form select").each(function () {;' . "\n" . '		$(this).change(function() { $("#preferred_editor").attr("disabled", true); });' . "\n" . '	});' . "\n" . '}' . "\n" . "\n" . '$(document).ready( detectChanges);' . "\n" . "\n" . '$("#title").focus();' . "\n");
    // general help on this form
    $help = '<p>' . sprintf(i18n::s('%s and %s are available to enhance text rendering.'), Skin::build_link('codes/', 'YACS codes', 'open'), Skin::build_link('smileys/', 'smileys', 'open')) . '</p>';
    $context['components']['boxes'] = Skin::build_box(i18n::s('Help'), $help, 'boxes', 'help');
}
// render the skin
render_skin();
Esempio n. 8
0
 /**
  * list users
  *
  * @param resource the SQL result
  * @return string the rendered text
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // empty list
     if (!SQL::count($result)) {
         $output = array();
         return $output;
     }
     // we return an array of ($url => $attributes)
     $items = array();
     // process all items in the list
     while ($item = SQL::fetch($result)) {
         // initialize variables
         $prefix = $suffix = $icon = '';
         // the url to view this item
         $url = Users::get_permalink($item);
         // flag profiles updated recently
         if ($item['create_date'] >= $context['fresh']) {
             $suffix .= NEW_FLAG;
         } elseif ($item['edit_date'] >= $context['fresh']) {
             $suffix .= UPDATED_FLAG;
         }
         // signal restricted and private profiles
         if ($item['active'] == 'N') {
             $prefix .= PRIVATE_FLAG;
         } elseif ($item['active'] == 'R') {
             $prefix .= RESTRICTED_FLAG;
         }
         // signal locked profiles
         if ($item['capability'] == '?') {
             $prefix .= EXPIRED_FLAG;
         }
         // item title
         if ($item['full_name']) {
             $label = ucfirst(Skin::strip($item['full_name'], 10)) . ' [' . $item['nick_name'] . ']';
         } else {
             $label = ucfirst(Skin::strip($item['nick_name'], 10));
         }
         // the introduction
         if ($item['introduction']) {
             if (is_callable(array('codes', 'beautify'))) {
                 $suffix .= ' -&nbsp;' . Codes::beautify($item['introduction']);
             } else {
                 $suffix .= ' -&nbsp;' . $item['introduction'];
             }
         }
         // details
         $details = array();
         // creation date
         if ($item['create_date']) {
             $details[] = sprintf(i18n::s('registered %s'), Skin::build_date($item['create_date']));
         }
         // last login
         if (isset($item['login_date']) && $item['login_date'] > NULL_DATE) {
             $details[] = sprintf(i18n::s('last login %s'), Skin::build_date($item['login_date']));
         } else {
             $details[] = i18n::s('no login');
         }
         // last post
         if (isset($item['post_date']) && $item['post_date'] > NULL_DATE) {
             $details[] = sprintf(i18n::s('last post %s'), Skin::build_date($item['post_date']));
         }
         // posts
         if (intval($item['posts']) > 1) {
             $details[] = sprintf(i18n::s('%d posts'), intval($item['posts']));
         }
         if (count($details)) {
             $suffix .= ' <span class="details">(' . implode(', ', $details) . ')</span>';
         }
         // the command to ask for a new password
         $suffix .= '<p style="padding: 0.5em 0 0.5em 0">' . Skin::build_link(Users::get_url($item['id'], 'password', $item['nick_name']), i18n::s('Authenticate with this profile'), 'button') . '</p>';
         // use the avatar, if any
         if (isset($item['avatar_url'])) {
             $icon = $item['avatar_url'];
         }
         // list all components for this item
         $items[$url] = array($prefix, $label, $suffix, 'user', $icon);
     }
     // end of processing
     SQL::free($result);
     return $items;
 }
Esempio n. 9
0
File: view.php Progetto: rair/yacs
    if (count($lines)) {
        $context['components']['channels'] = Skin::build_box(i18n::s('Monitor'), join(BR, $lines), 'channels', 'feed');
    }
    // categories attached to this item, if not at another follow-up page
    if (!$zoom_type || $zoom_type == 'categories') {
        // build a complete box
        $box = array();
        $box['bar'] = array();
        $box['text'] = '';
        // list categories by title
        $items =& Members::list_categories_by_title_for_member('user:'******'id'], 0, COMPACT_LIST_SIZE, 'sidebar');
        // the command to change categories assignments
        if (Categories::allow_assign($item)) {
            $items = array_merge($items, array(Categories::get_url('user:'******'id'], 'select') => i18n::s('Assign categories')));
        }
        // actually render the html for the section
        if (is_array($box['bar'])) {
            $box['text'] .= Skin::build_list($box['bar'], 'menu_bar');
        }
        if (is_array($items)) {
            $box['text'] .= Skin::build_list($items, 'compact');
        }
        if ($box['text']) {
            $context['components']['categories'] = Skin::build_box(i18n::s('See also'), $box['text'], 'categories', 'categories');
        }
    }
    // referrals, if any
    $context['components']['referrals'] =& Skin::build_referrals(Users::get_url($item['id']));
}
// render the skin -- do not provide Last-Modified header
render_skin(FALSE);
Esempio n. 10
0
    // one feed per section
    if ($items = Sections::list_by_title_for_anchor(NULL, 0, COMPACT_LIST_SIZE, 'raw')) {
        foreach ($items as $id => $attributes) {
            $text .= '	<outline type="rss" text="' . encode_field(strip_tags($attributes['title']) . $suffix) . '" xmlUrl="' . $context['url_to_home'] . $context['url_to_root'] . Sections::get_url($id, 'feed') . '"' . " />\n";
        }
    }
    // one feed per category
    if ($items = Categories::list_by_date(0, COMPACT_LIST_SIZE, 'raw')) {
        foreach ($items as $id => $attributes) {
            $text .= '	<outline type="rss" text="' . encode_field(strip_tags($attributes['title']) . $suffix) . '" xmlUrl="' . $context['url_to_home'] . $context['url_to_root'] . Categories::get_url($id, 'feed') . '"' . " />\n";
        }
    }
    // one feed per user
    if ($items = Users::list_by_posts(0, COMPACT_LIST_SIZE, 'raw')) {
        foreach ($items as $id => $attributes) {
            $text .= '	<outline type="rss" text="' . encode_field(strip_tags($attributes['nick_name']) . $suffix) . '" xmlUrl="' . $context['url_to_home'] . $context['url_to_root'] . Users::get_url($id, 'feed') . '"' . " />\n";
        }
    }
    // the postamble
    $text .= '</body>' . "\n" . '</opml>' . "\n";
    // put in cache
    Safe::file_put_contents($cache_id, $text);
}
//
// transfer to the user agent
//
// handle the output correctly
render_raw('text/xml; charset=' . $context['charset']);
// suggest a name on download
if (!headers_sent()) {
    $file_name = utf8::to_ascii($context['site_name'] . '.opml.xml');
Esempio n. 11
0
File: edit.php Progetto: rair/yacs
 // the information panel
 //
 $text = '';
 // the avatar url
 if (isset($item['id'])) {
     $label = i18n::s('Picture URL');
     // show the current avatar
     if (isset($item['avatar_url']) && $item['avatar_url']) {
         $input = '<img src="' . $item['avatar_url'] . '" alt="" />' . BR;
     }
     $value = '';
     if (isset($item['avatar_url']) && $item['avatar_url']) {
         $value = $item['avatar_url'];
     }
     $input .= '<input type="text" name="avatar_url" size="55" value="' . encode_field($value) . '" maxlength="255" />';
     $input .= ' <span class="details">' . Skin::build_link(Users::get_url($item['id'], 'select_avatar'), i18n::s('Change picture'), 'button') . '</span>';
     $fields[] = array($label, $input);
 }
 // from where
 $label = i18n::s('From');
 $input = '<input type="text" name="from_where" size="50" value="' . encode_field(isset($item['from_where']) ? $item['from_where'] : '') . '" maxlength="255" />';
 $hint = i18n::s('Some hint on your location (eg, \'Paris\', \'home\', \'the toys-for-sick-persons department\')');
 $fields[] = array($label, $input, $hint);
 // the introduction
 $label = i18n::s('Introduction');
 $input = '<textarea name="introduction" rows="5" cols="50">' . encode_field(isset($item['introduction']) ? $item['introduction'] : '') . '</textarea>';
 $hint = i18n::s('Displayed aside your pages');
 $fields[] = array($label, $input, $hint);
 // include overlay fields, if any
 if (is_object($overlay)) {
     $fields = array_merge($fields, $overlay->get_fields($item));
Esempio n. 12
0
        Skin::define_img('ARTICLES_INVITE_IMG', 'articles/invite.gif');
        $box['bar'] += array(Articles::get_url($item['id'], 'invite') => ARTICLES_INVITE_IMG . i18n::s('Invite participants'));
    }
    // notify participants
    if ($count > 1 && Articles::allow_message($item, $anchor) && isset($context['with_email']) && $context['with_email'] == 'Y') {
        Skin::define_img('ARTICLES_EMAIL_IMG', 'articles/email.gif');
        $box['bar'] += array(Articles::get_url($item['id'], 'mail') => ARTICLES_EMAIL_IMG . i18n::s('Notify participants'));
    }
    // manage editors, for owners
    if (Articles::is_owned($item, $anchor, TRUE) || Surfer::is_associate()) {
        Skin::define_img('ARTICLES_ASSIGN_IMG', 'articles/assign.gif');
        $box['bar'] += array(Users::get_url('article:' . $item['id'], 'select') => ARTICLES_ASSIGN_IMG . i18n::s('Manage participants'));
        // leave this page, for editors
    } elseif (Articles::is_assigned($item['id'])) {
        Skin::define_img('ARTICLES_ASSIGN_IMG', 'sections/assign.gif');
        $box['bar'] += array(Users::get_url('article:' . $item['id'], 'leave') => ARTICLES_ASSIGN_IMG . i18n::s('Leave this page'));
    }
    // headers
    $headers = array(i18n::s('Person'), i18n::s('Watcher'), i18n::s('Editor'), i18n::s('Owner'));
    // layout columns
    if ($rows) {
        $box['text'] .= Skin::table($headers, $rows, 'grid');
    }
    // actually render the html
    $users .= Skin::build_content(NULL, NULL, $box['text'], $box['bar']);
}
// display in a separate panel
if ($users) {
    $label = i18n::s('Persons');
    if ($users_count) {
        $label .= ' (' . $users_count . ')';
Esempio n. 13
0
File: users.php Progetto: rair/yacs
 /**
  * post a new user profile
  *
  * @param array an array of fields
  * @return the id of the new user profile, or FALSE on error
  *
  * @see control/populate.php
  * @see users/edit.php
  * @see users/populate.php
  * @see query.php
  **/
 public static function post(&$fields)
 {
     global $context;
     // nick_name is required
     if (!isset($fields['nick_name']) || !trim($fields['nick_name'])) {
         Logger::error(i18n::s('Please indicate a nick name.'));
         return FALSE;
     }
     // some weird users put spaces around
     $fields['nick_name'] = trim($fields['nick_name']);
     // names used on shadow records are quite long (eg, tom@foo.bar.com)
     if (preg_match('/^(.+)@(.+)$/', $fields['nick_name'], $matches)) {
         // if short name is free
         if (!Users::get($matches[1])) {
             // use it instead (eg, tom)
             $fields['nick_name'] = $matches[1];
         }
     }
     // nickname may be already used
     if (Users::get($fields['nick_name'])) {
         Logger::error(i18n::s('Another member already has this nick name. Please select a different one.'));
         return FALSE;
     }
     // ensure we have a full name
     if (!isset($fields['full_name']) || !trim($fields['full_name'])) {
         $fields['full_name'] = $fields['nick_name'];
     }
     // password is required
     if (!isset($fields['password']) || !trim($fields['password'])) {
         Logger::error(i18n::s('Please indicate a password.'));
         return FALSE;
     }
     // hash password if coming from a human facing a form
     if (isset($fields['confirm']) && $fields['confirm'] == $fields['password']) {
         $fields['password'] = md5($fields['password']);
     }
     // open community, accept subscribers and members
     if (!isset($fields['capability']) || !in_array($fields['capability'], array('A', 'M', 'S', '?'))) {
         $fields['capability'] = 'M';
     }
     // control user capability
     if (!Surfer::is_associate()) {
         // closed community, accept only subscribers
         if (isset($context['users_with_approved_members']) && $context['users_with_approved_members'] == 'Y') {
             $fields['capability'] = 'S';
         } elseif (isset($context['users_with_email_validation']) && $context['users_with_email_validation'] == 'Y') {
             $fields['capability'] = 'S';
         }
     }
     // remember who is changing this record
     Surfer::check_default_editor($fields);
     // save new settings in session and in cookie
     if (isset($fields['id']) && Surfer::is($fields['id'])) {
         // change preferred editor
         $_SESSION['surfer_editor'] = $fields['editor'];
         Safe::setcookie('surfer_editor', $fields['editor'], NULL, '/');
         // change preferred language
         if (isset($fields['language']) && $_SESSION['surfer_language'] != $fields['language']) {
             $_SESSION['surfer_language'] = $fields['language'];
             $_SESSION['l10n_modules'] = array();
         }
     }
     // fields to update
     $query = array();
     // on import
     if (isset($fields['id'])) {
         $query[] = "id=" . SQL::escape($fields['id']);
     }
     if (!isset($fields['active']) || !trim($fields['active'])) {
         $fields['active'] = 'Y';
     }
     $query[] = "active='" . SQL::escape($fields['active']) . "'";
     $query[] = "aim_address='" . SQL::escape(isset($fields['aim_address']) ? $fields['aim_address'] : '') . "'";
     $query[] = "alternate_number='" . SQL::escape(isset($fields['alternate_number']) ? $fields['alternate_number'] : '') . "'";
     // protect from hackers
     if (isset($fields['avatar_url'])) {
         $fields['avatar_url'] = encode_link($fields['avatar_url']);
     }
     $query[] = "avatar_url='" . SQL::escape(isset($fields['avatar_url']) ? $fields['avatar_url'] : '') . "'";
     if (!isset($fields['birth_date']) || !$fields['birth_date']) {
         $fields['birth_date'] = NULL_DATE;
     }
     $query[] = "birth_date='" . SQL::escape($fields['birth_date']) . "'";
     $query[] = "capability='" . SQL::escape($fields['capability']) . "'";
     $query[] = "create_name='" . SQL::escape(isset($fields['create_name']) ? $fields['create_name'] : $fields['edit_name']) . "'";
     if (isset($fields['create_id']) || $fields['edit_id']) {
         $query[] = "create_id=" . SQL::escape(isset($fields['create_id']) ? $fields['create_id'] : $fields['edit_id']);
     }
     $query[] = "create_address='" . SQL::escape(isset($fields['create_address']) ? $fields['create_address'] : $fields['edit_address']) . "'";
     if (!isset($fields['create_date']) || $fields['create_date'] <= NULL_DATE) {
         $fields['create_date'] = $fields['edit_date'];
     }
     $query[] = "create_date='" . SQL::escape($fields['create_date']) . "'";
     $query[] = "description='" . SQL::escape(isset($fields['description']) ? $fields['description'] : '') . "'";
     $query[] = "edit_name='" . SQL::escape($fields['edit_name']) . "'";
     $query[] = "edit_id=" . SQL::escape($fields['edit_id']);
     $query[] = "edit_address='" . SQL::escape($fields['edit_address']) . "'";
     $query[] = "edit_action='" . SQL::escape(isset($fields['edit_action']) ? $fields['edit_action'] : 'new') . "'";
     $query[] = "edit_date='" . SQL::escape($fields['edit_date']) . "'";
     if (isset($fields['selected_editor'])) {
         $fields['editor'] = $fields['selected_editor'];
     } elseif (isset($context['users_default_editor'])) {
         $fields['editor'] = $context['users_default_editor'];
     } else {
         $fields['editor'] = 'yacs';
     }
     $query[] = "editor='" . SQL::escape($fields['editor']) . "'";
     $query[] = "email='" . SQL::escape(isset($fields['email']) ? $fields['email'] : '') . "'";
     $query[] = "from_where='" . SQL::escape(isset($fields['from_where']) ? $fields['from_where'] : '') . "'";
     $query[] = "full_name='" . SQL::escape(isset($fields['full_name']) ? $fields['full_name'] : '') . "'";
     // always create a handle for this user
     $fields['handle'] = md5(rand());
     $query[] = "handle='" . SQL::escape($fields['handle']) . "'";
     $query[] = "icq_address='" . SQL::escape(isset($fields['icq_address']) ? $fields['icq_address'] : '') . "'";
     if (!isset($fields['interface']) || $fields['interface'] != 'C') {
         $fields['interface'] = 'I';
     }
     $query[] = "interface='" . SQL::escape($fields['interface']) . "'";
     $query[] = "introduction='" . SQL::escape(isset($fields['introduction']) ? $fields['introduction'] : '') . "'";
     $query[] = "irc_address='" . SQL::escape(isset($fields['irc_address']) ? $fields['irc_address'] : '') . "'";
     $query[] = "jabber_address='" . SQL::escape(isset($fields['jabber_address']) ? $fields['jabber_address'] : '') . "'";
     $query[] = "language='" . SQL::escape(isset($fields['language']) ? $fields['language'] : 'none') . "'";
     $query[] = "msn_address='" . SQL::escape(isset($fields['msn_address']) ? $fields['msn_address'] : '') . "'";
     $query[] = "nick_name='" . SQL::escape($fields['nick_name']) . "'";
     $query[] = "options='" . SQL::escape(isset($fields['options']) ? $fields['options'] : '') . "'";
     $query[] = "overlay='" . SQL::escape(isset($fields['overlay']) ? $fields['overlay'] : '') . "'";
     $query[] = "overlay_id='" . SQL::escape(isset($fields['overlay_id']) ? $fields['overlay_id'] : '') . "'";
     $query[] = "password='******'password']) ? $fields['password'] : '') . "'";
     $query[] = "pgp_key='" . SQL::escape(isset($fields['pgp_key']) ? $fields['pgp_key'] : '') . "'";
     $query[] = "phone_number='" . SQL::escape(isset($fields['phone_number']) ? $fields['phone_number'] : '') . "'";
     if (!isset($fields['post_date']) || $fields['post_date'] <= NULL_DATE) {
         $fields['post_date'] = $fields['edit_date'];
     }
     $query[] = "post_date='" . SQL::escape($fields['post_date']) . "'";
     $query[] = "posts=" . SQL::escape(isset($fields['posts']) ? $fields['posts'] : '0');
     $query[] = "signature='" . SQL::escape(isset($fields['signature']) ? $fields['signature'] : '') . "'";
     $query[] = "skype_address='" . SQL::escape(isset($fields['skype_address']) ? $fields['skype_address'] : '') . "'";
     // clean provided tags
     if (isset($fields['tags'])) {
         $fields['tags'] = trim($fields['tags'], " \t.:,!?");
     }
     $query[] = "tags='" . SQL::escape(isset($fields['tags']) ? $fields['tags'] : '') . "'";
     $query[] = "twitter_address='" . SQL::escape(isset($fields['twitter_address']) ? $fields['twitter_address'] : '') . "'";
     $query[] = "vcard_agent='" . SQL::escape(isset($fields['vcard_agent']) ? $fields['vcard_agent'] : '') . "'";
     $query[] = "vcard_label='" . SQL::escape(isset($fields['vcard_label']) ? $fields['vcard_label'] : '') . "'";
     $query[] = "vcard_organization='" . SQL::escape(isset($fields['vcard_organization']) ? $fields['vcard_organization'] : '') . "'";
     $query[] = "vcard_title='" . SQL::escape(isset($fields['vcard_title']) ? $fields['vcard_title'] : '') . "'";
     $query[] = "web_address='" . SQL::escape(isset($fields['web_address']) ? $fields['web_address'] : '') . "'";
     if (!isset($fields['with_newsletters']) || $fields['with_newsletters'] != 'N') {
         $fields['with_newsletters'] = 'Y';
     }
     $query[] = "with_newsletters='" . $fields['with_newsletters'] . "'";
     if (!isset($fields['without_alerts']) || $fields['without_alerts'] != 'Y') {
         $fields['without_alerts'] = 'N';
     }
     $query[] = "without_alerts='" . $fields['without_alerts'] . "'";
     if (!isset($fields['without_confirmations']) || $fields['without_confirmations'] != 'Y') {
         $fields['without_confirmations'] = 'N';
     }
     $query[] = "without_confirmations='" . $fields['without_confirmations'] . "'";
     if (!isset($fields['without_messages']) || $fields['without_messages'] != 'Y') {
         $fields['without_messages'] = 'N';
     }
     $query[] = "without_messages='" . $fields['without_messages'] . "'";
     $query[] = "yahoo_address='" . SQL::escape(isset($fields['yahoo_address']) ? $fields['yahoo_address'] : '') . "'";
     // insert statement
     $query = "INSERT INTO " . SQL::table_name('users') . " SET " . implode(', ', $query);
     // actual insert
     if (SQL::query($query, FALSE, $context['users_connection']) === FALSE) {
         return FALSE;
     }
     // remember the id of the new item
     if (!($fields['id'] = SQL::get_last_id($context['users_connection']))) {
         logger::remember('users/users.php: unable to retrieve id of new record');
         return FALSE;
     }
     // list the user in categories
     Categories::remember('user:'******'id'], NULL_DATE, isset($fields['tags']) ? $fields['tags'] : '');
     // clear the cache for users
     Users::clear($fields);
     // send a confirmation message
     if (isset($fields['email']) && trim($fields['email']) && isset($context['with_email']) && $context['with_email'] == 'Y') {
         // message title
         $subject = sprintf(i18n::s('Your account at %s'), strip_tags($context['site_name']));
         // top of the message
         $message = '<p>' . i18n::s('Welcome!') . '</p>' . '<p>' . sprintf(i18n::s('This message relates to your account at %s.'), '<a href="' . $context['url_to_home'] . $context['url_to_root'] . '">' . strip_tags($context['site_name']) . '</a>') . '</p>';
         // mention nick name
         $message .= '<p>' . sprintf(i18n::s('Your nick name is %s'), $fields['nick_name']) . '</p>';
         // direct link to login page --see users/login.php
         $link = $context['url_to_home'] . $context['url_to_root'] . Users::get_login_url('login', $fields['id'], rand(1000, 9999), $fields['handle']);
         $message .= '<p>' . i18n::s('Record this message and use the following link to authenticate to the site at any time:') . '</p>' . '<p><a href="' . $link . '">' . $link . '</a></p>';
         // caution note
         $message .= '<p>' . i18n::s('Caution: This hyperlink contains your login credentials encrypted. Please be aware anyone who uses this link will have full access to your account.') . '</p>';
         // confirmation link
         if (isset($context['users_with_email_validation']) && $context['users_with_email_validation'] == 'Y') {
             $message .= '<p>' . i18n::s('Click on the link below to activate your new account.') . '</p>';
             // use the secret handle
             $link = $context['url_to_home'] . $context['url_to_root'] . Users::get_url($fields['handle'], 'validate');
             $message .= '<p><a href="' . $link . '">' . $link . '</a></p>';
         }
         // bottom of the message
         $message .= '<p>' . sprintf(i18n::s('On-line help is available at %s'), '<a href="' . $context['url_to_home'] . $context['url_to_root'] . 'help/' . '">' . $context['url_to_home'] . $context['url_to_root'] . 'help/' . '</a>') . '</p>' . '<p>' . sprintf(i18n::s('Thank you for your interest into %s.'), '<a href="' . $context['url_to_home'] . $context['url_to_root'] . '">' . strip_tags($context['site_name']) . '</a>') . '</p>';
         // enable threading
         $headers = Mailer::set_thread('user:'******'id']);
         // post the confirmation message
         Mailer::notify(NULL, $fields['email'], $subject, $message, $headers);
     }
     // automatic login
     if (!Surfer::get_id() && is_callable(array('Surfer', 'set'))) {
         Surfer::set($fields, TRUE);
     }
     // return the id of the new item
     return $fields['id'];
 }
Esempio n. 14
0
File: view.php Progetto: rair/yacs
         $context['page_tools'][] = Skin::build_link(Comments::get_url('category:' . $item['id'], 'comment'), COMMENTS_ADD_IMG . i18n::s('Post a comment'), 'basic', i18n::s('Express yourself, and say what you think.'));
     }
     // add a link
     if (Links::allow_creation($item, $anchor, 'category')) {
         Skin::define_img('LINKS_ADD_IMG', 'links/add.gif');
         $context['page_tools'][] = Skin::build_link('links/edit.php?anchor=' . urlencode('category:' . $item['id']), LINKS_ADD_IMG . i18n::s('Add a link'), 'basic', i18n::s('Contribute to the web and link to relevant pages.'));
     }
     // modify this item
     Skin::define_img('CATEGORIES_EDIT_IMG', 'categories/edit.gif');
     $context['page_tools'][] = Skin::build_link(Categories::get_url($item['id'], 'edit'), CATEGORIES_EDIT_IMG . i18n::s('Edit this category'), 'basic', i18n::s('Press [e] to edit'), FALSE, 'e');
     // delete this item
     Skin::define_img('CATEGORIES_DELETE_IMG', 'categories/delete.gif');
     $context['page_tools'][] = Skin::build_link(Categories::get_url($item['id'], 'delete'), CATEGORIES_DELETE_IMG . i18n::s('Delete this category'));
     // manage persons assigned to this category
     Skin::define_img('CATEGORIES_ASSIGN_IMG', 'categories/assign.gif');
     $context['page_tools'][] = Skin::build_link(Users::get_url('category:' . $item['id'], 'select'), CATEGORIES_ASSIGN_IMG . i18n::s('Manage members'));
 }
 // add extra information from the overlay, if any
 if (is_object($overlay)) {
     $context['components']['overlay'] = $overlay->get_text('extra', $item);
 }
 // add extra information from this item, if any
 if (isset($item['extra']) && $item['extra']) {
     $context['components']['boxes'] = Codes::beautify_extra($item['extra']);
 }
 // 'Share' box
 //
 $lines = array();
 // the command to track back
 if (Links::allow_trackback()) {
     Skin::define_img('TOOLS_TRACKBACK_IMG', 'tools/trackback.gif');
Esempio n. 15
0
 if ($items = Members::list_watchers_by_name_for_anchor('user:'******'id'], 0, 1000, 'compact')) {
     if (is_array($items)) {
         $items = Skin::build_list($items, 'compact');
     }
     if (Surfer::get_id() == $item['id']) {
         $followers .= '<p>' . i18n::s('Persons who follow you:') . '</p>' . $items;
     } else {
         $followers .= '<p>' . sprintf(i18n::s('Persons who follow %s:'), $item['full_name']) . '</p>' . $items;
     }
 }
 // connect to people
 if (Surfer::get_id() && Surfer::get_id() != $item['id']) {
     // suggest a new connection
     if (!Members::check('user:'******'id'], 'user:'******'USERS_WATCH_IMG', 'users/watch.gif');
         $link = Users::get_url('user:'******'id'], 'track');
         $followers .= '<p style="margin: 1em 0;">' . Skin::build_link($link, USERS_WATCH_IMG . sprintf(i18n::s('Follow %s'), $item['full_name']), 'basic', i18n::s('Be notified of additions from this person')) . '</p>';
     }
 }
 // put followers in a sidebar
 if ($followers) {
     $output .= Skin::layout_horizontally($watched, Skin::build_block($followers, 'sidecolumn'));
 } else {
     $output .= $watched;
 }
 // actual transmission except on a HEAD request
 if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'HEAD') {
     echo $output;
 }
 // the post-processing hook, then exit
 finalize_page(TRUE);
Esempio n. 16
0
File: user.php Progetto: rair/yacs
 /**
  * get the url to display the main page for this anchor
  *
  * @param string the targeted action ('view', 'print', 'edit', 'delete', ...)
  * @return an anchor to the viewing script, or NULL
  *
  * @see shared/anchor.php
  */
 function get_url($action = 'view')
 {
     // sanity check
     if (!isset($this->item['id'])) {
         return NULL;
     }
     switch ($action) {
         // list of files
         case 'files':
             return Users::get_permalink($this->item) . '#_information';
             // the permalink page
         // the permalink page
         case 'view':
             return Users::get_permalink($this->item);
             // another action
         // another action
         default:
             return Users::get_url($this->item['id'], $action, $this->item['nick_name']);
     }
 }
Esempio n. 17
0
File: surfer.php Progetto: rair/yacs
 /**
  * get profile address for this surfer, if known
  *
  * @return string web link to the target user profile, or NULL
  */
 public static function get_permalink()
 {
     global $context;
     if (Surfer::get_id() && is_callable(array('Users', 'get_url'))) {
         return $context['url_to_home'] . $context['url_to_root'] . Users::get_url(Surfer::get_id(), 'view', Surfer::get_name());
     }
     return NULL;
 }
Esempio n. 18
0
                Skin::define_img('FILES_UPLOAD_IMG', 'files/upload.gif');
                $menu[] = '<a href="#" onclick="$(\'#comment_upload\').slideDown(600);$(\'body\').delegate(\'#upload\', \'change\', function(event){if(/\\.zip$/i.test($(\'#upload\').val())){$(\'#upload_option\').slideDown();}else{$(\'#upload_option\').slideUp();}});return false;"><span>' . FILES_UPLOAD_IMG . i18n::s('Add a file') . '</span></a>';
            }
            // the submit button
            $menu[] = Skin::build_submit_button(i18n::s('Submit'), i18n::s('Press [s] to submit data'), 's', 'submit');
            // go to smileys
            //		$menu[] = Skin::build_link('smileys/', i18n::s('Smileys'), 'open');
            // display all commands
            $context['text'] .= Skin::finalize_list($menu, 'menu_bar');
            // end the form
            $context['text'] .= '</form>' . "\n";
        }
        // end of the wrapper
        $context['text'] .= '</div>' . "\n";
        // the AJAX part
        $js_script = 'var Comments = {' . "\n" . "\n" . '	url: "' . $context['url_to_home'] . $context['url_to_root'] . Comments::get_url($item['id'], 'thread') . '",' . "\n" . '	timestamp: 0,' . "\n" . "\n" . '	initialize: function() { },' . "\n" . "\n" . '	contribute: function() {' . "\n" . '		Yacs.startWorking();' . "\n" . '		$("#upload_frame").load(Comments.contributed);' . "\n" . '		return true;' . "\n" . '	},' . "\n" . "\n" . '	contributed: function() {' . "\n" . '		$("#upload_frame").unbind("load");' . "\n" . '		$("#comment_upload").slideUp(600);' . "\n" . '		$("#upload_option").slideUp();' . "\n" . '		$("#upload").replaceWith(\'<input type="file" id="upload" name="upload" size="30" />\');' . "\n" . '		$("#description").val("").trigger("change").focus();' . "\n" . '		setTimeout(function() {Comments.subscribe(); Yacs.stopWorking();}, 500);' . "\n" . '		if((typeof OpenTok == "object") && OpenTok.session)' . "\n" . '			OpenTok.signal();' . "\n" . '	},' . "\n" . "\n" . '	keypress: function(event) {' . "\n" . '		if(event.which == 13) {' . "\n" . '			$("#submit").trigger("click");' . "\n" . '			return false;' . "\n" . '		}' . "\n" . '	},' . "\n" . "\n" . '	showMore: function() {' . "\n" . '		var options = {};' . "\n" . '		var newHeight = $("#thread_text_panel").clientHeight + 200;' . "\n" . '		options.height =  newHeight + "px";' . "\n" . '		options.maxHeight =  newHeight + "px";' . "\n" . '		$("#thread_text_panel").css(options);' . "\n" . '	},' . "\n" . "\n" . '	subscribe: function() {' . "\n" . '		$.ajax(Comments.url, {' . "\n" . '			type: "get",' . "\n" . '			dataType: "json",' . "\n" . '			data: { "timestamp" : Comments.timestamp },' . "\n" . '			success: Comments.updateOnSuccess' . "\n" . '		});' . "\n" . "\n" . '	},' . "\n" . "\n" . '	subscribeToExtraUpdates: function() {' . "\n" . '		$.ajax("' . $context['url_to_home'] . $context['url_to_root'] . Users::get_url($item['id'], 'visit') . '", {' . "\n" . '			type: "get",' . "\n" . '			dataType: "html",' . "\n" . '			success: function(data) { $("#thread_roster_panel").html(data); }' . "\n" . '		});' . "\n" . "\n" . '		$.ajax("' . $context['url_to_home'] . $context['url_to_root'] . Files::get_url($item['id'], 'thread') . '", {' . "\n" . '			type: "get",' . "\n" . '			dataType: "html",' . "\n" . '			success: function(data) { $("#thread_files_panel").html(data); }' . "\n" . '		});' . "\n" . "\n" . '	},' . "\n" . "\n" . '	updateOnSuccess: function(response) {' . "\n" . '		if(!response) return;' . "\n" . '		if(response["status"] != "started")' . "\n" . '			window.location.reload(true);' . "\n" . '		$("#thread_text_panel").html("<div>" + response["items"] + "</div>");' . "\n" . '		var div = $("#thread_text_panel")[0];' . "\n" . '		var scrollHeight = Math.max(div.scrollHeight, div.clientHeight);' . "\n" . '		div.scrollTop = scrollHeight - div.clientHeight;' . "\n" . '		if(typeof Comments.windowOriginalTitle != "string")' . "\n" . '			Comments.windowOriginalTitle = document.title;' . "\n" . '		document.title = "[" + response["name"] + "] " + Comments.windowOriginalTitle;' . "\n" . '		Comments.timestamp = response["timestamp"];' . "\n" . '	}' . "\n" . "\n" . '}' . "\n" . "\n" . '// wait for new comments and for other updates' . "\n" . 'Comments.subscribeTimer = setInterval("Comments.subscribe()", 5000);' . "\n" . 'Comments.subscribeTimer = setInterval("Comments.subscribeToExtraUpdates()", 59999);' . "\n" . "\n" . '// load past contributions asynchronously' . "\n" . '$(function() {' . 'Comments.subscribe();' . 'location.hash="#thread_text_panel";' . '$("#description").tipsy({gravity: "s", fade: true, title: function () {return "' . i18n::s('Contribute here') . '";}, trigger: "manual"});' . '$("#description").tipsy("show");' . 'setTimeout("$(\'#description\').tipsy(\'hide\');", 10000);' . '$("textarea#description").autogrow();' . '});' . "\n";
        // only authenticated surfers can contribute
        if (Surfer::is_logged() && Comments::allow_creation($item, $anchor)) {
            $js_script .= '$(function() {' . '$("#description").focus();' . '});' . "\n" . '$(\'#description\').keypress( Comments.keypress );' . "\n";
        }
        break;
        Page::insert_script($js_script);
    case 'excluded':
        // surfer is not
        $context['text'] .= Skin::build_block(i18n::s('You have not been enrolled into this interactive chat.'), 'caution');
        break;
}
//
// trailer information
//
// add trailer information from the overlay, if any --opentok videos come from here
Esempio n. 19
0
        Skin::define_img('SECTIONS_INVITE_IMG', 'sections/invite.gif');
        $box['bar'] += array(Sections::get_url($item['id'], 'invite') => SECTIONS_INVITE_IMG . i18n::s('Invite participants'));
    }
    // notify participants
    if ($count > 1 && Sections::allow_message($item, $anchor) && isset($context['with_email']) && $context['with_email'] == 'Y') {
        Skin::define_img('SECTIONS_EMAIL_IMG', 'sections/email.gif');
        $box['bar'] += array(Sections::get_url($item['id'], 'mail') => SECTIONS_EMAIL_IMG . i18n::s('Notify participants'));
    }
    // manage editors, for owners
    if (Sections::is_owned($item, $anchor, TRUE) || Surfer::is_associate()) {
        Skin::define_img('SECTIONS_ASSIGN_IMG', 'sections/assign.gif');
        $box['bar'] += array(Users::get_url('section:' . $item['id'], 'select') => SECTIONS_ASSIGN_IMG . i18n::s('Manage participants'));
        // leave this section, for editors
    } elseif (Sections::is_assigned($item['id'])) {
        Skin::define_img('SECTIONS_ASSIGN_IMG', 'sections/assign.gif');
        $box['bar'] += array(Users::get_url('section:' . $item['id'], 'leave') => SECTIONS_ASSIGN_IMG . i18n::s('Leave this section'));
    }
    // headers
    $headers = array(i18n::s('Person'), i18n::s('Watcher'), i18n::s('Editor'), i18n::s('Owner'));
    // layout columns
    if ($rows) {
        $box['text'] .= Skin::table($headers, $rows, 'grid');
    }
    // actually render the html
    $users .= Skin::build_content(NULL, NULL, $box['text'], $box['bar']);
}
// display in a separate panel
if ($users) {
    $label = i18n::s('Persons');
    if ($users_count) {
        $label .= ' (' . $users_count . ')';
Esempio n. 20
0
File: delete.php Progetto: rair/yacs
    if (Articles::delete($item['id'])) {
        // log item deletion
        $label = sprintf(i18n::c('Deletion: %s'), strip_tags($item['title']));
        $description = Articles::get_permalink($item);
        Logger::remember('articles/delete.php: ' . $label, $description);
        // this can appear anywhere
        Cache::clear();
        // back to the anchor page or to the index page
        if (is_object($overlay) && ($back_url = $overlay->get_url_after_deleting())) {
            Safe::redirect($back_url);
        } elseif (!is_object($anchor)) {
            Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'articles/');
        } elseif ($anchor->is_viewable()) {
            Safe::redirect($context['url_to_home'] . $context['url_to_root'] . $anchor->get_url());
        } elseif ($id = Surfer::get_id()) {
            Safe::redirect($context['url_to_home'] . $context['url_to_root'] . Users::get_url($id));
        } else {
            Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'articles/');
        }
    }
    // deletion has to be confirmed
} elseif (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
    Logger::error(i18n::s('The action has not been confirmed.'));
} else {
    // the article or the anchor icon, if any
    $context['page_image'] = $item['icon_url'];
    if (!$context['page_image'] && is_object($anchor)) {
        $context['page_image'] = $anchor->get_icon_url();
    }
    // commands
    $menu = array();
Esempio n. 21
0
 if ($item['web_address']) {
     $text .= '		<foaf:homepage rdf:resource="' . encode_field($item['web_address']) . '" />' . "\n";
 } else {
     $text .= '		<foaf:homepage rdf:resource="' . encode_field(Users::get_permalink($item)) . '" />' . "\n";
 }
 // the user avatar
 if ($item['avatar_url']) {
     if ($item['avatar_url'][0] == '/') {
         $item['avatar_url'] = str_replace('//', '/', $context['url_to_home'] . $context['url_to_root'] . $item['avatar_url']);
     }
     $text .= '		<foaf:img rdf:resource="' . encode_field($item['avatar_url']) . '" />' . "\n";
 }
 // list watched users by posts
 if ($items =& Members::list_users_by_posts_for_member('user:'******'id'], 0, USERS_PER_PAGE, 'raw')) {
     foreach ($items as $id => $attributes) {
         $text .= '	<foaf:knows>' . "\n" . '		<foaf:Person>' . "\n" . '			<foaf:name>' . encode_field($attributes['full_name']) . '</foaf:name>' . "\n" . '			<rdfs:seeAlso rdf:resource="' . encode_field($context['url_to_home'] . $context['url_to_root'] . Users::get_url($id, 'describe')) . '" />' . "\n" . '		</foaf:Person>' . "\n" . '	</foaf:knows>' . "\n";
     }
 }
 $text .= '	</foaf:Person>' . "\n" . '</rdf:RDF>';
 //
 // transfer to the user agent
 //
 // handle the output correctly
 render_raw('text/xml; charset=' . $context['charset']);
 // suggest a name on download
 if (!headers_sent()) {
     $file_name = utf8::to_ascii(Skin::strip($context['page_title']) . '.opml.xml');
     Safe::header('Content-Disposition: inline; filename="' . str_replace('"', '', $file_name) . '"');
 }
 // enable 30-minute caching (30*60 = 1800), even through https, to help IE6 on download
 http::expire(1800);
Esempio n. 22
0
File: mail.php Progetto: rair/yacs
 // enable yacs codes in messages
 $message = Codes::beautify($_REQUEST['message']);
 // nothing to do
 if (!$subject || !$message) {
     Logger::error('Please provide a subject and some text for your message.');
     $with_form = TRUE;
     // do the post
 } else {
     // headline
     $headline = sprintf(i18n::c('%s has sent a message to you'), Surfer::get_link());
     // assemble main content of this message
     $message = Skin::build_mail_content($headline, $message);
     // a set of links
     $menu = array();
     // call for action
     $link = $context['url_to_home'] . $context['url_to_root'] . Users::get_url(Surfer::get_id(), 'mail');
     $menu[] = Skin::build_mail_button($link, i18n::c('Reply'), TRUE);
     // link to surfer profile
     $link = Surfer::get_permalink();
     $menu[] = Skin::build_mail_button($link, Surfer::get_name(), FALSE);
     // finalize links
     $message .= Skin::build_mail_menu($menu);
     // threads messages
     $headers = Mailer::set_thread('user:'******'id']);
     // send the message
     if (Mailer::notify($from, $to, $subject, $message, $headers)) {
         // feed-back to the sender
         $context['text'] .= '<p>' . sprintf(i18n::s('Your message is being transmitted to %s'), strip_tags($item['email'])) . '</p>';
         // signal that a copy has been forwarded as well
         if (isset($_REQUEST['self_copy']) && $_REQUEST['self_copy'] == 'Y') {
             $context['text'] .= '<p>' . sprintf(i18n::s('At your request, a copy was also sent to %s'), $from) . '</p>';