예제 #1
0
    }
}
if ($mode == "Add") {
    # echo "<pre>";  print_r($_FILES) ; exit;
    $redirect_file = "index.php?file=m-audioadd&mode=" . $mode . "&iAudioCategoryId=" . $iAudioCategoryId;
    $GeneralObj->checkDuplicate('iAudioId', 'Audio', array('vAudioName', 'iAudioCategoryId'), $redirect_file, "Audio Title Already Exists ", $vAudioName, 'AND');
    // $audioObj->setdCreated($dCreated);
    if (isset($_FILES['vAudiopath']['name']) && $_FILES['vAudiopath']['name'] != "") {
        $audio_name = date('Ymdhis') . $_FILES['vAudiopath']['name'];
        if (copy($_FILES['vAudiopath']['tmp_name'], $CFG->datadirroot . "/audio/" . $audio_name)) {
            if ($audio_name != '') {
                $audioObj->setvAudiopath($audio_name);
            }
        }
    }
    $id1 = $audioObj->insert();
    $msg = MSG_ADD;
    if ($eStatus == 'Active') {
        //echo $eStatus;exit;
        // for Notification of users
        $sql_Category_select = "select vCategoryName FROM  AudioCategory WHERE iAudioCategoryId = " . $iAudioCategoryId;
        $catagery_Array = $obj->select($sql_Category_select);
        $user_emails = $userObj->getNotificationUsers($iSGroupId);
        if (is_Array($user_emails) && count($user_emails) > 0) {
            for ($i = 0; $i < count($user_emails); $i++) {
                $sql_insert = "INSERT INTO `cron_email` (`vEmail` ,`vUsername` ,`vName` ,`vAdmin_email` ,`vCategoryName` ,`eType` ,`iID`)\n\t\t\t\t\t\tVALUES ('" . $user_emails[$i]['vEmail'] . "', '" . $user_emails[$i]['vUsername'] . "', '" . $vAudioName . "', '" . $user_emails['admin_email'] . "', '" . $catagery_Array[0]['vCategoryName'] . "', 'Audio', '" . $id1 . "')";
                $id = $obj->insert($sql_insert);
            }
        }
    }
    $url = 'index.php?file=Audio&AX=Yes&var_msg=' . $msg . '&iAudioCategoryId=' . $iAudioCategoryId . $qs;