本文整理汇总了PHP中unobscure函数的典型用法代码示例。如果您正苦于以下问题:PHP unobscure函数的具体用法?PHP unobscure怎么用?PHP unobscure使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了unobscure函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: api_format_items
function api_format_items($r, $user_info)
{
//logger('api_format_items: ' . print_r($r,true));
//logger('api_format_items: ' . print_r($user_info,true));
$a = get_app();
$ret = array();
if (!$r) {
return $ret;
}
foreach ($r as $item) {
localize_item($item);
$status_user = $item['author_xchan'] == $user_info['guid'] ? $user_info : api_item_get_user($a, $item);
if (array_key_exists('status', $status_user)) {
unset($status_user['status']);
}
if ($item['parent'] != $item['id']) {
$r = q("select id from item where parent= %d and id < %d order by id desc limit 1", intval($item['parent']), intval($item['id']));
if ($r) {
$in_reply_to_status_id = $r[0]['id'];
} else {
$in_reply_to_status_id = $item['parent'];
}
xchan_query($r, true);
$in_reply_to_screen_name = $r[0]['author']['xchan_name'];
$in_reply_to_user_id = $r[0]['author']['abook_id'];
} else {
$in_reply_to_screen_name = '';
$in_reply_to_user_id = 0;
$in_reply_to_status_id = 0;
}
unobscure($item);
// Workaround for ostatus messages where the title is identically to the body
$statusbody = trim(html2plain(prepare_text($item['body'], $item['mimetype']), 0));
$statustitle = trim($item['title']);
if ($statustitle != '' and strpos($statusbody, $statustitle) !== false) {
$statustext = trim($statusbody);
} else {
$statustext = trim($statustitle . "\n\n" . $statusbody);
}
$status = array('text' => $statustext, 'truncated' => False, 'created_at' => api_date($item['created']), 'in_reply_to_status_id' => $in_reply_to_status_id, 'source' => $item['app'] ? $item['app'] : 'web', 'id' => intval($item['id']), 'in_reply_to_user_id' => $in_reply_to_user_id, 'in_reply_to_screen_name' => $in_reply_to_screen_name, 'geo' => '', 'favorited' => intval($item['item_starred']) ? true : false, 'user' => $status_user, 'statusnet_html' => trim(prepare_text($item['body'], $item['mimetype'])), 'statusnet_conversation_id' => $item['parent']);
// Seesmic doesn't like the following content
if ($_SERVER['HTTP_USER_AGENT'] != 'Seesmic') {
$status2 = array('updated' => api_date($item['edited']), 'published' => api_date($item['created']), 'message_id' => $item['mid'], 'url' => $item['plink'], 'coordinates' => $item['coord'], 'place' => $item['location'], 'contributors' => '', 'annotations' => '', 'entities' => '', 'objecttype' => $item['obj_type'] ? $item['obj_type'] : ACTIVITY_OBJ_NOTE, 'verb' => $item['verb'] ? $item['verb'] : ACTIVITY_POST, 'self' => $a->get_baseurl() . "/api/statuses/show/" . $item['id'] . "." . $type, 'edit' => $a->get_baseurl() . "/api/statuses/show/" . $item['id'] . "." . $type);
$status = array_merge($status, $status2);
}
$ret[] = $status;
}
return $ret;
}
开发者ID:msooon,项目名称:hubzilla,代码行数:49,代码来源:api.php
示例2: safeinput
$title = safeinput($_REQUEST['title']);
$tinytitle = safeinput($_REQUEST['tinytitle']);
$audience = $_REQUEST['audience'];
$descr = safeinput($_REQUEST['descr']);
$printdescr = safeinput($_REQUEST['printdescr']);
$newsflash = safeinput($_REQUEST['newsflash']);
$dates = $_REQUEST['dates'];
$eventtime = $_REQUEST['eventtime'];
$eventduration = $_REQUEST['eventduration'];
$timedetails = $_REQUEST['timedetails'];
$locname = safeinput($_REQUEST['locname']);
$address = safeinput($_REQUEST['address']);
$addressverified = $_REQUEST['addressverified'];
$locdetails = safeinput($_REQUEST['locdetails']);
$area = $_REQUEST['area'];
$id = unobscure($_REQUEST['edit']);
$comment = wordwrap(stripslashes($_REQUEST['comment']), 60);
$highlight = $_REQUEST['highlight'];
if ($highlight == '1') {
$highlight = 1;
} else {
$highlight = 0;
}
# parse the $dates value, and convert it to a list of specific dates
$daylist = repeatdates($dates);
# retrieve the old image name (if any), and review status
$oldimage = '';
$record = '';
if ($id) {
$result = mysql_query("SELECT * FROM calevent WHERE id={$id}", $conn) or die('Retrieveing old image name, ' . mysql_error());
$record = mysql_fetch_array($result);
开发者ID:kirkendall,项目名称:shiftcal,代码行数:31,代码来源:calsubmit.php
示例3: photos_content
//.........这里部分代码省略.........
//if (feature_enabled($conv->get_profile_owner(),'dislike')) {
$dislike_count = x($dlike, $link_item['mid']) ? $dlike[$link_item['mid']] : '';
$dislike_list = x($dlike, $link_item['mid']) ? $dlike[$link_item['mid'] . '-l'] : '';
$dislike_button_label = tt('Dislike', 'Dislikes', $dislike_count, 'noun');
if (count($dislike_list) > MAX_LIKERS) {
$dislike_list_part = array_slice($dislike_list, 0, MAX_LIKERS);
array_push($dislike_list_part, '<a href="#" data-toggle="modal" data-target="#dislikeModal-' . $this->get_id() . '"><b>' . t('View all') . '</b></a>');
} else {
$dislike_list_part = '';
}
//}
$like = isset($alike[$link_item['mid']]) ? format_like($alike[$link_item['mid']], $alike[$link_item['mid'] . '-l'], 'like', $link_item['mid']) : '';
$dislike = isset($dlike[$link_item['mid']]) ? format_like($dlike[$link_item['mid']], $dlike[$link_item['mid'] . '-l'], 'dislike', $link_item['mid']) : '';
// display comments
foreach ($r as $item) {
$comment = '';
$template = $tpl;
$sparkle = '';
if ((activity_match($item['verb'], ACTIVITY_LIKE) || activity_match($item['verb'], ACTIVITY_DISLIKE)) && $item['id'] != $item['parent']) {
continue;
}
$redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'];
$profile_url = zid($item['author']['xchan_url']);
$sparkle = '';
$profile_name = $item['author']['xchan_name'];
$profile_avatar = $item['author']['xchan_photo_m'];
$profile_link = $profile_url;
$drop = '';
if ($observer['xchan_hash'] === $item['author_xchan'] || $observer['xchan_hash'] === $item['owner_xchan']) {
$drop = replace_macros(get_markup_template('photo_drop.tpl'), array('$id' => $item['id'], '$delete' => t('Delete')));
}
$name_e = $profile_name;
$title_e = $item['title'];
unobscure($item);
$body_e = prepare_text($item['body'], $item['mimetype']);
$comments .= replace_macros($template, array('$id' => $item['id'], '$mode' => 'photos', '$profile_url' => $profile_link, '$name' => $name_e, '$thumb' => $profile_avatar, '$sparkle' => $sparkle, '$title' => $title_e, '$body' => $body_e, '$ago' => relative_date($item['created']), '$indent' => $item['parent'] != $item['id'] ? ' comment' : '', '$drop' => $drop, '$comment' => $comment));
}
if ($can_post || $can_comment) {
$commentbox = replace_macros($cmnt_tpl, array('$return_path' => '', '$jsreload' => $return_url, '$type' => 'wall-comment', '$id' => $link_item['id'], '$parent' => $link_item['id'], '$profile_uid' => $owner_uid, '$mylink' => $observer['xchan_url'], '$mytitle' => t('This is you'), '$myphoto' => $observer['xchan_photo_s'], '$comment' => t('Comment'), '$submit' => t('Submit'), '$ww' => ''));
}
}
$paginate = paginate($a);
}
$album_e = array($album_link, $ph[0]['album']);
$like_e = $like;
$dislike_e = $dislike;
$response_verbs = array('like');
if (feature_enabled($owner_uid, 'dislike')) {
$response_verbs[] = 'dislike';
}
$responses = get_responses($conv_responses, $response_verbs, '', $link_item);
$photo_tpl = get_markup_template('photo_view.tpl');
$o .= replace_macros($photo_tpl, array('$id' => $ph[0]['id'], '$album' => $album_e, '$tools' => $tools, '$lock' => $lockstate[1], '$photo' => $photo, '$prevlink' => $prevlink, '$nextlink' => $nextlink, '$desc' => $ph[0]['description'], '$filename' => $ph[0]['filename'], '$unknown' => t('Unknown'), '$tag_hdr' => t('In This Photo:'), '$tags' => $tags, 'responses' => $responses, '$edit' => $edit, '$map' => $map, '$map_text' => t('Map'), '$likebuttons' => $likebuttons, '$like' => $like_e, '$dislike' => $dislike_e, '$like_count' => $like_count, '$like_list' => $like_list, '$like_list_part' => $like_list_part, '$like_button_label' => $like_button_label, '$like_modal_title' => t('Likes', 'noun'), '$dislike_modal_title' => t('Dislikes', 'noun'), '$dislike_count' => $dislike_count, '$dislike_list' => $dislike_list, '$dislike_list_part' => $dislike_list_part, '$dislike_button_label' => $dislike_button_label, '$modal_dismiss' => t('Close'), '$comments' => $comments, '$commentbox' => $commentbox, '$paginate' => $paginate));
$a->data['photo_html'] = $o;
return $o;
}
// Default - show recent photos with upload link (if applicable)
//$o = '';
$r = q("SELECT `resource_id`, max(`scale`) AS `scale` FROM `photo` WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s' \n\t\tand photo_usage in ( %d, %d ) and is_nsfw = %d {$sql_extra} GROUP BY `resource_id`", intval($a->data['channel']['channel_id']), dbesc('Contact Photos'), dbesc(t('Contact Photos')), intval(PHOTO_NORMAL), intval(PHOTO_PROFILE), intval($unsafe));
if (count($r)) {
$a->set_pager_total(count($r));
$a->set_pager_itemspage(60);
}
$r = q("SELECT p.resource_id, p.id, p.filename, p.type, p.album, p.scale, p.created FROM photo p INNER JOIN \n\t\t(SELECT resource_id, max(scale) scale FROM photo \n\t\t\tWHERE uid=%d AND album != '%s' AND album != '%s' \n\t\t\tAND photo_usage IN ( %d, %d ) and is_nsfw = %d {$sql_extra} group by resource_id) ph \n\t\tON (p.resource_id = ph.resource_id and p.scale = ph.scale) ORDER by p.created DESC LIMIT %d OFFSET %d", intval($a->data['channel']['channel_id']), dbesc('Contact Photos'), dbesc(t('Contact Photos')), intval(PHOTO_NORMAL), intval(PHOTO_PROFILE), intval($unsafe), intval($a->pager['itemspage']), intval($a->pager['start']));
$photos = array();
if (count($r)) {
开发者ID:spthaolt,项目名称:hubzilla,代码行数:67,代码来源:photos.php
示例4: areacode
<script type="text/javascript" language="JavaScript">
// These are some trivial functions, generated via PHP. They are
// all collected here so that little snippets of PHP code won't
// mess up the syntax coloring of JavaScript code later in this file.
function areacode() { return "<?php
print AREACODE;
?>
"; }
function images() { return "<?php
print IMAGES;
?>
"; }
function appendid() {
<?php
if (isset($_REQUEST["edit"])) {
print "return \"&id=" . unobscure($_REQUEST["edit"]) . "\";";
} else {
print "return \"\";";
}
?>
}
function printsel() { return "<?php
print $printsel;
?>
"; }
function editparameter() { return "<?php
print isset($_REQUEST['edit']) ? $_REQUEST['edit'] : '';
?>
"; }
function origdatestype() { return "<?php
print $thisdatestype;
开发者ID:CorySpitzer,项目名称:shiftcal,代码行数:31,代码来源:calform.php
示例5: post_is_importable
function post_is_importable($item, $abook)
{
if (!$abook) {
return true;
}
if ($abook['abook_channel'] && !feature_enabled($abook['abook_channel'], 'connfilter')) {
return true;
}
if (!$item) {
return false;
}
if (!($abook['abook_incl'] || $abook['abook_excl'])) {
return true;
}
require_once 'include/html2plain.php';
unobscure($item);
$text = prepare_text($item['body'], $item['mimetype']);
$text = html2plain($item['title'] ? $item['title'] . ' ' . $text : $text);
$lang = null;
if (strpos($abook['abook_incl'], 'lang=') !== false || strpos($abook['abook_excl'], 'lang=') !== false) {
$lang = detect_language($text);
}
$tags = count($item['term']) ? $item['term'] : false;
// exclude always has priority
$exclude = $abook['abook_excl'] ? explode("\n", $abook['abook_excl']) : null;
if ($exclude) {
foreach ($exclude as $word) {
$word = trim($word);
if (!$word) {
continue;
}
if (substr($word, 0, 1) === '#' && $tags) {
foreach ($tags as $t) {
if (($t['type'] == TERM_HASHTAG || $t['type'] == TERM_COMMUNITYTAG) && ($t['term'] === substr($word, 1) || substr($word, 1) === '*')) {
return false;
}
}
} elseif (strpos($word, '/') === 0 && preg_match($word, $text)) {
return false;
} elseif (strpos($word, 'lang=') === 0 && $lang && strcasecmp($lang, trim(substr($word, 5))) == 0) {
return false;
} elseif (stristr($text, $word) !== false) {
return false;
}
}
}
$include = $abook['abook_incl'] ? explode("\n", $abook['abook_incl']) : null;
if ($include) {
foreach ($include as $word) {
$word = trim($word);
if (!$word) {
continue;
}
if (substr($word, 0, 1) === '#' && $tags) {
foreach ($tags as $t) {
if (($t['type'] == TERM_HASHTAG || $t['type'] == TERM_COMMUNITYTAG) && ($t['term'] === substr($word, 1) || substr($word, 1) === '*')) {
return true;
}
}
} elseif (strpos($word, '/') === 0 && preg_match($word, $text)) {
return true;
} elseif (strpos($word, 'lang=') === 0 && $lang && strcasecmp($lang, trim(substr($word, 5))) == 0) {
return true;
} elseif (stristr($text, $word) !== false) {
return true;
}
}
} else {
return true;
}
return false;
}
开发者ID:bashrc,项目名称:hubzilla,代码行数:72,代码来源:items.php
示例6: webpages_content
function webpages_content(&$a)
{
if (!App::$profile) {
notice(t('Requested profile is not available.') . EOL);
App::$error = 404;
return;
}
$which = argv(1);
$_SESSION['return_url'] = App::$query_string;
$uid = local_channel();
$owner = 0;
$channel = null;
$observer = App::get_observer();
$channel = App::get_channel();
if (App::$is_sys && is_site_admin()) {
$sys = get_sys_channel();
if ($sys && intval($sys['channel_id'])) {
$uid = $owner = intval($sys['channel_id']);
$channel = $sys;
$observer = $sys;
}
}
if (!$owner) {
// Figure out who the page owner is.
$r = q("select channel_id from channel where channel_address = '%s'", dbesc($which));
if ($r) {
$owner = intval($r[0]['channel_id']);
}
}
$ob_hash = $observer ? $observer['xchan_hash'] : '';
$perms = get_all_perms($owner, $ob_hash);
if (!$perms['write_pages']) {
notice(t('Permission denied.') . EOL);
return;
}
$mimetype = $_REQUEST['mimetype'] ? $_REQUEST['mimetype'] : get_pconfig($owner, 'system', 'page_mimetype');
if (!$mimetype) {
$mimetype = 'choose';
}
$layout = $_REQUEST['layout'] ? $_REQUEST['layout'] : get_pconfig($owner, 'system', 'page_layout');
if (!$layout) {
$layout = 'choose';
}
// Create a status editor (for now - we'll need a WYSIWYG eventually) to create pages
// Nickname is set to the observers xchan, and profile_uid to the owner's.
// This lets you post pages at other people's channels.
if (!$channel && $uid && $uid == App::$profile_uid) {
$channel = App::get_channel();
}
if ($channel) {
$channel_acl = array('allow_cid' => $channel['channel_allow_cid'], 'allow_gid' => $channel['channel_allow_gid'], 'deny_cid' => $channel['channel_deny_cid'], 'deny_gid' => $channel['channel_deny_gid']);
} else {
$channel_acl = array();
}
$is_owner = $uid && $uid == $owner;
$o = profile_tabs($a, $is_owner, App::$profile['channel_address']);
$x = array('webpage' => ITEM_TYPE_WEBPAGE, 'is_owner' => true, 'nickname' => App::$profile['channel_address'], 'lockstate' => $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid'] ? 'lock' : 'unlock', 'bang' => '', 'acl' => $is_owner ? populate_acl($channel_acl, false) : '', 'showacl' => $is_owner ? true : false, 'visitor' => true, 'profile_uid' => intval($owner), 'mimetype' => $mimetype, 'layout' => $layout, 'expanded' => true, 'novoting' => true, 'bbco_autocomplete' => 'bbcode', 'bbcode' => true);
if ($_REQUEST['title']) {
$x['title'] = $_REQUEST['title'];
}
if ($_REQUEST['body']) {
$x['body'] = $_REQUEST['body'];
}
if ($_REQUEST['pagetitle']) {
$x['pagetitle'] = $_REQUEST['pagetitle'];
}
$editor = status_editor($a, $x);
// Get a list of webpages. We can't display all them because endless scroll makes that unusable,
// so just list titles and an edit link.
/** @TODO - this should be replaced with pagelist_widget */
$sql_extra = item_permissions_sql($owner);
$r = q("select * from item_id left join item on item_id.iid = item.id \n\t\twhere item_id.uid = %d and service = 'WEBPAGE' and item_type = %d {$sql_extra} order by item.created desc", intval($owner), intval(ITEM_TYPE_WEBPAGE));
$pages = null;
if ($r) {
$pages = array();
foreach ($r as $rr) {
unobscure($rr);
$lockstate = $rr['allow_cid'] || $rr['allow_gid'] || $rr['deny_cid'] || $rr['deny_gid'] ? 'lock' : 'unlock';
$element_arr = array('type' => 'webpage', 'title' => $rr['title'], 'body' => $rr['body'], 'created' => $rr['created'], 'edited' => $rr['edited'], 'mimetype' => $rr['mimetype'], 'pagetitle' => $rr['sid'], 'mid' => $rr['mid'], 'layout_mid' => $rr['layout_mid']);
$pages[$rr['iid']][] = array('url' => $rr['iid'], 'pagetitle' => $rr['sid'], 'title' => $rr['title'], 'created' => datetime_convert('UTC', date_default_timezone_get(), $rr['created']), 'edited' => datetime_convert('UTC', date_default_timezone_get(), $rr['edited']), 'bb_element' => '[element]' . base64url_encode(json_encode($element_arr)) . '[/element]', 'lockstate' => $lockstate);
}
}
//Build the base URL for edit links
$url = z_root() . '/editwebpage/' . $which;
$o .= replace_macros(get_markup_template('webpagelist.tpl'), array('$listtitle' => t('Webpages'), '$baseurl' => $url, '$create' => t('Create'), '$edit' => t('Edit'), '$share' => t('Share'), '$delete' => t('Delete'), '$pages' => $pages, '$channel' => $which, '$editor' => $editor, '$view' => t('View'), '$preview' => t('Preview'), '$actions_txt' => t('Actions'), '$pagelink_txt' => t('Page Link'), '$title_txt' => t('Page Title'), '$created_txt' => t('Created'), '$edited_txt' => t('Edited')));
return $o;
}
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:87,代码来源:webpages.php
示例7: mysql_connect
#
# edit= Obscured version of the event ID, indicating which event
# should have its status changed.
#
# review= One of Inspect, Approved, Exclude, SentEmail, or Revised.
# This changes the review status of the event.
#
# tinytitle= Optional. New tinytitle for the event.
#
# printdescr= Optional. New printed description for the event.
include "include/common.php";
# Open a connection to the SQL server
$conn = mysql_connect(DBHOST, DBUSER, DBPASSWORD) or die(mysql_error());
mysql_select_db(DBDATABASE, $conn);
# Fetch the edit= parameter and convert it to an id
$id = unobscure($_REQUEST["edit"]);
# Fetch the current tiny title and print description. This is partly just
# to verify the id, but if we end up sending email then we'll need the values.
$result = mysql_query("SELECT tinytitle, printdescr, email FROM calevent WHERE id = {$id}", $conn) or die("Fetching printdescr, " . mysql_error());
if (mysql_num_rows($result) == 0) {
die("The 'edit' parameter is invalid");
}
$record = mysql_fetch_array($result);
# Fetch the review= parameter and convert it to a single letter
switch ($_REQUEST["review"]) {
case "Inspect":
$review = "I";
break;
case "Approved":
$review = "A";
break;
开发者ID:kirkendall,项目名称:shiftcal,代码行数:31,代码来源:vfyreview.php
示例8: prepare_body
function prepare_body(&$item, $attach = false)
{
call_hooks('prepare_body_init', $item);
unobscure($item);
$s = prepare_text($item['body'], $item['mimetype']);
$prep_arr = array('item' => $item, 'html' => $s);
call_hooks('prepare_body', $prep_arr);
$s = $prep_arr['html'];
if (!$attach) {
return $s;
}
if (strpos($s, '<div class="map">') !== false && $item['coord']) {
$x = generate_map(trim($item['coord']));
if ($x) {
$s = preg_replace('/\\<div class\\=\\"map\\"\\>/', '$0' . $x, $s);
}
}
$s .= theme_attachments($item);
$writeable = get_observer_hash() == $item['owner_xchan'] ? true : false;
$s .= format_hashtags($item);
if ($item['resource_type']) {
$s .= format_mentions($item);
}
$s .= format_categories($item, $writeable);
if (local_channel() == $item['uid']) {
$s .= format_filer($item);
}
$s = sslify($s);
// Look for spoiler
$spoilersearch = '<blockquote class="spoiler">';
// Remove line breaks before the spoiler
while (strpos($s, "\n" . $spoilersearch) !== false) {
$s = str_replace("\n" . $spoilersearch, $spoilersearch, $s);
}
while (strpos($s, "<br />" . $spoilersearch) !== false) {
$s = str_replace("<br />" . $spoilersearch, $spoilersearch, $s);
}
while (strpos($s, $spoilersearch) !== false) {
$pos = strpos($s, $spoilersearch);
$rnd = random_string(8);
$spoilerreplace = '<br /> <span id="spoiler-wrap-' . $rnd . '" style="white-space:nowrap;" class="fakelink" onclick="openClose(\'spoiler-' . $rnd . '\');">' . sprintf(t('Click to open/close')) . '</span>' . '<blockquote class="spoiler" id="spoiler-' . $rnd . '" style="display: none;">';
$s = substr($s, 0, $pos) . $spoilerreplace . substr($s, $pos + strlen($spoilersearch));
}
// Look for quote with author
$authorsearch = '<blockquote class="author">';
while (strpos($s, $authorsearch) !== false) {
$pos = strpos($s, $authorsearch);
$rnd = random_string(8);
$authorreplace = '<br /> <span id="author-wrap-' . $rnd . '" style="white-space:nowrap;" class="fakelink" onclick="openClose(\'author-' . $rnd . '\');">' . sprintf(t('Click to open/close')) . '</span>' . '<blockquote class="author" id="author-' . $rnd . '" style="display: block;">';
$s = substr($s, 0, $pos) . $authorreplace . substr($s, $pos + strlen($authorsearch));
}
$prep_arr = array('item' => $item, 'html' => $s);
call_hooks('prepare_body_final', $prep_arr);
return $prep_arr['html'];
}
开发者ID:einervonvielen,项目名称:redmatrix,代码行数:55,代码来源:text.php
示例9: obscure
<td><input type=text name=edit value="<?php
print $_REQUEST["edit"];
?>
" onchange="document.forms.obscurer.id.value = '';"></td>
<td><input type=submit></td>
</tr>
</table>
</form>
<?php
if ($_REQUEST["id"]) {
print "<h3>Results for \$id='{$_REQUEST['id']}'</h3>\n";
print "\$edit = " . obscure($_REQUEST["id"]) . "\n";
}
if ($_REQUEST["edit"]) {
print "<h3>Results for \$edit='{$_REQUEST['edit']}'</h3>\n";
print "\$id = " . unobscure($_REQUEST["edit"]) . "\n";
}
?>
<hr>
<h2>Venue Address Finder</h2>
If an event's location is a park or business, then you can enter its
name and the form will try to look up its address.
<form id=cal>
<input type=hidden name=addressverified value="X">
<table>
<tr><td>Venue:</td><td><input type=text size=30 name=locname onChange="verifyvenue(this.value);"></td></tr>
<tr><td>Address:</td><td><input type=text size=30 name=address onChange="verifyaddress(this.value);"><span id="verifiedstatus"></span></td></tr>
</table>
</form>
</body>
</html>
开发者ID:kirkendall,项目名称:shiftcal,代码行数:31,代码来源:repeattest.php
示例10: photos_content
//.........这里部分代码省略.........
}
}
$alike = array();
$dlike = array();
$like = '';
$dislike = '';
// display comments
if ($r) {
foreach ($r as $item) {
like_puller($a, $item, $alike, 'like');
like_puller($a, $item, $dlike, 'dislike');
}
$like = isset($alike[$link_item['id']]) ? format_like($alike[$link_item['id']], $alike[$link_item['id'] . '-l'], 'like', $link_item['id']) : '';
$dislike = isset($dlike[$link_item['id']]) ? format_like($dlike[$link_item['id']], $dlike[$link_item['id'] . '-l'], 'dislike', $link_item['id']) : '';
foreach ($r as $item) {
$comment = '';
$template = $tpl;
$sparkle = '';
if ((activity_match($item['verb'], ACTIVITY_LIKE) || activity_match($item['verb'], ACTIVITY_DISLIKE)) && $item['id'] != $item['parent']) {
continue;
}
$redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'];
$profile_url = zid($item['author']['xchan_url']);
$sparkle = '';
$profile_name = $item['author']['xchan_name'];
$profile_avatar = $item['author']['xchan_photo_m'];
$profile_link = $profile_url;
$drop = '';
if ($observer['xchan_hash'] === $item['author_xchan'] || $observer['xchan_hash'] === $item['owner_xchan']) {
$drop = replace_macros(get_markup_template('photo_drop.tpl'), array('$id' => $item['id'], '$delete' => t('Delete')));
}
$name_e = $profile_name;
$title_e = $item['title'];
unobscure($item);
$body_e = prepare_text($item['body'], $item['mimetype']);
$comments .= replace_macros($template, array('$id' => $item['item_id'], '$mode' => 'photos', '$profile_url' => $profile_link, '$name' => $name_e, '$thumb' => $profile_avatar, '$sparkle' => $sparkle, '$title' => $title_e, '$body' => $body_e, '$ago' => relative_date($item['created']), '$indent' => $item['parent'] != $item['item_id'] ? ' comment' : '', '$drop' => $drop, '$comment' => $comment));
}
if ($can_post || $can_comment) {
$comments .= replace_macros($cmnt_tpl, array('$return_path' => '', '$jsreload' => $return_url, '$type' => 'wall-comment', '$id' => $link_item['id'], '$parent' => $link_item['id'], '$profile_uid' => $owner_uid, '$mylink' => $observer['xchan_url'], '$mytitle' => t('This is you'), '$myphoto' => $observer['xchan_photo_s'], '$comment' => t('Comment'), '$submit' => t('Submit'), '$ww' => ''));
}
}
$paginate = paginate($a);
}
$album_e = array($album_link, $ph[0]['album']);
$like_e = $like;
$dislike_e = $dislike;
$photo_tpl = get_markup_template('photo_view.tpl');
$o .= replace_macros($photo_tpl, array('$id' => $ph[0]['id'], '$album' => $album_e, '$tools' => $tools, '$lock' => $lock, '$photo' => $photo, '$prevlink' => $prevlink, '$nextlink' => $nextlink, '$desc' => $ph[0]['description'], '$tag_hdr' => t('In This Photo:'), '$tags' => $tags, '$edit' => $edit, '$likebuttons' => $likebuttons, '$like' => $like_e, '$dislike' => $dislike_e, '$comments' => $comments, '$paginate' => $paginate));
$a->data['photo_html'] = $o;
return $o;
}
// Default - show recent photos with upload link (if applicable)
//$o = '';
$r = q("SELECT `resource_id`, max(`scale`) AS `scale` FROM `photo` WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s' \n\t\tand ( photo_flags = %d or photo_flags = %d ) {$sql_extra} GROUP BY `resource_id`", intval($a->data['channel']['channel_id']), dbesc('Contact Photos'), dbesc(t('Contact Photos')), intval(PHOTO_NORMAL), intval(PHOTO_PROFILE));
if (count($r)) {
$a->set_pager_total(count($r));
$a->set_pager_itemspage(60);
}
$r = q("SELECT `resource_id`, `id`, `filename`, type, `album`, max(`scale`) AS `scale` FROM `photo`\n\t\tWHERE `uid` = %d AND `album` != '%s' AND `album` != '%s'\n\t\tand ( photo_flags = %d or photo_flags = %d ) \n\t\t{$sql_extra} GROUP BY `resource_id` ORDER BY `created` DESC LIMIT %d , %d", intval($a->data['channel']['channel_id']), dbesc('Contact Photos'), dbesc(t('Contact Photos')), intval(PHOTO_NORMAL), intval(PHOTO_PROFILE), intval($a->pager['start']), intval($a->pager['itemspage']));
$photos = array();
if (count($r)) {
$twist = 'rotright';
foreach ($r as $rr) {
if ($twist == 'rotright') {
$twist = 'rotleft';
} else {
开发者ID:Mauru,项目名称:red,代码行数:67,代码来源:photos.php
示例11: get_webpage_elements
function get_webpage_elements($channel, $type = 'all')
{
$elements = array();
if (!$channel['channel_id']) {
return null;
}
switch ($type) {
case 'all':
// If all, execute all the pages, layouts, blocks case statements
// If all, execute all the pages, layouts, blocks case statements
case 'pages':
$elements['pages'] = null;
$owner = $channel['channel_id'];
$sql_extra = item_permissions_sql($owner);
$r = q("select * from iconfig left join item on iconfig.iid = item.id \n\t\t\t\t\t\t\twhere item.uid = %d and iconfig.cat = 'system' and iconfig.k = 'WEBPAGE' and item_type = %d \n\t\t\t\t\t\t\t{$sql_extra} order by item.created desc", intval($owner), intval(ITEM_TYPE_WEBPAGE));
$pages = null;
if ($r) {
$elements['pages'] = array();
$pages = array();
foreach ($r as $rr) {
unobscure($rr);
//$lockstate = (($rr['allow_cid'] || $rr['allow_gid'] || $rr['deny_cid'] || $rr['deny_gid']) ? 'lock' : 'unlock');
$element_arr = array('type' => 'webpage', 'title' => $rr['title'], 'body' => $rr['body'], 'created' => $rr['created'], 'edited' => $rr['edited'], 'mimetype' => $rr['mimetype'], 'pagetitle' => $rr['v'], 'mid' => $rr['mid'], 'layout_mid' => $rr['layout_mid']);
$pages[$rr['iid']][] = array('url' => $rr['iid'], 'pagetitle' => $rr['v'], 'title' => $rr['title'], 'created' => datetime_convert('UTC', date_default_timezone_get(), $rr['created']), 'edited' => datetime_convert('UTC', date_default_timezone_get(), $rr['edited']), 'bb_element' => '[element]' . base64url_encode(json_encode($element_arr)) . '[/element]');
$elements['pages'][] = $element_arr;
}
}
if ($type !== 'all') {
break;
}
case 'layouts':
$elements['layouts'] = null;
$owner = $channel['channel_id'];
$sql_extra = item_permissions_sql($owner);
$r = q("select * from iconfig left join item on iconfig.iid = item.id \n\t\t\t\t\t\t\twhere item.uid = %d and iconfig.cat = 'system' and iconfig.k = 'PDL' and item_type = %d \n\t\t\t\t\t\t\t{$sql_extra} order by item.created desc", intval($owner), intval(ITEM_TYPE_PDL));
$layouts = null;
if ($r) {
$elements['layouts'] = array();
$layouts = array();
foreach ($r as $rr) {
unobscure($rr);
$elements['layouts'][] = array('type' => 'layout', 'description' => $rr['title'], 'body' => $rr['body'], 'created' => $rr['created'], 'edited' => $rr['edited'], 'mimetype' => $rr['mimetype'], 'name' => $rr['v'], 'mid' => $rr['mid']);
}
}
if ($type !== 'all') {
break;
}
case 'blocks':
$elements['blocks'] = null;
$owner = $channel['channel_id'];
$sql_extra = item_permissions_sql($owner);
$r = q("select iconfig.iid, iconfig.k, iconfig.v, mid, title, body, mimetype, created, edited from iconfig \n\t\t\t\t\t\t\t\tleft join item on iconfig.iid = item.id\n\t\t\t\t\t\t\t\twhere uid = %d and iconfig.cat = 'system' and iconfig.k = 'BUILDBLOCK' \n\t\t\t\t\t\t\t\tand item_type = %d order by item.created desc", intval($owner), intval(ITEM_TYPE_BLOCK));
$blocks = null;
if ($r) {
$elements['blocks'] = array();
$blocks = array();
foreach ($r as $rr) {
unobscure($rr);
$elements['blocks'][] = array('type' => 'block', 'title' => $rr['title'], 'body' => $rr['body'], 'created' => $rr['created'], 'edited' => $rr['edited'], 'mimetype' => $rr['mimetype'], 'name' => $rr['v'], 'mid' => $rr['mid']);
}
}
if ($type !== 'all') {
break;
}
default:
break;
}
return $elements;
}
开发者ID:phellmes,项目名称:hubzilla,代码行数:69,代码来源:import.php
示例12: webpages_content
function webpages_content(&$a)
{
if (argc() > 1) {
$which = argv(1);
} else {
notice(t('Requested profile is not available.') . EOL);
$a->error = 404;
return;
}
$profile = 0;
$channel = $a->get_channel();
if (local_user() && argc() > 2 && argv(2) === 'view') {
$which = $channel['channel_address'];
$profile = argv(1);
}
profile_load($a, $which, $profile);
// Figure out who the page owner is.
$r = q("select channel_id from channel where channel_address = '%s'", dbesc($which));
if ($r) {
$owner = intval($r[0]['channel_id']);
}
// Get the observer, check their permissions
$observer = $a->get_observer();
$ob_hash = $observer ? $observer['xchan_hash'] : '';
$perms = get_all_perms($owner, $ob_hash);
if (!$perms['write_pages']) {
notice(t('Permission denied.') . EOL);
return;
}
// if(local_user() && local_user() == $owner) {
// $a->set_widget('design',design_tools());
// }
if (feature_enabled($owner, 'expert_mode')) {
$mimetype = $_REQUEST['mimetype'] ? $_REQUEST['mimetype'] : get_pconfig($owner, 'system', 'page_mimetype');
if (!$mimetype) {
$mimetype = 'choose';
}
} else {
$mimetype = 'text/bbcode';
}
$layout = $_REQUEST['layout'] ? $_REQUEST['layout'] : get_pconfig($owner, 'system', 'page_layout');
if (!$layout) {
$layout = 'choose';
}
// Create a status editor (for now - we'll need a WYSIWYG eventually) to create pages
// Nickname is set to the observers xchan, and profile_uid to the owners. This lets you post pages at other people's channels.
require_once 'include/conversation.php';
require_once 'include/acl_selectors.php';
if (local_user() && local_user() == $a->profile_uid) {
$channel = $a->get_channel();
$channel_acl = array('allow_cid' => $channel['channel_allow_cid'], 'allow_gid' => $channel['channel_allow_gid'], 'deny_cid' => $channel['channel_deny_cid'], 'deny_gid' => $channel['channel_deny_gid']);
} else {
$channel_acl = array();
}
require_once 'include/conversation.php';
$o = profile_tabs($a, true);
$o .= '<h2>' . t('Webpages') . '</h2>';
$x = array('webpage' => ITEM_WEBPAGE, 'is_owner' => true, 'nickname' => $a->profile['channel_address'], 'lockstate' => $group || $cid || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid'] ? 'lock' : 'unlock', 'bang' => $group || $cid ? '!' : '', 'acl' => local_user() && local_user() == $owner ? populate_acl($channel_acl, false) : '', 'visitor' => true, 'profile_uid' => intval($owner), 'mimetype' => $mimetype, 'layout' => $layout);
if ($_REQUEST['title']) {
$x['title'] = $_REQUEST['title'];
}
if ($_REQUEST['body']) {
$x['body'] = $_REQUEST['body'];
}
if ($_REQUEST['pagetitle']) {
$x['pagetitle'] = $_REQUEST['pagetitle'];
}
$o .= status_editor($a, $x);
// Get a list of webpages. We can't display all them because endless scroll makes that unusable, so just list titles and an edit link.
//TODO - this should be replaced with pagelist_widget
$r = q("select * from item_id left join item on item_id.iid = item.id where item_id.uid = %d and service = 'WEBPAGE' order by item.created desc", intval($owner));
$pages = null;
if ($r) {
$pages = array();
foreach ($r as $rr) {
unobscure($rr);
$pages[$rr['iid']][] = array('url' => $rr['iid'], 'pagetitle' => $rr['sid'], 'title' => $rr['title'], 'created' => datetime_convert('UTC', date_default_timezone_get(), $rr['created']), 'edited' => datetime_convert('UTC', date_default_timezone_get(), $rr['edited']));
}
}
//Build the base URL for edit links
$url = z_root() . "/editwebpage/" . $which;
// This isn't pretty, but it works. Until I figure out what to do with the UI, it's Good Enough(TM).
return $o . replace_macros(get_markup_template("webpagelist.tpl"), array('$baseurl' => $url, '$edit' => t('Edit'), '$pages' => $pages, '$channel' => $which, '$view' => t('View'), '$preview' => t('Preview'), '$actions_txt' => t('Actions'), '$pagelink_txt' => t('Page Link'), '$title_txt' => t('Title'), '$created_txt' => t('Created'), '$edited_txt' => t('Edited')));
}
开发者ID:Mauru,项目名称:red,代码行数:84,代码来源:webpages.php
注:本文中的unobscure函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论