<?php /** * Tool to generate random acronyms of selected language */ require_once 'config.php'; $session->requireLoggedIn(); require 'design_head.php'; echo '<h2>Generate acronyms</h2>'; if (!empty($_POST['acro'])) { $list = generateAcronyms($_POST['lang'], $_POST['acro'], $_POST['amount']); echo 'Acronyms created:<br/>'; d($list); } ?> Enter an acronym and choose the language you want. <form method="post" action=""> Acronym: <input type="text" name="acro"/><br/> Language: <?php echo xhtmlSelectCategory(CATEGORY_LANGUAGE, 0, 'lang'); ?> <br/> Amount: <?php echo xhtmlSelectNumeric('amount', 1, 50); ?> <br/> <input type="submit" class="button" value="Generate"/> </form> <?php require 'design_foot.php';
/** * 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>'; } }
<?php require_once 'config.php'; $session->requireLoggedIn(); if (isset($_POST['title']) && isset($_POST['body']) && isset($_POST['catid'])) { $blogId = addBlog($_POST['catid'], $_POST['title'], $_POST['body']); if ($blogId) { header('Location: blog.php?Blog:' . $blogId); die; } else { die('error saving blog'); } } require 'design_head.php'; echo 'Create a new blog:<br/><br/>'; echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo 'Title:<br/>'; echo '<input type="text" name="title" size="67" maxlength="40"/><br/>'; echo '<br/>'; echo 'Select blog category:<br/>'; echo xhtmlSelectCategory(CATEGORY_BLOG, 0, 'catid'); echo '<br/><br/>'; echo '<textarea name="body" cols="64" rows="24"></textarea><br/><br/>'; echo '<input type="submit" class="button" value="Save"/>'; echo '</form><br/>'; require 'design_foot.php';
require 'design_head.php'; $selectedLang = 0; $text = ''; if (!empty($_POST['text']) && !empty($_POST['lang']) && is_numeric($_POST['lang'])) { $selectedLang = $_POST['lang']; $text = $_POST['text']; analyzeText($selectedLang, $text); } ?> <h2>Add text</h2> Here you can add longer chunks of text, and choose a language.<br/> Each unique words, and their relations with other words within the sentences will be recorded.<br/> Only useful for natural written language.<br/> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> "> Language: <?php echo xhtmlSelectCategory(CATEGORY_LANGUAGE, 0, 'lang', !empty($_POST['lang']) ? $_POST['lang'] : ''); ?> <br/> Text:<br/> <textarea name="text" cols="70" rows="20"></textarea><br/> <input type="submit" class="button" value="Add"/> </form> <?php require 'design_foot.php';
<?php require_once 'config.php'; $session->requireAdmin(); if (!empty($_POST['lang'])) { addCategory(CATEGORY_LANGUAGE, $_POST['lang']); } require 'design_head.php'; ?> <h2>Add new language</h2> These languages already exist: <?php echo xhtmlSelectCategory(CATEGORY_LANGUAGE); ?> <br/><br/> <form method="post" action=""> language: <input type="text" name="lang"/> <input type="submit" class="button" value="Add"/> </form> <?php require 'design_foot.php';