function __construct()
 {
     $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
     $GLOBALS['phpgw_info']['flags']['menu_selection'] = 'admin::property';
     $this->nextmatchs = CreateObject('phpgwapi.nextmatchs');
     $this->account = $GLOBALS['phpgw_info']['user']['account_id'];
     $this->bo = CreateObject('property.boadmin', true);
     $this->bopreferences = createObject('preferences.boadmin_acl', true);
     $this->bocommon = CreateObject('property.bocommon');
     $this->acl =& $GLOBALS['phpgw']->acl;
     $this->acl_location = '.admin';
     $this->acl_read = $this->acl->check($this->acl_location, PHPGW_ACL_READ, 'property');
     $this->acl_add = $this->acl->check($this->acl_location, PHPGW_ACL_ADD, 'property');
     $this->acl_edit = $this->acl->check($this->acl_location, PHPGW_ACL_EDIT, 'property');
     $this->acl_delete = $this->acl->check($this->acl_location, PHPGW_ACL_DELETE, 'property');
     $this->acl_manage = $this->acl->check($this->acl_location, 16, 'property');
     //		$this->acl_app				= $this->bo->acl_app;
     $this->start = $this->bo->start;
     $this->query = $this->bo->query;
     $this->sort = $this->bo->sort;
     $this->order = $this->bo->order;
     $this->filter = $this->bo->filter;
     $this->cat_id = $this->bo->cat_id;
     $this->location = $this->bo->location;
     $this->granting_group = $this->bo->granting_group;
     $this->allrows = $this->bo->allrows;
 }
 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');
 }
 public function __construct($session = False)
 {
     $this->currentapp = $GLOBALS['phpgw_info']['flags']['currentapp'];
     $this->so = createObject('phpgwapi.custom_fields');
     if ($session) {
         $this->read_sessiondata();
         $this->use_session = True;
     }
     $start = phpgw::get_var('start', 'int');
     $query = phpgw::get_var('query');
     $sort = phpgw::get_var('sort');
     $order = phpgw::get_var('order');
     $filter = phpgw::get_var('filter');
     $location = phpgw::get_var('location');
     $allrows = phpgw::get_var('allrows', 'bool');
     $appname = phpgw::get_var('appname');
     if ($start) {
         $this->start = $start;
     } else {
         $this->start = 0;
     }
     $this->query = $query;
     $this->filter = $filter;
     $this->sort = $sort;
     $this->order = $order;
     $this->location = $location;
     $this->appname = $appname;
     $this->allrows = $allrows;
 }
 public function __construct()
 {
     if (stristr(PHP_OS, 'WIN')) {
         $sep = ';';
         // Win
     } else {
         $sep = ':';
         // Other
     }
     $java_classpath = "{$sep}.{$sep}";
     foreach (glob(JASPER_LIBS . "*.jar") as $filename) {
         $java_classpath .= $filename . $sep;
     }
     $this->java_classpath = $java_classpath;
     $_key = $GLOBALS['phpgw_info']['server']['setup_mcrypt_key'];
     $_iv = $GLOBALS['phpgw_info']['server']['mcrypt_iv'];
     $crypto = createObject('phpgwapi.crypto', array($_key, $_iv));
     $db_host = $crypto->decrypt($GLOBALS['phpgw_info']['server']['db_host']);
     $db_name = $crypto->decrypt($GLOBALS['phpgw_info']['server']['db_name']);
     $this->db_user = $crypto->decrypt($GLOBALS['phpgw_info']['server']['db_user']);
     $this->db_pass = $crypto->decrypt($GLOBALS['phpgw_info']['server']['db_pass']);
     $this->connection_string = "";
     if ($GLOBALS['phpgw_info']['server']['db_type'] == "postgres") {
         $this->connection_string = "jdbc:postgresql://" . $db_host . ":5432/" . $db_name;
     } elseif ($GLOBALS['phpgw_info']['server']['db_type'] == "mysql") {
         $this->connection_string = "jdbc:postgresql://" . $db_host . ":3306/" . $db_name;
     }
 }
 private function setupBimCss()
 {
     if (!isset($GLOBALS['phpgw']->css) || !is_object($GLOBALS['phpgw']->css)) {
         $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
     }
     $GLOBALS['phpgw']->css->add_external_file('bim/templates/base/css/bim.css');
 }
 function __construct($debug = False)
 {
     $this->debug = $debug;
     $this->title_font_size = 3;
     $this->line_font_size = 2;
     $this->x_font_size = 1;
     $this->title = 'Gantt Chart';
     $this->legend_title = 'Color Legend';
     $this->caption_x = 'x';
     $this->caption_y = 'y';
     $this->num_lines_x = 30;
     $this->num_lines_y = 10;
     $this->split_val = 1;
     $this->line_captions_x = array();
     $this->line_captions_y = array();
     $this->data = array();
     $this->colors = array('red', 'green', 'blue', 'bright green', 'bright blue', 'dark green', 'dark blue', 'olivedrab4', 'dove', 'seagreen', 'midnightblue');
     $this->color_legend = array();
     $this->color_extra = 'yellow';
     $this->legend_bottom = 40;
     $this->graph_width = 800;
     $this->graph_height = 400;
     $this->margin_top = 70;
     $this->margin_left = 150;
     $this->margin_bottom = 40;
     $this->margin_right = 20;
     $this->img = createObject('phpgwapi.gdimage');
     $this->temp_file = $this->img->temp_file;
 }
 function __construct()
 {
     $GLOBALS['phpgw_info']['flags']['noframework'] = true;
     require_once PHPGW_SERVER_ROOT . '/felamimail/inc/xajax.inc.php';
     $xajax = new xajax($GLOBALS['phpgw']->link('/felamimail/xajax.php', false, true), 'xajax_', 'utf-8');
     $xajax->waitCursorOff();
     $xajax->registerFunction("doXMLHTTP");
     $GLOBALS['phpgw_info']['flags']['java_script'] .= $xajax->getJavascript($GLOBALS['phpgw_info']['server']['webserver_url'] . '/felamimail/js/');
     $GLOBALS['phpgw']->js->validate_file('jsapi', 'jsapi', 'felamimail');
     $this->displayCharset = 'utf-8';
     if (!isset($_POST['composeid']) && !isset($_GET['composeid'])) {
         // create new compose session
         $this->bocompose = CreateObject('felamimail.bocompose', '', $this->displayCharset);
         $this->composeID = $this->bocompose->getComposeID();
     } else {
         // reuse existing compose session
         if (isset($_POST['composeid'])) {
             $this->composeID = $_POST['composeid'];
         } else {
             $this->composeID = $_GET['composeid'];
         }
         $this->bocompose = CreateObject('felamimail.bocompose', $this->composeID, $this->displayCharset);
     }
     $this->t = CreateObject('phpgwapi.Template', PHPGW_APP_TPL);
     $this->bofelamimail = CreateObject('felamimail.bofelamimail', $this->displayCharset);
     $this->mailPreferences = ExecMethod('felamimail.bopreferences.getPreferences');
     $this->t->set_unknowns('remove');
     $this->rowColor[0] = $GLOBALS['phpgw_info']["theme"]["bg01"];
     $this->rowColor[1] = $GLOBALS['phpgw_info']["theme"]["bg02"];
     if (!isset($GLOBALS['phpgw']->css) || !is_object($GLOBALS['phpgw']->css)) {
         $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
     }
     $GLOBALS['phpgw']->css->validate_file('app', 'felamimail');
 }
 function __construct()
 {
     $this->season_so = CreateObject('booking.soseason');
     $this->resource_so = CreateObject('booking.soresource');
     $this->customer_id = CreateObject('booking.customer_identifier');
     parent::__construct('bb_completed_reservation', array('id' => array('type' => 'int'), 'reservation_type' => array('type' => 'string', 'required' => True, 'nullable' => False), 'reservation_id' => array('type' => 'int', 'required' => True, 'nullable' => False), 'season_id' => array('type' => 'int'), 'cost' => array('type' => 'decimal', 'required' => true), 'from_' => array('type' => 'timestamp', 'required' => true), 'to_' => array('type' => 'timestamp', 'required' => true), 'organization_id' => array('type' => 'int'), 'customer_type' => array('type' => 'string', 'nullable' => False), 'customer_identifier_type' => array('type' => 'string', 'required' => False), 'customer_organization_number' => array('type' => 'string', 'precision' => '9', 'sf_validator' => createObject('booking.sfValidatorNorwegianOrganizationNumber', array(), array('invalid' => '%field% is invalid'))), 'customer_ssn' => array('type' => 'string', 'sf_validator' => createObject('booking.sfValidatorNorwegianSSN')), 'exported' => array('type' => 'int'), 'description' => array('type' => 'string', 'required' => True, 'nullable' => False), 'article_description' => array('type' => 'string', 'required' => True, 'nullable' => False, 'precision' => 35), 'building_id' => array('type' => 'string', 'required' => True), 'building_name' => array('type' => 'string', 'required' => True), 'export_file_id' => array('type' => 'int'), 'invoice_file_order_id' => array('type' => 'string'), 'season_name' => array('type' => 'string', 'query' => true, 'join' => array('table' => 'bb_season', 'fkey' => 'season_id', 'key' => 'id', 'column' => 'name')), 'organization_name' => array('type' => 'string', 'query' => true, 'join' => array('table' => 'bb_organization', 'fkey' => 'organization_id', 'key' => 'id', 'column' => 'name')), 'resources' => array('type' => 'int', 'required' => True, 'manytomany' => array('table' => 'bb_completed_reservation_resource', 'key' => 'completed_reservation_id', 'column' => 'resource_id'))));
 }
Example #9
0
function importDir($parent, $path)
{
	global $abspath;
	$logtext = "";
	
	$node_id = getNode($parent->getPath()."/".basename($path));
	
	if ($node_id <= 0)
	{
		$node_id = createObject($parent, basename($path), "file_folder");
		$logtext .= "Created ".$parent->getPathInTree()."/".basename($path)."<br/>";
		
		if ($node_id === false)
			return false;
	}
	
	$new_parent = new mObject($node_id);
	
	$subitems = GetSubfilesAndSubfolders($path);
	
	foreach ($subitems as $subitem)
	{
		if (is_dir("$path/$subitem"))
			$logtext .= importDir($new_parent, "$path/$subitem");
		else
		{
			createObject($new_parent, $subitem, "file", array("file" => "$subitem:$path/$subitem"));
			$logtext .= "Created ".$new_parent->getPathInTree()."/$subitem<br/>";
		}
	}
	
	return $logtext;
}
 function __construct()
 {
     $GLOBALS['phpgw_info']['flags']['noframework'] = true;
     $GLOBALS['phpgw_info']['flags']['headonly'] = true;
     $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
     $this->bo = CreateObject('property.bolookup', true);
     $this->start = $this->bo->start;
     $this->query = $this->bo->query;
     $this->sort = $this->bo->sort;
     $this->order = $this->bo->order;
     $this->filter = $this->bo->filter;
     $this->cat_id = $this->bo->cat_id;
     $this->part_of_town_id = $this->bo->part_of_town_id;
     $this->district_id = $this->bo->district_id;
     phpgwapi_yui::load_widget('tabview');
     phpgwapi_yui::load_widget('dragdrop');
     phpgwapi_yui::load_widget('datatable');
     phpgwapi_yui::load_widget('menu');
     phpgwapi_yui::load_widget('connection');
     phpgwapi_yui::load_widget('loader');
     phpgwapi_yui::load_widget('tabview');
     phpgwapi_yui::load_widget('paginator');
     phpgwapi_yui::load_widget('animation');
     if (!isset($GLOBALS['phpgw']->css) || !is_object($GLOBALS['phpgw']->css)) {
         $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
     }
     // Prepare CSS Style
     $GLOBALS['phpgw']->css->validate_file('datatable');
     $GLOBALS['phpgw']->css->validate_file('property');
     $GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
     $GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
     $GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
     $GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
 }
 function __construct($dbms)
 {
     switch ($dbms) {
         case 'mysql':
             $this->m_oTranslator = createObject('phpgwapi.schema_proc_mysql');
             break;
         case 'postgres':
             $this->m_oTranslator = createObject('phpgwapi.schema_proc_pgsql');
             break;
         case 'oracle':
             $this->m_oTranslator = createObject('phpgwapi.schema_proc_oracle');
             break;
         case 'sapdb':
             $this->m_oTranslator = createObject('phpgwapi.schema_proc_sapdb');
             break;
         case 'mssql':
             $this->m_oTranslator = createObject('phpgwapi.schema_proc_mssql');
             break;
         default:
             //what now?
     }
     $this->m_oDeltaProc = createObject('phpgwapi.schema_proc_array');
     $this->m_aTables = array();
     $this->m_bDeltaOnly = False;
     // Default to false here in case it's just a CreateTable script
     $this->dbms = $dbms;
 }
 /**
  * Handle instance variables better - this way we only load what we need
  *
  * @param string $var the variable name to get
  */
 public function __get($var)
 {
     if (!isset($this->instance_vars[$var]) || !is_object($this->instance_vars[$var])) {
         $this->instance_vars[$var] = createObject("phpgwapi.{$var}");
     }
     return $this->instance_vars[$var];
 }
 function get_available_users()
 {
     $users = array();
     $config = createObject('phpgwapi.config', 'messenger');
     $config->read();
     if (isset($config->config_data['restrict_to_group']) && $config->config_data['restrict_to_group'] && !isset($GLOBALS['phpgw_info']['user']['apps']['admin'])) {
         foreach ($config->config_data['restrict_to_group'] as $restrict_to_group) {
             $tmp_users = $GLOBALS['phpgw']->accounts->member($restrict_to_group, true);
             foreach ($tmp_users as $user) {
                 $users[$user['account_id']] = $user['account_name'];
             }
         }
         if ($users) {
             array_multisort($users, SORT_ASC, $users);
         }
     } else {
         $tmp_users = $GLOBALS['phpgw']->accounts->get_list('accounts', -1, 'ASC', 'account_lastname', '', -1);
         foreach ($tmp_users as $user) {
             if ($user->enabled) {
                 $users[$user->id] = $GLOBALS['phpgw']->common->display_fullname($user->lid, $user->firstname, $user->lastname);
             }
         }
     }
     return $users;
 }
 public function get_db()
 {
     if ($this->db && is_object($this->db)) {
         return $this->db;
     }
     $config = CreateObject('phpgwapi.config', 'rental');
     $config->read();
     if (!$config->config_data['external_db_host'] || !$this->ping($config->config_data['external_db_host'])) {
         $message = "Database server {$config->config_data['external_db_host']} is not accessible";
         phpgwapi_cache::message_set($message, 'error');
         return false;
     }
     $db = createObject('phpgwapi.db', null, null, true);
     $db->debug = !!$config->config_data['external_db_debug'];
     $db->Host = $config->config_data['external_db_host'];
     $db->Port = $config->config_data['external_db_port'];
     $db->Type = $config->config_data['external_db_type'];
     $db->Database = $config->config_data['external_db_name'];
     $db->User = $config->config_data['external_db_user'];
     $db->Password = $config->config_data['external_db_password'];
     try {
         $db->connect();
         $this->connected = true;
     } catch (Exception $e) {
         $status = lang('unable_to_connect_to_database');
     }
     $this->db = $db;
     return $db;
 }
 public function get_db()
 {
     if ($this->db && is_object($this->db)) {
         return $this->db;
     }
     $config = CreateObject('phpgwapi.config', 'rental');
     $config->read();
     if (!$config->config_data['external_db_host'] || !$this->ping($config->config_data['external_db_host'])) {
         $message = "Database server {$config->config_data['external_db_host']} is not accessible";
         phpgwapi_cache::message_set($message, 'error');
         return false;
     }
     $db = createObject('phpgwapi.db', null, null, true);
     $db->debug = !!$config->config_data['external_db_debug'];
     $db->Host = $config->config_data['external_db_host'];
     $db->Port = $config->config_data['external_db_port'];
     $db->Type = $config->config_data['external_db_type'];
     $db->Database = $config->config_data['external_db_name'];
     $db->User = $config->config_data['external_db_user'];
     $db->Password = $config->config_data['external_db_password'];
     $db->Halt_On_Error = 'no';
     try {
         $db->connect();
     } catch (Exception $e) {
         phpgwapi_cache::message_set('Could not connect to backend-server ' . $config->config_data['external_db_host'], 'error');
         $GLOBALS['phpgw']->redirect_link('/home.php');
     }
     $this->db = $db;
     return $db;
 }
Example #16
0
 /**
  * Output a pdf
  *
  * @param string $document the pdf document as a string
  * @param string $document_name the name to save the document as
  */
 function print_pdf($document = '', $document_name = 'document')
 {
     $browser = createObject('phpgwapi.browser');
     $size = strlen($document);
     $browser->content_header($document_name . '.pdf', 'application/x-pdf', $size);
     echo $document;
 }
 function __construct($session = false)
 {
     //		$this->so 			= CreateObject('property.soifc');
     $this->bocommon = createObject('property.bocommon');
     $this->custom = createObject('property.custom_fields');
     $this->acl_location = '.ifc';
     if ($session) {
         $this->read_sessiondata();
         $this->use_session = true;
     }
     $start = phpgw::get_var('start', 'int', 'REQUEST', 0);
     $query = phpgw::get_var('query');
     $sort = phpgw::get_var('sort');
     $order = phpgw::get_var('order');
     $filter = phpgw::get_var('filter', 'int');
     $cat_id = phpgw::get_var('cat_id', 'int');
     $allrows = phpgw::get_var('allrows', 'bool');
     if ($start) {
         $this->start = $start;
     } else {
         $this->start = 0;
     }
     if (array_key_exists('query', $_POST) || array_key_exists('query', $_GET)) {
         $this->query = $query;
     }
     if (array_key_exists('filter', $_POST) || array_key_exists('filter', $_GET)) {
         $this->filter = $filter;
     }
     if (array_key_exists('sort', $_POST) || array_key_exists('sort', $_GET)) {
         $this->sort = $sort;
     }
     if (array_key_exists('order', $_POST) || array_key_exists('order', $_GET)) {
         $this->order = $order;
     }
     if (array_key_exists('cat_id', $_POST) || array_key_exists('cat_id', $_GET)) {
         $this->cat_id = $cat_id;
     }
     if ($allrows) {
         $this->allrows = $allrows;
     }
     switch ($GLOBALS['phpgw_info']['server']['db_type']) {
         case 'mssql':
             $this->dateformat = "M d Y";
             $this->datetimeformat = "M d Y g:iA";
             break;
         case 'mysql':
             $this->dateformat = "Y-m-d";
             $this->datetimeformat = "Y-m-d G:i:s";
             break;
         case 'pgsql':
             $this->dateformat = "Y-m-d";
             $this->datetimeformat = "Y-m-d G:i:s";
             break;
         case 'postgres':
             $this->dateformat = "Y-m-d";
             $this->datetimeformat = "Y-m-d G:i:s";
             break;
     }
 }
Example #18
0
function createCollection()
{
    $collection = array();
    for ($i = 0; $i < 50; $i++) {
        $collection[] = createObject();
    }
    return $collection;
}
Example #19
0
function createCollection()
{
    $collection = [];
    for ($i = 0; $i < 50; ++$i) {
        $collection[] = createObject();
    }
    return $collection;
}
 public function list_log()
 {
     if ($GLOBALS['phpgw']->acl->check('error_log_access', 1, 'admin')) {
         $GLOBALS['phpgw']->redirect_link('/admin/index.php');
     }
     $account_id = phpgw::get_var('account_id', 'int');
     $start = phpgw::get_var('start', 'int');
     $sort = phpgw::get_var('sort', 'int');
     $order = phpgw::get_var('order', 'int');
     $GLOBALS['phpgw_info']['flags']['app_header'] = lang('Admin') . ' - ' . lang('View error log');
     if ($account_id) {
         $GLOBALS['phpgw_info']['flags']['app_header'] .= ' ' . lang('for') . ' ' . $GLOBALS['phpgw']->common->grab_owner_name($account_id);
     }
     $GLOBALS['phpgw']->common->phpgw_header(true);
     $bo = createObject('admin.bolog');
     $nextmatches = createObject('phpgwapi.nextmatchs');
     $t =& $GLOBALS['phpgw']->template;
     $t->set_root(PHPGW_APP_TPL);
     $t->set_file(array('errorlog' => 'errorlog_view.tpl', 'form_button' => 'form_button_script.tpl'));
     $t->set_block('errorlog', 'list');
     $t->set_block('errorlog', 'row');
     $t->set_block('errorlog', 'row_empty');
     $total_records = $bo->total($account_id);
     $var = array('nextmatchs_left' => $nextmatches->left('/index.php', $start, $total_records, '&menuaction=admin.uilog.list_log&account_id=' . $account_id), 'nextmatchs_right' => $nextmatches->right('/index.php', $start, $total_records, '&menuaction=admin.uilog.list_log&account_id=' . $account_id), 'showing' => $nextmatches->show_hits($total_records, $start), 'lang_loginid' => lang('LoginID'), 'lang_date' => lang('time'), 'lang_app' => lang('module'), 'lang_severity' => lang('severity'), 'lang_line' => lang('line'), 'lang_file' => lang('file'), 'lang_message' => lang('log message'), 'lang_total' => lang('Total'));
     $t->set_var($var);
     $records = $bo->list_log($account_id, $start, $order, $sort);
     if (!is_array($records) || !count($records)) {
         $t->set_var(array('row_message' => lang('No error log records exist for this user'), 'tr_class' => 'row_on'));
         $t->fp('rows_access', 'row_empty', true);
     } else {
         $tr_class = '';
         foreach ($records as $record) {
             $tr_class = $nextmatches->alternate_row_class($tr_class);
             $t->set_var(array('row_date' => $record['log_date'], 'row_loginid' => $record['log_account_lid'], 'row_app' => $record['log_app'], 'row_severity' => $record['log_severity'], 'row_file' => $record['log_file'], 'row_line' => $record['log_line'], 'row_message' => $record['log_msg'], 'tr_class' => $tr_class));
             $t->parse('rows_access', 'row', true);
         }
     }
     if ($total_records) {
         if ($account_id) {
             $var = array('submit_button' => lang('Submit'), 'action_url_button' => $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'admin.uilog.purge_log', 'account_id' => $account_id)), 'action_text_button' => ' ' . lang('Delete all log records for %1', $GLOBALS['phpgw']->common->grab_owner_name($account_id)), 'action_confirm_button' => '', 'action_extra_field' => '');
         } else {
             $var = array('submit_button' => lang('Submit'), 'action_url_button' => $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'admin.uilog.purge_log')), 'action_text_button' => ' ' . lang('Delete all log records'), 'action_confirm_button' => '', 'action_extra_field' => '');
         }
         $t->set_var($var);
         $var['purge_log_button'] = $t->fp('button', 'form_button', true);
         $t->set_var($var);
     }
     if ($account_id) {
         $account_name = $GLOBALS['phpgw']->common->grab_owner_name($account_id);
         $var = array('footer_total' => lang('Total records for %1 : %2', $account_name, $total_records));
     } else {
         $var = array('footer_total' => lang('Total records: %1', $total_records));
     }
     // create the menu on the left, if needed
     //$var['rows'] = createObject('admin.uimenuclass')->createHTMLCode('view_account');
     //$t->set_var($var);
     $t->pfp('out', 'list');
 }
Example #21
0
	function actionImport_upload(&$system, $args)
	{
		global $abspath;
		$chroot = "$abspath/upload";
		
		$object = new mObject($this->getNodeId($args));
		
		if ($object->getNodeId() <= 0)
		{
			$system->addAlert(ucf(i18n("invalid upload target")));
			return;
		}
		
		if (!$object->hasRight("write"))
		{
			$system->addAlert(ucf(i18n("not enough rights")));
			return;
		}
		
		// Validate path... only folders under upload
		
		if (count($args['filenames']) == 0)
		{
			$system->addAlert(ucf(i18n("you must select some files or folders to import")));
			return;
		}
		
		$path = empty($args['path']) ? "/" : urldecode($args['path']);
		$fullpath = extractPath("$chroot$path");
		
		$testpath = substr($fullpath, 0, strlen($chroot));
		if ($testpath != $chroot)
		{
			$system->addAlert(ucf(i18n("this path is not allowed")));
			return;
		}
		
		$logtext = "<strong>Beginning import from upload folder</strong> - ".date("Y-m-d H:i:s")."<hr/>";
		
		foreach ($args['filenames'] as $filename)
		{
			if (is_dir("$fullpath$filename"))
			{
				$logtext .= importDir($object, "$fullpath$filename");
			}
			else if (is_file("$fullpath$filename"))
			{
				createObject($object, $filename, "file", array("file" => "$filename:$fullpath$filename"));
				$logtext .= "Created ".$object->getPathInTree()."/$filename<br/>";
			}
			else
				$logtext .= "Did not find $path$filename - skipping<br/>";
		}
		
		$logtext .= "<hr/><strong>Finished import</strong> - ".date("Y-m-d H:i:s")."<br/><br/>";
		
		$system->paddZoneData("zone_import_log", utf8e($logtext));
	}
 public function __construct()
 {
     $this->account = (int) $GLOBALS['phpgw_info']['user']['account_id'];
     $this->_db =& $GLOBALS['phpgw']->db;
     $this->_join =& $this->_db->join;
     $this->_like =& $this->_db->like;
     $this->_left_join =& $this->_db->left_join;
     $this->custom = createObject('property.custom_fields');
 }
 function utilities_()
 {
     //      $GLOBALS['phpgw']->rssparser = createObject("phpgwapi.rssparser");
     //      $GLOBALS['phpgw']->clientsniffer = createObject("phpgwapi.clientsniffer");
     //      $GLOBALS['phpgw']->http = createObject("phpgwapi.http");
     //     $GLOBALS['phpgw']->matrixview = createObject("phpgwapi.matrixview");
     //     $GLOBALS['phpgw']->menutree = createObject("phpgwapi.menutree");
     $GLOBALS['phpgw']->sbox = createObject('phpgwapi.portalbox');
 }
 function __construct()
 {
     $this->account = (int) $GLOBALS['phpgw_info']['user']['account_id'];
     $this->historylog = CreateObject('property.historylog', 'tts');
     $this->custom = createObject('property.custom_fields');
     $this->db =& $GLOBALS['phpgw']->db;
     $this->like =& $this->db->like;
     $this->join =& $this->db->join;
     $this->left_join =& $this->db->left_join;
     $this->dateformat = $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
 }
 function __construct($type = '', $type_id = 0)
 {
     $this->account = $GLOBALS['phpgw_info']['user']['account_id'];
     $this->custom = createObject('property.custom_fields');
     $this->_db =& $GLOBALS['phpgw']->db;
     $this->_db2 = clone $this->_db;
     $this->_like =& $this->_db->like;
     $this->_join =& $this->_db->join;
     if ($type) {
         $this->get_location_info($type, $type_id);
     }
 }
 /**
  * Test Custom Fields add method
  *
  * @return void
  */
 public function testAdd()
 {
     $GLOBALS['phpgw']->locations->add('.test', 'Custom Functions Unit Test', 'phpgwapi', false, 'aaaa_test');
     $oProc = createObject('phpgwapi.schema_proc', $GLOBALS['phpgw_info']['server']['db_type']);
     $oProc->m_odb =& $GLOBALS['phpgw']->db;
     $table_def = array('fd' => array('aaaa_id' => array('type' => 'auto', 'precision' => 4, 'nullable' => false)), 'pk' => array('aaaa_id'), 'fk' => array(), 'ix' => array(), 'uc' => array());
     $oProc->createTable('aaaa_test', $table_def);
     $status = 'this value is ignored by modern browsers default configs';
     $field = array('appname' => 'phpgwapi', 'location' => '.test', 'column_name' => 'test_entry', 'input_text' => 'this is a test entry', 'statustext' => $status, 'search' => true, 'list' => true, 'history' => true, 'disabled' => false, 'helpmsg' => 'i am helpful - i think', 'attrib_sort' => 0, 'nullable' => true, 'column_info' => array('type' => 'V', 'precision' => 50, 'scale' => '', 'default' => ''));
     $this->fieldID = $GLOBALS['phpgw']->custom_fields->add($field);
     $this->assertTrue($this->fieldID > 0);
 }
 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 __construct($acl_location)
 {
     $this->account =& $GLOBALS['phpgw_info']['user']['account_id'];
     $this->db =& $GLOBALS['phpgw']->db;
     $this->like =& $this->db->like;
     $this->join =& $this->db->join;
     $this->left_join =& $this->db->left_join;
     $this->acl_location = $acl_location;
     $this->custom = createObject('property.custom_fields');
     $GLOBALS['phpgw']->acl->set_account_id($this->account);
     $this->grants = $GLOBALS['phpgw']->acl->get_grants('demo', $this->acl_location);
 }
Example #29
0
function sender2phpgw_lid($sender_email)
{
    $contacts = createObject('phpgwapi.contacts');
    $contact_id = $contacts->search(array('comm_data'), $sender_email);
    unset($contacts);
    if (is_array($contact_id) && count($contact_id)) {
        $userid = $GLOBALS['phpgw']->accounts->search_person($contact_id[0]);
        if ($userid) {
            return $GLOBALS['phpgw']->accounts->id2lid($userid);
        }
    }
    return 0;
}
 function __construct($entity_id = '', $cat_id = '')
 {
     $this->account = $GLOBALS['phpgw_info']['user']['account_id'];
     $this->bocommon = CreateObject('property.bocommon');
     $this->custom = createObject('property.custom_fields');
     $this->db =& $GLOBALS['phpgw']->db;
     $this->db2 = clone $this->db;
     $this->join =& $this->db->join;
     $this->left_join =& $this->db->left_join;
     $this->like =& $this->db->like;
     $this->entity_id = $entity_id;
     $this->cat_id = $cat_id;
 }