function print_query($q) { if (!$q instanceof SqlQuery) { throw new \Exception('odd input: ' . $q); } $query = htmlentities(nl2br($q->query), ENT_COMPAT, 'UTF-8'); $keywords = array('SELECT ', 'UPDATE ', 'INSERT ', 'DELETE ', 'SHOW ', 'CALL ', ' FROM ', ' SET ', ' WHERE ', ' HAVING ', ' LEFT JOIN ', ' LEFT OUTER JOIN ', ' INNER JOIN ', ' GROUP BY ', ' ORDER BY ', ' ON ', ' AS ', ' AND ', ' OR ', ' LIMIT ', ' BETWEEN ', ' STATUS', ' IS NULL', ' IS NOT NULL', ' DESC', ' ASC', ' != ', 'NOW()', ' DATE(', ' COUNT(', ' DISTINCT(', ' SUM(', ' LENGTH(', ' CHAR_LENGTH(', ' LOWER(', ' RAND(', ' MIN(', ' MAX(', ' SHA1(', ',SHA1('); $decorated = array('<b>SELECT</b> ', '<b>UPDATE</b> ', '<b>INSERT</b> ', '<b>DELETE</b> ', '<b>SHOW</b> ', '<b>CALL</b> ', '<br/><b>FROM</b> ', '<br/><b>SET</b> ', '<br/><b>WHERE</b> ', '<br/><b>HAVING</b> ', '<br/><b>LEFT JOIN</b> ', '<br/><b>LEFT OUTER JOIN</b> ', '<br/><b>INNER JOIN</b> ', '<br/><b>GROUP BY</b> ', '<br/><b>ORDER BY</b> ', ' <b>ON</b> ', ' <b>AS</b> ', ' <b>AND</b> ', ' <b>OR</b> ', ' <b>LIMIT</b> ', ' <b>BETWEEN</b> ', ' <b>STATUS</b>', ' <b>IS NULL</b>', ' <b>IS NOT NULL</b>', ' <b>DESC</b>', ' <b>ASC</b>', ' <b>!=</b> ', '<b>NOW()</b>', ' <b>DATE</b>(', ' <b>COUNT</b>( ', ' <b>DISTINCT</b>( ', ' <b>SUM</b>( ', ' <b>LENGTH</b>( ', ' <b>CHAR_LENGTH</b>( ', ' <b>LOWER</b>( ', ' <b>RAND</b>( ', ' <b>MIN</b>( ', ' <b>MAX</b>( ', ' <b>SHA1</b>( ', ', <b>SHA1</b>( '); $query = str_replace($keywords, $decorated, $query); echo '<div class="cd_sql_row">' . '<div class="' . ($q->prepared ? 'cd_sql_box_p' : 'cd_sql_box') . '">'; if ($q->error) { echo coreButton('Error', '', 'SQL Error'); } else { echo round($q->time, 2) . 's'; } echo '</div><div class="cd_sql_text">'; if ($q->error) { echo 'Error: <b>' . $q->error . '</b><br/><br/>'; } echo $query; if ($q->format) { echo ' (' . $q->format . ')'; } if ($q->params) { echo ': '; $tmp = array(); foreach ($q->params as $param) { $bg_col = 'white'; if (is_int($param)) { $bg_col = '#A2B0FF'; // blueish } else { if (is_float($param)) { $bg_col = '#FF6EDB'; // pink } else { if (is_string($param)) { $bg_col = '#26D938'; // greenish } } } if (is_string($param)) { $tmp[] = '<span style="background-color:' . $bg_col . ';">' . $param . '</span>'; } else { $tmp[] = '<span style="background-color:' . $bg_col . ';">' . serialize($param) . '</span>'; } } echo implode(', ', $tmp); } echo '</div>' . '</div>'; }
<?php require_once 'config.php'; $session->requireLoggedIn(); require 'design_head.php'; if (!empty($_GET['del'])) { deleteWord($_GET['del']); } if (empty($_GET['lang']) || !is_numeric($_GET['lang'])) { echo '<h2>Show words</h2>'; echo 'Select language first<br/><br/>'; $list = getCategories(CATEGORY_LANGUAGE); foreach ($list as $row) { echo '<a href="' . $_SERVER['PHP_SELF'] . '?lang=' . $row['categoryId'] . '">' . $row['categoryName'] . '</a> (' . getWordCount($row['categoryId']) . ' words)<br/>'; } } else { echo '<h2>Show words</h2>'; $langId = $_GET['lang']; $list = getWords($langId); foreach ($list as $row) { coreButton('Delete', $_SERVER['PHP_SELF'] . '?lang=' . $langId . '&del=' . $row['id']); echo $row['word'] . '<br/>'; } } require 'design_foot.php';
/** * Displays the different forums of one root level category + activity details */ function displayForumContentFlat($itemId) { global $db, $config; if (!is_numeric($itemId)) { return false; } echo '<div class="forum_overview_group">'; $data = getForumItem($itemId); $tot_cnt = getForumItemCountFlat($itemId); $pager = makePager($tot_cnt, $config['forum']['topics_per_page']); $list = getForumItems($itemId, false, $pager['limit']); echo $pager['head']; echo '<div class="forum_header">' . getForumDepthHTML(FORUM_FOLDER, $itemId) . '</div>'; echo '<br/>'; echo '<table width="100%" class="forum_overview_table">'; echo '<tr class="forum_subheader">'; echo '<th width=30></th>'; if ($data['parentId'] == 0) { echo '<th>' . t('Forum') . '</th>'; echo '<th width=80>' . t('Author') . '</th>'; echo '<th width=70 align="center">' . t('Topics') . '</th>'; echo '<th width=70 align="center">' . t('Views') . '</th>'; echo '<th width=200>' . t('Last topic') . '</th>'; } else { echo '<th>' . t('Topic') . '</th>'; echo '<th width=80>' . t('Author') . '</th>'; echo '<th width=70 align="center">' . t('Posts') . '</th>'; echo '<th width=70 align="center">' . t('Views') . '</th>'; echo '<th width=200>' . t('Last post') . '</th>'; } echo '</tr>'; $i = 0; foreach ($list as $row) { $i++; echo '<tr class="forum_overview_item_' . ($i % 2 ? 'even' : 'odd') . '">'; echo '<td align="center">'; //icon if ($row['locked']) { echo '<img src="' . coredev_webroot() . 'gfx/icon_locked.png" alt="Locked" title="Locked"/><br/>'; } if ($row['sticky'] == 1) { echo '<img src="' . coredev_webroot() . 'gfx/icon_forum_sticky.png" alt="Sticky" title="Sticky"/>'; } if ($row['sticky'] == 2) { echo '<img src="' . coredev_webroot() . 'gfx/icon_forum_announcement.png" alt="Announcement" title="Announcement"/>'; } else { if ($data['parentId'] == 0) { echo coreButton('Folder'); } else { echo '<img src="' . coredev_webroot() . 'gfx/icon_forum_topic.png" alt="Message" title="Message"/>'; } } echo '</td>'; echo '<td class="forum_item_text">'; //topic/forum //if ($row['sticky'] == 1) echo '<b>Sticky: </b>'; //if ($row['sticky'] == 2) echo '<b>Announcement: </b>'; echo '<a href="forum.php?id=' . $row['itemId'] . '">' . $row['itemSubject'] . '</a><br/>'; echo '</td>'; echo '<td>'; //author echo Users::link($row['authorId'], $row['authorName']); //echo ' '.$row['timeCreated']; echo '</td>'; echo '<td align="center">' . formatNumber(getForumMessageCount($row['itemId'], false)) . '</td>'; echo '<td align="center">' . formatNumber($row['itemRead']) . '</td>'; $lastpost = getForumLastPost($row['itemId']); echo '<td class="forum_item_text">'; //last post/last topic if ($lastpost) { if ($data['parentId'] == 0) { //This is a topic $subject = $lastpost['itemSubject']; if (mb_strlen($subject) > 25) { $subject = mb_substr($subject, 0, 25) . '...'; } echo '<a href="forum.php?id=' . $lastpost['itemId'] . '#post' . $lastpost['itemId'] . '">' . $subject . '</a><br/>'; } else { //This is a post (a reply to a topic) echo '<a href="forum.php?id=' . $row['itemId'] . '#post' . $lastpost['itemId'] . '"><img src="' . coredev_webroot() . 'gfx/icon_forum_post.png" alt="Post"/></a> '; } echo t('by') . ' ' . Users::link($lastpost['userId'], $lastpost['userName']) . '<br/>'; echo formatTime($lastpost['timeCreated']); } else { if ($data['parentId'] == 0) { echo 'No topics'; } else { echo 'No posts'; } } echo '</td>'; echo '</tr>'; } echo '</table>'; echo '</div>'; if ($data['parentId'] == 0) { echo '<br/>'; echo '<div class="forum_overview_group">'; echo '<b>Active topics</b><br/><br/>'; echo 'fixme - list a few of the active topics within the above forums here'; echo '</div>'; } }
foreach ($settings as $set) { if (!empty($_POST['setting_name_' . $set['id']])) { UserSetting::set($user->id, $_POST['setting_name_' . $set['id']], $_POST['setting_val_' . $set['id']]); } } } if (!empty($_POST['grp_id'])) { UserGroupHandler::addToGroup($user->id, $_POST['grp_id']); } if (!empty($_GET['rm_grp'])) { UserGroupHandler::removeFromGroup($user->id, $_GET['rm_grp']); } echo '<h2>Group membership</h2>'; echo 'This user is member of the following groups:<br/>'; foreach (UserGroupHandler::getGroups($user->id) as $g) { echo '<a href="' . relurl_add(array('rm_grp' => $g->getId())) . '">' . coreButton('Delete') . '</a> '; echo ahref('a/usergroup/' . $g->getId(), $g->getName()) . '<br/>'; } echo '<br/>'; echo xhtmlForm('grp'); $x = new XhtmlComponentDropdown(); $x->name = 'grp_id'; $x->setOptions(UserGroup::getIndexedList()); echo $x->render() . ' '; echo xhtmlSubmit('Add'); echo xhtmlFormClose() . '<br/><br/>'; echo '<h2>Password</h2>'; $form = new XhtmlForm('pwd'); $form->disableAutocomplete(); $form->addPassword('change_pwd', 'Change password'); $form->addSubmit('Change');