<?php /** * $Id$ * * Popupwindow that displays a image resource * * todo: * - display ajax loading wheel in place of image * - hover mouse over image to highlight controls: cut, resize, rotate, convert, etc */ if (empty($_GET['id']) || !is_numeric($_GET['id'])) { die; } $fileId = $_GET['id']; require_once 'find_config.php'; $header = new xhtml_header(); echo $header->render(); echo '<img id="popup_img" src="' . coredev_webroot() . 'api/file.php?id=' . $fileId . '"/>'; ?> <script type="text/javascript"> if (image_loaded('popup_img')) resize_wnd_to_img('popup_img'); </script>
/** * Returns a input field from the passed data, used together with editUserdataSettings() */ function getUserdataInput($row, $fill = false) { $fieldId = $row['fieldId']; if (isset($row['value'])) { $value = stripslashes($row['value']); //doesnt nessecary exist } else { if (!empty($row['settingValue'])) { $value = stripslashes($row['settingValue']); } else { if ($fill) { //look for post data if (!empty($_POST['userdata_' . $fieldId])) { $value = $_POST['userdata_' . $fieldId]; } } } } if (!isset($value)) { //for default values in admin display $value = stripslashes($row['fieldDefault']); } switch ($row['fieldType']) { case USERDATA_TYPE_EMAIL: case USERDATA_TYPE_TEXT: $result = '<td>' . stripslashes($row['fieldName']) . ':</td><td>'; $result .= xhtmlInput('userdata_' . $fieldId, $value, 20, 50); if ($row['fieldType'] == USERDATA_TYPE_EMAIL) { $result .= ' ' . xhtmlImage(coredev_webroot() . 'gfx/icon_mail.png', t('E-mail')) . '<br/>'; //$result .= '<div id="email_valid_'.$fieldId.'">dskksks</div>'; //XXX show email input status (invalid, taken) } if ($row['private']) { $result .= '<br/>' . t('This setting is hidden from other users.'); } $result .= '</td>'; break; case USERDATA_TYPE_TEXTAREA: $result = '<td>' . stripslashes($row['fieldName']) . ':</td><td>'; $result .= '<textarea name="userdata_' . $fieldId . '" rows="6" cols="40">' . $value . '</textarea>'; $result .= '</td>'; break; case USERDATA_TYPE_CHECKBOX: $result = '<td colspan="2">'; $result .= '<input name="userdata_' . $fieldId . '" type="hidden" value="0"/>'; $result .= '<input name="userdata_' . $fieldId . '" id="userdata_' . $fieldId . '" type="checkbox" class="checkbox" value="1"' . ($value == '1' ? ' checked="checked"' : '') . '/>'; $result .= ' <label for="userdata_' . $fieldId . '">' . $row['fieldName'] . '</label>'; $result .= '</td>'; break; case USERDATA_TYPE_AVATAR: $result = '<td>' . stripslashes($row['fieldName']) . ':</td><td>'; $options = getCategoriesByOwner(CATEGORY_USERDATA, $fieldId); foreach ($options as $row) { $result .= '<input name="userdata_' . $fieldId . '" type="radio" id="lab_' . $row['categoryId'] . '" value="' . $row['categoryId'] . '"' . ($row['categoryId'] == $value ? ' checked="checked"' : '') . '/>'; $result .= ' <label for="lab_' . $row['categoryId'] . '">'; $result .= '<img src="' . $row['categoryName'] . '"/>'; $result .= '</label><br/>'; } $result .= '</td>'; break; case USERDATA_TYPE_RADIO: case USERDATA_TYPE_GENDER: $result = '<td>' . stripslashes($row['fieldName']) . ':</td><td>'; $options = getCategoriesByOwner(CATEGORY_USERDATA, $fieldId); foreach ($options as $row) { $result .= '<input name="userdata_' . $fieldId . '" type="radio" id="lab_' . $row['categoryId'] . '" value="' . $row['categoryId'] . '"' . ($row['categoryId'] == $value ? ' checked="checked"' : '') . '/>'; $result .= ' <label for="lab_' . $row['categoryId'] . '">' . $row['categoryName'] . '</label><br/>'; } $result .= '</td>'; break; case USERDATA_TYPE_THEME: case USERDATA_TYPE_SELECT: $result = '<td>' . stripslashes($row['fieldName']) . ':</td><td>'; $result .= xhtmlSelectCategory(CATEGORY_USERDATA, $fieldId, 'userdata_' . $fieldId, $value); $result .= '</td>'; break; case USERDATA_TYPE_IMAGE: $result = '<td>' . stripslashes($row['fieldName']) . ':</td><td>'; if ($value) { $result .= makeThumbLink($value); $result .= '<input name="userdata_' . $fieldId . '_remove" id="userdata_' . $fieldId . '_remove" type="checkbox" class="checkbox"/> '; $result .= '<label for="userdata_' . $fieldId . '_remove">' . t('Delete image') . '</label>'; } else { $result .= '<input name="userdata_' . $fieldId . '" type="file"/>'; } $result .= '</td>'; break; case USERDATA_TYPE_BIRTHDATE: $result = '<td>' . stripslashes($row['fieldName']) . ':</td><td>'; $d = $m = $y = ''; if ($value) { $y = date('Y', strtotime($row['settingValue'])); $m = date('m', strtotime($row['settingValue'])); $d = date('d', strtotime($row['settingValue'])); } else { if (isset($_POST['userdata_' . $fieldId . '_year'])) { if (is_numeric($_POST['userdata_' . $fieldId . '_year'])) { $y = $_POST['userdata_' . $fieldId . '_year']; } if (is_numeric($_POST['userdata_' . $fieldId . '_month'])) { $m = $_POST['userdata_' . $fieldId . '_month']; } if (is_numeric($_POST['userdata_' . $fieldId . '_day'])) { $d = $_POST['userdata_' . $fieldId . '_day']; } } } $result .= '<select name="userdata_' . $fieldId . '_year">'; $result .= '<option value="">- ' . t('Year') . ' -'; for ($j = date('Y') - 100; $j <= date('Y'); $j++) { $result .= '<option value="' . $j . '"' . ($j == $y ? ' selected' : '') . '>' . $j; } $result .= '</select>'; $result .= '<select name="userdata_' . $fieldId . '_month">'; $result .= '<option value="">- ' . t('Month') . ' -'; for ($j = 1; $j <= 12; $j++) { $k = $j; if ($j < 10) { $k = '0' . $k; } $result .= '<option value="' . $k . '"' . ($j == $m ? ' selected' : '') . '>' . $j; } $result .= '</select>'; $result .= '<select name="userdata_' . $fieldId . '_day">'; $result .= '<option value="">- ' . t('Day') . ' -'; for ($j = 1; $j <= 31; $j++) { $result .= '<option value="' . ($j < 10 ? '0' . $j : $j) . '"' . ($j == $d ? ' selected' : '') . '>' . $j; } $result .= '</select>'; $result .= '</td>'; break; case USERDATA_TYPE_BIRTHDATE_SWE: $result = '<td>' . stripslashes($row['fieldName']) . ':</td><td>'; $d = $m = $y = $chk = ''; if ($value) { $result .= date('Y-m-d', strtotime($row['settingValue'])); } else { if (isset($_POST['userdata_' . $fieldId . '_year'])) { if (is_numeric($_POST['userdata_' . $fieldId . '_year'])) { $y = $_POST['userdata_' . $fieldId . '_year']; } if (is_numeric($_POST['userdata_' . $fieldId . '_month'])) { $m = $_POST['userdata_' . $fieldId . '_month']; } if (is_numeric($_POST['userdata_' . $fieldId . '_day'])) { $d = $_POST['userdata_' . $fieldId . '_day']; } if (is_numeric($_POST['userdata_' . $fieldId . '_chk'])) { $chk = $_POST['userdata_' . $fieldId . '_chk']; } } $result .= '<select name="userdata_' . $fieldId . '_year">'; $result .= '<option value="">- ' . t('Year') . ' -'; for ($j = date('Y') - 100; $j <= date('Y'); $j++) { $result .= '<option value="' . $j . '"' . ($j == $y ? ' selected' : '') . '>' . $j; } $result .= '</select>'; $result .= '<select name="userdata_' . $fieldId . '_month">'; $result .= '<option value="">- ' . t('Month') . ' -'; for ($j = 1; $j <= 12; $j++) { $k = $j; if ($j < 10) { $k = '0' . $k; } $result .= '<option value="' . $k . '"' . ($j == $m ? ' selected' : '') . '>' . $j; } $result .= '</select>'; $result .= '<select name="userdata_' . $fieldId . '_day">'; $result .= '<option value="">- ' . t('Day') . ' -'; for ($j = 1; $j <= 31; $j++) { $result .= '<option value="' . ($j < 10 ? '0' . $j : $j) . '"' . ($j == $d ? ' selected' : '') . '>' . $j; } $result .= '</select>'; $result .= '<input type="text" name="userdata_' . $fieldId . '_chk" value="' . $chk . '" size="4" maxlength="4"/>'; } $result .= '</td>'; break; case USERDATA_TYPE_LOCATION_SWE: $result = '<td>' . stripslashes($row['fieldName']) . ':</td><td>'; $result .= '<input name="userdata_' . $fieldId . '" type="text" value="' . $value . '" size="5" maxlength="5"/>'; $result .= '</td>'; break; case USERDATA_TYPE_CELLPHONE: $result = '<td>' . stripslashes($row['fieldName']) . ':</td><td>'; $result .= '<input name="userdata_' . $fieldId . '" type="text" value="' . $value . '" size="12" maxlength="12"/>'; $result .= '</td>'; break; default: die('FATAL: unhandled userdata type in getUserdataInput(): ' . $row['fieldType']); } return $result; }
/** * Displays current user's friend list */ function displayFriendList() { global $h, $db, $config; $userId = $h->session->id; if (!empty($_GET['id']) && is_numeric($_GET['id'])) { $userId = $_GET['id']; } if ($h->session->id != $userId && isset($_GET['addfriend'])) { if ($config['contacts']['friend_requests']) { if (!empty($_POST['type_id'])) { //sends a request to create a contact to user addFriendRequest($userId, $_POST['type_id'], $_POST['msg']); echo 'A request has been sent to the user to create a contact<br/>'; echo 'You will recieve a message when the user responds to the request.<br/><br/>'; return; } echo '<h1>Send friend request</h1>'; echo '<form method="post" action="">'; echo 'So you wish to send a friend request to ' . Users::link($userId) . '?<br/>'; echo 'First, you need to choose relation type: '; echo xhtmlSelectCategory(CATEGORY_CONTACT, 0, 'type_id') . '<br/>'; echo '(Optional) send a message:<br/>'; echo '<textarea name="msg" cols="40" rows="6"></textarea><br/>'; echo '<input type="submit" class="button" value="Send request"/>'; echo '</form>'; return; } else { //directly add contact to own contact list, dont send request setContact(CONTACT_FRIEND, $h->session->id, $userId); } } if ($h->session->id != $userId) { if (isset($_GET['removefriend'])) { removeContact(CONTACT_FRIEND, $userId); } if (hasPendingFriendRequest($userId)) { echo '<div class="item">'; echo 'You already have a pending relation request with this user.<br/><br/>'; echo 'You can remove your pending relation requests by clicking <a href="' . $_SERVER['PHP_SELF'] . '?request_stopwait=' . $userId . '">here</a>.'; echo '</div><br/>'; } else { if (!haveContact(CONTACT_FRIEND, $h->session->id, $userId)) { echo '<a href="?id=' . $userId . '&addfriend">Become friends</a><br/>'; } else { echo '<a href="?id=' . $userId . '&removefriend">Remove friend contact</a><br/>'; } } return; } if ($userId == $h->session->id) { if (!empty($_GET['request_stopwait'])) { removeSentFriendRequest($_GET['request_stopwait']); } if (isset($_GET['request_deny'])) { denyFriendRequest($_GET['request_deny']); } if (isset($_GET['request_accept'])) { acceptFriendRequest($_GET['request_accept']); } $list = getSentFriendRequests(); if (count($list)) { echo 'Your sent friend requests:<br/>'; foreach ($list as $row) { echo '<div class="item">'; echo Users::link($row['recieverId'], $row['recieverName']) . ' - '; echo '<a href="?request_stopwait=' . $row['recieverId'] . '">Remove</a><br/>'; echo '</div><br/>'; } } $list = getRecievedFriendRequests(); if (count($list)) { echo 'Your recieved friend requests:<br/>'; foreach ($list as $row) { echo '<div class="item">'; echo Users::link($row['senderId'], $row['senderName']) . ' wants to be ' . $row['categoryName'] . ' - Do you '; echo '<a href="?request_accept=' . $row['senderId'] . '">Accept</a> or '; echo '<a href="?request_deny=' . $row['senderId'] . '">Deny</a>?<br/>'; if ($row['msg']) { echo 'Personal message: ' . nl2br($row['msg']); } echo '</div><br/>'; } } } $list = getContactsFlat(CONTACT_FRIEND, $userId); if ($h->session->id != $userId) { echo 'Friends:' . Users::getName($userId) . '<br/>'; } else { echo 'Your friend list:<br/>'; } if (!count($list)) { echo 'No friends.'; return; } foreach ($list as $row) { echo '<div class="' . ($row['isOnline'] ? 'friend_online' : 'friend_offline') . '">'; echo Users::link($row['otherUserId'], $row['contactName']); echo '<a href="messages.php?id=' . $row['contactId'] . '"><img src="' . coredev_webroot() . 'gfx/icon_mail.png" alt="Send a message to ' . $row['contactName'] . '"/></a>'; echo '</div>'; } }
echo '<?xml version="1.0" encoding="UTF-8"?>'; echo '<rss version="2.0">'; echo '<channel>'; echo '<title>' . $title . '</title>'; echo '<link>' . $server_url . '</link>'; echo '<description>' . $description . '</description>'; echo '<language>' . $language . '</language>'; echo '<pubDate>' . $publish_date . '</pubDate>'; echo '<copyright>' . $copyright . '</copyright>'; echo '<webMaster>' . $webmaster . '</webMaster>'; echo '<generator>uReply RSS propagator</generator>'; echo '<image>'; echo '<title>image title</title>'; echo '<link>' . $server_url . '</link>'; echo '<description>Click the url</description>'; echo '<url>http://localhost/' . coredev_webroot() . 'gfx/icon_warning_big.png</url>'; echo '<width>82</width>'; echo '<height>45</height>'; echo '</image>'; $path = basename($_GET['pr']); if ($db->escape($path) != $_GET['pr']) { die; } for ($i = 0; $i < count($list); $i++) { if (!$list[$i]['rss_enabled']) { continue; } $item_url = 'http://localhost/' . $path . '/news.php?news=' . $list[$i]['newsId']; echo '<item>'; echo '<title>' . $list[$i]['title'] . '</title>'; echo '<pubDate>' . $list[$i]['timeToPublish'] . '</pubDate>';
function showForumPost($item, $islocked = false) { global $h, $config; $subject = formatUserInputText($item['itemSubject']); $body = formatUserInputText($item['itemBody']); if (!$islocked) { $islocked = $item['locked']; } echo '<a name="post' . $item['itemId'] . '" id="post' . $item['itemId'] . '"></a>'; echo '<table width="100%" class="forum_post_table">'; echo '<tr class="forum_post_item">'; echo '<td valign="top">'; if ($subject) { echo '<h1>' . $subject . '</h1><hr/>'; } echo '<div class="forum_post_details">'; echo '<a href="forum.php?id=' . $item['parentId'] . '#post' . $item['itemId'] . '">'; echo '<img src="' . coredev_webroot() . 'gfx/icon_forum_post.png" alt="Post"/></a> '; echo t('by') . ' ' . Users::link($item['authorId'], $item['authorName']) . ' ' . formatTime($item['timeCreated']); echo '</div><br/>'; echo $body; $signature = loadUserdataSetting($h->session->id, $config['settings']['default_signature']); if ($signature) { echo '<hr/>' . $signature . '<br/>'; } $h->files->showAttachments(FILETYPE_FORUM, $item['itemId']); echo '</td>'; echo '<td width="120" valign="top" class="forum_item_text">'; echo Users::linkThumb($item['authorId'], $item['authorName']) . '<br/><br/>'; echo Users::getMode($item['authorId']) . '<br/>'; //echo 'Join date: '.getUserCreated($item['authorId']).'<br/>'; echo t('Posts') . ': ' . getForumPostsCount($item['authorId']); echo '</td>'; echo '</tr>'; if (!$h->session->id) { echo '</table><br/>'; return; } echo '<tr class="forum_item">'; echo '<td colspan="2" align="right">'; if (!$islocked) { if (forumItemIsDiscussion($item['itemId'])) { echo '<a href="forum_new.php?id=' . $item['itemId'] . '&q=' . $item['itemId'] . '">' . t('Quote') . '</a> '; } else { echo '<a href="forum_new.php?id=' . $item['parentId'] . '&q=' . $item['itemId'] . '">' . t('Quote') . '</a> '; } if ($item['authorId'] == $h->session->id || $h->session->isAdmin) { echo '<a href="forum_edit.php?id=' . $item['itemId'] . '">' . t('Edit') . '</a> '; } } if (!$islocked && $h->session->isAdmin) { echo '<a href="forum_delete.php?id=' . $item['itemId'] . '">' . t('Remove') . '</a> '; } if (forumItemIsDiscussion($item['itemId'])) { echo '<a href="forum_tipsa.php?id=' . $item['itemId'] . '">' . t('Tell a friend') . '</a> '; if ($h->session->isAdmin) { if (!$item['locked']) { echo '<a href="forum_lock.php?id=' . $item['itemId'] . '">' . t('Lock') . '</a> '; } else { echo '<a href="forum_lock.php?id=' . $item['itemId'] . '&unlock">' . t('Unlock') . '</a> '; } echo '<a href="forum_move.php?id=' . $item['itemId'] . '">' . t('Move') . '</a> '; } } if ($h->session->id != $item['authorId']) { echo '<a href="forum_report.php?id=' . $item['itemId'] . '">' . t('Report') . '</a> '; } echo '</td></tr>'; echo '</table><br/>'; }
echo formatTime($row->time_created) . ': '; $creator = User::get($row->created_by); switch ($row->event) { case EVENT_TEXT_CHANGED: echo '<a href="#" onclick="return toggle_el(\'layer_history' . $row->id . '\')">'; echo t('Edited by') . ' ' . $creator->name . ' (' . strlen($row->value) . ' ' . t('characters') . ')</a><br/>'; echo '<div id="layer_history' . $row->id . '" class="revision_entry" style="display: none;">'; echo nl2br(htmlentities($row->value, ENT_COMPAT, 'UTF-8')); echo '</div>'; break; case EVENT_LOCKED: echo '<img src="' . coredev_webroot() . 'gfx/icon_locked.png" width="16" height="16" alt="Locked"/>'; echo ' Locked by ' . $creator->name . '<br/>'; break; case EVENT_UNLOCKED: echo '<img src="' . coredev_webroot() . 'gfx/icon_unlocked.png" width="16" height="16" alt="Unlocked"/>'; echo ' Unlocked by ' . $creator->name . '<br/>'; break; case EVENT_FILE_UPLOADED: echo ' File uploaded by ' . $creator->name . '<br/>'; break; case EVENT_FILE_DELETED: echo ' File deleted by ' . $creator->name . '<br/>'; break; default: throw new \Exception('unknown revision event ' . $row->event); } } } else { echo 'There is no history for this wiki.'; }