/** * Return all project files that were automatically checked out (on edit) by the user * * @param User $user * @return array */ static function closeAutoCheckedoutFilesByUser($user = null) { if (!$user) { $user = logged_user(); } try { $condstr = 'checked_out_by_id = ' . $user->getId() . ' AND was_auto_checked_out = 1 AND checked_out_on <> \'' . EMPTY_DATETIME . '\''; $files = self::findAll(array('conditions' => $condstr)); // findAll if ($files) { foreach ($files as $file) { $file->setWasAutoCheckedAuto($autoCheckOut); $file->setCheckedOutById(0); $file->setCheckedOutOn(EMPTY_DATETIME); $file->setMarkTimestamps(false); $file->save(); } return true; } return false; } catch (Exception $exc) { flash_error(lang('error checkin file')); return false; } }
private function loadPanels($options) { if (!$this->panels) { $contact_pg_ids = ContactPermissionGroups::getPermissionGroupIdsByContactCSV(logged_user()->getId(), false); $this->panels = array(); $sql = "\r\n\t\t\t\tSELECT * FROM " . TABLE_PREFIX . "tab_panels \r\n\t\t\t\tWHERE \r\n\t\t\t\t\tenabled = 1 AND\t\t\t\t\t\r\n\t\t\t\t\t( \t\r\n\t\t\t\t\t\tplugin_id IS NULL OR plugin_id=0 OR\r\n\t\t\t\t\t\tplugin_id IN (SELECT id FROM " . TABLE_PREFIX . "plugins WHERE is_installed = 1 AND is_activated = 1) \r\n\t\t\t\t\t)\r\n\t\t\t\t\tAND id IN (SELECT tab_panel_id FROM " . TABLE_PREFIX . "tab_panel_permissions WHERE permission_group_id IN ({$contact_pg_ids}))\r\n\t\t\t\tORDER BY ordering ASC "; $res = DB::execute($sql); while ($row = $res->fetchRow()) { $object = array("title" => lang($row['title']), "id" => $row['id'], "quickAddTitle" => lang($row['default_controller']), "refreshOnWorkspaceChange" => (bool) $row['refresh_on_context_change'], "defaultController" => $row['default_controller'], "defaultContent" => array("type" => "url", "data" => get_url($row['default_controller'], $row['default_action'])), "enabled" => $row['enabled'], "type" => $row['type'], "tabTip" => lang($row['title'])); if (config_option('show_tab_icons')) { $object["iconCls"] = $row['icon_cls']; } if ($row['initial_controller'] && $row['initial_action']) { $object["initialContent"] = array("type" => "url", "data" => get_url($row['initial_controller'], $row['initial_action'])); } if ($row['id'] == 'more-panel' && config_option('getting_started_step') >= 99) { $object['closable'] = true; if (!user_config_option('settings_closed')) { $this->panels[] = $object; } } else { $this->panels[] = $object; } } } return $this->panels; }
/** * Add permissions for a contact on members * @param array $members_id Array with the ids of members * @param array $rol_permissions Array with the permissions for the user type of the contact * @return null */ function addPermissions($members_id, $rol_permissions) { //permissions $permissions = ""; foreach ($rol_permissions as $permission) { if ($permissions != "") { $permissions .= ','; } $permissions .= '{"pg":"' . $this->getId() . '","o":' . $permission['object_type_id'] . ',"d":' . $permission['can_delete'] . ',"w":' . $permission['can_write'] . ',"r":1}'; } $permissions = "[" . $permissions . "]"; //members $members = array(); foreach ($members_id as $member_id) { $mem = Members::findById($member_id); if (!$mem instanceof Member) { continue; } $members[] = $mem; } //save permissions foreach ($members as $member) { save_member_permissions_background(logged_user(), $member, $permissions); } }
function tickets_dashboard_content($context) { $tickets = ProjectTickets::getOpenTicketsByUser(logged_user()); $context->assign('ticketsheader', lang('open tickets')); $context->assign('tickets', $tickets); $context->includeTemplate(get_template_path('dashboard', 'tickets')); }
function getWebpages($project, $tag = '', $page = 1, $webpages_per_page = 10, $orderBy = 'title', $orderDir = 'ASC', $archived = false) { $orderDir = strtoupper($orderDir); if ($orderDir != "ASC" && $orderDir != "DESC") { $orderDir = "ASC"; } if ($page < 0) { $page = 1; } //$conditions = logged_user()->isMemberOfOwnerCompany() ? '' : ' `is_private` = 0'; if ($tag == '' || $tag == null) { $tagstr = "1=1"; } else { $tagstr = "(SELECT count(*) FROM `" . TABLE_PREFIX . "tags` WHERE `" . TABLE_PREFIX . "project_webpages`.`id` = `" . TABLE_PREFIX . "tags`.`rel_object_id` AND `" . TABLE_PREFIX . "tags`.`tag` = " . DB::escape($tag) . " AND `" . TABLE_PREFIX . "tags`.`rel_object_manager` = 'ProjectWebpages' ) > 0 "; } $permission_str = ' AND (' . permissions_sql_for_listings(ProjectWebpages::instance(), ACCESS_LEVEL_READ, logged_user()) . ')'; if ($project instanceof Project) { $pids = $project->getAllSubWorkspacesCSV(true); $project_str = " AND " . self::getWorkspaceString($pids); } else { $project_str = ""; } if ($archived) { $archived_cond = " AND `archived_by_id` <> 0"; } else { $archived_cond = " AND `archived_by_id` = 0"; } $conditions = $tagstr . $permission_str . $project_str . $archived_cond; return ProjectWebpages::paginate(array("conditions" => $conditions, 'order' => DB::escapeField($orderBy) . " {$orderDir}"), config_option('files_per_page', 10), $page); // paginate }
/** * Create new log entry and return it * * Delete actions are automatically marked as silent if $is_silent value is not provided (not NULL) * * @param ApplicationDataObject $object * @param Project $project * @param DataManager $manager * @param boolean $save Save log object before you save it * @return ApplicationReadLog */ static function createLog(ApplicationDataObject $object, $workspaces, $action = null, $save = true, $log_data = '') { if (is_null($action)) { $action = self::ACTION_READ; } // if if (!self::isValidAction($action)) { throw new Error("'{$action}' is not valid log action"); } // if try { Notifier::notifyAction($object, $action, $log_data); } catch (Exception $ex) { } $manager = $object->manager(); if (!$manager instanceof DataManager) { throw new Error('Invalid object manager'); } // if $log = new ApplicationReadLog(); if (logged_user() instanceof Contact) { $log->setTakenById(logged_user()->getId()); } else { $log->setTakenById(0); } $log->setRelObjectId($object->getObjectId()); $log->setAction($action); if ($save) { $log->save(); } // if return $log; }
function login_check() { global $options; if ($options['login']) { function logged_user($ul) { foreach ($ul as $user => $pass) { if ($_SERVER['PHP_AUTH_USER'] == $user && isset($_SERVER['PHP_AUTH_PW']) && $_SERVER['PHP_AUTH_PW'] == $pass) { return true; } } return false; } if (empty($_SERVER['PHP_AUTH_USER']) && (!empty($_SERVER['HTTP_AUTHORIZATION']) || !empty($_SERVER['REDIRECT_HTTP_AUTHORIZATION']))) { $auth = !empty($_SERVER['HTTP_AUTHORIZATION']) ? $_SERVER['HTTP_AUTHORIZATION'] : $_SERVER['REDIRECT_HTTP_AUTHORIZATION']; if (stripos($auth, 'Basic ') === 0 && strpos($auth = base64_decode(substr($auth, 6)), ':') > 0) { list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':', $auth, 2); } unset($auth); } if (empty($_SERVER['PHP_AUTH_USER']) || !logged_user($options['users'])) { header('WWW-Authenticate: Basic realm="RAPIDLEECH PLUGMOD"'); header('HTTP/1.0 401 Unauthorized'); include 'deny.php'; exit; } } }
function task_list_delete_link() { global $the_task_list; if ($the_task_list->canDelete(logged_user())) { action_link($the_task_list->getDeleteUrl(), '/icons/delete.png', 'delete'); } }
/** * Renders select page box * * @param string $name Name to use in HTML for the select * @param Project $project * @param integer $selected Id of selected element * @param array $attributes Array of additional attributes * @return string */ function wiki_select_page($name, $project, $selected = null, $attributes = null) { if (is_array($attributes)) { if (!isset($attributes['class'])) { $attributes['class'] = 'wiki_select_page'; } } else { $attributes = array('class' => 'wiki_select_page'); } // if $options = array(option_tag(lang('none'), 0)); if (logged_user()->isAdministrator()) { $pages = Wiki::getAllProjectPages($project); } else { $pages = Wiki::getAllProjectPages($project); } if (is_array($pages)) { foreach ($pages as $page) { $option_attributes = $page->getId() == $selected ? array('selected' => 'selected') : null; $options[] = option_tag($page->getObjectName(), $page->getId(), $option_attributes); } // foreach } // if return select_box($name, $options, $attributes); }
function ExecuteQuery() { $this->data = array(); $date = new DateTimeValue(Time()); $notYet = ProjectTasks::findAll(array('conditions' => 'created_by_id = ' . logged_user()->getId() . ' AND ( due_date = \'0000-00-00 00:00:00\' OR due_date > \'' . substr($date->toMySQL(), 0, strpos($date->toMySQL(), ' ')) . "')")); $today = ProjectTasks::findAll(array('conditions' => 'created_by_id = ' . logged_user()->getId() . ' AND due_date = \'' . substr($date->toMySQL(), 0, strpos($date->toMySQL(), ' ')) . "'")); $past = ProjectTasks::findAll(array('conditions' => 'created_by_id = ' . logged_user()->getId() . ' AND due_date > \'1900-01-01 00:00:00\' AND due_date < \'' . substr($date->toMySQL(), 0, strpos($date->toMySQL(), ' ')) . "'")); $value = 0; if (isset($past)) { $value = count($past); } $this->data['values'][0]['labels'][] = 'Overdue'; $this->data['values'][0]['values'][] = $value; $value = 0; if (isset($notYet)) { $value = count($notYet); } $this->data['values'][0]['labels'][] = 'Not yet due'; $this->data['values'][0]['values'][] = $value; $value = 0; if (isset($today)) { $value = count($today); } $this->data['values'][0]['labels'][] = 'Due today'; $this->data['values'][0]['values'][] = $value; }
/** * Render form control * * @param string $control_name * @return string */ function render($control_name) { $value = $this->getValue(); $dimensions = Dimensions::instance()->findAll(); $permission_group_ids = ContactPermissionGroups::getPermissionGroupIdsByContactCSV(logged_user()->getId(), false); $out = ''; foreach ($dimensions as $dim) { /* @var $dim Dimension */ if ($dim->getOptions(1) && isset($dim->getOptions(1)->hidden) && $dim->getOptions(1)->hidden) { continue; } if (!$dim->getDefinesPermissions() || !$dim->deniesAllForContact($permission_group_ids)) { if (array_search($dim->getId(), $value) !== false) { $checked = 1; } else { $checked = 0; } $out .= '<div class="dimension" >'; $out .= label_tag($dim->getName(), null, false, array('style' => 'display:inline;margin:10px;vertical-align:super;')); $out .= checkbox_field($control_name . '[' . $dim->getId() . ']', $checked); $out .= '</div >'; } } $out .= '<input type="hidden" name="' . $control_name . '[0]" value=" ">'; return $out; }
function form_my_tasks_dropdown() { echo '<li class="header"><a href="' . get_url('form', 'index') . '">' . lang('forms') . '</a></li>'; if (ProjectForm::canAdd(logged_user(), active_project())) { echo '<li><a href="' . get_url('form', 'add') . '">' . lang('add form') . '</a></li>'; } // if }
function times_my_tasks_dropdown() { echo '<li class="header"><a href="' . get_url('time', 'index') . '">' . lang('time') . '</a></li>'; if (ProjectTime::canAdd(logged_user(), active_project())) { echo '<li><a href="' . get_url('time', 'add') . '">' . lang('add time') . '</a></li>'; } // if }
function links_my_tasks_dropdown() { echo '<li class="header"><a href="' . get_url('links', 'index') . '">' . lang('links') . '</a></li>'; if (ProjectLink::canAdd(logged_user(), active_project())) { echo '<li><a href="' . get_url('links', 'add_link') . '">' . lang('add link') . '</a></li>'; } // if }
/** * Determine if a user canGoOn to deny access to files in projects * to which the user has not been assigned. * * @access public * @return null */ function canGoOn() { if (active_project() == null || !logged_user()->isProjectUser(active_project())) { flash_error(lang('no access permissions')); $this->redirectTo('dashboard'); } // if }
function countAllowedContacts() { $conditions = ""; if (!can_manage_contacts(logged_user())) { $conditions .= "e.user_type>0 OR e.object_id IN (\r\n\t\t\t\tSELECT st.object_id FROM " . TABLE_PREFIX . "sharing_table st WHERE st.group_id IN (\r\n\t\t\t\t\tSELECT pg.id FROM " . TABLE_PREFIX . "permission_groups pg WHERE pg.type='permission_groups' AND pg.contact_id = " . logged_user()->getId() . "\r\n\t\t\t\t)\r\n\t\t\t)"; } return Contacts::instance()->count($conditions); }
function wiki_my_tasks_dropdown() { echo '<li class="header"><a href="' . get_url('wiki', 'index') . '">' . lang('wiki') . '</a></li>'; if (WikiPage::canAdd(logged_user(), active_project())) { echo '<li><a href="' . get_url('wiki', 'add') . '">' . lang('add wiki page') . '</a></li>'; } // if }
/** * Return files * * @param void * @return array */ function getFiles() { if (is_null($this->files)) { $this->files = ProjectFiles::getByFolder($this, logged_user()->isMemberOfOwnerCompany()); } // if return $this->files; }
function findBySubscriptions($event, $contact = '') { if (!$contact instanceof Contact) { $contact_id = logged_user()->getId(); } else { $contact_id = $contact->getId(); } return ObjectSubscriptions::findOne(array('conditions' => array('`contact_id` = ? AND object_id = ?', $contact_id, $event))); }
function enable_all_context_help() { $context_help_options = UserWsConfigOptions::getOptionsByCategoryName('context help', true); foreach ($context_help_options as $option) { set_user_config_option($option->getName(), true, logged_user()->getId()); } ajx_current("empty"); flash_success(lang('success enable all context help')); }
private function loadPanels($options) { if (! $this->panels) { $contact_pg_ids = ContactPermissionGroups::getPermissionGroupIdsByContactCSV(logged_user()->getId(),false); $this->panels = array(); $sql = " SELECT * FROM " . TABLE_PREFIX . "tab_panels WHERE enabled = 1 AND ( type = 'system' OR plugin_id IN (SELECT id FROM ".TABLE_PREFIX."plugins WHERE is_installed = 1 AND is_activated = 1) ) AND id IN (SELECT tab_panel_id FROM ".TABLE_PREFIX."tab_panel_permissions WHERE permission_group_id IN ($contact_pg_ids)) ORDER BY ordering ASC "; $res = DB::execute ( $sql ); while ( $row = $res->fetchRow () ) { $object = array ( "title" => lang($row ['title']), "id" => $row ['id'], "quickAddTitle" => lang ($row['default_controller']), "refreshOnWorkspaceChange" => (bool) $row ['refresh_on_context_change'] , "defaultController" => $row['default_controller'] , "defaultContent" => array ( "type" => "url", "data" => get_url ( $row ['default_controller'], $row ['default_action'] ) ), "enabled" => $row ['enabled'], "type" => $row ['type'], ); if (config_option('show_tab_icons')) { $object["iconCls"] = $row ['icon_cls']; } if ( $row ['initial_controller'] && $row['initial_action'] ) { $object["initialContent"] = array ( "type" => "url", "data" => get_url ( $row ['initial_controller'], $row ['initial_action'] ) ); } /* if ( $row['title'] == "overview" ) { $object["initialContent"] = array ( "type" => "url", "data" => ROOT_URL ); }*/ $this->panels [] = $object ; } } return $this->panels; }
/** * Construct the ApplicationController * * @param void * @return ApplicationController */ function __construct() { parent::__construct(); prepare_company_website_controller($this, 'administration'); // Access permissios if (!logged_user()->isAdministrator(owner_company())) { flash_error(lang('no access permissions')); $this->redirectTo('dashboard'); } // if }
function show_context_help() { $show_context_help = array_var($_GET, 'show_context_help'); set_user_config_option('show_context_help', $show_context_help, logged_user()->getId()); ajx_current("empty"); if ($show_context_help == 'until_close') { flash_success(lang('success enable context help')); } else { flash_success(lang('success disable context help')); } }
/** * Returns an array containing only the contacts that logged_user can read. * * @return array */ function getAllowedContacts($extra_conds = null) { $result = array(); foreach ($contacts = Contacts::instance()->findAll(array('conditions' => array($extra_conds))) as $c) { /* @var $c Contact */ if ($c->canView(logged_user())) { $result[] = $c; } } return $result; }
function getEventLimits($event, $date, &$event_start, &$event_duration, &$end_modified) { $end_modified = false; if ($event instanceof ProjectEvent) { $event_start = new DateTimeValue($event->getStart()->getTimestamp() + 3600 * logged_user()->getTimezone()); $event_duration = new DateTimeValue($event->getDuration()->getTimestamp() + 3600 * logged_user()->getTimezone()); } else if ($event instanceof ProjectTask) {/* @var $event ProjectTask */ $work_day_start = new DateTimeValue($date->getTimestamp()); $wsd = user_config_option('work_day_start_time'); $work_day_start->setHour(substr($wsd, 0, strpos($wsd, ':'))); $work_day_start->setMinute(substr($wsd, strpos($wsd, ':')+1)); if ($event->getStartDate() instanceof DateTimeValue && $event->getStartDate()->getTimestamp() + 3600 * logged_user()->getTimezone() >= $work_day_start->getTimestamp()) { $event_start = new DateTimeValue($event->getStartDate()->getTimestamp() + 3600 * logged_user()->getTimezone()); } else if (!$event->getStartDate() instanceof DateTimeValue && $event->getTimeEstimate() > 0 && $event->getDueDate() instanceof DateTimeValue) { $event_start = new DateTimeValue($event->getDueDate()->getTimestamp() + 3600 * logged_user()->getTimezone()); $event_start->advance($event->getTimeEstimate() * -60); } else { $event_start = $work_day_start; } $work_day_end = new DateTimeValue($date->getTimestamp()); $wed = user_config_option('work_day_end_time'); $work_day_end->setHour(substr($wed, 0, strpos($wed, ':'))); $work_day_end->setMinute(substr($wed, strpos($wed, ':')+1)); if ($event->getDueDate() instanceof DateTimeValue && $event->getDueDate()->getTimestamp() + 3600 * logged_user()->getTimezone() <= $work_day_end->getTimestamp()) { $event_duration = new DateTimeValue($event->getDueDate()->getTimestamp() + 3600 * logged_user()->getTimezone()); } else if (!$event->getDueDate() instanceof DateTimeValue && $event->getTimeEstimate() > 0 && $event->getStartDate() instanceof DateTimeValue) { $event_duration = new DateTimeValue($event_start->getTimestamp()); $event_duration->advance($event->getTimeEstimate() * 60); } else { $event_duration = $work_day_end; } } $tomorrow = new DateTimeValue($date->getTimestamp()); $tomorrow->add('d', 1); if ($event_duration->getTimestamp() > $tomorrow->getTimestamp()) { $event_duration = new DateTimeValue($tomorrow->getTimestamp()); $end_modified = true; } if ($event_start->getTimestamp() < $date->getTimestamp()) { if (!$event->isRepetitive()) { $event_start = new DateTimeValue($date->getTimestamp()); } else { $event_start->setDay($date->getDay()); $event_start->setMonth($date->getMonth()); $event_start->setYear($date->getYear()); } } }
/** * Create new log entry and return it * * Delete actions are automatically marked as silent if $is_silent value is not provided (not NULL) * * @param ApplicationDataObject $object * @param Project $project * @param DataManager $manager * @param boolean $save Save log object before you save it * @return ApplicationReadLog */ static function createLog(ApplicationDataObject $object, $workspaces, $action = null, $is_private = false, $is_silent = null, $save = true, $log_data = '') { if (is_null($action)) { $action = self::ACTION_READ; } // if if (!self::isValidAction($action)) { throw new Error("'{$action}' is not valid log action"); } // if try { Notifier::notifyAction($object, $action, $log_data); } catch (Exception $ex) { } $manager = $object->manager(); if (!$manager instanceof DataManager) { throw new Error('Invalid object manager'); } // if $log = new ApplicationReadLog(); if (logged_user() instanceof User) { $log->setTakenById(logged_user()->getId()); } else { $log->setTakenById(0); } $log->setRelObjectId($object->getObjectId()); $log->setRelObjectManager(get_class($manager)); $log->setAction($action); if ($save) { $log->save(); } // if if ($save) { if ($workspaces instanceof Project) { $wo = new WorkspaceObject(); $wo->setObject($log); $wo->setWorkspace($workspaces); $wo->save(); } else { if (is_array($workspaces)) { foreach ($workspaces as $w) { if ($w instanceof Project) { $wo = new WorkspaceObject(); $wo->setObject($log); $wo->setWorkspace($w); $wo->save(); } } } } } return $log; }
/** * Prepare search conditions string based on input params * * @param string $search_for Search string * @param Project $project Search in this project * @return array */ function getSearchConditions($search_for, Project $project, $include_private = false) { if (logged_user()->isAdministrator()) { return DB::prepareString('MATCH (`content`) AGAINST (? IN BOOLEAN MODE)', array($search_for)); } if ($include_private) { return DB::prepareString('MATCH (`content`) AGAINST (? IN BOOLEAN MODE) AND `project_id` = ?', array($search_for, $project->getId())); } else { return DB::prepareString('MATCH (`content`) AGAINST (? IN BOOLEAN MODE) AND `project_id` = ? AND `is_private` = ?', array($search_for, $project->getId(), false)); } // if }
/** * Return objects by array of object - object relations * * @param array $relations * @param boolean $exclude_private Exclude private objects * @return array */ static function getObjectsByRelations($relations, $originalObject, $exclude_private = false) { if(!is_array($relations)) return null; $objects = array(); foreach($relations as $relation) { $object = $relation->getOtherObject($originalObject); if (!$object->canView(logged_user())) continue; $objects[] = $object; } // if return count($objects) ? $objects : null; } //getObjectsByRelations
/** * Return Mail accounts by user * * @param user * @return array */ function getMailAccountsByUser(Contact $user) { return MailAccounts::findAll(array("conditions" => "contact_id = " . logged_user()->getId())); /*$accounts = array(); $accountUsers = MailAccountContacts::getByContact($user); foreach ($accountUsers as $au) { $account = $au->getAccount(); if ($account instanceof MailAccount) { $accounts[] = $account; } } return $accounts;*/ }
function connect_error() { global $adminer, $connection, $token, $error, $drivers; if (DB != "") { header("HTTP/1.1 404 Not Found"); page_header(lang('Database') . ": " . h(DB), lang('Invalid database.'), true); } else { if ($_POST["db"] && !$error) { queries_redirect(substr(ME, 0, -1), lang('Databases have been dropped.'), drop_databases($_POST["db"])); } //Encabezado y botones de la parte superior en la seleccion de bases de datos page_header(lang('Select database'), $error, false); echo "<p>\n"; foreach (array('database' => lang('Create new database'), 'privileges' => lang('Privileges'), 'processlist' => lang('Process list'), 'variables' => lang('Variables'), 'status' => lang('Status')) as $key => $val) { if (support($key)) { echo "<a class='btn btn-xs btn-primary' href='" . h(ME) . "{$key}='>{$val}</a>\n"; } } //Presenta informacion de la conexion echo "<p><i class='fa fa-exchange fa-fw'></i> " . lang('%s version: %s through PHP extension %s', $drivers[DRIVER], "<b>" . h($connection->server_info) . "</b>", "<b>{$connection->extension}</b>") . "\n"; echo "<p><i class='fa fa-user fa-fw'></i> " . lang('Logged as: %s', "<b>" . h(logged_user()) . "</b>") . "\n"; //Presenta la lista de bases de datos existentes y los encabezados $databases = $adminer->databases(); if ($databases) { $scheme = support("scheme"); $collations = collations(); echo "<form action='' method='post'>\n"; echo "<table cellspacing='0' class='checkable table table-condensed table-responsive table-hover' onclick='tableClick(event);' ondblclick='tableClick(event, true);'>\n"; echo "<thead><tr>" . (support("database") ? "<th> " : "") . "<th>" . lang('Database') . " - <a class='btn btn-default btn-xs' href='" . h(ME) . "refresh=1'><i class='fa fa-refresh fa-fw'></i> " . lang('Refresh') . "</a>" . "<th>" . lang('Collation') . "<th>" . lang('Tables') . "<th>" . lang('Size') . " - <a class='btn btn-default btn-xs' href='" . h(ME) . "dbsize=1' onclick=\"return !ajaxSetHtml('" . js_escape(ME) . "script=connect');\">" . lang('Compute') . "</a>" . "</thead>\n"; //Presenta la lista de bases de datos $databases = $_GET["dbsize"] ? count_tables($databases) : array_flip($databases); foreach ($databases as $db => $tables) { $root = h(ME) . "db=" . urlencode($db); echo "<tr" . odd() . ">" . (support("database") ? "\n\t\t\t\t\t<td align=center>" . checkbox("db[]", $db, in_array($db, (array) $_POST["db"])) : ""); echo "<th><a href='{$root}'>" . h($db) . "</a>"; $collation = nbsp(db_collation($db, $collations)); echo "<td>" . (support("database") ? "<a href='{$root}" . ($scheme ? "&ns=" : "") . "&database=' title='" . lang('Alter database') . "'>{$collation}</a>" : $collation); echo "<td align='right'><a href='{$root}&schema=' id='tables-" . h($db) . "' title='" . lang('Database schema') . "'>" . ($_GET["dbsize"] ? $tables : "?") . "</a>"; echo "<td align='right' id='size-" . h($db) . "'>" . ($_GET["dbsize"] ? db_size($db) : "?"); echo "\n"; } echo "</table>\n"; //Agrega boton de eliminar echo support("database") ? "<fieldset><legend>" . lang('Selected') . " <span id='selected'></span></legend><div>\n" . "<input type='hidden' name='all' value='' onclick=\"selectCount('selected', formChecked(this, /^db/));\">\n" . "<input class='btn btn-xs btn-danger' type='submit' name='drop' value='" . lang('Drop') . "'" . confirm() . ">\n" . "</div></fieldset>\n" : ""; echo "<script type='text/javascript'>tableCheck();</script>\n"; echo "<input type='hidden' name='token' value='{$token}'>\n"; echo "</form>\n"; } } page_footer("db"); }