private function process() { $this->commonProcess(); $config = services::getService('config'); $lang = services::getService('lang'); $params = services::getService('pageParams'); $categories = services::getService('cats'); $mail = services::getService('mail'); $form = new formPoolData('FoundForm'); if ($params->getParam('pool_id')) { $pool = new pools(); $pool->get($params->getParam('pool_id')); if (!$pool->isAdmin($this->user->id)) { $this->switchPage('mysite'); } // defaults $form->setDefaults(array('poolname' => $pool->name, 'pooldesc' => $pool->description, 'poolarea' => $pool->area, 'poolcountry' => $pool->country, 'pooladress' => array('plz1' => substr($pool->plz, 0, 2), 'plz2' => substr($pool->plz, 2, 3), 'city' => $pool->city), 'is_public' => $pool->is_public)); $this->pool = $pool; $this->header = $pool->name . $lang->getMsg('pooldata_header_change'); } else { $this->header = $pool->name . $lang->getMsg('pooldata_header_found'); } // Try to validate a form if ($form->validate()) { if (!isset($pool)) { $pool = new pools(); } $pool->name = $form->exportValue('poolname'); $pool->description = $form->exportValue('pooldesc'); $pool->area = $form->exportValue('poolarea'); $pool->country = $form->exportValue('poolcountry'); $adress2 = $form->getElementValue('pooladress'); $pool->plz = $adress2['plz1'] . $adress2['plz2']; $pool->city = $adress2['city']; $pool->is_public = $form->exportValue('is_public'); //$pool->is_located = $form->exportValue('is_located'); if (isset($pool->id)) { $pool->update(); $this->addMsg('msg_data_change_success'); $form->freezeForm(); $this->change_success_link = true; } else { $pool->wait = 1; $pool->insert(); $new_user = new poolsUser(); $new_user->user_id = $this->user->id; $new_user->pool_id = $pool->id; $new_user->wait = 0; $new_user->insert(); $new_admin = new poolsAdmin(); $new_admin->user_id = $this->user->id; $new_admin->pool_id = $pool->id; $new_admin->insert(); $params->addParam('msg', 'msg_found_success', 'page'); $mail->send('found_pool_admin', $config->getSetting('email'), $pool); $mail->send('found_pool_founder', $this->user, $pool); $this->switchPage('mysite'); } } $this->form = $form; }
} // set $msg if ($deleted) { $msg = 'delng_success'; } } // free_ng-form if (isset($_POST['ng_free_submit'])) { for ($count = 1; $count <= $_POST['ng_free_count']; ++$count) { $pools = new pools(); // free ng $curr_id = $_POST['ng_free_' . $count]; if ($curr_id) { $pools->get($curr_id); $pools->wait = 0; $pools->update(); // compose email $tos = $pools->getAdmins(); $mail = services::getService('mail'); foreach ($tos as $to) { $mail->send('found_pool_accepted', $to, $pools); } $freed = TRUE; } } // set $msg if ($freed) { $msg = 'freeng_success'; } } include './inc/adminHeader.php';