diff --git a/infolog/csv_import.php b/infolog/csv_import.php index 4fddfdbf7c..f200e8d0c8 100644 --- a/infolog/csv_import.php +++ b/infolog/csv_import.php @@ -12,53 +12,53 @@ /* $Id$ */ - $GLOBALS['phpgw_info']['flags'] = array( + $GLOBALS['egw_info']['flags'] = array( 'currentapp' => 'infolog', 'noheader' => True, 'enable_contacts_class' => True, ); include('../header.inc.php'); - if (!isset($GLOBALS['phpgw_info']['user']['apps']['admin']) || - !$GLOBALS['phpgw_info']['user']['apps']['admin']) // no admin + if (!isset($GLOBALS['egw_info']['user']['apps']['admin']) || + !$GLOBALS['egw_info']['user']['apps']['admin']) // no admin { - $GLOBALS['phpgw']->redirect_link('/home.php'); + $GLOBALS['egw']->redirect_link('/home.php'); } if (isset($_FILES['csvfile']['tmp_name'])) { - $csvfile = tempnam($GLOBALS['phpgw_info']['server']['temp_dir'],$GLOBALS['phpgw_info']['flags']['currentapp']."_"); - $GLOBALS['phpgw']->session->appsession('csvfile','',$csvfile); + $csvfile = tempnam($GLOBALS['egw_info']['server']['temp_dir'],$GLOBALS['egw_info']['flags']['currentapp']."_"); + $GLOBALS['egw']->session->appsession('csvfile','',$csvfile); $_POST['action'] = move_uploaded_file($_FILES['csvfile']['tmp_name'],$csvfile) ? 'download' : ''; } else { - $csvfile = $GLOBALS['phpgw']->session->appsession('csvfile'); + $csvfile = $GLOBALS['egw']->session->appsession('csvfile'); } if ($_POST['cancel']) { @unlink($csvfile); - $GLOBALS['phpgw']->redirect_link('/admin/index.php'); + $GLOBALS['egw']->redirect_link('/admin/index.php'); } - $GLOBALS['phpgw_info']['flags']['app_header'] = lang('InfoLog - Import CSV-File'); - $GLOBALS['phpgw']->common->phpgw_header(); + $GLOBALS['egw_info']['flags']['app_header'] = lang('InfoLog - Import CSV-File'); + $GLOBALS['egw']->common->egw_header(); $boinfolog = createobject('infolog.boinfolog'); - $GLOBALS['phpgw']->template->set_file(array('import_t' => 'csv_import.tpl')); - $GLOBALS['phpgw']->template->set_block('import_t','filename','filenamehandle'); - $GLOBALS['phpgw']->template->set_block('import_t','fheader','fheaderhandle'); - $GLOBALS['phpgw']->template->set_block('import_t','fields','fieldshandle'); - $GLOBALS['phpgw']->template->set_block('import_t','ffooter','ffooterhandle'); - $GLOBALS['phpgw']->template->set_block('import_t','imported','importedhandle'); - $GLOBALS['phpgw']->template->set_block('import_t','import','importhandle'); + $GLOBALS['egw']->template->set_file(array('import_t' => 'csv_import.tpl')); + $GLOBALS['egw']->template->set_block('import_t','filename','filenamehandle'); + $GLOBALS['egw']->template->set_block('import_t','fheader','fheaderhandle'); + $GLOBALS['egw']->template->set_block('import_t','fields','fieldshandle'); + $GLOBALS['egw']->template->set_block('import_t','ffooter','ffooterhandle'); + $GLOBALS['egw']->template->set_block('import_t','imported','importedhandle'); + $GLOBALS['egw']->template->set_block('import_t','import','importhandle'); if(($_POST['action'] == 'download' || $_POST['action'] == 'continue') && (!$_POST['fieldsep'] || !$csvfile || !($fp=fopen($csvfile,'rb')))) { $_POST['action'] = ''; } - $GLOBALS['phpgw']->template->set_var("action_url",$GLOBALS['phpgw']->link("/infolog/csv_import.php")); + $GLOBALS['egw']->template->set_var("action_url",$GLOBALS['egw']->link("/infolog/csv_import.php")); $PSep = '||'; // Pattern-Separator, separats the pattern-replacement-pairs in trans $ASep = '|>'; // Assignment-Separator, separats pattern and replacesment @@ -111,22 +111,22 @@ function cat_id($cats) } else { - if (!is_object($GLOBALS['phpgw']->categories)) + if (!is_object($GLOBALS['egw']->categories)) { - $GLOBALS['phpgw']->categories = createobject('phpgwapi.categories'); + $GLOBALS['egw']->categories = createobject('phpgwapi.categories'); } - if (is_numeric($cat) && $GLOBALS['phpgw']->categories->id2name($cat) != '--') + if (is_numeric($cat) && $GLOBALS['egw']->categories->id2name($cat) != '--') { $cat2id[$cat] = $ids[$cat] = $cat; } - elseif ($id = $GLOBALS['phpgw']->categories->name2id( addslashes($cat) )) + elseif ($id = $GLOBALS['egw']->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) ); + $GLOBALS['egw']->categories->add( array('name' => $cat,'descr' => $cat )); + $cat2id[$cat] = $ids[$cat] = $GLOBALS['egw']->categories->name2id( addslashes($cat) ); } } } @@ -139,45 +139,45 @@ function cat_id($cats) return $id_str; } - if (!is_object($GLOBALS['phpgw']->html)) + if (!is_object($GLOBALS['egw']->html)) { - $GLOBALS['phpgw']->html = CreateObject('phpgwapi.html'); + $GLOBALS['egw']->html =& CreateObject('phpgwapi.html'); } if ($_POST['next']) $_POST['action'] = 'next'; switch ($_POST['action']) { case '': // Start, ask Filename - $GLOBALS['phpgw']->template->set_var('lang_csvfile',lang('CSV-Filename')); - $GLOBALS['phpgw']->template->set_var('lang_fieldsep',lang('Fieldseparator')); - $GLOBALS['phpgw']->template->set_var('lang_charset',lang('Charset of file')); - $GLOBALS['phpgw']->template->set_var('select_charset', - $GLOBALS['phpgw']->html->select('charset','', - $GLOBALS['phpgw']->translation->get_installed_charsets()+ + $GLOBALS['egw']->template->set_var('lang_csvfile',lang('CSV-Filename')); + $GLOBALS['egw']->template->set_var('lang_fieldsep',lang('Fieldseparator')); + $GLOBALS['egw']->template->set_var('lang_charset',lang('Charset of file')); + $GLOBALS['egw']->template->set_var('select_charset', + $GLOBALS['egw']->html->select('charset','', + $GLOBALS['egw']->translation->get_installed_charsets()+ array('utf-8' => 'utf-8 (Unicode)'),True)); - $GLOBALS['phpgw']->template->set_var('fieldsep',$_POST['fieldsep'] ? $_POST['fieldsep'] : ','); - $GLOBALS['phpgw']->template->set_var('submit',lang('Import')); - $GLOBALS['phpgw']->template->set_var('enctype','ENCTYPE="multipart/form-data"'); + $GLOBALS['egw']->template->set_var('fieldsep',$_POST['fieldsep'] ? $_POST['fieldsep'] : ','); + $GLOBALS['egw']->template->set_var('submit',lang('Import')); + $GLOBALS['egw']->template->set_var('enctype','ENCTYPE="multipart/form-data"'); - $GLOBALS['phpgw']->template->parse('rows','filename'); + $GLOBALS['egw']->template->parse('rows','filename'); break; case 'continue': case 'download': - $GLOBALS['phpgw']->preferences->read_repository(); - $defaults = $GLOBALS['phpgw_info']['user']['preferences']['infolog']['cvs_import']; + $GLOBALS['egw']->preferences->read_repository(); + $defaults = $GLOBALS['egw_info']['user']['preferences']['infolog']['cvs_import']; if (!is_array($defaults)) { $defaults = array(); } - $GLOBALS['phpgw']->template->set_var('lang_csv_fieldname',lang('CSV-Fieldname')); - $GLOBALS['phpgw']->template->set_var('lang_info_fieldname',lang('InfoLog-Fieldname')); - $GLOBALS['phpgw']->template->set_var('lang_translation',lang("Translation").' '.lang('help').''); - $GLOBALS['phpgw']->template->set_var('submit', - $GLOBALS['phpgw']->html->submit_button('convert','Import') . ' '. - $GLOBALS['phpgw']->html->submit_button('cancel','Cancel')); - $GLOBALS['phpgw']->template->set_var('lang_debug',lang('Test Import (show importable records only in browser)')); - $GLOBALS['phpgw']->template->parse('rows','fheader'); + $GLOBALS['egw']->template->set_var('lang_csv_fieldname',lang('CSV-Fieldname')); + $GLOBALS['egw']->template->set_var('lang_info_fieldname',lang('InfoLog-Fieldname')); + $GLOBALS['egw']->template->set_var('lang_translation',lang("Translation").' '.lang('help').''); + $GLOBALS['egw']->template->set_var('submit', + $GLOBALS['egw']->html->submit_button('convert','Import') . ' '. + $GLOBALS['egw']->html->submit_button('cancel','Cancel')); + $GLOBALS['egw']->template->set_var('lang_debug',lang('Test Import (show importable records only in browser)')); + $GLOBALS['egw']->template->parse('rows','fheader'); $info_names = array( 'type' => 'Type: char(10) task,phone,note,confirm,reject,email,fax', @@ -221,41 +221,41 @@ function cat_id($cats) $info_name_options = "none\n"; foreach($info_names as $field => $name) { - $info_name_options .= "".$GLOBALS['phpgw']->strip_html($name)."\n"; + $info_name_options .= "".$GLOBALS['egw']->strip_html($name)."\n"; } $csv_fields = fgetcsv($fp,8000,$_POST['fieldsep']); - $csv_fields = $GLOBALS['phpgw']->translation->convert($csv_fields,$_POST['charset']); + $csv_fields = $GLOBALS['egw']->translation->convert($csv_fields,$_POST['charset']); $csv_fields[] = 'no CSV 1'; // eg. for static assignments $csv_fields[] = 'no CSV 2'; $csv_fields[] = 'no CSV 3'; foreach($csv_fields as $csv_idx => $csv_field) { - $GLOBALS['phpgw']->template->set_var('csv_field',$csv_field); - $GLOBALS['phpgw']->template->set_var('csv_idx',$csv_idx); + $GLOBALS['egw']->template->set_var('csv_field',$csv_field); + $GLOBALS['egw']->template->set_var('csv_idx',$csv_idx); if ($def = $defaults[$csv_field]) { list( $info,$trans ) = explode($PSep,$def,2); - $GLOBALS['phpgw']->template->set_var('trans',$trans); - $GLOBALS['phpgw']->template->set_var('info_fields',str_replace('="'.$info.'">','="'.$info.'" selected>',$info_name_options)); + $GLOBALS['egw']->template->set_var('trans',$trans); + $GLOBALS['egw']->template->set_var('info_fields',str_replace('="'.$info.'">','="'.$info.'" selected>',$info_name_options)); } else { - $GLOBALS['phpgw']->template->set_var('trans',''); - $GLOBALS['phpgw']->template->set_var('info_fields',$info_name_options); + $GLOBALS['egw']->template->set_var('trans',''); + $GLOBALS['egw']->template->set_var('info_fields',$info_name_options); } - $GLOBALS['phpgw']->template->parse('rows','fields',True); + $GLOBALS['egw']->template->parse('rows','fields',True); } - $GLOBALS['phpgw']->template->set_var('lang_start',lang('Startrecord')); - $GLOBALS['phpgw']->template->set_var('start',get_var('start',array('POST'),1)); + $GLOBALS['egw']->template->set_var('lang_start',lang('Startrecord')); + $GLOBALS['egw']->template->set_var('start',get_var('start',array('POST'),1)); $msg = ($safe_mode = ini_get('safe_mode') == 'On') ? lang('to many might exceed your execution-time-limit'): lang('empty for all'); - $GLOBALS['phpgw']->template->set_var('lang_max',lang('Number of records to read (%1)',$msg)); - $GLOBALS['phpgw']->template->set_var('max',get_var('max',array('POST'),$safe_mode ? 200 : '')); - $GLOBALS['phpgw']->template->set_var('debug',get_var('debug',array('POST'),True)?' checked':''); - $GLOBALS['phpgw']->template->parse('rows','ffooter',True); + $GLOBALS['egw']->template->set_var('lang_max',lang('Number of records to read (%1)',$msg)); + $GLOBALS['egw']->template->set_var('max',get_var('max',array('POST'),$safe_mode ? 200 : '')); + $GLOBALS['egw']->template->set_var('debug',get_var('debug',array('POST'),True)?' checked':''); + $GLOBALS['egw']->template->parse('rows','ffooter',True); fclose($fp); - $hiddenvars = $GLOBALS['phpgw']->html->input_hidden(array( + $hiddenvars = $GLOBALS['egw']->html->input_hidden(array( 'action' => 'import', 'fieldsep'=> $_POST['fieldsep'], 'charset' => $_POST['charset'] @@ -292,7 +292,7 @@ function cat_id($cats) "will be automaticaly added.". "I hope that helped to understand the features, if not ask."; - $GLOBALS['phpgw']->template->set_var('help_on_trans',lang($help_on_trans)); // I don't think anyone will translate this + $GLOBALS['egw']->template->set_var('help_on_trans',lang($help_on_trans)); // I don't think anyone will translate this break; case 'next': @@ -300,7 +300,7 @@ function cat_id($cats) $_POST['trans'] = unserialize(stripslashes($_POST['trans'])); // fall-through case 'import': - $hiddenvars = $GLOBALS['phpgw']->html->input_hidden(array( + $hiddenvars = $GLOBALS['egw']->html->input_hidden(array( 'action' => 'continue', 'fieldsep'=> $_POST['fieldsep'], 'charset' => $_POST['charset'], @@ -313,7 +313,7 @@ function cat_id($cats) @set_time_limit(0); $fp=fopen($csvfile,'r'); $csv_fields = fgetcsv($fp,8000,$_POST['fieldsep']); - $csv_fields = $GLOBALS['phpgw']->translation->convert($csv_fields,$_POST['charset']); + $csv_fields = $GLOBALS['egw']->translation->convert($csv_fields,$_POST['charset']); $csv_fields[] = 'no CSV 1'; // eg. for static assignments $csv_fields[] = 'no CSV 2'; $csv_fields[] = 'no CSV 3'; @@ -330,9 +330,9 @@ function cat_id($cats) } } - $GLOBALS['phpgw']->preferences->read_repository(); - $GLOBALS['phpgw']->preferences->add('infolog','cvs_import',$defaults); - $GLOBALS['phpgw']->preferences->save_repository(True); + $GLOBALS['egw']->preferences->read_repository(); + $GLOBALS['egw']->preferences->add('infolog','cvs_import',$defaults); + $GLOBALS['egw']->preferences->save_repository(True); $log = "\n\t#\n"; @@ -377,7 +377,7 @@ function cat_id($cats) { break; // EOF } - $fields = $GLOBALS['phpgw']->translation->convert($fields,$_POST['charset']); + $fields = $GLOBALS['egw']->translation->convert($fields,$_POST['charset']); $log .= "\t".($start+$anz)."\n"; @@ -445,7 +445,7 @@ function cat_id($cats) { if (isset($values[$user]) && !is_numeric($user)) { - $values[$user] = $GLOBALS['phpgw']->accounts->name2id($values[$user]); + $values[$user] = $GLOBALS['egw']->accounts->name2id($values[$user]); } } if (!in_array('access',$info_fields)) @@ -468,19 +468,19 @@ function cat_id($cats) } $log .= "\t\n\n"; - $GLOBALS['phpgw']->template->set_var('anz_imported',($_POST['debug'] ? + $GLOBALS['egw']->template->set_var('anz_imported',($_POST['debug'] ? lang('%1 records read (not yet imported, you may go %2back%3 and uncheck Test Import)', $anz,'','') : lang('%1 records imported',$anz)). ' '. - (!$_POST['debug'] && $fields ? $GLOBALS['phpgw']->html->submit_button('next','Import next set') . ' ':''). - $GLOBALS['phpgw']->html->submit_button('continue','Back') . ' '. - $GLOBALS['phpgw']->html->submit_button('cancel','Cancel')); - $GLOBALS['phpgw']->template->set_var('log',$log); - $GLOBALS['phpgw']->template->parse('rows','imported'); + (!$_POST['debug'] && $fields ? $GLOBALS['egw']->html->submit_button('next','Import next set') . ' ':''). + $GLOBALS['egw']->html->submit_button('continue','Back') . ' '. + $GLOBALS['egw']->html->submit_button('cancel','Cancel')); + $GLOBALS['egw']->template->set_var('log',$log); + $GLOBALS['egw']->template->parse('rows','imported'); break; } - $GLOBALS['phpgw']->template->set_var('hiddenvars',str_replace('{','{',$hiddenvars)); - $GLOBALS['phpgw']->template->pfp('phpgw_body','import'); - $GLOBALS['phpgw']->common->phpgw_footer(); + $GLOBALS['egw']->template->set_var('hiddenvars',str_replace('{','{',$hiddenvars)); + $GLOBALS['egw']->template->pfp('phpgw_body','import'); + $GLOBALS['egw']->common->egw_footer(); ?> diff --git a/infolog/inc/class.admin_prefs_sidebox_hooks.inc.php b/infolog/inc/class.admin_prefs_sidebox_hooks.inc.php index a9ba5d788e..8cec3206f9 100644 --- a/infolog/inc/class.admin_prefs_sidebox_hooks.inc.php +++ b/infolog/inc/class.admin_prefs_sidebox_hooks.inc.php @@ -12,6 +12,13 @@ /* $Id$ */ +/** + * Class containing admin, preferences and sidebox-menus (used as hooks) + * + * @package infolog + * @author RalfBecker-At-outdoor-training.de + * @copyright GPL - GNU General Public License + */ class admin_prefs_sidebox_hooks { function all_hooks($args) @@ -23,20 +30,20 @@ class admin_prefs_sidebox_hooks if ($location == 'sidebox_menu') { $file = array( - 'infolog list' => $GLOBALS['phpgw']->link('/index.php',array( + 'infolog list' => $GLOBALS['egw']->link('/index.php',array( 'menuaction' => 'infolog.uiinfolog.index' )), - 'add' => $GLOBALS['phpgw']->link('/index.php',array( + 'add' => $GLOBALS['egw']->link('/index.php',array( 'menuaction' => 'infolog.uiinfolog.edit' )) ); - display_sidebox($appname,$GLOBALS['phpgw_info']['apps']['infolog']['title'].' '.lang('Menu'),$file); + display_sidebox($appname,$GLOBALS['egw_info']['apps']['infolog']['title'].' '.lang('Menu'),$file); } - if ($GLOBALS['phpgw_info']['user']['apps']['preferences'] && $location != 'admin') + if ($GLOBALS['egw_info']['user']['apps']['preferences'] && $location != 'admin') { $file = array( - 'Preferences' => $GLOBALS['phpgw']->link('/preferences/preferences.php','appname='.$appname), - 'Grant Access' => $GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$appname), - 'Edit Categories' => $GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uicategories.index&cats_app=' . $appname . '&cats_level=True&global_cats=True') + 'Preferences' => $GLOBALS['egw']->link('/preferences/preferences.php','appname='.$appname), + 'Grant Access' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$appname), + 'Edit Categories' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uicategories.index&cats_app=' . $appname . '&cats_level=True&global_cats=True') ); if ($location == 'preferences') { @@ -48,18 +55,18 @@ class admin_prefs_sidebox_hooks } } - if ($GLOBALS['phpgw_info']['user']['apps']['admin'] && $location != 'preferences') + if ($GLOBALS['egw_info']['user']['apps']['admin'] && $location != 'preferences') { $file = Array( - 'Site configuration' => $GLOBALS['phpgw']->link('/index.php',array( + 'Site configuration' => $GLOBALS['egw']->link('/index.php',array( 'menuaction' => 'infolog.uiinfolog.admin' )), - 'Global Categories' => $GLOBALS['phpgw']->link('/index.php',array( + 'Global Categories' => $GLOBALS['egw']->link('/index.php',array( 'menuaction' => 'admin.uicategories.index', 'appname' => $appname, 'global_cats'=> True)), - 'Custom fields, typ and status' => $GLOBALS['phpgw']->link('/index.php',array( + 'Custom fields, typ and status' => $GLOBALS['egw']->link('/index.php',array( 'menuaction' => 'infolog.uicustomfields.edit')), - 'CSV-Import' => $GLOBALS['phpgw']->link('/infolog/csv_import.php') + 'CSV-Import' => $GLOBALS['egw']->link('/infolog/csv_import.php') ); if ($location == 'admin') { diff --git a/infolog/inc/class.boinfolog.inc.php b/infolog/inc/class.boinfolog.inc.php index f6fee8b38f..a5f777db45 100644 --- a/infolog/inc/class.boinfolog.inc.php +++ b/infolog/inc/class.boinfolog.inc.php @@ -12,7 +12,17 @@ \**************************************************************************/ /* $Id$ */ + + include_once(EGW_INCLUDE_ROOT.'/infolog/inc/class.soinfolog.inc.php'); + include_once(EGW_INCLUDE_ROOT.'/infolog/inc/class.bolink.inc.php'); + /** + * This class is the BO-layer of InfoLog, it also handles xmlrpc requests + * + * @package infolog + * @author RalfBecker-At-outdoor-training.de + * @copyright GPL - GNU General Public License + */ class boinfolog // BO: buiseness objects: internal logic { var $enums; @@ -88,10 +98,10 @@ 'ongoing' => 'ongoing', 'done' => 'done' )); - $this->so = CreateObject('infolog.soinfolog'); - $this->link = CreateObject('infolog.bolink'); + $this->so =& new soinfolog(); + $this->link =& new bolink(); - $this->config = CreateObject('phpgwapi.config'); + $this->config =& CreateObject('phpgwapi.config'); $this->config->read_repository(); $this->customfields = array(); @@ -127,7 +137,7 @@ * @var int $tz_offset_s offset in secconds between user and server-time, * it need to be add to a server-time to get the user-time or substracted from a user-time to get the server-time */ - $this->tz_offset = $GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset']; + $this->tz_offset = $GLOBALS['egw_info']['user']['preferences']['common']['tz_offset']; $this->tz_offset_s = 60*60*$this->tz_offset; $this->user_time_now = time() + $this->tz_offset_s; @@ -144,10 +154,12 @@ } } - /*! - @function has_customfields - @abstract checks if there are customfields for typ $typ - */ + /** + * checks if there are customfields for typ $typ + * + * @param string $typ + * @return boolean True if there are customfields for $typ, else False + */ function has_customfields($typ) { foreach($this->customfields as $name => $field) @@ -160,19 +172,34 @@ return False; } - /* + /** * check's if user has the requiered rights on entry $info_id + * + * @param int $info_id id of infolog entry to check + * @param int $required_rights EGW_ACL_{READ|EDIT|ADD|DELETE} + * @return boolean */ function check_access( $info_id,$required_rights ) { return $this->so->check_access( $info_id,$required_rights ); } + /** + * init internal data to be empty + */ function init() { $this->so->init(); } + /** + * convert a link_id value into an info_from text + * + * @param array &$info infolog entry, key info_from gets set by this function + * @param string $not_app='' app to exclude + * @param string $not_id='' id to exclude + * @return boolean True if we have a linked item, False otherwise + */ function link_id2from(&$info,$not_app='',$not_id='') { //echo "boinfolog::link_id2from(subject='$info[info_subject]', link_id='$info[info_link_id], from='$info[info_from]', not_app='$not_app', not_id='$not_id')"; @@ -204,11 +231,20 @@ return False; } + /** + * Create a subject from a description: truncate it and add ' ...' + */ function subject_from_des($des) { return substr($des,0,60).' ...'; } + /** + * Read an infolog entry specified by $info_id + * + * @param int/array $info_id integer id or array with key 'info_id' of the entry to read + * @return array/boolean infolog entry or False if not found or no permission to read it + */ function &read($info_id) { if (is_array($info_id)) @@ -224,7 +260,7 @@ } return False; } - if (!$this->check_access($info_id,PHPGW_ACL_READ)) // check behind read, to prevent a double read + if (!$this->check_access($info_id,EGW_ACL_READ)) // check behind read, to prevent a double read { if ($this->xmlrpc) { @@ -252,6 +288,14 @@ return $data; } + /** + * Delete an infolog entry, evtl. incl. it's children / subs + * + * @param int/array $info_id int id or array with keys 'info_id', 'delete_children' and 'new_parent' setting all 3 params + * @param boolean $delete_children should the children be deleted + * @param int/boolean $new_parent parent to use for not deleted children if > 0 + * @return boolean True if delete was successful, False otherwise ($info_id does not exist or no rights) + */ function delete($info_id,$delete_children=False,$new_parent=False) { if (is_array($info_id)) @@ -268,7 +312,7 @@ } return False; } - if (!$this->check_access($info_id,PHPGW_ACL_DELETE)) + if (!$this->check_access($info_id,EGW_ACL_DELETE)) { if ($this->xmlrpc) { @@ -283,7 +327,9 @@ $this->so->delete($info_id,$delete_children,$new_parent); - $GLOBALS['phpgw']->contenthistory->updateTimeStamp('infolog_'.$info['info_type'], $info_id, 'delete', time()); + $GLOBALS['egw']->contenthistory->updateTimeStamp('infolog_'.$info['info_type'], $info_id, 'delete', time()); + + return True; } /** @@ -316,10 +362,10 @@ } } $status_only = $values['info_id'] && $values['info_responsible'] == $this->user && - !$this->check_access($values['info_id'],PHPGW_ACL_EDIT); // responsible has implicit right to change status + !$this->check_access($values['info_id'],EGW_ACL_EDIT); // responsible has implicit right to change status - if ($values['info_id'] && !$this->check_access($values['info_id'],PHPGW_ACL_EDIT) && !$status_only || - !$values['info_id'] && $values['info_id_parent'] && !$this->check_access($values['info_id_parent'],PHPGW_ACL_ADD)) + if ($values['info_id'] && !$this->check_access($values['info_id'],EGW_ACL_EDIT) && !$status_only || + !$values['info_id'] && $values['info_id_parent'] && !$this->check_access($values['info_id_parent'],EGW_ACL_ADD)) { if ($this->xmlrpc) { @@ -388,7 +434,7 @@ if($values['info_id']) { // update - $GLOBALS['phpgw']->contenthistory->updateTimeStamp( + $GLOBALS['egw']->contenthistory->updateTimeStamp( 'infolog_'.$values['info_type'], $infoID, 'modify', time() ); @@ -396,7 +442,7 @@ else { // add - $GLOBALS['phpgw']->contenthistory->updateTimeStamp( + $GLOBALS['egw']->contenthistory->updateTimeStamp( 'infolog_'.$values['info_type'], $infoID, 'add', time() ); @@ -406,25 +452,30 @@ return $infoID; } + /** + * Query the number of children / subs + * + * @param int $info_id id + * @return int number of subs + */ function anzSubs( $info_id ) { return $this->so->anzSubs( $info_id ); } - /*! - @function search - @abstract searches InfoLog for a certain pattern in $query - @syntax search( $query ) - @param $query[order] column-name to sort after - @param $query[sort] sort-order DESC or ASC - @param $query[filter] string with combination of acl-, date- and status-filters, eg. 'own-open-today' or '' - @param $query[cat_id] category to use or 0 or unset - @param $query[search] pattern to search, search is done in info_from, info_subject and info_des - @param $query[action] / $query[action_id] if only entries linked to a specified app/entry show be used - @param &$query[start], &$query[total] nextmatch-parameters will be used and set if query returns less entries - @param $query[col_filter] array with column-name - data pairs, data == '' means no filter (!) - @returns array with id's as key of the matching log-entries - */ + /** + * searches InfoLog for a certain pattern in $query + * + * @param $query[order] column-name to sort after + * @param $query[sort] sort-order DESC or ASC + * @param $query[filter] string with combination of acl-, date- and status-filters, eg. 'own-open-today' or '' + * @param $query[cat_id] category to use or 0 or unset + * @param $query[search] pattern to search, search is done in info_from, info_subject and info_des + * @param $query[action] / $query[action_id] if only entries linked to a specified app/entry show be used + * @param &$query[start], &$query[total] nextmatch-parameters will be used and set if query returns less entries + * @param $query[col_filter] array with column-name - data pairs, data == '' means no filter (!) + * @return array with id's as key of the matching log-entries + */ function &search(&$query) { //echo "boinfolog::search(".print_r($query,True).")\n"; @@ -454,12 +505,14 @@ return $ret; } - /*! - @function link_title - @syntax link_title( $id ) - @author ralfbecker - @abstract get title for an infolog entry identified by $id - */ + /** + * get title for an infolog entry identified by $info + * + * Is called as hook to participate in the linking + * + * @param int/array $info int info_id or array with infolog entry + * @param string the title + */ function link_title( $info ) { if (!is_array($info)) @@ -474,12 +527,14 @@ $this->subject_from_des($info['info_descr']); } - /*! - @function link_query - @syntax link_query( $pattern ) - @author ralfbecker - @abstract query infolog for entries matching $pattern - */ + /** + * query infolog for entries matching $pattern + * + * Is called as hook to participate in the linking + * + * @param string $pattern pattern to search + * @return array with info_id - title pairs of the matching entries + */ function link_query( $pattern ) { $query = array( @@ -499,16 +554,14 @@ return $content; } - /*! - @function cal_to_include - @syntax cal_to_include( $args ) - @author ralfbecker - @abstract hook called be calendar to include events or todos in the cal-dayview - @param $args[year], $args[month], $args[day] date of the events - @param $args[owner] owner of the events - @param $args[location] calendar_include_{events|todos} - @returns array of events (array with keys starttime, endtime, title, view, icon, content) - */ + /** + * hook called be calendar to include events or todos in the cal-dayview + * + * @param int $args[year], $args[month], $args[day] date of the events + * @param int $args[owner] owner of the events + * @param string $args[location] calendar_include_{events|todos} + * @return array of events (array with keys starttime, endtime, title, view, icon, content) + */ function cal_to_include($args) { //echo "cal_to_include("; print_r($args); echo ")\n"; @@ -517,11 +570,11 @@ { return False; } - if (!is_object($GLOBALS['phpgw']->html)) + if (!is_object($GLOBALS['egw']->html)) { - $GLOBALS['phpgw']->html = CreateObject('phpgwapi.html'); + $GLOBALS['egw']->html =& CreateObject('phpgwapi.html'); } - $GLOBALS['phpgw']->translation->add_app('infolog'); + $GLOBALS['egw']->translation->add_app('infolog'); $do_events = $args['location'] == 'calendar_include_events'; $to_include = array(); @@ -543,7 +596,7 @@ { continue; } - $title = ($do_events?$GLOBALS['phpgw']->common->formattime(adodb_date('H',$info['info_startdate']),adodb_date('i',$info['info_startdate'])).' ':''). + $title = ($do_events?$GLOBALS['egw']->common->formattime(adodb_date('H',$info['info_startdate']),adodb_date('i',$info['info_startdate'])).' ':''). $info['info_subject']; $view = $this->link->view('infolog',$info['info_id']); $content=array(); @@ -552,10 +605,10 @@ $info['info_status'] => 'infolog' ) as $name => $app) { - $content[] = $GLOBALS['phpgw']->html->image($app,$name,lang($name),'border="0" width="15" height="15"').' '; + $content[] = $GLOBALS['egw']->html->image($app,$name,lang($name),'border="0" width="15" height="15"').' '; } - $content[] = $GLOBALS['phpgw']->html->a_href($title,$view); - $content = $GLOBALS['phpgw']->html->table(array(1 => $content)); + $content[] = $GLOBALS['egw']->html->a_href($title,$view); + $content = $GLOBALS['egw']->html->table(array(1 => $content)); $to_include[] = array( 'starttime' => $info['info_startdate'], @@ -575,14 +628,16 @@ return $to_include; } + /** + * handles introspection or discovery by the logged in client, + * in which case the input might be an array. The server always calls + * this function to fill the server dispatch map using a string. + * + * @param string $_type='xmlrpc' xmlrpc or soap + * @return array + */ function list_methods($_type='xmlrpc') { - /* - ** This handles introspection or discovery by the logged in client, - ** in which case the input might be an array. The server always calls - ** this function to fill the server dispatch map using a string. - */ - if (is_array($_type)) { $_type = $_type['type'] ? $_type['type'] : $_type[0]; @@ -634,6 +689,12 @@ } } + /** + * Convert an InfoLog entry into its xmlrpc representation, eg. convert timestamps to datetime.iso8601 + * + * @param array $data infolog entry + * @param array xmlrpc infolog entry + */ function data2xmlrpc($data) { $data['rights'] = $this->so->grants[$data['info_owner']]; @@ -662,6 +723,12 @@ return $data; } + /** + * Convert an InfoLog xmlrpc representation into the internal one, eg. convert datetime.iso8601 to timestamps + * + * @param array $data infolog entry + * @param array xmlrpc infolog entry + */ function xmlrpc2data($data) { foreach($data as $name => $val) @@ -689,7 +756,12 @@ return $data; } - // return array with all infolog categories (for xmlrpc) + /** + * return array with all infolog categories (for xmlrpc) + * + * @param boolean $complete true returns array with all data for each cat, else only the title is returned + * @return array with cat_id / title or data pairs (see above) + */ function categories($complete = False) { return $this->xmlrpc ? $GLOBALS['server']->categories($complete) : False; diff --git a/infolog/inc/class.bolink.inc.php b/infolog/inc/class.bolink.inc.php index f49e12a9c9..dcae5ee434 100644 --- a/infolog/inc/class.bolink.inc.php +++ b/infolog/inc/class.bolink.inc.php @@ -12,26 +12,29 @@ /* $Id$ */ - include_once(PHPGW_INCLUDE_ROOT . '/infolog/inc/class.solink.inc.php'); + include_once(EGW_INCLUDE_ROOT . '/infolog/inc/class.solink.inc.php'); - $GLOBALS['phpgw_info']['flags']['included_classes']['bolink'] = True; - - /*! - @class bolink - @author ralfbecker - @copyright GPL - GNU General Public License - @abstract generalized linking between entries of eGroupware apps - BO layer - @discussion This class is the BO-layer of the links - Links have two ends each pointing to an entry, each entry is a double: - app app-name or directory-name of an egw application, eg. 'infolog' - id this is the id, eg. an integer or a tupple like '0:INBOX:1234' - The BO-layer implementes 2 extra features on top of the so-layer: - 1) It handles links to not already existing entries. This is used by the eTemplate link-widget, which allows to - setup links even for new / not already existing entries, before they get saved. - In that case you have to set the first id to 0 for the link-function and pass the array returned in that id - (not the return-value) after saveing your new entry again to the link function. - 2) Attaching files: they are saved in the vfs and not the link-table (!). - */ + /** + * generalized linking between entries of eGroupware apps - BO layer + * + * This class is the BO-layer of the links + * + * Links have two ends each pointing to an entry, each entry is a double: + * - app app-name or directory-name of an egw application, eg. 'infolog' + * - id this is the id, eg. an integer or a tupple like '0:INBOX:1234' + * + * The BO-layer implementes 2 extra features on top of the so-layer: + * 1) It handles links to not already existing entries. This is used by the eTemplate link-widget, which allows to + * setup links even for new / not already existing entries, before they get saved. + * In that case you have to set the first id to 0 for the link-function and pass the array returned in that id + * (not the return-value) after saveing your new entry again to the link function. + * 2) Attaching files: they are saved in the vfs and not the link-table (!). + * + * @package infolog + * @subpackage link + * @author RalfBecker-At-outdoor-training.de + * @copyright GPL - GNU General Public License + */ class bolink extends solink { // other apps can participate in the linking by implementing a search_link hook, which @@ -86,12 +89,11 @@ var $valid_pathes = array(); var $send_file_ips = array(); - /*! - @function bolink - @syntax bolink( ) - @author ralfbecker - @abstract constructor - */ + /** + * @author ralfbecker + * constructor + * + */ function bolink( ) { $this->solink( ); // call constructor of derived class @@ -101,10 +103,10 @@ 'view' => True, 'get_file' => True ); - //$this->vfs = CreateObject('infolog.vfs'); - $this->vfs = CreateObject('phpgwapi.vfs'); + //$this->vfs =& CreateObject('infolog.vfs'); + $this->vfs =& CreateObject('phpgwapi.vfs'); - $config = CreateObject('phpgwapi.config'); + $config =& CreateObject('phpgwapi.config'); $config->read_repository(); if (is_array($config->config_data)) { @@ -116,7 +118,7 @@ // other apps can participate in the linking by implementing a search_link hook, which // has to return an array in the format of an app_register entry // - $search_link_hooks = $GLOBALS['phpgw']->hooks->process('search_link'); + $search_link_hooks = $GLOBALS['egw']->hooks->process('search_link'); if (is_array($search_link_hooks)) { foreach($search_link_hooks as $app => $data) @@ -129,29 +131,28 @@ } } - /*! - @function link - @syntax link( $app1,&$id1,$app2,$id2='',$remark='',$user=0 ) - @author ralfbecker - @abstract creats a link between $app1,$id1 and $app2,$id2 - $id1 does NOT need to exist yet - @param $app1 app of $id1 - @param $id1 id of item to linkto or 0 if item not yet created or array with links - of not created item or $file-array if $app1 == $this->vfs_appname (see below). - If $id==0 it will be set on return to an array with the links for the new item. - @param $app2 app of 2.linkend or array with links ($id2 not used) - @param $id2 id of 2. item of $file-array if $app2 == $this->vfs_appname (see below) - $file array with informations about the file in format of the etemplate file-type - $file['name'] name of the file (no directory) - $file['type'] mine-type of the file - $file['tmp_name'] name of the uploaded file (incl. directory) - $file['path'] path of the file on the client computer - $file['ip'] of the client (path and ip in $file are only needed if u want a symlink (if possible)) - @param $remark Remark to be saved with the link (defaults to '') - @param $owner Owner of the link (defaults to user) - @discussion Does NOT check if link already exists. - File-attachments return a negative link-id !!! - @result False (for db or param-error) or on success link_id (Please not the return-value of $id1) - */ + /** + * @author ralfbecker + * creats a link between $app1,$id1 and $app2,$id2 - $id1 does NOT need to exist yet + * + * @param $app1 app of $id1 + * @param $id1 id of item to linkto or 0 if item not yet created or array with links + * of not created item or $file-array if $app1 == $this->vfs_appname (see below). + * If $id==0 it will be set on return to an array with the links for the new item. + * @param $app2 app of 2.linkend or array with links ($id2 not used) + * @param $id2 id of 2. item of $file-array if $app2 == $this->vfs_appname (see below) + * $file array with informations about the file in format of the etemplate file-type + * $file['name'] name of the file (no directory) + * $file['type'] mine-type of the file + * $file['tmp_name'] name of the uploaded file (incl. directory) + * $file['path'] path of the file on the client computer + * $file['ip'] of the client (path and ip in $file are only needed if u want a symlink (if possible)) + * @param $remark Remark to be saved with the link (defaults to '') + * @param $owner Owner of the link (defaults to user) + * Does NOT check if link already exists. + * File-attachments return a negative link-id !!! + * @return False (for db or param-error) or on success link_id (Please not the return-value of $id1) + */ function link( $app1,&$id1,$app2,$id2='',$remark='',$owner=0,$lastmod=0 ) { if ($this->debug) @@ -217,16 +218,15 @@ return solink::link($app1,$id1,$app2,$id2,$remark,$owner); } - /*! - @function get_links - @syntax get_links( $app,$id,$only_app='',$only_name='',$order='link_lastmod DESC' ) - @author ralfbecker - @abstract returns array of links to $app,$id (reimplemented to deal with not yet created items) - @param $id id of entry in $app or array of links if entry not yet created - @param $only_app if set return only links from $only_app (eg. only addressbook-entries) or NOT from if $only_app[0]=='!' - @param $order defaults to newest links first - @result array of links or empty array if no matching links found - */ + /** + * @author ralfbecker + * returns array of links to $app,$id (reimplemented to deal with not yet created items) + * + * @param $id id of entry in $app or array of links if entry not yet created + * @param $only_app if set return only links from $only_app (eg. only addressbook-entries) or NOT from if $only_app[0]=='!' + * @param $order defaults to newest links first + * @return array of links or empty array if no matching links found + */ function get_links( $app,$id,$only_app='',$order='link_lastmod DESC' ) { //echo "bolink::get_links(app='$app',id='$id',only_app='$only_app',order='$order')\n"; @@ -269,16 +269,15 @@ return $ids; } - /*! - @function get_link - @syntax get_link( $app_link_id,$id='',$app2='',$id2='' ) - @author ralfbecker - @abstract returns data of a link - @param $app_link_id > 0 link_id of link or app-name of link - @param $id,$app2,$id2 other param of the link if not link_id given - @result array with link-data or False - @discussion If $id is an array (links not yet created) only link_ids are allowed. - */ + /** + * @author ralfbecker + * returns data of a link + * + * @param $app_link_id > 0 link_id of link or app-name of link + * @param $id,$app2,$id2 other param of the link if not link_id given + * @return array with link-data or False + * If $id is an array (links not yet created) only link_ids are allowed. + */ function get_link($app_link_id,$id='',$app2='',$id2='') { if (is_array($id)) @@ -304,17 +303,16 @@ return solink::get_link($app_link_id,$id,$app2,$id2); } - /*! - @function unlink - @syntax unlink( $link_id,$app='',$id='',$owner='',$app2='',$id2='' ) - @author ralfbecker - @abstract Remove link with $link_id or all links matching given $app,$id - @param $link_id link-id to remove if > 0 - @param $app,$id,$owner,$app2,$id2 if $link_id <= 0: removes all links matching the non-empty params - @discussion Note: if $link_id != '' and $id is an array: unlink removes links from that array only - unlink has to be called with &$id to see the result (depricated) or unlink2 has to be used !!! - @result the number of links deleted - */ + /** + * @author ralfbecker + * Remove link with $link_id or all links matching given $app,$id + * + * @param $link_id link-id to remove if > 0 + * @param $app,$id,$owner,$app2,$id2 if $link_id <= 0: removes all links matching the non-empty params + * Note: if $link_id != '' and $id is an array: unlink removes links from that array only + * unlink has to be called with &$id to see the result (depricated) or unlink2 has to be used !!! + * @return the number of links deleted + */ function unlink($link_id,$app='',$id='',$owner='',$app2='',$id2='') { return $this->unlink2($link_id,$app,$id,$owner,$app2,$id2); @@ -355,34 +353,32 @@ return False; } - /*! - @function app_list - @syntax app_list( ) - @author ralfbecker - @abstract get list/array of link-aware apps the user has rights to use - @result array( $app => lang($app), ... ) - */ + /** + * @author ralfbecker + * get list/array of link-aware apps the user has rights to use + * + * @return array( $app => lang($app), ... ) + */ function app_list( ) { reset ($this->app_register); $apps = array(); while (list($app,$reg) = each($this->app_register)) { - if ($GLOBALS['phpgw_info']['user']['apps'][$app]) + if ($GLOBALS['egw_info']['user']['apps'][$app]) { - $apps[$app] = $GLOBALS['phpgw_info']['apps'][$app]['title']; + $apps[$app] = $GLOBALS['egw_info']['apps'][$app]['title']; } } return $apps; } - /*! - @function query - @syntax query( $app,$pattern ) - @author ralfbecker - @abstract Searches for a $pattern in the entries of $app - @result an array of $id => $title pairs - */ + /** + * @author ralfbecker + * Searches for a $pattern in the entries of $app + * + * @return an array of $id => $title pairs + */ function query($app,$pattern) { if ($app == '' || !is_array($reg = $this->app_register[$app]) || !isset($reg['query'])) @@ -398,13 +394,12 @@ return strchr($method,'.') ? ExecMethod($method,$pattern) : $this->$method($pattern); } - /*! - @function title - @syntax title( $app,$id ) - @author ralfbecker - @abstract returns the title (short description) of entry $id and $app - @result the title or false if $id does not exist in $app - */ + /** + * @author ralfbecker + * returns the title (short description) of entry $id and $app + * + * @return the title or false if $id does not exist in $app + */ function title($app,$id,$link='') { if ($this->debug) @@ -452,13 +447,12 @@ return $title; } - /*! - @function view - @syntax view( $app,$id ) - @author ralfbecker - @abstract view entry $id of $app - @result array with name-value pairs for link to view-methode of $app to view $id - */ + /** + * @author ralfbecker + * view entry $id of $app + * + * @return array with name-value pairs for link to view-methode of $app to view $id + */ function view($app,$id,$link='') { if ($app == $this->vfs_appname && !empty($id) && is_array($link)) @@ -502,11 +496,11 @@ $id = get_var('id','GET'); $filename = get_var('filename','GET'); - if (empty($app) || empty($id) || empty($filename) /* || !$this->bo->check_access($info_id,PHPGW_ACL_READ)*/) + if (empty($app) || empty($id) || empty($filename) /* || !$this->bo->check_access($info_id,EGW_ACL_READ)*/) { - $GLOBALS['phpgw']->redirect_link('/'); + $GLOBALS['egw']->redirect_link('/'); } - $browser = CreateObject('phpgwapi.browser'); + $browser =& CreateObject('phpgwapi.browser'); $local = $this->attached_local($app,$id,$filename, get_var('REMOTE_ADDR',Array('SERVER')),$browser->is_windows()); @@ -521,16 +515,15 @@ $browser->content_header($filename,$info['type']); echo $this->read_attached($app,$id,$filename); } - $GLOBALS['phpgw']->common->phpgw_exit(); + $GLOBALS['egw']->common->egw_exit(); } - /*! - @function vfs_path - @syntax vfs_path ( $app,$id,$file='' ) - @abstract path to the attached files of $app/$ip - @discussion All link-files are based in the vfs-subdir 'infolog'. For other apps - @discussion separate subdirs with name app are created. - */ + /** + * path to the attached files of $app/$ip + * + * All link-files are based in the vfs-subdir 'infolog'. For other apps + * separate subdirs with name app are created. + */ function vfs_path($app,$id='',$file='',$relatives=False) { $path = $this->vfs_basedir . ($app == '' || $app == 'infolog' ? '' : '/'.$app) . @@ -546,20 +539,19 @@ ) : $path; } - /*! - @function attach_file - @syntax attach_file ( $app,$id,$file,$comment='' ) - @abstract Put a file to the corrosponding place in the VFS and set the attributes - @param $app/$id entry which should the file should be linked with - @param $file array with informations about the file in format of the etemplate file-type - $file['name'] name of the file (no directory) - $file['type'] mine-type of the file - $file['tmp_name'] name of the uploaded file (incl. directory) - $file['path'] path of the file on the client computer - $file['ip'] of the client (path and ip are only needed if u want a symlink (if possible)) - @param $comment - @return int negative id of phpgw_vfs table as negative link-id's are for vfs attachments - */ + /** + * Put a file to the corrosponding place in the VFS and set the attributes + * + * @param $app/$id entry which should the file should be linked with + * @param $file array with informations about the file in format of the etemplate file-type + * $file['name'] name of the file (no directory) + * $file['type'] mine-type of the file + * $file['tmp_name'] name of the uploaded file (incl. directory) + * $file['path'] path of the file on the client computer + * $file['ip'] of the client (path and ip are only needed if u want a symlink (if possible)) + * @param $comment + * @return int negative id of phpgw_vfs table as negative link-id's are for vfs attachments + */ function attach_file($app,$id,$file,$comment='') { if ($this->debug) @@ -636,14 +628,13 @@ return is_array($link) ? $link['link_id'] : False; } - /*! - @function delete_attached - @syntax delete_attached( $app,$id,$filename ) - @author ralfbecker - @abstract deletes an attached file - @param $app > 0: file_id of an attchemnt or $app/$id entry which linked to - @param $filename - */ + /** + * @author ralfbecker + * deletes an attached file + * + * @param $app > 0: file_id of an attchemnt or $app/$id entry which linked to + * @param $filename + */ function delete_attached($app,$id='',$fname = '') { if (intval($app) > 0) // is file_id @@ -680,15 +671,14 @@ return $Ok; } - /*! - @function info_attached - @syntax info_attached( $app,$id,$filename ) - @author ralfbecker - @abstract converts the infos vfs has about a file into a link - @param $app/$id entry which linked to - @param $filename - @returns a 'kind' of link-array - */ + /** + * @author ralfbecker + * converts the infos vfs has about a file into a link + * + * @param $app/$id entry which linked to + * @param $filename + * a 'kind' of link-array + */ function info_attached($app,$id,$filename) { $this->vfs->override_acl = 1; @@ -702,15 +692,14 @@ return $this->fileinfo2link($attachments[0]); } - /*! - @function fileinfo2link - @syntax fileinfo2link( $fileinfo ) - @author ralfbecker - @abstract converts a fileinfo (row in the vfs-db-table) in a link - @param $fileinfo a row from the vfs-db-table (eg. returned by the vfs ls function) - or a file_id of that table - @returns a 'kind' of link-array - */ + /** + * @author ralfbecker + * converts a fileinfo (row in the vfs-db-table) in a link + * + * @param $fileinfo a row from the vfs-db-table (eg. returned by the vfs ls function) + * or a file_id of that table + * a 'kind' of link-array + */ function fileinfo2link($fileinfo) { if (!is_array($fileinfo)) @@ -743,13 +732,12 @@ ); } - /*! - @function list_attached - @syntax list_attached( $app,$id ) - @author ralfbecker - @abstract lists all attachments to $app/$id - @returns a 'kind' of link-array - */ + /** + * @author ralfbecker + * lists all attachments to $app/$id + * + * a 'kind' of link-array + */ function list_attached($app,$id) { $this->vfs->override_acl = 1; @@ -768,26 +756,24 @@ return $attached; } - /*! - @function is_win_path - @syntax is_win_path( $path ) - @author ralfbecker - @abstract checks if path starts with a '\\' or has a ':' in it - */ + /** + * @author ralfbecker + * checks if path starts with a '\\' or has a ':' in it + * + */ function is_win_path($path) { return $path[0] == '\\' || strstr($path,':'); } - /*! - @function read_attached - @syntax read_attached($app,$id,$filename) - @author ralfbecker - @abstract reads the attached file and returns the content - */ + /** + * @author ralfbecker + * reads the attached file and returns the content + * + */ function read_attached($app,$id,$filename) { - if (empty($app) || !$id || empty($filename) /*|| !$this->check_access($info_id,PHPGW_ACL_READ)*/) + if (empty($app) || !$id || empty($filename) /*|| !$this->check_access($info_id,EGW_ACL_READ)*/) { return False; } @@ -797,18 +783,18 @@ return $data; } - /*! - @function attached_local - @syntax attached_local($app,$id,$filename,$ip,$win_user) - @author ralfbecker - @abstract Checks if filename should be local availible and if so returns - @abstract 'file:/path' for HTTP-redirect else return False - */ + /** + * @author ralfbecker + * Checks if filename should be local availible and if so returns + * + * 'file:/path' for HTTP-redirect else return False + * + */ function attached_local($app,$id,$filename,$ip,$win_user) { //echo "attached_local(app=$app, id='$id', filename='$filename', ip='$ip', win_user='$win_user', count(send_file_ips)=".count($this->send_file_ips).")\n"; - if (!$id || !$filename || /* !$this->check_access($info_id,PHPGW_ACL_READ) || */ + if (!$id || !$filename || /* !$this->check_access($info_id,EGW_ACL_READ) || */ !count($this->send_file_ips)) { return False; @@ -836,23 +822,21 @@ return False; } - /*! - @function decode_htmlspecialchars - @syntax decode_htmlspecialchars( $str ) - @author ralfbecker - @abstract reverse function of htmlspecialchars() - */ + /** + * @author ralfbecker + * reverse function of htmlspecialchars() + * + */ function decode_htmlspecialchars($str) { return str_replace(array('&','"','<','>'),array('&','"','<','>'),$str); } - /*! - @function calendar_title - @syntax calendar_title( $id ) - @author ralfbecker - @abstract get title for an event, should be moved to bocalendar.link_title - */ + /** + * @author ralfbecker + * get title for an event, should be moved to bocalendar.link_title + * + */ function calendar_title( $event ) { if (!is_object($this->bocal)) @@ -867,21 +851,20 @@ { return False; } - $format = $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'] . ' '. - ($GLOBALS['phpgw_info']['user']['preferences']['common']['timeformat'] == '12' ? 'h:i a' : 'H:i'); + $format = $GLOBALS['egw_info']['user']['preferences']['common']['dateformat'] . ' '. + ($GLOBALS['egw_info']['user']['preferences']['common']['timeformat'] == '12' ? 'h:i a' : 'H:i'); - $name = $GLOBALS['phpgw']->common->show_date($this->bocal->maketime($event['start']) - $this->bocal->datetime->tz_offset,$format); + $name = $GLOBALS['egw']->common->show_date($this->bocal->maketime($event['start']) - $this->bocal->datetime->tz_offset,$format); $name .= ': ' . $this->decode_htmlspecialchars($event['title']); // cal returns entities return $name; } - /*! - @function calendar_query - @syntax calendar_query( $pattern ) - @author ralfbecker - @abstract query calendar for an event $matching pattern, should be moved to bocalendar.link_query - */ + /** + * @author ralfbecker + * query calendar for an event $matching pattern, should be moved to bocalendar.link_query + * + */ function calendar_query($pattern) { if (!is_object($this->bocal)) @@ -895,7 +878,7 @@ foreach($event_ids as $id) { // only include it in the list, if we have permissions to read it - if ($this->bocal->check_perms(PHPGW_ACL_READ,$id)) + if ($this->bocal->check_perms(EGW_ACL_READ,$id)) { $content[$id] = $this->calendar_title( $id ); } @@ -904,12 +887,11 @@ return $content; } - /*! - @function addressbook_title - @syntax addressbook_title( $id ) - @author ralfbecker - @abstract get title for an address, should be moved to boaddressbook.link_title - */ + /** + * @author ralfbecker + * get title for an address, should be moved to boaddressbook.link_title + * + */ function addressbook_title( $addr ) { if (!is_object($this->contacts)) @@ -943,12 +925,11 @@ return stripslashes($name); // addressbook returns quotes with slashes } - /*! - @function addressbook_query - @syntax addressbook_query( $pattern ) - @author ralfbecker - @abstract query addressbook for $pattern, should be moved to boaddressbook.link_query - */ + /** + * @author ralfbecker + * query addressbook for $pattern, should be moved to boaddressbook.link_query + * + */ function addressbook_query( $pattern ) { if (!is_object($this->contacts)) @@ -964,17 +945,16 @@ return $content; } - /*! - @function projects_title - @syntax projects_title( $id ) - @author ralfbecker - @abstract get title for a project, should be moved to boprojects.link_title - */ + /** + * @author ralfbecker + * get title for a project, should be moved to boprojects.link_title + * + */ function projects_title( $proj ) { if (!is_object($this->boprojects)) { - if (!file_exists(PHPGW_SERVER_ROOT.'/projects')) // check if projects installed + if (!file_exists(EGW_SERVER_ROOT.'/projects')) // check if projects installed return ''; $this->boprojects = createobject('projects.boprojects'); } @@ -985,17 +965,16 @@ return is_array($proj) ? $proj['title'] : False; } - /*! - @function projects_query - @syntax projects_query( $pattern ) - @author ralfbecker - @abstract query for projects matching $pattern, should be moved to boprojects.link_query - */ + /** + * @author ralfbecker + * query for projects matching $pattern, should be moved to boprojects.link_query + * + */ function projects_query( $pattern ) { if (!is_object($this->boprojects)) { - if (!file_exists(PHPGW_SERVER_ROOT.'/projects')) // check if projects installed + if (!file_exists(EGW_SERVER_ROOT.'/projects')) // check if projects installed return array(); $this->boprojects = createobject('projects.boprojects'); } diff --git a/infolog/inc/class.customfields_widget.inc.php b/infolog/inc/class.customfields_widget.inc.php index cfce426f94..948dceba63 100644 --- a/infolog/inc/class.customfields_widget.inc.php +++ b/infolog/inc/class.customfields_widget.inc.php @@ -12,12 +12,15 @@ /* $Id$ */ - /*! - @class customfields_widget - @author ralfbecker - @abstract generates a template based on an array with definitions - @discussion This widget has neither a render nor a post_process function as it only generates a template - */ + /** + * generates a template based on an array with definitions + * + * This widget has neither a render nor a post_process function as it only generates a template + * + * @package infolog + * @author RalfBecker-At-outdoor-training.de + * @copyright GPL - GNU General Public License + */ class customfields_widget { var $public_functions = array( @@ -36,7 +39,7 @@ $cell['type'] = 'label'; return True; } - $tpl = new etemplate; + $tpl =& new etemplate; $tpl->init('*** generated custom fields for InfoLog','','',0,'',0,0); // make an empty template $typ = $value['###typ###']; diff --git a/infolog/inc/class.soinfolog.inc.php b/infolog/inc/class.soinfolog.inc.php index 213158b614..d2a6e293b6 100644 --- a/infolog/inc/class.soinfolog.inc.php +++ b/infolog/inc/class.soinfolog.inc.php @@ -13,14 +13,18 @@ /* $Id$ */ - /*! - @class soinfolog - @abstract storage object / db-layer for InfoLog - @author Ralf Becker - @copyright GPL - GNU General Public License - @note all values passed to this class are run either through intval or addslashes to prevent query-insertion - and for pgSql 7.3 compatibility - */ + include_once(EGW_INCLUDE_ROOT.'/infolog/inc/class.solink.inc.php'); + + /** + * storage object / db-layer for InfoLog + * + * all values passed to this class are run either through intval or addslashes to prevent query-insertion + * and for pgSql 7.3 compatibility + * + * @package infolog + * @author RalfBecker-At-outdoor-training.de + * @copyright GPL - GNU General Public License + */ class soinfolog // DB-Layer { var $db; @@ -30,32 +34,30 @@ var $info_table = 'phpgw_infolog'; var $extra_table = 'phpgw_infolog_extra'; - /*! - @function soinfolog - @abstract constructor - */ + /** + * constructor + */ function soinfolog( $info_id = 0) { - $this->db = clone($GLOBALS['phpgw']->db); + $this->db = clone($GLOBALS['egw']->db); $this->db->set_app('infolog'); - $this->grants = $GLOBALS['phpgw']->acl->get_grants('infolog'); - $this->user = $GLOBALS['phpgw_info']['user']['account_id']; + $this->grants = $GLOBALS['egw']->acl->get_grants('infolog'); + $this->user = $GLOBALS['egw_info']['user']['account_id']; - $this->links = CreateObject('infolog.solink'); + $this->links =& new solink(); - $this->tz_offset = $GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset']; + $this->tz_offset = $GLOBALS['egw_info']['user']['preferences']['common']['tz_offset']; $this->read( $info_id ); } - /*! - @function check_access - @abstract checks if user has the $required_rights to access $info_id (private access is handled too) - @syntax check_access( $info_id,$required_rights ) - @param $info_id Id of InfoLog entry - @param $required_rights PHPGW_ACL_xyz anded together - @returns True if access is granted else False - */ + /** + * checks if user has the $required_rights to access $info_id (private access is handled too) + * + * @param $info_id Id of InfoLog entry + * @param $required_rights EGW_ACL_xyz anded together + * @return boolean True if access is granted else False + */ function check_access( $info_id,$required_rights ) { if ($info_id != $this->data['info_id']) // already loaded? @@ -79,21 +81,21 @@ // ACL only on public entrys || $owner granted _PRIVATE (!!($this->grants[$owner] & $required_rights) || // implicite read-rights for responsible user !!! - $info['info_responsible'] == $this->user && $required_rights == PHPGW_ACL_READ) && + $info['info_responsible'] == $this->user && $required_rights == EGW_ACL_READ) && ($info['info_access'] == 'public' || - !!($this->grants[$owner] & PHPGW_ACL_PRIVATE)); + !!($this->grants[$owner] & EGW_ACL_PRIVATE)); //echo "check_access(info_id=$info_id (owner=$owner, user=$user),required_rights=$required_rights): access".($access_ok?"Ok":"Denied")."\n"; return $access_ok; } - /*! - @function aclFilter - @abstract generate sql to be AND'ed into a query to ensure ACL is respected (incl. _PRIVATE) - @param $filter: none|all - list all entrys user have rights to see - private|own - list only his personal entrys (incl. those he is responsible for !!!) - @returns the necesary sql - */ + /** + * generate sql to be AND'ed into a query to ensure ACL is respected (incl. _PRIVATE) + * + * @param $filter: none|all - list all entrys user have rights to see + * private|own - list only his personal entrys (incl. those he is responsible for !!!) + * @return string the necesary sql + */ function aclFilter($filter = False) { preg_match('/(own|privat|all|none|user)([0-9]*)/',$filter_was=$filter,$vars); @@ -109,11 +111,11 @@ foreach($this->grants as $user => $grant) { // echo "grants: user=$user, grant=$grant"; - if ($grant & (PHPGW_ACL_READ|PHPGW_ACL_EDIT)) + if ($grant & (EGW_ACL_READ|EGW_ACL_EDIT)) { $public_user_list[] = $user; } - if ($grant & PHPGW_ACL_PRIVATE) + if ($grant & EGW_ACL_PRIVATE) { $private_user_list[] = $user; } @@ -157,13 +159,12 @@ return $this->acl_filter[$filter.$user] = $filtermethod; // cache the filter } - /*! - @function statusFilter - @abstract generate sql to filter based on the status of the log-entry - @syntax statusFilter($filter = '') - @param $filter done = done or billed, open = not ()done or billed), offer = offer - @returns the necesary sql - */ + /** + * generate sql to filter based on the status of the log-entry + * + * @param $filter done = done or billed, open = not ()done or billed), offer = offer + * @return string the necesary sql + */ function statusFilter($filter = '') { preg_match('/(done|open|offer)/',$filter,$vars); @@ -178,16 +179,15 @@ return ''; } - /*! - @function dateFilter - @abstract generate sql to filter based on the start- and enddate of the log-entry - @syntax dateFilter($filter = '') - @param $filter upcoming = startdate is in the future - today startdate < tomorrow - overdue enddate < tomorrow - limitYYYY/MM/DD not older or open - @returns the necesary sql - */ + /** + * generate sql to filter based on the start- and enddate of the log-entry + * + * @param $filter upcoming = startdate is in the future + * today startdate < tomorrow + * overdue enddate < tomorrow + * limitYYYY/MM/DD not older or open + * @return string the necesary sql + */ function dateFilter($filter = '') { preg_match('/(upcoming|today|overdue|date)([-\\/.0-9]*)/',$filter,$vars); @@ -223,11 +223,11 @@ return ''; } - /*! - @function init - @abstract initialise the internal $this->data to be empty - @discussion only non-empty values got initialised - */ + /** + * initialise the internal $this->data to be empty + * + * only non-empty values got initialised + */ function init() { $this->data = array( @@ -236,13 +236,13 @@ ); } - /*! - @function db2data - @abstract copy data after a query into $data - @syntax db2data(&$data) - @param $data array to copy the data - @description copy only non-numeric keys - */ + /** + * copy data after a query into $data + * + * copy only non-numeric keys + * + * @param $data array to copy the data + */ function db2data(&$data) { $data = array(); @@ -255,14 +255,14 @@ } } - /*! - @function read - @abstract read InfoLog entry $info_id - @syntax read( $info_id ) - @param $info_id id of log-entry - @description some cacheing is done to prevent multiple reads of the same entry - @returns the entry as array - */ + /** + * read InfoLog entry $info_id + * + * some cacheing is done to prevent multiple reads of the same entry + * + * @param $info_id id of log-entry + * @return array/boolean the entry as array or False on error (eg. entry not found) + */ function read($info_id) // did _not_ ensure ACL { $info_id = intval($info_id); @@ -287,14 +287,13 @@ return $this->data; } - /*! - @function delete - @abstract delete InfoLog entry $info_id AND the links to it - @syntax delete( $info_id ) - @param int $info_id id of log-entry - @param bool $delete_children delete the children, if not set there parent-id to $new_parent - @param int new_parent new parent-id to set for subs - */ + /** + * delete InfoLog entry $info_id AND the links to it + * + * @param int $info_id id of log-entry + * @param bool $delete_children delete the children, if not set there parent-id to $new_parent + * @param int $new_parent new parent-id to set for subs + */ function delete($info_id,$delete_children=True,$new_parent=0) // did _not_ ensure ACL { //echo "soinfolog::delete($info_id,'$delete_children',$new_parent)\n"; @@ -327,13 +326,12 @@ $this->db->update($this->info_table,array('info_id_parent'=>$new_parent),array('info_id_parent'=>$info_id),__LINE__,__FILE__); } - /*! - @function change_delete_owner - @abstract changes or deletes entries with a spezified owner (for hook_delete_account) - @syntax change_delete_owner( $owner,$new_owner=0 ) - @param $owner old owner - @param $new_owner new owner or 0 if entries should be deleted - */ + /** + * changes or deletes entries with a spezified owner (for hook_delete_account) + * + * @param $owner old owner + * @param $new_owner new owner or 0 if entries should be deleted + */ function change_delete_owner($owner,$new_owner=0) // new_owner=0 means delete { if (!(int) $new_owner) @@ -352,13 +350,12 @@ $this->db->update($this->info_table,array('info_responsible'=>$new_owner),array('info_responsible'=>$owner),__LINE__,__FILE__); } - /*! - @function write - @abstract writes the given $values to InfoLog, a new entry gets created if info_id is not set or 0 - @syntax write( $values ) - @param $values array with the data of the log-entry - @return the info_id - */ + /** + * writes the given $values to InfoLog, a new entry gets created if info_id is not set or 0 + * + * @param array $values with the data of the log-entry + * @return int the info_id + */ function write($values) // did _not_ ensure ACL { $info_id = (int) $values['info_id']; @@ -406,13 +403,12 @@ return $this->data['info_id']; } - /*! - @function anzSubs - @abstract count the sub-entries of $info_id - @syntax anzSubs( $info_id ) - @param $info_id id of log-entry - @returns the number of sub-entries - */ + /** + * count the sub-entries of $info_id + * + * @param $info_id id of log-entry + * @return int the number of sub-entries + */ function anzSubs( $info_id ) { if (($info_id = intval($info_id)) <= 0) @@ -429,21 +425,20 @@ return $this->db->f(0); } - /*! - @function search - @abstract searches InfoLog for a certain pattern in $query - @syntax search( $query ) - @param $query[order] column-name to sort after - @param $query[sort] sort-order DESC or ASC - @param $query[filter] string with combination of acl-, date- and status-filters, eg. 'own-open-today' or '' - @param $query[cat_id] category to use or 0 or unset - @param $query[search] pattern to search, search is done in info_from, info_subject and info_des - @param $query[action] / $query[action_id] if only entries linked to a specified app/entry show be used - @param &$query[start], &$query[total] nextmatch-parameters will be used and set if query returns less entries - @param $query[col_filter] array with column-name - data pairs, data == '' means no filter (!) - @param $query[subs] boolean return subs or not, if unset the user preference is used - @returns array with id's as key of the matching log-entries - */ + /** + * searches InfoLog for a certain pattern in $query + * + * @param $query[order] column-name to sort after + * @param $query[sort] sort-order DESC or ASC + * @param $query[filter] string with combination of acl-, date- and status-filters, eg. 'own-open-today' or '' + * @param $query[cat_id] category to use or 0 or unset + * @param $query[search] pattern to search, search is done in info_from, info_subject and info_des + * @param $query[action] / $query[action_id] if only entries linked to a specified app/entry show be used + * @param &$query[start], &$query[total] nextmatch-parameters will be used and set if query returns less entries + * @param $query[col_filter] array with column-name - data pairs, data == '' means no filter (!) + * @param $query[subs] boolean return subs or not, if unset the user preference is used + * @return array with id's as key of the matching log-entries + */ function search(&$query) { //echo "soinfolog.search(".print_r($query,True).")\n"; @@ -503,11 +498,11 @@ if ((int)$query['cat_id']) { //$filtermethod .= ' AND info_cat='.intval($query['cat_id']).' '; - if (!is_object($GLOBALS['phpgw']->categories)) + if (!is_object($GLOBALS['egw']->categories)) { - $GLOBALS['phpgw']->categories = CreateObject('phpgwapi.categories'); + $GLOBALS['egw']->categories =& CreateObject('phpgwapi.categories'); } - $cats = $GLOBALS['phpgw']->categories->return_all_children((int)$query['cat_id']); + $cats = $GLOBALS['egw']->categories->return_all_children((int)$query['cat_id']); $filtermethod .= ' AND info_cat'.(count($cats)>1? ' IN ('.implode(',',$cats).') ' : '='.(int)$query['cat_id']); } $join = ''; @@ -531,7 +526,7 @@ } $pid = 'AND info_id_parent='.($action == 'sp' ? $query['action_id'] : 0); - if (!$GLOBALS['phpgw_info']['user']['preferences']['infolog']['listNoSubs'] && + if (!$GLOBALS['egw_info']['user']['preferences']['infolog']['listNoSubs'] && $action != 'sp' || isset($query['subs']) && $query['subs']) { $pid = ''; diff --git a/infolog/inc/class.solink.inc.php b/infolog/inc/class.solink.inc.php index 94dee309bd..5003ef610c 100644 --- a/infolog/inc/class.solink.inc.php +++ b/infolog/inc/class.solink.inc.php @@ -12,19 +12,19 @@ /* $Id$ */ - $GLOBALS['phpgw_info']['flags']['included_classes']['solink'] = True; - /*! - @class solink - @author ralfbecker - @copyright GPL - GNU General Public License - @abstract generalized linking between entries of eGroupware apps - DB layer - @discussion This class is to access the links in the DB - Links have to ends each pointing two an entry, each entry is a double: - app app-name or directory-name of an egw application, eg. 'infolog' - id this is the id, eg. an integer or a tupple like '0:INBOX:1234' - @note All vars passed to this class are run either through addslashes or intval - to prevent query insertion and to get pgSql 7.3 compatibility. - */ + $GLOBALS['egw_info']['flags']['included_classes']['solink'] = True; + /** + * @author ralfbecker + * @copyright GPL - GNU General Public License + * generalized linking between entries of eGroupware apps - DB layer + * + * This class is to access the links in the DB + * * Links have to ends each pointing two an entry, each entry is a double: + * * app app-name or directory-name of an egw application, eg. 'infolog' + * * id this is the id, eg. an integer or a tupple like '0:INBOX:1234' + * All vars passed to this class are run either through addslashes or intval + * * to prevent query insertion and to get pgSql 7.3 compatibility. + */ class solink // DB-Layer { var $public_functions = array @@ -40,29 +40,27 @@ var $link_table = 'phpgw_links'; var $debug; - /*! - @function solink - @syntax solink( ) - @author ralfbecker - @abstract constructor - */ + /** + * @author ralfbecker + * constructor + * + */ function solink( ) { - $this->db = clone($GLOBALS['phpgw']->db); + $this->db = clone($GLOBALS['egw']->db); $this->db->set_app('infolog'); - $this->user = $GLOBALS['phpgw_info']['user']['account_id']; + $this->user = $GLOBALS['egw_info']['user']['account_id']; } - /*! - @function link - @syntax link( $app1,$id1,$app2,$id2,$remark='',$user=0 ) - @author ralfbecker - @abstract creats a link between $app1,$id1 and $app2,$id2 - @param $remark Remark to be saved with the link (defaults to '') - @param $owner Owner of the link (defaults to user) - @discussion Does NOT check if link already exists - @result False (for db or param-error) or link_id for success - */ + /** + * @author ralfbecker + * creats a link between $app1,$id1 and $app2,$id2 + * + * @param $remark Remark to be saved with the link (defaults to '') + * @param $owner Owner of the link (defaults to user) + * Does NOT check if link already exists + * @return False (for db or param-error) or link_id for success + */ function link( $app1,$id1,$app2,$id2,$remark='',$owner=0,$lastmod=0 ) { if ($this->debug) @@ -93,15 +91,14 @@ ),False,__LINE__,__FILE__) ? $this->db->get_last_insert_id($this->link_table,'link_id') : false; } - /*! - @function get_links - @syntax get_links( $app,$id,$only_app='',$only_name='',$order='link_lastmod DESC' ) - @author ralfbecker - @abstract returns array of links to $app,$id - @param $only_app if set return only links from $only_app (eg. only addressbook-entries) or NOT from if $only_app[0]=='!' - @param $order defaults to newest links first - @result array of links (only_app: ids) or empty array if no matching links found - */ + /** + * @author ralfbecker + * returns array of links to $app,$id + * + * @param $only_app if set return only links from $only_app (eg. only addressbook-entries) or NOT from if $only_app[0]=='!' + * @param $order defaults to newest links first + * @return array of links (only_app: ids) or empty array if no matching links found + */ function get_links( $app,$id,$only_app='',$order='link_lastmod DESC' ) { if ($this->debug) @@ -144,7 +141,7 @@ ); } if ($only_app && $not_only == ($link['app'] == $only_app) || - !$GLOBALS['phpgw_info']['user']['apps'][$link['app']]) + !$GLOBALS['egw_info']['user']['apps'][$link['app']]) { continue; } @@ -158,15 +155,14 @@ return $links; } - /*! - @function get_link - @syntax get_link( $app_link_id,$id='',$app2='',$id2='' ) - @author ralfbecker - @abstract returns data of a link - @param $app_link_id > 0 link_id of link or app-name of link - @param $id,$app2,$id2 other param of the link if not link_id given - @result array with link-data or False - */ + /** + * @author ralfbecker + * returns data of a link + * + * @param $app_link_id > 0 link_id of link or app-name of link + * @param $id,$app2,$id2 other param of the link if not link_id given + * @return array with link-data or False + */ function get_link($app_link_id,$id='',$app2='',$id2='') { if ($this->debug) @@ -213,15 +209,14 @@ return False; } - /*! - @function unlink - @syntax unlink( $link_id,$app='',$id='',$owner='',$app2='',$id2='' ) - @author ralfbecker - @abstract Remove link with $link_id or all links matching given params - @param $link_id link-id to remove if > 0 - @param $app,$id,$owner,$app2,$id2 if $link_id <= 0: removes all links matching the non-empty params - @result the number of links deleted - */ + /** + * @author ralfbecker + * Remove link with $link_id or all links matching given params + * + * @param $link_id link-id to remove if > 0 + * @param $app,$id,$owner,$app2,$id2 if $link_id <= 0: removes all links matching the non-empty params + * @return the number of links deleted + */ function unlink($link_id,$app='',$id='',$owner='',$app2='',$id2='') { if ($this->debug) @@ -275,15 +270,14 @@ return $this->db->affected_rows(); } - /*! - @function chown - @syntax chown( $owner,$new_owner ) - @author ralfbecker - @abstract Changes ownership of all links from $owner to $new_owner - @discussion This is needed when a user/account gets deleted - @discussion Does NOT change the modification-time - @result the number of links changed - */ + /** + * @author ralfbecker + * Changes ownership of all links from $owner to $new_owner + * + * This is needed when a user/account gets deleted + * Does NOT change the modification-time + * @return the number of links changed + */ function chown($owner,$new_owner) { if ((int)$owner <= 0 || (int) $new_owner) diff --git a/infolog/inc/class.uicustomfields.inc.php b/infolog/inc/class.uicustomfields.inc.php index 9a2a42e4e7..d679b55a92 100644 --- a/infolog/inc/class.uicustomfields.inc.php +++ b/infolog/inc/class.uicustomfields.inc.php @@ -21,24 +21,23 @@ function uicustomfields( ) { - $this->bo = CreateObject('infolog.boinfolog'); - $this->tmpl = CreateObject('etemplate.etemplate'); + $this->bo =& CreateObject('infolog.boinfolog'); + $this->tmpl =& CreateObject('etemplate.etemplate'); $this->types = &$this->bo->enums['type']; $this->status = &$this->bo->status; $this->config = &$this->bo->config; $this->fields = &$this->bo->customfields; } - /*! - @function edit - @syntax edit( $content=0 ) - @author ralfbecker - @abstract Edit/Create an InfoLog Custom fields, typ and status - @param $content Content from the eTemplate Exec - */ + /** + * @author ralfbecker + * Edit/Create an InfoLog Custom fields, typ and status + * + * @param $content Content from the eTemplate Exec + */ function edit($content = 0) { - $GLOBALS['phpgw_info']['flags']['app_header'] = lang('InfoLog').' - '.lang('Custom fields, typ and status'); + $GLOBALS['egw_info']['flags']['app_header'] = lang('InfoLog').' - '.lang('Custom fields, typ and status'); if (is_array($content)) { //echo ''; print_r($content); echo "\n"; @@ -65,7 +64,7 @@ break; } case 'cancel': - $GLOBALS['phpgw']->redirect_link('/admin/'); + $GLOBALS['egw']->redirect_link('/admin/'); exit; } } diff --git a/infolog/inc/class.uiinfolog.inc.php b/infolog/inc/class.uiinfolog.inc.php index a80fcd8011..fb7d2bfa54 100644 --- a/infolog/inc/class.uiinfolog.inc.php +++ b/infolog/inc/class.uiinfolog.inc.php @@ -13,7 +13,16 @@ /* $Id$ */ - class uiinfolog // UI - User Interface - HTML + include_once(EGW_INCLUDE_ROOT.'/infolog/inc/class.boinfolog.inc.php'); + + /** + * This class is the UI-layer (user interface) of InfoLog + * + * @package infolog + * @author RalfBecker-At-outdoor-training.de + * @copyright GPL - GNU General Public License + */ + class uiinfolog { var $public_functions = array ( @@ -28,7 +37,7 @@ function uiinfolog( ) { - $this->bo = CreateObject('infolog.boinfolog'); + $this->bo =& new boinfolog(); $this->icons = array( 'type' => array( @@ -75,10 +84,10 @@ ); $this->link = &$this->bo->link; - $this->tmpl = CreateObject('etemplate.etemplate'); + $this->tmpl =& CreateObject('etemplate.etemplate'); $this->html = &$this->tmpl->html; - $this->user = $GLOBALS['phpgw_info']['user']['account_id']; + $this->user = $GLOBALS['egw_info']['user']['account_id']; } function get_info($info,&$readonlys,$action='',$action_id='') @@ -97,14 +106,14 @@ $info['info_anz_subs'] = $this->bo->anzSubs($id); $this->bo->link_id2from($info,$action,$action_id); // unset from for $action:$action_id - $readonlys["edit[$id]"] = !$this->bo->check_access($id,PHPGW_ACL_EDIT); - $readonlys["edit_status[$id]"] = !($this->bo->check_access($id,PHPGW_ACL_EDIT) || $info['info_responsible'] == $this->user); - $readonlys["delete[$id]"] = !$this->bo->check_access($id,PHPGW_ACL_DELETE); - $readonlys["sp[$id]"] = !$this->bo->check_access($id,PHPGW_ACL_ADD); + $readonlys["edit[$id]"] = !$this->bo->check_access($id,EGW_ACL_EDIT); + $readonlys["edit_status[$id]"] = !($this->bo->check_access($id,EGW_ACL_EDIT) || $info['info_responsible'] == $this->user); + $readonlys["delete[$id]"] = !$this->bo->check_access($id,EGW_ACL_DELETE); + $readonlys["sp[$id]"] = !$this->bo->check_access($id,EGW_ACL_ADD); $readonlys["view[$id]"] = $info['info_anz_subs'] < 1; $readonlys['view[0]'] = True; // no parent - $show_links = $GLOBALS['phpgw_info']['user']['preferences']['infolog']['show_links']; + $show_links = $GLOBALS['egw_info']['user']['preferences']['infolog']['show_links']; if ($show_links != 'none' && ($links = $this->link->get_links('infolog',$info['info_id']))) { @@ -128,7 +137,7 @@ { $for = @$values['session_for'] ? $values['session_for'] : @$this->called_by; //echo "$for: uiinfolog::save_sessiondata(".print_r($values,True).") called_by='$this->called_by'\n"; - $GLOBALS['phpgw']->session->appsession($for.'session_data','infolog',array( + $GLOBALS['egw']->session->appsession($for.'session_data','infolog',array( 'search' => $values['search'], 'start' => $values['start'], 'filter' => $values['filter'], @@ -142,7 +151,7 @@ function read_sessiondata() { - $values = $GLOBALS['phpgw']->session->appsession(@$this->called_by.'session_data','infolog'); + $values = $GLOBALS['egw']->session->appsession(@$this->called_by.'session_data','infolog'); if (!@$values['session_for'] && $this->called_by) { $values['session_for'] = $this->called_by; @@ -275,7 +284,7 @@ { if ($typ != 'defaults') $all_stati += $stati; } - $GLOBALS['phpgw_info']['flags']['params']['manual'] = array('page' => 'ManualInfologIndex'); + $GLOBALS['egw_info']['flags']['params']['manual'] = array('page' => 'ManualInfologIndex'); return $this->tmpl->exec('infolog.uiinfolog.index',$values,array( 'info_type' => $this->bo->enums['type'], @@ -290,7 +299,7 @@ if (is_array($values) || $info_id <= 0) { - if ($values['delete'] && $info_id > 0 && $this->bo->check_access($info_id,PHPGW_ACL_DELETE)) + if ($values['delete'] && $info_id > 0 && $this->bo->check_access($info_id,EGW_ACL_DELETE)) { $this->bo->delete($info_id,$values['remove_subs'],$values['info_id_parent']); } @@ -307,24 +316,22 @@ $persist['referer'] = $referer; $persist['info_id_parent'] = $values['main'][1]['info_id_parent']; - $GLOBALS['phpgw_info']['flags']['app_header'] = lang('InfoLog').' - '.lang('Delete'); - $GLOBALS['phpgw_info']['flags']['params']['manual'] = array('page' => 'ManualInfologDelete'); + $GLOBALS['egw_info']['flags']['app_header'] = lang('InfoLog').' - '.lang('Delete'); + $GLOBALS['egw_info']['flags']['params']['manual'] = array('page' => 'ManualInfologDelete'); $this->tmpl->exec('infolog.uiinfolog.delete',$values,'',$readonlys,$persist); } - /*! - @function edit - @syntax edit( $content=0,$action='',$action_id=0,$type='',$referer='' ) - @author ralfbecker - @abstract Edit/Create an InfoLog Entry - @param $content Content from the eTemplate Exec call or info_id on inital call - @param $action Name of an app of 'sp' for a infolog-sub - @param $action_id Id of app-entry to which a link is created - @param $type Type of log-entry: note,todo,task - @param $referer array with param/get-vars of the refering page - */ - function edit($content = 0,$action = '',$action_id=0,$type='',$referer='') + /** + * Edit/Create an InfoLog Entry + * + * @param array $content=null Content from the eTemplate Exec call or info_id on inital call + * @param string $action='' Name of an app of 'sp' for a infolog-sub + * @param int $action_id=0 Id of app-entry to which a link is created + * @param string $type='' Type of log-entry: note,todo,task + * @param string $referer='' array with param/get-vars of the refering page + */ + function edit($content = null,$action = '',$action_id=0,$type='',$referer='') { if (is_array($content)) { @@ -342,7 +349,7 @@ { if ($content['save'] && $info_id) { - if (!($edit_acl = $this->bo->check_access($info_id,PHPGW_ACL_EDIT))) + if (!($edit_acl = $this->bo->check_access($info_id,EGW_ACL_EDIT))) { $old = $this->bo->read($info_id); $status_only = $old['info_responsible'] == $this->user; @@ -402,7 +409,7 @@ $info_id = $content ? $content : get_var('info_id', array('POST','GET')); $type = $type ? $type : get_var('type', array('POST','GET')); $referer = $referer !== '' ? $referer : - ereg_replace('^.*'.$GLOBALS['phpgw_info']['server']['webserver_url'],'', + ereg_replace('^.*'.$GLOBALS['egw_info']['server']['webserver_url'],'', get_var('HTTP_REFERER',Array('SERVER'))); //echo "uiinfolog::edit: info_id=$info_id, action='$action', action_id='$action_id', type='$type', referer='$referer'\n"; @@ -416,7 +423,7 @@ if (!$info_id && $action_id && $action == 'sp') // new SubProject { - if (!$this->bo->check_access($action_id,PHPGW_ACL_ADD)) + if (!$this->bo->check_access($action_id,EGW_ACL_ADD)) { return $referer ? $this->tmpl->location($referer) : $this->index(0,$action,$action_id); } @@ -448,7 +455,7 @@ } else { - if ($info_id && !$this->bo->check_access($info_id,PHPGW_ACL_EDIT)) + if ($info_id && !$this->bo->check_access($info_id,EGW_ACL_EDIT)) { if ($content['info_responsible'] == $this->user) { @@ -519,9 +526,9 @@ { $content['blur_title'] = $this->link->title($action,$action_id); } - $readonlys['delete'] = !$info_id || !$this->bo->check_access($info_id,PHPGW_ACL_DELETE); + $readonlys['delete'] = !$info_id || !$this->bo->check_access($info_id,EGW_ACL_DELETE); - $GLOBALS['phpgw_info']['flags']['app_header'] = lang($this->messages[$info_id ? 'edit' : ($action == 'sp' ? 'add_sub' : 'add')]); + $GLOBALS['egw_info']['flags']['app_header'] = lang($this->messages[$info_id ? 'edit' : ($action == 'sp' ? 'add_sub' : 'add')]); $this->tmpl->read('infolog.edit'); if ($this->bo->has_customfields($content['info_type'])) @@ -533,9 +540,9 @@ { $this->tmpl->set_cell_attribute('description|links|delegation|customfields','name','description|links|delegation'); } - $GLOBALS['phpgw_info']['flags']['app_header'] = lang('InfoLog').' - '. + $GLOBALS['egw_info']['flags']['app_header'] = lang('InfoLog').' - '. ($content['status_only'] ? lang('Edit Status') : lang('Edit')); - $GLOBALS['phpgw_info']['flags']['params']['manual'] = array('page' => ($info_id ? 'ManualInfologEdit' : 'ManualInfologAdd')); + $GLOBALS['egw_info']['flags']['params']['manual'] = array('page' => ($info_id ? 'ManualInfologEdit' : 'ManualInfologAdd')); //echo "uiinfolog.edit(info_id='$info_id',action='$action',action_id='$action_id') readonlys="; print_r($readonlys); echo ", content = "; _debug_array($content); $this->tmpl->exec('infolog.uiinfolog.edit',$content,array( @@ -565,7 +572,7 @@ { $icon = $this->icons[$cat][$id]; } - if ($icon && !is_readable($GLOBALS['phpgw']->common->get_image_dir() . '/' . $icon)) + if ($icon && !is_readable($GLOBALS['egw']->common->get_image_dir() . '/' . $icon)) { $icon = False; } @@ -583,7 +590,7 @@ { if(get_var('cancel',Array('POST'))) { - $GLOBALS['phpgw']->redirect_link('/admin/index.php'); + $GLOBALS['egw']->redirect_link('/admin/index.php'); } if(get_var('save',Array('POST'))) @@ -608,15 +615,15 @@ $this->bo->config->save_repository(True); } - $GLOBALS['phpgw_info']['flags']['css'] = $this->html->theme2css(); - $GLOBALS['phpgw_info']['flags']['app_header'] = lang('InfoLog').' - '.lang('Configuration'); - $GLOBALS['phpgw']->common->phpgw_header(); + $GLOBALS['egw_info']['flags']['css'] = $this->html->theme2css(); + $GLOBALS['egw_info']['flags']['app_header'] = lang('InfoLog').' - '.lang('Configuration'); + $GLOBALS['egw']->common->egw_header(); - $GLOBALS['phpgw']->template->set_file(array('info_admin_t' => 'admin.tpl')); - $GLOBALS['phpgw']->template->set_block('info_admin_t', 'admin_line'); - $GLOBALS['phpgw']->template->set_block('info_admin_t', 'info_admin'); + $GLOBALS['egw']->template->set_file(array('info_admin_t' => 'admin.tpl')); + $GLOBALS['egw']->template->set_block('info_admin_t', 'admin_line'); + $GLOBALS['egw']->template->set_block('info_admin_t', 'info_admin'); - $GLOBALS['phpgw']->template->set_var(Array( + $GLOBALS['egw']->template->set_var(Array( 'text' => lang('file-attachments via symlinks instead of uploads and retrieval via file:/path for direct lan-clients'), 'action_url' => $this->html->link('/index.php',$this->menuaction('admin')), 'save_button' => $this->html->submit_button('save','Save'), @@ -633,33 +640,33 @@ $i = 0; @reset($this->bo->link_pathes); do { list($valid,$trans) = @each($this->bo->link_pathes); - $GLOBALS['phpgw']->template->set_var(array( + $GLOBALS['egw']->template->set_var(array( 'tr_color' => $i & 1 ? 'row_off' : 'row_on', 'num' => $i+1, 'val_valid' => $this->html->input("valid[$i]",$valid), 'val_trans' => $this->html->input("trans[$i]",$trans), 'val_ip' => $this->html->input("ip[$i]",$this->bo->send_file_ips[$valid]) )); - $GLOBALS['phpgw']->template->parse('admin_lines','admin_line',True); + $GLOBALS['egw']->template->parse('admin_lines','admin_line',True); ++$i; } while ($valid); if (!$this->tmpl->xslt) { echo parse_navbar(); - $GLOBALS['phpgw']->template->pfp('phpgw_body','info_admin'); + $GLOBALS['egw']->template->pfp('phpgw_body','info_admin'); } else { - $GLOBALS['phpgw']->template->fp('phpgw_body','info_admin'); + $GLOBALS['egw']->template->fp('phpgw_body','info_admin'); } } - /*! - @function writeLangFile - @abstract writes langfile with all templates and messages registered here - @discussion called via [write Langfile] in the etemplate-editor or as http://domain/egroupware/index.php?menuaction=infolog.uiinfolog.writeLangFile - */ + /** + * writes langfile with all templates and messages registered here + * + * called via [write Langfile] in the etemplate-editor or as http://domain/egroupware/index.php?menuaction=infolog.uiinfolog.writeLangFile + */ function writeLangFile() { $extra = $this->messages + $this->filters; @@ -672,24 +679,23 @@ return $this->tmpl->writeLangFile('infolog','en',$extra); } - /*! - @function hook_view - @abstract shows infolog in other applications - @syntax hook_view($args) - @param $args['location'] location des hooks: {addressbook|projects|calendar}_view|infolog - @param $args['view'] menuaction to view, if location == 'infolog' - @param $args['app'] app-name, if location == 'infolog' - @param $args['view_id'] name of the id-var for location == 'infolog' - @param $args[$args['view_id']] id of the entry - @note this function can be called for any app, which should include infolog: \ - $GLOBALS['phpgw']->hooks->process(array( \ - 'location' => 'infolog', \ - 'app' => , \ - 'view_id' => , \ - => , \ - 'view' => \ - )); - */ + /** + * shows infolog in other applications + * + * @param $args['location'] location des hooks: {addressbook|projects|calendar}_view|infolog + * @param $args['view'] menuaction to view, if location == 'infolog' + * @param $args['app'] app-name, if location == 'infolog' + * @param $args['view_id'] name of the id-var for location == 'infolog' + * @param $args[$args['view_id']] id of the entry + * this function can be called for any app, which should include infolog: \ + * $GLOBALS['egw']->hooks->process(array( \ + * * 'location' => 'infolog', \ + * * 'app' => , \ + * * 'view_id' => , \ + * * => , \ + * * 'view' => \ + * )); + */ function hook_view($args) { switch ($args['location']) @@ -724,17 +730,17 @@ } $this->called_by = $app; // for read/save_sessiondata, to have different sessions for the hooks - $save_app = $GLOBALS['phpgw_info']['flags']['currentapp']; - $GLOBALS['phpgw_info']['flags']['currentapp'] = 'infolog'; + $save_app = $GLOBALS['egw_info']['flags']['currentapp']; + $GLOBALS['egw_info']['flags']['currentapp'] = 'infolog'; - $GLOBALS['phpgw']->translation->add_app('infolog'); + $GLOBALS['egw']->translation->add_app('infolog'); - $GLOBALS['phpgw_info']['etemplate']['hooked'] = True; + $GLOBALS['egw_info']['etemplate']['hooked'] = True; $this->index(0,$app,$args[$view_id],array( 'menuaction' => $view, $view_id => $args[$view_id] ),True); - $GLOBALS['phpgw_info']['flags']['currentapp'] = $save_app; - unset($GLOBALS['phpgw_info']['etemplate']['hooked']); + $GLOBALS['egw_info']['flags']['currentapp'] = $save_app; + unset($GLOBALS['egw_info']['etemplate']['hooked']); } } diff --git a/infolog/inc/hook_deleteaccount.inc.php b/infolog/inc/hook_deleteaccount.inc.php index fc02467b63..61c9d386fb 100644 --- a/infolog/inc/hook_deleteaccount.inc.php +++ b/infolog/inc/hook_deleteaccount.inc.php @@ -11,10 +11,10 @@ /* $Id$ */ // Delete all records for a user - $info = CreateObject('infolog.soinfolog'); + $info =& CreateObject('infolog.soinfolog'); - $info->change_delete_owner(intval($GLOBALS['HTTP_POST_VARS']['account_id']), - intval($GLOBALS['HTTP_POST_VARS']['new_owner'])); + $info->change_delete_owner(intval($_POST['account_id']), + intval($_POST['new_owner'])); unset($info); ?> diff --git a/infolog/inc/hook_home.inc.php b/infolog/inc/hook_home.inc.php index 357aece842..7f5b407b8d 100644 --- a/infolog/inc/hook_home.inc.php +++ b/infolog/inc/hook_home.inc.php @@ -10,18 +10,18 @@ \**************************************************************************/ /* $Id$ */ - $showevents = intval($GLOBALS['phpgw_info']['user']['preferences']['infolog']['homeShowEvents']); + $showevents = intval($GLOBALS['egw_info']['user']['preferences']['infolog']['homeShowEvents']); if($showevents > 0) { - $save_app = $GLOBALS['phpgw_info']['flags']['currentapp']; - $GLOBALS['phpgw_info']['flags']['currentapp'] = 'infolog'; + $save_app = $GLOBALS['egw_info']['flags']['currentapp']; + $GLOBALS['egw_info']['flags']['currentapp'] = 'infolog'; - $GLOBALS['phpgw']->translation->add_app('infolog'); + $GLOBALS['egw']->translation->add_app('infolog'); - $app_id = $GLOBALS['phpgw']->applications->name2id('infolog'); + $app_id = $GLOBALS['egw']->applications->name2id('infolog'); $GLOBALS['portal_order'][] = $app_id; - $infolog = CreateObject('infolog.uiinfolog'); + $infolog =& CreateObject('infolog.uiinfolog'); switch($showevents) { case 1: @@ -37,14 +37,14 @@ if(!$xslt) // .14/6 { - $portalbox = CreateObject('phpgwapi.listbox',array( + $portalbox =& CreateObject('phpgwapi.listbox',array( 'title' => $title, - 'primary' => $GLOBALS['phpgw_info']['theme']['navbar_bg'], - 'secondary' => $GLOBALS['phpgw_info']['theme']['navbar_bg'], - 'tertiary' => $GLOBALS['phpgw_info']['theme']['navbar_bg'], + 'primary' => $GLOBALS['egw_info']['theme']['navbar_bg'], + 'secondary' => $GLOBALS['egw_info']['theme']['navbar_bg'], + 'tertiary' => $GLOBALS['egw_info']['theme']['navbar_bg'], 'width' => '100%', 'outerborderwidth' => '0', - 'header_background_image' => $GLOBALS['phpgw']->common->image('phpgwapi/templates/default','bg_filler') + 'header_background_image' => $GLOBALS['egw']->common->image('phpgwapi/templates/default','bg_filler') )); foreach(array( 'up' => Array('url' => '/set_box.php', 'app' => $app_id), @@ -63,14 +63,14 @@ } else // HEAD / XSLT { - $GLOBALS['phpgw']->portalbox->set_params(array( + $GLOBALS['egw']->portalbox->set_params(array( 'app_id' => $app_id, 'title' => $title )); - $GLOBALS['phpgw']->portalbox->draw($html); + $GLOBALS['egw']->portalbox->draw($html); } unset($html); - $GLOBALS['phpgw_info']['flags']['currentapp'] = $save_app; + $GLOBALS['egw_info']['flags']['currentapp'] = $save_app; } unset($showevents); ?> diff --git a/infolog/inc/hook_settings.inc.php b/infolog/inc/hook_settings.inc.php index c4b73f29d1..c391bfc43f 100644 --- a/infolog/inc/hook_settings.inc.php +++ b/infolog/inc/hook_settings.inc.php @@ -24,7 +24,7 @@ create_input_box('Max number of entries to display on the main screen','mainscreen_maxshow', 'Only up to this number of entries are displayed on the main screen.','10',3); - $ui = CreateObject('infolog.uiinfolog'); // need some labels from + $ui =& CreateObject('infolog.uiinfolog'); // need some labels from foreach($ui->filters as $key => $label) { $filters[$key] = lang($label); diff --git a/infolog/index.php b/infolog/index.php index 2541e6c27e..0e4bf98fb8 100644 --- a/infolog/index.php +++ b/infolog/index.php @@ -13,16 +13,16 @@ /* $Id$ */ - $GLOBALS['phpgw_info']['flags'] = array( + $GLOBALS['egw_info']['flags'] = array( 'currentapp' => 'infolog', 'noheader' => True, 'nonavbar' => True ); include('../header.inc.php'); - $GLOBALS['phpgw']->redirect_link('/index.php',array( + $GLOBALS['egw']->redirect_link('/index.php',array( 'menuaction' => 'infolog.uiinfolog.index', - 'filter' => $GLOBALS['phpgw_info']['user']['preferences']['infolog']['defaultFilter'] + 'filter' => $GLOBALS['egw_info']['user']['preferences']['infolog']['defaultFilter'] )); - $GLOBALS['phpgw']->common->phpgw_exit(); + $GLOBALS['egw']->common->egw_exit(); ?>
". "I hope that helped to understand the features, if not ask."; - $GLOBALS['phpgw']->template->set_var('help_on_trans',lang($help_on_trans)); // I don't think anyone will translate this + $GLOBALS['egw']->template->set_var('help_on_trans',lang($help_on_trans)); // I don't think anyone will translate this break; case 'next': @@ -300,7 +300,7 @@ function cat_id($cats) $_POST['trans'] = unserialize(stripslashes($_POST['trans'])); // fall-through case 'import': - $hiddenvars = $GLOBALS['phpgw']->html->input_hidden(array( + $hiddenvars = $GLOBALS['egw']->html->input_hidden(array( 'action' => 'continue', 'fieldsep'=> $_POST['fieldsep'], 'charset' => $_POST['charset'], @@ -313,7 +313,7 @@ function cat_id($cats) @set_time_limit(0); $fp=fopen($csvfile,'r'); $csv_fields = fgetcsv($fp,8000,$_POST['fieldsep']); - $csv_fields = $GLOBALS['phpgw']->translation->convert($csv_fields,$_POST['charset']); + $csv_fields = $GLOBALS['egw']->translation->convert($csv_fields,$_POST['charset']); $csv_fields[] = 'no CSV 1'; // eg. for static assignments $csv_fields[] = 'no CSV 2'; $csv_fields[] = 'no CSV 3'; @@ -330,9 +330,9 @@ function cat_id($cats) } } - $GLOBALS['phpgw']->preferences->read_repository(); - $GLOBALS['phpgw']->preferences->add('infolog','cvs_import',$defaults); - $GLOBALS['phpgw']->preferences->save_repository(True); + $GLOBALS['egw']->preferences->read_repository(); + $GLOBALS['egw']->preferences->add('infolog','cvs_import',$defaults); + $GLOBALS['egw']->preferences->save_repository(True); $log = "
boinfolog::link_id2from(subject='$info[info_subject]', link_id='$info[info_link_id], from='$info[info_from]', not_app='$not_app', not_id='$not_id')"; @@ -204,11 +231,20 @@ return False; } + /** + * Create a subject from a description: truncate it and add ' ...' + */ function subject_from_des($des) { return substr($des,0,60).' ...'; } + /** + * Read an infolog entry specified by $info_id + * + * @param int/array $info_id integer id or array with key 'info_id' of the entry to read + * @return array/boolean infolog entry or False if not found or no permission to read it + */ function &read($info_id) { if (is_array($info_id)) @@ -224,7 +260,7 @@ } return False; } - if (!$this->check_access($info_id,PHPGW_ACL_READ)) // check behind read, to prevent a double read + if (!$this->check_access($info_id,EGW_ACL_READ)) // check behind read, to prevent a double read { if ($this->xmlrpc) { @@ -252,6 +288,14 @@ return $data; } + /** + * Delete an infolog entry, evtl. incl. it's children / subs + * + * @param int/array $info_id int id or array with keys 'info_id', 'delete_children' and 'new_parent' setting all 3 params + * @param boolean $delete_children should the children be deleted + * @param int/boolean $new_parent parent to use for not deleted children if > 0 + * @return boolean True if delete was successful, False otherwise ($info_id does not exist or no rights) + */ function delete($info_id,$delete_children=False,$new_parent=False) { if (is_array($info_id)) @@ -268,7 +312,7 @@ } return False; } - if (!$this->check_access($info_id,PHPGW_ACL_DELETE)) + if (!$this->check_access($info_id,EGW_ACL_DELETE)) { if ($this->xmlrpc) { @@ -283,7 +327,9 @@ $this->so->delete($info_id,$delete_children,$new_parent); - $GLOBALS['phpgw']->contenthistory->updateTimeStamp('infolog_'.$info['info_type'], $info_id, 'delete', time()); + $GLOBALS['egw']->contenthistory->updateTimeStamp('infolog_'.$info['info_type'], $info_id, 'delete', time()); + + return True; } /** @@ -316,10 +362,10 @@ } } $status_only = $values['info_id'] && $values['info_responsible'] == $this->user && - !$this->check_access($values['info_id'],PHPGW_ACL_EDIT); // responsible has implicit right to change status + !$this->check_access($values['info_id'],EGW_ACL_EDIT); // responsible has implicit right to change status - if ($values['info_id'] && !$this->check_access($values['info_id'],PHPGW_ACL_EDIT) && !$status_only || - !$values['info_id'] && $values['info_id_parent'] && !$this->check_access($values['info_id_parent'],PHPGW_ACL_ADD)) + if ($values['info_id'] && !$this->check_access($values['info_id'],EGW_ACL_EDIT) && !$status_only || + !$values['info_id'] && $values['info_id_parent'] && !$this->check_access($values['info_id_parent'],EGW_ACL_ADD)) { if ($this->xmlrpc) { @@ -388,7 +434,7 @@ if($values['info_id']) { // update - $GLOBALS['phpgw']->contenthistory->updateTimeStamp( + $GLOBALS['egw']->contenthistory->updateTimeStamp( 'infolog_'.$values['info_type'], $infoID, 'modify', time() ); @@ -396,7 +442,7 @@ else { // add - $GLOBALS['phpgw']->contenthistory->updateTimeStamp( + $GLOBALS['egw']->contenthistory->updateTimeStamp( 'infolog_'.$values['info_type'], $infoID, 'add', time() ); @@ -406,25 +452,30 @@ return $infoID; } + /** + * Query the number of children / subs + * + * @param int $info_id id + * @return int number of subs + */ function anzSubs( $info_id ) { return $this->so->anzSubs( $info_id ); } - /*! - @function search - @abstract searches InfoLog for a certain pattern in $query - @syntax search( $query ) - @param $query[order] column-name to sort after - @param $query[sort] sort-order DESC or ASC - @param $query[filter] string with combination of acl-, date- and status-filters, eg. 'own-open-today' or '' - @param $query[cat_id] category to use or 0 or unset - @param $query[search] pattern to search, search is done in info_from, info_subject and info_des - @param $query[action] / $query[action_id] if only entries linked to a specified app/entry show be used - @param &$query[start], &$query[total] nextmatch-parameters will be used and set if query returns less entries - @param $query[col_filter] array with column-name - data pairs, data == '' means no filter (!) - @returns array with id's as key of the matching log-entries - */ + /** + * searches InfoLog for a certain pattern in $query + * + * @param $query[order] column-name to sort after + * @param $query[sort] sort-order DESC or ASC + * @param $query[filter] string with combination of acl-, date- and status-filters, eg. 'own-open-today' or '' + * @param $query[cat_id] category to use or 0 or unset + * @param $query[search] pattern to search, search is done in info_from, info_subject and info_des + * @param $query[action] / $query[action_id] if only entries linked to a specified app/entry show be used + * @param &$query[start], &$query[total] nextmatch-parameters will be used and set if query returns less entries + * @param $query[col_filter] array with column-name - data pairs, data == '' means no filter (!) + * @return array with id's as key of the matching log-entries + */ function &search(&$query) { //echo "
boinfolog::search(".print_r($query,True).")
cal_to_include("; print_r($args); echo ")
bolink::get_links(app='$app',id='$id',only_app='$only_app',order='$order')
attached_local(app=$app, id='$id', filename='$filename', ip='$ip', win_user='$win_user', count(send_file_ips)=".count($this->send_file_ips).")
check_access(info_id=$info_id (owner=$owner, user=$user),required_rights=$required_rights): access".($access_ok?"Ok":"Denied")."
grants: user=$user, grant=$grant
soinfolog::delete($info_id,'$delete_children',$new_parent)
soinfolog.search(".print_r($query,True).")
'; print_r($content); echo "
$for: uiinfolog::save_sessiondata(".print_r($values,True).") called_by='$this->called_by'
uiinfolog::edit: info_id=$info_id, action='$action', action_id='$action_id', type='$type', referer='$referer'
uiinfolog.edit(info_id='$info_id',action='$action',action_id='$action_id') readonlys="; print_r($readonlys); echo ", content = "; _debug_array($content); $this->tmpl->exec('infolog.uiinfolog.edit',$content,array( @@ -565,7 +572,7 @@ { $icon = $this->icons[$cat][$id]; } - if ($icon && !is_readable($GLOBALS['phpgw']->common->get_image_dir() . '/' . $icon)) + if ($icon && !is_readable($GLOBALS['egw']->common->get_image_dir() . '/' . $icon)) { $icon = False; } @@ -583,7 +590,7 @@ { if(get_var('cancel',Array('POST'))) { - $GLOBALS['phpgw']->redirect_link('/admin/index.php'); + $GLOBALS['egw']->redirect_link('/admin/index.php'); } if(get_var('save',Array('POST'))) @@ -608,15 +615,15 @@ $this->bo->config->save_repository(True); } - $GLOBALS['phpgw_info']['flags']['css'] = $this->html->theme2css(); - $GLOBALS['phpgw_info']['flags']['app_header'] = lang('InfoLog').' - '.lang('Configuration'); - $GLOBALS['phpgw']->common->phpgw_header(); + $GLOBALS['egw_info']['flags']['css'] = $this->html->theme2css(); + $GLOBALS['egw_info']['flags']['app_header'] = lang('InfoLog').' - '.lang('Configuration'); + $GLOBALS['egw']->common->egw_header(); - $GLOBALS['phpgw']->template->set_file(array('info_admin_t' => 'admin.tpl')); - $GLOBALS['phpgw']->template->set_block('info_admin_t', 'admin_line'); - $GLOBALS['phpgw']->template->set_block('info_admin_t', 'info_admin'); + $GLOBALS['egw']->template->set_file(array('info_admin_t' => 'admin.tpl')); + $GLOBALS['egw']->template->set_block('info_admin_t', 'admin_line'); + $GLOBALS['egw']->template->set_block('info_admin_t', 'info_admin'); - $GLOBALS['phpgw']->template->set_var(Array( + $GLOBALS['egw']->template->set_var(Array( 'text' => lang('file-attachments via symlinks instead of uploads and retrieval via file:/path for direct lan-clients'), 'action_url' => $this->html->link('/index.php',$this->menuaction('admin')), 'save_button' => $this->html->submit_button('save','Save'), @@ -633,33 +640,33 @@ $i = 0; @reset($this->bo->link_pathes); do { list($valid,$trans) = @each($this->bo->link_pathes); - $GLOBALS['phpgw']->template->set_var(array( + $GLOBALS['egw']->template->set_var(array( 'tr_color' => $i & 1 ? 'row_off' : 'row_on', 'num' => $i+1, 'val_valid' => $this->html->input("valid[$i]",$valid), 'val_trans' => $this->html->input("trans[$i]",$trans), 'val_ip' => $this->html->input("ip[$i]",$this->bo->send_file_ips[$valid]) )); - $GLOBALS['phpgw']->template->parse('admin_lines','admin_line',True); + $GLOBALS['egw']->template->parse('admin_lines','admin_line',True); ++$i; } while ($valid); if (!$this->tmpl->xslt) { echo parse_navbar(); - $GLOBALS['phpgw']->template->pfp('phpgw_body','info_admin'); + $GLOBALS['egw']->template->pfp('phpgw_body','info_admin'); } else { - $GLOBALS['phpgw']->template->fp('phpgw_body','info_admin'); + $GLOBALS['egw']->template->fp('phpgw_body','info_admin'); } } - /*! - @function writeLangFile - @abstract writes langfile with all templates and messages registered here - @discussion called via [write Langfile] in the etemplate-editor or as http://domain/egroupware/index.php?menuaction=infolog.uiinfolog.writeLangFile - */ + /** + * writes langfile with all templates and messages registered here + * + * called via [write Langfile] in the etemplate-editor or as http://domain/egroupware/index.php?menuaction=infolog.uiinfolog.writeLangFile + */ function writeLangFile() { $extra = $this->messages + $this->filters; @@ -672,24 +679,23 @@ return $this->tmpl->writeLangFile('infolog','en',$extra); } - /*! - @function hook_view - @abstract shows infolog in other applications - @syntax hook_view($args) - @param $args['location'] location des hooks: {addressbook|projects|calendar}_view|infolog - @param $args['view'] menuaction to view, if location == 'infolog' - @param $args['app'] app-name, if location == 'infolog' - @param $args['view_id'] name of the id-var for location == 'infolog' - @param $args[$args['view_id']] id of the entry - @note this function can be called for any app, which should include infolog: \ - $GLOBALS['phpgw']->hooks->process(array( \ - 'location' => 'infolog', \ - 'app' => , \ - 'view_id' => , \ - => , \ - 'view' => \ - )); - */ + /** + * shows infolog in other applications + * + * @param $args['location'] location des hooks: {addressbook|projects|calendar}_view|infolog + * @param $args['view'] menuaction to view, if location == 'infolog' + * @param $args['app'] app-name, if location == 'infolog' + * @param $args['view_id'] name of the id-var for location == 'infolog' + * @param $args[$args['view_id']] id of the entry + * this function can be called for any app, which should include infolog: \ + * $GLOBALS['egw']->hooks->process(array( \ + * * 'location' => 'infolog', \ + * * 'app' => , \ + * * 'view_id' => , \ + * * => , \ + * * 'view' => \ + * )); + */ function hook_view($args) { switch ($args['location']) @@ -724,17 +730,17 @@ } $this->called_by = $app; // for read/save_sessiondata, to have different sessions for the hooks - $save_app = $GLOBALS['phpgw_info']['flags']['currentapp']; - $GLOBALS['phpgw_info']['flags']['currentapp'] = 'infolog'; + $save_app = $GLOBALS['egw_info']['flags']['currentapp']; + $GLOBALS['egw_info']['flags']['currentapp'] = 'infolog'; - $GLOBALS['phpgw']->translation->add_app('infolog'); + $GLOBALS['egw']->translation->add_app('infolog'); - $GLOBALS['phpgw_info']['etemplate']['hooked'] = True; + $GLOBALS['egw_info']['etemplate']['hooked'] = True; $this->index(0,$app,$args[$view_id],array( 'menuaction' => $view, $view_id => $args[$view_id] ),True); - $GLOBALS['phpgw_info']['flags']['currentapp'] = $save_app; - unset($GLOBALS['phpgw_info']['etemplate']['hooked']); + $GLOBALS['egw_info']['flags']['currentapp'] = $save_app; + unset($GLOBALS['egw_info']['etemplate']['hooked']); } } diff --git a/infolog/inc/hook_deleteaccount.inc.php b/infolog/inc/hook_deleteaccount.inc.php index fc02467b63..61c9d386fb 100644 --- a/infolog/inc/hook_deleteaccount.inc.php +++ b/infolog/inc/hook_deleteaccount.inc.php @@ -11,10 +11,10 @@ /* $Id$ */ // Delete all records for a user - $info = CreateObject('infolog.soinfolog'); + $info =& CreateObject('infolog.soinfolog'); - $info->change_delete_owner(intval($GLOBALS['HTTP_POST_VARS']['account_id']), - intval($GLOBALS['HTTP_POST_VARS']['new_owner'])); + $info->change_delete_owner(intval($_POST['account_id']), + intval($_POST['new_owner'])); unset($info); ?> diff --git a/infolog/inc/hook_home.inc.php b/infolog/inc/hook_home.inc.php index 357aece842..7f5b407b8d 100644 --- a/infolog/inc/hook_home.inc.php +++ b/infolog/inc/hook_home.inc.php @@ -10,18 +10,18 @@ \**************************************************************************/ /* $Id$ */ - $showevents = intval($GLOBALS['phpgw_info']['user']['preferences']['infolog']['homeShowEvents']); + $showevents = intval($GLOBALS['egw_info']['user']['preferences']['infolog']['homeShowEvents']); if($showevents > 0) { - $save_app = $GLOBALS['phpgw_info']['flags']['currentapp']; - $GLOBALS['phpgw_info']['flags']['currentapp'] = 'infolog'; + $save_app = $GLOBALS['egw_info']['flags']['currentapp']; + $GLOBALS['egw_info']['flags']['currentapp'] = 'infolog'; - $GLOBALS['phpgw']->translation->add_app('infolog'); + $GLOBALS['egw']->translation->add_app('infolog'); - $app_id = $GLOBALS['phpgw']->applications->name2id('infolog'); + $app_id = $GLOBALS['egw']->applications->name2id('infolog'); $GLOBALS['portal_order'][] = $app_id; - $infolog = CreateObject('infolog.uiinfolog'); + $infolog =& CreateObject('infolog.uiinfolog'); switch($showevents) { case 1: @@ -37,14 +37,14 @@ if(!$xslt) // .14/6 { - $portalbox = CreateObject('phpgwapi.listbox',array( + $portalbox =& CreateObject('phpgwapi.listbox',array( 'title' => $title, - 'primary' => $GLOBALS['phpgw_info']['theme']['navbar_bg'], - 'secondary' => $GLOBALS['phpgw_info']['theme']['navbar_bg'], - 'tertiary' => $GLOBALS['phpgw_info']['theme']['navbar_bg'], + 'primary' => $GLOBALS['egw_info']['theme']['navbar_bg'], + 'secondary' => $GLOBALS['egw_info']['theme']['navbar_bg'], + 'tertiary' => $GLOBALS['egw_info']['theme']['navbar_bg'], 'width' => '100%', 'outerborderwidth' => '0', - 'header_background_image' => $GLOBALS['phpgw']->common->image('phpgwapi/templates/default','bg_filler') + 'header_background_image' => $GLOBALS['egw']->common->image('phpgwapi/templates/default','bg_filler') )); foreach(array( 'up' => Array('url' => '/set_box.php', 'app' => $app_id), @@ -63,14 +63,14 @@ } else // HEAD / XSLT { - $GLOBALS['phpgw']->portalbox->set_params(array( + $GLOBALS['egw']->portalbox->set_params(array( 'app_id' => $app_id, 'title' => $title )); - $GLOBALS['phpgw']->portalbox->draw($html); + $GLOBALS['egw']->portalbox->draw($html); } unset($html); - $GLOBALS['phpgw_info']['flags']['currentapp'] = $save_app; + $GLOBALS['egw_info']['flags']['currentapp'] = $save_app; } unset($showevents); ?> diff --git a/infolog/inc/hook_settings.inc.php b/infolog/inc/hook_settings.inc.php index c4b73f29d1..c391bfc43f 100644 --- a/infolog/inc/hook_settings.inc.php +++ b/infolog/inc/hook_settings.inc.php @@ -24,7 +24,7 @@ create_input_box('Max number of entries to display on the main screen','mainscreen_maxshow', 'Only up to this number of entries are displayed on the main screen.','10',3); - $ui = CreateObject('infolog.uiinfolog'); // need some labels from + $ui =& CreateObject('infolog.uiinfolog'); // need some labels from foreach($ui->filters as $key => $label) { $filters[$key] = lang($label); diff --git a/infolog/index.php b/infolog/index.php index 2541e6c27e..0e4bf98fb8 100644 --- a/infolog/index.php +++ b/infolog/index.php @@ -13,16 +13,16 @@ /* $Id$ */ - $GLOBALS['phpgw_info']['flags'] = array( + $GLOBALS['egw_info']['flags'] = array( 'currentapp' => 'infolog', 'noheader' => True, 'nonavbar' => True ); include('../header.inc.php'); - $GLOBALS['phpgw']->redirect_link('/index.php',array( + $GLOBALS['egw']->redirect_link('/index.php',array( 'menuaction' => 'infolog.uiinfolog.index', - 'filter' => $GLOBALS['phpgw_info']['user']['preferences']['infolog']['defaultFilter'] + 'filter' => $GLOBALS['egw_info']['user']['preferences']['infolog']['defaultFilter'] )); - $GLOBALS['phpgw']->common->phpgw_exit(); + $GLOBALS['egw']->common->egw_exit(); ?>