* @version $Id$ * @access public * @license http://opensource.org/licenses/gpl-3.0.html */ include_once('../user/'.SQL.'.inc.php'); require_once ('../news/mysql.inc.php'); // import the Intervention Image Manager Class use Intervention\Image\ImageManagerStatic as Image; if (! function_exists ( 'getLatestContrib' )) { function getLatestContrib($nb, $module_id, $chars = 100) { global $sql_object; $loop = ''; $options = array('module' => 'contribute', 'module_id' => $module_id, 'order_by' => 'DESC', 'limit' => $nb); $data = $sql_object->DBSelect(SQL_getComments($options)); if(is_array($data)) { foreach ($data as $c) { // get fullname if($c['comment_user_id'] != 0) { $fullname = $c['user_login']; if(!empty($c['profile_firstname']) || !empty($c['profile_lastname'])) $fullname .= ' ('.$c['profile_firstname']. ' '.$c['profile_lastname'].')'; } else { $fullname = $c['comment_name']; } $link = HrefMaker(array('rub' => $GLOBALS['links'][U_L]['contribute']['linkvalue'], '#' => 'com-' . $c['comment_id']));; $loop .= '
'._t('divers', 'nodata').'
'; } return sprintf(''._t('divers', 'nodata').'
'; } return $content; } } if(!function_exists('getIncomingEvents')) { function getIncomingEvents($nb) { global $sql_object; $data= $sql_object->DBSelect(SQLget_incomingEvents($nb)); if($data!=0) { $content= ''._t('divers', 'nodata').'
'; } return $content; } } if(!function_exists('getEvents')) { function getEvents($nb) { global $sql_object; $data= $sql_object->DBSelect(SQLget_Events($nb)); if($data!=0) { $content= ''._t('divers', 'nodata').'
'; } return $content; } } if(!function_exists('getWorkgroupList')) { function getWorkgroupList($nb) { global $sql_object; $data= $sql_object->DBSelect(SQLget_WorkshopList($nb)); if($data!=0) { $content= ' '; for($i=0; $i'._t('divers','nodata').'
'; } return $content; } } if (! function_exists ( 'DisplayLastNews' )) { function DisplayLastNews($nb) { $display_comments = true; $link = HrefMaker(array('rub'=> $GLOBALS['links'][U_L]['news']['linkvalue'])); $data = $GLOBALS ['sql_object']->DBSelect ( SQL_getNewsList ( 0, $nb, 'public' ) ); $content = ''; $content .= '' . PHP_EOL; if(commentEnabled('news') && $display_comments == true) { $content .= getCommentsNumbers(array('module'=> 'news', 'module_id'=> $data[$i]['news_id'], 'link_to_comments'=> $link_detail + array('#' => 'comments'))); } $content .= ''._t('statut','published_on') . ' ' . $news_posted_on . ' '; $content .= _t('divers','by').' ' . $news_posted_by . ''; $content .= '
' . PHP_EOL; $content .= ''._t('btn', 'read_more').''; $content .= '' . _t('divers','nodata') . '
'; } $content .= ''; $content.=_t('public','edito'); $content.='
'.PHP_EOL; $content.=''; $content.=''; //$content.=_t('public','workgroup_edito'); $content .= ' '; $content.=''; $content.='
'.PHP_EOL; $content.=''; $content.=''; // $content.=_t('public','dashboard_edito'); $content.= ' '; $content.=''; $content.='
'.PHP_EOL; $content.=''. _t('auth','note') . '
' . PHP_EOL; if(isset($msg)) $form .= $msg . PHP_EOL; $form .= '' . PHP_EOL; return $form; } } /** * AuthForm() * Formulaire d'authentification pour login ou inscription * * @param string $todo * @return void (echo string) */ if(!function_exists('AuthForm')) { function AuthForm($todo = 'LOGON', $back = 1 , $usero = null) { // if back == 1 but there is no redirect page we get it if($back === 1) $back = get_referer(true); else { // handle redirect when user is not authenticated if(isset($_GET['refer'])) { $back = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://".$_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']; if(!empty($_SERVER['QUERY_STRING'])) $back .= '?' . htmlspecialchars($_SERVER['QUERY_STRING'], ENT_QUOTES, CHARSET); } // if redirect page is set we go to it elseif(is_string($back)) $back = $back; // else only, we go to public page else $back = CURRENT_APP_URL; } isset($_POST['login']) ? $form_login = formatText($_POST['login'], '2FIELD') : $form_login = ''; isset($_POST['email']) ? $form_email = formatText($_POST['email'], '2FIELD') : $form_email = ''; isset($_POST['firstname']) ? $form_firstname = formatText(trim($_POST['firstname']), '2FIELD') : $form_firstname = ''; isset($_POST['lastname']) ? $form_lastname = formatText(trim($_POST['lastname']), '2FIELD') : $form_lastname = ''; $form_password = ''; if ($todo == 'LOGON') { $input_hidden = $GLOBALS['links'][U_L]['user-prefs']['linkvalue']; $div_id = 'logon'; } else { $input_hidden = $GLOBALS['links'][U_L]['user-registration']['linkvalue']; $div_id = 'subscribe'; $pwdsec = []; if (defined('PASSWD_STRENGTH')) { if (strpos(PASSWD_STRENGTH, 'a') !== false) array_push($pwdsec, _t('user', 'lowercase_char') ); if (strpos(PASSWD_STRENGTH, 'A') !== false) array_push($pwdsec, _t('user', 'uppercase_char') ) . '' . _t('user', 'security_policy') . ''. sprintf(_t('user', 'security_policy_msg'), join(', ', $pwdsec)) .'
'; } } $link_pass = array('rub' => $GLOBALS['links'][U_L]['forgot-password']['linkvalue']); $form = '
' . PHP_EOL; return $form; } } /** * MyGroups() * Return groups user has subscribed to * nothing if no groups * @return string */ if(!function_exists('MyGroups')) { function MyGroups() { if(!isset($_COOKIE['linea21']['workshop']) || !isset($_SESSION['authenticated'])) return false; global $sql_object; $link_account = array('rub' => $GLOBALS['links'][U_L]['user-prefs']['linkvalue']); // get and prepare user groups $groups = base64_decode($_COOKIE['linea21']['workshop']); if($groups[0]=='/') $groups = substr($groups, 1); // removing first separator if(!empty($groups)) { $groups = @explode('/',$groups); $data= $sql_object->DBSelect(SQL_Get_WorkshopsNames($groups)); } else { $data=0; } $content = ''._t('divers','actu_left').'
'; $content.= ''._t('divers','nodata').'
'; } $content.= '