function __construct()
 {
     $GLOBALS['phpgw_info']['flags']['noframework'] = true;
     require_once PHPGW_SERVER_ROOT . '/felamimail/inc/xajax.inc.php';
     $xajax = new xajax($GLOBALS['phpgw']->link('/felamimail/xajax.php', false, true), 'xajax_', 'utf-8');
     $xajax->waitCursorOff();
     $xajax->registerFunction("doXMLHTTP");
     $GLOBALS['phpgw_info']['flags']['java_script'] .= $xajax->getJavascript($GLOBALS['phpgw_info']['server']['webserver_url'] . '/felamimail/js/');
     $GLOBALS['phpgw']->js->validate_file('jsapi', 'jsapi', 'felamimail');
     $this->displayCharset = 'utf-8';
     if (!isset($_POST['composeid']) && !isset($_GET['composeid'])) {
         // create new compose session
         $this->bocompose = CreateObject('felamimail.bocompose', '', $this->displayCharset);
         $this->composeID = $this->bocompose->getComposeID();
     } else {
         // reuse existing compose session
         if (isset($_POST['composeid'])) {
             $this->composeID = $_POST['composeid'];
         } else {
             $this->composeID = $_GET['composeid'];
         }
         $this->bocompose = CreateObject('felamimail.bocompose', $this->composeID, $this->displayCharset);
     }
     $this->t = CreateObject('phpgwapi.Template', PHPGW_APP_TPL);
     $this->bofelamimail = CreateObject('felamimail.bofelamimail', $this->displayCharset);
     $this->mailPreferences = ExecMethod('felamimail.bopreferences.getPreferences');
     $this->t->set_unknowns('remove');
     $this->rowColor[0] = $GLOBALS['phpgw_info']["theme"]["bg01"];
     $this->rowColor[1] = $GLOBALS['phpgw_info']["theme"]["bg02"];
     if (!isset($GLOBALS['phpgw']->css) || !is_object($GLOBALS['phpgw']->css)) {
         $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
     }
     $GLOBALS['phpgw']->css->validate_file('app', 'felamimail');
 }
Esempio n. 2
0
 /**
  * Get the menus for the felamimail
  *
  * @return array available menus for the current user
  */
 function get_menu()
 {
     $preferences = ExecMethod('felamimail.bopreferences.getPreferences');
     $linkData = array('menuaction' => 'felamimail.uicompose.compose');
     $menus = array();
     $menus['navbar'] = array('felamimail' => array('text' => $GLOBALS['phpgw']->translation->translate('Felamimail', array(), true), 'url' => $GLOBALS['phpgw']->link('/felamimail/index.php'), 'image' => array('felamimail', 'navbar'), 'order' => 6, 'group' => 'office'));
     $menus['toolbar'] = array(array('text' => $GLOBALS['phpgw']->translation->translate('New', array(), true), 'url' => $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'felamimail.uicompose.compose'))));
     /*
     	$file = array(
     		array(
     			'text' => '<a class="textSidebox" href="'. htmlspecialchars($GLOBALS['phpgw']->link('/index.php', $linkData)).'" target="_blank" onclick="egw_openWindowCentered(\''.$GLOBALS['phpgw']->link('/index.php', $linkData).'\',\''.lang('compose').'\',700,750); return false;">'.lang('compose'),
                             'no_lang' => true,
                         ),
     
     	);
     */
     if (isset($GLOBALS['phpgw_info']['user']['apps']['admin'])) {
         $menus['admin'] = array(array('text' => $GLOBALS['phpgw']->translation->translate('Site Configuration', array(), true), 'url' => $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'emailadmin.emailadmin_ui.listProfiles'))));
     }
     if (isset($GLOBALS['phpgw_info']['user']['apps']['preferences'])) {
         $menus['preferences'] = array(array('text' => $GLOBALS['phpgw']->translation->translate('Preferences', array(), true), 'url' => $GLOBALS['phpgw']->link('/preferences/preferences.php', array('appname' => 'felamimail'))), array('text' => 'Manage Folders', 'url' => $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'felamimail.uipreferences.listFolder'))));
         if ($preferences && ($preferences->userDefinedAccounts || $preferences->userDefinedIdentities)) {
             $menus['preferences'][] = array('text' => $GLOBALS['phpgw']->translation->translate('Manage eMail: Accounts / Identities', array(), true), 'url' => $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'felamimail.uipreferences.listAccountData')));
         }
         if ($preferences && $preferences->ea_user_defined_signatures) {
             $menus['preferences'][] = array('text' => $GLOBALS['phpgw']->translation->translate('Manage Signatures', array(), true), 'url' => $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'felamimail.uipreferences.listSignatures')));
         }
         $menus['toolbar'][] = array('text' => $GLOBALS['phpgw']->translation->translate('Preferences', array(), true), 'url' => $GLOBALS['phpgw']->link('/preferences/preferences.php', array('appname' => 'felamimail')), 'image' => array('felamimail', 'preferences'));
         $menus['toolbar'][] = array('text' => $GLOBALS['phpgw']->translation->translate('Manage Folders', array(), true), 'url' => $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'felamimail.uipreferences.listFolder')));
     }
     $menus['navigation'] = array(array('text' => $GLOBALS['phpgw']->translation->translate('New', array(), true), 'url' => "javascript:openwindow('" . $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'felamimail.uicompose.compose')) . "','700','600')"));
     if ($preferences) {
         $icServer = $preferences->getIncomingServer(0);
         if (is_a($icServer, 'defaultimap')) {
             if ($icServer->enableSieve) {
                 $menus['navigation'][] = array(array('text' => $GLOBALS['phpgw']->translation->translate('filter rules', array(), true), 'url' => $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'felamimail.uisieve.listRules'))));
                 $menus['navigation'][] = array(array('text' => $GLOBALS['phpgw']->translation->translate('vacation notice', array(), true), 'url' => $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'felamimail.uisieve.editVacation'))));
                 $menus['navigation'][] = array(array('text' => $GLOBALS['phpgw']->translation->translate('email notification', array(), true), 'url' => $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'felamimail.uisieve.editEmailNotification'))));
             }
         }
         $ogServer = $preferences->getOutgoingServer(0);
         if (is_a($ogServer, 'defaultsmtp')) {
             if ($ogServer->editForwardingAddress) {
                 $menus['navigation'][] = array(array('text' => $GLOBALS['phpgw']->translation->translate('Forwarding', array(), true), 'url' => $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'felamimail.uipreferences.editForwardingAddress'))));
             }
         }
     }
     //$menus['folders'] = phpgwapi_menu::get_categories('felamimail');
     return $menus;
 }
 function get_content(&$arguments, $properties)
 {
     $GLOBALS['phpgw_info']['flags']['currentapp'] = 'phpbrain';
     if (isset($_GET['menuaction'])) {
         list($app, $class, $method) = explode('.', @$_GET['menuaction']);
     } else {
         $class = 'uikb';
         $method = 'index';
     }
     $app = 'phpbrain';
     $GLOBALS[$class] = CreateObject(sprintf('%s.%s', $app, $class), $this->find_template_dir(), $this->link(), $arguments);
     if (is_array($GLOBALS[$class]->public_functions) && $GLOBALS[$class]->public_functions[$method]) {
         return ExecMethod($app . '.' . $class . '.' . $method);
     }
 }
    /**
     * Check the consumption  on an order - and notify the coordinator
     * @param integer $order_id
     */
    function notify_coordinator_on_consumption($order_id)
    {
        $notify_coordinator = true;
        if (!$notify_coordinator) {
            return false;
        }
        $toarray = array();
        $workorder = $this->so->read_single($order_id);
        if (!$workorder['continuous']) {
            return false;
        }
        $project = ExecMethod('property.boproject.read_single_mini', $workorder['project_id']);
        $coordinator = $project['coordinator'];
        $prefs_coordinator = $this->bocommon->create_preferences('property', $coordinator);
        if (isset($prefs_coordinator['email']) && $prefs_coordinator['email']) {
            $toarray[] = $prefs_coordinator['email'];
        }
        if ($toarray) {
            $budget_info = $this->so->get_order_budget_percent($order_id);
            if ($budget_info['percent'] < 90) {
                return false;
            }
            if (isset($GLOBALS['phpgw_info']['user']['preferences']['property']['email']) && $GLOBALS['phpgw_info']['user']['preferences']['property']['email']) {
                $from_name = $GLOBALS['phpgw_info']['user']['fullname'];
                $from_email = $GLOBALS['phpgw_info']['user']['preferences']['property']['email'];
            } else {
                $from_name = 'noreply';
                $from_email = "{$from_name}<*****@*****.**>";
            }
            $subject = "Bestilling # {$order_id} har disponert {$budget_info['percent']} prosent av budsjettet";
            $lang_budget = lang('budget');
            $lang_actual_cost = lang('actual cost');
            $lang_percent = lang('percent');
            $lang_obligation = lang('obligation');
            $_budget = number_format($budget_info['budget'], 0, ',', ' ');
            $_actual_cost = number_format($budget_info['actual_cost'], 0, ',', ' ');
            $_budget = number_format($budget_info['budget'], 0, ',', ' ');
            $_obligation = number_format($budget_info['obligation'], 0, ',', ' ');
            $to = implode(';', $toarray);
            $cc = false;
            $bcc = false;
            $body = '<a href ="' . $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'property.uiworkorder.edit', 'id' => $order_id), false, true) . '">' . lang('workorder %1 has been edited', $order_id) . '</a>' . "\n";
            $body .= <<<HTML
\t\t\t\t</br>
\t\t\t\t<h2>{$workorder['title']}</h2>
\t\t\t\t</br>
\t\t\t\t</br>
\t\t\t\t<table>
\t\t\t\t\t<tr>
\t\t\t\t\t\t<td>
\t\t\t\t\t\t\t{$lang_budget}
\t\t\t\t\t\t</td>
\t\t\t\t\t\t<td align = 'right'>
\t\t\t\t\t\t\t{$_budget}
\t\t\t\t\t\t</td>
\t\t\t\t\t</tr>
\t\t\t\t\t<tr>
\t\t\t\t\t\t<td>
\t\t\t\t\t\t\t{$lang_actual_cost}
\t\t\t\t\t\t</td>
\t\t\t\t\t\t<td align = 'right'>
\t\t\t\t\t\t\t{$_actual_cost}
\t\t\t\t\t\t</td>
\t\t\t\t\t</tr>
\t\t\t\t\t<tr>
\t\t\t\t\t\t<td>
\t\t\t\t\t\t\t{$lang_percent}
\t\t\t\t\t\t</td>
\t\t\t\t\t\t<td align = 'right'>
\t\t\t\t\t\t\t{$budget_info['percent']}
\t\t\t\t\t\t</td>
\t\t\t\t\t</tr>
\t\t\t\t\t<tr>
\t\t\t\t\t\t<td>
\t\t\t\t\t\t\t{$lang_obligation}
\t\t\t\t\t\t</td>
\t\t\t\t\t\t<td align = 'right'>
\t\t\t\t\t\t\t{$_obligation}
\t\t\t\t\t\t</td>
\t\t\t\t\t</tr>
\t\t\t\t</table>
HTML;
            if (!is_object($GLOBALS['phpgw']->send)) {
                $GLOBALS['phpgw']->send = CreateObject('phpgwapi.send');
            }
            try {
                $ok = $GLOBALS['phpgw']->send->msg('email', $to, $subject, $body, false, $cc, $bcc, $from_email, $from_name, 'html');
            } catch (phpmailerException $e) {
                phpgwapi_cache::message_set($e->getMessage(), 'error');
            }
            if ($ok) {
                $historylog = CreateObject('property.historylog', 'workorder');
                $historylog->add('ON', $order_id, lang('%1 is notified', $to));
                $historylog->add('RM', $order_id, $subject);
                return true;
            }
        }
    }
 function compose($_focusElement = "to")
 {
     // read the data from session
     // all values are empty for a new compose window
     $sessionData = $this->bocompose->getSessionData();
     $preferences = ExecMethod('felamimail.bopreferences.getPreferences');
     #_debug_array($preferences);
     // is the to address set already?
     if (!empty($GLOBALS['HTTP_GET_VARS']['send_to'])) {
         $sessionData['to'] = base64_decode($_GET['send_to']);
     }
     $this->display_app_header();
     $this->t->set_file(array("composeForm" => "composeForm.tpl"));
     $this->t->set_block('composeForm', 'header', 'header');
     $this->t->set_block('composeForm', 'body_input');
     $this->t->set_block('composeForm', 'attachment', 'attachment');
     $this->t->set_block('composeForm', 'attachment_row', 'attachment_row');
     $this->t->set_block('composeForm', 'attachment_row_bold');
     $this->translate();
     $this->t->set_var("link_addressbook", $GLOBALS['phpgw']->link('/felamimail/addressbook.php'));
     $this->t->set_var("focusElement", $_focusElement);
     $linkData = array('menuaction' => 'felamimail.uifelamimail.viewMainScreen');
     if ($this->mailPreferences['messageNewWindow']) {
         $this->t->set_var("link_message_list", "javascript:window.close();");
     } else {
         $this->t->set_var("link_message_list", $GLOBALS['phpgw']->link('/felamimail/index.php', $linkData));
     }
     $linkData = array('menuaction' => 'felamimail.uicompose.action', 'composeid' => $this->composeID);
     $this->t->set_var("link_action", $GLOBALS['phpgw']->link('/index.php', $linkData));
     $this->t->set_var('folder_name', $this->bofelamimail->sessionData['mailbox']);
     // check for some error messages from last posting attempt
     if ($errorInfo = $this->bocompose->getErrorInfo()) {
         $this->t->set_var('errorInfo', "<font color=\"red\"><b>{$errorInfo}</b></font>");
     } else {
         $this->t->set_var('errorInfo', '&nbsp;');
     }
     // header
     $displayFrom = @htmlentities($preferences['emailAddress'][0][name] . ' <' . $preferences['emailAddress'][0][address] . '>', ENT_QUOTES, $this->displayCharset);
     $this->t->set_var("from", $displayFrom);
     $this->t->set_var("to", @htmlentities($sessionData['to'], ENT_QUOTES, $this->displayCharset));
     $this->t->set_var("cc", @htmlentities($sessionData['cc'], ENT_QUOTES, $this->displayCharset));
     $this->t->set_var("bcc", @htmlentities($sessionData['bcc'], ENT_QUOTES, $this->displayCharset));
     $this->t->set_var("reply_to", @htmlentities($sessionData['reply_to'], ENT_QUOTES, $this->displayCharset));
     $this->t->set_var("subject", @htmlentities($sessionData['subject'], ENT_QUOTES, $this->displayCharset));
     $this->t->set_var('addressbookImage', $GLOBALS['phpgw']->common->image('phpgwapi/templates/phpgw_website', 'users'));
     $this->t->pparse("out", "header");
     // body
     $this->t->set_var("body", $sessionData['body']);
     $this->t->set_var("signature", $sessionData['signature']);
     $this->t->pparse("out", "body_input");
     // attachments
     if (is_array($sessionData['attachments']) && count($sessionData['attachments']) > 0) {
         $this->t->set_var('row_color', $this->rowColor[0]);
         $this->t->set_var('name', lang('name'));
         $this->t->set_var('type', lang('type'));
         $this->t->set_var('size', lang('size'));
         $this->t->parse('attachment_rows', 'attachment_row_bold', True);
         while (list($key, $value) = each($sessionData['attachments'])) {
             #print "$key : $value<br>";
             $this->t->set_var('row_color', $this->rowColor[($key + 1) % 2]);
             $this->t->set_var('name', $value['name']);
             $this->t->set_var('type', $value['type']);
             $this->t->set_var('size', $value['size']);
             $this->t->set_var('attachment_number', $key);
             $this->t->parse('attachment_rows', 'attachment_row', True);
         }
     } else {
         $this->t->set_var('attachment_rows', '');
     }
     $this->t->pparse("out", "attachment");
 }
 /**
  * changes the data from your work-format to the db-format
  *
  * reimplemented to adjust the timezone of the timestamps (subtraction $this->tz_offset_s to get server-time)
  * Please note, we do NOT call the method of the parent so_sql !!!
  *
  * @param array $data if given works on that array and returns result, else works on internal data-array
  * @return array with changed data
  */
 function data2db($data = null)
 {
     if ($intern = !is_array($data)) {
         $data =& $this->data;
     }
     foreach ($this->timestamps as $name) {
         if (isset($data[$name]) && $data[$name]) {
             $data[$name] -= $this->tz_offset_s;
         }
     }
     if ($data['cp_trainer'] && is_array($data['cp_trainer'])) {
         $data['cp_trainer'] = implode(',', $data['cp_trainer']);
     }
     if ($data['cp_defect_cleared'] && is_array($data['cp_defect_cleared'])) {
         $data['cp_defect_cleared'] = implode(',', $data['cp_defect_cleared']);
     }
     if ($data['cp_events'] && is_array($data['cp_events'])) {
         $data['cp_events'] = implode(',', $data['cp_events']);
     }
     if ($data['cal_id'] && ($event = ExecMethod('calendar.calendar_bo.read', $data['cal_id']))) {
         $data['cp_date'] = $event['start'];
     }
     return $data;
 }
 function editAccountData()
 {
     $boPreferences =& CreateObject('felamimail.bopreferences');
     $preferences =& $boPreferences->getPreferences();
     if (!($preferences->userDefinedAccounts || $preferences->userDefinedIdentities)) {
         die('you are not allowed to be here');
     }
     if ($_POST['save'] || $_POST['apply']) {
         // IMAP connection settings
         $icServer =& CreateObject('emailadmin.defaultimap');
         if (is_array($_POST['ic'])) {
             foreach ($_POST['ic'] as $key => $value) {
                 switch ($key) {
                     case 'validatecert':
                         $icServer->{$key} = $value != 'dontvalidate';
                         break;
                     case 'enableSieve':
                         $icServer->{$key} = $value == 'enableSieve';
                         break;
                     default:
                         $icServer->{$key} = $value;
                         break;
                 }
             }
         } else {
             $icServer = NULL;
         }
         // SMTP connection settings
         $ogServer =& CreateObject('emailadmin.defaultsmtp');
         if (is_array($_POST['og'])) {
             foreach ($_POST['og'] as $key => $value) {
                 $ogServer->{$key} = $value;
             }
         } else {
             $ogServer = NULL;
         }
         // identity settings
         $identity =& CreateObject('emailadmin.ea_identity');
         if (is_array($_POST['identity'])) {
             foreach ($_POST['identity'] as $key => $value) {
                 $identity->{$key} = $value;
             }
         }
         $newID = $boPreferences->saveAccountData($icServer, $ogServer, $identity);
         if ($identity->id == 'new') {
             $identity->id = $newID;
         }
         if ((int) $_POST['active']) {
             #$boPreferences->saveAccountData($icServer, $ogServer, $identity);
             $boPreferences->setProfileActive(false);
             $boPreferences->setProfileActive(true, $identity->id);
         } else {
             $boPreferences->setProfileActive(false, $identity->id);
         }
         if ($_POST['save']) {
             ExecMethod('felamimail.uifelamimail.viewMainScreen');
             return;
         }
     } elseif ($_POST['cancel']) {
         ExecMethod('felamimail.uifelamimail.viewMainScreen');
         return;
     }
     $this->display_app_header(TRUE);
     $this->t->set_root(PHPGW_APP_TPL);
     $this->t->set_file(array("body" => "edit_account_data.tpl"));
     $this->t->set_block('body', 'main');
     $this->translate();
     // if there is no accountID with the call of the edit method, retrieve an active account
     $account2retrieve = 'active';
     if ((int) $_GET['accountID']) {
         $account2retrieve = $_GET['accountID'];
     }
     if ($_GET['accountID'] == 'new') {
         $account2retrieve = 'new';
     }
     if (!empty($newID) && $newID > 0) {
         $account2retrieve = $newID;
     }
     if ($account2retrieve != 'new') {
         $accountData = $boPreferences->getAccountData($preferences, $account2retrieve);
     }
     $icServer =& $accountData['icServer'];
     $ogServer =& $accountData['ogServer'];
     $identity =& $accountData['identity'];
     #_debug_array($identity);
     if ($icServer) {
         foreach ($icServer as $key => $value) {
             if (is_object($value) || is_array($value)) {
                 continue;
             }
             switch ($key) {
                 case 'encryption':
                     $this->t->set_var('checked_ic_' . $key . '_' . $value, 'checked');
                     break;
                 case 'enableSieve':
                     $this->t->set_var('checked_ic_' . $key, $value ? 'checked' : '');
                     break;
                 case 'validatecert':
                     $this->t->set_var('checked_ic_' . $key, $value ? '' : 'checked');
                     break;
                 default:
                     $this->t->set_var("ic[{$key}]", $value);
                     break;
             }
         }
     }
     if ($ogServer) {
         foreach ($ogServer as $key => $value) {
             if (is_object($value) || is_array($value)) {
                 continue;
             }
             #print "$key => $value<bR>";
             switch ($key) {
                 case 'smtpAuth':
                     $this->t->set_var('checked_og_' . $key, $value ? 'checked' : '');
                 default:
                     $this->t->set_var("og[{$key}]", $value);
             }
         }
     }
     $felamimail_bosignatures = new felamimail_bosignatures();
     $signatures = $felamimail_bosignatures->getListOfSignatures();
     $allSignatures = array('-2' => lang('no signature'));
     foreach ($signatures as $sigkey => $sig) {
         $allSignatures[$sig['fm_signatureid']] = $sig['fm_description'];
     }
     $sigvalue = -2;
     if ($identity) {
         foreach ($identity as $key => $value) {
             if (is_object($value) || is_array($value)) {
                 continue;
             }
             switch ($key) {
                 case 'signature':
                     $sigvalue = $value;
                     break;
                 default:
                     $this->t->set_var("identity[{$key}]", $value);
             }
         }
         $this->t->set_var('accountID', $identity->id);
         $this->t->set_var('checked_active', $accountData['active'] ? $preferences->userDefinedAccounts ? 'checked' : '' : '');
     } else {
         if ($signatureData = $felamimail_bosignatures->getDefaultSignature()) {
             if (is_array($signatureData)) {
                 $sigvalue = $signatureData['signatureid'];
             } else {
                 $sigvalue = $signatureData;
             }
         }
         $this->t->set_var('accountID', 'new');
     }
     $this->t->set_var('allowAccounts', $preferences->userDefinedAccounts ? 1 : 0);
     $this->t->set_var('identity_selectbox', html::select('identity[signature]', $sigvalue, $allSignatures, true, "style='width: 250px;'"));
     $linkData = array('menuaction' => 'felamimail.uipreferences.editAccountData');
     $this->t->set_var('form_action', $GLOBALS['phpgw']->link('/index.php', $linkData));
     $this->t->parse("out", "main");
     print $this->t->get('out', 'main');
 }
 function edit($content = '', $msg = '')
 {
     if (isset($_GET['app'])) {
         $this->app = $_GET['app'];
     }
     if (is_array($content)) {
         if ($this->debug) {
             echo "content =";
             _debug_array($content);
         }
         $this->app = $content['app'];
         // this is what the user selected
         $this->table = $content['table_name'];
         $posted_app = $content['posted_app'];
         // this is the old selection
         $posted_table = $content['posted_table'];
     }
     if ($posted_app && $posted_table && ($posted_app != $this->app || $posted_table != $this->table)) {
         if ($this->needs_save('', $posted_app, $posted_table, $this->content2table($content))) {
             return;
         }
         $this->renames = array();
     }
     if (!$this->app) {
         $this->table = '';
         $table_names = array('' => lang('none'));
     } else {
         $this->read($this->app, $this->data);
         foreach ($this->data as $name => $table) {
             $table_names[$name] = $name;
         }
     }
     if (!$this->table || $this->app != $posted_app) {
         reset($this->data);
         list($this->table) = each($this->data);
         // use first table
     } elseif ($this->app == $posted_app && $posted_table) {
         $this->data[$posted_table] = $this->content2table($content);
     }
     if ($content['write_tables']) {
         if ($this->needs_save('', $this->app, $this->table, $this->data[$posted_table])) {
             return;
         }
         $msg .= lang('Table unchanged, no write necessary !!!');
     } elseif ($content['delete']) {
         list($col) = each($content['delete']);
         @reset($this->data[$posted_table]['fd']);
         while ($col-- > 0 && (list($key, $data) = @each($this->data[$posted_table]['fd']))) {
         }
         unset($this->data[$posted_table]['fd'][$key]);
         $this->changes[$posted_table][$key] = '**deleted**';
     } elseif ($content['add_column']) {
         $this->data[$posted_table]['fd'][''] = array();
     } elseif ($content['add_table'] || $content['import']) {
         if (!$this->app) {
             $msg .= lang('Select an app first !!!');
         } elseif (!$content['new_table_name']) {
             $msg .= lang('Please enter table-name first !!!');
         } elseif ($content['add_table']) {
             $this->table = $content['new_table_name'];
             $this->data[$this->table] = array('fd' => array(), 'pk' => array(), 'ix' => array(), 'uc' => array(), 'fk' => array());
             $msg .= lang('New table created');
         } else {
             $oProc = CreateObject('phpgwapi.schema_proc', $GLOBALS['phpgw_info']['server']['db_type']);
             $oProc->m_odb = $GLOBALS['phpgw']->db;
             $oProc->m_oTranslator->_GetColumns($oProc, $content['new_table_name'], $nul);
             while (list($key, $tbldata) = each($oProc->m_oTranslator->sCol)) {
                 $cols .= $tbldata;
             }
             eval('$cols = array(' . $cols . ');');
             $this->data[$this->table = $content['new_table_name']] = array('fd' => $cols, 'pk' => $oProc->m_oTranslator->pk, 'fk' => $oProc->m_oTranslator->fk, 'ix' => $oProc->m_oTranslator->ix, 'uc' => $oProc->m_oTranslator->uc);
         }
     } elseif ($content['editor']) {
         ExecMethod('etemplate.editor.edit');
         return;
     }
     $add_index = isset($content['add_index']);
     // from here on, filling new content for eTemplate
     $content = array('msg' => $msg, 'table_name' => $this->table, 'app' => $this->app);
     if (!isset($table_names[$this->table])) {
         $table_names[$this->table] = $this->table;
     }
     $sel_options = array('table_name' => $table_names, 'type' => $this->types);
     if ($this->table != '' && isset($this->data[$this->table])) {
         $content += $this->table2content($this->data[$this->table], $sel_options['Index'], $add_index);
     }
     $no_button = array();
     if (!$this->app || !$this->table) {
         $no_button += array('write_tables' => True);
     }
     if ($this->debug) {
         echo 'editor.edit: content =';
         _debug_array($content);
     }
     $this->editor->exec('etemplate.db_tools.edit', $content, $sel_options, $no_button, array('posted_table' => $this->table, 'posted_app' => $this->app, 'changes' => $this->changes));
 }
 function deleteMessage()
 {
     $preferences = ExecMethod('felamimail.bopreferences.getPreferences');
     $message[] = $_GET["message"];
     $mailfolder = NULL;
     if (!empty($_GET['folder'])) {
         $mailfolder = base64_decode($_GET['folder']);
     }
     $this->bofelamimail->deleteMessages($message, $mailfolder);
     // set the url to open when refreshing
     $linkData = array('menuaction' => 'felamimail.uifelamimail.viewMainScreen');
     $refreshURL = $GLOBALS['phpgw']->link('/index.php', $linkData);
     print "<script type=\"text/javascript\">\n\t\t\topener.location.href = '" . $refreshURL . "';\n\t\t\twindow.close();</script>";
 }
 function delete($data)
 {
     return ExecMethod($this->svc . '.' . $this->function_map['delete']['function'], $data);
 }
 function process_edit($content)
 {
     if ($this->debug) {
         echo "editor.process_edit: content =";
         _debug_array($content);
     }
     $this->extensions = $content['**extensions**'];
     unset($content['**extensions**']);
     $this->etemplate->init($content);
     $opts = array();
     reset($this->options);
     while (list(, $opt) = each($this->options)) {
         $opts[$opt] = $content['options'][$opt];
     }
     $this->etemplate->size = ereg_replace(',*$', '', implode(',', $opts));
     $this->etemplate->style = $content['style'];
     $names = array('width', 'height', 'class');
     $opts = array();
     while (list(, $opt) = each($names)) {
         if (is_array($content[$opt])) {
             $opts += $content[$opt];
         }
     }
     $this->etemplate->data = array($opts);
     $row = 1;
     $col = 0;
     while (isset($content[$name = $this->etemplate->num2chrs($col) . $row])) {
         $cell =& $content[$name];
         switch ($cell['type']) {
             case 'vbox':
             case 'hbox':
             case 'deck':
                 if ($cell['size'] < 2) {
                     $cell['size'] = 2;
                 }
                 for ($n = 1; $n <= $cell['size']; ++$n) {
                     if (!isset($cell[$n]) || !is_array($cell[$n])) {
                         $cell[$n] = $this->etemplate->empty_cell();
                     }
                 }
                 while (isset($cell[$n])) {
                     unset($cell[$n++]);
                 }
                 break;
         }
         $row_data[$this->etemplate->num2chrs($col++)] = $cell;
         if (!isset($content[$name = $this->etemplate->num2chrs($col) . $row])) {
             if ($col > $cols) {
                 $cols = $col;
             }
             $this->etemplate->data[$row] = $row_data;
             ++$row;
             $col = 0;
             $row_data = array();
         }
     }
     $this->etemplate->rows = $row - 1;
     $this->etemplate->cols = $cols;
     if (isset($content['insert_row'])) {
         list($row) = each($content['insert_row']);
         $opts = $this->etemplate->data[0];
         // move height + class options of rows
         for ($r = $this->etemplate->rows; $r > $row; --$r) {
             $opts['c' . (1 + $r)] = $opts["c{$r}"];
             unset($opts["c{$r}"]);
             $opts['h' . (1 + $r)] = $opts["h{$r}"];
             unset($opts["h{$r}"]);
         }
         $this->etemplate->data[0] = $opts;
         $old = $this->etemplate->data;
         // move rows itself
         $row_data = array();
         for ($col = 0; $col < $this->etemplate->cols; ++$col) {
             $row_data[$this->etemplate->num2chrs($col)] = $this->etemplate->empty_cell();
         }
         $this->etemplate->data[++$row] = $row_data;
         for (; $row <= $this->etemplate->rows; ++$row) {
             $this->etemplate->data[1 + $row] = $old[$row];
         }
         ++$this->etemplate->rows;
     } elseif (isset($content['insert_col'])) {
         list($insert_col) = each($content['insert_col']);
         for ($row = 1; $row <= $this->etemplate->rows; ++$row) {
             $old = $row_data = $this->etemplate->data[$row];
             $row_data[$this->etemplate->num2chrs($insert_col)] = $this->etemplate->empty_cell();
             for ($col = $insert_col; $col < $this->etemplate->cols; ++$col) {
                 $row_data[$this->etemplate->num2chrs(1 + $col)] = $old[$this->etemplate->num2chrs($col)];
             }
             $this->etemplate->data[$row] = $row_data;
         }
         $width = $this->etemplate->data[0];
         for ($col = $this->etemplate->cols; $col > $insert_col; --$col) {
             $width[$this->etemplate->num2chrs($col)] = $width[$this->etemplate->num2chrs($col - 1)];
         }
         unset($width[$this->etemplate->num2chrs($insert_col)]);
         $this->etemplate->data[0] = $width;
         ++$this->etemplate->cols;
     } elseif (isset($content['exchange_col'])) {
         list($exchange_col) = each($content['exchange_col']);
         $right = $this->etemplate->num2chrs($exchange_col - 1);
         $left = $this->etemplate->num2chrs($exchange_col - 2);
         for ($row = 1; $row <= $this->etemplate->rows; ++$row) {
             $this->swap($this->etemplate->data[$row][$left], $this->etemplate->data[$row][$right]);
         }
         $this->swap($this->etemplate->data[0][$left], $this->etemplate->data[0][$right]);
     } elseif (isset($content['exchange_row'])) {
         list($er2) = each($content['exchange_row']);
         $er1 = $er2 - 1;
         $this->swap($this->etemplate->data[$er1], $this->etemplate->data[$er2]);
         $this->swap($this->etemplate->data[0]["c{$er1}"], $this->etemplate->data[0]["c{$er2}"]);
         $this->swap($this->etemplate->data[0]["h{$er1}"], $this->etemplate->data[0]["h{$er2}"]);
     } elseif (isset($content['delete_row'])) {
         list($delete_row) = each($content['delete_row']);
         $opts = $this->etemplate->data[0];
         for ($row = $delete_row; $row < $this->etemplate->rows; ++$row) {
             $this->etemplate->data[$row] = $this->etemplate->data[1 + $row];
             $opts["c{$row}"] = $opts['c' . (1 + $row)];
             $opts["h{$row}"] = $opts['h' . (1 + $row)];
         }
         unset($this->etemplate->data[$this->etemplate->rows--]);
         $this->etemplate->data[0] = $opts;
     } elseif (isset($content['delete_col'])) {
         list($delete_col) = each($content['delete_col']);
         for ($row = 1; $row <= $this->etemplate->rows; ++$row) {
             $row_data = $this->etemplate->data[$row];
             for ($col = $delete_col; $col < $this->etemplate->cols; ++$col) {
                 $row_data[$this->etemplate->num2chrs($col - 1)] = $row_data[$this->etemplate->num2chrs($col)];
             }
             unset($row_data[$this->etemplate->num2chrs($this->etemplate->cols - 1)]);
             $this->etemplate->data[$row] = $row_data;
         }
         $width = $this->etemplate->data[0];
         for ($col = $delete_col; $col < $this->etemplate->cols; ++$col) {
             $width[$this->etemplate->num2chrs($col - 1)] = $width[$this->etemplate->num2chrs($col)];
         }
         $this->etemplate->data[0] = $width;
         --$this->etemplate->cols;
     }
     if ($this->debug) {
         echo 'editor.process_edit: rows=' . $this->etemplate->rows . ', cols=' . $this->etemplate->cols . ', data =';
         _debug_array($this->etemplate->data);
     }
     // Execute the action resulting from the submit-button
     if ($content['read']) {
         if ($content['version'] != '') {
             $save_version = $content['version'];
             unset($content['version']);
             $this->etemplate->read($content);
             $newest_version = $this->etemplate->version;
             $content['version'] = $save_version;
         }
         if (!$this->etemplate->read($content)) {
             $content['version'] = '';
             // trying it without version
             if ($this->etemplate->read($content)) {
                 $msg = lang('only an other Version found !!!');
             } else {
                 $result = $this->etemplate->search($content);
                 if (count($result) > 1) {
                     return $this->list_result(array('result' => $result));
                 } elseif (!count($result) || !$this->etemplate->read($result[0])) {
                     $msg = lang('Error: Template not found !!!');
                 } elseif ($content['name'] == $result[0]['name']) {
                     $msg = lang('only an other Version found !!!');
                 }
             }
         } elseif ($newest_version != '' && $this->etemplate->version != $newest_version) {
             $msg = lang("newer version '%1' exists !!!", $newest_version);
         }
     } elseif ($content['delete']) {
         $this->delete();
         return;
     } elseif ($content['dump']) {
         list($name) = explode('.', $content['name']);
         if (empty($name) || !@is_dir(PHPGW_SERVER_ROOT . '/' . $name)) {
             $msg = lang('Application name needed to write a langfile or dump the eTemplates !!!');
         } else {
             $msg = $this->etemplate->dump2setup($content['name']);
         }
     } elseif ($content['save']) {
         if (!$this->etemplate->modified_set || !$this->etemplate->modified) {
             $this->etemplate->modified = time();
         }
         $ok = $this->etemplate->save(trim($content['name']), trim($content['template']), trim($content['lang']), intval($content['group']), trim($content['version']));
         $msg = $ok ? lang('Template saved') : lang('Error: while saveing !!!');
     } elseif ($content['show']) {
         $this->show();
         return;
     } elseif ($content['langfile']) {
         list($name) = explode('.', $content['name']);
         if (empty($name) || !@is_dir(PHPGW_SERVER_ROOT . '/' . $name)) {
             $msg = lang('Application name needed to write a langfile or dump the eTemplates !!!');
         } else {
             $additional = array();
             if ($name == 'etemplate') {
                 $additional = $this->etemplate->types + $this->extensions + $this->aligns;
             } else {
                 $ui = @CreateObject($name . '.' . ($class = 'ui' . $name));
                 if (!is_object($ui)) {
                     $ui = @CreateObject($name . '.' . ($class = 'ui'));
                 }
                 if (!is_object($ui)) {
                     $ui = @CreateObject($name . '.' . ($class = $name));
                 }
                 if (is_object($ui) && @$ui->public_functions['writeLangFile']) {
                     $msg = "{$class}::writeLangFile: " . $ui->writeLangFile();
                 }
                 unset($ui);
             }
             if (empty($msg)) {
                 $msg = $this->etemplate->writeLangFile($name, 'en', $additional);
             }
         }
     } elseif ($content['export_xml']) {
         $msg = $this->export_xml();
     } elseif ($content['import_xml']) {
         $msg = $this->import_xml($content['file']['tmp_name']);
     } elseif ($content['db_tools']) {
         ExecMethod('etemplate.db_tools.edit');
         return;
     }
     $this->edit($msg);
 }
 function create_tabs($tabs, $selected, $fontsize = '')
 {
     $output_text = '<table border="0" cellspacing="0" cellpadding="0"><tr>';
     /* This is a php3 workaround */
     if (PHPGW_IMAGES_DIR == 'PHPGW_IMAGES_DIR') {
         $ir = ExecMethod('phpgwapi.phpgw.common.get_image_path', 'phpgwapi');
     } else {
         $ir = PHPGW_IMAGES_DIR;
     }
     if ($fontsize) {
         $fs = '<font size="' . $fontsize . '">';
         $fse = '</font>';
     }
     $i = 1;
     while ($tab = each($tabs)) {
         if ($tab[0] == $selected) {
             if ($i == 1) {
                 $output_text .= '<td align="right"><img src="' . $ir . '/tabs-start1.gif"></td>';
             }
             $output_text .= '<td align="left" background="' . $ir . '/tabs-bg1.gif">&nbsp;<b><a href="' . $tab[1]['link'] . '" class="tablink" ' . $tab[1]['target'] . '>' . $fs . $tab[1]['label'] . $fse . '</a></b>&nbsp;</td>';
             if ($i == count($tabs)) {
                 $output_text .= '<td align="left"><img src="' . $ir . '/tabs-end1.gif"></td>';
             } else {
                 $output_text .= '<td align="left"><img src="' . $ir . '/tabs-sepr.gif"></td>';
             }
         } else {
             if ($i == 1) {
                 $output_text .= '<td align="right"><img src="' . $ir . '/tabs-start0.gif"></td>';
             }
             $output_text .= '<td align="left" background="' . $ir . '/tabs-bg0.gif">&nbsp;<b><a href="' . $tab[1]['link'] . '" class="tablink" ' . $tab[1]['target'] . '>' . $fs . $tab[1]['label'] . $fse . '</a></b>&nbsp;</td>';
             if ($i + 1 == $selected) {
                 $output_text .= '<td align="left"><img src="' . $ir . '/tabs-sepl.gif"></td>';
             } elseif ($i == $selected || $i != count($tabs)) {
                 $output_text .= '<td align="left"><img src="' . $ir . '/tabs-sepm.gif"></td>';
             } elseif ($i == count($tabs)) {
                 if ($i == $selected) {
                     $output_text .= '<td align="left"><img src="' . $ir . '/tabs-end1.gif"></td>';
                 } else {
                     $output_text .= '<td align="left"><img src="' . $ir . '/tabs-end0.gif"></td>';
                 }
             } else {
                 if ($i != count($tabs)) {
                     $output_text .= '<td align="left"><img src="' . $ir . '/tabs-sepr.gif"></td>';
                 }
             }
         }
         $i++;
         $output_text .= "\n";
     }
     $output_text .= "</table>\n";
     return $output_text;
 }
 function export($data)
 {
     return ExecMethod($this->svc . '.' . $this->function_map['export_event']['function'], $data);
 }
Esempio n. 14
0
 function manager()
 {
     $alarm = phpgw::get_var('alarm', 'int', 'POST');
     if (phpgw::get_var('delete', 'bool', 'POST') && is_array($alarm) && count($alarm)) {
         if ($this->bo->delete($alarm) < 0) {
             echo '<div class="err">' . lang('You do not have permission to delete this alarm !!!') . '</div>';
             $GLOBALS['phpgw']->common->phpgw_exit(True);
         }
     }
     $enable = phpgw::get_var('enable', 'bool', 'POST');
     $disable = phpgw::get_var('disable', 'bool', 'POST');
     if (($enable || $disable) && count($alarm)) {
         if ($this->bo->enable($alarm, $enable) < 0) {
             echo '<div class="err">' . lang('You do not have permission to enable/disable this alarm !!!') . '</div>';
             $GLOBALS['phpgw']->common->phpgw_exit(True);
         }
     }
     $this->prep_page();
     if (phpgw::get_var('add', 'bool', 'POST')) {
         $post_time = phpgw::get_var('time', 'int', 'POST');
         $time = $post_time['days'] * phpgwapi_datetime::SECONDS_IN_DAY + $post_time['hours'] * phpgwapi_datetime::SECONDS_IN_HOUR + $post_time['minutes'] * 60;
         if ($time > 0 && !$this->bo->add($this->event, $time, phpgw::get_var('owner', 'int', 'POST'))) {
             echo '<div class="err">' . lang('You do not have permission to add alarms to this event !!!') . '</div';
             $GLOBALS['phpgw']->common->phpgw_exit(True);
         }
     }
     if (!ExecMethod('calendar.uicalendar.view_event', $this->event)) {
         echo '<center>' . lang('You do not have permission to read this record!') . '</center>';
         $GLOBALS['phpgw']->common->phpgw_exit(True);
     }
     $GLOBALS['phpgw']->template->set_var('th_bg', $this->theme['th_bg']);
     $GLOBALS['phpgw']->template->set_var('hr_text', lang('Alarms') . ':');
     $GLOBALS['phpgw']->template->fp('row', 'hr', True);
     $GLOBALS['phpgw']->template->pfp('phpgw_body', 'view_event');
     $var = array('action_url' => $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'calendar.uialarm.manager')), 'hidden_vars' => $this->html->input_hidden('cal_id', $this->bo->cal_id), 'lang_select' => lang('Select'), 'lang_time' => lang('Time'), 'lang_text' => lang('Text'), 'lang_owner' => lang('Owner'), 'lang_enabled' => lang('enabled'), 'lang_disabled' => lang('disabled'), 'lang_enabled' => lang('enabled'), 'lang_disabled' => lang('disabled'));
     if ($this->event['alarm']) {
         $this->output_template_array('rows', 'alarm_headers', $var);
         $to_delete = '';
         foreach ($this->event['alarm'] as $key => $alarm) {
             if (!$this->bo->check_perms(PHPGW_ACL_READALARM, $alarm['owner'])) {
                 continue;
             }
             $var = array('field' => $GLOBALS['phpgw']->common->show_date($alarm['time']), 'data' => 'Email Notification', 'owner' => $GLOBALS['phpgw']->common->grab_owner_name($alarm['owner']), 'enabled' => $alarm['enabled'] ? '<img src="' . $GLOBALS['phpgw']->common->image('calendar', 'enabled.png') . '" width="13" height="13" title="' . lang('enabled') . '">' : '<img src="' . $GLOBALS['phpgw']->common->image('calendar', 'disabled.png') . '" width="13" height="13" title="' . lang('disabled') . '">', 'select' => '<input type="checkbox" name="alarm[' . $alarm['id'] . ']">');
             if ($this->bo->check_perms(PHPGW_ACL_DELETEALARM, $alarm['owner'])) {
                 ++$to_delete;
             }
             $this->output_template_array('rows', 'list', $var);
         }
         $this->template->set_var('enable_button', $this->html->submit_button('enable', 'Enable'));
         $this->template->set_var('disable_button', $this->html->submit_button('disable', 'Disable'));
         if ($to_delete) {
             $this->template->set_var('delete_button', $this->html->submit_button('delete', 'Delete', "return confirm('" . lang("Are you sure\\nyou want to\\ndelete these alarms?") . "')"));
         }
         $this->template->parse('rows', 'buttons', True);
     }
     if (isset($this->event['participants'][intval($GLOBALS['phpgw_info']['user']['person_id'])])) {
         $time = phpgw::get_var('time', 'int', 'POST');
         $this->template->set_var(array('hidden_vars' => $this->html->input_hidden('cal_id', $this->bo->cal_id), 'input_text' => lang('Email reminder'), 'input_days' => $this->html->select('time[days]', isset($time['days']) ? $time['days'] : 0, range(0, 31), True) . ' ' . lang('days'), 'input_hours' => $this->html->select('time[hours]', isset($time['hours']) ? $time['hours'] : 0, range(0, 24), True) . ' ' . lang('hours'), 'input_minutes' => $this->html->select('time[mins]', isset($time['mins']) ? $time['mins'] : 0, range(0, 60), True) . ' ' . lang('minutes') . ' ' . lang('before the event'), 'input_owner' => $this->html->select('owner', $GLOBALS['phpgw_info']['user']['account_id'], $this->bo->participants($this->event, True), True), 'input_add' => $this->html->submit_button('add', 'Add Alarm')));
     }
     //echo "<p>alarm_management='".htmlspecialchars($this->template->get_var('alarm_management'))."'</p>\n";
     $this->template->pfp('out', 'alarm_management');
 }
Esempio n. 15
0
<?php

/**************************************************************************\
  * eGroupWare - Polls                                                       *
  * http://www.egroupware.org                                                *
  * Copyright (c) 1999 Till Gerken (tig@skv.org)                             *
  * Modified by Greg Haygood (shrykedude@bellsouth.net)                      *
  * -----------------------------------------------                          *
  *  This program is free software; you can redistribute it and/or modify it *
  *  under the terms of the GNU General Public License as published by the   *
  *  Free Software Foundation; either version 2 of the License, or (at your  *
  *  option) any later version.                                              *
  \**************************************************************************/
/* $Id: index.php,v 1.9 2004/01/10 02:18:08 shrykedude Exp $ */
$GLOBALS['phpgw_info'] = array();
$GLOBALS['phpgw_info']['flags'] = array('currentapp' => 'polls', 'noheader' => True, 'nonavbar' => True, 'enable_nextmatchs_class' => True);
include '../header.inc.php';
ExecMethod('polls.ui.index');
$GLOBALS['phpgw']->common->phpgw_footer();
 function title($app, $id, $link = '')
 {
     if ($this->debug) {
         echo "<p>bolink::title('{$app}','{$id}')</p>\n";
     }
     if ($app == $this->vfs_appname) {
         if (is_array($id) && $link) {
             $link = $id;
             $id = $link['name'];
         }
         if (is_array($link)) {
             $size = $link['size'];
             if ($size_k = intval($size / 1024)) {
                 if (intval($size_k / 1024)) {
                     $size = sprintf('%3.1dM', doubleval($size_k) / 1024.0);
                 } else {
                     $size = $size_k . 'k';
                 }
             }
             $extra = ': ' . $link['type'] . ' ' . $size;
         }
         return $id . $extra;
     }
     if ($app == '' || !is_array($reg = $this->app_register[$app]) || !isset($reg['title'])) {
         return array();
     }
     $method = $reg['title'];
     $title = strchr($method, '.') ? ExecMethod($method, $id) : $this->{$method}($id);
     if ($id && !$title) {
         $this->unlink(0, $app, $id);
         return False;
     }
     return $title;
 }
/**************************************************************************\
	* eGroupWare - Calendar Preferences                                        *
	* http://www.egroupware.org                                                *
	* Based on Webcalendar by Craig Knudsen <*****@*****.**>               *
	*          http://www.radix.net/~cknudsen                                  *
	* Modified by Mark Peters <*****@*****.**>                       *
	* Modified by Ralf Becker <*****@*****.**>                 *
	* --------------------------------------------                             *
	*  This program is free software; you can redistribute it and/or modify it *
	*  under the terms of the GNU General Public License as published by the   *
	*  Free Software Foundation; either version 2 of the License, or (at your  *
	*  option) any later version.                                              *
	\**************************************************************************/
/* $Id: hook_settings.inc.php,v 1.8 2004/04/14 12:35:34 ralfbecker Exp $ */
ExecMethod('calendar.bocalendar.check_set_default_prefs');
$default = array('day' => lang('Daily'), 'week' => lang('Weekly'), 'month' => lang('Monthly'), 'year' => lang('Yearly'), 'planner_cat' => lang('Planner by category'), 'planner_user' => lang('Planner by user'));
create_select_box('default calendar view', 'defaultcalendar', $default, 'Which of calendar view do you want to see, when you start calendar ?');
/* Selection of list for home page is different from default calendar,
   since the decision for the front page is different for the decision
   for the main calendar page.  But the list could be added to the
   default list above, if requested.  - shrykedude. */
$mainpage = array('1' => lang('Yes'), '0' => lang('No'), '2' => lang('No') . ' - ' . lang('show list of upcoming events'));
create_select_box('show default view on main screen', 'mainscreen_showevents', $mainpage, 'Displays your default calendar view on the startpage (page you get when you enter eGroupWare or click on the homepage icon)?');
unset($mainpage);
/*
	$summary = array(
		'no'     => lang('Never'),
		'daily'  => lang('Daily'),
		'weekly' => lang('Weekly')
	);
$d1 = strtolower(substr(PHPGW_APP_INC, 0, 3));
if ($d1 == 'htt' || $d1 == 'ftp') {
    echo 'Failed attempt to break in via an old Security Hole!<br>' . "\n";
    $GLOBALS['phpgw']->common->phpgw_exit();
}
unset($d1);
$today = $GLOBALS['phpgw']->datetime->users_localtime;
$dates = array($today);
$wday = date('w', $today);
if ($wday == '5') {
    $dates[] = $today + 86400;
    // Saturday
    $dates[] = $today + 2 * 86400;
    // Sunday
}
if ($wday == '6') {
    $dates[] = $today + 86400;
    // Sunday
}
$dates[] = $dates[count($dates) - 1] + 86400;
// the next business day
$extra_data = $GLOBALS['css'] . "\n" . '<table border="0" width="100%" cellspacing="0" cellpadding="1">' . '<tr><td valign="top" width="100%">';
foreach ($dates as $id => $day) {
    $dayprint = ExecMethod('calendar.uicalendar.print_day', array('year' => date('Y', $day), 'month' => date('m', $day), 'day' => date('d', $day)));
    $extra_data .= '<font class="event-off" style="font-weight: bold">&nbsp;&nbsp&nbsp;' . lang(date('l', $day)) . '</font><br />' . $dayprint;
}
$extra_data .= '</td></tr></table>' . "\n";
$GLOBALS['extra_data'] = $extra_data;
unset($dates);
unset($today);
unset($extra_data);
 function deleteMessage()
 {
     $preferences = ExecMethod('felamimail.bopreferences.getPreferences');
     $message[] = $GLOBALS['HTTP_GET_VARS']["message"];
     $this->bofelamimail->deleteMessages($message);
     // set the url to open when refreshing
     $linkData = array('menuaction' => 'felamimail.uifelamimail.viewMainScreen');
     $refreshURL = $GLOBALS['phpgw']->link('/index.php', $linkData);
     if ($preferences['messageNewWindow']) {
         print "<script type=\"text/javascript\">\n\t\t\t\topener.location.href = '" . $refreshURL . "';\n\t\t\t\twindow.close();</script>";
     } else {
         $this->viewMainScreen();
     }
 }
 function single($args, $appname = '', $no_permission_check = False, $try_unregistered = False)
 {
     //echo "<p>hooks::single("; print_r($args); echo ",'$appname','$no_permission_check','$try_unregistered')</p>\n";
     if (is_array($args)) {
         $location = $args['location'];
     } else {
         $location = $args;
     }
     if (!$appname) {
         $appname = is_array($args) && isset($args['appname']) ? $args['appname'] : $GLOBALS['phpgw_info']['flags']['currentapp'];
     }
     $SEP = filesystem_separator();
     /* First include the ordered apps hook file */
     if (isset($this->found_hooks[$appname][$location]) || $try_unregistered) {
         $parts = explode('.', $method = $this->found_hooks[$appname][$location]);
         if (count($parts) != 3 || $parts[1] == 'inc' && $parts[2] == 'php') {
             if ($try_unregistered && empty($method)) {
                 $method = 'hook_' . $location . '.inc.php';
             }
             $f = PHPGW_SERVER_ROOT . $SEP . $appname . $SEP . 'inc' . $SEP . $method;
             if (file_exists($f) && ($GLOBALS['phpgw_info']['user']['apps'][$appname] || ($no_permission_check || $location == 'config' || $appname == 'phpgwapi') && $appname)) {
                 include $f;
                 return True;
             } else {
                 return False;
             }
         } else {
             return ExecMethod($method, $args);
         }
     } else {
         return False;
     }
 }
Esempio n. 21
0
<?php

/**************************************************************************\
	* eGroupWare - Online User manual                                          *
	* http://www.eGroupWare.org                                                *
	* Written and (c) by RalfBecker@outdoor-training.de                        *
	* --------------------------------------------                             *
	*  This program is free software; you can redistribute it and/or modify it *
	*  under the terms of the GNU General Public License as published by the   *
	*  Free Software Foundation; either version 2 of the License, or (at your  *
	*  option) any later version.                                              *
	\**************************************************************************/
/* $Id: index.php,v 1.13 2004/04/13 08:19:10 ralfbecker Exp $ */
$GLOBALS['phpgw_info']['flags'] = array('currentapp' => 'manual', 'nonavbar' => True, 'noheader' => True);
include '../header.inc.php';
ExecMethod('manual.uimanual.view');
$GLOBALS['phpgw']->common->phpgw_footer();
 function process_exec()
 {
     //echo "process_exec: _POST ="; _debug_array($_POST);
     $session_data = $this->get_appsession($_POST['etemplate_exec_id']);
     //echo "<p>process_exec: session_data ="; _debug_array($session_data);
     if (!$_POST['etemplate_exec_id'] || !is_array($session_data) || count($session_data) < 10) {
         // this prevents an empty screen, if the sessiondata gets lost somehow
         $this->location(array('menuaction' => $_GET['menuaction']));
     }
     if (isset($_POST['submit_button']) && !empty($_POST['submit_button'])) {
         $this->set_array($_POST, $_POST['submit_button'], 'pressed');
     }
     $content = $_POST['exec'];
     if (!is_array($content)) {
         $content = array();
     }
     $this->init($session_data);
     $GLOBALS['phpgw_info']['etemplate']['extension_data'] = $session_data['extension_data'];
     $GLOBALS['phpgw_info']['etemplate']['java_script'] = $session_data['java_script'] || $_POST['java_script'];
     $GLOBALS['phpgw_info']['etemplate']['dom_enabled'] = $session_data['dom_enabled'] || $_POST['dom_enabled'];
     //echo "globals[java_script] = '".$GLOBALS['phpgw_info']['etemplate']['java_script']."', session_data[java_script] = '".$session_data['java_script']."', _POST[java_script] = '".$_POST['java_script']."'\n";
     //echo "process_exec($this->name) content ="; _debug_array($content);
     if ($GLOBALS['phpgw_info']['flags']['currentapp'] != 'etemplate') {
         $GLOBALS['phpgw']->translation->add_app('etemplate');
         // some extensions have own texts
     }
     $this->process_show($content, $session_data['to_process'], 'exec');
     $GLOBALS['phpgw_info']['etemplate']['loop'] |= !$this->canceled && $this->button_pressed && count($GLOBALS['phpgw_info']['etemplate']['validation_errors']) > 0;
     // set by process_show
     //echo "process_exec($this->name) process_show(content) ="; _debug_array($content);
     //echo "process_exec($this->name) session_data[changes] ="; _debug_array($session_data['changes']);
     $content = $this->complete_array_merge($session_data['changes'], $content);
     //echo "process_exec($this->name) merge(changes,content) ="; _debug_array($content);
     if ($GLOBALS['phpgw_info']['etemplate']['loop']) {
         if ($session_data['hooked'] != '') {
             if ($this->stable) {
                 //echo "<p>process_exec: hook_content set</p>\n";
                 $GLOBALS['phpgw_info']['etemplate']['hook_content'] = $session_data['hooked'];
             } else {
                 $GLOBALS['phpgw']->xslttpl->set_var('phpgw', array('body_data' => $session_data['hooked']));
             }
         }
         if (!empty($session_data['app_header'])) {
             $GLOBALS['phpgw_info']['flags']['app_header'] = $session_data['app_header'];
         }
         //echo "<p>process_exec($this->name): <font color=red>loop is set</font>, content=</p>\n"; _debug_array($content);
         $this->exec($_GET['menuaction'], $session_data['content'], $session_data['sel_options'], $session_data['readonlys'], $session_data['preserv'], $content);
     } else {
         ExecMethod($_GET['menuaction'], $this->complete_array_merge($session_data['preserv'], $content));
     }
 }
 /**
  * Test if there are any jobs ready to run (timer expired) and executes them
  *
  * @param string $run_by Unknown
  * @return integer|boolean Number of jobs or false
  */
 function check_run($run_by = '')
 {
     @set_time_limit(0);
     // dont stop for an execution-time-limit
     flush();
     $error = false;
     if (!$this->last_check_run(True, False, $run_by)) {
         return False;
         // cant obtain semaphore
     }
     if ($jobs = $this->read()) {
         foreach ($jobs as $id => $job) {
             // checking / setting up phpgw_info/user
             //
             if ($GLOBALS['phpgw_info']['user']['account_id'] != $job['account_id']) {
                 $domain = $GLOBALS['phpgw_info']['user']['domain'];
                 $lang = $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'];
                 unset($GLOBALS['phpgw_info']['user']);
                 if ($job['account_id']) {
                     $GLOBALS['phpgw']->session->set_account_id($job['account_id']);
                     //			$GLOBALS['phpgw']->session->account_domain = $domain;
                     $GLOBALS['phpgw']->session->read_repositories(False, False);
                     $GLOBALS['phpgw_info']['user'] = $GLOBALS['phpgw']->session->get_user();
                     if ($lang != $GLOBALS['phpgw_info']['user']['preferences']['common']['lang']) {
                         $GLOBALS['phpgw']->translation->add_app('common');
                     }
                 }
                 $GLOBALS['phpgw_info']['user']['domain'] = $domain;
                 $GLOBALS['phpgw_info']['server']['default_domain'] = $domain;
             }
             list($app) = explode('.', $job['method']);
             $GLOBALS['phpgw']->translation->add_app($app);
             $GLOBALS['phpgw']->db->Exception_On_Error = true;
             if ($job['next'] <= time()) {
                 try {
                     echo 'Start job: ' . date('Y/m/d H:i:s ') . "\n";
                     echo "--id: {$job['id']}\n";
                     echo "--method: {$job['method']}\n";
                     if (isset($job['data']) && $job['data']) {
                         echo "--data: ";
                         print_r($job['data']);
                         echo "\n";
                     }
                     ExecMethod($job['method'], $job['data']);
                     echo 'End job: ' . date('Y/m/d H:i:s ') . "\n\n";
                 } catch (Exception $e) {
                     if ($e) {
                         $GLOBALS['phpgw']->log->error(array('text' => 'asyncservice::check_run() : error when trying to execute %1. Error: %2', 'p1' => $job['method'], 'p2' => $e->getMessage(), 'line' => __LINE__, 'file' => __FILE__));
                         // Do not throw further - it will stop the loop
                         // in case of a manual run
                         echo $e->getMessage() . "\n";
                         continue;
                     }
                 }
             }
             $GLOBALS['phpgw']->db->Exception_On_Error = $this->Exception_On_Error;
             if ($job['next'] = $this->next_run($job['times'])) {
                 $updated_jobs = $this->read($id);
                 if (isset($updated_jobs[$id]) && isset($updated_jobs[$id]['data'])) {
                     // update async data field, it could be changed during ExecMethod()
                     $job['data'] = $updated_jobs[$id]['data'];
                 }
                 // TK 20.11.06 write job to get 'next' and alarm updated
                 $job['data']['time'] = $job['next'];
                 $this->write($job);
             } else {
                 if ($job['next'] <= time()) {
                     $this->delete($job['id']);
                 }
             }
         }
     }
     $this->last_check_run(True, True, $run_by);
     // release semaphore
     return $jobs ? count($jobs) : False;
 }
Esempio n. 24
0
$_domain_info = isset($GLOBALS['phpgw_domain'][$_GET['domain']]) ? $GLOBALS['phpgw_domain'][$_GET['domain']] : '';
if (!$_domain_info) {
    echo "not a valid domain\n";
    die;
} else {
    $GLOBALS['phpgw_domain'] = array();
    $GLOBALS['phpgw_domain'][$_GET['domain']] = $_domain_info;
}
include PHPGW_API_INC . '/functions.inc.php';
$data = array('function' => $function, 'enabled' => 1);
while ($argc > 3) {
    list($key, $value) = explode('=', $argv[3]);
    $data[$key] = $value;
    array_shift($argv);
    --$argc;
}
$destroy_session = false;
if (!isset($GLOBALS['phpgw']->session->sessionid) || !$GLOBALS['phpgw']->session->sessionid) {
    $GLOBALS['phpgw']->session->sessionid = md5($GLOBALS['phpgw']->common->randomstring(10));
    $destroy_session = true;
}
$GLOBALS['phpgw_info']['user']['apps']['admin'] = true;
$GLOBALS['phpgw_info']['user']['domain'] = $_GET['domain'];
$GLOBALS['phpgw_info']['user']['account_id'] = -1;
$GLOBALS['phpgw_info']['user']['account_lid'] = 'cron_job';
$num = ExecMethod('property.custom_functions.index', $data);
// echo date('Y/m/d H:i:s ').$_GET['domain'].': '.($num ? "$num job(s) executed" : 'Nothing to execute')."\n";
if ($destroy_session) {
    $GLOBALS['phpgw']->session->destroy($GLOBALS['phpgw']->session->sessionid, true);
}
$GLOBALS['phpgw']->common->phpgw_exit();
	*  under the terms of the GNU General Public License as published by the   *
	*  Free Software Foundation; either version 2 of the License, or (at your  *
	*  option) any later version.                                              *
	\**************************************************************************/
/* $Id$ */
/*
	This hookfile is for generating an app-specific side menu used in the idots
	template set.

	$menu_title speaks for itself
	$file is the array with link to app functions

	display_sidebox can be called as much as you like
*/
$menu_title = $GLOBALS['phpgw_info']['apps'][$appname]['title'] . ' ' . lang('Menu');
$preferences = ExecMethod('felamimail.bopreferences.getPreferences');
$linkData = array('menuaction' => 'felamimail.uicompose.compose');
$file = array(array('text' => '<a class="textSidebox" href="' . htmlspecialchars($GLOBALS['phpgw']->link('/index.php', $linkData)) . '" target="_blank" onclick="egw_openWindowCentered(\'' . $GLOBALS['phpgw']->link('/index.php', $linkData) . '\',\'' . lang('compose') . '\',700,750); return false;">' . lang('compose'), 'no_lang' => true));
if ($preferences->preferences['deleteOptions'] == 'move_to_trash') {
    $file += array('_NewLine_' => '', 'empty trash' => "javascript:emptyTrash();");
}
if ($preferences->preferences['deleteOptions'] == 'mark_as_deleted') {
    $file += array('_NewLine_' => '', 'compress folder' => "javascript:compressFolder();");
}
display_sidebox($appname, $menu_title, $file);
if ($GLOBALS['phpgw_info']['user']['apps']['preferences']) {
    #$mailPreferences = ExecMethod('felamimail.bopreferences.getPreferences');
    $menu_title = lang('Preferences');
    $file = array('Preferences' => $GLOBALS['phpgw']->link('/index.php', 'menuaction=preferences.uisettings.index&appname=felamimail'));
    if ($preferences->userDefinedAccounts || $preferences->userDefinedIdentities) {
        $linkData = array('menuaction' => 'felamimail.uipreferences.listAccountData');
 function forward($message_id = '', $n_message = '')
 {
     if (!$message_id) {
         $message_id = phpgw::get_var('message_id');
         $message = phpgw::get_var('message');
     }
     $errors = $this->check_for_missing_fields($message);
     if ($errors) {
         ExecMethod('messenger.uimessenger.forward', array($errors, $message));
         //$this->ui->forward($errors, $n_message);
     } else {
         $this->so->send_message($message);
         $this->so->update_message_status('F', $message_id);
         $GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 'messenger.uimessenger.inbox'));
     }
 }
     }
     // this removes the sessiondata if its saved in the URL
     $query = preg_replace('/[&]?sessionid(=|%3D)[^&]+&kp3(=|%3D)[^&]+&domain=.*$/', '', $_SERVER['QUERY_STRING']);
     Header('Location: ' . $GLOBALS['phpgw_info']['server']['webserver_url'] . '/login.php?cd=10&phpgw_forward=' . urlencode($relpath . (!empty($query) ? '?' . $query : '')));
     exit;
 }
 $GLOBALS['phpgw']->datetime = CreateObject('phpgwapi.datetime');
 /* A few hacker resistant constants that will be used throught the program */
 define('PHPGW_TEMPLATE_DIR', ExecMethod('phpgwapi.phpgw.common.get_tpl_dir', 'phpgwapi'));
 define('PHPGW_IMAGES_DIR', ExecMethod('phpgwapi.phpgw.common.get_image_path', 'phpgwapi'));
 define('PHPGW_IMAGES_FILEDIR', ExecMethod('phpgwapi.phpgw.common.get_image_dir', 'phpgwapi'));
 define('PHPGW_APP_ROOT', ExecMethod('phpgwapi.phpgw.common.get_app_dir'));
 define('PHPGW_APP_INC', ExecMethod('phpgwapi.phpgw.common.get_inc_dir'));
 define('PHPGW_APP_TPL', ExecMethod('phpgwapi.phpgw.common.get_tpl_dir'));
 define('PHPGW_IMAGES', ExecMethod('phpgwapi.phpgw.common.get_image_path'));
 define('PHPGW_APP_IMAGES_DIR', ExecMethod('phpgwapi.phpgw.common.get_image_dir'));
 /*	define('PHPGW_APP_IMAGES_DIR', $GLOBALS['phpgw']->common->get_image_dir()); */
 /* Moved outside of this logic
 		define('PHPGW_ACL_READ',1);
 		define('PHPGW_ACL_ADD',2);
 		define('PHPGW_ACL_EDIT',4);
 		define('PHPGW_ACL_DELETE',8);
 		define('PHPGW_ACL_PRIVATE',16);
 		*/
 /********* This sets the user variables *********/
 $GLOBALS['phpgw_info']['user']['private_dir'] = $GLOBALS['phpgw_info']['server']['files_dir'] . '/users/' . $GLOBALS['phpgw_info']['user']['userid'];
 /* This will make sure that a user has the basic default prefs. If not it will add them */
 $GLOBALS['phpgw']->preferences->verify_basic_settings();
 /********* Optional classes, which can be disabled for performance increases *********/
 while ($phpgw_class_name = each($GLOBALS['phpgw_info']['flags'])) {
     if (ereg('enable_', $phpgw_class_name[0])) {
 function parseRequest($data = '')
 {
     global $HTTP_RAW_POST_DATA;
     if ($data == '') {
         $data = $HTTP_RAW_POST_DATA;
     }
     //			return $this->echoInput($data);
     /* Decode to extract methodName */
     $params = xmlrpc_decode_request($data, &$methName);
     $this->last_method = $methName;
     $syscall = 0;
     /* Setup dispatch map based on the function, if this is a system call */
     if (ereg('^system\\.', $methName)) {
         foreach ($GLOBALS['_xmlrpcs_dmap'] as $meth => $dat) {
             $this->add_to_map($meth, $dat['function'], $dat['signature'], $dat['docstring']);
         }
         $sysCall = 1;
         $dmap = $this->dmap;
     } elseif (ereg('^examples\\.', $methName) || ereg('^validator1\\.', $methName) || ereg('^interopEchoTests\\.', $methName)) {
         $dmap = $this->dmap;
         $sysCall = 1;
     }
     /* verify dispatch map, or try to fix it for non-trivial system calls */
     if (!isset($this->dmap[$methName]['function'])) {
         if ($sysCall) {
             /* Bad or non-existent system call, return error */
             $r = CreateObject('phpgwapi.xmlrpcresp', '', $GLOBALS['xmlrpcerr']['unknown_method'], $GLOBALS['xmlrpcstr']['unknown_method'] . ': ' . $methName);
             return $r;
         }
         if ($this->authed) {
             $method = $methName;
             list($app, $class, $method) = explode('.', $methName);
             switch ($app) {
                 case 'server':
                 case 'phpgwapi':
                     /* Server role functions only - api access */
                     if ($GLOBALS['phpgw']->acl->get_role() >= PHPGW_ACL_SERVER) {
                         $dmap = ExecMethod(sprintf('%s.%s.%s', 'phpgwapi', $class, 'list_methods'), 'xmlrpc');
                     }
                     break;
                 case 'service':
                     /* Service functions, user-level */
                     $t = 'phpgwapi.' . $class . '.exec';
                     $dmap = ExecMethod($t, array($service, 'list_methods', 'xmlrpc'));
                     break;
                 default:
                     /* User-level application access */
                     if ($GLOBALS['phpgw']->acl->check('run', PHPGW_ACL_READ, $app)) {
                         $dmap = ExecMethod(sprintf('', $app, $class, 'list_methods'), 'xmlrpc');
                     } else {
                         $r = CreateObject('phpgwapi.xmlrpcresp', '', $GLOBALS['xmlrpcerr']['no_access'], $GLOBALS['xmlrpcstr']['no_access']);
                         return $r;
                     }
             }
         }
     }
     /* add the functions from preset $dmap OR list_methods() to the server map */
     foreach ($dmap as $meth => $dat) {
         $this->add_to_map($meth, $dat['function'], $dat['signature'], $dat['docstring']);
     }
     /* _debug_array($this->dmap);exit; */
     /* Now make the call */
     if (isset($dmap[$methName]['function'])) {
         // dispatch if exists
         if (isset($dmap[$methName]['signature'])) {
             $sr = $this->verifySignature($m, $dmap[$methName]['signature']);
         }
         if (!isset($dmap[$methName]['signature']) || $sr[0]) {
             // if no signature or correct signature
             $r = xmlrpc_server_call_method($this->server, $data, $params);
         } else {
             $r = CreateObject('phpgwapi.xmlrpcresp', '', $GLOBALS['xmlrpcerr']['incorrect_params'], $GLOBALS['xmlrpcstr']['incorrect_params'] . ': ' . $sr[1]);
         }
     } else {
         // else prepare error response
         if (!$this->authed) {
             //					$r = False;
             // send 401 header to force authorization
             $r = CreateObject('phpgwapi.xmlrpcresp', CreateObject('phpgwapi.xmlrpcval', 'UNAUTHORIZED', 'string'));
         } else {
             $r = CreateObject('phpgwapi.xmlrpcresp', '', $GLOBALS['xmlrpcerr']['unknown_method'], $GLOBALS['xmlrpcstr']['unknown_method'] . ': ' . $methName);
         }
     }
     xmlrpc_server_destroy($xmlrpc_server);
     return $r;
 }
Esempio n. 29
0
 /**
  * Do some cleaning up before we exit
  *
  * @internal called by register_shutdown_function()
  */
 public function phpgw_final()
 {
     static $final_called = null;
     if (is_null($final_called)) {
         // call the asyncservice check_run function if it is not explicitly set to cron-only
         if (!isset($GLOBALS['phpgw_info']['server']['asyncservice']) || !$GLOBALS['phpgw_info']['server']['asyncservice'] || $GLOBALS['phpgw_info']['server']['asyncservice'] == 'fallback') {
             ExecMethod('phpgwapi.asyncservice.check_run', 'fallback');
         }
         $GLOBALS['phpgw']->session->commit_session();
         $GLOBALS['phpgw']->db->disconnect();
         $final_called = true;
     }
 }
<?php

/**************************************************************************\
  * phpGroupWare - Calendar                                                  *
  * http://www.phpgroupware.org                                              *
  * Based on Webcalendar by Craig Knudsen <*****@*****.**>               *
  *          http://www.radix.net/~cknudsen                                  *
  * Written by Mark Peters <*****@*****.**>                        *
  * --------------------------------------------                             *
  *  This program is free software; you can redistribute it and/or modify it *
  *  under the terms of the GNU General Public License as published by the   *
  *  Free Software Foundation; either version 2 of the License, or (at your  *
  *  option) any later version.                                              *
  \**************************************************************************/
/* $Id$ */
$d1 = strtolower(substr(PHPGW_APP_INC, 0, 3));
if ($d1 == 'htt' || $d1 == 'ftp') {
    echo 'Failed attempt to break in via an old Security Hole!<br />' . "\n";
    $GLOBALS['phpgw']->common->phpgw_exit();
}
unset($d1);
$GLOBALS['extra_data'] = $GLOBALS['css'] . "\n" . '<td>' . "\n" . '<table border="0" cols="3"><tr><td align="center" width="100%" valign="top">' . ExecMethod('calendar.uicalendar.get_week_new') . '</td>' . "\n" . '</tr>' . "\n" . '</table>' . "\n" . '</td>' . "\n";