Esempio n. 1
0
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with Positions. If not, see <http://www.gnu.org/licenses/>.
 --------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
$img = new PluginPositionsImageItem();
if (isset($_POST["add"]) && isset($_POST['type'])) {
    $test = explode(";", $_POST['type']);
    if (isset($test[0]) && isset($test[1]) && !empty($test[1])) {
        $_POST['type'] = $test[1];
        $_POST['itemtype'] = $test[0];
        if ($img->canCreate()) {
            if (!empty($_POST["img"])) {
                $img->addItemImage($_POST);
            } else {
                Session::addMessageAfterRedirect(__('No picture uploaded', 'positions'), false, ERROR);
            }
        }
    }
    Html::back();
} else {
    if (isset($_POST["delete"])) {
        $img->getFromDB($_POST["id"], -1);
        foreach ($_POST["item"] as $key => $val) {
            if ($val == 1) {
                $img->delete(array('id' => $key));
            }
        }
        Html::back();