コード例 #1
0
ファイル: tags.php プロジェクト: kaz6120/Loggix
 *
 * @package  Downloads
 * @since    5.5.26
 * @version  10.4.11
 */
/**
 * Include Download Module class
 */
$pathToIndex = '../../..';
require_once $pathToIndex . '/modules/downloads/lib/LM_Downloads.php';
$app = new LM_Downloads();
$app->getModuleLanguage('downloads');
$sessionState = $app->getSessionState();
$config = $app->getConfigArray();
if ($sessionState == 'on') {
    $app->insertSafe();
    // Add New Tag
    if (isset($_POST['action']) == 'add' && isset($_POST['new_tag'])) {
        $aNewTag = $_POST['new_tag'];
        $checkSql = 'SELECT ' . 'COUNT(id) ' . 'FROM ' . DOWNLOADS_TAG_TABLE . ' ' . 'WHERE ' . 'tag_name = :tag_name';
        $stmt = $app->db->prepare($checkSql);
        $stmt->execute(array(':tag_name' => $aNewTag));
        $countId = $stmt->fetchColumn();
        if ($countId == '0') {
            $sql = 'INSERT INTO ' . DOWNLOADS_TAG_TABLE . '(tag_name) ' . 'VALUES' . '(:tag_name)';
            $stmt = $app->db->prepare($sql);
            $stmt->execute(array(':tag_name' => $aNewTag));
            header('Location : ' . $_SERVER['PHP_SELF']);
        }
        // Save Changes
    } elseif (isset($_POST['action']) == 'save' && isset($_POST['id'], $_POST['tag_name'])) {