<?php

/*
 * tagControl.php
 * 负责处理管理员管理系统标签的逻辑
 * Created By C860 at 2014-1-15
 */
include_once '../conf/config.php';
//需要管理员权限
sys::needAdmin('index.php');
//引入相关模型类
include_once '../Models/tag.php';
if (isset($_POST['type'])) {
    if ($_POST['type'] == 'modify') {
        if (isset($_POST['tag_id']) && is_numeric($_POST['tag_id']) && isset($_POST['name']) && !empty($_POST['name']) && isset($_POST['isFormal']) && is_numeric($_POST['isFormal']) && isset($_POST['img']) && !empty($_POST['img'])) {
            if (tag::update($_POST['tag_id'], $_POST['name'], $_POST['isFormal'], $_POST['img'])) {
                sys::alert('修改成功!');
            } else {
                sys::alert('出现未知错误!');
            }
            sys::redirect('../back/tagControl.php');
        }
    } else {
        if ($_POST['type'] == 'add') {
            if (isset($_POST['name']) && !empty($_POST['name']) && isset($_POST['isFormal']) && is_numeric($_POST['isFormal']) && isset($_POST['img']) && !empty($_POST['img'])) {
                if (tag::add($_POST['name'], $_POST['isFormal'], $_POST['img'])) {
                    sys::alert('新增标签成功!');
                } else {
                    sys::alert('出现未知错误!');
                }
                sys::redirect('../back/tagControl.php');
示例#2
0
 static function photo_edit_form_completed($photo, $form)
 {
     tag::update($photo, $form->edit_photo->tags->value);
 }