Example #1
0
 function _content()
 {
     if (empty($this->_params['location'])) {
         return _("No location is set.");
     }
     // Set the timezone variable, if available.
     NLS::setTimeZone();
     list($lat, $long) = explode(':', $this->_params['location']);
     $rise = $this->_calculateSunset(time(), $lat, $long, false, floor(date('Z') / 3600));
     $set = $this->_calculateSunset(time(), $lat, $long, true, floor(date('Z') / 3600));
     $location = '';
     global $coordinates;
     if (!is_array($coordinates)) {
         require HORDE_LIBS . 'Horde/NLS/coordinates.php';
     }
     foreach ($coordinates as $country) {
         if (array_key_exists($this->_params['location'], $country)) {
             $location = $country[$this->_params['location']];
             break;
         }
     }
     $html = '<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0"><tr>';
     $html .= '<td colspan="2" class="control"><b>' . $location . '</b></td></tr><tr height="100%">';
     $html .= '<td width="50%" align="center">';
     $html .= Horde::img('block/sunrise/sunrise.gif', _("Sun Rise"));
     $html .= '<br/>' . $rise;
     $html .= '</td>';
     $html .= '<td width="50%" align="center">';
     $html .= Horde::img('block/sunrise/sunset.gif', _("Sun Set"));
     $html .= '<br/>' . $set;
     $html .= '</td>';
     $html .= '</tr></table>';
     return $html;
 }
 function getAllLang()
 {
     include_once Util::base_Path('include/classes/nls.class.php');
     $langlist = array();
     $dir = opendir(MIGUELGETTEXT_DIR);
     while ($item = readdir($dir)) {
         if ($item != '.' && $item != '..' && $item != 'CVS' && !is_file($item)) {
             $langlist[NLS::getLangLabel($item)] = $item;
         }
     }
     closedir($dir);
     return $langlist;
 }
Example #3
0
 /**
  * The content to go in this block.
  *
  * @return string   The content
  */
 function _content()
 {
     // Set the timezone variable, if available.
     NLS::setTimeZone();
     $html = '<table width="100%" height="100%"><tr><td style="font-family:verdana;font-size:18px;" align="center" valign="center">';
     $html .= strftime('%A, %B %d, %Y ');
     if ($this->_params['time'] == '24-hour') {
         $html .= strftime('%H:%M');
     } else {
         $html .= strftime('%I:%M %p');
     }
     $html .= '</td></tr></table>';
     return $html;
 }
Example #4
0
 /**
  * Export this component in vCal format.
  *
  * @param string $base
  *        	The type of the base object.
  *        	
  * @return string vCal format data.
  */
 function _exportvData($base = 'VCALENDAR')
 {
     $result = 'BEGIN:' . strtoupper($base) . $this->_newline;
     // VERSION is not allowed for entries enclosed in VCALENDAR/ICALENDAR,
     // as it is part of the enclosing VCALENDAR/ICALENDAR. See rfc2445
     if ($base !== 'VEVENT' && $base !== 'VTODO' && $base !== 'VALARM' && $base !== 'VJOURNAL' && $base !== 'VFREEBUSY') {
         // Ensure that version is the first attribute.
         $result .= 'VERSION:' . $this->_version . $this->_newline;
     }
     foreach ($this->_attributes as $attribute) {
         $name = $attribute['name'];
         if ($name == 'VERSION') {
             // Already done.
             continue;
         }
         $params_str = '';
         $params = $attribute['params'];
         if ($params) {
             foreach ($params as $param_name => $param_value) {
                 /* Skip CHARSET for iCalendar 2.0 data, not allowed. */
                 if ($param_name == 'CHARSET' && !$this->isOldFormat()) {
                     continue;
                 }
                 /* Skip VALUE=DATE for vCalendar 1.0 data, not allowed. */
                 if ($this->isOldFormat() && $param_name == 'VALUE' && $param_value == 'DATE') {
                     continue;
                 }
                 if ($param_value === null) {
                     $params_str .= ";{$param_name}";
                 } else {
                     $params_str .= ";{$param_name}={$param_value}";
                 }
             }
         }
         $value = $attribute['value'];
         switch ($name) {
             // Date fields.
             case 'COMPLETED':
             case 'CREATED':
             case 'DCREATED':
             case 'LAST-MODIFIED':
                 $value = $this->_exportDateTime($value);
                 break;
             case 'DTEND':
             case 'DTSTART':
             case 'DTSTAMP':
             case 'DUE':
             case 'AALARM':
             case 'RECURRENCE-ID':
                 if (isset($params['VALUE'])) {
                     if ($params['VALUE'] == 'DATE') {
                         $value = $this->_exportDate($value, $name == 'DTEND' ? '235959' : '000000');
                     } else {
                         $value = $this->_exportDateTime($value);
                     }
                 } else {
                     $value = $this->_exportDateTime($value);
                 }
                 break;
                 // Comma seperated dates.
             // Comma seperated dates.
             case 'EXDATE':
             case 'RDATE':
                 $dates = array();
                 foreach ($value as $date) {
                     if (isset($params['VALUE'])) {
                         if ($params['VALUE'] == 'DATE') {
                             $dates[] = $this->_exportDate($date, '000000');
                         } elseif ($params['VALUE'] == 'PERIOD') {
                             $dates[] = $this->_exportPeriod($date);
                         } else {
                             $dates[] = $this->_exportDateTime($date);
                         }
                     } else {
                         $dates[] = $this->_exportDateTime($date);
                     }
                 }
                 $value = implode(',', $dates);
                 break;
             case 'TRIGGER':
                 if (isset($params['VALUE'])) {
                     if ($params['VALUE'] == 'DATE-TIME') {
                         $value = $this->_exportDateTime($value);
                     } elseif ($params['VALUE'] == 'DURATION') {
                         $value = $this->_exportDuration($value);
                     }
                 } else {
                     $value = $this->_exportDuration($value);
                 }
                 break;
                 // Duration fields.
             // Duration fields.
             case 'DURATION':
                 $value = $this->_exportDuration($value);
                 break;
                 // Period of time fields.
             // Period of time fields.
             case 'FREEBUSY':
                 $value_str = '';
                 foreach ($value as $period) {
                     $value_str .= empty($value_str) ? '' : ',';
                     $value_str .= $this->_exportPeriod($period);
                 }
                 $value = $value_str;
                 break;
                 // UTC offset fields.
             // UTC offset fields.
             case 'TZOFFSETFROM':
             case 'TZOFFSETTO':
                 $value = $this->_exportUtcOffset($value);
                 break;
                 // Integer fields.
             // Integer fields.
             case 'PERCENT-COMPLETE':
             case 'PRIORITY':
             case 'REPEAT':
             case 'SEQUENCE':
                 $value = '$value';
                 break;
                 // Geo fields.
             // Geo fields.
             case 'GEO':
                 $value = $value['latitude'] . ',' . $value['longitude'];
                 break;
                 // Recurrence fields.
             // Recurrence fields.
             case 'EXRULE':
             case 'RRULE':
                 break;
             case 'ATTENDEE':
                 // Kronolith creates attendee field in vcalendar2.0 format.
                 // Convert to vcalendar1.0 if necessary.
                 // Example of 1.0 style:
                 // ATTENDEE;ROLE=OWNER;STATUS=CONFIRMED:John Smith <*****@*****.**>
                 if ($this->isOldFormat()) {
                     $value = preg_replace('/MAILTO:/i', '', $value);
                     $value = $value . ' <' . $value . '>';
                     $params_str = str_replace('PARTSTAT=', 'STATUS=', $params_str);
                     $params_str = str_replace('STATUS=NEEDS-ACTION', 'STATUS=NEEDS ACTION', $params_str);
                     $params_str = str_replace('ROLE=REQ-PARTICIPANT', 'EXPECT=REQUIRE', $params_str);
                     $params_str = str_replace('ROLE=OPT-PARTICIPANT', 'EXPECT=REQUEST', $params_str);
                     $params_str = str_replace('ROLE=NON-PARTICIPANT', 'EXPECT=FYI', $params_str);
                     $params_str = str_replace('RSVP=TRUE', 'RSVP=YES', $params_str);
                     $params_str = str_replace('RSVP=FALSE', 'RSVP=NO', $params_str);
                 }
                 break;
             default:
                 if ($this->isOldFormat()) {
                     if (is_array($attribute['values']) && count($attribute['values']) > 1) {
                         $values = $attribute['values'];
                         if ($name == 'N' || $name == 'ADR' || $name == 'ORG') {
                             $glue = ';';
                         } else {
                             $glue = ',';
                         }
                         $values = str_replace(';', '\\;', $values);
                         $value = implode($glue, $values);
                     } else {
                         /*
                          * vcard 2.1 and vcalendar 1.0 escape only semicolons
                          */
                         $value = str_replace(';', '\\;', $value);
                     }
                     if ($name == 'STATUS') {
                         // vcalendar 1.0 has STATUS:NEEDS ACTION while 2.0 has
                         // STATUS:NEEDS-ACTION.
                         $value = str_replace('NEEDS-ACTION', 'NEEDS ACTION', $value);
                     }
                     // Text containing newlines or ASCII >= 127 must be BASE64
                     // or QUOTED-PRINTABLE encoded. Currently we use
                     // QUOTED-PRINTABLE as default.
                     // FIXME: deal with base64 encodings!
                     if (preg_match("/[^ -\r\n]/", $value) && empty($params['ENCODING'])) {
                         $params['ENCODING'] = 'QUOTED-PRINTABLE';
                         $params_str .= ';ENCODING=QUOTED-PRINTABLE';
                         // Add CHARSET as well. At least the synthesis client
                         // gets confused otherwise
                         if (empty($params['CHARSET'])) {
                             $params['CHARSET'] = NLS::getCharset();
                             $params_str .= ';CHARSET=' . $params['CHARSET'];
                         }
                     }
                 } else {
                     if (is_array($attribute['values']) && count($attribute['values']) > 1) {
                         $values = $attribute['values'];
                         if ($name == 'N' || $name == 'ADR' || $name == 'ORG') {
                             $glue = ';';
                         } else {
                             $glue = ',';
                         }
                         // As of rfc 2426 2.5 semicolon and comma must be
                         // escaped.
                         $values = str_replace(array(';', ',', '\\'), array('\\;', '\\,', '\\\\'), $values);
                         $value = implode($glue, $values);
                     } else {
                         // As of rfc 2426 2.5 semicolon and comma must be
                         // escaped.
                         $value = str_replace(array(';', ',', '\\'), array('\\;', '\\,', '\\\\'), $value);
                     }
                 }
                 break;
         }
         if (!empty($params['ENCODING']) && $params['ENCODING'] == 'QUOTED-PRINTABLE' && strlen(trim($value)) > 0) {
             $value = str_replace('\\r', '', $value);
             /*
              * quotedPrintableEncode does not escape CRLFs, but strange enough single LFs. so convert everything to LF only and replace afterwards.
              */
             $result .= $name . $params_str . ':=' . $this->_newline . str_replace('=0A', '=0D=0A', $this->_quotedPrintableEncode($value)) . $this->_newline;
         } else {
             $attr_string = $name . $params_str . ':' . $value;
             $result .= $this->_foldLine($attr_string) . $this->_newline;
         }
     }
     foreach ($this->_components as $component) {
         $result .= $component->exportvCalendar();
     }
     return $result . 'END:' . $base . $this->_newline;
 }
Example #5
0
 /**
  * Highlights an access key in a label.
  *
  * @param string $label      The label to highlight the access key in.
  * @param string $accessKey  The access key to highlight.
  *
  * @return string  The HTML version of the label with the access key
  *                 highlighted.
  */
 function highlightAccessKey($label, $accessKey)
 {
     $stripped_label = Horde::stripAccessKey($label);
     if (empty($accessKey)) {
         return $stripped_label;
     }
     if (isset($GLOBALS['nls']['multibyte'][NLS::getCharset(true)])) {
         /* Prefix parenthesis with the UTF-8 representation of the LRO
          * (Left-to-Right-Override) Unicode codepoint U+202D. */
         $prefix = NLS::getCharset() == 'UTF-8' ? "‭" : '';
         return $stripped_label . $prefix . '(<span class="accessKey">' . strtoupper($accessKey) . '</span>' . ')';
     } else {
         return str_replace('_' . $accessKey, '<span class="accessKey">' . $accessKey . '</span>', $label);
     }
 }
Example #6
0
    }
    $url = Horde::applicationUrl('admin/setup/index.php', true);
    header('Location: ' . $url);
    exit;
}
$data = '';
if ($setup == 'conf' && $type == 'php') {
    /* A bit ugly here, save PHP code into a string for creating the script
     * to be run at the command prompt. */
    $data = '#!/usr/local/bin/php' . "\n";
    $data .= '<?php' . "\n";
    foreach ($_SESSION['_config'] as $app => $php) {
        $path = $registry->getParam('fileroot', $app) . '/config';
        $data .= 'if ($fp = @fopen(\'' . $path . '/conf.php\', \'w\')) {' . "\n";
        $data .= '    fwrite($fp, \'';
        $data .= String::convertCharset(addslashes($php), NLS::getCharset(), 'iso-8859-1');
        $data .= '\');' . "\n";
        $data .= '    fclose($fp);' . "\n";
        $data .= '    echo \'' . sprintf(_("Saved %s configuration."), $app) . '\' . "\\n";' . "\n";
        $data .= '} else {' . "\n";
        $data .= '    echo \'' . sprintf(_("Could not save %s configuration."), $app) . '\' . "\\n";' . "\n";
        $data .= '}' . "\n\n";
    }
}
if ($save == 'tmp') {
    $tmp_dir = Horde::getTempDir();
    /* Add self-destruct code. */
    $data .= 'echo \'Self-destructing...\' . "\\n";' . "\n";
    $data .= 'if (unlink(__FILE__)) {' . "\n";
    $data .= '    echo \'' . _("Upgrade script deleted.") . '\' . "\\n";' . "\n";
    $data .= '} else {' . "\n";
Example #7
0
 /**
  * Devuelve el valor del charset para el lenguaje seleccionado
  *
  * @param optional boolean $no_utf  Do not use UTF-8?
  *
  * @return string  The character set that should be used with the current
  *                 locale settings.
  * @access public
  */
 function getCharset($no_utf = false)
 {
     global $nls;
     $language = Session::getValue('language');
     /* Get cached results. */
     $cacheKey = intval($no_utf);
     $charset = NLS::_cachedCharset($cacheKey);
     if (!is_null($charset)) {
         return $charset;
     }
     $lang_charset = setlocale(LC_ALL, 0);
     if (!strstr($lang_charset, ';') && !strstr($lang_charset, '/')) {
         $lang_charset = explode('.', $lang_charset);
         if (count($lang_charset) == 2 && !empty($lang_charset[1]) && (!$no_utf || $lang_charset[1] != 'UTF-8')) {
             NLS::_cachedCharset($cacheKey, $lang_charset[1]);
             return $lang_charset[1];
         }
     }
     return !empty($nls['charsets'][$language]) ? $nls['charsets'][$language] : $nls['defaults']['charset'];
 }
Example #8
0
 array_unshift($_SESSION['_sql_query_cache'], $command);
 while (count($_SESSION['_sql_query_cache']) > 20) {
     array_pop($_SESSION['_sql_query_cache']);
 }
 echo '<div class="header">' . _("SQL Query") . ':</div><br />';
 echo '<table cellpadding="4" border="0"><tr><td class="text"><pre>' . htmlspecialchars($command) . '</pre></td></tr></table>';
 echo '<br /><div class="header">' . _("Results") . ':</div><br />';
 echo '<table cellpadding="2" border="0"><tr><td class="control">';
 // Parse out the query results.
 $dbh =& DB::connect($conf['sql']);
 if (is_a($dbh, 'PEAR_Error')) {
     echo '<pre>';
     var_dump($dbh);
     echo '</pre>';
 } else {
     $result = $dbh->query(String::convertCharset($command, NLS::getCharset(), $conf['sql']['charset']));
     if (is_a($result, 'PEAR_Error')) {
         echo '<pre>';
         var_dump($result);
         echo '</pre>';
     } else {
         if (is_object($result)) {
             echo '<table border="0" cellpadding="1" cellspacing="1">';
             $first = true;
             $i = 0;
             while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC)) {
                 if ($first) {
                     echo '<tr>';
                     foreach ($row as $key => $val) {
                         echo '<th align="left">' . (empty($key) ? '&nbsp;' : htmlspecialchars(String::convertCharset($key, $conf['sql']['charset']))) . '</th>';
                     }
Example #9
0
 function formatLogMessage($log)
 {
     global $conf;
     $log = Text::toHTML($log, TEXT_HTML_MICRO, NLS::getCharset(), null);
     if (!empty($conf['tickets']['regexp']) && !empty($conf['tickets']['replacement'])) {
         $log = preg_replace($conf['tickets']['regexp'], $conf['tickets']['replacement'], $log);
     }
     return $log;
 }
 function processPetition()
 {
     //Declaraciones comunes
     $virtual_user = array('username' => 'installer', 'name' => 'instalación', 'surname' => '');
     $message = '';
     $this->setSessionArray("userinfo", $virtual_user);
     //Paso en la instalación
     $install_step = intval($this->getSessionElement('install_step'));
     //Control de salida por peticion de usuario
     if ($this->issetViewVariable('quit')) {
         $install_step = -1;
     }
     switch ($install_step) {
         case -1:
             $this->currentStep = 0;
             break;
         case 1:
             include_once Util::base_Path('include/classes/nls.class.php');
             NLS::setLang($this->getViewVariable('miguel_lang'));
             //NLS::setTextdomain('install', Util::formatPath(MIGUELGETTEXT_DIR), NLS::getCharset());
             if ($this->issetViewVariable('submit')) {
                 $this->currentStep = 2;
             }
             break;
         case 2:
             if ($this->issetViewVariable('submit')) {
                 $this->currentStep = 3;
             }
             if ($this->issetViewVariable('back')) {
                 $this->currentStep = 1;
             }
             break;
         case 3:
             if ($this->issetViewVariable('submit')) {
                 $this->currentStep = 4;
             }
             if ($this->issetViewVariable('back')) {
                 $this->currentStep = 2;
             }
             break;
         case 4:
             if ($this->issetViewVariable('submit')) {
                 $all_Ok = false;
                 //Control sobre variables de vista definidas
                 if ($this->issetViewVariable('miguel_ddbb_sgbd') && $this->getViewVariable('miguel_ddbb_sgbd') != '') {
                     $this->setViewVariable('inst_ddbb_sgbd', $this->getViewVariable('miguel_ddbb_sgbd'));
                     $all_Ok = true;
                 } else {
                     $all_Ok = false;
                 }
                 if ($this->issetViewVariable('miguel_ddbb_host') && $this->getViewVariable('miguel_ddbb_host') != '') {
                     $this->setViewVariable('inst_ddbb_host', $this->getViewVariable('miguel_ddbb_host'));
                     $all_Ok = true;
                 } else {
                     $all_Ok = false;
                 }
                 if ($this->issetViewVariable('miguel_ddbb_name') && $this->getViewVariable('miguel_ddbb_name') != '') {
                     $this->setViewVariable('inst_ddbb_name', $this->getViewVariable('miguel_ddbb_name'));
                     $all_Ok = true;
                 } else {
                     $all_Ok = false;
                 }
                 if ($this->issetViewVariable('miguel_ddbb_user') && $this->getViewVariable('miguel_ddbb_user') != '') {
                     $this->setViewVariable('inst_ddbb_user', $this->getViewVariable('miguel_ddbb_user'));
                     $all_Ok = true;
                 } else {
                     $all_Ok = false;
                 }
                 if ($this->issetViewVariable('miguel_ddbb_passwd') && $this->getViewVariable('miguel_ddbb_passwd') != '') {
                     $this->setViewVariable('inst_ddbb_passwd', $this->getViewVariable('miguel_ddbb_passwd'));
                     $all_Ok = true;
                 } else {
                     $all_Ok = false;
                 }
                 if ($this->issetViewVariable('miguel_ddbb_passwd2') && $this->getViewVariable('miguel_ddbb_passwd2') != '') {
                     $this->setViewVariable('inst_ddbb_passwd2', $this->getViewVariable('miguel_ddbb_passwd2'));
                     $all_Ok = true;
                 } else {
                     $all_Ok = false;
                 }
                 if ($all_Ok) {
                     if ($this->getViewVariable('miguel_ddbb_passwd') == $this->getViewVariable('miguel_ddbb_passwd2')) {
                         $this->setSessionElement('host_sgbd', $this->getViewVariable('miguel_ddbb_sgbd'));
                         $this->setSessionElement('host_name', $this->getViewVariable('miguel_ddbb_host'));
                         $this->setSessionElement('ddbb_name', $this->getViewVariable('miguel_ddbb_name'));
                         $this->setSessionElement('ddbb_user', $this->getViewVariable('miguel_ddbb_user'));
                         $this->setSessionElement('ddbb_passwd', $this->getViewVariable('miguel_ddbb_passwd'));
                         $this->currentStep = 5;
                     } else {
                         $this->currentStep = 4;
                         $message = 'Error: Las claves no coinciden.';
                     }
                 } else {
                     $this->currentStep = 4;
                     $message = 'Error: Todos los campos son obligatorios.';
                 }
             }
             if ($this->issetViewVariable('back')) {
                 $this->currentStep = 3;
             }
             break;
         case 5:
             if ($this->issetViewVariable('submit')) {
                 $all_Ok = false;
                 if ($this->issetViewVariable('miguel_campus_name') && $this->getViewVariable('miguel_campus_name') != '') {
                     $this->setViewVariable('inst_campus_name', $this->getViewVariable('miguel_campus_name'));
                     $all_Ok = true;
                 } else {
                     $all_Ok = false;
                 }
                 if ($this->issetViewVariable('miguel_inst_name') && $this->getViewVariable('miguel_inst_name') != '') {
                     $this->setViewVariable('inst_inst_name', $this->getViewVariable('miguel_inst_name'));
                     $all_Ok = true;
                 } else {
                     $all_Ok = false;
                 }
                 if ($this->issetViewVariable('miguel_inst_url') && $this->getViewVariable('miguel_inst_url') != '') {
                     $this->setViewVariable('inst_inst_url', $this->getViewVariable('miguel_inst_url'));
                     $all_Ok = true;
                 } else {
                     $all_Ok = false;
                 }
                 if ($this->issetViewVariable('miguel_director_name') && $this->getViewVariable('miguel_director_name') != '') {
                     $this->setViewVariable('inst_director_name', $this->getViewVariable('miguel_director_name'));
                     $all_Ok = true;
                 } else {
                     $all_Ok = false;
                 }
                 if ($this->issetViewVariable('miguel_director_email') && $this->getViewVariable('miguel_director_email') != '') {
                     $this->setViewVariable('inst_director_email', $this->getViewVariable('miguel_director_email'));
                     $all_Ok = true;
                 } else {
                     $all_Ok = false;
                 }
                 if ($this->issetViewVariable('miguel_inst_phone') && $this->getViewVariable('miguel_inst_phone') != '') {
                     $this->setViewVariable('inst_inst_phone', $this->getViewVariable('miguel_inst_phone'));
                     $all_Ok = true;
                 } else {
                     $all_Ok = false;
                 }
                 if ($this->issetViewVariable('miguel_campus_lang') && $this->getViewVariable('miguel_campus_lang') != '') {
                     $this->setViewVariable('inst_campus_lang', $this->getViewVariable('miguel_campus_lang'));
                     $all_Ok = true;
                 } else {
                     $all_Ok = false;
                 }
                 if ($this->issetViewVariable('miguel_campus_lang') && $this->getViewVariable('miguel_campus_lang') != '') {
                     $this->setViewVariable('inst_campus_lang', $this->getViewVariable('miguel_campus_lang'));
                     $all_Ok = true;
                 } else {
                     $all_Ok = false;
                 }
                 if ($this->issetViewVariable('miguel_admin_name') && $this->getViewVariable('miguel_admin_name') != '') {
                     $this->setViewVariable('inst_admin_name', $this->getViewVariable('miguel_admin_name'));
                     $all_Ok = true;
                 } else {
                     $all_Ok = false;
                 }
                 if ($this->issetViewVariable('miguel_admin_surname') && $this->getViewVariable('miguel_admin_surname') != '') {
                     $this->setViewVariable('inst_admin_surname', $this->getViewVariable('miguel_admin_surname'));
                     $all_Ok = true;
                 } else {
                     $all_Ok = false;
                 }
                 if ($this->issetViewVariable('miguel_admin_user') && $this->getViewVariable('miguel_admin_user') != '') {
                     $this->setViewVariable('inst_admin_user', $this->getViewVariable('miguel_admin_user'));
                     $all_Ok = true;
                 } else {
                     $all_Ok = false;
                 }
                 if ($this->issetViewVariable('miguel_admin_passwd') && $this->getViewVariable('miguel_admin_passwd') != '') {
                     $this->setViewVariable('inst_admin_passwd', $this->getViewVariable('miguel_admin_passwd'));
                     $all_Ok = true;
                 } else {
                     $all_Ok = false;
                 }
                 if ($this->issetViewVariable('miguel_admin_passwd2') && $this->getViewVariable('miguel_admin_passwd2') != '') {
                     $this->setViewVariable('inst_admin_passwd2', $this->getViewVariable('miguel_admin_passwd2'));
                     $all_Ok = true;
                 } else {
                     $all_Ok = false;
                 }
                 if ($this->issetViewVariable('miguel_admin_theme') && $this->getViewVariable('miguel_admin_theme') != '') {
                     $this->setViewVariable('inst_admin_theme', $this->getViewVariable('miguel_admin_theme'));
                     $all_Ok = true;
                 } else {
                     $all_Ok = false;
                 }
                 if ($this->issetViewVariable('miguel_cript_passwd') && $this->getViewVariable('miguel_cript_passwd') != '') {
                     $this->setViewVariable('inst_cript_passwd', $this->getViewVariable('miguel_cript_passwd'));
                     $all_Ok = true;
                 } else {
                     $all_Ok = false;
                 }
                 if ($all_Ok) {
                     if ($this->getViewVariable('miguel_admin_passwd') == $this->getViewVariable('miguel_admin_passwd2')) {
                         $this->setSessionElement('campus_name', $this->getViewVariable('miguel_campus_name'));
                         $this->setSessionElement('inst_name', $this->getViewVariable('miguel_inst_name'));
                         $this->setSessionElement('inst_url', $this->getViewVariable('miguel_inst_url'));
                         $this->setSessionElement('director_name', $this->getViewVariable('miguel_director_name'));
                         $this->setSessionElement('director_email', $this->getViewVariable('miguel_director_email'));
                         $this->setSessionElement('inst_phone', $this->getViewVariable('miguel_inst_phone'));
                         $this->setSessionElement('campus_lang', $this->getViewVariable('miguel_campus_lang'));
                         $this->setSessionElement('admin_name', $this->getViewVariable('miguel_admin_name'));
                         $this->setSessionElement('admin_surname', $this->getViewVariable('miguel_admin_surname'));
                         $this->setSessionElement('admin_user', $this->getViewVariable('miguel_admin_user'));
                         $this->setSessionElement('admin_passwd', $this->getViewVariable('miguel_admin_passwd'));
                         $this->setSessionElement('admin_theme', $this->getViewVariable('miguel_admin_theme'));
                         if ($this->getViewVariable('miguel_cript_passwd') == agt('Si')) {
                             $cripted = 'true';
                         } else {
                             $cripted = 'false';
                         }
                         $this->setSessionElement('cript_passwd', $cripted);
                         $this->currentStep = 6;
                     } else {
                         $this->currentStep = 5;
                         $message = 'Error: Las claves no coinciden.';
                     }
                 } else {
                     $this->currentStep = 5;
                     $message = 'Error: Todos los campos son obligatorios.';
                 }
             }
             if ($this->issetViewVariable('back')) {
                 $this->currentStep = 4;
             }
             break;
         case 6:
             if ($this->issetViewVariable('submit')) {
                 $this->obj_data->makeXMLData();
                 $this->currentStep = 7;
             }
             if ($this->issetViewVariable('back')) {
                 $this->currentStep = 5;
             }
             break;
         default:
             $this->currentStep = 1;
     }
     //end switch
     switch ($this->currentStep) {
         case 0:
             //$this->Close();
             $this->setViewVariable("install_step", 0);
             break;
         case 1:
             if (!$this->issetViewVariable('inst_lang')) {
                 $this->setViewVariable('inst_lang', NLS::getLangLabel('es_ES'));
             }
             $this->setViewVariable('select_lang', $this->obj_data->getAllLang());
             $this->setViewVariable("install_step", 1);
             break;
         case 2:
             $this->setViewVariable("install_step", 2);
             $this->setViewVariable("install_require", $this->_getRequire());
             break;
         case 3:
             $this->setViewVariable("install_step", 3);
             break;
         case 4:
             if (!$this->issetViewVariable('inst_ddbb_sgbd')) {
                 $this->setViewVariable('inst_ddbb_sgbd', $this->obj_data->getAllSGBD());
             }
             if (!$this->issetViewVariable('inst_ddbb_host')) {
                 $this->setViewVariable('inst_ddbb_host', 'localhost');
             }
             if (!$this->issetViewVariable('inst_ddbb_name')) {
                 $this->setViewVariable('inst_ddbb_name', 'miguel');
             }
             if (!$this->issetViewVariable('inst_ddbb_user')) {
                 $this->setViewVariable('inst_ddbb_user', 'root');
             }
             if (!$this->issetViewVariable('inst_ddbb_passwd')) {
                 $this->setViewVariable('inst_ddbb_passwd', Util::newPasswd());
             }
             if (!$this->issetViewVariable('inst_ddbb_paswwd2')) {
                 $this->setViewVariable('inst_ddbb_paswwd2', '');
             }
             $this->setViewVariable("install_step", 4);
             break;
         case 5:
             if (!$this->issetViewVariable('inst_campus_name')) {
                 $this->setViewVariable('inst_campus_name', 'miguel (OO)');
             }
             if (!$this->issetViewVariable('inst_inst_name')) {
                 $this->setViewVariable('inst_inst_name', 'Hispalinux');
             }
             if (!$this->issetViewVariable('inst_inst_url')) {
                 $this->setViewVariable('inst_inst_url', 'http://www.hispalinux.es');
             }
             if (!$this->issetViewVariable('inst_director_name')) {
                 $this->setViewVariable('inst_director_name', 'Juan Español');
             }
             if (!$this->issetViewVariable('inst_director_email')) {
                 $this->setViewVariable('inst_director_email', 'root@localhost');
             }
             if (!$this->issetViewVariable('inst_inst_phone')) {
                 $this->setViewVariable('inst_inst_phone', '(515) 648 208');
             }
             $this->setViewVariable('inst_campus_lang', $this->obj_data->getAllLang());
             if (!$this->issetViewVariable('inst_admin_name')) {
                 $this->setViewVariable('inst_admin_name', 'Juan');
             }
             if (!$this->issetViewVariable('inst_admin_surname')) {
                 $this->setViewVariable('inst_admin_surname', 'Español');
             }
             if (!$this->issetViewVariable('inst_admin_user')) {
                 $this->setViewVariable('inst_admin_user', 'admin');
             }
             if (!$this->issetViewVariable('inst_admin_passwd')) {
                 $this->setViewVariable('inst_admin_passwd', '');
             }
             if (!$this->issetViewVariable('inst_cript_passwd')) {
                 $this->setViewVariable('inst_cript_passwd', true);
             }
             $this->setViewVariable("install_step", 5);
             break;
         case 6:
             $this->setViewVariable("install_step", 6);
             break;
         case 7:
             $this->setViewVariable("install_step", 7);
             break;
     }
     if ($this->currentStep == 0) {
         $step = "Salida a petición de usuario.";
     } else {
         $step = "Paso " . $this->currentStep . " de 7.";
     }
     $this->setSessionElement('install_step', $this->currentStep);
     $this->setPageTitle("miguel Instalation Page");
     if ($message == '') {
         $this->setMessage('Proceso de instalación y configuración de su plataforma miguel - ' . $step);
     } else {
         $this->setMessage($message);
     }
     $this->setHelp("EducInstall");
 }
 function show_Details($_type, $_content, $_dt_ini, $_dt_fin, $calendar_id)
 {
     $row = html_tr();
     $row->add(html_td('ptabla03', '', html_b(NLS::localiseDateTime("%d-%m-%Y", $_dt_ini))));
     $row->add(html_td('ptabla03', '', html_b(NLS::localiseDateTime("%d-%m-%Y", $_dt_fin))));
     $row->add(html_td('ptabla03', '', $_type));
     $row->add(html_td('ptabla03', '', nl2br($_content)));
     $opEliminar = $this->icon_link(Util::format_URLPath('courseTask/index.php', "status=delete&id={$calendar_id}"), Theme::getThemeImagePath('delete.png'), 'Borrar', 'titulo03a');
     $row->add(html_td('ptabla03', '', $opEliminar));
     return $row;
 }
Example #12
0
require_once HORDE_LIBS . 'Horde/CLI.php';
$c =& new Horde_CLI();
if (!$c->runningFromCLI()) {
    $c->fatal(_("This script must be run from the command line."));
}
$c->init();
require HORDE_BASE . '/config/nls.php';
require_once HORDE_LIBS . 'Horde/NLS.php';
if (!empty($language)) {
    $tmp = explode('.', $language);
    $language = $tmp[0];
    $language = NLS::_map(trim($language));
    if (!NLS::isValid($language)) {
        $language = NLS::_map(substr($language, 0, 2));
    }
    if (NLS::isValid($language)) {
        setlocale(LC_ALL, $language);
        bindtextdomain('horde', HORDE_BASE . '/locale');
        textdomain('horde');
        if (array_key_exists(1, $tmp) && function_exists('bind_textdomain_codeset')) {
            bind_textdomain_codeset('horde', $tmp[1]);
        }
    }
}
$c->writeln($c->bold(_("---------------------------")));
$c->writeln($c->bold(_("Horde translation generator")));
$c->writeln($c->bold(_("---------------------------")));
/* Sanity checks */
if (!extension_loaded('gettext')) {
    $c->writeln($c->red('Gettext extension not found!'));
    footer();
 function show_Details($calendar, $course, $event, $subject, $content, $dt_ini, $dt_fin, $opers = false)
 {
     $table = html_table(Session::getContextValue("mainInterfaceWidth"), 0, 2, 2);
     //$dia = html_td('', '', html_b(ucfirst(NLS::localiseDateTime("%B %Y", $dt_ini))));
     $dia = html_td('ptabla02', '', html_b('Dia: ' . ucfirst(NLS::localiseDateTime("%A, %d-%m-%Y", $dt_ini)) . ' desde ' . NLS::localiseDateTime("%H:%M", $dt_ini) . ' hasta ' . NLS::localiseDateTime("%H:%M", $dt_fin)));
     $dia->set_tag_attribute('bgcolor', '#C0C0C0');
     $dia->set_tag_attribute('width', '80%');
     $row = html_tr();
     $row->add($dia);
     if (!empty($calendar) && $opers && Session::getValue('isCourseAdmin')) {
         $container = container();
         //$container->add(html_a(Util::format_URLPath('calendar/index.php',"status=modify&id=$calendar"), agt('miguel_modify')));
         //$container->add(' - ');
         $container->add(html_a(Util::format_URLPath('calendar/index.php', "status=delete&id={$calendar}"), agt('miguel_delete')));
         $oper = html_td('ptabla03', '', $container);
         //$oper->set_tag_attribute('bgcolor','#C0C0C0');
         $oper->set_tag_attribute('width', '20%');
         $row->add($oper);
     }
     $table->add_row($row);
     /*
     $tiempo = html_td('', '', html_a(Util::format_URLPath('calendar/index.php',"status=show&id=$calendar_id"),$time));
     $tiempo->set_tag_attribute('bgcolor','#99CE99');
     $tiempo->set_tag_attribute('align','right');
     */
     if (!empty($course)) {
         $cont2 = container();
         $cont2->add(html_b('Curso: '));
         $cont2->add($course);
         $row2 = html_tr();
         $row2->add(html_td('ptabla02', '', $cont2));
         $table->add_row($row2);
     }
     $cont3 = container();
     $cont3->add(html_b($subject));
     $cont3->add("&nbsp;");
     $cont3->add('Tipo de evento: ' . $event);
     $table->add_row(html_td('ptabla02', '', $cont3));
     $table->add_row(html_td('ptabla03', '', nl2br($content)));
     return $table;
 }
 /**
  * Define la estructura global de la página
  *
  */
 function body_content()
 {
     $this->set_body_attributes("bgcolor=\"yellow\"");
     //add the header area
     $this->add(html_comment("Header block begins"));
     $this->add($this->header_block());
     $this->add(html_comment("Header block ends"));
     //add it to the page
     //build the outer wrapper div
     //that everything will live under
     $wrapper_div = html_div();
     $wrapper_div->set_id("mainarea");
     //add the main body
     $wrapper_div->add(html_comment("Main block begins"));
     NLS::setTextdomain($this->registry->gettextDomain(), Util::formatPath(MIGUELGETTEXT_DIR), NLS::getCharset());
     $wrapper_div->add($this->main_block());
     $wrapper_div->add(html_comment("Main block ends"));
     $this->add($wrapper_div);
 }
 /**
  * Elimina de la pila el módulo, restaurando el siguiente módulo en la pila.
  *
  * @return string  The name of the application that was popped.
  *
  * @access public
  */
 function popApp()
 {
     /* Pop the current application off of the stack. */
     if (count($this->_appStack) > 1) {
         $previous = array_pop($this->_appStack);
         /* Import the new active application's configuration values
            and set the gettext domain and the preferred language. */
         $this->_currentApp = count($this->_appStack) ? end($this->_appStack) : null;
         if ($this->_currentApp) {
             NLS::setLang();
             NLS::setTextdomain($this->modules[$this->_currentApp]['gettext'], Util::formatPath(MIGUELGETTEXT_DIR), NLS::getCharset());
         }
     }
 }
Example #16
0
if (Util::removeParameter($login_screen, array('url', 'nocache')) != Util::removeParameter(Horde::url(Horde::selfUrl(), true), array('url', 'nocache'))) {
    if ($url_param) {
        $login_screen = Util::addParameter($login_screen, 'url', $url_param);
    }
    $login_screen = Util::addParameter($login_screen, 'frameset', Util::getFormData('frameset'));
    header('Location: ' . $login_screen);
    exit;
}
if ($browser->isMobile()) {
    require_once HORDE_LIBS . 'Horde/Mobile.php';
    require HORDE_TEMPLATES . '/login/mobile.inc';
    exit;
}
/* Build the <select> widget containing the available languages. */
if (!$prefs->isLocked('language')) {
    $_SESSION['horde_language'] = NLS::select();
    $langs = '<select name="new_lang" onchange="selectLang()">';
    foreach ($nls['languages'] as $key => $val) {
        $sel = $key == $_SESSION['horde_language'] ? ' selected="selected"' : '';
        $langs .= "<option value=\"{$key}\"{$sel}>{$val}</option>";
    }
    $langs .= '</select>';
}
$title = _("Log in");
$notification->push('setFocus()', 'javascript');
if ($logout_reason && $conf['menu']['always']) {
    $notification->push('if (window.parent.frames.horde_menu) window.parent.frames.horde_menu.location.reload();', 'javascript');
}
$reason = $auth->getLogoutReasonString();
/* Add some javascript. */
Horde::addScriptFile('enter_key_trap.js', 'horde');
Example #17
0
    $url = Horde::applicationUrl('admin/setup/index.php', true);
    header('Location: ' . $url);
    exit;
}
$vars = Variables::getDefaultVariables();
$form =& new ConfigForm($vars, $app);
$form->setTitle($title);
$form->setButtons(sprintf(_("Generate %s Configuration"), $appname));
$php = '';
if ($form->validate($vars)) {
    $config =& new Horde_Config($app);
    $php = $config->generatePHPConfig($vars);
    $path = $registry->getParam('fileroot', $app) . '/config';
    if ($fp = @fopen($path . '/conf.php', 'w')) {
        /* Can write, so output to file. */
        fwrite($fp, String::convertCharset($php, NLS::getCharset(), 'iso-8859-1'));
        fclose($fp);
        $notification->push(sprintf(_("Successfully wrote %s"), $path . '/conf.php'), 'horde.success');
    } else {
        /* Can not write. */
        $notification->push(sprintf(_("Writing not possible. You can either use the available upgrade script or copy manually the code below to %s."), $path . '/conf.php'), 'horde.warning');
        /* Save to session. */
        $_SESSION['_config'][$app] = $php;
    }
}
/* Render the configuration form. */
require_once HORDE_LIBS . 'Horde/UI/VarRenderer.php';
$renderer =& new Horde_Form_Renderer();
$renderer->setAttrColumnWidth('50%');
$form = Util::bufferOutput(array($form, 'renderActive'), $renderer, $vars, 'config.php', 'post');
/* Set up the template. */
Example #18
0
} else {
    $fileroot = $registry->getParam('fileroot', $module);
    $help_file = $fileroot . "/locale/{$language}/help.xml";
    $help_file_fallback = $fileroot . '/locale/en_US/help.xml';
}
if ($show == 'index') {
    require HORDE_TEMPLATES . '/help/index.inc';
} else {
    require HORDE_TEMPLATES . '/common-header.inc';
    if ($show == 'menu') {
        require HORDE_TEMPLATES . '/help/menu.inc';
    } elseif ($show == 'about') {
        require $fileroot . '/lib/version.php';
        eval('$version = "' . ucfirst($module) . ' " . ' . String::upper($module) . '_VERSION;');
        $credits = Util::bufferOutput('include', $fileroot . '/docs/CREDITS');
        $credits = String::convertCharset($credits, 'iso-8859-1', NLS::getCharset());
        require HORDE_TEMPLATES . '/help/about.inc';
    } else {
        require HORDE_TEMPLATES . '/help/header.inc';
        $help = new Help(HELP_SOURCE_FILE, array($help_file, $help_file_fallback));
        if ($show == 'entry' && !empty($topic)) {
            $help->lookup($topic);
            $help->display();
        } else {
            $topics = $help->topics();
            foreach ($topics as $id => $title) {
                $link = Horde::url($registry->getParam('webroot', 'horde') . '/services/help/');
                $link = Util::addParameter($link, array('show' => 'entry', 'module' => $module, 'topic' => $id));
                echo Horde::link($link, '', 'helpitem');
                echo $title . "</a><br />\n";
            }
Example #19
0
 function appConfig($is_config_ok)
 {
     if ($is_config_ok) {
         $run_config = $this->cli->prompt(_("All the installed applications seem to be configured, reconfigure any app?"), array('y' => _("Yes"), 'n' => _("No")));
         if ($run_config == 'n') {
             return true;
         }
     }
     global $registry;
     $applist = $registry->listApps(array('hidden', 'notoolbar', 'active'));
     sort($applist);
     $apps = array(0 => _("All applications"));
     foreach ($applist as $app) {
         if (@file_exists($registry->getParam('fileroot', $app) . '/config/conf.xml')) {
             array_push($apps, $app);
         }
     }
     $apps = $apps + array('x' => 'exit');
     $app_choice = $this->cli->prompt(_("Which app do you wish to reconfigure?"), $apps);
     if ($app_choice == 'x') {
         return true;
     }
     if ($app_choice > 0) {
         $apps = array($apps[$app_choice]);
     } else {
         $apps = array_slice($apps, 1, count($apps) - 2);
     }
     $vars = Variables::getDefaultVariables();
     foreach ($apps as $app) {
         $config =& new Horde_Config($app);
         $php = $config->generatePHPConfig($vars);
         $fp = @fopen($registry->getParam('fileroot', $app) . '/config/conf.php', 'w');
         if ($fp) {
             fwrite($fp, String::convertCharset($php, NLS::getCharset(), 'iso-8859-1'));
             fclose($fp);
             $this->log(sprintf(_("Wrote configuration file '%s'."), $registry->getParam('fileroot', $app) . '/config/conf.php'), 'success');
         } else {
             $this->log(sprintf(_("Can not write configuration file '%s'."), $registry->getParam('fileroot', $app) . '/config/conf.php'), 'error');
         }
     }
 }