Esempio n. 1
0
     }
 } else {
     $tabExist++;
 }
 if (getTables('settings') == false) {
     $newTabSet = createDbTable('settings');
     if (!$newTabSet) {
         $errMsg[] = "Error: Problem creating table 'settings' in calendar {$calID}";
         break;
     }
 } else {
     $tabExist++;
     $newTabSet = '';
 }
 //insert initial data in cat, user and settings tables
 $catSaved = initCats();
 if (!$catSaved) {
     $errMsg[] = "Error: Problem writing to database table 'categories' in calendar {$calID}.";
     break;
 }
 $adPwMd5 = md5($adPwrd);
 $usrSaved = initUsers($adName, $adMail, $adPwMd5);
 if (!$usrSaved) {
     $errMsg[] = "Error: Problem writing to database table 'users' in calendar {$calID}.";
     break;
 }
 $grpSaved = initGroups();
 if (!$grpSaved) {
     $errMsg[] = "Error: Problem writing to database table 'groups' in calendar {$calID}.";
     break;
 }
Esempio n. 2
0
 if (empty($calendars)) {
     $calendars[0] = $newCal;
 }
 $dbPfix = trim(substr($calendars[0], 0, strpos($calendars[0], '-')));
 foreach ($calendars as $calendar) {
     //check / create calendar tables
     list($calID, $calTitle) = explode('-', $calendar);
     $calID = trim($calID);
     $calTitle = trim($calTitle);
     //if not present, create tables
     $tabEve = createDbTable('events', $calID);
     $tabCat = createDbTable('categories', $calID);
     $tabUse = createDbTable('users', $calID);
     $tabSet = createDbTable('settings', $calID);
     //insert initial data in cat, user and settings tables
     $catSaved = initCats($calID);
     $usrSaved = initUsers($calID, $adName, $adMail, $adPwMd5);
     $setSaved = true;
     //init
     if ($tabSet != '2') {
         $dbSet = array();
         $dbSet['calendarTitle'] = $calTitle;
         $dbSet['calendarUrl'] = $calUrlBase . '?cal=' . $calID;
         $dbSet['calendarEmail'] = $calEmail;
         checkSettings($dbSet);
         $setSaved = saveSettings($calID, $dbSet, true);
     }
     if (!$tabEve or !$tabCat or !$tabUse or !$tabSet) {
         $errMsg[] = "Problem creating tables<br>Check your database permissions\n";
         break;
     }