Esempio n. 1
0
 function editPost()
 {
     system::setParam("page", "addPage");
     $id = intval($_GET["contentID"]);
     $fill = $_POST;
     if ($_POST) {
         // echo '<pre>'.print_r($_POST,1).'</pre>';
         if (isset($_POST['x1']) && isset($_POST['y1']) && isset($_POST['w1']) && isset($_POST['h1']) && $_POST['x1'] != '' && $_POST['y1'] != '' && $_POST['w1'] != '' && $_POST['h1'] != '') {
             $data = array('x1' => $_POST['x1'], 'y1' => $_POST['y1'], 'w1' => $_POST['w1'], 'h1' => $_POST['h1'], 'width' => 200, 'height' => 200);
             unset($_POST['x1'], $_POST['y1'], $_POST['w1'], $_POST['h1']);
             photo::cropImage($_POST['picture'], $data, '200x200');
         }
         if (isset($_POST['x2']) && isset($_POST['y2']) && isset($_POST['w2']) && isset($_POST['h2']) && $_POST['x2'] != '' && $_POST['y2'] != '' && $_POST['w2'] != '' && $_POST['h2'] != '') {
             $data = array('x1' => $_POST['x2'], 'y1' => $_POST['y2'], 'w1' => $_POST['w2'], 'h1' => $_POST['h2'], 'width' => 200, 'height' => 140);
             unset($_POST['x2'], $_POST['y2'], $_POST['w2'], $_POST['h2']);
             photo::cropImage($_POST['picture'], $data, '200x140');
         }
         $_POST['type'] = 'news';
         photo::updatePost($_POST, $id);
     }
     $fill = photo::getPost($id);
     $this->smarty->assign("fill", $fill);
 }