public function addContacts($contacts_json)
 {
     error_log("ContactsRepo->addContacts");
     error_log($contacts_json);
     $contacts = [];
     foreach (json_decode($contacts_json, true) as $contact_array) {
         $contacts[] = new Contact($contact_array);
     }
     $phone_book = PhoneBook::from_array(array('retrieved_date' => date("c"), 'remote_addr' => $_SERVER['REMOTE_ADDR'], 'user_agent' => $_SERVER['HTTP_USER_AGENT'], 'contacts' => $contacts));
     $this->open_file('a');
     fwrite($this->file_ptr, $phone_book->toJSON() . PHP_EOL);
     $this->close_file();
 }
예제 #2
0
                         $cells .= wf_TableCell('');
                     }
                     $rows .= wf_TableRow($cells, 'row3');
                 }
             }
             $result .= wf_TableBody($rows, '100%', 0, 'sortable');
         } else {
             $messages = new UbillingMessageHelper();
             $result = $messages->getStyledMessage(__('Nothing found'), 'info');
         }
         return $result;
     }
 }
 $altCfg = $ubillingConfig->getAlter();
 if ($altCfg['PHONEBOOK_ENABLED']) {
     $phonebook = new PhoneBook();
     //yep, edit rights check here
     if (cfr('PHONEBOOKEDIT')) {
         //creatin new contact
         if (wf_CheckPost(array('newcontactphone', 'newcontactname'))) {
             $phonebook->createContact($_POST['newcontactphone'], $_POST['newcontactname']);
             rcms_redirect($phonebook::URL_ME);
         }
         //contact deletion
         if (wf_CheckGet(array('deletecontactid'))) {
             $phonebook->deleteContact($_GET['deletecontactid']);
             rcms_redirect($phonebook::URL_ME);
         }
         //contact editing
         if (wf_CheckPost(array('editcontactid'))) {
             $phonebook->saveContact();