function display_app_header($_displayNavbar)
 {
     switch ($_GET['menuaction']) {
         case 'felamimail.uipreferences.editSignature':
             $GLOBALS['phpgw']->js->validate_file('jscode', 'listSignatures', 'felamimail');
             #$GLOBALS['phpgw']->js->set_onload('fm_initEditLayout();');
             break;
         case 'felamimail.uipreferences.listAccountData':
         case 'felamimail.uipreferences.editAccountData':
             $GLOBALS['phpgw']->js->validate_file('jscode', 'editAccountData', 'felamimail');
             $GLOBALS['phpgw']->js->set_onload('javascript:initEditAccountData();');
             break;
         case 'felamimail.uipreferences.listSignatures':
             $GLOBALS['phpgw']->js->validate_file('jscode', 'listSignatures', 'felamimail');
             #$GLOBALS['phpgw']->js->set_onload('javascript:initEditAccountData();');
             break;
         case 'felamimail.uipreferences.listFolder':
         case 'felamimail.uipreferences.addACL':
             $GLOBALS['phpgw']->js->validate_file('tabs', 'tabs', 'felamimail');
             $GLOBALS['phpgw']->js->validate_file('dhtmlxtree', 'js/dhtmlXCommon', 'felamimail');
             $GLOBALS['phpgw']->js->validate_file('dhtmlxtree', 'js/dhtmlXTree', 'felamimail');
             $GLOBALS['phpgw']->js->validate_file('jscode', 'listFolder', 'felamimail');
             $GLOBALS['phpgw']->js->set_onload('javascript:initAll();');
             break;
     }
     $GLOBALS['phpgw_info']['flags']['include_xajax'] = True;
     $GLOBALS['phpgw']->common->phpgw_header();
     if ($_displayNavbar == TRUE) {
         echo parse_navbar();
     }
 }
 function display_app_header()
 {
     $GLOBALS['phpgw']->js->validate_file('jscode', 'editUserdata', 'emailadmin');
     $GLOBALS['phpgw_info']['flags']['include_xajax'] = True;
     $GLOBALS['phpgw']->common->egw_header();
     echo parse_navbar();
 }
 function acllist()
 {
     if (!$GLOBALS['phpgw']->acl->check('run', 1, 'admin')) {
         $this->deny();
     }
     if ($_POST['btnDone']) {
         $GLOBALS['phpgw']->redirect_link('/admin/index.php');
     }
     $GLOBALS['phpgw']->common->phpgw_header();
     echo parse_navbar();
     if ($_POST['btnSave']) {
         foreach ($_POST['catids'] as $cat_id) {
             $this->bo->set_rights($cat_id, $_POST['inputread'][$cat_id], $_POST['inputwrite'][$cat_id]);
         }
     }
     $GLOBALS['phpgw']->template->set_file('acl', 'acl.tpl');
     $GLOBALS['phpgw']->template->set_block('acl', 'cat_list', 'Cblock');
     $GLOBALS['phpgw']->template->set_var(array('title' => $GLOBALS['phpgw_info']['apps']['news_admin']['title'] . ' - ' . lang('Configure Access Permissions'), 'lang_search' => lang('Search'), 'lang_save' => lang('Save'), 'lang_done' => lang('Done'), 'lang_read' => lang('Read permissions'), 'lang_write' => lang('Write permissions'), 'lang_implies' => lang('implies read permission')));
     $left = $this->nextmatchs->left('/index.php', $this->start, $this->bo->catbo->total_records, 'menuaction=news_admin.uiacl.acllist');
     $right = $this->nextmatchs->right('/index.php', $this->start, $this->bo->catbo->total_records, 'menuaction=news_admin.uiacl.acllist');
     $GLOBALS['phpgw']->template->set_var(array('left' => $left, 'right' => $right, 'lang_showing' => $this->nextmatchs->show_hits($this->bo->catbo->total_records, $this->start), 'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'], 'sort_cat' => $this->nextmatchs->show_sort_order($this->sort, 'cat_name', 'cat_name', '/index.php', lang('Category'), '&menuaction=news_admin.uiacl.acllist'), 'query' => $this->query));
     @reset($this->bo->cats);
     while (list(, $cat) = @each($this->bo->cats)) {
         $this->rights = $this->bo->get_rights($cat['id']);
         $tr_color = $this->nextmatchs->alternate_row_color($tr_color);
         $GLOBALS['phpgw']->template->set_var(array('tr_color' => $tr_color, 'catname' => $cat['name'], 'catid' => $cat['id'], 'read' => $this->selectlist(PHPGW_ACL_READ), 'write' => $this->selectlist(PHPGW_ACL_ADD)));
         $GLOBALS['phpgw']->template->parse('Cblock', 'cat_list', True);
     }
     $GLOBALS['phpgw']->template->pfp('out', 'acl', True);
 }
 function import()
 {
     $url = $this->config->config_data['manual_update_url'];
     $from = explode('/', $url);
     $from = count($from) > 2 ? $from[2] : $url;
     $langs = implode(',', array_keys($GLOBALS['phpgw']->translation->get_installed_langs()));
     if ($langs) {
         $url .= (strstr($url, '?') === False ? '?' : '&') . 'lang=' . $langs;
     }
     // only do an incremental update if the langs are unchanged and we already did an update
     if ($langs == $this->config->config_data['manual_langs'] && $this->config->config_data['manual_updated']) {
         $url .= (strstr($url, '?') === False ? '?' : '&') . 'modified=' . (int) $this->config->config_data['manual_updated'];
     }
     $GLOBALS['phpgw_info']['flags']['app_header'] = lang('manual') . ' - ' . lang('download');
     $GLOBALS['phpgw']->common->phpgw_header();
     parse_navbar();
     echo str_pad('<h3>' . lang('Starting import from %1, this might take several minutes (specialy if you start it the first time) ...', '<a href="' . $url . '" target="_blank">' . $from . '</a>') . "</h3>\n", 4096);
     // dirty hack to flushes the buffer;
     @set_time_limit(0);
     $status = xmlwiki::import($url, True);
     $this->config->config_data['manual_updated'] = $status['meta']['exported'];
     $this->config->config_data['manual_langs'] = $langs;
     $this->config->save_repository();
     echo '<h3>' . lang('%1 manual page(s) added or updated', count($status['imported'])) . "</h3>\n";
     $GLOBALS['phpgw']->common->phpgw_footer();
 }
 function display_headers($extras = '')
 {
     //$broadcaster=$GLOBALS['phpgw']->acl->get_specific_rights(
     //$GLOBALS['phpgw']->accounts->name2id('Broadcast'),'phpgw_group');
     //$multicaster = $GLOBALS['phpgw']->acl->get_specific_rights(
     //$GLOBALS['phpgw']->accounts->name2id('Multicast'),'phpgw_group');
     $GLOBALS['phpgw']->template->set_file('_header', 'messenger_header.tpl');
     $GLOBALS['phpgw']->template->set_block('_header', 'global_header');
     $GLOBALS['phpgw']->template->set_var('lang_inbox', '<a href="' . $GLOBALS['phpgw']->link('/index.php', 'menuaction=messenger.uimessenger.inbox') . '">' . lang('Inbox') . '</a>');
     $GLOBALS['phpgw']->template->set_var('lang_archive', '<a href="' . $GLOBALS['phpgw']->link('/index.php', 'menuaction=messenger.uimessenger.archive') . '">' . lang('archive') . '</a>');
     $GLOBALS['phpgw']->template->set_var('lang_compose', '<a href="' . $GLOBALS['phpgw']->link('/index.php', 'menuaction=messenger.uimessenger.compose') . '">' . lang('Compose to single-user') . '</a>');
     if ($this->broadcaster || $this->multicaster) {
         $GLOBALS['phpgw']->template->set_var('lang_compose_multiple', '<a href="' . $GLOBALS['phpgw']->link('/index.php', 'menuaction=messenger.uimessenger.compose_multiple') . '">' . lang('Compose to multi-users') . '</a>');
     }
     if ($extras['nextmatchs_left']) {
         $GLOBALS['phpgw']->template->set_var('nextmatchs_left', $extras['nextmatchs_left']);
     }
     if ($extras['nextmatchs_right']) {
         $GLOBALS['phpgw']->template->set_var('nextmatchs_right', $extras['nextmatchs_right']);
     }
     if ($extras['folder_name']) {
         $GLOBALS['phpgw']->template->set_var('lang_folder_name', lang($extras['folder_name']));
     }
     $GLOBALS['phpgw']->template->fp('app_header', 'global_header');
     $GLOBALS['phpgw']->common->phpgw_header();
     echo parse_navbar();
 }
 public final function edit()
 {
     if (!$GLOBALS['phpgw']->acl->check('run', 1, 'admin')) {
         $GLOBALS['phpgw']->redirect_link('/admin/index.php');
     }
     $webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url'];
     $webserver_url = !empty($webserver_url) ? $webserver_url : '/';
     $GLOBALS['phpgw_info']['flags']['app_header'] = lang('Admin') . ' - ' . lang('Expresso Messenger');
     echo parse_navbar();
     $path_expressoMail = $webserver_url . "/" . $GLOBALS['phpgw_info']['flags']['currentapp'];
     // Get Organizations Ldap
     $organizationsLdap = "<option value='-1'>-- " . lang('Select Organization') . " --</option>";
     if ($orgs = $this->getOrganizations()) {
         foreach ($orgs as $value) {
             $organizationsLdap .= "<option value='" . $value . "'>" . $value . "</option>";
         }
     }
     $current_config = array();
     // Get values
     if ($this->repository->config_data) {
         $current_config = $this->repository->config_data;
     }
     if (isset($current_config['groups_expresso_messenger'])) {
         //Groups Expresso Messenger
         natsort($current_config['groups_expresso_messenger']);
         foreach ($current_config['groups_expresso_messenger'] as $value) {
             $groups = explode(";", $value);
             $groups_expresso_messenger .= "<option value='" . $value . "'>" . $groups[0] . "</option>";
         }
     }
     $GLOBALS['phpgw']->template->set_file(array('expressoMessenger' => 'expressoMessenger.tpl'));
     $GLOBALS['phpgw']->template->set_block('expressoMessenger', 'bodyMessenger');
     $GLOBALS['phpgw']->template->set_var(array('action_url' => $GLOBALS['phpgw']->link('/index.php', 'menuaction=expressoMail.configMessenger.save'), 'lang_add' => lang('Add'), 'lang_cancel' => lang('Cancel'), 'lang_Domain_Jabber' => lang('Domain Jabber'), 'lang_Expresso_Messenger_settings' => lang('Expresso Messenger Settings'), 'lang_enabled_groups' => lang('Enabled groups'), 'lang_groups_ldap' => lang('Groups ldap'), 'lang_organizations' => lang('Organizations'), 'lang_remove' => lang('Remove'), 'lang_save' => lang("Save"), 'lang_URL_for_connecting_via_WebServer' => lang('URL for connecting via WebServer'), 'lang_URL_for_direct_connection' => lang('URL for direct connection'), 'path_expressoMail' => $path_expressoMail, 'value_jabber_url_1' => isset($current_config['jabber_url_1']) ? $current_config['jabber_url_1'] : "", 'value_jabber_url_2' => isset($current_config['jabber_url_2']) ? $current_config['jabber_url_2'] : "", 'value_jabber_domain' => isset($current_config['jabber_domain']) ? $current_config['jabber_domain'] : "", 'value_organizationsLdap' => isset($organizationsLdap) ? $organizationsLdap : "", 'value_groups_expresso_messenger' => isset($groups_expresso_messenger) ? $groups_expresso_messenger : ""));
     $GLOBALS['phpgw']->template->pparse('out', 'bodyMessenger');
 }
 function header()
 {
     if (!@is_object($GLOBALS['phpgw']->js)) {
         $GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript');
     }
     $GLOBALS['phpgw']->js->validate_file('jscode', 'openwindow', 'admin');
     $GLOBALS['phpgw']->common->phpgw_header();
     echo parse_navbar();
 }
 function StartPage()
 {
     if (isset($_REQUEST['bNoHeader'])) {
         return;
     }
     global $phpgw;
     $phpgw->common->phpgw_header();
     echo parse_navbar();
 }
 function display_app_header()
 {
     if (!@is_object($GLOBALS['phpgw']->js)) {
         $GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript');
     }
     $GLOBALS['phpgw']->js->validate_file('foldertree', 'foldertree');
     $GLOBALS['phpgw']->common->phpgw_header();
     echo parse_navbar();
 }
 function list_history()
 {
     $account_id = get_var('account_id', array('GET', 'POST'));
     $start = get_var('start', array('POST'), 0);
     $sort = get_var('sort', array('POST'), 0);
     $order = get_var('order', array('POST'), 0);
     $GLOBALS['phpgw_info']['flags']['app_header'] = lang('Admin') . ' - ' . lang('View access log');
     if (!@is_object($GLOBALS['phpgw']->js)) {
         $GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript');
     }
     $GLOBALS['phpgw']->js->validate_file('jscode', 'openwindow', 'admin');
     $GLOBALS['phpgw']->common->phpgw_header();
     echo parse_navbar();
     $total_records = $this->bo->total($account_id);
     $var = array('th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'], 'nextmatchs_left' => $this->nextmatchs->left('/index.php', $start, $total_records, '&menuaction=admin.uiaccess_history.list_history&account_id=' . $account_id), 'nextmatchs_right' => $this->nextmatchs->right('/index.php', $start, $total_records, '&menuaction=admin.uiaccess_history.list_history&account_id=' . $account_id), 'showing' => $this->nextmatchs->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);
     }
     $this->template->set_var($var);
     $records = $this->bo->list_history($account_id, $start, $order, $sort);
     while (is_array($records) && (list(, $record) = each($records))) {
         $this->nextmatchs->template_alternate_row_color($this->template);
         $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'] : '&nbsp;');
         $this->template->set_var($var);
         $this->template->fp('rows_access', 'row', True);
     }
     if (!$total_records && $account_id) {
         $this->nextmatchs->template_alternate_row_color($this->template);
         $this->template->set_var('row_message', lang('No login history exists for this user'));
         $this->template->fp('rows_access', 'row_empty', True);
     }
     $loggedout = $this->bo->return_logged_out($account_id);
     if ($total_records) {
         $percent = round(10000 * ($loggedout / $total_records) / 100);
     } else {
         $percent = '0';
     }
     $var = array('bg_color' => $GLOBALS['phpgw_info']['themes']['bg_color'], '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
     $menuClass = CreateObject('admin.uimenuclass');
     $var['rows'] = $menuClass->createHTMLCode('view_account');
     $this->template->set_var($var);
     $this->template->pfp('out', 'list');
 }
 public function create_header()
 {
     ob_start();
     $GLOBALS['egw']->common->egw_header();
     parse_navbar();
     $jsVersion = $this->m_tblConfig['JS_VERSION'];
     echo "<link rel='stylesheet' type='text/css' href='" . $GLOBALS['egw']->link('/' . $this->getCurrentApp(false) . '/templates/default/' . $this->m_tblConfig['APP_CSS'] . '/jquery-ui-1.8.16.custom.css') . "' />";
     echo "<link rel='stylesheet' type='text/css' href='" . $GLOBALS['egw']->link('/' . $this->getCurrentApp(false) . '/templates/default/' . $this->m_tblConfig['APP_CSS'] . '/app-custom.css?' . $jsVersion) . "' />";
     echo "<link rel='stylesheet' type='text/css' href='" . $GLOBALS['egw']->link('/' . $this->getCurrentApp(false) . '/templates/default/ui.jqgrid.css') . "' />";
     echo "<link rel='stylesheet' type='text/css' href='" . $GLOBALS['egw']->link('/' . $this->getCurrentApp(false) . '/templates/default/ui.jqgridex.css') . "' />";
     if ($_SESSION[$this->getCurrentApp(false)]['testmode']) {
         echo "<div style='width:100%;text-align:center;color:white;background-color:red;'><strong><blink>WARNING</blink> : Test mode is activated !</strong>\n              <a style='color:white;' href=" . $GLOBALS['egw']->link('/index.php', array('menuaction' => $this->getCurrentApp(false) . '.uietude.startupInterface', 'testmode' => 'false', 'title' => urlencode(lang('testmode')))) . ">Click here to exit test mode</a></div>";
     }
 }
 function draw_form()
 {
     $this->template->set_file(array('manage_cats_t' => 'categorize_contacts.tpl'));
     $list_widget = $this->lists->get_widget();
     $onsubjs = $this->lists->get_onsubmit_js_string();
     $GLOBALS['phpgw']->common->phpgw_header();
     echo parse_navbar();
     $this->template->set_var('action', $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'addressbook.uicategorize_contacts.index')));
     $this->template->set_var('form_name', 'categorize_contacts_form');
     $this->template->set_var('onsubjs', $onsubjs);
     $this->template->set_var('widget_lists', $list_widget);
     $this->template->pfp('out', 'manage_cats_t');
     $GLOBALS['phpgw']->common->phpgw_exit();
 }
 function vfs()
 {
     $this->vfs_shared();
     $this->basedir = $GLOBALS['phpgw_info']['server']['files_dir'];
     $this->working_id = $GLOBALS['phpgw_info']['user']['account_id'];
     $this->working_lid = $GLOBALS['phpgw']->accounts->id2name($this->working_id);
     $this->now = date('Y-m-d');
     /*
        File/dir attributes, each corresponding to a database field.  Useful for use in loops
        If an attribute was added to the table, add it here and possibly add it to
        set_attributes ()
     
        set_attributes now uses this array().   07-Dec-01 skeeter
     */
     $this->attributes[] = 'deleteable';
     $this->attributes[] = 'content';
     /*
        Decide whether to use any actual filesystem calls (fopen(), fread(),
        unlink(), rmdir(), touch(), etc.).  If not, then we're working completely
        in the database.
     */
     $this->file_actions = $GLOBALS['phpgw_info']['server']['file_store_contents'] == 'filesystem' || !$GLOBALS['phpgw_info']['server']['file_store_contents'];
     // test if the files-dir is inside the document-root, and refuse working if so
     //
     if ($this->file_actions && $this->in_docroot($this->basedir)) {
         $GLOBALS['phpgw']->common->phpgw_header();
         if ($GLOBALS['phpgw_info']['flags']['noheader']) {
             echo parse_navbar();
         }
         echo '<p align="center"><font color="red"><b>' . lang('Path to user and group files HAS TO BE OUTSIDE of the webservers document-root!!!') . "</b></font></p>\n";
         $GLOBALS['phpgw']->common->phpgw_exit();
     }
     /*
        These are stored in the MIME-type field and should normally be ignored.
        Adding a type here will ensure it is normally ignored, but you will have to
        explicitly add it to acl_check (), and to any other SELECT's in this file
     */
     $this->meta_types = array('journal', 'journal-deleted');
     /* We store the linked directories in an array now, so we don't have to make the SQL call again */
     if ($GLOBALS['phpgw_info']['server']['db_type'] == 'mssql' || $GLOBALS['phpgw_info']['server']['db_type'] == 'sybase') {
         $query = $GLOBALS['phpgw']->db->query("SELECT directory, name, link_directory, link_name FROM phpgw_vfs WHERE CONVERT(varchar,link_directory) != '' AND CONVERT(varchar,link_name) != ''" . $this->extra_sql(array('query_type' => VFS_SQL_SELECT)), __LINE__, __FILE__);
     } else {
         $query = $GLOBALS['phpgw']->db->query("SELECT directory, name, link_directory, link_name FROM phpgw_vfs WHERE (link_directory IS NOT NULL or link_directory != '') AND (link_name IS NOT NULL or link_name != '')" . $this->extra_sql(array('query_type' => VFS_SQL_SELECT)), __LINE__, __FILE__);
     }
     $this->linked_dirs = array();
     while ($GLOBALS['phpgw']->db->next_record()) {
         $this->linked_dirs[] = $GLOBALS['phpgw']->db->Record;
     }
 }
 /**
  * Show applications user interface.
  */
 function init()
 {
     $GLOBALS['phpgw']->common->phpgw_header();
     echo parse_navbar();
     if ($this->error_report) {
         $old = error_reporting(E_ALL);
     }
     if (is_object($this->ipcManager) == false) {
         echo 'ipc_manager not found';
         return false;
     }
     echo '<table width="100%" border="0"><tr><td><pre>';
     $this->run_test();
     echo '</pre></td></tr></table>';
     if ($this->error_report) {
         error_reporting($old);
     }
     $GLOBALS['phpgw']->common->phpgw_footer();
 }
 public function edit_log_levels()
 {
     if ($GLOBALS['phpgw']->acl->check('error_log_access', 1, 'admin')) {
         $GLOBALS['phpgw']->redirect_link('/index.php');
     }
     // If log_levels have ever been set before, go ahead and set them.
     // There's probably a more correct place to do this.
     if (!isset($GLOBALS['phpgw_info']['server']['log_levels'])) {
         $GLOBALS['phpgw_info']['server']['log_levels'] = array('global_level' => 'E', 'module' => array(), 'user' => array());
     }
     // If they've updated something, save the change.
     $level_type = phpgw::get_var('level_type');
     if ($level_type) {
         $level_key = phpgw::get_var('level_key');
         $new_level = phpgw::get_var($level_type . '_' . $level_key . '_select');
         $this->update_level($level_type, $level_key, $new_level);
     } else {
         $level_key = phpgw::get_var('module_add_name_select');
         if ($level_key) {
             $this->update_level('module', $level_key, phpgw::get_var('module_add_level_select'));
         }
         $level_key = phpgw::get_var('user_add_name_select');
         if ($level_key) {
             $this->update_level('user', $level_key, phpgw::get_var('user_add_level_select'));
         }
     }
     $GLOBALS['phpgw_info']['flags']['app_header'] = lang('Admin') . ' - ' . lang('Edit Log Levels');
     $GLOBALS['phpgw']->common->phpgw_header();
     echo parse_navbar();
     $this->add_modules_list();
     $this->add_users_list();
     $var['lang_set_levels'] = "Set Logging Levels";
     $var['lang_global_level'] = "Global logging level";
     $var['lang_module_level'] = "Module Logging Levels";
     $var['lang_user_level'] = "User Logging Levels";
     $var['global_option'] = $this->create_select_box('global', '', $GLOBALS['phpgw_info']['server']['log_levels']['global_level']);
     $this->template->set_var($var);
     $this->template->pfp('out', 'loglevels');
 }
 function admin($message = NULL)
 {
     unset($GLOBALS['phpgw_info']['flags']['noheader']);
     unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
     $GLOBALS['phpgw_info']['flags']['noappfooter'] = True;
     $GLOBALS['phpgw']->common->phpgw_header();
     echo parse_navbar();
     $p = $GLOBALS['phpgw']->template;
     $p->set_root(PHPGW_APP_TPL);
     $p->set_file(array('fields' => 'fields.tpl'));
     if (!isset($message)) {
         $message = phpgw::get_var('message', 'string', 'GET');
     }
     $var = array('action_url' => $GLOBALS['phpgw']->link($this->base_url, array('menuaction' => 'registration.uimanagefields.submit')), 'message' => $message, 'lang_current_fields' => lang('Current fields:'), 'lang_name_and_shortdesc' => lang('Name (blank unless Text, Textarea, Dropdown, Checkbox; else alphanumeric only)'), 'lang_text' => lang('Text'), 'lang_type' => lang('Type'), 'lang_values_and_shortdesc' => lang('Values (For Dropdown only; comma separated)'), 'lang_required' => lang('Required'), 'lang_remove' => lang('Remove'), 'lang_order' => lang('Order'), 'lang_textarea' => lang('Textarea'), 'lang_dropdown' => lang('Dropdown'), 'lang_checkbox' => lang('Checkbox'), 'lang_email' => lang('Email'), 'lang_first_name' => lang('First Name'), 'lang_last_name' => lang('Last Name'), 'lang_address' => lang('Address'), 'lang_city' => lang('City'), 'lang_state' => lang('State'), 'lang_zip' => lang('ZIP/Postal'), 'lang_country' => lang('Country'), 'lang_gender' => lang('Gender'), 'lang_phone' => lang('Phone'), 'lang_birthday' => lang('Birthday'), 'lang_location' => lang('location'), 'lang_cancel' => lang('Cancel'), 'lang_update_add' => lang('Update/Add'));
     $p->set_var($var);
     $row_color = $GLOBALS['phpgw']->nextmatches->alternate_row_color($row_color);
     $var = array('row_off' => $GLOBALS['phpgw']->nextmatches->alternate_row_color($row_color));
     $p->set_var($var);
     $row_color = $GLOBALS['phpgw']->nextmatches->alternate_row_color($row_color);
     $var = array('row_on' => $GLOBALS['phpgw']->nextmatches->alternate_row_color($row_color));
     $p->set_var($var);
     $p->set_block('fields', 'info', 'info_list');
     $fields = $this->bo->fields;
     foreach ($fields as $num => $field_info) {
         unset($field_required);
         if ($field_info['field_required'] == 'Y') {
             $field_required = "checked";
         }
         $var = array('field_short_name' => $field_info['field_name'], 'field_name' => $field_info['field_name'], 'field_text' => $field_info['field_text'], 'field_type' => $field_info['field_type'], 'field_type_selected_text' => '', 'field_type_selected_textarea' => '', 'field_type_selected_dropdown' => '', 'field_type_selected_checkbox' => '', 'field_type_selected_email' => '', 'field_type_selected_first_name' => '', 'field_type_selected_last_name' => '', 'field_type_selected_address' => '', 'field_type_selected_city' => '', 'field_type_selected_state' => '', 'field_type_selected_zip' => '', 'field_type_selected_country' => '', 'field_type_selected_gender' => '', 'field_type_selected_phone' => '', 'field_type_selected_birthday' => '', 'field_type_selected_location' => '', 'field_type_selected_' . $field_info['field_type'] => 'selected', 'field_values' => $field_info['field_values'], 'field_required' => $field_required, 'field_order' => $field_info['field_order']);
         $p->set_var($var);
         $p->parse('info_list', 'info', True);
     }
     /* Add an empty entry line */
     $var = array('field_short_name' => 'reg_new', 'field_name' => '', 'field_text' => '', 'field_type' => '', 'field_type_selected_text' => '', 'field_type_selected_textarea' => '', 'field_type_selected_dropdown' => '', 'field_type_selected_checkbox' => '', 'field_type_selected_email' => '', 'field_type_selected_first_name' => '', 'field_type_selected_last_name' => '', 'field_type_selected_address' => '', 'field_type_selected_city' => '', 'field_type_selected_state' => '', 'field_type_selected_zip' => '', 'field_type_selected_country' => '', 'field_type_selected_gender' => '', 'field_type_selected_phone' => '', 'field_type_selected_birthday' => '', 'field_type_selected_location' => '', 'field_values' => '', 'field_required' => '', 'field_remove' => '', 'field_order' => '');
     $p->set_var($var);
     $p->parse('info_list', 'info', True);
     $p->pfp('out', 'fields');
 }
 function exportlist()
 {
     if (!$GLOBALS['phpgw']->acl->check('run', 1, 'admin')) {
         $this->deny();
     }
     if ($_POST['btnDone']) {
         $GLOBALS['phpgw']->redirect_link('/admin/index.php');
     }
     $GLOBALS['phpgw']->common->phpgw_header();
     echo parse_navbar();
     if ($_POST['btnSave']) {
         foreach ($_POST['catids'] as $cat_id) {
             $this->bo->saveconfig($cat_id, $_POST['inputconfig'][$cat_id]);
         }
     }
     $GLOBALS['phpgw']->template->set_file('export', 'export.tpl');
     $GLOBALS['phpgw']->template->set_block('export', 'cat_list', 'Cblock');
     $GLOBALS['phpgw']->template->set_block('cat_list', 'config', 'confblock');
     $GLOBALS['phpgw']->template->set_var(array('title' => $GLOBALS['phpgw_info']['apps']['news_admin']['title'] . ' - ' . lang('Configure RSS exports'), 'lang_search' => lang('Search'), 'lang_save' => lang('Save'), 'lang_done' => lang('Done'), 'lang_search' => lang('Search'), 'lang_configuration' => lang('Configuration')));
     $left = $this->nextmatchs->left('/index.php', $this->start, $this->bo->catbo->total_records, 'menuaction=news_admin.uiexport.exportlist');
     $right = $this->nextmatchs->right('/index.php', $this->start, $this->bo->catbo->total_records, 'menuaction=news_admin.uiexport.exportlist');
     $GLOBALS['phpgw']->template->set_var(array('left' => $left, 'right' => $right, 'lang_showing' => $this->nextmatchs->show_hits($this->bo->catbo->total_records, $this->start), 'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'], 'sort_cat' => $this->nextmatchs->show_sort_order($this->sort, 'cat_name', 'cat_name', '/index.php', lang('Category'), '&menuaction=news_admin.uiexport.exportlist'), 'query' => $this->query));
     @reset($this->bo->cats);
     while (list(, $cat) = @each($this->bo->cats)) {
         $config = $this->bo->readconfig($cat['id']);
         $tr_color = $this->nextmatchs->alternate_row_color($tr_color);
         $GLOBALS['phpgw']->template->set_var(array('tr_color' => $tr_color, 'catname' => $cat['name'], 'catid' => $cat['id'], 'lang_type' => lang('Format of export'), 'typeselectlist' => $this->selectlist($this->exporttypes, $config['type']), 'lang_item' => lang('Format for links to items'), 'itemsyntaxselectlist' => $this->selectlist($this->itemsyntaxtypes, $config['itemsyntax'])));
         $GLOBALS['phpgw']->template->set_var('confblock', '');
         foreach (array('title' => lang('Title'), 'link' => lang('Link'), 'description' => lang('description'), 'img_title' => lang('Image Title'), 'img_url' => lang('Image URL'), 'img_link' => lang('Image Link')) as $setting => $label) {
             $GLOBALS['phpgw']->template->set_var(array('setting' => $label, 'value' => '<input size="80" type="text" name="inputconfig[' . $cat['id'] . '][' . $setting . ']" value="' . $config[$setting] . '" />'));
             $GLOBALS['phpgw']->template->parse('confblock', 'config', True);
         }
         $GLOBALS['phpgw']->template->parse('Cblock', 'cat_list', True);
     }
     $GLOBALS['phpgw']->template->pfp('out', 'export', True);
 }
 function export()
 {
     $convert = get_var('convert', 'POST');
     $conv_type = get_var('conv_type', 'POST');
     $fcat_id = get_var('fcat_id', 'POST');
     $download = get_var('download', 'POST');
     $tsvfilename = get_var('tsvfilename', 'POST');
     if ($convert) {
         if ($conv_type == 'none') {
             $GLOBALS['phpgw_info']['flags']['noheader'] = False;
             $GLOBALS['phpgw_info']['flags']['noheader'] = True;
             $GLOBALS['phpgw']->common->phpgw_header();
             echo parse_navbar();
             echo lang('<b>No conversion type &lt;none&gt; could be located.</b>  Please choose a conversion type from the list');
             echo '&nbsp<a href="' . $GLOBALS['phpgw']->link('/index.php', 'menuaction=addressbook.uiXport.export') . '">' . lang('OK') . '</a>';
             $GLOBALS['phpgw']->common->phpgw_footer();
             $GLOBALS['phpgw']->common->phpgw_exit();
         }
         $buffer = $this->bo->export($conv_type, $fcat_id);
         if ($download == 'on' || $conv_type == 'Palm_PDB') {
             // filename, default application/octet-stream, length of file, default nocache True
             $this->browser->content_header($tsvfilename, 'application/x-octet-stream', strlen($buffer));
             echo $buffer;
         } else {
             $GLOBALS['phpgw']->common->phpgw_header();
             echo parse_navbar();
             echo "<pre>\n";
             echo $buffer;
             echo "\n</pre>\n";
             echo '<a href="' . $GLOBALS['phpgw']->link('/index.php', 'menuaction=addressbook.uiXport.export') . '">' . lang('OK') . '</a>';
             $GLOBALS['phpgw']->common->phpgw_footer();
         }
     } else {
         $GLOBALS['phpgw']->common->phpgw_header();
         echo parse_navbar();
         set_time_limit(0);
         $this->template->set_file(array('export' => 'export.tpl'));
         $dir_handle = opendir(PHPGW_APP_INC . SEP . 'export');
         $i = 0;
         $myfilearray = '';
         while ($file = readdir($dir_handle)) {
             if (substr($file, 0, 1) != '.' && is_file(PHPGW_APP_INC . SEP . 'export' . SEP . $file)) {
                 $myfilearray[$i] = $file;
                 $i++;
             }
         }
         closedir($dir_handle);
         sort($myfilearray);
         for ($i = 0; $i < count($myfilearray); $i++) {
             if ($myfilearray[$i] == 'Multiple_VCard') {
                 $fname = lang('multiple vcard');
             } else {
                 $fname = str_replace('_', ' ', $myfilearray[$i]);
             }
             $conv .= '        <option value="' . $myfilearray[$i] . '">' . $fname . '</option>' . "\n";
         }
         $this->template->set_var('lang_none', lang('none'));
         $this->template->set_var('lang_cancel', lang('Cancel'));
         $this->template->set_var('lang_cat', lang('Select Category'));
         $this->template->set_var('lang_export_instructions', lang('Download export file (Uncheck to debug output in browser)'));
         $this->template->set_var('lang_select', lang('Select the type of conversion:'));
         $this->template->set_var('cat_link', $this->cat_option($this->cat_id, False, False));
         $this->template->set_var('cancel_url', $GLOBALS['phpgw']->link('/addressbook/index.php'));
         $this->template->set_var('navbar_bg', $GLOBALS['phpgw_info']['theme']['navbar_bg']);
         $this->template->set_var('navbar_text', $GLOBALS['phpgw_info']['theme']['navbar_text']);
         $this->template->set_var('export_text', lang('Export from Addressbook'));
         $this->template->set_var('action_url', $GLOBALS['phpgw']->link('/index.php', 'menuaction=addressbook.uiXport.export'));
         $this->template->set_var('filename', lang('Export file name'));
         $this->template->set_var('conv', $conv);
         $this->template->set_var('debug', lang(''));
         $this->template->set_var('download', lang('Submit'));
         $this->template->set_var('start', $this->start);
         $this->template->set_var('sort', $this->sort);
         $this->template->set_var('order', $this->order);
         $this->template->set_var('filter', $this->filter);
         $this->template->set_var('query', $this->query);
         $this->template->set_var('cat_id', $this->cat_id);
         $this->template->pparse('out', 'export');
         $GLOBALS['phpgw']->common->phpgw_footer();
     }
 }
 /**
  * Load the phpgw header
  */
 public function phpgw_header($navbar = False)
 {
     // this prevents infinite loops caused by bad code - skwashd jan08
     static $called = false;
     if ($called) {
         return;
     }
     $called = true;
     $tpl_name = $GLOBALS['phpgw_info']['server']['template_set'];
     if (!is_dir(PHPGW_INCLUDE_ROOT . "/phpgwapi/templates/{$tpl_name}/") || !is_readable(PHPGW_INCLUDE_ROOT . "/phpgwapi/templates/{$tpl_name}/head.inc.php")) {
         $tpl_name = 'simple';
     }
     require_once PHPGW_INCLUDE_ROOT . "/phpgwapi/templates/{$tpl_name}/head.inc.php";
     require_once PHPGW_INCLUDE_ROOT . "/phpgwapi/templates/{$tpl_name}/navbar.inc.php";
     if ($navbar) {
         echo parse_navbar();
     }
     /* used for xslt apps without xslt framework */
     if (isset($GLOBALS['phpgw_info']['flags']['xslt_app']) && $GLOBALS['phpgw_info']['flags']['xslt_app']) {
         $GLOBALS['phpgw']->xslttpl->add_file('app_data');
     }
 }
 function send_group()
 {
     $GLOBALS['phpgw_info']['flags']['menu_selection'] .= '::outbox';
     $GLOBALS['phpgw_info']['flags']['xslt_app'] = false;
     $GLOBALS['phpgw_info']['flags']['app_header'] = lang('SMS') . '::' . lang('Send broadcast SMS');
     $GLOBALS['phpgw_info']['flags']['java_script'] .= "\n" . '<script language="JavaScript">' . "\n" . 'function SmsCountKeyUp(maxChar)' . "\n" . '{' . "\n" . '    var msg  = document.forms.fm_sendsms.message;' . "\n" . '    var left = document.forms.fm_sendsms.charNumberLeftOutput;' . "\n" . '    var smsLenLeft = maxChar  - msg.value.length;' . "\n" . '    if (smsLenLeft >= 0) ' . "\n" . '    {' . "\n" . '	left.value = smsLenLeft;' . "\n" . '    } ' . "\n" . '    else ' . "\n" . '    {' . "\n" . '	var msgMaxLen = maxChar;' . "\n" . '	left.value = 0;' . "\n" . '	msg.value = msg.value.substring(0, msgMaxLen);' . "\n" . '    }' . "\n" . '}' . "\n" . 'function SmsCountKeyDown(maxChar)' . "\n" . '{' . "\n" . '    var msg  = document.forms.fm_sendsms.message;' . "\n" . '    var left = document.forms.fm_sendsms.charNumberLeftOutput;' . "\n" . '    var smsLenLeft = maxChar  - msg.value.length;' . "\n" . '    if (smsLenLeft >= 0) ' . "\n" . '    {' . "\n" . '	left.value = smsLenLeft;' . "\n" . '    } ' . "\n" . '    else ' . "\n" . '    {' . "\n" . '	var msgMaxLen = maxChar;' . "\n" . '	left.value = 0; ' . "\n" . '	msg.value = msg.value.substring(0, msgMaxLen);' . "\n" . '    }' . "\n" . '}' . "\n" . "</script>\n";
     $GLOBALS['phpgw']->common->phpgw_header();
     echo parse_navbar();
     $message = phpgw::get_var('message');
     $err = urldecode(phpgw::get_var('err'));
     $link_data = array('menuaction' => 'sms.uisms.sendsmstogr_yes', 'sms_id' => $sms_id, 'from' => $from);
     $form_action = $GLOBALS['phpgw']->link('/index.php', $link_data);
     /*
     			$db_query = "SELECT * FROM "._DB_PREF_."_tblUserGroupPhonebook WHERE uid='$uid' ORDER BY gp_name";
     			$db_result = $this->db->query($db_query);
     			while ($db_row = dba_fetch_array($db_result))
     			{
     			    $list_of_group .= "<option value=\"$db_row[gp_code]\" $selected>$db_row[gp_name] ($db_row[gp_code])</option>";
     			}
     			// add shared group
     			$db_query = "
     			    SELECT 
     				"._DB_PREF_."_tblUserGroupPhonebook.gpid as gpid, 
     				"._DB_PREF_."_tblUserGroupPhonebook.gp_name as gp_name,
     				"._DB_PREF_."_tblUserGroupPhonebook.gp_code as gp_code
     			    FROM "._DB_PREF_."_tblUserGroupPhonebook,"._DB_PREF_."_tblUserGroupPhonebook_public 
     			    WHERE 
     				"._DB_PREF_."_tblUserGroupPhonebook.gpid="._DB_PREF_."_tblUserGroupPhonebook_public.gpid AND
     				NOT ("._DB_PREF_."_tblUserGroupPhonebook_public.uid='$uid')
     			    ORDER BY gp_name
     			";
     			$db_result = $this->db->query($db_query);
     			while ($db_row = dba_fetch_array($db_result))
     			{
     			    $list_of_group .= "<option value=\"$db_row[gp_code]\" $selected>$db_row[gp_name] ($db_row[gp_code])</option>";
     			}
     */
     $sms = CreateObject('sms.sms');
     $max_length = $core_config['smsmaxlength'] = 160;
     if ($sms_sender = $sms->username2sender($GLOBALS['phpgw_info']['user']['account_lid'])) {
         $max_length = $max_length - strlen($sms_sender);
     } else {
         $sms_sender = "<i>not set</i>";
     }
     if ($err) {
         $content = "<p><font color=red>{$err}</font><p>";
     }
     if ($gateway_number) {
         $sms_from = $gateway_number;
     } else {
         $sms_from = $mobile;
     }
     // WWW
     $db_query2 = "SELECT * FROM phpgw_sms_tblsmstemplate WHERE uid='{$this->account}'";
     $this->db->query($db_query2);
     $j = 0;
     $option_values = "<option value=\"\" default>--Please Select--</option>";
     while ($this->db->next_record()) {
         $j++;
         $option_values .= "<option value=\"" . $this->db->f('t_text') . "\">" . $this->db->f('t_title') . "</option>";
         $input_values .= "<input type=\"hidden\" name=\"content_{$j}\" value=\"" . $this->db->f('t_text') . "\">";
     }
     // document.fm_sendsms.message.value = document.fm_smstemplate.content_num.value;
     $content .= "\n\t\t\t<!-- WWW -->\n\t\t\t    <script language=\"javascript\">\n\t\t\n\t\t\t\tfunction setTemplate()\n\t\t\t\t{\t\t    \n\t\t\t\t    sellength = fm_sendsms.smstemplate.length;\n\t\t\t\t    for ( i=0; i<sellength; i++)\n\t\t\t\t    {\n\t\t\t\t\tif (fm_sendsms.smstemplate.options[i].selected == true)\n\t\t\t\t\t{\n\t\t\t\t\t    fm_sendsms.message.value = fm_sendsms.smstemplate.options[i].value;\n\t\t\t\t\t}\n\t\t\t\t    }\n\t\t\t\t}\n\t\t\t    </script>\n\t\t\n\t\t\t    <form name=\"fm_smstemplate\">\n\t\t\t    {$input_values}\n\t\t\t    </form>\n\t\t\n\t\t\t    <h2>Send broadcast SMS</h2>\n\t\t\t    <p>\n\t\t\t    <form name='fm_sendsms' id='fm_sendsms' action={$form_action} method=POST>\n\t\t\t    <p>From: {$sms_from}\n\t\t\t    <p>\n\t\t\t    <p>Send to group: <select name=\"gp_code\">{$list_of_group}</select>\n\t\t\t    <!--\n\t\t\t    <table cellpadding=1 cellspacing=0 border=0>\n\t\t\t    <tr>\n\t\t\t\t<td nowrap>\n\t\t\t\t    Group(s):<br>\n\t\t\t\t    <select name=\"gp_code_dump[]\" size=\"10\" multiple=\"multiple\" onDblClick=\"moveSelectedOptions(this.form['gp_code_dump[]'],this.form['gp_code[]'])\">{$list_of_group}</select>\n\t\t\t\t</td>\n\t\t\t\t<td width=10>&nbsp;</td>\n\t\t\t\t<td align=center valign=middle>\n\t\t\t\t<input type=\"button\" class=\"button\" value=\"&gt;&gt;\" onclick=\"moveSelectedOptions(this.form['gp_code_dump[]'],this.form['gp_code[]'])\"><br><br>\n\t\t\t\t<input type=\"button\" class=\"button\" value=\"All &gt;&gt;\" onclick=\"moveAllOptions(this.form['gp_code_dump[]'],this.form['gp_code[]'])\"><br><br>\n\t\t\t\t<input type=\"button\" class=\"button\" value=\"&lt;&lt;\" onclick=\"moveSelectedOptions(this.form['gp_code[]'],this.form['gp_code_dump[]'])\"><br><br>\n\t\t\t\t<input type=\"button\" class=\"button\" value=\"All &lt;&lt;\" onclick=\"moveAllOptions(this.form['gp_code[]'],this.form['gp_code_dump[]'])\">\n\t\t\t\t</td>\t\t\n\t\t\t\t<td width=10>&nbsp;</td>\n\t\t\t\t<td nowrap>\n\t\t\t\t    Send to:<br>\n\t\t\t\t    <select name=\"gp_code[]\" size=\"10\" multiple=\"multiple\" onDblClick=\"moveSelectedOptions(this.form['gp_code[]'],this.form['gp_code_dump[]'])\"></select>\n\t\t\t\t</td>\n\t\t\t    </tr>\n\t\t\t    </table>\n\t\t\t    -->\n\t\t\t    <p>Or: <input type=text size=20 maxlength=20 name=gp_code_text value=\"{$dst_gp_code}\"> (Group name)\n\t\t\t    <p>SMS Sender ID: {$sms_sender} \n\t\t\t    <p>Message template: <select name=\"smstemplate\">{$option_values}</select>\n\t\t\t    <p><input type=\"button\" onClick=\"javascript: setTemplate();\" name=\"nb\" value=\"Use Template\" class=\"button\">\n\t\t\t    <p>Your message: \n\t\t\t    <br><textarea cols=\"39\" rows=\"5\" onKeyUp=\"javascript: SmsCountKeyUp({$max_length});\" onKeyDown=\"javascript: SmsCountKeyDown({$max_length});\" name=\"message\" id=\"ta_sms_content\">{$message}</textarea>\n\t\t\t    <br>Character left: <input value=\"{$max_length}\" type=\"text\" onKeyPress=\"if (window.event.keyCode == 13){return false;}\" onFocus=\"this.blur();\" size=\"3\" name=\"charNumberLeftOutput\" id=\"charNumberLeftOutput\">\n\t\t\t    <p><input type=checkbox name=msg_flash> Send as flash message\n\t\t\t    <p><input type=submit class=button value=Send onClick=\"selectAllOptions(this.form['gp_code[]'])\"> \n\t\t\t    </form>\n\t\t\t";
     echo $content;
 }
 function show()
 {
     $type = get_var('type', array('GET', 'POST'));
     if ($type == 'question') {
         $pagetitle = lang('Show questions');
         $allowed_actions = array('view', 'edit', 'delete');
         $this->t->set_file(array('admin' => 'admin_list_questions.tpl'));
     } elseif ($type == 'answer') {
         $pagetitle = lang('Show answers');
         $allowed_actions = array('edit', 'delete');
         $this->t->set_file(array('admin' => 'admin_list_answers.tpl'));
     } else {
         $GLOBALS['phpgw']->redirect_link('/polls/index.php');
         $GLOBALS['phpgw']->common->phpgw_exit(True);
         return 0;
     }
     $GLOBALS['phpgw_info']['flags']['app_header'] = lang('Polls') . ' - ' . $pagetitle;
     $GLOBALS['phpgw']->common->phpgw_header();
     echo parse_navbar();
     $this->bo->sort = $_GET['sort'] ? $_GET['sort'] : 'ASC';
     $this->bo->order = isset($_GET['order']) ? $_GET['order'] : 'poll_title';
     if (!$this->bo->start) {
         $this->bo->start = 0;
     }
     $this->bo->save_sessiondata();
     $this->t->set_block('admin', 'form', 'form');
     $this->t->set_block('admin', 'row', 'row');
     $this->t->set_unknowns('remove');
     $thelist = $this->bo->get_list($type);
     $this->t->set_var('th_bg', $GLOBALS['phpgw_info']['theme']['th_bg']);
     $this->t->set_var('sort_title', $this->nextmatchs->show_sort_order($this->bo->sort, 'poll_title', $this->bo->order, 'index.php', lang('Title'), '&menuaction=polls.ui.admin&action=show&type=' . $type));
     if ($type == 'answer') {
         $this->t->set_var('sort_answer', $this->nextmatchs->show_sort_order($this->bo->sort, 'option_text', $this->bo->order, 'index.php', lang('Answer'), '&menuaction=polls.ui.admin&action=show&type=' . $type));
     }
     $left = $this->nextmatchs->left('/index.php', $this->bo->start, $this->bo->total, 'menuaction=polls.ui.admin&action=show&type=' . $type);
     $right = $this->nextmatchs->right('/index.php', $this->bo->start, $this->bo->total, 'menuaction=polls.ui.admin&action=show&type=' . $type);
     $this->t->set_var('match_left', $left);
     $this->t->set_var('match_right', $right);
     $this->t->set_var('lang_showing', $this->nextmatchs->show_hits($this->bo->total, $this->bo->start));
     $this->t->set_var('lang_actions', lang('actions'));
     $this->t->set_var('lang_view', lang('view'));
     $this->t->set_var('lang_edit', lang('edit'));
     $this->t->set_var('lang_delete', lang('delete'));
     $this->t->set_var('rows', '');
     foreach ($thelist as $key => $array) {
         $tr_color = $this->nextmatchs->alternate_row_color($tr_color);
         $this->t->set_var('tr_color', $tr_color);
         $poll_id = $array['poll_id'];
         $vote_id = $array['vote_id'];
         $poll_title = $array['poll_title'];
         $option_text = $array['option_text'];
         $actions = '';
         $_options = array('menuaction' => 'polls.ui.admin', 'type' => $type, 'poll_id' => $poll_id);
         foreach ($allowed_actions as $_action) {
             $_options['action'] = $_action;
             if ($type == 'answer') {
                 $_options['vote_id'] = $vote_id;
             }
             $actions .= $this->action_button($_action, $_options);
         }
         $this->t->set_var('row_actions', $actions);
         if ($type == 'question') {
             $this->t->set_var('row_title', stripslashes($poll_title));
         } else {
             $this->t->set_var('row_answer', stripslashes($option_text));
             $this->t->set_var('row_title', stripslashes($poll_title));
             $this->t->set_var('row_edit', '<a href="' . $this->adminlink('edit', 'answer', array('vote_id' => $vote_id, 'poll_id' => $poll_id)) . '">' . lang('Edit') . '</a>');
             $this->t->set_var('row_delete', '<a href="' . $this->adminlink('delete', 'answer', array('vote_id' => $vote_id, 'poll_id' => $poll_id)) . '">' . lang('Delete') . '</a>');
         }
         $this->t->parse('rows', 'row', True);
     }
     $this->t->set_var('add_action', $this->adminlink('add', $type));
     $this->t->set_var('lang_add', lang('add'));
     $this->t->pparse('out', 'form');
     $GLOBALS['phpgw']->common->phpgw_footer();
 }
 function manage()
 {
     if (!$this->acl->check($this->acl_location, 16, 'sms')) {
         $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
         $this->bocommon->no_access();
         return;
     }
     $GLOBALS['phpgw_info']['flags']['app_header'] = lang('SMS') . ' - ' . lang('Manage SMS autoreply');
     $GLOBALS['phpgw']->common->phpgw_header();
     echo parse_navbar();
     $autoreply_id = phpgw::get_var('autoreply_id');
     $err = urldecode(phpgw::get_var('err'));
     /*			if (!$this->acl->check('run', PHPGW_ACL_READ,'admin'))
     			{
     			    $query_user_only = "AND uid='$uid'";
     			}
     */
     $sql = "SELECT * FROM phpgw_sms_featautoreply WHERE autoreply_id='{$autoreply_id}' {$query_user_only}";
     $this->db->query($sql, __LINE__, __FILE__);
     $this->db->next_record();
     $manage_autoreply_code = $this->db->f('autoreply_code');
     $o_uid = $this->db->f('uid');
     if ($err) {
         $content = "<p><font color=red>{$err}</font><p>";
     }
     $add_data = array('menuaction' => 'sms.uiautoreply.add_scenario', 'autoreply_id' => $autoreply_id);
     $add_url = $GLOBALS['phpgw']->link('/index.php', $add_data);
     $content .= "\n\t\t\t    <p>\n\t\t\t    <p>SMS autoreply code: <b>{$manage_autoreply_code}</b>\n\t    \t\t<p>";
     $content .= "\n\t\t\t    <p>\n\t\t\t    <a href=\"{$add_url}\">[ Add SMS autoreply scenario ]</a>\n\t\t\t    <p>\n\t\t\t";
     $sql = "SELECT * FROM phpgw_sms_featautoreply_scenario WHERE autoreply_id='{$autoreply_id}' ORDER BY autoreply_scenario_param1";
     $this->db->query($sql, __LINE__, __FILE__);
     while ($this->db->next_record()) {
         $owner = $GLOBALS['phpgw']->accounts->id2name($o_uid);
         $list_of_param = "";
         for ($i = 1; $i <= 7; $i++) {
             $list_of_param .= $this->db->f("autoreply_scenario_param{$i}") . "&nbsp;";
         }
         $content .= "[<a href=" . $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'sms.uiautoreply.edit_scenario', 'autoreply_id' => $this->db->f('autoreply_id'), 'autoreply_scenario_id' => $this->db->f('autoreply_scenario_id'))) . ">e</a>] ";
         $content .= "[<a href=" . $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'sms.uiautoreply.delete_scenario', 'autoreply_id' => $this->db->f('autoreply_id'), 'autoreply_scenario_id' => $this->db->f('autoreply_scenario_id'))) . ">x</a>] ";
         $content .= " <b>Param:</b> " . $list_of_param . "&nbsp;<br><b>Return:</b> " . $this->db->f('autoreply_scenario_result') . "&nbsp;&nbsp;<b>User:</b> {$owner}<br><br>";
     }
     $content .= "\n\t\t\t    <p>\n\t\t\t    <a href=\"{$add_url}\">[ Add SMS autoreply scenario ]</a>\n\t\t\t    <p>\n\t\t\t";
     $done_data = array('menuaction' => 'sms.uiautoreply.index');
     $done_url = $GLOBALS['phpgw']->link('/index.php', $done_data);
     $content .= "\n\t\t\t    <p><li>\n\t\t\t    <a href=\"{$done_url}\">Back</a>\n\t\t\t    <p>\n\t\t\t";
     echo $content;
 }
 function delete()
 {
     if (!$this->acl_delete) {
         $GLOBALS['phpgw']->redirect_link('/index.php');
     }
     $link_data = array('menuaction' => 'admin.uicategories.index', 'appname' => $this->appname);
     if (!$this->cat_id || $_POST['cancel']) {
         $GLOBALS['phpgw']->redirect_link('/index.php', $link_data);
     }
     if ($_POST['confirm']) {
         if ($_POST['subs']) {
             $this->bo->delete($this->cat_id, True);
         } else {
             $this->bo->delete($this->cat_id, False);
         }
         $GLOBALS['phpgw']->redirect_link('/index.php', $link_data);
     }
     $this->template->set_file(array('category_delete' => 'delete_cat.tpl'));
     if ($this->appname) {
         $type = 'noglobalapp';
     } else {
         $type = 'noglobal';
     }
     $apps_cats = $this->bo->exists(array('type' => $type, 'cat_name' => '', 'cat_id' => $this->cat_id));
     $GLOBALS['phpgw_info']['flags']['app_header'] .= ' - ' . lang('Delete category');
     if (!@is_object($GLOBALS['phpgw']->js)) {
         $GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript');
     }
     $GLOBALS['phpgw']->js->validate_file('jscode', 'openwindow', 'admin');
     $GLOBALS['phpgw']->common->phpgw_header();
     echo parse_navbar();
     $hidden_vars = '<input type="hidden" name="cat_id" value="' . $this->cat_id . '">' . "\n";
     $this->template->set_var('hidden_vars', $hidden_vars);
     $cats = $this->bo->cats->return_single($this->cat_id);
     $this->template->set_var('cat_name', $cat['name']);
     if ($apps_cats) {
         $this->template->set_block('category_delete', 'delete', 'deletehandle');
         $this->template->set_var('messages', lang('This category is currently being used by applications as a parent category') . '<br>' . lang('You will need to remove the subcategories before you can delete this category'));
         $this->template->set_var('lang_subs', '');
         $this->template->set_var('subs', '');
         $this->template->set_var('nolink', $nolink);
         $this->template->set_var('deletehandle', '');
         $this->template->set_var('donehandle', '');
         $this->template->set_var('lang_ok', lang('Ok'));
         $this->template->pfp('out', 'category_delete');
     } else {
         $this->template->set_block('category_delete', 'done', 'donehandle');
         $this->template->set_var('messages', lang('Are you sure you want to delete this category ?'));
         $exists = $this->bo->exists(array('type' => 'subs', 'cat_name' => '', 'cat_id' => $this->cat_id));
         if ($exists) {
             $this->template->set_var('lang_subs', lang('Do you also want to delete all global subcategories ?'));
             $this->template->set_var('subs', '<input type="checkbox" name="subs" value="True">');
         } else {
             $this->template->set_var('lang_subs', '');
             $this->template->set_var('subs', '');
         }
         $link_data['menuaction'] = 'admin.uicategories.delete';
         $link_data['cat_id'] = $this->cat_id;
         $this->template->set_var('action_url', $GLOBALS['phpgw']->link('/index.php', $link_data));
         $this->template->set_var('lang_yes', lang('Yes'));
         $this->template->set_var('lang_no', lang('No'));
         $this->template->pfp('out', 'category_delete');
     }
 }
 function hookAdmin()
 {
     if (!$GLOBALS['phpgw']->acl->check('run', 1, 'admin')) {
         $GLOBALS['phpgw']->common->phpgw_header();
         echo parse_navbar();
         echo lang('access not permitted');
         $GLOBALS['phpgw']->log->message('F-Abort, Unauthorized access to felamimail.uifelamimail.hookAdmin');
         $GLOBALS['phpgw']->log->commit();
         $GLOBALS['phpgw']->common->phpgw_exit();
     }
     if (!empty($_POST['profileID']) && is_int(intval($_POST['profileID']))) {
         $profileID = intval($_POST['profileID']);
         $this->bofelamimail->setEMailProfile($profileID);
     }
     $boemailadmin = new emailadmin_bo();
     $profileList = $boemailadmin->getProfileList();
     $profileID = $this->bofelamimail->getEMailProfile();
     $this->display_app_header();
     $this->t->set_file(array("body" => "selectprofile.tpl"));
     $this->t->set_block('body', 'main');
     $this->t->set_block('body', 'select_option');
     $this->t->set_var('lang_select_email_profile', lang('select emailprofile'));
     $this->t->set_var('lang_site_configuration', lang('site configuration'));
     $this->t->set_var('lang_save', lang('save'));
     $this->t->set_var('lang_back', lang('back'));
     $linkData = array('menuaction' => 'felamimail.uifelamimail.hookAdmin');
     $this->t->set_var('action_url', $GLOBALS['phpgw']->link('/index.php', $linkData));
     $linkData = array('menuaction' => 'emailadmin.emailadmin_ui.listProfiles');
     $this->t->set_var('lang_go_emailadmin', lang('use <a href="%1">EmailAdmin</a> to create profiles', $GLOBALS['phpgw']->link('/index.php', $linkData)));
     $this->t->set_var('back_url', $GLOBALS['phpgw']->link('/admin/index.php'));
     if (isset($profileList) && is_array($profileList)) {
         foreach ($profileList as $key => $value) {
             #print "$key => $value<br>";
             #_debug_array($value);
             $this->t->set_var('profileID', $value['profileID']);
             $this->t->set_var('description', $value['description']);
             if (is_int($profileID) && $profileID == $value['profileID']) {
                 $this->t->set_var('selected', 'selected');
             } else {
                 $this->t->set_var('selected', '');
             }
             $this->t->parse('select_options', 'select_option', True);
         }
     }
     $this->t->parse("out", "main");
     print $this->t->get('out', 'main');
 }
 unset($theme_to_load);
 /*************************************************************************\
 		* If they are using frames, we need to set some variables                 *
 		\*************************************************************************/
 if (isset($GLOBALS['phpgw_info']['user']['preferences']['common']['useframes']) && $GLOBALS['phpgw_info']['user']['preferences']['common']['useframes'] && $GLOBALS['phpgw_info']['server']['useframes'] == 'allowed' || $GLOBALS['phpgw_info']['server']['useframes'] == 'always') {
     $GLOBALS['phpgw_info']['flags']['navbar_target'] = 'phpgw_body';
 }
 /*************************************************************************\
 		* Verify that the users session is still active otherwise kick them out   *
 		\*************************************************************************/
 if ($GLOBALS['phpgw_info']['flags']['currentapp'] != 'home' && $GLOBALS['phpgw_info']['flags']['currentapp'] != 'about') {
     // This will need to use ACL in the future
     if (!$GLOBALS['phpgw_info']['user']['apps'][$GLOBALS['phpgw_info']['flags']['currentapp']] || @$GLOBALS['phpgw_info']['flags']['admin_only'] && !$GLOBALS['phpgw_info']['user']['apps']['admin']) {
         $GLOBALS['phpgw']->common->phpgw_header();
         if ($GLOBALS['phpgw_info']['flags']['noheader']) {
             echo parse_navbar();
         }
         $GLOBALS['phpgw']->log->write(array('text' => 'W-Permissions, Attempted to access %1', 'p1' => $GLOBALS['phpgw_info']['flags']['currentapp']));
         echo '<p><center><b>' . lang('Access not permitted') . '</b></center>';
         $GLOBALS['phpgw']->common->phpgw_exit(True);
     }
 }
 if (!is_object($GLOBALS['phpgw']->datetime)) {
     $GLOBALS['phpgw']->datetime = CreateObject('phpgwapi.datetime');
 }
 $GLOBALS['phpgw']->applications->read_installed_apps();
 // to get translated app-titles
 /*************************************************************************\
 		* Load the header unless the developer turns it off                       *
 		\*************************************************************************/
 if (!@$GLOBALS['phpgw_info']['flags']['noheader']) {
 function global_options()
 {
     global $phpgw, $phpgw_info, $HTTP_POST_VARS;
     if ($HTTP_POST_VARS['submit'] != '') {
         if ($HTTP_POST_VARS['submit'] == lang("Submit")) {
             $field = $this->get_form();
             // checks can be added here.
             $field['message'] = $this->bo->update_global_options($field);
         }
         if ($HTTP_POST_VARS['submit'] == lang("Done")) {
             header('Location: ' . $phpgw->link('/admin/index.php'));
         }
     } else {
         $field = $this->bo->admin_global_options_data();
         $field['message'] = '';
     }
     $g_censor_level = $this->functions->select_box('g_censor_level');
     $g_image_source = $this->functions->select_box('g_image_source');
     $field['title'] = lang("Daily Comics - Global Options");
     $field['image_source_label'] = lang("Image Source");
     $field['remote_enabled_label'] = lang("Remote (Parse/Snarf) Enabled");
     $field['censor_level_label'] = lang("Censorship Level");
     $field['filesize_label'] = lang("Max File size");
     $field['override_enabled_label'] = lang("Censorship Override Enabled");
     $field['submit'] = lang("Submit");
     $field['reset'] = lang("Reset");
     $field['done'] = lang("Done");
     $field['action_url'] = $phpgw->link('/index.php', 'menuaction=comic.uiadmin.global_options');
     $phpgw->common->phpgw_header();
     // echo parse_navbar();
     print parse_navbar();
     if ($field['remote_enabled'] == 1) {
         $field['remote_enabled'] = "checked";
     } else {
         $field['remote_enabled'] = '';
     }
     if ($field['override_enabled'] == 1) {
         $field['override_enabled'] = "checked";
     } else {
         $field['override_enabled'] = '';
     }
     $options_tpl = CreateObject('phpgwapi.Template', $phpgw->common->get_tpl_dir('comic'));
     $options_tpl->set_unknowns("remove");
     $options_tpl->set_file(array(coptions => 'option.common.tpl'));
     for ($loop = 0; $loop < count($g_censor_level); $loop++) {
         $selected = '';
         if ($field['censor_level'] == $loop) {
             $selected = "selected";
         }
         $options_tpl->set_var(array(OPTION_VALUE => $loop, OPTION_SELECTED => $selected, OPTION_NAME => $g_censor_level[$loop]));
         $options_tpl->parse(option_list, "coptions", TRUE);
     }
     $field['censor_level_options'] = $options_tpl->get("option_list");
     for ($loop = 0; $loop < count($g_image_source); $loop++) {
         $selected = '';
         if ($field['image_source'] == $loop) {
             $selected = "selected";
         }
         $options_tpl->set_var(array(OPTION_VALUE => $loop, OPTION_SELECTED => $selected, OPTION_NAME => $g_image_source[$loop]));
         $options_tpl->parse(option_list2, "coptions", TRUE);
     }
     $field['image_source_options'] = $options_tpl->get("option_list2");
     $phpgw->template->set_file(array('main' => 'admin_global_options.tpl'));
     $phpgw->template->set_var(array('action_url' => $field['action_url'], 'title_color' => $phpgw_info['theme']['th_bg'], 'title' => $field['title'], 'row_1_color' => $this->functions->row_color(), 'message' => $field['message'], 'censor_level_color' => $this->functions->row_color(), 'censor_level_label' => $field['censor_level_label'], 'censor_level_options' => $field['censor_level_options'], 'override_enabled_color' => $this->functions->row_color(), 'override_enabled_label' => $field['override_enabled_label'], 'override_enabled' => $field['override_enabled'], 'image_source_color' => $this->functions->row_color(), 'image_source_label' => $field['image_source_label'], 'image_source_options' => $field['image_source_options'], 'remote_enabled_color' => $this->functions->row_color(), 'remote_enabled_label' => $field['remote_enabled_label'], 'remote_enabled' => $field['remote_enabled'], 'filesize_color' => $this->functions->row_color(), 'filesize_label' => $field['filesize_label'], 'filesize' => $field['filesize'], 'row_2_color' => $this->functions->row_color(), 'submit' => $field['submit'], 'reset' => $field['reset'], 'done' => $field['done']));
     $phpgw->template->parse('out', 'main', TRUE);
     $phpgw->template->p('out');
 }
 function delete()
 {
     if (!$GLOBALS['phpgw']->acl->check('run', 1, 'admin')) {
         $GLOBALS['phpgw']->common->phpgw_header();
         echo parse_navbar();
         $this->deny();
     }
     $site_id = get_var('site_id', array('POST', 'GET'));
     if ($_POST['yes'] || $_POST['no']) {
         if ($_POST['yes']) {
             $this->bo->delete($site_id);
         }
         $GLOBALS['phpgw']->redirect_link('/index.php', 'menuaction=sitemgr.Sites_UI.list_sites');
     } else {
         $GLOBALS['phpgw']->common->phpgw_header();
         echo parse_navbar();
         $site = $this->bo->read($site_id);
         $GLOBALS['phpgw']->template->set_file(array('site_delete' => 'delete_common.tpl'));
         $GLOBALS['phpgw']->template->set_var(array('form_action' => $GLOBALS['phpgw']->link('/index.php', 'menuaction=sitemgr.Sites_UI.delete'), 'hidden_vars' => '<input type="hidden" name="site_id" value="' . $site_id . '"><script>document.yesbutton.yesbutton.focus()</script>', 'messages' => lang('Are you sure you want to delete site %1 and all its content? You cannot retrieve it if you continue.', $site['site_name']), 'no' => lang('No'), 'yes' => lang('Yes')));
         $GLOBALS['phpgw']->template->pparse('phpgw_body', 'site_delete');
     }
 }
 function edit()
 {
     if (!$this->acl->check($this->acl_location, PHPGW_ACL_EDIT, 'sms')) {
         $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
         $this->bocommon->no_access();
         return;
     }
     $GLOBALS['phpgw_info']['flags']['app_header'] = lang('SMS') . ' - ' . lang('Edit SMS board');
     $GLOBALS['phpgw']->common->phpgw_header();
     echo parse_navbar();
     $err = urldecode(phpgw::get_var('err'));
     $board_id = phpgw::get_var('board_id');
     if ($err) {
         $content = "<p><font color=red>{$err}</font><p>";
     }
     $sql = "SELECT * FROM phpgw_sms_featboard WHERE board_id='{$board_id}'";
     $this->db->query($sql, __LINE__, __FILE__);
     $this->db->next_record();
     $board_code = $this->db->f('board_code');
     $email = $this->db->f('board_forward_email', true);
     $template = $this->db->f('board_pref_template', true);
     $add_data = array('menuaction' => 'sms.uiboard.edit_yes', 'board_id' => $board_id, 'board_code' => $board_code);
     $add_url = $GLOBALS['phpgw']->link('/index.php', $add_data);
     $board_url = $this->db->f('board_url', true);
     $content .= "\n\t\t\t\t<p>\n\t\t\t\t<form action={$add_url} method=post>\n\t    \t\t\t<p>SMS board: <b>{$board_code}</b>\n\t\t\t\t<p>Forward to email: <input type=text size=30 name=email value=\"{$email}\">\n\t\t\t\t<p>Template:\n\t\t\t\t<br><textarea name=template rows=5 cols=60>{$template}</textarea>\n\t\t\t\t<p><input type=submit class=button value=Save>\n\t\t\t\t</form>";
     $done_data = array('menuaction' => 'sms.uiboard.index');
     $done_url = $GLOBALS['phpgw']->link('/index.php', $done_data);
     $content .= "\n\t\t\t    <p>\n\t\t\t    <a href=\"{$done_url}\">[ Done ]</a>\n\t\t\t    <p>\n\t\t\t";
     echo $content;
 }
 function import()
 {
     if ($_POST['import']) {
         $this->bo->import($_FILES['bkfile'], $_POST['bookmark']['category']);
     }
     $GLOBALS['phpgw']->common->phpgw_header();
     echo parse_navbar();
     $this->t->set_file('body', 'import.body.tpl');
     $this->t->set_var(array('FORM_ACTION' => $GLOBALS['phpgw']->link('/index.php', 'menuaction=bookmarks.ui.import'), 'lang_name' => lang('Enter the name of the Netscape bookmark file<br>that you want imported into bookmarker below.'), 'lang_file' => lang('Netscape Bookmark File'), 'lang_import_button' => lang('Import Bookmarks'), 'lang_note' => lang('<b>Note:</b> This currently works with netscape bookmarks only'), 'lang_catchoose' => lang('To which category should the imported folder hierarchy be attached'), 'input_categories' => $this->bo->categories_list(0)));
     $this->app_messages();
     $this->t->pfp('out', 'body');
     $GLOBALS['phpgw']->common->phpgw_footer();
 }
 function display_app_header()
 {
     if (!@is_object($GLOBALS['phpgw']->js)) {
         $GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript');
     }
     $GLOBALS['phpgw']->js->validate_file('tabs', 'tabs');
     $GLOBALS['phpgw']->js->validate_file('jscode', 'view_message', 'felamimail');
     $GLOBALS['phpgw']->js->set_onload('javascript:initAll();');
     $GLOBALS['phpgw']->common->phpgw_header();
     if (!$this->mailPreferences['messageNewWindow']) {
         echo parse_navbar();
     }
 }