コード例 #1
0
ファイル: ops.php プロジェクト: sergiovelayos/liveuamap
 function saveit($saveid, $header = '')
 {
     $this->saveid = $saveid;
     $this->weight = $_POST['fieldiiweight'];
     $this->weight = $_POST['fieldiiweight'];
     $this->alt = $_POST['fieldiialt'];
     $this->keywords = $_POST['fieldiikeywords'];
     if (isset($_POST['fieldiiautoadres'])) {
         $this->autoadres = 1;
     } else {
         $this->autoadres = 0;
     }
     if ($this->autoadres) {
         $this->adres = WRA::totranslit(WRA::mb_trim($header));
     } else {
         $this->adres = $_POST['fieldiiadres'];
     }
     $this->commentopt = $_POST['fieldiicommentopt'];
     $this->mappriority = $_POST['fieldiimappriority'];
     $this->authorid = $_POST['fieldiiauthorid'];
     $this->postdate = wra_admintable::getdate('fieldiipostdate');
     //(iipostdate_ATOM, mktime($_POST['fieldiipostdateshowhour'], $_POST['fieldiipostdateshowminute'], 0, $_POST['fieldiipostdateshowmonth'], $_POST['fieldiipostdateshowday'], $_POST['fieldiipostdateshowyear']));
     $this->postopt = $_POST['fieldiipostopt'];
     if ($saveid != -1) {
         $this->update();
     } else {
         $this->add();
     }
     ///обработка уникальной формы cf_images
     $jsonpost = json_decode(stripslashes(wra_admintable::getpost('new-fieldiiimages')));
     $jsondelete = json_decode(stripslashes(wra_admintable::getpost('delete-fieldiiimages')));
     if ($jsonpost == '') {
         $jsonpost = json_decode(stripslashes(stripslashes(wra_admintable::getpost('new-fieldiiimages'))));
     }
     if ($jsondelete == '') {
         $jsondelete = json_decode(stripslashes(stripslashes(wra_admintable::getpost('delete-fieldiiimages'))));
     }
     if (is_array($jsonpost)) {
         foreach ($jsonpost as $key => $value) {
             $newitem = new wra_image();
             $edik = false;
             if (substr($value->id, 0, 1) != 'p') {
                 $edik = true;
             }
             if ($edik) {
                 $newitem->load($value->id);
             } else {
                 $newitem->load($value->picid);
             }
             $newitem->description = $value->description;
             $newitem->header = $value->header;
             $newitem->galinfoid = $this->id;
             $newitem->update();
         }
     }
     if (is_array($jsondelete)) {
         foreach ($jsondelete as $key => $value) {
             $newitem = new wra_image();
             $newitem->load($value);
             $newitem->delete();
         }
     } else {
         $newitem = new wra_image();
         $newitem->load($jsondelete);
         $newitem->delete();
     }
     //-----------
 }