Ejemplo n.º 1
0
} else {
    // Has Connected Youtube Account
    $countErrors = 0;
    $dispError = "";
    $dispSuccess = false;
    if ($_POST['submit']) {
        // Check Video Display
        $arrVideoDisplayCheck = array(0, 1, 2, 3, 4, 5);
        if (!in_array($_POST['showvideos'], $arrVideoDisplayCheck) || !is_numeric($_POST['showvideos'])) {
            $dispError = "&nbsp;&nbsp;&nbsp;<b>&middot;</b> You selected an invalid video display amount.<br>";
            $countErrors++;
        }
        if ($countErrors == 0) {
            $setShowInfoCard = $_POST['showinfocard'] == 1 ? 1 : 0;
            $setAllowLogin = $_POST['allowlogin'] == 1 ? 1 : 0;
            if ($ytObj->update(array("allowlogin", "showsubscribe", "showvideos"), array($_POST['allowlogin'], $_POST['showinfocard'], $_POST['showvideos']))) {
                $dispSuccess = true;
            } else {
                $countErrors++;
                $dispError .= "&nbsp;&nbsp;&nbsp;<b>&middot;</b> Unable to save information to the database.  Please contact the website administrator.<br>";
            }
        }
    }
    $ytInfo = $ytObj->get_info_filtered();
    $checkVideos = array();
    if ($ytInfo['showvideos'] == 0) {
        $checkVideos[0] = " selected";
    } elseif ($ytInfo['showvideos'] == 1) {
        $checkVideos[1] = " selected";
    }
    $checkInfoCard = $ytInfo['showsubscribe'] == 1 ? " checked" : "";