<h3><label for="keyword"><?php echo get_lang('Search from keyword'); ?> </label></h3> <form method="post" action="<?php echo $this->formAction; ?> "> <input type="text" name="coursesearchbox_keyword" id="coursesearchbox_keyword" class="inputSearch" /> <button type="submit"><?php echo get_lang('Search'); ?> </button> </form> <?php if (!empty($this->keyword)) { ?> <h3> <?php echo get_lang('Search results for <i>"%keyword"</i>', array('%keyword' => claro_htmlentities(strip_tags($this->keyword)))); ?> </h3> <?php echo $this->courseTree->render(); ?> <?php }
switch ($display) { case DISP_PROFILE_FORM: // Display form profile if (trim($profileText) != '') { $out .= '<div class="info profileEdit">' . $profileText . '</div>'; } $out .= user_html_form($userId); break; case DISP_MOREINFO_FORM: // Display request course creator form $out .= '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">' . "\n" . '<input type="hidden" name="cmd" value="exMoreInfo" />' . "\n" . '<table>' . "\n"; foreach ($extraInfoDefList as $extraInfoDef) { $currentValue = array_key_exists($extraInfoDef['propertyId'], $userInfo) ? $userInfo[$extraInfoDef['propertyId']] : $extraInfoDef['defaultValue']; $requirement = (bool) (true == $extraInfoDef['required']); $labelExtraInfoDef = $extraInfoDef['label']; $out .= form_input_text('extraInfoList[' . claro_htmlentities($extraInfoDef['propertyId']) . ']', $currentValue, get_lang($labelExtraInfoDef), $requirement); } $out .= '<tr valign="top">' . "\n" . '<td>' . get_lang('Submit') . ': </td>' . "\n" . '<td>' . '<input type="submit" value="' . get_lang('Ok') . '" /> ' . "\n" . claro_html_button($_SERVER['PHP_SELF'], get_lang('Cancel')) . "\n" . '</td>' . '</tr>' . "\n" . form_row(' ', '<small>' . get_lang('<span class="required">*</span> denotes required field') . '</small>') . '</table>' . "\n" . '</form>' . "\n"; break; case DISP_REQUEST_COURSE_CREATOR_STATUS: $out .= '<p>' . get_lang('Fill in the text area to motivate your request and then submit the form to send it to platform administrators') . '</p>'; // Display request course creator form $out .= '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">' . "\n" . '<input type="hidden" name="cmd" value="exCCstatus" />' . "\n" . '<table>' . "\n" . form_input_textarea('explanation', '', get_lang('Comment'), true, 6) . '<tr valign="top">' . "\n" . '<td>' . get_lang('Submit') . ': </td>' . "\n" . '<td><input type="submit" value="' . get_lang('Ok') . '" /> ' . "\n" . claro_html_button($_SERVER['PHP_SELF'], get_lang('Cancel')) . "\n" . '</td></tr>' . "\n" . '</table>' . "\n" . '</form>' . "\n"; break; case DISP_REQUEST_REVOQUATION: if (get_conf('can_request_revoquation')) { $out .= '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">' . "\n" . '<input type="hidden" name="cmd" value="exRevoquation" />' . "\n" . '<table>' . "\n" . form_input_text('loginToDelete', '', get_lang('Username'), true) . form_input_password('passwordToDelete', '', get_lang('Password'), true) . form_input_textarea('explanation', '', get_lang('Comment'), true, 6) . '<tr valign="top">' . "\n" . '<td>' . get_lang('Delete my account') . ': </td>' . "\n" . '<td>' . '<input type="submit" value="' . get_lang('Ok') . '" /> ' . "\n" . claro_html_button($_SERVER['PHP_SELF'], get_lang('Cancel')) . "\n" . '</td></tr>' . "\n" . '</table>' . "\n" . '</form>' . "\n"; } break; } // end switch display
/** * CLAROLINE * * MyCalendar portlet ajax backend * * @version $Revision: 14315 $ * @copyright (c) 2001-2011, Universite catholique de Louvain (UCL) * @license http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE * @package DESKTOP * @author Claroline team <*****@*****.**> * @since 1.9 */ if (isset($_REQUEST['location'])) { // Call the right class according to the location if ($_REQUEST['location'] == 'coursehomepage') { require_once dirname(__FILE__) . '/../../claroline/inc/claro_init_global.inc.php'; require_once dirname(__FILE__) . '/lib/coursehomepagecalendar.lib.php'; $cal = new CourseHomePageCalendar(claro_htmlentities($_REQUEST['courseCode'])); } elseif ($_REQUEST['location'] == 'userdesktop') { require_once dirname(__FILE__) . '/../../claroline/inc/claro_init_global.inc.php'; require_once dirname(__FILE__) . '/lib/desktopcalendar.lib.php'; $cal = new UserDesktopCalendar(); } if (isset($_REQUEST['year'])) { $cal->setYear((int) $_REQUEST['year']); } if (isset($_REQUEST['month'])) { $cal->setMonth((int) $_REQUEST['month']); } echo claro_utf8_encode($cal->render(), get_conf('charset')); }
/** * Return the value of a Claroline configuration parameter * @param string $param config parameter * @param mixed $default (optionnal) - set a defaut to return value * if no paramater with such a name is found. * @author Christophe Gesche <*****@*****.**> * @return string param value * @todo http://www.claroline.net/forum/viewtopic.php?t=4579 */ function get_init($param) { static $initValueList = array('_uid', '_cid', '_gid', '_tid', 'is_authenticated', 'in_course_context', 'in_group_context', 'is_platformAdmin', '_course', '_user', '_group', '_groupProperties', '_courseUser', '_courseTool', '_courseToolList', 'is_courseMember', 'is_courseTutor', 'is_courseAdmin', 'is_courseAllowed', 'is_allowedCreateCourse', 'is_groupMember', 'is_groupTutor', 'is_groupAllowed', 'is_toolAllowed', 'calledFrom'); if (!in_array($param, $initValueList)) { trigger_error(claro_htmlentities($param) . ' is not a know init value name ', E_USER_NOTICE); } //TODO create a real auth function to eval this state if ($param == 'is_authenticated') { return !(bool) is_null($GLOBALS['_uid']); } //TODO create a real course function to eval this state if ($param == 'in_course_context') { return !(bool) is_null(claro_get_current_course_id()); } if (array_key_exists($param, $GLOBALS)) { return $GLOBALS[$param]; } elseif (defined($param)) { return constant($param); } return null; }
/** * Returns decoded utf-8 $str. No changes are made if it was not utf-8 * */ function claro_utf8_decode($str, $toCharset = '') { if ($toCharset != '') { $charset = $toCharset; } else { $charset = $GLOBALS['charset']; } if (strtoupper($charset) == 'UTF-8' || !seems_utf8($str)) { return $str; } elseif (strtoupper($charset) == 'ISO-8859-1') { return utf8_decode($str); } elseif (function_exists('mb_convert_encoding')) { return mb_convert_encoding($str, 'UTF-8', $charset); } elseif (function_exists('iconv')) { return iconv('UTF-8', $charset . '//TRANSLIT', $str); } else { $converted = claro_htmlentities($str, ENT_NOQUOTES, 'UTF-8'); return claro_html_entity_decode($converted, ENT_NOQUOTES, $charset); } }
/** * replace XML entities * * With the optional second parameter, you may select, which * entities should be replaced. * * <code> * require_once PEAR_LIB_PATH . '/XML/Util.php'; * * // replace XML entites: * $string = XML_Util::replaceEntities("This string contains < & >."); * </code> * * @access public * @static * @param string string where XML special chars should be replaced * @param integer setting for entities in attribute values (one of XML_UTIL_ENTITIES_XML, XML_UTIL_ENTITIES_XML_REQUIRED, XML_UTIL_ENTITIES_HTML) * @return string string with replaced chars * @see reverseEntities() */ function replaceEntities($string, $replaceEntities = XML_UTIL_ENTITIES_XML) { switch ($replaceEntities) { case XML_UTIL_ENTITIES_XML: return strtr($string, array('&' => '&', '>' => '>', '<' => '<', '"' => '"', '\'' => ''')); break; case XML_UTIL_ENTITIES_XML_REQUIRED: return strtr($string, array('&' => '&', '<' => '<', '"' => '"')); break; case XML_UTIL_ENTITIES_HTML: return claro_htmlentities($string); break; } return $string; }
/** * replaces some dangerous character in a file name * This function is broken ! * * @param string $string * @param string $strict (optional) removes also scores and simple quotes * @since Claroline 1.11.0-beta1 $strict is ignored ! * @return string : the string cleaned of dangerous character * @todo function broken ! */ function replace_dangerous_char($string, $strict = 'loose') { // workaround for mac os x $string = preg_replace('/&#\\d+;/', '_', $string); $search[] = ' '; $replace[] = '_'; $search[] = '/'; $replace[] = '-'; $search[] = '\\'; $replace[] = '-'; $search[] = '"'; $replace[] = '-'; $search[] = '\''; $replace[] = '_'; $search[] = '?'; $replace[] = '-'; $search[] = '*'; $replace[] = '-'; $search[] = '>'; $replace[] = ''; $search[] = '<'; $replace[] = '-'; $search[] = '|'; $replace[] = '-'; $search[] = ':'; $replace[] = '-'; $search[] = '$'; $replace[] = '-'; $search[] = '('; $replace[] = '-'; $search[] = ')'; $replace[] = '-'; $search[] = '^'; $replace[] = '-'; $search[] = '['; $replace[] = '-'; $search[] = ']'; $replace[] = '-'; $search[] = '°'; $replace[] = ''; foreach ($search as $key => $char) { $string = str_replace($char, $replace[$key], $string); } $string = preg_replace('~&([a-z]{1,2})(acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);~i', '$1', claro_htmlentities(claro_utf8_encode($string), ENT_QUOTES, 'UTF-8')); $string = str_replace("'", '', $string); return $string; }
/** * Dump the contents of this object to "standard output". */ function dump() { foreach ($this->_properties as $prop => $foo) { print "{$prop} = "; print claro_htmlentities($this->{$prop}); print "<br />\n"; } }
/** * This method is used to print the HTML output when the user was not authenticated. * * @param $failure the failure that occured * @param $cas_url the URL the CAS server was asked for * @param $no_response the response from the CAS server (other * parameters are ignored if TRUE) * @param $bad_response bad response from the CAS server ($err_code * and $err_msg ignored if TRUE) * @param $cas_response the response of the CAS server * @param $err_code the error code given by the CAS server * @param $err_msg the error message given by the CAS server * * @private */ function authError($failure, $cas_url, $no_response, $bad_response = '', $cas_response = '', $err_code = '', $err_msg = '') { phpCAS::traceBegin(); $this->printHTMLHeader($this->getString(CAS_STR_AUTHENTICATION_FAILED)); printf($this->getString(CAS_STR_YOU_WERE_NOT_AUTHENTICATED), claro_htmlentities($this->getURL()), $_SERVER['SERVER_ADMIN']); phpCAS::trace('CAS URL: ' . $cas_url); phpCAS::trace('Authentication failure: ' . $failure); if ($no_response) { phpCAS::trace('Reason: no response from the CAS server'); } else { if ($bad_response) { phpCAS::trace('Reason: bad response from the CAS server'); } else { switch ($this->getServerVersion()) { case CAS_VERSION_1_0: phpCAS::trace('Reason: CAS error'); break; case CAS_VERSION_2_0: if (empty($err_code)) { phpCAS::trace('Reason: no CAS error'); } else { phpCAS::trace('Reason: [' . $err_code . '] CAS error: ' . $err_msg); } break; } } phpCAS::trace('CAS response: ' . $cas_response); } $this->printHTMLFooter(); phpCAS::traceExit(); exit; }