function pre_run($data = array()) { if (isset($data['enabled']) && $data['enabled'] == 1) { $confirm = true; $cron = true; $this->cron = true; } else { $confirm = phpgw::get_var('confirm', 'bool', 'POST'); $execute = phpgw::get_var('execute', 'bool', 'GET'); } if (isset($data['debug']) && $data['debug']) { $this->debug = true; } else { $this->debug = phpgw::get_var('debug', 'bool'); } if ($confirm) { $this->execute($data); $this->cron_log($cron); // initiated from ui if (!$cron) { $this->confirm($execute = false); } } else { $this->confirm($execute = false); } }
function parse_navbar($force = False) { $navbar = array(); $navbar = execMethod('phpgwapi.menu.get', 'navbar'); $user = $GLOBALS['phpgw']->accounts->get($GLOBALS['phpgw_info']['user']['id']); $var = array('home_url' => $GLOBALS['phpgw']->link('/home.php'), 'home_text' => lang('home'), 'home_icon' => 'icon icon-home', 'about_url' => $GLOBALS['phpgw']->link('/about.php', array('app' => $GLOBALS['phpgw_info']['flags']['currentapp'])), 'about_text' => lang('about'), 'logout_url' => $GLOBALS['phpgw']->link('/logout.php'), 'logout_text' => lang('logout'), 'user_fullname' => $user->__toString()); if ($GLOBALS['phpgw']->acl->check('run', PHPGW_ACL_READ, 'preferences')) { $var['preferences_url'] = $GLOBALS['phpgw']->link('/preferences/index.php'); $var['preferences_text'] = lang('preferences'); } if (isset($GLOBALS['phpgw_info']['user']['apps']['manual'])) { $var['help_url'] = "javascript:openwindow('" . $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'manual.uimanual.help', 'app' => $GLOBALS['phpgw_info']['flags']['currentapp'], 'section' => isset($GLOBALS['phpgw_info']['apps']['manual']['section']) ? $GLOBALS['phpgw_info']['apps']['manual']['section'] : '', 'referer' => phpgw::get_var('menuaction'))) . "','700','600')"; $var['help_text'] = lang('help'); $var['help_icon'] = 'icon icon-help'; } if (isset($GLOBALS['phpgw_info']['user']['apps']['admin'])) { $var['debug_url'] = "javascript:openwindow('" . $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'property.uidebug_json.index')) . "','','')"; $var['debug_text'] = lang('debug'); $var['debug_icon'] = 'icon icon-debug'; } $GLOBALS['phpgw']->template->set_root(PHPGW_TEMPLATE_DIR); $GLOBALS['phpgw']->template->set_file('navbar', 'navbar.tpl'); $flags =& $GLOBALS['phpgw_info']['flags']; $var['current_app_title'] = isset($flags['app_header']) ? $flags['app_header'] : lang($GLOBALS['phpgw_info']['flags']['currentapp']); $flags['menu_selection'] = isset($flags['menu_selection']) ? $flags['menu_selection'] : ''; $GLOBALS['phpgw']->template->set_var($var); $GLOBALS['phpgw']->template->pfp('out', 'navbar'); register_shutdown_function('parse_footer_end'); }
public function list_history() { if ($GLOBALS['phpgw']->acl->check('access_log_access', 1, 'admin')) { $GLOBALS['phpgw']->redirect_link('/index.php'); } $bo = createobject('admin.boaccess_history'); $nextmatches = createobject('phpgwapi.nextmatchs'); $account_id = phpgw::get_var('account_id', 'int', 'REQUEST'); $start = phpgw::get_var('start', 'int', 'GET', 0); $sort = phpgw::get_var('sort', 'int', 'POST', 0); $order = phpgw::get_var('order', 'int', 'POST', 0); $GLOBALS['phpgw_info']['flags']['app_header'] = lang('Admin') . ' - ' . lang('View access log'); $GLOBALS['phpgw_info']['flags']['menu_selection'] = 'admin::admin::access_log'; $GLOBALS['phpgw']->common->phpgw_header(true); $t =& $GLOBALS['phpgw']->template; $t->set_root(PHPGW_APP_TPL); $t->set_file('accesslog', 'accesslog.tpl'); $t->set_block('accesslog', 'list'); $t->set_block('accesslog', 'row'); $t->set_block('accesslog', 'row_empty'); $total_records = $bo->total($account_id); $var = array('nextmatchs_left' => $nextmatches->left('/index.php', $start, $total_records, '&menuaction=admin.uiaccess_history.list_history&account_id=' . $account_id), 'nextmatchs_right' => $nextmatches->right('/index.php', $start, $total_records, '&menuaction=admin.uiaccess_history.list_history&account_id=' . $account_id), 'showing' => $nextmatches->show_hits($total_records, $start), 'lang_loginid' => lang('LoginID'), 'lang_ip' => lang('IP'), 'lang_login' => lang('Login'), 'lang_logout' => lang('Logout'), 'lang_total' => lang('Total')); if ($account_id) { $var['link_return_to_view_account'] = '<a href="' . $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'admin.uiaccounts.view', 'account_id' => $account_id)) . '">' . lang('Return to view account') . '</a>'; $var['lang_last_x_logins'] = lang('Last %1 logins for %2', $total_records, $GLOBALS['phpgw']->common->grab_owner_name($account_id)); } else { $var['lang_last_x_logins'] = lang('Last %1 logins', $total_records); } $t->set_var($var); $records = $bo->list_history($account_id, $start, $order, $sort); if (is_array($records)) { foreach ($records as &$record) { $nextmatches->template_alternate_row_class($t); $var = array('row_loginid' => $record['loginid'], 'row_ip' => $record['ip'], 'row_li' => $record['li'], 'row_lo' => $record['account_id'] ? $record['lo'] : '<b>' . lang($record['sessionid']) . '</b>', 'row_total' => $record['lo'] ? $record['total'] : ' '); $t->set_var($var); $t->fp('rows_access', 'row', true); } } if (!$total_records && $account_id) { $nextmatches->template_alternate_row_class($t); $t->set_var('row_message', lang('No login history exists for this user')); $t->fp('rows_access', 'row_empty', true); } $loggedout = $bo->return_logged_out($account_id); if ($total_records) { $percent = round($loggedout / $total_records * 100); } else { $percent = '0'; } $var = array('footer_total' => lang('Total records') . ': ' . $total_records); if ($account_id) { $var['lang_percent'] = lang('Percent this user has logged out') . ': ' . $percent . '%'; } else { $var['lang_percent'] = lang('Percent of users that logged out') . ': ' . $percent . '%'; } // create the menu on the left, if needed $var['rows'] = createObject('admin.uimenuclass')->createHTMLCode('view_account'); $t->set_var($var); $t->pfp('out', 'list'); }
public function __construct($session = False) { $this->currentapp = $GLOBALS['phpgw_info']['flags']['currentapp']; $this->so = createObject('phpgwapi.custom_fields'); if ($session) { $this->read_sessiondata(); $this->use_session = True; } $start = phpgw::get_var('start', 'int'); $query = phpgw::get_var('query'); $sort = phpgw::get_var('sort'); $order = phpgw::get_var('order'); $filter = phpgw::get_var('filter'); $location = phpgw::get_var('location'); $allrows = phpgw::get_var('allrows', 'bool'); $appname = phpgw::get_var('appname'); if ($start) { $this->start = $start; } else { $this->start = 0; } $this->query = $query; $this->filter = $filter; $this->sort = $sort; $this->order = $order; $this->location = $location; $this->appname = $appname; $this->allrows = $allrows; }
/** * Check logout error code * * @param integer $code Error code * @return string Error message */ function check_logoutcode($code) { switch ($code) { case 1: return lang('You have been successfully logged out'); case 2: return lang('Sorry, your login has expired'); case 5: return lang('Bad login or password'); case 20: return lang('Cannot find the mapping ! (please advice your adminstrator)'); case 21: return lang('you had inactive mapping to %1 account', phpgw::get_var('phpgw_account', 'string', 'GET', '')); case 22: $GLOBALS['phpgw']->session->phpgw_setcookie('sessionid'); $GLOBALS['phpgw']->session->phpgw_setcookie('kp3'); $GLOBALS['phpgw']->session->phpgw_setcookie('domain'); return lang('you seemed to have an active session elsewhere for the domain "%1", now set to expired - please try again', phpgw::get_var('domain', 'string', 'COOKIE')); case 99: return lang('Blocked, too many attempts'); case 10: $GLOBALS['phpgw']->session->phpgw_setcookie('sessionid'); $GLOBALS['phpgw']->session->phpgw_setcookie('kp3'); $GLOBALS['phpgw']->session->phpgw_setcookie('domain'); // fix for bug php4 expired sessions bug if ($GLOBALS['phpgw_info']['server']['sessions_type'] == 'php') { $GLOBALS['phpgw']->session->phpgw_setcookie('phpgwsessid'); } return lang('Your session could not be verified.'); default: return ' '; } }
/** * @param mixed $data * If $data is an array - then the process is run as cron - and will look for $data['function'] to * determine which custom class to load */ function index($data = '') { if (!isset($GLOBALS['phpgw_info']['user']['apps']['admin'])) { return; } if (is_array($data)) { $function = $data['function']; } else { $data = unserialize(urldecode(phpgw::get_var('data'))); $data = phpgw::clean_value($data); if (!isset($data['function'])) { $function = phpgw::get_var('function'); } else { $function = $data['function']; } } // prevent path traversal if (preg_match('/\\.\\./', $function)) { return; } $file = PHPGW_SERVER_ROOT . "/property/inc/cron/{$GLOBALS['phpgw_info']['user']['domain']}/{$function}.php"; if (is_file($file)) { require_once $file; $custom = new $function(); $custom->pre_run($data); } else { echo "no such file: path_to_phpgw_server_root/property/inc/cron/{$GLOBALS['phpgw_info']['user']['domain']}/{$function}.php"; } }
public function get_schedule($id, $module) { $date = new DateTime(phpgw::get_var('date')); // Make sure $from is a monday if ($date->format('w') != 1) { $date->modify('last monday'); } $prev_date = clone $date; $next_date = clone $date; $prev_date->modify('-1 week'); $next_date->modify('+1 week'); $building = $this->read_single($id); $building['buildings_link'] = self::link(array('menuaction' => $module . '.index')); $building['building_link'] = self::link(array('menuaction' => $module . '.show', 'id' => $building['id'])); $building['date'] = $date->format('Y-m-d'); $building['week'] = intval($date->format('W')); $building['year'] = intval($date->format('Y')); $building['prev_link'] = self::link(array('menuaction' => $module . '.schedule', 'id' => $building['id'], 'date' => $prev_date->format('Y-m-d'))); $building['next_link'] = self::link(array('menuaction' => $module . '.schedule', 'id' => $building['id'], 'date' => $next_date->format('Y-m-d'))); for ($i = 0; $i < 7; $i++) { $building['days'][] = array('label' => sprintf('%s<br/>%s %s', lang($date->format('l')), lang($date->format('M')), $date->format('d')), 'key' => $date->format('D')); $date->modify('+1 day'); } return $building; }
function __construct($session = false) { $this->so = CreateObject('sms.soautoreply'); $this->bocommon = CreateObject('sms.bocommon'); if ($session) { $this->read_sessiondata(); $this->use_session = true; } $start = phpgw::get_var('start', 'int', 'REQUEST', 0); $query = phpgw::get_var('query'); $sort = phpgw::get_var('sort'); $order = phpgw::get_var('order'); $filter = phpgw::get_var('filter', 'int'); $cat_id = phpgw::get_var('cat_id', 'int'); $allrows = phpgw::get_var('allrows', 'bool'); $this->start = $start ? $start : 0; if (array_key_exists('query', $_POST) || array_key_exists('query', $_GET)) { $this->query = $query; } if (array_key_exists('filter', $_POST) || array_key_exists('filter', $_GET)) { $this->filter = $filter; } if (array_key_exists('sort', $_POST) || array_key_exists('sort', $_GET)) { $this->sort = $sort; } if (array_key_exists('order', $_POST) || array_key_exists('order', $_GET)) { $this->order = $order; } if (array_key_exists('cat_id', $_POST) || array_key_exists('cat_id', $_GET)) { $this->cat_id = $cat_id; } if ($allrows) { $this->allrows = $allrows; } }
/** * Check form values */ function check_form_values() { $errors = ''; $domains = phpgw::get_var('domains', 'string', 'POST'); if (!is_array($domains)) { $domains = array(); } foreach ($domains as $k => $v) { $deletedomain = phpgw::get_var('deletedomain', 'string', 'POST'); if (isset($deletedomain[$k])) { continue; } if (!$_POST['settings'][$k]['config_pass']) { $errors .= '<br>' . lang("You didn't enter a config password for domain %1", $v); } } $setting = phpgw::get_var('setting', 'string', 'POST'); if (!$setting['HEADER_ADMIN_PASSWORD']) { $errors .= '<br>' . lang("You didn't enter a header admin password"); } if ($errors) { $GLOBALS['phpgw_setup']->html->show_header('Error', True); echo $errors; exit; } }
public function edit() { $id = intval(phpgw::get_var('id', 'GET')); if ($id) { $person = $this->bo->read_single($id); $person['id'] = $id; $person['contactpersons_link'] = self::link(array('menuaction' => 'booking.uicontactperson.index')); $person['edit_link'] = self::link(array('menuaction' => 'booking.uicontactperson.edit', 'id' => $person['id'])); } else { $person = array(); } $errors = array(); if ($_SERVER['REQUEST_METHOD'] == 'POST') { $person = array_merge($person, extract_values($_POST, array('ssn', 'name', 'homepage', 'phone', 'email', 'description'))); $errors = $this->bo->validate($person); if (!$errors) { if ($id) { $receipt = $this->bo->update($person); } else { $receipt = $this->bo->add($person); } $this->redirect(array('menuaction' => $this->module . '.uicontactperson.show', 'id' => $receipt['id'])); } } $this->flash_form_errors($errors); self::add_stylesheet('phpgwapi/js/yahoo/assets/skins/sam/skin.css'); self::add_javascript('yahoo', 'yahoo/yahoo-dom-event', 'yahoo-dom-event.js'); self::add_javascript('yahoo', 'yahoo/element', 'element-min.js'); self::add_javascript('yahoo', 'yahoo/dom', 'dom-min.js'); self::add_javascript('yahoo', 'yahoo/container', 'container_core-min.js'); self::add_javascript('yahoo', 'yahoo/editor', 'simpleeditor-min.js'); self::add_template_file("contactperson_fields"); self::render_template('contactperson_edit', array('person' => $person)); }
public function edit() { $id = intval(phpgw::get_var('id', 'GET')); $activity = $this->bo->read_single($id); $parent_activity = $this->bo->read_single($activity['parent_id']); $activities = $this->bo->fetch_activities(); $activities = $activities['results']; $activity['id'] = $id; $activity['activities_link'] = self::link(array('menuaction' => 'booking.uiactivity.index')); $activity['building_link'] = self::link(array('menuaction' => 'booking.uibuilding.index')); $errors = array(); if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($_POST['parent_id'] == '0') { $_POST['parent_id'] = null; } $activity = array_merge($activity, extract_values($_POST, array('name', 'active', 'description', 'parent_id'))); $errors = $this->bo->validate($activity); if (!$errors) { $receipt = $this->bo->update($activity); $this->redirect(array('menuaction' => 'booking.uiactivity.index')); } } $this->flash_form_errors($errors); $activity['cancel_link'] = self::link(array('menuaction' => 'booking.uiactivity.index')); self::render_template('activity_edit', array('activity' => $activity, 'parent' => $parent_activity, 'activities' => $activities)); }
public function addfiles() { $GLOBALS['phpgw_info']['flags']['xslt_app'] = false; $GLOBALS['phpgw_info']['flags']['noframework'] = true; $GLOBALS['phpgw_info']['flags']['nofooter'] = true; $acl =& $GLOBALS['phpgw']->acl; $acl_add = $acl->check($this->acl_location, PHPGW_ACL_ADD, 'manual'); $acl_edit = $acl->check($this->acl_location, PHPGW_ACL_EDIT, 'manual'); $cat_id = phpgw::get_var('id', 'int'); $check = phpgw::get_var('check', 'bool'); $fileuploader = CreateObject('property.fileuploader'); if (!$acl_add && !$acl_edit) { $GLOBALS['phpgw']->common->phpgw_exit(); } if (!$cat_id) { $GLOBALS['phpgw']->common->phpgw_exit(); } $test = false; if ($test) { if (!empty($_FILES)) { $tempFile = $_FILES['Filedata']['tmp_name']; $targetPath = "{$GLOBALS['phpgw_info']['server']['temp_dir']}/"; $targetFile = str_replace('//', '/', $targetPath) . $_FILES['Filedata']['name']; move_uploaded_file($tempFile, $targetFile); echo str_replace($GLOBALS['phpgw_info']['server']['temp_dir'], '', $targetFile); } $GLOBALS['phpgw']->common->phpgw_exit(); } if ($check) { $fileuploader->check($cat_id, '/manual'); } else { $fileuploader->upload($cat_id, '/manual'); } }
public function __construct($session = false) { $this->so = CreateObject('admin.soconfig'); if ($session) { $this->read_sessiondata(); $this->use_session = true; } $start = phpgw::get_var('start', 'int', 'REQUEST', 0); $query = phpgw::get_var('query'); $sort = phpgw::get_var('sort'); $order = phpgw::get_var('order'); $filter = phpgw::get_var('filter', 'int'); $allrows = phpgw::get_var('allrows', 'bool'); $location_id = phpgw::get_var('location_id', 'int', 'REQUEST', 0); $this->start = $start ? $start : 0; $this->location_id = $location_id ? $location_id : 0; $this->so->set_location($this->location_id); if (array_key_exists('query', $_POST) || array_key_exists('query', $_GET)) { $this->query = $query; } if (array_key_exists('filter', $_POST) || array_key_exists('filter', $_GET)) { $this->filter = $filter; } if (array_key_exists('sort', $_POST) || array_key_exists('sort', $_GET)) { $this->sort = $sort; } if (array_key_exists('order', $_POST) || array_key_exists('order', $_GET)) { $this->order = $order; } if ($allrows) { $this->allrows = $allrows; } }
function __construct($session = false) { $this->so = CreateObject('property.sojasper'); $this->grants =& $this->so->grants; if ($session) { $this->read_sessiondata(); $this->use_session = true; } $start = phpgw::get_var('start', 'int', 'REQUEST', 0); $query = phpgw::get_var('query'); $sort = phpgw::get_var('sort'); $order = phpgw::get_var('order'); $filter = phpgw::get_var('filter', 'int'); $cat_id = phpgw::get_var('cat_id', 'int'); $allrows = phpgw::get_var('allrows', 'bool'); $app = phpgw::get_var('app'); $this->start = $start ? $start : 0; $this->query = isset($_REQUEST['query']) ? $query : $this->query; $this->sort = isset($_REQUEST['sort']) ? $sort : $this->sort; $this->order = isset($_REQUEST['order']) ? $order : $this->order; $this->cat_id = isset($_REQUEST['cat_id']) ? $cat_id : $this->cat_id; $this->user_id = isset($_REQUEST['user_id']) ? $user_id : $this->user_id; $this->allrows = isset($allrows) && $allrows ? $allrows : ''; $this->app = isset($_REQUEST['app']) ? $app : $this->app; }
public function edit() { date_default_timezone_set("Europe/Oslo"); $date = new DateTime(phpgw::get_var('date')); $system_message = array(); $system_message['building_id'] = intval(phpgw::get_var('building_id', 'GET')); $system_message['building_name'] = phpgw::get_var('building_name', 'GET'); $system_message['cancel_link'] = self::link(array('menuaction' => $this->module . '.uisearch.index')); $system_message['created'] = $date->format('Y-m-d H:m'); $errors = array(); if ($_SERVER['REQUEST_METHOD'] == 'POST') { $system_message = array_merge($system_message, extract_values($_POST, array('time', 'title', 'message', 'name', 'phone', 'email'))); if ($system_message['message'] == '') { $errors['system_message'] = lang('Missing title'); } elseif ($system_message['title'] == '') { $errors['system_message'] = lang('Missing message'); } elseif ($system_message['name'] == '') { $errors['system_message'] = lang('Missing name'); } if (!$errors) { $system_message['title'] = $system_message['building_name'] . " - " . $system . $system_message['title']; $receipt = $this->bo->add($system_message); $this->redirect(array('menuaction' => $this->module . '.uibuilding.show.index', 'id' => $system_message['building_id'])); } } $this->flash_form_errors($errors); $this->use_yui_editor(); self::render_template('system_message', array('system_message' => $system_message)); }
function pre_run($data = '') { $cron = false; $dry_run = false; if (isset($data['enabled']) && $data['enabled'] == 1) { $confirm = true; $execute = true; $cron = true; if ($data['suffix']) { $this->suffix = $data['suffix']; } if ($data['dir']) { $this->dir = $data['dir']; } } else { $confirm = phpgw::get_var('confirm', 'bool', 'POST'); $execute = true; //phpgw::get_var('execute', 'bool', 'GET'); if (phpgw::get_var('dir', 'string', 'GET')) { $this->dir = urldecode(phpgw::get_var('dir', 'string', 'GET')); } if (phpgw::get_var('suffix', 'string', 'GET')) { $this->suffix = phpgw::get_var('suffix', 'string', 'GET'); } } if (!$execute) { $dry_run = true; } if ($confirm) { $this->execute($dry_run, $cron); } else { $this->confirm($execute = false); } }
public function query() { // YUI variables for paging and sorting $start_index = phpgw::get_var('startIndex', 'int'); $num_of_objects = phpgw::get_var('results', 'int', 'GET', 10); $sort_field = phpgw::get_var('sort'); $sort_ascending = phpgw::get_var('dir') == 'desc' ? false : true; // Form variables $search_for = phpgw::get_var('query'); $search_type = phpgw::get_var('search_option'); // Create an empty result set $result_objects = array(); $result_count = 0; // TODO: access control $composite_id = phpgw::get_var('composite_id'); $filters = array('composite_id' => $composite_id); $result_objects = rental_sounit::get_instance()->get($start_index, $num_of_objects, $sort_field, $sort_ascending, $search_for, $search_type, $filters); $result_count = rental_sounit::get_instance()->get_count($search_for, $search_type, $filters); $editable = phpgw::get_var('editable') == 'true' ? true : false; //Serialize the documents found $rows = array(); foreach ($result_objects as $result) { if (isset($result)) { if ($result->has_permission(PHPGW_ACL_READ)) { $rows[] = $result->serialize(); } } } //Add context menu columns (actions and labels) array_walk($rows, array($this, 'add_actions'), array($composite_id, $editable)); //Build a YUI result from the data // $result_data = array('results' => $rows, 'total_records' => count($rows)); return $this->yui_results($result_data, 'total_records', 'results'); }
function __construct($session = false) { // $this->so = CreateObject('property.soifc'); $this->bocommon = createObject('property.bocommon'); $this->custom = createObject('property.custom_fields'); $this->acl_location = '.ifc'; if ($session) { $this->read_sessiondata(); $this->use_session = true; } $start = phpgw::get_var('start', 'int', 'REQUEST', 0); $query = phpgw::get_var('query'); $sort = phpgw::get_var('sort'); $order = phpgw::get_var('order'); $filter = phpgw::get_var('filter', 'int'); $cat_id = phpgw::get_var('cat_id', 'int'); $allrows = phpgw::get_var('allrows', 'bool'); if ($start) { $this->start = $start; } else { $this->start = 0; } if (array_key_exists('query', $_POST) || array_key_exists('query', $_GET)) { $this->query = $query; } if (array_key_exists('filter', $_POST) || array_key_exists('filter', $_GET)) { $this->filter = $filter; } if (array_key_exists('sort', $_POST) || array_key_exists('sort', $_GET)) { $this->sort = $sort; } if (array_key_exists('order', $_POST) || array_key_exists('order', $_GET)) { $this->order = $order; } if (array_key_exists('cat_id', $_POST) || array_key_exists('cat_id', $_GET)) { $this->cat_id = $cat_id; } if ($allrows) { $this->allrows = $allrows; } switch ($GLOBALS['phpgw_info']['server']['db_type']) { case 'mssql': $this->dateformat = "M d Y"; $this->datetimeformat = "M d Y g:iA"; break; case 'mysql': $this->dateformat = "Y-m-d"; $this->datetimeformat = "Y-m-d G:i:s"; break; case 'pgsql': $this->dateformat = "Y-m-d"; $this->datetimeformat = "Y-m-d G:i:s"; break; case 'postgres': $this->dateformat = "Y-m-d"; $this->datetimeformat = "Y-m-d G:i:s"; break; } }
/** * Get application name * * @return string Application name */ function check_app() { $app = phpgw::get_var('appname', 'string', 'GET', ''); if (!$app || $app == 'preferences') { return 'common'; } return $app; }
public function purge_log() { if ($GLOBALS['phpgw']->acl->check('error_log_access', 1, 'admin')) { $GLOBALS['phpgw']->redirect_link('/index.php'); } execMethod('admin.bolog.purge_log', phpgw::get_var('account_id', 'int')); $GLOBALS['phpgw']->redirect_link('index.php', array('menuaction', 'admin.uilog.list_log')); }
function search($searchterm) { if ($type = phpgw::get_var('type', 'GET')) { $types = array($type); } else { $types = array('building', 'resource'); //default } $bui_result = $org_result = $res_result = $event_result = array(); if (in_array('building', $types)) { $bui_result = $this->sobuilding->read(array("query" => $searchterm, "sort" => "name", "dir" => "asc", "filters" => array("active" => "1"))); foreach ($bui_result['results'] as &$bui) { $bui['type'] = "building"; $bui['link'] = $GLOBALS['phpgw']->link('/bookingfrontend/', array('menuaction' => 'bookingfrontend.uibuilding.show', 'id' => $bui['id'])); $bui['img_container'] = "building-" . $bui['id']; $bui['img_url'] = $GLOBALS['phpgw']->link('/bookingfrontend/', array('menuaction' => 'bookingfrontend.uidocument_building.index_images', 'filter_owner_id' => $bui['id'], 'phpgw_return_as' => 'json', 'results' => '1')); if (trim($bui['homepage']) != '' && !preg_match("/^http|https:\\/\\//", trim($bui['homepage']))) { $bui['homepage'] = 'http://' . $bui['homepage']; } } } if (in_array('organization', $types)) { $org_result = $this->soorganization->read(array("query" => $searchterm, "sort" => "name", "dir" => "asc", "filters" => array("active" => "1"))); foreach ($org_result['results'] as &$org) { $org['type'] = "organization"; $org['description'] = nl2br(strip_tags($org['description'])); $org['link'] = $GLOBALS['phpgw']->link('/bookingfrontend/', array('menuaction' => 'bookingfrontend.uiorganization.show', 'id' => $org['id'])); if (trim($org['homepage']) != '' && !preg_match("/^http|https:\\/\\//", trim($org['homepage']))) { $org['homepage'] = 'http://' . $org['homepage']; } } } if (in_array('resource', $types)) { $res_result = $this->soresource->read(array("query" => $searchterm, "sort" => "name", "dir" => "asc", "filters" => array("active" => "1"))); foreach ($res_result['results'] as &$res) { $res['name'] = $res['building_name'] . ' / ' . $res['name']; $res['type'] = "resource"; $res['link'] = $GLOBALS['phpgw']->link('/bookingfrontend/', array('menuaction' => 'bookingfrontend.uiresource.show', 'id' => $res['id'])); $res['img_container'] = "resource-" . $res['id']; $res['img_url'] = $GLOBALS['phpgw']->link('/bookingfrontend/', array('menuaction' => 'bookingfrontend.uidocument_resource.index_images', 'filter_owner_id' => $res['id'], 'phpgw_return_as' => 'json', 'results' => '1')); } } if (in_array('event', $types)) { $now = date('Y-m-d'); $expired_conditions = "(bb_event.active != 0 AND bb_event.completed = 0 AND bb_event.from_ > '{$now}' AND bb_event.description != '')"; $event_result = $this->soevent->read(array("query" => $searchterm, "sort" => "name", "dir" => "asc", "filters" => array('where' => $expired_conditions))); foreach ($event_result['results'] as &$event) { $event['name'] = $event['building_name'] . ' / ' . $event['description']; $event['type'] = "Event"; $date = date('Y-m-d', strtotime($event['from_'])); $event_res = $this->soresource->read(array('filters' => array('id' => $event['resources'][0]))); $event['link'] = $GLOBALS['phpgw']->link('/bookingfrontend/', array('menuaction' => 'bookingfrontend.uibuilding.schedule', 'id' => $event_res['results'][0]['building_id'], 'date' => $date)); } } $final_array = array_merge_recursive($bui_result, $org_result, $res_result, $event_result); $final_array['total_records_sum'] = array_sum((array) $final_array['total_records']); return $final_array; }
public function __construct($session = false) { $this->acl_location = '.admin'; if ($session) { $this->read_sessiondata(); $this->use_session = true; } $start = phpgw::get_var('start', 'int', 'REQUEST', 0); }
public static function sort_by_params($a, $b) { static $dir, $key; if (!isset($dir)) { !($dir = phpgw::get_var('dir', 'string', null)) and $dir = 'asc'; !($sort = phpgw::get_var('sort', 'string', null)) and $sort = 'name'; } $retVal = strcmp($a[$sort], $b[$sort]); return $dir == 'desc' ? -$retVal : $retVal; }
/** * Insert system default preferences * * @param integer $defaultgroup the id of the "default" group * * @return void */ function insert_default_prefs($defaultgroup) { $accountid = -2; $defaultprefs = array('common' => array('maxmatchs' => 10, 'template_set' => 'portico', 'theme' => 'portico', 'tz_offset' => 0, 'dateformat' => 'Y/m/d', 'lang' => substr(phpgw::get_var('ConfigLang'), 0, 2), 'timeformat' => 24, 'default_app' => '', 'currency' => '$', 'show_help' => 1), 'addressbook' => array(), 'calendar' => array('workdaystarts' => 9, 'workdayends' => 17, 'weekdaystarts' => 'Monday', 'defaultcalendar' => 'month', 'planner_start_with_group' => $defaultgroup)); foreach ($defaultprefs as $app => $prefs) { $prefs = $GLOBALS['phpgw_setup']->db->db_addslashes(serialize($prefs)); $sql = 'INSERT INTO phpgw_preferences(preference_owner, preference_app, preference_value)' . " VALUES({$accountid}, '{$app}', '{$prefs}')"; $GLOBALS['phpgw_setup']->db->query($sql, __LINE__, __FILE__); } }
public function index_json() { if ($id = intval(phpgw::get_var('id', 'GET'))) { $person = $this->bo->read_single($id); return $this->yui_results(array("totalResultsAvailable" => 1, "results" => $person)); } $persons = $this->bo->read(); array_walk($persons["results"], array($this, "_add_links"), "bookingfrontend.uicontactperson.show"); return $this->yui_results($persons); }
public function index() { $settings = $this->bo->read(); if ($_SERVER['REQUEST_METHOD'] == 'POST') { $settings['booking_async_task_update_reservation_state_enabled'] = phpgw::get_var('booking_async_task_update_reservation_state_enabled', 'bool', 'POST'); $settings['booking_async_task_send_reminder_enabled'] = phpgw::get_var('booking_async_task_send_reminder_enabled', 'bool', 'POST'); $this->bo->update($settings); } self::render_template('async_settings_form', array('settings' => $settings)); }
public function schedule() { $backend = phpgw::get_var('backend', 'GET'); $building = $this->bo->get_schedule(phpgw::get_var('id', 'GET'), "booking.uimassbooking"); $building['application_link'] = self::link(array('menuaction' => 'booking.uiallocation.add', 'building_id' => $building['id'], 'building_name' => $building['name'])); $building['datasource_url'] = self::link(array('menuaction' => 'booking.uibooking.building_schedule', 'building_id' => $building['id'], 'phpgw_return_as' => 'json')); if ($backend == 'true') { $building['date'] = phpgw::get_var('date', 'GET'); } self::add_javascript('booking', 'booking', 'schedule.js'); self::render_template('massbooking_schedule', array('building' => $building, 'backend' => $backend)); }
public function index() { if (phpgw::get_var('phpgw_return_as') == 'json') { return $this->index_json(); } $GLOBALS['phpgw_info']['apps']['manual']['section'] = 'booking_manual'; self::add_javascript('booking', 'booking', 'datatable.js'); phpgwapi_yui::load_widget('datatable'); phpgwapi_yui::load_widget('paginator'); $data = array('form' => array('toolbar' => array('item' => array(array('type' => 'filter', 'name' => 'status', 'text' => lang('Status') . ':', 'list' => array(array('id' => '', 'name' => lang('All')), array('id' => 'NEW', 'name' => lang('NEW')), array('id' => 'PENDING', 'name' => lang('PENDING')), array('id' => 'REJECTED', 'name' => lang('REJECTED')), array('id' => 'ACCEPTED', 'name' => lang('ACCEPTED')))), array('type' => 'autocomplete', 'name' => 'building', 'ui' => 'building', 'text' => lang('Building') . ':'), array('type' => 'text', 'name' => 'query'), array('type' => 'submit', 'name' => 'search', 'value' => lang('Search')), array('type' => 'link', 'value' => $this->show_all_dashboard_applications() ? lang('Show only applications assigned to me') : lang('Show all applications'), 'href' => self::link(array('menuaction' => $this->url_prefix . '.toggle_show_all_dashboard_applications')))))), 'datatable' => array('source' => self::link(array('menuaction' => 'booking.uidashboard.index', 'phpgw_return_as' => 'json')), 'field' => array(array('key' => 'id', 'label' => lang('ID'), 'formatter' => 'YAHOO.booking.formatLink'), array('key' => 'status', 'label' => lang('Status')), array('key' => 'created', 'label' => lang('Created')), array('key' => 'modified', 'label' => lang('Last modified')), array('key' => 'what', 'label' => lang('What')), array('key' => 'activity_name', 'label' => lang('Activity')), array('key' => 'contact_name', 'label' => lang('Contact')), array('key' => 'case_officer_name', 'label' => lang('Case Officer')), array('key' => 'link', 'hidden' => true)))); self::render_template('datatable', $data); }
public function query() { $unit_id = (int) phpgw::get_var('unit_id'); $delegates_data = array(); if (isset($unit_id) && $unit_id > 0) { $delegates_per_org_unit = frontend_bofrontend::get_delegates($unit_id); $delegates_data = array('results' => $delegates_per_org_unit, 'total_records' => count($delegates_per_org_unit)); $editable = phpgw::get_var('editable') == 'true' ? true : false; array_walk($delegates_data['results'], array($this, 'add_actions'), array($unit_id)); } return $this->yui_results($delegates_data, 'total_records', 'results'); }
function __construct($session = false) { $this->so = CreateObject('property.sobudget'); $this->bocommon = CreateObject('property.bocommon'); $this->cats =& $this->so->cats; if ($session) { $this->read_sessiondata(); $this->use_session = true; } $start = phpgw::get_var('start', 'int', 'REQUEST', 0); $query = phpgw::get_var('query'); $sort = phpgw::get_var('sort'); $order = phpgw::get_var('order'); $filter = phpgw::get_var('filter', 'int'); $cat_id = phpgw::get_var('cat_id', 'int'); $dimb_id = phpgw::get_var('dimb_id', 'int'); $org_unit_id = phpgw::get_var('org_unit_id', 'int'); $allrows = phpgw::get_var('allrows', 'bool'); $district_id = phpgw::get_var('district_id', 'int'); $year = phpgw::get_var('year', 'int'); $month = phpgw::get_var('month', 'int'); $grouping = phpgw::get_var('grouping', 'int'); $revision = phpgw::get_var('revision', 'int'); $allrows = phpgw::get_var('allrows', 'bool'); $details = phpgw::get_var('details', 'bool'); $direction = phpgw::get_var('direction'); $this->start = $start; $this->query = $query ? $query : $this->query; $this->direction = $direction ? $direction : $this->direction; if (!$this->direction) { $this->direction = 'expenses'; } $this->filter = isset($filter) && $filter ? $filter : ''; $this->sort = isset($sort) && $sort ? $sort : ''; $this->order = isset($order) && $order ? $order : ''; $this->cat_id = isset($cat_id) && $cat_id ? $cat_id : ''; $this->dimb_id = isset($dimb_id) && $dimb_id ? $dimb_id : ''; //$GLOBALS['phpgw_info']['user']['preferences']['property']['dimb']; $this->org_unit_id = isset($org_unit_id) && $org_unit_id ? $org_unit_id : ''; //$GLOBALS['phpgw_info']['user']['preferences']['property']['org_unit_id']; $this->part_of_town_id = isset($part_of_town_id) && $part_of_town_id ? $part_of_town_id : ''; $this->district_id = isset($district_id) && $district_id ? $district_id : ''; $this->grouping = isset($grouping) && $grouping ? $grouping : ''; $this->revision = isset($revision) && $revision ? $revision : 1; $this->allrows = isset($allrows) && $allrows ? $allrows : ''; $this->year = isset($year) && $year ? $year : date('Y'); $this->month = isset($month) && $month ? $month : 0; $this->details = $details; if (isset($year) && !$this->year == $year && !$GLOBALS['phpgw_info']['menuaction'] == 'property.uibudget.obligations') { $this->grouping = ''; $this->revision = ''; } }