{$ax['no_way']}

\n"; exit; } function buttonsValid($buttons,$range) { global $pSet; if (empty($buttons)) { return true; } foreach (explode(',',$buttons) as $buttonNr) { if (substr_count($buttons.',',$buttonNr.',') > 1 or strpos($range.',',$buttonNr.',') === false) { return false; } } return true; } function fieldsValid($fields,$range) { if (empty($fields)) { return false; } foreach (str_split($fields) as $fieldNr) { if (substr_count($range,$fieldNr) != 1) { return false; } } return true; } //set lcconfig params $calMenu = isset($_POST['calMenu']) ? $_POST['calMenu'] : 0; //calendar menu in Opt panel $cronHost = isset($_POST['cronHost']) ? $_POST['cronHost'] : $crHost; //cron service host $cronIpAd = isset($_POST['cronIpAd']) ? $_POST['cronIpAd'] : $crIpAd; //cron service Ip address if (isset($_POST["save"])) { //get posted settings foreach ($defSet as $key => $void) { if (!isset($_POST['pSet'][$key])) { $pSet[$key] = 0; //set unchecked check box to unchecked } else { $pSet[$key] = is_int($defSet[$key][0]) ? intval($_POST['pSet'][$key]) : trim($_POST['pSet'][$key]); //make int-strings integers } } } else { //get current settings foreach ($defSet as $key => $value) { $pSet[$key] = isset($set[$key]) ? $set[$key] : $value[0]; } } if (isset($_POST["mail"])) { //send test mail $msgBody = "

{$ax['set_mail_sent_from']}.

"; $recipient = sendEml($ax['set_test_mail'],$msgBody,$pSet['calendarEmail'],1,0,0); $msg .= $ax['set_mail_sent_to'].' '.$recipient; } //preprocessing - comma separate $pSet['viewsPublic'] = trim(preg_replace('%(\d)(?!0|,|$)%',"$1,",$pSet['viewsPublic']),' ,'); $pSet['viewsLogged'] = trim(preg_replace('%(\d)(?!0|,|$)%',"$1,",$pSet['viewsLogged']),' ,'); $pSet['viewButsPub'] = trim(preg_replace('%(\d)(?!0|,|$)%',"$1,",$pSet['viewButsPub']),' ,'); $pSet['viewButsLog'] = trim(preg_replace('%(\d)(?!0|,|$)%',"$1,",$pSet['viewButsLog']),' ,'); $pSet['recipList'] = trim(preg_replace("%[\s\\\\<>]%",'',$pSet['recipList']),' ,;.'); $pSet['smsCountry'] = ltrim($pSet['smsCountry'],'+0'); $eClass = 'warning'; $errors = array_fill(0, 51, ''); $e = 0; //init if (isset($_POST["save"])) { //validate settings if (!$pSet['calendarTitle']) { $errors[$e] = ' class="inputError"'; } $e++; if (!$pSet['calendarUrl'] or !preg_match($rxCalURL,$pSet['calendarUrl'])) { $errors[$e] = " class='inputError'"; } $e++; if (substr($pSet['calendarUrl'],0,4) != 'http') { $pSet['calendarUrl'] = 'http://'.$pSet['calendarUrl']; } if (!$pSet['calendarEmail'] or !preg_match($rxEmailX, $pSet['calendarEmail'])) { $errors[$e] = " class='inputError'"; } $e++; //xxx if ($pSet['backLinkUrl'] and substr($pSet['backLinkUrl'],0,4) != 'http') { $pSet['backLinkUrl'] = 'http://'.$pSet['backLinkUrl']; } if (!$pSet['timeZone'] or !@date_default_timezone_set($pSet['timeZone'])) { $errors[$e] = " class='inputError'"; } $e++; if ($pSet['notifChange'] and !preg_match ('%^([^@;]+@[^@;]+?\.\w+;|\d{8,14};|\w+;)+$%',$pSet['recipList'].';')) { $errors[$e] = " class='inputError'"; } $e++; if (!preg_match ('%^(([1-9]|10),\s*)*([1-9]|10)$%',$pSet['viewsPublic'])) { $errors[$e] = " class='inputError'"; } $e++; if (!preg_match ('%^(([1-9]|10),\s*)*([1-9]|10)$%',$pSet['viewsLogged'])) { $errors[$e] = " class='inputError'"; } $e++; if (!buttonsValid($pSet['viewButsPub'],$pSet['viewsPublic'])) { $errors[$e] = " class='inputError'"; } $e++; if (!buttonsValid($pSet['viewButsLog'],$pSet['viewsLogged'])) { $errors[$e] = " class='inputError'"; } $e++; if (strpos($pSet['viewsPublic'].',',strval($pSet['defViewPub']).',') === false) { $errors[$e] = " class='inputError'"; } $e++; if (strpos($pSet['viewsLogged'].',',strval($pSet['defViewLog']).',') === false) { $errors[$e] = " class='inputError'"; } $e++; if ($pSet['cookieExp'] < 1 or $pSet['cookieExp'] > 365) { $errors[$e] = " class='inputError'"; } $e++; if (!fieldsValid($pSet['evtTemplGen'],' 12345678')) { $errors[$e] = " class='inputError'"; } $e++; if (!fieldsValid($pSet['evtTemplUpc'],' 12345678')) { $errors[$e] = " class='inputError'"; } $e++; if (!fieldsValid($pSet['evtTemplPop'],' 12345678')) { $errors[$e] = " class='inputError'"; } $e++; if ($pSet['yearStart'] < 0 or $pSet['yearStart'] > 12) { $errors[$e] = " class='inputError'"; } $e++; if ($pSet['YvRowsToShow'] < 1 or $pSet['YvRowsToShow'] > 10) { $errors[$e] = " class='inputError'"; } $e++; if ($pSet['YvColsToShow'] < 1 or $pSet['YvColsToShow'] > 6) { $errors[$e] = " class='inputError'"; } $e++; if ($pSet['MvWeeksToShow'] < 0 or $pSet['MvWeeksToShow'] > 20) { $errors[$e] = " class='inputError'"; } $e++; if (!preg_match("/^[0-6]{1,7}$/", $pSet['workWeekDays'])) { $errors[$e] = " class='inputError'"; } $e++; if ($pSet['weekStart'] < 0 or $pSet['weekStart'] > 6) { $errors[$e] = " class='inputError'"; } $e++; if ($pSet['XvWeeksToShow'] < 4 or $pSet['XvWeeksToShow'] > 20) { $errors[$e] = " class='inputError'"; } $e++; if ($pSet['lookaheadDays'] < 1 or $pSet['lookaheadDays'] > 365) { $errors[$e] = " class='inputError'"; } $e++; if ($pSet['dwStartHour'] < 0 or $pSet['dwStartHour'] > 18 or $pSet['dwStartHour'] > ($pSet['dwEndHour'] - 4)) { $errors[$e] = " class='inputError'"; } $e++; if ($pSet['dwEndHour'] > 24 or $pSet['dwEndHour'] < 6 or $pSet['dwStartHour'] > ($pSet['dwEndHour'] - 4)) { $errors[$e] = " class='inputError'"; } $e++; if ($pSet['dwTsHeight'] < 10 or $pSet['dwTsHeight'] > 60) { $errors[$e] = " class='inputError'"; } $e++; //the following regexs use lookahead assertion if (!preg_match ('%^([ymd])([^\da-zA-Z])(?!\1)([ymd])\2(?!(\1|\3))[ymd]$%',$pSet['dateFormat'])) { $errors[$e] = " class='inputError'"; } $e++; if (!preg_match ('%^([Md])[^\da-zA-Z]+(?!\1)[Md]$%',$pSet['MdFormat'])) { $errors[$e] = " class='inputError'"; } $e++; if (!preg_match ('%^([Myd])[^\da-zA-Z]+(?!\1)([Myd])[^\da-zA-Z]+(?!(\1|\2))[Myd]$%',$pSet['MdyFormat'])) { $errors[$e] = " class='inputError'"; } $e++; if (!preg_match ('%^([My])[^\da-zA-Z]+(?!\1)[My]$%',$pSet['MyFormat'])) { $errors[$e] = " class='inputError'"; } $e++; if (!preg_match ('%^(WD|[Md])[^\da-zA-Z]+(?!\1)(WD|[Md])[^\da-zA-Z]+(?!(\1|\2))(WD|[Md])$%',$pSet['DMdFormat'])) { $errors[$e] = " class='inputError'"; } $e++; if (!preg_match ('%^(WD|[Mdy])[^\da-zA-Z]+(?!\1)(WD|[Mdy])[^\da-zA-Z]+(?!(\1|\2))(WD|[Mdy])[^\da-zA-Z]+(?!(\1|\2\3))(WD|[Mdy])$%',$pSet['DMdyFormat'])) { $errors[$e] = " class='inputError'"; } $e++; if (!preg_match ('%^([Hhm])[^\da-zA-Z](?!\1)[Hhm](\s?[aA])?$%',$pSet['timeFormat'])) { $errors[$e] = " class='inputError'"; } $e++; if ($pSet['maxUplSize'] < 1 or $pSet['maxUplSize'] > 6) { $errors[$e] = " class='inputError'"; } $e++; if ($pSet['tnlMaxW'] < 10 or $pSet['tnlMaxW'] > 800) { $errors[$e] = " class='inputError'"; } $e++; if ($pSet['tnlMaxH'] < 10 or $pSet['tnlMaxH'] > 800) { $errors[$e] = " class='inputError'"; } $e++; if ($pSet['tnlDelDays'] < 0 or $pSet['tnlDelDays'] > 99) { $errors[$e] = " class='inputError'"; } $e++; if (!$pSet['smtpServer'] and $pSet['mailServer'] == 2) { $errors[$e] = " class='inputError'"; } $e++; if ($pSet['smtpPort'] < 0 or $pSet['smtpPort'] > 10025) { $errors[$e] = " class='inputError'"; } $e++; //10025 max port nr for SMTP if (!$pSet['smtpUser'] and $pSet['smtpAuth'] and $pSet['mailServer'] == 2) { $errors[$e] = " class='inputError'"; } $e++; if (!$pSet['smtpPass'] and $pSet['smtpAuth'] and $pSet['mailServer'] == 2) { $errors[$e] = " class='inputError'"; } $e++; if ($pSet['smsService'] and $pSet['smsSubject'] and !$pSet['calendarPhone'] and !$pSet['notSenderSms']) { $errors[$e] = " class='inputError'"; } $e++; //xxx if ($pSet['smsService'] and !preg_match ('%^[^#@]*#[^#@]*?@([^@\.]+?\.)+[\w]+$%',$pSet['smsCarrier'])) { $errors[$e] = " class='inputError'"; } $e++; if ($pSet['smsService'] and $pSet['smsCountry'] and !is_numeric($pSet['smsCountry'])) { $errors[$e] = " class='inputError'"; } $e++; if ($pSet['maxLenSms'] < 70 or $pSet['maxLenSms'] > 500) { $errors[$e] = " class='inputError'"; } $e++; if ($cronHost == 2 and !preg_match('%(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){4}%',$cronIpAd.'.')) { $errors[$e] = " class='inputError'"; } $e++; if ($pSet['chgNofDays'] < 0 or $pSet['chgNofDays'] > 30) { $errors[$e] = " class='inputError'"; } $e++; if ($pSet['eventExp'] < 0 or $pSet['eventExp'] > 999) { $errors[$e] = " class='inputError'"; } $e++; if ($pSet['maxNoLogin'] < 0 or $pSet['maxNoLogin'] > 365) { $errors[$e] = " class='inputError'"; } $e++; if (!empty($pSet['popFieldsSbar']) and !fieldsValid($pSet['popFieldsSbar'],' 1234567')) { $errors[$e] = " class='inputError'"; } $e++; if ($pSet['sideBarDays'] < 1 or $pSet['sideBarDays'] > 365) { $errors[$e] = " class='inputError'"; } $e++; //no errors, save settings in database if (!in_array(" class='inputError'",$errors)) { if ($dbSel != $calMenu or $crHost != $cronHost or $crIpAd != $cronIpAd) { $dbSel = $calMenu; $crHost = $cronHost; $crIpAd = $cronIpAd; saveConfig(); //save config data } saveSettings($pSet); $msg = $ax['set_settings_saved']; } else { //errors found $msg .= $ax['set_missing_invalid']; $eClass = 'error'; } } echo "

".(($msg) ? $msg : $ax['hover_for_details'])."

\n
\n"; //display form fields echo "
"; $e = 0; //init errors index echo "
{$ax['set_general_settings']}
{$ax['versions_label']}: LuxCal {$ax['calendar']}: ".LCV." (".($dbType == 'SQLite' ? $dbDir : '')."{$calID})
PHP: ".phpversion()." - Show info
".ucfirst($ax['database']).": {$dbType} V".$dbH->getAttribute(PDO::ATTR_SERVER_VERSION)."
{$ax['calTitle_label']}:
{$ax['calUrl_label']}:
{$ax['calEmail_label']}:
{$ax['logoPath_label']}:
{$ax['backLinkUrl_label']}:
{$ax['timeZone_label']}: {$ax['see']}: [{$ax['time_zones']}]
{$ax['notifChange_label']}:    {$ax['recipList']}:
{$ax['rssFeed_label']}:
{$ax['logging_label']}:      
\n"; echo "
{$ax['set_navbar_settings']}
{$ax['contact_label']}:
{$ax['optionsPanel_label']}:               
{$ax['availViews_label']}: {$ax['public']}:    {$ax['logged_in']}:
{$ax['viewButtons_label']}: {$ax['public']}:    {$ax['logged_in']}:
{$ax['defaultView_label']}: {$ax['public']}:    {$ax['logged_in']}:
{$ax['language_label']}:
\n"; echo "
{$ax['set_event_settings']}
{$ax['ownerTitle_label']}:
{$ax['privEvents_label']}:
{$ax['aldDefault_label']}:
{$ax['details4All_label']}:        
{$ax['evtDelButton_label']}:        
{$ax['eventColor_label']}:    
{$ax['xField1_label']}: {$ax['xField_label']}:    
{$ax['xField2_label']}: {$ax['xField_label']}:    
\n"; echo "
{$ax['set_user_settings']}
{$ax['selfReg_label']}:    {$ax['user_group']}
{$ax['selfRegNot_label']}:
{$ax['restLastSel_label']}:
{$ax['cookieExp_label']}: (1 - 365)
\n"; echo "
{$ax['set_view_settings']}
'.$ax['templFields_text'])."', 'normal')\">{$ax['evtTemplate_label']}: {$ax['evtTemplGen']}:     {$ax['evtTemplUpc']}:     {$ax['evtTemplPop']}:
{$ax['yearStart_label']}: (1 - 12 {$ax['or']} 0)
{$ax['YvRowsColumns_label']}: {$ax['rows']} (1 - 10)    {$ax['columns']} (1 - 6)
{$ax['MvWeeksToShow_label']}: (2 - 20 {$ax['or']} 0 {$ax['or']} 1)
{$ax['workWeekDays_label']}: (0: {$wkDays_l[0]}, 1: {$wkDays_l[1]} .... 6: {$wkDays_l[6]})
{$ax['weekStart_label']}: (0: {$wkDays_l[0]}, 1: {$wkDays_l[1]} .... 6: {$wkDays_l[6]})
{$ax['XvWeeksToShow_label']}: (4 - 20)
{$ax['lookaheadDays_label']}: (1 - 365)
{$ax['dwStartEndHour_label']}: (0 - 18)   (6 - 24)
{$ax['dwTimeSlot_label']}: {$ax['minutes']}
{$ax['dwTsHeight_label']}: {$ax['pixels']} (10 - 60)
{$ax['showInMView_label']}:      
{$ax['monthInDCell_label']}:
\n"; echo "
{$ax['set_dt_settings']}
{$ax['dateFormat_label']}: ({$ax['dateFormat_expl']})
{$ax['MdFormat_label']}: ({$ax['MdFormat_expl']})
{$ax['MdyFormat_label']}: ({$ax['MdyFormat_expl']})
{$ax['MyFormat_label']}: ({$ax['MyFormat_expl']})
{$ax['DMdFormat_label']}: ({$ax['DMdFormat_expl']})
{$ax['DMdyFormat_label']}: ({$ax['DMdyFormat_expl']})
{$ax['timeFormat_label']}: ({$ax['timeFormat_expl']})
{$ax['weekNumber_label']}:
\n"; echo "
{$ax['set_upload_settings']}
{$ax['maxUplSize_label']}: {$ax['mbytes']}
{$ax['attTypes_label']}:
{$ax['tnlTypes_label']}:
{$ax['tnlMaxSize_label']}:  x  {$ax['wxhinpx']} (10 - 800)
{$ax['tnlDelDays_label']}: {$ax['days']}
\n"; echo "
{$ax['set_reminder_settings']}
{$ax['services_label']}:   
{$ax['general']}
{$ax['defRecips_label']}:
{$ax['email']}
{$ax['notSenderEml_label']}:    
{$ax['mailServer_label']}:    
{$ax['smtpServer_label']}:
{$ax['smtpPort_label']}:
{$ax['smtpSsl_label']}:
{$ax['smtpAuth_label']}:   {$ax['username']}:   {$ax['password']}:
{$ax['sms']}
{$ax['notSenderSms_label']}:    
{$ax['calPhone_label']}:
{$ax['smsCarrier_label']}:
{$ax['smsCountry_label']}:   
{$ax['smsSubject_label']}:
{$ax['maxLenSms_label']}: (70 - 500 bytes)
{$ax['smsAddLink_label']}:
\n"; echo "
{$ax['set_perfun_settings']}
{$ax['cronHost_label']}:         :
{$ax['cronSummary_label']}:    
{$ax['chgEmailList_label']}:
{$ax['chgNofDays_label']}: (0 - 30)
{$ax['icsExport_label']}:
{$ax['eventExp_label']}: (0 - 999)
{$ax['maxNoLogin_label']}: (0 - 365)
\n"; echo "
{$ax['set_sidebar_settings']}
'.$ax['templFields_text'])."', 'normal')\">{$ax['popFieldsSbar_label']}:
{$ax['showLinkInSB_label']}:
{$ax['sideBarDays_label']}: (1 - 365)
\n"; ?>