Пример #1
0
 // if the token is exist and not yet expired
 if ($s->check(false, $token, "CREATE_ORG")) {
     //if organization saved
     if ($o->insertOrganization()) {
         $latest_id = $o->getLatestOrganizationID();
         redirect_header("organization.php?action=edit&organization_id={$latest_id}", $pausetime, "Your data is saved.");
     } else {
         $o->groupctrl = $ctrl->getAllSystemGroup(0);
         $token = $s->createToken($tokenlife, "CREATE_ORG");
         if ($o->country_id == "") {
             $o->country_id = 0;
         }
         if ($o->currency_id == "") {
             $o->currency_id = 0;
         }
         $o->countryctrl = $ctrl->getSelectCountry($o->country_id, 'N');
         $o->currencyctrl = $ctrl->getSelectCurrency($o->currency_id, 'N');
         $o->getInputForm("new", -1, $token);
         $o->showOrganizationTable("where organization_id>0", "order by defaultlevel,organization_name");
     }
 } else {
     // if the token is not valid or the token is expired, it back to previous form with previous inputed data
     $o->groupctrl = $ctrl->getAllSystemGroup(0);
     $token = $s->createToken($tokenlife, "CREATE_ORG");
     if ($o->country_id == "") {
         $o->country_id = 0;
     }
     if ($o->currency_id == "") {
         $o->currency_id = 0;
     }
     $o->countryctrl = $ctrl->getSelectCountry($o->country_id, 'N');