function get_item_description($activity) { global $dbh; global $settings; if ($activity['type'] == 'backed up') { ?> <a href="<?php echo $activity['table']; ?> " target="_blank">File</a> - <?php echo byte_convert($activity['row']); echo file_exists($activity['table']) ? '' : ' - <span class="warning">Missing File!</span>'; } elseif ($activity['type'] == 'error') { $view_error = true ? ellipses($activity['sql']) : $activity['sql']; return '<a href="#" class="dialog_note" title="Error Detail" message="<b>User:</b> ' . get_username($activity['user']) . '<br><b>Page:</b> ' . $activity['table'] . '<br><b>Time:</b> ' . date('M jS Y, g:i:s a', strtotime($activity['datetime'])) . '<br><br>' . str_replace('"', '\\"', strip_tags($activity['sql'])) . '">View Error</a>: ' . $view_error; } elseif ($activity['type'] == 'installed') { return 'Directus install'; } elseif ($activity['table'] == 'directus_users') { return '<a href="users.php">' . $activity['sql'] . '</a> has been added to Directus Users'; } elseif ($activity['table'] == 'directus_media') { // Get name of media $sth = $dbh->prepare("SELECT * FROM `directus_media` WHERE `id` = :id "); $sth->bindParam(':id', $activity['row']); $sth->execute(); if ($row = $sth->fetch()) { $title = $row['title']; } $title = $title ? ellipses($title, 20) : '<i>No title</i>'; $return = '<a href="#" class="open_media" media_id="' . $activity['row'] . '">' . $title . '</a> within Directus Media'; $return .= $activity['sql'] == 'batch' ? ' - <b>Batch upload</b>' : ''; return $return; } elseif ($activity['table'] && $activity['row']) { $first_field = get_primary_field_value($activity['table'], $activity['row']); return '<a href="edit.php?table=' . $activity['table'] . '&item=' . $activity['row'] . '" title="' . ellipses(str_replace('"', '\\"', $first_field), 200) . '">' . ellipses($first_field, 20) . '</a> within ' . uc_table($activity['table']); } }
<th>Description</th> </tr> </thead> <tbody> <?php $query = "SELECT * FROM `directus_users` "; // Hides inactive users from non-administrators if (!$cms_user['admin']) { $query .= "WHERE `active` = '1' "; } $query .= "ORDER BY `active` DESC, `last_login` DESC "; foreach ($dbh->query($query) as $user) { $last_page = explode('?', $user["last_page"]); $page_user_on = uc_convert(basename($last_page[0], ".php")); parse_str($last_page[1], $user_query_string); $table = $user_query_string['table'] ? uc_table($user_query_string['table']) : ''; // Find out the page that users are on based on URL if ($plugin_pos = strpos($user["last_page"], '/plugins/')) { $plugin_name = explode('/', substr($last_page[0], $plugin_pos + 9)); $describe_page_on = uc_convert($plugin_name[0]) . ' Plugin'; } elseif ($page_user_on == 'Edit') { $describe_page_on = $user_query_string['item'] ? 'Editing within <b>' . $table . '</b>' : 'Creating new item in <b>' . $table . '</b>'; } elseif ($page_user_on == 'Index') { $describe_page_on = 'Dashboard'; } elseif ($page_user_on == 'Browse') { $describe_page_on = 'Browsing <b>' . $table . '</b>'; } elseif (!$user["last_page"]) { $describe_page_on = 'Hasn\'t logged in yet'; } else { $describe_page_on = $page_user_on . ' page'; }
function get_rows($table_id, $id = false) { global $dbh; global $cms_user; $results = array(); // Get table name info based on ID... forces to check if table exists $tables = get_tables(); $table = $tables[$table_id]; if ($table) { // If the user has header preferences for this table $results['header_fields'] = false; $results['sort_field'] = false; $sth = $dbh->prepare("SELECT * FROM `directus_preferences` WHERE `user` = :user AND `name` = :name "); $sth->bindParam(':user', $cms_user['id']); $sth->bindParam(':name', $table); $sth->execute(); while ($user_table_preferences = $sth->fetch()) { $results[$user_table_preferences['type']] = $user_table_preferences['value']; } // Set the table names $results['table_id'] = $table_id; $results['name'] = $table; $results['name_uc'] = uc_table($table); // Get and set the table info $table_info = get_rows_info($table); $results['info'] = $table_info['info']; $results['active'] = $table_info['active']; $results['sort'] = $table_info['sort']; $results['num'] = $table_info['num']; $results['fields'] = $table_info['fields']; // Get the rows if ($id != 'bypass') { $query_rows = "SELECT * FROM `{$table}` WHERE 1=1 "; if ($id !== false) { // Check to make sure this is JUST an ID $id = intval($id); // Limit results to just this ID if given $query_rows .= "AND `id` = '{$id}' LIMIT 1 "; $results['item_id'] = $id; } else { ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Add or Update user field sort preference // Clean variables $_GET['direction'] = $_GET['direction'] == 'DESC' ? 'DESC' : 'ASC'; $_GET['sort'] = $_GET['sort'] == 'sort' || in_array($_GET['sort'], $results['fields']) ? $_GET['sort'] : false; if ($_GET['sort'] && $_GET['direction']) { if ($results['sort_field']) { $query = "UPDATE `directus_preferences` SET `value` = :value WHERE `user` = :user AND `name` = :name AND `type` = 'sort_field' "; } else { $query = "INSERT INTO `directus_preferences` SET `value` = :value, `user` = :user, `name` = :name, `type` = 'sort_field' "; } $results['sort_field'] = $_GET['sort'] . ' ' . $_GET['direction']; $sth = $dbh->prepare($query); $sth->bindParam(':user', $cms_user['id']); $sth->bindParam(':name', $table); $sth->bindParam(':value', $results['sort_field']); $sth->execute(); } if ($results['sort_field']) { // Sort by user preferences $query_rows .= $table_info['sort'] ? "ORDER BY " . $results['sort_field'] . ", `sort` ASC " : "ORDER BY " . $results['sort_field'] . " "; } else { // Sort by SORT and ID if there is an sort field, or just ID if not $query_rows .= $table_info['sort'] ? "ORDER BY `sort` ASC, `id` ASC " : "ORDER BY `id` ASC "; } } $results['sql'] = $query_rows; $results['rows'] = array(); $sth = $dbh->query($query_rows); while ($row_rows = $sth->fetch()) { $results['rows'][$row_rows['id']] = $row_rows; } } return $results; } else { return false; } }
function item_message_subject($table, $row) { return uc_table($table) . " Item: " . get_primary_field_value($table, $row); }
</tr> </thead> <tbody class="check_no_rows"> <?php // User privileges // Note: Should check which tables have active/order fields since those would not have options for reordering and deleting foreach ($tables as $key => $value) { ?> <tr> <td class="icon"><img class="icon" src="media/site/icons/database.png" width="16" height="16" /></td> <td class="first_field privileges_toggle_table" link="<?php echo $value; ?> "><div class="wrap"><?php echo uc_table($value); ?> </div></td> <td><input value="<?php echo $value; ?> " priv="all" name="view[]" type="checkbox" <?php echo !$cms_user["admin"] || $user_edit['admin'] ? 'disabled="disabled"' : ''; ?> <?php echo $user_edit["view"] == 'all' || !$user_edit['id'] || $user_edit['admin'] || strpos($user_edit["view"], ',' . $value . ',') !== false ? 'checked="checked"' : ''; ?> /></td> <td><input value="<?php echo $value; ?>
foreach ($visible_tables as $table) { // If table is not hidden and user has access to table, all or is admin OR ALL IS TRUE if ((strpos($cms_user["view"], ',' . $table . ',') !== false || $cms_user["view"] == 'all' || $cms_user["admin"] == '1') && !in_array($table, $settings['table_hidden'])) { $table_info = get_rows_info($table); $add_or_edit = $table_info['num'] == 0 ? '' : '&item=1'; ?> <tr onclick="location.href='<?php echo in_array($table, $settings['table_single']) ? 'edit.php?table=' . $table . $add_or_edit : 'browse.php?table=' . $table; ?> '"> <td class="icon"><img src="media/site/icons/<?php echo in_array($table, $settings['table_single']) ? 'database-arrow' : 'database'; ?> .png" width="16" height="16" /></td> <td class="first_field"><div class="wrap"><?php echo uc_table($table); ?> </div></td> <td class="text_right"><?php echo $table_info['num']; ?> </td> </tr> <?php } } ////////////////////////////////////////////////////////////////////////////// ?> <tr class="item no_rows"><td colspan="3">No tables available</td></tr> </tbody> </table>
\t\t\t\t\t\t\t<th>Nome</th> \t\t\t\t\t\t\t<th>Diagramma</th> \t\t\t\t\t\t\t<th>Descrizione</th> \t\t\t\t\t\t\t<th>Precondizioni</th> \t\t\t\t\t\t\t<th>Postcondizioni</th> \t\t\t\t\t\t\t<th>Padre</th> \t\t\t\t\t\t\t<th>ScenarioPrincipale</th> \t\t\t\t\t\t\t<th>Inclusioni</th> \t\t\t\t\t\t\t<th>Estensioni</th> \t\t\t\t\t\t\t<th>ScenariAlternativi</th> \t\t\t\t\t\t</tr> \t\t\t\t\t</thead> \t\t\t\t\t<tbody> \t\t\t\t\t\t<tr> END; uc_table($row); echo <<<END \t\t\t\t\t\t</tr> \t\t\t\t\t</tbody> \t\t\t\t</table> \t\t\t\t<div id="form"> \t\t\t\t\t<form action="{$absurl}/UseCase/eliminausecase.php?id={$id}" method="post"> \t\t\t\t\t\t<fieldset> \t\t\t\t\t\t\t<input type="hidden" id="timestamp" name="timestamp" value="{$timestamp}" /> \t\t\t\t\t\t\t<p> \t\t\t\t\t\t\t\t<input type="submit" id="yes" name="yes" value="Elimina" /> \t\t\t\t\t\t\t\t<input type="submit" id="no" name="no" value="Annulla" /> \t\t\t\t\t\t\t</p> \t\t\t\t\t\t</fieldset> \t\t\t\t\t</form> \t\t\t\t</div>