function nextmatchs($website = False)
 {
     if (!$website) {
         $this->template = createobject('phpgwapi.Template', PHPGW_TEMPLATE_DIR);
         $this->template->set_file(array('_nextmatchs' => 'nextmatchs.tpl'));
         $this->template->set_block('_nextmatchs', 'nextmatchs');
         $this->template->set_block('_nextmatchs', 'filter');
         $this->template->set_block('_nextmatchs', 'form');
         $this->template->set_block('_nextmatchs', 'icon');
         $this->template->set_block('_nextmatchs', 'link');
         $this->template->set_block('_nextmatchs', 'search');
         $this->template->set_block('_nextmatchs', 'cats');
         $this->template->set_block('_nextmatchs', 'search_filter');
         $this->template->set_block('_nextmatchs', 'cats_search_filter');
     }
     if (isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) && (int) $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0) {
         $this->maxmatches = (int) $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
     } else {
         $this->maxmatches = 15;
     }
     $this->_start = (int) get_var('start', array('GLOBAL', 'POST', 'GET'));
     foreach (array('menuaction', 'filter', 'qfield', 'order', 'sort') as $name) {
         $var = '_' . $name;
         $this->{$var} = get_var($name, array('GLOBAL', 'POST', 'GET'));
         if (!preg_match('/^[a-z0-9_. -]*$/i', $this->{$var})) {
             $this->{$var} = '';
         }
     }
     if (!is_object($GLOBALS['phpgw']->html)) {
         $GLOBALS['phpgw']->html = CreateObject('phpgwapi.html');
     }
 }
Ejemplo n.º 2
0
function cat_id($cats)
{
    if (!$cats) {
        return '';
    }
    $ids = array();
    foreach (split(' *[,;] *', $cats) as $cat) {
        if (isset($cat2id[$cat])) {
            $ids[$cat] = $cat2id[$cat];
            // cat is in cache
        } else {
            if (!is_object($GLOBALS['phpgw']->categories)) {
                $GLOBALS['phpgw']->categories = createobject('phpgwapi.categories');
            }
            if (is_numeric($cat) && $GLOBALS['phpgw']->categories->id2name($cat) != '--') {
                $cat2id[$cat] = $ids[$cat] = $cat;
            } elseif ($id = $GLOBALS['phpgw']->categories->name2id(addslashes($cat))) {
                // cat exists
                $cat2id[$cat] = $ids[$cat] = $id;
            } else {
                // create new cat
                $GLOBALS['phpgw']->categories->add(array('name' => $cat, 'descr' => $cat));
                $cat2id[$cat] = $ids[$cat] = $GLOBALS['phpgw']->categories->name2id(addslashes($cat));
            }
        }
    }
    $id_str = implode(',', $ids);
    if (count($ids) > 1) {
        $id_str = ",{$id_str},";
    }
    return $id_str;
}
 function uimessenger()
 {
     $this->bo = CreateObject('messenger.bomessenger');
     $this->nextmatchs = createobject('phpgwapi.nextmatchs');
     $this->broadcaster = $GLOBALS['phpgw']->acl->get_specific_rights($GLOBALS['phpgw']->accounts->name2id('Broadcast'), 'phpgw_group');
     $this->multicaster = $GLOBALS['phpgw']->acl->get_specific_rights($GLOBALS['phpgw']->accounts->name2id('Multicast'), 'phpgw_group');
 }
 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'] : '&nbsp;');
             $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');
 }
 function module_guestbook()
 {
     $this->i18n = False;
     $this->post = array('name' => array('type' => 'textfield'), 'comment' => array('type' => 'textarea'), 'save' => array('type' => 'submit', 'value' => lang('Save')));
     $this->arguments = array('book' => array('type' => 'select', 'label' => lang('Choose a guestbook'), 'options' => array()));
     $this->properties = array('allownew' => array('type' => 'checkbox', 'label' => lang('Are contributors allowed to define new guestbooks?')));
     $this->bo = createobject('sitemgr_module_guestbook.guestbook_BO');
 }
 /**
  * Add welkome message to new users
  *
  * @return void
  */
 public function add_welkome_message($data)
 {
     $message['to'] = $data['account_lid'];
     $message['subject'] = lang('Welcome');
     $message['content'] = $data['message'];
     $so = createobject('messenger.somessenger');
     $so->send_message($message, True);
 }
 function kill()
 {
     if (isset($_GET['ksession']) && $_GET['ksession'] && $GLOBALS['sessionid'] != $_GET['ksession'] && !$GLOBALS['phpgw']->acl->check('current_sessions_access', 8, 'admin')) {
         $GLOBALS['phpgw']->session->destroy($_GET['ksession']);
     }
     $this->ui = createobject('admin.uicurrentsessions');
     $this->ui->list_sessions();
 }
 function uicurrentsessions()
 {
     if ($GLOBALS['phpgw']->acl->check('current_sessions_access', 1, 'admin')) {
         $GLOBALS['phpgw']->redirect_link('/index.php');
     }
     $this->template = createobject('phpgwapi.Template', PHPGW_APP_TPL);
     $this->bo = createobject('admin.bocurrentsessions');
     $this->nextmatchs = createobject('phpgwapi.nextmatchs');
 }
 function __construct()
 {
     $this->template = $GLOBALS['phpgw']->template;
     $this->bo = CreateObject('messenger.bomessenger');
     $this->nextmatchs = createobject('phpgwapi.nextmatchs');
     if (!$this->bo->is_connected()) {
         $this->_error_not_connected();
     }
 }
 /**
  * Clear reg_accounts either as part of a cron-job or logout hook
  *
  * @return void
  */
 public function clear_reg_accounts()
 {
     $c = createobject('phpgwapi.config', 'registration');
     $c->read();
     if ($c->config_data['activate_account'] == 'pending_approval') {
         $GLOBALS['phpgw']->db->query("DELETE FROM phpgw_reg_accounts WHERE reg_dla <= '" . (time() - 7200) . "' AND reg_info IS NULL", __LINE__, __FILE__);
     } else {
         $GLOBALS['phpgw']->db->query("DELETE FROM phpgw_reg_accounts WHERE reg_dla <= '" . (time() - 7200) . "'", __LINE__, __FILE__);
     }
 }
 function get_content(&$arguments, $properties)
 {
     if ($arguments['expanded']) {
         $expandedcats = array_keys($arguments['expanded']);
     } else {
         $expandedcats = array();
     }
     $bo = createobject('bookmarks.bo');
     return $bo->export($arguments['category'], 'xbel', $expandedcats);
 }
 function __construct()
 {
     if (isset($GLOBALS['phpgw_setup']->db) && is_object($GLOBALS['phpgw_setup']->db)) {
         $this->db = clone $GLOBALS['phpgw_setup']->db;
     } else {
         //				$this->db = clone($GLOBALS['phpgw']->db);
         $this->db = createobject('felamimail.egw_db');
     }
     //			$this->db->set_app('emailadmin');
 }
 function uiexport()
 {
     $this->bo = createobject('news_admin.boexport', True);
     $this->nextmatchs = createobject('phpgwapi.nextmatchs');
     $this->start = $this->bo->start;
     $this->query = $this->bo->query;
     $this->order = $this->bo->order;
     $this->sort = $this->bo->sort;
     $this->exporttypes = array(0 => lang('No RSS export'), 1 => 'RSS 0.91', 2 => 'RSS 1.0', 3 => 'RSS 2.0');
     $this->itemsyntaxtypes = array(0 => '?item=n', 1 => '&item=n', 2 => '?news%5Bitem%5D=n', 3 => '&news%5Bitem%5D=n');
 }
 function uiacl()
 {
     $this->bo = createobject('news_admin.boacl', True);
     $this->accounts = $GLOBALS['phpgw']->accounts->get_list();
     $this->nextmatchs = createobject('phpgwapi.nextmatchs');
     $this->start = $this->bo->start;
     $this->query = $this->bo->query;
     $this->order = $this->bo->order;
     $this->sort = $this->bo->sort;
     $this->cat_id = $this->bo->cat_id;
 }
 function uinews()
 {
     $this->nextmatchs = createobject('phpgwapi.nextmatchs');
     $this->template = $GLOBALS['phpgw']->template;
     $this->bo = CreateObject('news_admin.bonews', True);
     $this->sbox = createObject('phpgwapi.sbox');
     $this->start = $this->bo->start;
     $this->query = $this->bo->query;
     $this->order = $this->bo->order;
     $this->sort = $this->bo->sort;
     $this->cat_id = $this->bo->cat_id;
 }
 function uiaccess_history()
 {
     if ($GLOBALS['phpgw']->acl->check('access_log_access', 1, 'admin')) {
         $GLOBALS['phpgw']->redirect_link('/index.php');
     }
     $this->bo = createobject('admin.boaccess_history');
     $this->nextmatchs = createobject('phpgwapi.nextmatchs');
     $this->template = $GLOBALS['phpgw']->template;
     $this->template->set_file(array('accesslog' => 'accesslog.tpl'));
     $this->template->set_block('accesslog', 'list');
     $this->template->set_block('accesslog', 'row');
     $this->template->set_block('accesslog', 'row_empty');
 }
 function bo($session = False)
 {
     $this->so = createobject('polls.so');
     $this->load_settings();
     if ($session) {
         $this->read_sessiondata();
         $this->use_session = True;
     }
     $_start = get_var('start', array('POST', 'GET'));
     $_query = get_var('query', array('POST', 'GET'));
     $_sort = get_var('sort', array('POST', 'GET'));
     $_order = get_var('order', array('POST', 'GET'));
     $_limit = get_var('limit', array('POST', 'GET'));
     $_filter = get_var('filter', array('POST', 'GET'));
     if (isset($_start)) {
         if ($this->debug) {
             echo '<br>overriding $start: "' . $this->start . '" now "' . $_start . '"';
         }
         $this->start = $_start;
     }
     if ($_limit) {
         $this->limit = $_limit;
     } else {
         $this->limit = $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
     }
     if (empty($_query) && !empty($this->query) || !empty($_query)) {
         $this->query = $_query;
     }
     if (!empty($_sort)) {
         if ($this->debug) {
             echo '<br>overriding $sort: "' . $this->sort . '" now "' . $_sort . '"';
         }
         $this->sort = $_sort;
     } else {
         $this->sort = 'ASC';
     }
     if (!empty($_order)) {
         if ($this->debug) {
             echo '<br>overriding $order: "' . $this->order . '" now "' . $_order . '"';
         }
         $this->order = $_order;
     } else {
         $this->order = 'poll_title';
     }
     if (!empty($_filter)) {
         if ($this->debug) {
             echo '<br>overriding $filter: "' . $this->filter . '" now "' . $_filter . '"';
         }
         $this->filter = $_filter;
     }
 }
Ejemplo n.º 18
0
 function __construct()
 {
     $this->bo = createobject('admin.boserver', True);
     $this->nextmatchs = createobject('phpgwapi.nextmatchs');
     $this->start = $this->bo->start;
     $this->limit = $this->bo->limit;
     $this->query = $this->bo->query;
     $this->sort = $this->bo->sort;
     $this->order = $this->bo->order;
     if ($this->debug) {
         $this->_debug_sqsof();
     }
     /* _debug_array($this); */
 }
 function bo()
 {
     $this->so = createobject('bookmarks.so');
     $this->db = $GLOBALS['phpgw']->db;
     $this->grants = $GLOBALS['phpgw']->acl->get_grants('bookmarks');
     $this->categories = createobject('phpgwapi.categories', '', 'bookmarks');
     $GLOBALS['phpgw']->config = createobject('phpgwapi.config');
     $GLOBALS['phpgw']->config->read_repository();
     $this->config = $GLOBALS['phpgw']->config->config_data;
     $this->url_format_check = True;
     $this->validate = createobject('phpgwapi.validator');
     $this->translation =& $GLOBALS['phpgw']->translation;
     $this->charset = $this->translation->charset();
 }
 function Sites_UI()
 {
     $this->common_ui = CreateObject('sitemgr.Common_UI', True);
     $this->bo =& $GLOBALS['Common_BO']->sites;
     $this->nextmatchs = createobject('phpgwapi.nextmatchs');
     $this->start = $this->bo->start;
     $this->query = $this->bo->query;
     $this->order = $this->bo->order;
     $this->sort = $this->bo->sort;
     if ($this->debug) {
         $this->_debug_sqsof();
     }
     /* _debug_array($this); */
 }
 public function list_sessions()
 {
     $GLOBALS['phpgw_info']['flags']['menu_selection'] = 'admin::admin::sessions';
     $info = $GLOBALS['phpgw']->session->appsession('currentsessions_session_data', 'admin');
     if (!is_array($info)) {
         $info = array('start' => 0, 'sort' => 'asc', 'order' => 'session_dla');
         $this->store_location($info);
     }
     $vars = array('start' => 'int', 'sort' => 'string', 'order' => 'string');
     foreach ($vars as $var => $type) {
         $val = phpgw::get_var($var, $type, 'GET');
         if ($val) {
             $info[$var] = $val;
         }
     }
     $this->store_location($info);
     $GLOBALS['phpgw_info']['flags']['app_header'] = lang('Admin') . ' - ' . lang('List of current users');
     $can_kill = false;
     $lang_kill = '';
     if (!$GLOBALS['phpgw']->acl->check('current_sessions_access', phpgwapi_acl::DELETE, 'admin')) {
         $can_kill = true;
         $lang_kill = lang('kill');
     }
     $total = $this->bo->total();
     $nextmatchs = createobject('phpgwapi.nextmatchs');
     $header = array('left_next_matchs' => $nextmatchs->left('/admin/currentusers.php', $info['start'], $total), 'right_next_matchs' => $nextmatchs->right('/admin/currentusers.php', $info['start'], $total), 'sort_loginid' => $nextmatchs->show_sort_order($info['sort'], 'lid', $info['order'], '/admin/currentusers.php', lang('LoginID')), 'sort_ip' => $nextmatchs->show_sort_order($info['sort'], 'ip', $info['order'], '/admin/currentusers.php', lang('IP')), 'sort_login_time' => $nextmatchs->show_sort_order($info['sort'], 'logints', $info['order'], '/admin/currentusers.php', lang('Login Time')), 'sort_action' => $nextmatchs->show_sort_order($info['sort'], 'action', $info['order'], '/admin/currentusers.php', lang('Action')), 'sort_idle' => $nextmatchs->show_sort_order($info['sort'], 'dla', $info['order'], '/admin/currentusers.php', lang('idle')), 'lang_kill' => $lang_kill);
     $this->header();
     $this->template->set_file('current', 'currentusers.tpl');
     $this->template->set_block('current', 'rows', 'row');
     $this->template->set_block('current', 'list', 'list');
     $this->template->set_var($header);
     $tr_class = '';
     $values = $this->bo->list_sessions($info['start'], $info['order'], $info['sort']);
     foreach ($values as $value) {
         $tr_class = $nextmatchs->alternate_row_class($tr_class);
         $value['tr_class'] = $tr_class;
         $value['kill'] = '&nbsp;';
         if ($can_kill && $value['id'] != $GLOBALS['phpgw_info']['user']['sessionid']) {
             $kill_url = $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'admin.uicurrentsessions.kill', 'ksession' => $value['id'], 'kill' => 'true'));
             $value['kill'] = "<a href=\"{$kill_url}\">{$lang_kill}</a>";
         }
         $this->template->set_var($value);
         $this->template->parse('row', 'rows', true);
     }
     $this->template->pfp('out', 'list');
 }
 function return_html($filter_out, $orderby = '', $sort = '', $record_id)
 {
     $this->template = createobject('phpgwapi.Template', PHPGW_TEMPLATE_DIR);
     $this->nextmatchs = createobject('phpgwapi.nextmatchs');
     $this->template->set_file('_history', 'history_list.tpl');
     $this->template->set_block('_history', 'row_no_history');
     $this->template->set_block('_history', 'list');
     $this->template->set_block('_history', 'row');
     $this->template->set_var('lang_user', lang('User'));
     $this->template->set_var('lang_date', lang('Date'));
     $this->template->set_var('lang_action', lang('Action'));
     $this->template->set_var('lang_new_value', lang('New Value'));
     $this->template->set_var('th_bg', $GLOBALS['phpgw_info']['theme']['th_bg']);
     $this->template->set_var('sort_date', lang('Date'));
     $this->template->set_var('sort_owner', lang('User'));
     $this->template->set_var('sort_status', lang('Status'));
     $this->template->set_var('sort_new_value', lang('New value'));
     $this->template->set_var('sort_old_value', lang('Old value'));
     $values = $this->return_array($filter_out, array(), $orderby, $sort, $record_id);
     if (!is_array($values)) {
         $this->template->set_var('tr_color', $GLOBALS['phpgw_info']['theme']['row_off']);
         $this->template->set_var('lang_no_history', lang('No history for this record'));
         $this->template->fp('rows', 'row_no_history');
         return $this->template->fp('out', 'list');
     }
     while (list(, $value) = each($values)) {
         $this->nextmatchs->template_alternate_row_color($this->template);
         $this->template->set_var('row_date', $GLOBALS['phpgw']->common->show_date($value['datetime']));
         $this->template->set_var('row_owner', $value['owner']);
         if ($this->alternate_handlers[$value['status']]) {
             eval('\\$s = ' . $this->alternate_handlers[$value['status']] . '(' . $value['new_value'] . ');');
             $this->template->set_var('row_new_value', $s);
             unset($s);
             eval('\\$s = ' . $this->alternate_handlers[$value['status']] . '(' . $value['old_value'] . ');');
             $this->template->set_var('row_old_value', $s);
             unset($s);
         } else {
             $this->template->set_var('row_new_value', $value['new_value']);
             $this->template->set_var('row_old_value', $value['old_value']);
         }
         $this->template->set_var('row_status', $this->types[$value['status']]);
         $this->template->fp('rows', 'row', True);
     }
     return $this->template->fp('out', 'list');
 }
 function boexport($session = False)
 {
     $this->so = CreateObject('news_admin.soexport');
     $this->debug = False;
     if ($session) {
         $this->read_sessiondata();
         $this->use_session = True;
         foreach (array('start', 'query', 'sort', 'order') as $var) {
             if (isset($_POST[$var])) {
                 $this->{$var} = $_POST[$var];
             } elseif (isset($_GET[$var])) {
                 $this->{$var} = $_GET[$var];
             }
         }
         $this->save_sessiondata();
         $this->catbo = createobject('phpgwapi.categories');
         $this->cats = $this->catbo->return_array('all', $this->start, True, $this->query, $this->sort, 'cat_name', True);
     }
 }
 function socalendar($param)
 {
     $this->db = $GLOBALS['phpgw']->db;
     if (!is_object($GLOBALS['phpgw']->datetime)) {
         $GLOBALS['phpgw']->datetime = createobject('phpgwapi.datetime');
     }
     $this->owner = !isset($param['owner']) || $param['owner'] == 0 ? $GLOBALS['phpgw_info']['user']['account_id'] : $param['owner'];
     $this->filter = isset($param['filter']) && $param['filter'] != '' ? $param['filter'] : $this->filter;
     $this->cat_id = isset($param['category']) && $param['category'] != '' ? $param['category'] : $this->cat_id;
     if (isset($param['g_owner']) && is_array($param['g_owner'])) {
         $this->is_group = True;
         $this->g_owner = $param['g_owner'];
     }
     if ($this->debug) {
         echo '<!-- SO Filter : ' . $this->filter . ' -->' . "\n";
         echo '<!-- SO cat_id : ' . $this->cat_id . ' -->' . "\n";
     }
     $this->cal = CreateObject('calendar.socalendar_');
     $this->open_box($this->owner);
 }
 function uiserver()
 {
     if ($GLOBALS['phpgw']->acl->check('peer_server_access', 1, 'admin')) {
         $GLOBALS['phpgw']->redirect_link('/index.php');
     }
     $this->acl_search = !$GLOBALS['phpgw']->acl->check('peer_server_access', 2, 'admin');
     $this->acl_add = !$GLOBALS['phpgw']->acl->check('peer_server_access', 4, 'admin');
     $this->acl_view = !$GLOBALS['phpgw']->acl->check('peer_server_access', 8, 'admin');
     $this->acl_edit = !$GLOBALS['phpgw']->acl->check('peer_server_access', 16, 'admin');
     $this->acl_delete = !$GLOBALS['phpgw']->acl->check('peer_server_access', 32, 'admin');
     $this->bo = createobject('admin.boserver', True);
     $this->nextmatchs = createobject('phpgwapi.nextmatchs');
     $this->start = $this->bo->start;
     $this->limit = $this->bo->limit;
     $this->query = $this->bo->query;
     $this->sort = $this->bo->sort;
     $this->order = $this->bo->order;
     if ($this->debug) {
         $this->_debug_sqsof();
     }
     /* _debug_array($this); */
 }
 function bonews($session = False)
 {
     $this->acl = CreateObject('news_admin.boacl');
     $this->sonews = CreateObject('news_admin.sonews');
     $this->accounts = $GLOBALS['phpgw']->accounts->get_list();
     $this->debug = False;
     if ($session) {
         $this->read_sessiondata();
         $this->use_session = True;
         foreach (array('start', 'query', 'sort', 'order', 'cat_id') as $var) {
             $this->{$var} = get_var($var, array('POST', 'GET'), '');
         }
         $this->cat_id = $this->cat_id ? $this->cat_id : 'all';
         $this->save_sessiondata();
     }
     $this->catbo = createobject('phpgwapi.categories', '', 'news_admin');
     $this->cats = $this->catbo->return_array('all', 0, False, '', '', 'cat_name', True);
     settype($this->cats, 'array');
     //change this around 19 Jan 2038 03:14:07 GMT
     $this->unixtimestampmax = 2147483647;
     $this->dateformat = $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
 }
Ejemplo n.º 27
0
 function adduser()
 {
     $args = new safe_args();
     $args->set('username');
     $args->set('passwd', '');
     $args->set('fname', '');
     $args->set('lname', '');
     $args->set('isadmin', False, 'bool');
     $args = $args->get(func_get_args(), __LINE__, __FILE__);
     if (isset($args['username'])) {
         $account_info['account_lid'] = $args['username'];
         $account_info['account_passwd'] = $args['passwd'];
         $account_info['account_firstname'] = $args['fname'];
         $account_info['account_lastname'] = $args['lname'];
         $account_info['account_type'] = 'u';
         $account_info['account_status'] = 'A';
         $account_info['account_expires'] = mktime(0, 0, 0, 12, 31, 2005);
         $newid = $GLOBALS['phpgw']->accounts->create($account_info);
         if ($newid === False) {
             $result['text'] = '';
             return $result;
         }
         $result['text'] = 'Created ' . $args['username'] . ' which has id of ' . $newid;
         $acl = createobject('api_acl', array('account_id' => $newid));
         if ($args['username']) {
             $acl->add('.', 63);
         } else {
             $acl->add('api.base', 1);
             $acl->add('skel.base', 1);
             $acl->add('wcm.base', 1);
             $acl->add('admin.base', 1);
         }
     } else {
         $result['text'] = 'Enter details';
     }
     $GLOBALS['phpgw']->add_xsl('admin.adduser');
     return $result;
 }
 function boacl($session = False)
 {
     $this->so = CreateObject('news_admin.soacl');
     $this->accounts = $GLOBALS['phpgw']->accounts->get_list();
     $this->debug = False;
     //all this is only needed when called from uiacl. not from ui,
     if ($session) {
         $this->read_sessiondata();
         $this->use_session = True;
         foreach (array('start', 'query', 'sort', 'order') as $var) {
             if (isset($_POST[$var])) {
                 $this->{$var} = $_POST[$var];
             } elseif (isset($_GET[$var])) {
                 $this->{$var} = $_GET[$var];
             }
         }
         $this->save_sessiondata();
         $this->catbo = createobject('phpgwapi.categories');
         //				$main_cat = array(array('id' => 0, 'name' => lang('Global news')));
         //				$this->cats = array_merge($main_cat,$this->catbo->return_array('all',$this->start,True,$this->query,$this->sort,'cat_name',True));
         $this->cats = $this->catbo->return_array('all', $this->start, True, $this->query, $this->sort, 'cat_name', True);
     }
     $this->permissions = $this->get_permissions(True);
 }
Ejemplo n.º 29
0
 function __construct()
 {
     $this->so = createobject('admin.solog');
 }
Ejemplo n.º 30
0
function parse_navbar_end()
{
    $tpl = createobject('phpgwapi.Template', PHPGW_TEMPLATE_DIR);
    $tpl->set_unknowns('remove');
    $tpl->set_file(array('footer' => 'footer.tpl'));
    $var = array();
    $var['powered_by'] = lang('Powered by phpGroupWare version %1', $GLOBALS['phpgw_info']['server']['versions']['phpgwapi']);
    if (isset($GLOBALS['phpgw_info']['navbar']['admin']) && isset($GLOBALS['phpgw_info']['user']['preferences']['common']['show_currentusers']) && $GLOBALS['phpgw_info']['user']['preferences']['common']['show_currentusers']) {
        $var['current_users'] = '<a href="' . $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'admin.uicurrentsessions.list_sessions')) . '">' . lang('Current users') . ': ' . $GLOBALS['phpgw']->session->total() . '</a>';
    }
    $now = time();
    $var['user_info'] = $GLOBALS['phpgw']->common->display_fullname() . ' - ' . lang($GLOBALS['phpgw']->common->show_date($now, 'l')) . ' ' . $GLOBALS['phpgw']->common->show_date($now, $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
    $tpl->set_var($var);
    $GLOBALS['phpgw']->hooks->process('navbar_end');
    $tpl->pfp('out', 'footer');
}