public function renderContent() { global $platformLanguage; $out = ''; // Last user action $lastUserAction = isset($_SESSION['last_action']) && $_SESSION['last_action'] != '1970-01-01 00:00:00' ? $_SESSION['last_action'] : date('Y-m-d H:i:s'); $userCommands = array(); // User commands // 'Create Course Site' command. Only available for teacher. if (claro_is_allowed_to_create_course()) { $userCommands[] = '<a href="' . claro_htmlspecialchars(Url::Contextualize(get_path('clarolineRepositoryWeb') . 'course/create.php')) . '" class="userCommandsItem">' . '<img src="' . get_icon_url('courseadd') . '" alt="" /> ' . get_lang('Create a course site') . '</a>' . "\n"; } elseif ($GLOBALS['currentUser']->isCourseCreator) { $userCommands[] = '<span class="userCommandsItemDisabled">' . '<img src="' . get_icon_url('courseadd') . '" alt="" /> ' . get_lang('Create a course site') . '</span>' . "\n"; } if (get_conf('allowToSelfEnroll', true)) { $userCommands[] = '<a href="' . claro_htmlspecialchars(Url::Contextualize(get_path('clarolineRepositoryWeb') . 'auth/courses.php?cmd=rqReg&categoryId=0')) . '" class="userCommandsItem">' . '<img src="' . get_icon_url('enroll') . '" alt="" /> ' . get_lang('Enrol on a new course') . '</a>' . "\n"; $userCommands[] = '<a href="' . claro_htmlspecialchars(Url::Contextualize(get_path('clarolineRepositoryWeb') . 'auth/courses.php?cmd=rqUnreg')) . '" class="userCommandsItem">' . '<img src="' . get_icon_url('unenroll') . '" alt="" /> ' . get_lang('Remove course enrolment') . '</a>' . "\n"; } $userCommands[] = '<a href="' . claro_htmlspecialchars(Url::Contextualize(get_path('clarolineRepositoryWeb') . 'course/platform_courses.php')) . '" class="userCommandsItem">' . '<img src="' . get_icon_url('course') . '" alt="" /> ' . get_lang('All platform courses') . '</a>' . "\n"; $userCommands[] = '<a href="' . claro_htmlspecialchars(Url::Contextualize(get_path('clarolineRepositoryWeb') . 'notification_date.php')) . '" class="userCommandsItem">' . '<img class="iconDefinitionList" src="' . get_icon_url('hot') . '" alt="' . get_lang('New items') . '" />' . ' ' . get_lang('New items') . ' ' . get_lang('to another date') . (substr($lastUserAction, strlen($lastUserAction) - 8) == '00:00:00' ? ' [' . claro_html_localised_date(get_locale('dateFormatNumeric'), strtotime($lastUserAction)) . ']' : '') . '</a>' . "\n"; $userCourseList = render_user_course_list(); $userCourseListDesactivated = render_user_course_list_desactivated(); $out .= '<div class="userCommands">' . '<h2>' . get_lang('Manage my courses') . '</h2>' . claro_html_list($userCommands) . '</div>' . '<div class="userCourseList">' . '<h2>' . get_lang('My course list') . '</h2>' . $userCourseList; if (!empty($userCourseListDesactivated)) { $out .= '<h4>' . get_lang('Deactivated course list') . '</h4>' . $userCourseListDesactivated; } $out .= '</div>'; /*'</td>' . '</tr>' . '</tbody>' . '</table>'*/ $this->content = $out; return $this->content; }
/** * Render content */ public function render() { CssLoader::getInstance()->load('profile', 'all'); load_kernel_config('user_profile'); $userData = user_get_properties($this->userId); $pictureUrl = ''; if (get_conf('allow_profile_picture')) { $picturePath = user_get_picture_path($userData); if ($picturePath && file_exists($picturePath)) { $pictureUrl = user_get_picture_url($userData); } else { $pictureUrl = get_icon_url('nopicture'); } } $userFullName = claro_htmlspecialchars(get_lang('%firstName %lastName', array('%firstName' => $userData['firstname'], '%lastName' => $userData['lastname']))); $dock = new ClaroDock('userProfileBox'); $template = new CoreTemplate('user_profilebox.tpl.php'); $template->assign('userId', $this->userId); $template->assign('pictureUrl', $pictureUrl); $template->assign('userFullName', $userFullName); $template->assign('dock', $dock); $template->assign('condensedMode', $this->condensedMode); $template->assign('userData', $userData); return $template->render(); }
function db_init($db_group = 'default') { IS_DB_ACTIVE or show_error('please check your database configration'); //数据库资源 $db = false; $db_username = ''; $db_passwd = ''; $db_database = ''; $db_host = 'localhost'; $db_port = '3306'; $db_conf = get_conf('db_conf'); $charset = str_replace('-', '', CHARSET); //将 utf-8 切换为 utf8 if (!$db_conf) { show_error('none valid database configration!'); } else { if (!array_key_exists($db_group, $db_conf)) { show_error("invalid database group '{$db_group}' called!"); } else { extract($db_conf[$db_group]); $db = new mysqli($db_host, $db_username, $db_passwd, $db_database, $db_port); if ($db->connect_errno) { $error_msg = convert_str('database established error - error code: ' . $db->connect_errno . " | " . 'error msg: ' . $db->connect_error); show_error($error_msg); } else { $db->set_charset($charset); //由 set names xxx 升级为该行 } } } return $db; }
public function export() { $postsList = $this->loadTopic($this->getTopicId()); $topicInfo = get_topic_settings($this->getTopicId()); $this->createPDF($topicInfo['topic_title']); $this->pdf->AddPage(); $htmlContent = '<p>' . "\n" . '<table cellspacing="0" cellpadding="2" border="1">' . "\n" . '<tbody>' . "\n" . '<tr>' . "\n" . '<th colspan="2" style="font-weight: bold; background-color: #EDF1E3; color: #669933; border-bottom: 1px solid #96BB7A;">' . claro_utf8_encode($topicInfo['topic_title']) . '</th>' . '</tr>' . "\n"; foreach ($postsList as $post) { $htmlContent .= '<tr>' . "\n" . '<td style="width: 150px; background-color: #EEEEEE;">' . "\n" . '<div style="font-weight: bold;">' . claro_utf8_encode($post['firstname'] . ' ' . $post['lastname'], get_conf('charset')) . '</div>' . "\n" . '<small>' . claro_html_localised_date(get_locale('dateTimeFormatLong'), datetime_to_timestamp($post['post_time'])) . '</small>' . "\n" . '</td>' . "\n" . '<td style="width: 354px;">' . claro_utf8_encode(claro_parse_user_text(strip_tags($post['post_text'])), get_conf('charset')) . '</td>' . "\n" . '</tr>' . "\n"; } $htmlContent .= '</tbody>' . "\n" . '</table>' . "\n" . '</p>'; //exit( claro_utf8_decode($htmlContent) ); $this->pdf->writeHTML($htmlContent, true, 0, true, 0); switch ($this->output) { case 'screen': $this->pdf->Output(claro_utf8_encode($topicInfo['topic_id'] . '_' . $topicInfo['topic_title'] . '.pdf'), 'D'); break; default: $path = get_conf('rootSys') . get_conf('tmpPathSys') . '/forum_export/'; claro_mkdir($path); $this->pdf->Output($path . claro_utf8_encode(replace_dangerous_char($topicInfo['topic_id'] . '_' . $topicInfo['topic_title']) . '.pdf'), 'F'); break; } return true; }
/** * Build the file path of a textzone in a given context * * @param string $key * @param array $context specify the context to build the path. * @param array $right specify an array of right to specify the file * @return file path */ public static function get_textzone_file_path($key, $context = null, $right = null) { $textZoneFile = null; $key .= '.'; if (!is_null($right) && is_array($right)) { foreach ($right as $context => $rightInContext) { if (is_array($rightInContext)) { $key .= $context . '_'; foreach ($rightInContext as $rightName => $rightValue) { if (is_bool($rightValue)) { $key .= $rightValue ? $rightName : 'not_' . $rightName; } else { $key .= $rightName . '_' . $rightValue; } $key .= '.'; } } } } if (is_array($context) && array_key_exists(CLARO_CONTEXT_COURSE, $context)) { if (is_array($context) && array_key_exists(CLARO_CONTEXT_GROUP, $context)) { $textZoneFile = get_conf('coursesRepositorySys') . claro_get_course_group_path($context) . '/textzone/' . $key . 'inc.html'; } else { $textZoneFile = get_conf('coursesRepositorySys') . claro_get_course_path($context[CLARO_CONTEXT_COURSE]) . '/textzone/' . $key . 'inc.html'; } } if (is_null($textZoneFile)) { $textZoneFile = get_path('rootSys') . 'platform/textzone/' . $key . 'inc.html'; } pushClaroMessage($textZoneFile); return $textZoneFile; }
function ClaroPHPMailer() { //prevent phpMailer from echo'ing anything parent::__construct(true); // set charset $this->CharSet = get_locale('charset'); if (get_conf('smtp_host') != '') { // set smtp mode and smtp host $this->IsSMTP(); $this->Host = get_conf('smtp_host'); if (get_conf('smtp_username') != '') { // SMTP authentification $this->SMTPAuth = true; // turn on SMTP $this->Username = get_conf('smtp_username'); // SMTP username $this->Password = get_conf('smtp_password'); // SMTP password } if (get_conf('smtp_port') != '') { $this->Port = (int) get_conf('smtp_port'); } if (get_conf('smtp_secure') != '') { $this->SMTPSecure = get_conf('smtp_secure'); } } else { // set sendmail mode $this->IsMail(); } }
/** * Set the authentication profile options. Contains * $data['courseRegistrationAllowed'] with value true, false or null (let the platform decide) * $data['courseEnrolmentMode'] with value 'open', 'close', 'validation' or null (let the platform decide) * $data['defaultCourseProfile'] profile attributed by default to the user when registering to a new course or null * $data['editableProfileFields'] array of editable fileds in the user profile or null * @return $this */ public function setAuthDriverOptions($data) { if (isset($data['courseEnrolmentMode'])) { $this->courseEnrolmentMode = $data['courseEnrolmentMode']; } else { $this->courseEnrolmentMode = null; } if (isset($data['defaultCourseProfile']) && !is_null($data['defaultCourseProfile'])) { $this->defaultCourseProfile = $data['defaultCourseProfile']; } else { $this->defaultCourseProfile = 'user'; } if (isset($data['editableProfileFields']) && !empty($data['editableProfileFields'])) { $this->editableProfileFields = $data['editableProfileFields']; } else { load_kernel_config('user_profile'); if (empty($data['readonlyProfileFields'])) { $this->editableProfileFields = get_conf('profile_editable'); } else { $baseProfileFeilds = get_conf('profile_editable'); $this->editableProfileFields = array(); foreach ($baseProfileFeilds as $profileField) { if (!in_array($profileField, $data['readonlyProfileFields'])) { $this->editableProfileFields[] = $profileField; } } } } if (isset($data['courseRegistrationAllowed']) && !is_null($data['courseRegistrationAllowed'])) { $this->courseRegistrationAllowed = $data['courseRegistrationAllowed']; } else { $this->courseRegistrationAllowed = get_conf('allowToSelfEnroll', true); } return $this; }
/** * CLAROLINE * * @version $Revision: 13708 $ * @copyright (c) 2001-2011, Universite catholique de Louvain (UCL) * @license http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE * @package CLANN * @subpackage CLICAL * @author Claro Team <*****@*****.**> */ function CLANN_write_ical($iCal, $context) { if (is_array($context) && count($context) > 0) { $courseId = array_key_exists(CLARO_CONTEXT_COURSE, $context) ? $context[CLARO_CONTEXT_COURSE] : claro_get_current_course_id(); } require_once dirname(__FILE__) . '/../lib/announcement.lib.php'; $courseData = claro_get_course_data($courseId); $toolNameList = claro_get_tool_name_list(); $announcementList = announcement_get_item_list($context, 'DESC'); $organizer = (array) array($courseData['titular'], $courseData['email']); $attendees = array(); $categories = array(get_conf('siteName'), $courseData['officialCode'], trim($toolNameList['CLANN'])); foreach ($announcementList as $announcementItem) { if ('SHOW' == $announcementItem['visibility']) { /* $rssList[] = array( 'title' => trim($announcementItem['title']) , 'category' => trim($toolNameList['CLANN']) , 'guid' => get_module_url('CLANN') . '/announcements.php?cidReq='.claro_get_current_course_id().'&l#ann'.$announcementItem['id'] , 'link' => get_module_url('CLANN') . '/announcements.php?cidReq='.claro_get_current_course_id().'&l#ann'.$announcementItem['id'] , 'description' => trim(str_replace('<!-- content: html -->','',$announcementItem['content'])) , 'pubDate' => date('r', stripslashes(strtotime($announcementItem['time']))) //, 'author' => $_course['email'] ); */ $iCal->addJournal(trim($announcementItem['title']), trim(str_replace('<!-- content: html -->', '', $announcementItem['content'])), strtotime($announcementItem['time']), strtotime($announcementItem['time']), time(), 1, 1, $organizer, $attendees, $categories, 5, 10, 1, array(), 0, '', get_path('rootWeb') . get_module_url('CLANN') . '/announcements.php?cidReq=' . $courseId . '&l#ann' . $announcementItem['id'], get_locale('iso639_1_code'), ''); } } return $iCal; }
function getradacctlist($status = 'all', $nullsession = 'all', $sessions = 'all', $cause = 'all', $startdatefrom = NULL, $startdateto = NULL, $enddatefrom = NULL, $enddateto = NULL, $cid = NULL, $nid = NULL) { $status = strtolower($status); $nullsession = strtolower($nullsession); $sessions = strtolower($sessions); $cause = strtoupper($cause); if (!empty($startdatefrom)) { $startdatefrom = str_replace('/', '-', $startdatefrom); } if (!empty($startdateto)) { $startdateto = str_replace('/', '-', $startdateto); } if (!empty($enddatefrom)) { $enddatefrom = str_replace('/', '-', $enddatefrom); } if (!empty($enddateto)) { $enddateto = str_replace('/', '-', $enddateto); } $auth_login = strtolower(get_conf('radius.auth_login', 'id')); if (!in_array($auth_login, array('id', 'name', 'ip', 'passwd'))) { $auth_login = '******'; } $return = $this->DB->GetAll('SELECT r.radacctid, r.acctsessionid, r.username, r.nasipaddress, r.nasporttype, r.acctstarttime, r.servicetype ' . ', r.acctstoptime, r.acctterminatecause ' . ', r.acctsessiontime, r.acctinputoctets, r.acctoutputoctets, r.framedipaddress, UPPER(r.callingstationid) AS callingstationid ' . ', nass.name AS nasname, nass.netdevid AS nasid ' . ', n.id AS nodeid, n.name AS nodename , c.id AS cid' . ', ' . $this->DB->Concat('c.lastname', "' '", 'c.name') . ' AS customername ' . ($status == 'open' ? ', nd.maxid AS maxid ' : ', 0 AS maxid ') . 'FROM radacct r ' . ($status == 'open' ? 'JOIN ( SELECT MAX(radacctid) AS maxid, username FROM radacct GROUP BY username) nd ON (nd.username = r.username) ' : '') . ($this->DB->_dbtype != 'postgres' ? 'JOIN nas nass ON (nass.nasname = r.nasipaddress) ' : 'JOIN nas nass ON (nass.nasname::inet = r.nasipaddress) ') . ($auth_login == 'id' ? 'JOIN nodes n ON (n.id = r.username) ' : '') . ($auth_login == 'name' ? 'JOIN nodes n ON (upper(n.name) = upper(r.username)) ' : '') . ($auth_login == 'ip' ? 'JOIN nodes n ON (inet_ntoa(n.ipaddr) = r.username) ' : '') . ($auth_login == 'passwd' ? 'JOIN nodes n ON (n.passwd = r.username) ' : '') . ($auth_login == 'pppoe_login' ? 'JOIN nodes n ON (n.pppoelogin = r.username) ' : '') . 'JOIN customersview c ON (c.id = n.ownerid) ' . ($this->DB->_dbtype != 'postgres' ? ($status == 'open' ? ' WHERE (r.acctstoptime IS NULL OR r.acctstoptime=\'0000-00-00 00:00:00\') ' : '') . ($status == 'completed' ? ' WHERE r.acctstoptime IS NOT NULL AND r.acctstoptime!=\'0000-00-00 00:00:00\' ' : '') : ($status == 'open' ? ' WHERE (r.acctstoptime IS NULL OR r.acctstoptime=\'0001-01-01 00:00:00\') ' : '') . ($status == 'completed' ? ' WHERE r.acctstoptime IS NOT NULL AND r.acctstoptime!=\'0001-01-01 00:00:00\' ' : '')) . ($nullsession == 'tak' ? ' AND r.acctsessiontime = 0 ' : '') . ($nullsession == 'nie' ? ' AND r.acctsessiontime != 0 ' : '') . ($sessions == 'cur' && $status == 'open' ? ' AND r.radacctid = nd.maxid ' : '') . ($sessions == 'err' && $status == 'open' ? ' AND r.radacctid != nd.maxid ' : '') . (!empty($startdatefrom) ? " AND DATE(r.acctstarttime) >= '" . $startdatefrom . "'" : '') . (!empty($startdateto) ? " AND DATE(r.acctstarttime) <= '" . $startdateto . "'" : '') . (!empty($enddatefrom) ? " AND DATE(r.acctstoptime) >= '" . $enddatefrom . "'" : '') . (!empty($enddateto) ? " AND DATE(r.acctstoptime) <= '" . $enddateto . "'" : '') . ($status == 'completed' && $cause == 'NULL' ? " AND r.acctterminatecause=''" : '') . ($cid ? " AND c.id = '" . $cid . "'" : '') . ($nid ? " AND n.id = '" . $nid . "'" : '') . ($status == 'completed' && $cause != 'NULL' && $cause != 'ALL' ? " AND UPPER(r.acctterminatecause)='" . $cause . "'" : '') . ' ORDER BY r.acctstarttime DESC' . ';'); return $return; }
function getValue($cid, $year, $month) { global $DB; $start = mktime(0, 0, 0, $month, 1, $year); $end = mktime(23, 59, 59, $month, date("t", mktime(0, 0, 0, $month, 1, $year)), $year); $suspension_percentage = f_round(get_conf('finances.suspension_percentage', 0)); $sql = 'SELECT a.customerid, SUM((CASE a.suspended WHEN 0 THEN (((100 - a.pdiscount) * (CASE WHEN t.value IS NULL THEN l.value ELSE t.value END) / 100) - a.vdiscount) ELSE ((((100 - a.pdiscount) * (CASE WHEN t.value IS NULL THEN l.value ELSE t.value END) / 100) - a.vdiscount) * ' . $suspension_percentage . ' / 100) END) * (CASE t.period WHEN ' . MONTHLY . ' THEN 1 WHEN ' . YEARLY . ' THEN 1/12.0 WHEN ' . HALFYEARLY . ' THEN 1/6.0 WHEN ' . QUARTERLY . ' THEN 1/3.0 ELSE (CASE a.period WHEN ' . MONTHLY . ' THEN 1 WHEN ' . YEARLY . ' THEN 1/12.0 WHEN ' . HALFYEARLY . ' THEN 1/6.0 WHEN ' . QUARTERLY . ' THEN 1/3.0 ELSE 0 END) END) ) AS value FROM assignments a LEFT JOIN tariffs t ON (t.id = a.tariffid) LEFT JOIN liabilities l ON (l.id = a.liabilityid AND a.period != ' . DISPOSABLE . ') WHERE (a.datefrom <= ' . $start . ' OR a.datefrom = 0) AND (a.dateto >= ' . $end . ' OR a.dateto = 0) AND a.customerid = ' . $cid . ';'; $tmp = $DB->GetRow($sql); $val = str_replace(',', '.', sprintf('%01.2f', $tmp['value'])); return $val; }
public function render() { if ($this->hidden) { return '<!-- footer hidden -->' . "\n"; } $currentCourse = claro_get_current_course_data(); if (claro_is_in_a_course()) { $courseManagerOutput = '<div id="courseManager">' . get_lang('Manager(s) for %course_code', array('%course_code' => $currentCourse['officialCode'])) . ' : '; $currentCourseTitular = empty($currentCourse['titular']) ? get_lang('Course manager') : $currentCourse['titular']; if (empty($currentCourse['email'])) { $courseManagerOutput .= '<a href="' . get_module_url('CLUSR') . '/user.php">' . $currentCourseTitular . '</a>'; } else { $courseManagerOutput .= '<a href="mailto:' . $currentCourse['email'] . '?body=' . $currentCourse['officialCode'] . '&subject=[' . rawurlencode(get_conf('siteName')) . ']' . '">' . $currentCourseTitular . '</a>'; } $courseManagerOutput .= '</div>'; $this->assign('courseManager', $courseManagerOutput); } else { $this->assign('courseManager', ''); } $platformManagerOutput = '<div id="platformManager">' . get_lang('Administrator for %site_name', array('%site_name' => get_conf('siteName'))) . ' : ' . '<a href="mailto:' . get_conf('administrator_email') . '?subject=[' . rawurlencode(get_conf('siteName')) . ']' . '">' . get_conf('administrator_name') . '</a>'; if (get_conf('administrator_phone') != '') { $platformManagerOutput .= '<br />' . "\n" . get_lang('Phone : %phone_number', array('%phone_number' => get_conf('administrator_phone'))); } $platformManagerOutput .= '</div>'; $this->assign('platformManager', $platformManagerOutput); $poweredByOutput = '<span class="poweredBy">' . get_lang('Powered by') . ' <a href="http://www.claroline.net" target="_blank">Claroline</a> ' . '© 2001 - 2013' . '</span>'; $this->assign('poweredBy', $poweredByOutput); return parent::render(); }
function getThroughput($ip) { global $CONFIG; $result = new xajaxResponse(); $cmd = get_conf('phpui.live_traffic_helper'); if (empty($cmd)) { return $result; } $cmd = str_replace('%i', $ip, $cmd); exec($cmd, $output); if (!is_array($output) && count($output) != 1) { return $result; } $stats = explode(' ', $output[0]); if (count($stats) != 4) { return $result; } array_walk($stats, intval); foreach (array(0, 2) as $idx) { if ($stats[$idx] > 1000000) { $stats[$idx] = round(floatval($stats[$idx]) / 1000000.0, 2) . ' Mbit/s'; } elseif ($stats[$idx] > 1000) { $stats[$idx] = round(floatval($stats[$idx]) / 1000.0, 2) . ' Kbit/s'; } else { $stats[$idx] = $stats[$idx] . ' bit/s'; } } $result->assign('livetraffic', 'innerHTML', $stats[0] . ' / ' . $stats[2]); $result->call('live_traffic_finished'); return $result; }
public function export() { $postsList = $this->loadTopic($this->getTopicId()); $topicInfo = get_topic_settings($this->getTopicId()); $css = $this->importCss(); $form = new PhpTemplate(get_module_path('CLFRM') . '/templates/forum_export.tpl.php'); $form->assign('forum_id', $topicInfo['forum_id']); $form->assign('topic_id', $topicInfo['topic_id']); $form->assign('notification_bloc', false); $form->assign('topic_subject', $topicInfo['topic_title']); $form->assign('postList', $postsList); $form->assign('claro_notifier', false); $form->assign('is_allowedToEdit', false); $form->assign('date', null); $out = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n" . '<html>' . "\n" . '<head>' . "\n" . '<meta http-equiv="Content-Type" content="text/HTML; charset=' . get_conf('charset') . '" />' . "\n" . '<style type="text/css">' . $css . '</style>' . "\n" . '<title>' . $topicInfo['topic_title'] . '</title>' . "\n" . '</head>' . "\n" . '<body><div id="forumExport">' . "\n"; $out .= $form->render(); $out .= '</div></body>' . "\n" . '</html>'; $path = get_conf('rootSys') . get_conf('tmpPathSys') . '/forum_export/'; $filename = $path . replace_dangerous_char(str_replace(' ', '_', $topicInfo['topic_title']) . '_' . $topicInfo['topic_id']) . '.html'; claro_mkdir($path); file_put_contents($filename, $out); switch ($this->output) { case 'screen': header('Content-Description: File Transfer'); header('Content-Type: application/force-download'); header('Content-Length: ' . filesize($filename)); header('Content-Disposition: attachment; filename=' . basename($filename)); readfile($filename); claro_delete_file($filename); break; case 'file': break; } return true; }
public function __construct() { if (get_conf('course_order_by') == 'official_code') { $this->orderBy = self::ORDER_BY_OFFICIAL_CODE; } else { $this->orderBy = self::ORDER_BY_TITLE; } }
public function testCurlDo() { $res = \CashWay\cURL::curlDo(get_conf()['API_URL'], array()); $tr = json_decode($res['body'], true); $this->assertEquals('GET', $tr['method']); $this->assertEquals('/', $tr['request']); $this->assertEquals('200', $res['code']); }
function viewsponsorzy() { $obj = new xajaxResponse(); $info = get_conf('inetlms.sponsorzy', NULL); if (!$info) { $result = "<p style=\"margin-top:10px;\"><h1>Brak informacji</h1><h3>Pobranie danych o sponsorach nie jest możliwe.</h3></p>"; } else { $info = unserialize(base64_decode($info)); $cdate = $info['data']; if ($cdate < time() - 604800) { $update = pobierzdane(); if ($update) { aktualizacja($update); $info = unserialize(base64_decode($update)); } } $cdate = $info['data']; $dane = $info['dane']; $tab = $dane; $count = sizeof($tab); $j = 0; $width = 700; $result = "<p style=\"margin:4px 0 4px 0;\"><strong>Lista firm które wsparły finansowo projekt iNET LMS</strong></p>"; $result .= "<table style=\"width:" . $width . "px;border:0;\" cellpadding=\"3\" cellspacing=\"0\">"; for ($i = 0; $i < $count; $i++) { if (!empty($tab[$i][4])) { $j++; $result .= "<tr>\n\t <td width=\"1%\" nowrap align=\"center\" style=\"border: solid 1px #999999;border-bottom:0;\"><b> " . $j . " </b></td>\n\t <td width=\"1%\" nowrap align=\"center\" style=\"border-top:solid 1px #999999;border-right:solid 1px #999999;\"><b> " . $tab[$i][3] . "% </b></td>\n\t <td width=\"98%\" style=\"border-top:solid 1px #999999;border-right:solid 1px #999999;\">\n\t <b>" . $tab[$i][1] . "</b>"; if (!empty($tab[$i][2])) { $result .= "<br><font style=\"font-size:11px;\">" . $tab[$i][2] . "</font>"; } if (!empty($tab[$i][4])) { $result .= "<p style=\"margin:3px 0 3px 1px;\"><img src=\"img/bluepx.gif\" style=\"height:16px;width:" . $tab[$i][4] . "px;\"></p>"; } $result .= "</td></tr>"; } } $result .= "<tr><td colspan=\"3\" style=\"border-top:solid 1px #999999;\"></td></tr></table>"; $j = 0; $result .= "<p style=\"margin:10px 0 4px 0;\"><strong>Lista firm które wsparły projekt iNET LMS udostępniając kody źródłowe swoich rozwiązań</strong></p>"; $result .= "<table style=\"width:" . $width . "px;\" cellpadding=\"3\" cellspacing=\"0\">"; for ($i = 0; $i < $count; $i++) { if (empty($tab[$i][4])) { $j++; $result .= "<tr>\n\t <td width=\"1%\" nowrap align=\"center\" style=\"border: solid 1px #999999;border-bottom:0;\"><b> " . $j . " </b></td>\n\t <td width=\"99%\" style=\"border-top:solid 1px #999999;border-right:solid 1px #999999;\">\n\t <b>" . $tab[$i][1] . "</b>"; if (!empty($tab[$i][2])) { $result .= "<br><font style=\"font-size:12px;\">" . $tab[$i][2] . "</font>"; } $result .= "</td></tr>"; } } $result .= "<tr><td colspan=\"2\" style=\"border-top:solid 1px #999999;\"></td></tr>"; $result .= "</table>"; $result .= "<p style=\"color:green;font-size:10px;\">Stan na dzień " . date('Y/m/d', $cdate) . "</p>"; } $obj->assign('spons', 'innerHTML', $result); return $obj; }
/** * CLAROLINE * * @version 1.11 $Revision: 14315 $ * @copyright (c) 2001-2012, Universite catholique de Louvain (UCL) * @license http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE * @author Piraux Sebastien <*****@*****.**> * @author Lederer Guillaume <*****@*****.**> * @package CLLNP */ function get_xml_charset($xml) { $regex = '/<\\?xml(?:.*?)encoding="([a-zA-Z0-9\\-]+)"(?:.*?)\\s*\\?>/'; if (preg_match($regex, $xml, $matches)) { return $matches[1]; } else { return get_conf('charset'); } }
/** * 针对指定配置执行sql * @param unknown_type $module * @param unknown_type $sql */ protected function sql_clean($module, $sql) { $conf = get_conf($module); $ipaddr = $conf["mysql"]["ipaddr"]; $db = $conf["mysql"]["db"]; $user = $conf["mysql"]["user"]; $pwd = $conf["mysql"]["pwd"]; sql_execute($ipaddr, $db, $user, $pwd, $sql); }
public static function error($message) { // claro_failure::set_failure( $message ); if (claro_debug_mode()) { pushClaroMessage($message, self::ERROR); } if (get_conf('log_report_level', self::REPORT_LEVEL_ALL) >= self::REPORT_LEVEL_ERROR) { Claroline::log(self::ERROR, $message); } }
function buildRecords($exportUserInfo = true) { $tbl_mdb_names = claro_sql_get_main_tbl(); $tbl_user = $tbl_mdb_names['user']; $tbl_rel_course_user = $tbl_mdb_names['rel_course_user']; $tbl_cdb_names = claro_sql_get_course_tbl(claro_get_course_db_name_glued($this->course_id)); $tbl_team = $tbl_cdb_names['group_team']; $tbl_rel_team_user = $tbl_cdb_names['group_rel_team_user']; $username = claro_is_platform_admin() && get_conf('export_sensitive_data_for_admin', false) || get_conf('export_user_username', false) ? "`U`.`username` AS `username`," : ""; if (claro_is_platform_admin() && get_conf('export_sensitive_data_for_admin', false) || get_conf('export_user_password', false)) { if (claro_is_platform_admin() && get_conf('export_sensitive_data_for_admin', false) || get_conf('export_user_password_encrypted', true)) { $password = "******"; } else { $password = "******"; } } else { $password = ''; } // get user list $sql = "SELECT `U`.`user_id` AS `userId`,\n `U`.`nom` AS `lastname`,\n `U`.`prenom` AS `firstname`,\n {$username}\n {$password}\n `U`.`email` AS `email`,\n `U`.`officialCode` AS `officialCode`,\n GROUP_CONCAT(`G`.`id`) AS `groupId`,\n GROUP_CONCAT(`G`.`name`) AS `groupName`\n FROM\n (\n `" . $tbl_user . "` AS `U`,\n `" . $tbl_rel_course_user . "` AS `CU`\n )\n LEFT JOIN `" . $tbl_rel_team_user . "` AS `GU`\n ON `U`.`user_id` = `GU`.`user`\n LEFT JOIN `" . $tbl_team . "` AS `G`\n ON `GU`.`team` = `G`.`id`\n WHERE `U`.`user_id` = `CU`.`user_id`\n AND `CU`.`code_cours`= '" . claro_sql_escape($this->course_id) . "'\n GROUP BY U.`user_id`\n ORDER BY U.`user_id`"; $userList = claro_sql_query_fetch_all($sql); // build recordlist with good values for answers if (is_array($userList) && !empty($userList)) { // add titles at row 0, for that get the keys of the first row of array $this->recordList[0] = array_keys($userList[0]); $i = 1; $userIdList = array(); foreach ($userList as $user) { $userIdList[$user['userId']] = $i; if (!(claro_is_platform_admin() && get_conf('export_sensitive_data_for_admin', false) || get_conf('export_user_id', false))) { $user['userId'] = $i; } // $this->recordList is defined in parent class csv $this->recordList[$i] = $user; $i++; } if ($exportUserInfo) { $userInfoList = new UserInfoList($this->course_id); $userInfoLabelList = $userInfoList->getUserInfoLabels(); foreach ($userInfoLabelList as $catId => $catTitle) { $this->recordList[0][] = $catTitle; $userCatInfo = $userInfoList->getUserInfo($catId); foreach ($userCatInfo as $userCatInfo) { $this->recordList[$userIdList[$userCatInfo['userId']]][] = $userCatInfo['content']; } } } } if (is_array($this->recordList) && !empty($this->recordList)) { return true; } else { return false; } }
function module_main() { global $LMS, $HIPERUS, $SMARTY, $SESSION, $DB, $CONFIG; $SMARTY->assign('hiperusaccountcustomerlist', $HIPERUS->GetCustomerListList('name,asc', array('extid' => $SESSION->id))); $voipallinfo = false; $voipid = $_GET['voipid'] ? $_GET['voipid'] : ''; if (isset($_GET['voipid']) && !isset($_GET['print'])) { $cusid = intval($_GET['voipid']); $voipallinfo = true; if (isset($_GET['vprint'])) { $vprint = true; } else { $vprint = false; } if (isset($_GET['rok']) && !empty($_GET['rok'])) { $rok = (int) $_GET['rok']; } else { $rok = date('Y', time()); } if (isset($_GET['msc']) && !empty($_GET['msc'])) { $msc = (int) $_GET['msc']; } else { $msc = date('m', time()); } if (isset($_GET['terminal']) && !empty($_GET['terminal'])) { $terminal = $_GET['terminal']; } else { $terminal = $DB->GetOne('SELECT username FROM hv_terminal WHERE customerid=? LIMIT 1 ;', array($cusid)); } $SMARTY->assign('stvat', intval(get_conf('hiperus_c5.taxrate', get_conf('phpui.default_taxrate', '23'))) / 100 + 1); $SMARTY->assign('terminallist', $HIPERUS->GetTerminalOneOrList(NULL, $cusid)); $SMARTY->assign('terminal', $terminal); $SMARTY->assign('rok', $rok); $SMARTY->assign('msc', $msc); $SMARTY->assign('cusid', $cusid); $SMARTY->assign('subscription', $HIPERUS->GetSubscriptionByTerminalName($terminal)); $SMARTY->assign('billing', $HIPERUS->GetBillingByCustomer($cusid, $rok, $msc, NULL, NULL, $terminal)); $SMARTY->assign('listyear', $DB->GetAll('SELECT ' . $DB->YEAR('start_time') . ' AS rok FROM hv_billing GROUP BY rok')); $SMARTY->assign('cusname', strtoupper($DB->GetOne('SELECT name FROM hv_customers WHERE id=? LIMIT 1 ;', array($cusid)))); $SMARTY->assign('ctypename', array('incoming' => 'przy', 'outgoing' => 'wych', 'internal' => 'wew', 'disa' => 'disa', 'vpbx' => 'vpbx', 'forwarded' => 'prze')); $info['terminal'] = $HIPERUS->GetTerminalOneOrList(NULL, $cusid); $info['pstn'] = $HIPERUS->GetPSTNOneOrList(NULL, $cusid); $SMARTY->assign('hide_c5_passwd', $DB->GetOne('SELECT value FROM uiconfig WHERE section=? AND var=? LIMIT 1;', array('userpanel', 'hide_c5_passwd'))); $SMARTY->assign('info', $info); $SMARTY->assign('miesiace', array('1' => 'styczeń', '2' => 'luty', '3' => 'marzec', '4' => 'kwiecień', '5' => 'maj', '6' => 'czerwiec', '7' => 'lipiec', '8' => 'sierpień', '9' => 'wrzesień', '10' => 'październik', '11' => 'listopad', '12' => 'grudzień')); } if (isset($_GET['voipid']) && isset($_GET['print'])) { include 'billingprint.php'; } $SMARTY->assign('voipid', $voipid); $SMARTY->assign('voipallinfo', $voipallinfo); $SMARTY->display('module:infovoip.html'); }
function module_setup() { global $SMARTY, $DB, $USERPANEL, $layout, $LMS; $layout['pagetitle'] = trans('Userpanel Configuration'); $SMARTY->assign('logourl', get_conf('userpanel.logourl')); $SMARTY->assign('boxinfo1', get_conf('userpanel.boxinfo1')); $SMARTY->assign('boxinfo2', get_conf('userpanel.boxinfo2')); $SMARTY->assign('boxinfo3', get_conf('userpanel.boxinfo3')); $SMARTY->assign('boxinfo4', get_conf('userpanel.boxinfo4')); $SMARTY->assign('total', sizeof($USERPANEL->MODULES)); $SMARTY->assign('disable_modules', unserialize(get_conf('userpanel.disable_modules', 'a:0:{}'))); $SMARTY->display(USERPANEL_DIR . '/templates/setup.html'); }
function country_conf_currency($html = false) { $id = get_conf(__FILE__, __LINE__, 'country'); $country = new country($id); $curr_lett = $country->data['currency_letter']; if (!$html) { return $curr_lett; } $curr_html = $country->data['currency_html']; if (empty($curr_html)) { return $curr_lett; } return $curr_html; }
/** * get all the items * * @param $courseId string glued dbName of the course to affect default: current course * * @return array of arrays with data of the item * * @author Christophe Gesché <*****@*****.**> * */ function course_description_get_item_list($courseId = null) { $tbl = claro_sql_get_course_tbl(claro_get_course_db_name_glued($courseId)); $tblCourseDescription = $tbl['course_description']; if (get_conf('cldsc_use_new_ordering_of_labels')) { // sort first the principal categories $sql = "SELECT `cd`.`id`,\n\t `cd`.`category`,\n\t `cd`.`title`,\n\t `cd`.`content`,\n\t UNIX_TIMESTAMP(cd.`lastEditDate`)\n\t AS `unix_lastEditDate`,\n\t `cd`.`visibility`\n\t FROM `" . $tblCourseDescription . "` AS `cd`\n\t WHERE `cd`.`category` != '-1'\n\t ORDER BY `cd`.`category` ASC"; // and then the "other" category ... by title $sql2 = "SELECT cd.`id`,\n\t cd.`category`,\n\t cd.`title`,\n\t cd.`content`,\n\t UNIX_TIMESTAMP(`cd`.`lastEditDate`)\n\t AS `unix_lastEditDate`,\n\t `cd`.`visibility`\n\t FROM `" . $tblCourseDescription . "` AS `cd`\n\t WHERE `cd`.`category` = '-1'\n\t ORDER BY `cd`.`title` ASC"; return array_merge(claro_sql_query_fetch_all($sql), claro_sql_query_fetch_all($sql2)); } else { $sql = "SELECT `cd`.`id`,\n\t `cd`.`category`,\n\t `cd`.`title`,\n\t `cd`.`content`,\n\t UNIX_TIMESTAMP(cd.`lastEditDate`)\n\t AS `unix_lastEditDate`,\n\t `cd`.`visibility`\n\t FROM `" . $tblCourseDescription . "` AS `cd`\n\t ORDER BY `cd`.`category` ASC"; return claro_sql_query_fetch_all($sql); } }
public static function setForUser($_uid) { $tbl = claro_sql_get_main_tbl(); $ssoCookieExpireTime = time() + get_conf('ssoCookiePeriodValidity', 3600); $ssoCookieValue = md5(time() . rand(100, 1000000)); $sql = "UPDATE `{$tbl['sso']}`\n" . "SET cookie = '" . $ssoCookieValue . "',\n" . "rec_time = NOW()\n" . "WHERE user_id = " . (int) $_uid; $affectedRowCount = claro_sql_query_affected_rows($sql); if ($affectedRowCount < 1) { $sql = "INSERT INTO `{$tbl['sso']}`\n" . "SET cookie = '" . $ssoCookieValue . "',\n" . "rec_time = NOW(),\n" . "user_id = " . (int) $_uid; claro_sql_query($sql); } return setcookie(get_conf('ssoCookieName', 'clarolineSsoCookie'), $ssoCookieValue, $ssoCookieExpireTime, get_conf('ssoCookiePath', '/'), get_conf('ssoCookieDomain', 'sso.claroline.net')); // Note. $ssoCookieName, $ssoCookieValussoCookieExpireTime, // $soCookiePath and $ssoCookieDomain are coming from // claroline/inc/conf/auth.conf.php }
/** * Load user properties from database */ public function loadFromDatabase() { $tbl = claro_sql_get_main_tbl(); $sqlUserId = (int) $this->_userId; $sql = "SELECT " . "`user`.`user_id` AS userId,\n" . "`user`.`username`,\n" . "`user`.`prenom` AS firstName,\n" . "`user`.`nom` AS lastName,\n" . "`user`.`email`AS `mail`,\n" . "`user`.`officialEmail` AS `officialEmail`,\n" . "`user`.`language`,\n" . "`user`.`isCourseCreator`,\n" . "`user`.`isPlatformAdmin`,\n" . "`user`.`creatorId` AS creatorId,\n" . "`user`.`officialCode`,\n" . "`user`.`language`,\n" . "`user`.`authSource`,\n" . "`user`.`phoneNumber` AS `phone`,\n" . "`user`.`pictureUri` AS `picture`,\n" . (get_conf('is_trackingEnabled') ? "UNIX_TIMESTAMP(`tracking`.`date`) " : "DATE_SUB(CURDATE(), INTERVAL 1 DAY) ") . "AS lastLogin\n" . "FROM `{$tbl['user']}` AS `user`\n" . (get_conf('is_trackingEnabled') ? "LEFT JOIN `{$tbl['tracking_event']}` AS `tracking`\n" . "ON `user`.`user_id` = `tracking`.`user_id`\n" . "AND `tracking`.`type` = 'user_login'\n" : '') . "WHERE `user`.`user_id` = " . $sqlUserId . "\n" . (get_conf('is_trackingEnabled') ? "ORDER BY `tracking`.`date` DESC LIMIT 1" : ''); $userData = Claroline::getDatabase()->query($sql)->fetch(); if (!$userData) { throw new Exception("Cannot load user data for {$this->_userId}"); } else { $userData['isPlatformAdmin'] = (bool) $userData['isPlatformAdmin']; $userData['isCourseCreator'] = (bool) $userData['isCourseCreator']; $this->_rawData = $userData; pushClaroMessage("User {$this->_userId} loaded from database", 'debug'); $this->loadUserProperties(); } }
public function getFilePath($requestedUrl) { if (claro_is_in_a_course()) { $intermediatePath = get_path('coursesRepositorySys') . claro_get_course_path() . '/document'; } else { $intermediatePath = rtrim(str_replace('\\', '/', get_path('rootSys')), '/') . '/platform/document'; } if (get_conf('secureDocumentDownload') && $GLOBALS['is_Apache']) { // pretty url $path = realpath($intermediatePath . '/' . $requestedUrl); } else { // TODO check if we can remove rawurldecode $path = $intermediatePath . implode('/', array_map('rawurldecode', explode('/', $requestedUrl))); } return $path; }
function init_default_right_profile() { require_once get_conf('includePath') . '/lib/right/profileToolRight.class.php'; $tbl_mdb_names = claro_sql_get_tbl(array('course_tool', 'right_profile', 'right_rel_profile_action', 'right_action')); $sql = " SELECT `id` as `toolId`\n FROM `" . $tbl_mdb_names['course_tool'] . "`"; $result = claro_sql_query_fetch_all_cols($sql); $toolList = $result['toolId']; /** * Initialise anonymous profile */ $profile = new RightProfile(); $profile->load(claro_get_profile_id(ANONYMOUS_PROFILE)); $profileAction = new RightProfileToolRight(); $profileAction->load($profile); $profileAction->setToolListRight($toolList, 'user'); $profileAction->save(); /** * Initialise guest profile */ $profile = new RightProfile(); $profile->load(claro_get_profile_id(GUEST_PROFILE)); $profileAction = new RightProfileToolRight(); $profileAction->load($profile); $profileAction->setToolListRight($toolList, 'user'); $profileAction->save(); /** * Initialise user profile */ $profile = new RightProfile(); $profile->load(claro_get_profile_id(USER_PROFILE)); $profileAction = new RightProfileToolRight(); $profileAction->load($profile); $profileAction->setToolListRight($toolList, 'user'); $profileAction->save(); /** * Initialise manager profile */ $profile = new RightProfile(); $profile->load(claro_get_profile_id(MANAGER_PROFILE)); $profileAction = new RightProfileToolRight(); $profileAction->load($profile); $profileAction->setToolListRight($toolList, 'manager'); $profileAction->save(); return true; }
public function render() { $out = ''; if (!claro_is_user_authenticated()) { if (get_conf('claro_displayLocalAuthForm', true) == true) { $out .= $this->renderLoginLink(); } } elseif (!claro_is_platform_admin() && (claro_is_in_a_course() && !claro_is_course_member()) && claro_get_current_course_data('registrationAllowed')) { if (claro_is_current_user_enrolment_pending()) { $out .= '<img src="' . get_icon_url('warning') . '" alt="off" /> ' . '<b>' . get_lang('Enrolment pending') . '</b>'; } else { $out .= $this->renderRegistrationLink(); } } elseif (claro_is_display_mode_available()) { $out .= $this->renderViewModeSwitch(); } return $out; }
function wphp_custom_after_instance() { $timer = get_conf('timer'); $timer->end(); // echo "<br>\r\n"; // echo $timer->time(), ' s'; return; echo '<div style="display:none"><pre>'; echo '<br><br>$_GET = '; var_export($_GET); echo '<br><br>$_POST = '; var_export($_POST); echo '<br><br>$_COOKIE = '; var_export($_COOKIE); echo '<br><br>$_SERVER = '; var_export($_SERVER); echo '</pre></div>'; }