Esempio n. 1
0
    Copyright (C) 2008 Jesse Hogan <*****@*****.**>
    All rights reserverd
*/
try {
    global $session;
    ?>
    <br/>
    <b>(C) 2008 Small Talkies</b>
    <br/><b><?php 
    echo GetCap('capPoweredBy');
    ?>
</b>:
    <a href="http://en.wikipedia.org/wiki/FOSS"><?php 
    echo GetCap('capFreeOpenSourceSoftware');
    ?>
</a>
    (<a href="http://en.wikipedia.org/wiki/Linux">Linux</a> 
    <a href="http://apache.org">Apache</a> 
    <a href="http://mysql.com">MySql</a> 
    <a href="http://php.net">PHP</a>)
    <br/>

    <?php 
    dump(false);
    UpdateObject($session, false);
} catch (Exception $ex) {
    ProcessException($ex);
}
?>

Esempio n. 2
0
function main()
{
    try {
        global $pageTitle;
        global $editable;
        global $session;
        global $user;
        $post = $_POST['blnPost'];
        $username = $_GET['username'];
        $selUser = new User("username = '******'");
        $logout = $_GET['logout'];
        if ($selUser->IsEmpty()) {
            print GetCap('capUserNotFound');
            $session->ViewedNotFound("Movie", $username);
            UpdateObject($session, false);
            Dump();
        }
        if ($logout) {
            $selUser->Logout();
            $session->ForcedLogout($selUser->ID());
        }
        if (isset($user)) {
            if ($user->ID() == $selUser->ID()) {
                $sameUser = true;
            }
        }
        if (!$editable && !$selUser->Enabled()) {
            echo GetCap('capThisAccountHasBeenDisabled');
            Dump();
        }
        if ($post) {
            if (!$editable && !$sameUser) {
                BlockIfViolation('update');
            }
            ThrowExceptionOnMaliciousInput($_POST['txtInfo'], 'USER_INFO');
            if ($editable) {
                $selUser->Enabled($_POST['chkEnabled'] == '1' ? 1 : 0);
            }
            $selUser->PlayTimesLocation($_POST['txtPlayTimesLocation']);
            $selUser->Email($_POST['txtEmail']);
            $selUser->Info(strip_tags($_POST['txtInfo']));
            UpdateObject($selUser);
        } else {
            $session->Viewed("User", $selUser->ID());
        }
        $username = $selUser->UserName();
        $pageTitle = $username;
        $email = $selUser->Email();
        $playTimesLocation = $selUser->PlayTimesLocation();
        $enabled = $selUser->Enabled();
        $info = $selUser->Info();
        ?>
        <br />
        <form name="frm" method="post" action="<?php 
        echo $PHP_SELF . "?username="******">
            <table>
                <tr> 
                    <td>
                        <font size=6><b><?php 
        echo $username;
        ?>
</b></font>
                        <?php 
        if (!$sameUser) {
            echo PublicizedInfo($info);
        }
        ?>
                    </td>
                </tr> 
                    <?php 
        if ($editable || $sameUser) {
            ?>
                        <tr> 
                            <td>
                                <b><?php 
            echo GetCap('capEmailAddress');
            ?>
: </b>
                            </td>
                            <td>
                                <input type="text" size=50 name="txtEmail" value="<?php 
            echo $email;
            ?>
"/>
                                <?php 
            echo "<i>(" . GetCap('capPrivate') . ")</i>";
            ?>
                            </td>
                        </tr> 
                     <?php 
        }
        if ($editable || $sameUser) {
            ?>
                    <tr> 
                        <td>
                            <b><?php 
            echo GetCap('capPlayTimesLocation');
            ?>
: </b>
                        </td>
                        <td>
                            <input type="text" size=50 name="txtPlayTimesLocation" value="<?php 
            echo $playTimesLocation;
            ?>
"/>
                            <?php 
            echo "<i>(" . GetCap('capPrivate') . ")</i>";
            ?>
                        </td>
                    </tr> 
                <?php 
        }
        if ($editable || $sameUser) {
            ?>
                <tr> 
                        <td valign=top>
                            <b><?php 
            echo GetCap('capTellUsAboutYourself');
            ?>
: </b>
                            <br/>
                            <i>(<?php 
            echo GetCap('capEditAnywayYouWish');
            ?>
)</i>
                        </td>
                        <td valign=top>
                            <textarea rows="10" cols="57" name="txtInfo"><?php 
            echo $info;
            ?>
</textarea>
                            <?php 
            echo "<i>(" . GetCap('capPublic') . ")</i>";
            ?>
                        </td>
                </tr> 
                <tr valign=top> 
                        <td>
                            <b><?php 
            echo GetCap('capPublicView');
            ?>
: </b>
                        </td>
                        <td>
                            <?php 
            echo PublicizedInfo($info);
            ?>
                        </td>
                </tr> 
                <?php 
        }
        if ($editable) {
            ?>
                    <tr> 
                        <td>
                            <b><?php 
            echo GetCap('capLoggedIn');
            ?>
: </b>
                            <?php 
            if ($selUser->LoggedIn()) {
                print GetCap("capYes");
                if ($admin) {
                    print "<a href=\"user.php?username={$username}&logout=1\">[" . GetCap('capLogout') . "]</a>";
                }
            } else {
                print GetCap("capNo");
            }
            ?>
                    </tr> 
                    <tr> 
                        <td>
                            <b><?php 
            echo GetCap('capEnabled');
            ?>
: </b>
                            <?php 
            print "<input type=\"checkbox\" name=\"chkEnabled\" value=\"1\" " . ($enabled ? 'checked="checked"' : '') . "/>";
            ?>
                    </tr> 
                <?php 
        }
        if ($editable || $sameUser) {
            ?>
                    <tr> 
                        <td>
                            <input type="submit" name="btnLogin" value="<?php 
            echo GetCap('capSave');
            ?>
"/>
                        </td>
                        <td>
                            <input type="hidden" name="blnPost" value="1"/>
                        </td>
                    </tr> 
                <?php 
        }
        ?>
        </table>
    </form>
    <?php 
    } catch (Exception $ex) {
        ProcessException($ex);
    }
}
Esempio n. 3
0
File: bbs.php Progetto: jhogan/nplay
function main()
{
    try {
        global $editable;
        global $user;
        global $thisURIEncoded;
        global $session;
        global $bbsRow;
        $PHP_SELF = $_SERVER['PHP_SELF'];
        $post = $_POST['blnPost'];
        $id = $_GET['id'];
        $topic = new Post($id);
        if (!$topic->IsNew()) {
            $session->Viewed("Post", $id);
        }
        $enablePost = $_GET['enablePost'] == '1' ? true : false;
        $disablePost = $_GET['disablePost'] == '1' ? true : false;
        if ($enablePost || $disablePost) {
            if (!NoteViolation("toggle {$enablePost}:{$disablePost} ({$id})")) {
                $postID = $_GET['postID'];
                $posts = $topic->Posts();
                foreach ($posts as $post0) {
                    if ($post0->ID() == $postID) {
                        $post0->Disabled($disablePost);
                        UpdateObject($post0);
                        if ($disabled) {
                            $session->Disabled('Post', $postID);
                        } else {
                            $session->Enabled('Post', $postID);
                        }
                        break;
                    }
                }
            }
        }
        if ($id == "") {
            $movID = $_GET['movID'];
            $mov = new Movie($movID);
            $topic->MovieID($movID);
        } else {
            $mov =& $topic->Movie();
            $movID = $mov->ID();
        }
        if ($mov->IsEmpty()) {
            BlockIfViolation("non-exisisting movie (id={$movID})");
        }
        if (!$mov->Visible()) {
            BlockIfViolation("invisable view (id={$movID})");
        }
        ?>
	<a href="movie.php?id=<?php 
        echo $mov->ID();
        ?>
"> <img src="<?php 
        echo $mov->MainPicture();
        ?>
" alt=""/></a>
        <b><font size="6"><a href="movie.php?id=<?php 
        echo $movID;
        ?>
"><?php 
        echo $mov->Title();
        ?>
</a></font></b>
	<?php 
        if ($post) {
            ThrowExceptionOnMaliciousInput($_POST['txtText'], 'BBS_TEXT');
            ThrowExceptionOnMaliciousInput($_POST['txtSubject'], 'BBS_SUB');
            $username = $user->Username();
            if ($topic->IsNew()) {
                $topic->Text($_POST['txtText']);
                $topic->Subject($_POST['txtSubject']);
                $topic->Username($username);
                $topic->ParentID(0);
                // Currently non-threaded, may change...
                $topic->MovieID($movID);
                $upd =& $topic;
            } else {
                $objPost = new Post();
                $objPost->Text($_POST['txtText']);
                $objPost->Username($username);
                $objPost->ParentID($topic->ID());
                // Currently non-threaded, may change...
                $objPost->MovieID($movID);
                $upd =& $objPost;
            }
            UpdateObject($upd);
            $id = $topic->ID();
        }
        if (!$topic->IsNew()) {
            $posts =& $topic->Posts();
        }
        $subject = $topic->Subject();
        $username = $topic->Username();
        $text = $topic->Text();
        ?>
        <table>
            <?php 
        if (!$topic->IsNew()) {
            ?>
                <tr>
                    <td>
                        <h3><?php 
            echo GetCap('capTopic') . ": {$subject}";
            ?>
</h3>
                    </td>
                </tr>
            <?php 
        }
        if (isset($posts)) {
            foreach ($posts as $post) {
                $text = $post->Text();
                $text = wordwrap(strip_tags($text), 75);
                $text = str_replace("\n", '<br />', $text);
                $date = $post->DatePosted();
                $postID = $post->ID();
                $username = $post->Username();
                $pad = str_repeat('&nbsp;', 20 - strlen($username));
                $disabled = $post->Disabled();
                if ($disabled) {
                    if ($user == null || $username != $user->Username() && !$user->IsMaintainer()) {
                        continue;
                    }
                }
                ?>
                    <tr <?php 
                echo $bbsRow;
                ?>
>
                        <td>
                            <?php 
                echo "<b><a href=\"user.php?username={$username}\">{$username}</a></b>" . '<br />' . $date . "";
                ?>
                            &nbsp;<?php 
                echo "<a href=\"bbsReport.php?postID={$postID}&amp;type=" . REPORT_TYPE_SPAM . "\">[" . GetCap('capReport') . "]</a>";
                ?>
                        </td>
                    </tr>
                    <?php 
                if ($editable) {
                    ?>
                        <tr align="right">
                        <?php 
                    if ($post->Disabled()) {
                        echo "<td><a href=\"bbs.php?id={$id}&amp;postID={$postID}&amp;enablePost=1\">" . GetCap('capEnable') . "</a></td>";
                    } else {
                        echo "<td><a href=\"bbs.php?id={$id}&amp;postID={$postID}&amp;disablePost=1\">" . GetCap('capDisable') . "</a></td>";
                    }
                    ?>
                        </td>
                        <?php 
                }
                ?>
                    <tr>
                        <td>
                            <?php 
                if ($disabled) {
                    if ($user->IsMaintainer()) {
                        echo "&nbsp;&nbsp;&nbsp;&nbsp;";
                        echo "<b>" . strtoupper(GetCap('capDisabled')) . "</b><br />";
                    } else {
                        echo "<b>" . GetCap('capThisPostWasDisabledBecauseItViolatedOurPolicy') . "</b>";
                        echo "<br>&nbsp;&nbsp;&nbsp;&nbsp";
                        echo "<b>" . GetCap('capOnlyYouCanSeeThisPost') . "</b>";
                        echo "<br>&nbsp;&nbsp;&nbsp;&nbsp";
                    }
                }
                echo "<p>{$text}</p>";
                ?>
                        </td>
                    </tr>
                    <?php 
            }
        }
        ?>
        </table>
        <?php 
        if ($user != null) {
            ?>
            <form name="frm" method="post" action="<?php 
            echo $PHP_SELF . "?id={$id}&amp;movID={$movID}";
            ?>
">
                <table>
                    <?php 
            if ($topic->IsNew()) {
                ?>
                        <tr>
                            <td>
                                <?php 
                echo "<b>" . GetCap('capSubject') . "</b>";
                ?>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="text" name="txtSubject" value="<?php 
                echo $subject;
                ?>
"/>
                            </td>
                        </tr>
                    <?php 
            }
            ?>
                    <tr <?php 
            echo $postMessageRow;
            ?>
>
                        <td>
                            <?php 
            echo "<b>" . GetCap('capPostMessage') . "</b>";
            ?>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <textarea rows="10" cols="57" name="txtText"></textarea>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input type="submit" name="btnPost" value="<?php 
            echo GetCap('capPost');
            ?>
"/>
                        </td>
                        <td>
                            <input type="hidden" name="blnPost" value="1"/>
                        </td>
                    </tr>
                </table>
            </form>
        <?php 
        } else {
            ?>
            <table>
                <tr>
                    <td>
                        <?php 
            echo GetCap('capYouMustBeLoggedInToPostA Message');
            ?>
                    </td>
                </tr>
            </table>
        <?php 
        }
    } catch (Exception $ex) {
        ProcessException($ex);
    }
}
Esempio n. 4
0
 public function step2Event($runData)
 {
     $pl = $runData->getParameterList();
     $evercode = $pl->getParameterValue("evercode");
     if ($evercode != $runData->sessionGet("revcode")) {
         throw new ProcessException(_("The verification codes do not match."), "form_error");
     }
     $password = $pl->getParameterValue("password");
     $password2 = $pl->getParameterValue("password2");
     $password = trim(CryptUtils::rsaDecrypt($password));
     $password = preg_replace("/^__/", '', $password);
     $password2 = trim(CryptUtils::rsaDecrypt($password2));
     $password2 = preg_replace("/^__/", '', $password2);
     // check password
     if (strlen8($password) < 6) {
         throw new ProcessException(_("Please provide a password min. 6 characters long."), "form_error");
     } elseif (strlen8($password) > 20) {
         throw new ProcessException(_("Password should not be longer than 20 characters."), "form_error");
     } elseif ($password2 != $password) {
         throw new ProcessException(_("Passwords are not identical."), "form_error");
     }
     // ok. seems fine.
     $userId = $runData->sessionGet("prUserId");
     $user = DB_OzoneUserPeer::instance()->selectByPrimaryKey($userId);
     if ($user == null) {
         throw ProcessException("No such user.", "no_user");
     }
     $user->setPassword(md5($password));
     $user->save();
 }
Esempio n. 5
0
function main()
{
    try {
        BlockIfViolation();
        global $locale;
        global $returnURI;
        $PHP_SELF = $_SERVER['PHP_SELF'];
        $post = $_POST['blnPost'];
        $id = $_GET['id'];
        $movID = $_GET['movID'];
        $relationship = $_GET['relationship'];
        $m2p = new MovieToPerson($id);
        if (!$m2p->IsNew()) {
            $mov =& $m2p->Movie();
            $person =& $m2p->Person();
        } else {
            $m2p->Relationship($relationship);
            $person = new Person();
            if ($movID == "") {
                throw new Exception("Missing movID");
            }
            $mov = new Movie($movID);
        }
        $movID = $mov->ID();
        $persons = new Persons();
        $persons->LoadAll();
        $persons->Sort("FirstName");
        print "<h3><a href=movie.php?id={$movID}>" . $mov->Title() . "</a></h3>\n";
        $characterName = $m2p->CharacterName();
        $relationship = $m2p->Relationship();
        if ($post) {
            if ($_POST['btnDelete'] != '') {
                $m2p->MarkForDeletion();
                $characterName = $relationship = '';
            } else {
                $person = new Person($_POST['cboPersons']);
                $m2p->Person($person);
                $m2p->PersonID($person->ID());
                $m2p->Movie($mov);
                $m2p->CharacterName($_POST['txtCharacterName']);
                $m2p->Relationship($_POST['txtRelationship']);
                $characterName = $m2p->CharacterName();
                $relationship = $m2p->Relationship();
            }
            if (UpdateObject($m2p)) {
                ReturnURI();
            }
        }
        $firstName = $person->FirstName();
        $lastName = $person->LastName();
        ?>
        <form name=frm method=post action=<?php 
        echo $PHP_SELF . "?id={$id}&movID={$movID}&returnURI={$returnURI}";
        ?>
>
            <table border=1>
                <tr>
                    <td>
                        <?php 
        print "<select name=cboPersons>\n";
        foreach ($persons as $person) {
            $name = $person->Name();
            $id = $person->ID();
            if ($id == $m2p->PersonID()) {
                $selectTag = 'SELECTED';
            } else {
                $selectTag = '';
            }
            ?>
                                <option value=<?php 
            echo $id;
            ?>
 <?php 
            echo $selectTag;
            ?>
><?php 
            echo $name;
            ?>
</option>
                            <?php 
        }
        print "</select>\n";
        ?>
                    </td>
                </tr>
                <?php 
        if ($relationship == 's') {
            ?>
                    <tr>
                        <td><?php 
            echo GetCap('capCharacterName');
            ?>
</td>
                        <td><input type=text name=txtCharacterName value='<?php 
            echo $characterName;
            ?>
'></td>
                    </tr>
                <?php 
        }
        ?>
                <tr>
                    <td><?php 
        echo GetCap('capRelationship');
        ?>
</td>
                    <td><input type=text name=txtRelationship value=<?php 
        echo $relationship;
        ?>
></td>
                </tr>
                <tr>
                    <td> <input type=submit name=btnSubmit value=<?php 
        echo GetCap('capSubmit');
        ?>
> </td>
                    <td> <a href=<?php 
        echo "{$PHP_SELF}?movID={$movID}";
        ?>
><?php 
        echo GetCap('capNew');
        ?>
</a>
                </tr>
                <input type=hidden name=blnPost value=1>
            </table>
         </form>
        <?php 
    } catch (Exception $ex) {
        ProcessException($ex);
    }
    require_once 'tailer.php';
}
Esempio n. 6
0
function main()
{
    try {
        BlockIfViolation();
        global $locale;
        $PHP_SELF = $_SERVER['PHP_SELF'];
        $id = $_POST['lstCategories'];
        if ($id == "") {
            $id = $_POST['txtID'];
        }
        $post = $_POST['blnPost'];
        $cat = new Category($id);
        if ($post) {
            $desc = $_POST['txtDesc'];
            $name = $_POST['txtName'];
            $enabled = $_POST['chkEnabled'];
            $cat->Description($desc);
            $cat->Name($locale, $name);
            $enabled = $enabled == '1' ? 1 : 0;
            $cat->Enabled($enabled);
            /* TODO:NICE: Redirect to previous page */
            UpdateObject($cat);
        }
        ?>
        <form name=frm method=post>
            <table border=1>
                <tr>
                    <td>
                        <?php 
        echo GetCap('capDescription');
        ?>
                    </td>
                    <td>
                        <input type=text name=txtDesc value='<?php 
        echo $cat->Description();
        ?>
'>
                    </td>
                 </tr>
                 <tr>
                    <td>
                        <?php 
        echo GetCap('capName');
        ?>
                    </td>
                    <td>
                        <input type=text name=txtName value='<?php 
        echo $cat->Name($locale);
        ?>
'>
                     </td>
                  </tr>
                 <tr>
                    <td>
                        <?php 
        echo GetCap('capEnable');
        ?>
                    </td>
                    <td>
                        <input type=checkbox name=chkEnabled value=1 <?php 
        echo $cat->Enabled() ? 'CHECKED' : '';
        ?>
>
                     </td>
                  </tr>
                  <tr>
                   <td>
                        <a href=categories.php><?php 
        echo GetCap('catBackToCategoryList');
        ?>
</a>
                    </td>
                    <td>
                        <input type=submit value=<?php 
        echo GetCap('catSave');
        ?>
>
                    </td>
                     <td>
                        <input type=hidden name=blnPost value=1>
                    </td>
                     <td> <input type=hidden name=txtID value=<?php 
        echo $id;
        ?>
>
                    </td>
                </tr>
                </tr>
             </table>
          </form>
        <?php 
    } catch (Exception $ex) {
        ProcessException($ex);
    }
}
Esempio n. 7
0
function main()
{
    try {
        BlockIfViolation();
        global $locale;
        $PHP_SELF = $_SERVER['PHP_SELF'];
        $post = $_POST['blnPost'];
        $id = $_GET['id'];
        $movID = $_GET['movID'];
        $mov = new Movie($movID);
        $movToCats =& $mov->MovieToCategories();
        $cats = new Categories();
        $cats->LoadAll();
        $cats->Sort("Description");
        $movID = $mov->ID();
        print "<h3><a href=movie.php?id={$movID}>" . $mov->Title() . "</a></h3>\n";
        if ($post) {
            $adds = array();
            $deletes = array();
            $proposedCats = $_POST['lstCategories'];
            foreach ($proposedCats as $proposedCat) {
                $found = false;
                foreach ($movToCats as $movToCat) {
                    if ($movToCat->CategoryID() == $proposedCat) {
                        $found = true;
                    }
                }
                if (!$found) {
                    $proposedMovToCat = new MovieToCategory();
                    $proposedMovToCat->MovieID($movID);
                    $proposedMovToCat->CategoryID($proposedCat);
                    $adds[] = $proposedMovToCat;
                }
            }
            foreach ($movToCats as $movToCat) {
                $found = false;
                foreach ($proposedCats as $proposedCat) {
                    if ($proposedCat == $movToCat->CategoryID()) {
                        $found = true;
                    }
                }
                if (!$found) {
                    $deletes[] = $movToCat;
                }
            }
            foreach ($adds as $add) {
                $movToCats->Add($add);
            }
            foreach ($deletes as $delete) {
                $delete->MarkForDeletion();
            }
            /* TODO:NICE: This should redirect on save to previous page */
            UpdateObject($movToCats);
        }
        ?>
        <form name=frm method=post action=<?php 
        echo $PHP_SELF . "?id={$id}&movID={$movID}";
        ?>
>
            <table border=1>
                <tr>
                    <td>
                        <select name="lstCategories[]" multiple=true>
                        <?php 
        foreach ($cats as $cat) {
            $selectTag = '';
            foreach ($movToCats as $movToCat) {
                if ($cat->ID() == $movToCat->CategoryID()) {
                    $selectTag = 'SELECTED';
                    break;
                }
            }
            ?>
                                <option value=<?php 
            echo $cat->ID();
            ?>
 <?php 
            echo $selectTag;
            ?>
 ><?php 
            echo $cat->Name($locale);
            ?>
</option>
                                <?php 
        }
        ?>
                        </select>
                     </td>
                     <td>
                        <input type=hidden name=blnPost value=1>
                     </td>
                </tr>
                <tr>
                     <td>
                        <input type=submit value=Submit>
                     </td>
                </tr>
                <tr>
                     <td>
                        <a href=categories.php> <?php 
        echo GetCap("capEditCategoryList");
        ?>
 </a>
                     </td>
                </tr>
            </table>
         </form>
        <?php 
    } catch (Exception $ex) {
        ProcessException($ex);
    }
}
Esempio n. 8
0
function RSS(&$movs)
{
    try {
        global $PHP_SELF;
        global $locale;
        global $session;
        global $gs;
        $session->Viewed("Movies", 0, $gs->ActionMsg2ID('ViewedNowPlayingRSS'));
        $appPath = preg_replace('/\\/[^\\/]+$/', '', $_SERVER['SCRIPT_NAME']);
        $movie_phpURL = 'http://' . $_SERVER['SERVER_NAME'] . "{$appPath}/movie.php";
        $movies_phpURL = 'http://' . $_SERVER['SERVER_NAME'] . "{$appPath}/movies.php";
        $rss = new RSS2Doc(GetCap('capNowPlaying'), $movies_phpURL, GetCap('capListOfMoviesNowPlaying'));
        foreach ($movs as $mov) {
            $id = $mov->ID();
            $rss->AddItem($mov->Title(), "{$movie_phpURL}?id={$id}", $mov->Plot($locale));
        }
        ob_end_clean();
        header("Content-Type: text/xml");
        echo $rss->ToString();
        exit;
    } catch (Exception $ex) {
        ob_end_clean();
        ProcessException($ex);
    }
}
Esempio n. 9
0
function main()
{
    try {
        global $sid;
        global $session;
        global $returnURI;
        global $DOMAIN;
        global $FROM_ADDR;
        global $X_MAILER;
        $PHP_SELF = $_SERVER['PHP_SELF'];
        $message = $_REQUEST['message'];
        $captchaCode = $_REQUEST['txtCaptchaCode'];
        $random = $_REQUEST['txtRandom'];
        $post = $_POST['blnPost'];
        $username = $_POST['txtUsername'];
        $password = $_POST['txtPassword'];
        $repassword = $_POST['txtRePassword'];
        $email = $_POST['txtEmail'];
        $emailPassword = $_POST['btnEmailPassword'] != "";
        $create = $_POST['btnCreateAccount'] != "";
        if (!$create) {
            $create = $_GET['create'] != "";
        }
        if (!$emailPassword) {
            $emailPassword = $_GET['emailPassword'] != "";
        }
        if ($post) {
            if ($emailPassword) {
                $user = new User("username='******'");
                if ($user->Email() != '') {
                    $capLogin = GetCap('capLogin');
                    $sub = GetCap('capPassword');
                    $path = dirname($_SERVER['SCRIPT_NAME']);
                    $msg = GetCap('capBelowAreYourCredentials') . "\r\n";
                    $msg .= "Username: "******"\r\n";
                    $msg .= 'Password: '******'capEmailHasBeenSent') . '</center></b>';
                } else {
                    print "<b><center>" . GetCap('capUserAccountDoesn\'tHaveEmailAddress</center></b>');
                }
                $username = $user->UserName();
                $email = $user->Email();
            } elseif ($create) {
                $captcha = new CaptchasDotNet('demo', 'secret');
                if (!$captcha->validate($random)) {
                    $password = $_POST['txtPassword'];
                    $rePassword = $_POST['txtRePassword'];
                    print "<center>" . GetCap('capCaptchaWasReused') . "</center>";
                    $session->ReusedCaptcha("session", $session->ID(), $random);
                } elseif (!$captcha->verify($captchaCode)) {
                    $password = $_POST['txtPassword'];
                    $rePassword = $_POST['txtRePassword'];
                    print "<center>" . GetCap('capInvalidConfirmationCode') . "</center>";
                    $session->InvalidConfirmationCode($captchCode);
                } elseif ($password == $repassword) {
                    $user = new User();
                    $user->UserName($username);
                    $user->Password($password);
                    $user->Email($email);
                    if (UpdateObject($user)) {
                        $session->UserID($user->ID());
                        $session->LoggedIn(true);
                        UpdateObject($session);
                        $username = $user->UserName();
                        $email = $user->Email();
                        ReturnURI();
                        print '<center>' . GetCap("capUpdateSucceded") . '</center>';
                    }
                } else {
                    $password = $_POST['txtPassword'];
                    $rePassword = $_POST['txtRePassword'];
                    print "<center>" . GetCap('capPasswordsDoNotMatch') . "</center>";
                }
            }
        }
        /* TODO:PREROLL Go to captcha.net and register an actual account (not demo) before rolling
           to production */
        if ($create) {
            $captcha = new CaptchasDotNet('demo', 'secret');
        }
        ?>
        <form name="frm" method="post" action="<?php 
        echo "login.php?returnURI={$returnURI}";
        ?>
">
            <table>
                <tr> 
                    <td>
                        <b><?php 
        echo GetCap('capUsername');
        ?>
: </b>
                    </td>
                    <td>
                        <input type="text" name="txtUsername" value="<?php 
        echo $username;
        ?>
"/>
                    </td>
                </tr> 
                <?php 
        if ($create) {
            ?>
                    <tr> 
                        <td>
                            <b><?php 
            echo GetCap('capPassword');
            ?>
: </b>
                        </td>
                        <td>
                            <input type="password" name="txtPassword" value="<?php 
            echo $password;
            ?>
"/>
                        </td>
                    </tr> 
                    <tr> 
                        <td>
                            <b><?php 
            echo GetCap('capRe-typePassword');
            ?>
: </b>
                        </td>
                        <td>
                            <input type="password" name="txtRePassword" value="<?php 
            echo $_POST['txtRePassword'];
            ?>
"/>
                        </td>
                    </tr> 
                    <tr> 
                        <td>
                            <b><?php 
            echo GetCap('capEmail (optional)');
            ?>
: </b>
                        </td>
                        <td>
                            <input type="text" name="txtEmail" value="<?php 
            echo $email;
            ?>
"/>
                        </td>
                        <td>
                            <i><?php 
            echo GetCap('capIn case you forget your password we can email you a new one.');
            ?>
</i>
                        </td>
                    </tr> 
                    <tr valign="top">
                        <td>
                            <b><?php 
            echo GetCap('capEnterConfirmationCodeFromPicture');
            ?>
: </b>
                        </td>
                        <td>
                            <input type="text" name="txtCaptchaCode"/>
                            <input type="hidden" name="txtRandom" value="<?php 
            echo $captcha->random();
            ?>
" />
                            <br /><br/><br/> 
                            <a href="<?php 
            echo $captcha->audio_url();
            ?>
"><?php 
            echo GetCap('capPhoenieticSpelling(mp3)');
            ?>
</a>
                        </td>
                        <td>
                            <?php 
            echo $captcha->Image(false, 'captchas.net', GetCap('capLoadingCaptcha...'));
            ?>
                        </td>
                    </tr> 
                    <tr> 
                        <td>
                            <input type="submit" name="btnCreateAccount" value="<?php 
            echo GetCap('capCreateAccount');
            ?>
"/>
                        </td>
                    </tr> 
                <?php 
        }
        if ($emailPassword) {
            ?>
                    <tr>
                        <td>&nbsp;</td>
                        <td>
                            <input type="submit" name="btnEmailPassword" value="<?php 
            echo GetCap('capEmailMePassword');
            ?>
"/>
                        </td>
                    </tr>
                <?php 
        }
        ?>
                <tr>
                    <td>
                        <input type="hidden" name="blnPost" value="1"/>
                    </td>
                </tr> 
            </table>
         </form>
        <?php 
    } catch (Exception $ex) {
        ProcessException($ex);
    }
}
Esempio n. 10
0
function main()
{
    try {
        global $user;
        global $PHP_SELF;
        $id = $_POST['id'];
        $postID = $_POST['txtPostID'];
        if ($postID == "") {
            $postID = $_GET['postID'];
        }
        $type = $_POST['cboType'];
        if ($type == "") {
            $type = $_GET['type'];
        }
        $post = new Post($postID);
        $bbsRpt = new BBSReport($id);
        $bbsRpt->Type($type);
        $username = $post->Username();
        $text = $post->Text();
        $parent =& $post->Parent();
        $parID =& $parent->ID();
        $mov =& $post->Movie();
        $movTitle = $mov->Title();
        $movID = $mov->ID();
        $subject = $parent->Subject();
        if ($_POST['blnPost'] != 1 && $post->Username() == $user->Username()) {
            ?>
            <table>
                <tr>
                    <td>
                        <?php 
            echo "<h3>" . GetCap("capNote: YouAreReportingOnYourOwnPost") . "</h3>";
            ?>
                    </td>
                </tr>
                <tr>
                    <td>
                       <?php 
            echo GetCap('capReturnToTopic') . ": ";
            ?>
 
                       <?php 
            echo "<a href=\"bbs.php?id={$parID}\">{$subject}</a>";
            ?>
 
                    </td>
                </tr>
            </table>
        <?php 
        }
        $bbsRpts = new BBSReports("postID = {$postID} and userID = " . $user->ID());
        if ($bbsRpts->Count() > 0) {
            ?>
            <table>
                <tr>
                    <td>
                        <?php 
            echo GetCap("capYouHaveAlreadyReportedThisPost");
            ?>
                    </td>
                </tr>
                <tr>
                    <td>
                       <?php 
            echo GetCap('capReturnToTopic') . ": ";
            ?>
 
                       <?php 
            echo "<a href=\"bbs.php?id={$parID}\">{$subject}</a>";
            ?>
 
                    </td>
                </tr>
            </table>
            <?php 
            Dump();
        }
        if ($_POST['blnPost']) {
            $bbsRpt->PostID($post->ID());
            $bbsRpt->UserID($user->ID());
            $bbsRpt->Comments($_POST['txtComment']);
            if (UpdateObject($bbsRpt, true, true)) {
                ?>
                    <table>
                        <tr>
                            <td>
                                <?php 
                if ($bbsRpt->Type() == REPORT_TYPE_SPAM) {
                    print GetCap('capThankYouForFightingSpam');
                } elseif ($bbsRpt->Type() == REPORT_TYPE_ABUSE) {
                    print GetCap('capThankYouForReportingAbuse');
                } else {
                    throw new Exception("Report Type: '" . $bbsRpt->Type() . "' not supported");
                }
                ?>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <?php 
                echo GetCap("capYourReportWillBeReviewed. TheOffendingPostWillBeRemovedIfItViolatesOurPolicies");
                ?>
                            </td>
                        </tr>
                        <tr>
                            <td>
                               <?php 
                echo GetCap('capReturnToTopic') . ": ";
                ?>
 
                               <?php 
                echo "<a href=\"bbs.php?id={$parID}\">{$subject}</a>";
                ?>
 
                            </td>
                        </tr>
                    </table>
                <?php 
            }
        } else {
            $comments = $bbsRpt->Comments();
            $type = $bbsRpt->Type();
            $id = $bbsRpt->ID();
            ?>
            <form name="frm" method="post" action="<?php 
            echo $PHP_SELF;
            ?>
">
                <table>
                        <tr>
                            <td>
                                <?php 
            echo "<h3><a href=\"movie.php?id={$movID}\">{$movTitle}</a></h3>";
            ?>
                            </td>
                        </tr>
                        <tr>
                            <td>
                               <?php 
            echo GetCap('capTopic') . ":";
            ?>
 
                            </td>
                            <td>
                               <?php 
            echo "<a href=\"bbs.php?id={$parID}\">{$subject}</a>";
            ?>
 
                            </td>
                        </tr>
                        <tr>
                            <td>
                               <?php 
            echo GetCap('capUser') . ":";
            ?>
 
                            </td>
                            <td>
                               <?php 
            echo "<a href=\"user.php?username={$username}\">{$username}</a>";
            ?>
 
                            </td>
                        </tr>
                        <tr>
                            <td>
                               <?php 
            echo GetCap('capPost') . ":";
            ?>
 
                            </td>
                            <td>
                               <?php 
            echo "<b>{$text}</b>";
            ?>
 
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <?php 
            echo GetCap('capFlagAs') . ":";
            ?>
                            </td>
                            <td>
                                <select name="cboType">
                                    <option value="<?php 
            echo REPORT_TYPE_SPAM;
            ?>
"<?php 
            echo $type == REPORT_TYPE_SPAM ? ' selected="selected"' : "";
            ?>
><?php 
            echo GetCap('capSpam');
            ?>
</option>
                                    <option value="<?php 
            echo REPORT_TYPE_ABUSE;
            ?>
"<?php 
            echo $type == REPORT_TYPE_ABUSE ? ' selected="selected"' : "";
            ?>
><?php 
            echo GetCap('capAbuse');
            ?>
</option>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td>
                               <?php 
            echo GetCap('capComment/Complaint');
            ?>
 
                            </td>
                            <td>
                               <textarea rows="5" cols="75" name="txtComment"><?php 
            echo $comments;
            ?>
</textarea>
                            </td>
                        </tr>
                        <tr>
                            <td> &nbsp; </td>
                            <td>
                                <input type="submit" name="btnPost" value="<?php 
            echo GetCap('capReport');
            ?>
"/>
                            </td>
                            <td>
                                <input type="hidden" name="blnPost" value="1"/>
                            </td>
                            <td>
                                <input type="hidden" name="txtPostID" value="<?php 
            echo $postID;
            ?>
"/>
                            </td>
                        </tr>
                </table>
            </form>
        <?php 
        }
    } catch (Exception $ex) {
        ProcessException($ex);
    }
    require_once 'tailer.php';
}
Esempio n. 11
0
function main()
{
    try {
        global $pageTitle;
        global $locale;
        global $editable;
        global $session;
        global $user;
        global $gs;
        global $thisURI;
        global $thisURIEncoded;
        global $topicRowAlt1;
        global $topicRowAlt2;
        global $messaageBoardHeaderRow;
        $enableThread = $_GET['enableThread'] == '1' ? true : false;
        $disableThread = $_GET['disableThread'] == '1' ? true : false;
        $nowPlaying = $_POST['chkNowPlaying'] == '1' ? true : false;
        $visible = $_POST['chkVisible'] == '1' ? true : false;
        $id = $_GET['id'];
        if ($id == "") {
            $id = $_POST['id'];
        }
        $mov = new Movie($id);
        if ($mov->IsEmpty()) {
            BlockIfViolation("non-exisisting movie (id={$id})");
        }
        if (!$mov->Visible()) {
            BlockIfViolation("invisable view (id={$id})");
        }
        /*TODO:PERF:  This is very redundant. Keep in memory when resource
          becomes available */
        $link = new Link();
        $link->LoadLinkID('US_GOOGLE_PLAYTIMES');
        if ($enableThread) {
            if (!NoteViolation('enableThread')) {
                $postID = $_GET['postID'];
                $post = new Post($postID);
                $post->EnableRecursivly();
                UpdateObject($post);
                $session->Enabled("Post", $postID);
            }
        }
        if ($disableThread) {
            if (!NoteViolation('disableThread')) {
                $postID = $_GET['postID'];
                $post = new Post($postID);
                $post->DisableRecursivly();
                UpdateObject($post);
                $session->Disabled("Post", $postID);
            }
        }
        if ($_POST['btnLocation'] != '') {
            $location = $_POST['txtLocation'];
            if (isset($user)) {
                $user->PlayTimesLocation($location);
                UpdateObject($user, false);
            } else {
                $session->PlayTimesLocation($location);
                UpdateObject($session, false);
            }
            $session->ChangedPlayTimesLocation('Movie', $mov->ID(), $location);
            UpdateObject($session, false);
            $playTimesURL = $link->URLPlugged($location, $mov->GoogleID());
            header("Location: {$playTimesURL}");
            exit;
        }
        $classID = $gs->ClassName2ID('Movie');
        if (!$editable && $id == "") {
            throw new Exception(GetCap("capNoMovieID ParameterInURL"));
        }
        $PHP_SELF = $_SERVER['PHP_SELF'];
        if ($_POST['blnPost']) {
            if ($_POST['btnSnarf'] != '') {
                BlockIfViolation('snarf');
                $url = $_POST['txtURL'];
                $mov->SnarfMainPicture($url);
                $session->Snarfed("Movie", $mov->ID(), $url);
            } else {
                BlockIfViolation('update');
                $mov->Title($_POST['txtTitle']);
                $mov->ReleaseDate($_POST['txtReleaseDate']);
                $mov->Plot($locale, $_POST['txtPlot']);
                $mov->PlotOutline($locale, $_POST['txtPlotOutline']);
                $mov->GoogleID($_POST['txtGoogleID']);
                $mov->NowPlaying($nowPlaying);
                $mov->Visible($visible);
                UpdateObject($mov);
            }
        } else {
            if ($id != "") {
                $session->Viewed('Movie', $id);
            }
        }
        $title = $mov->Title();
        $pageTitle = $title;
        $gid = $mov->GoogleID();
        $releaseDate = $mov->ReleaseDate();
        $plot = $mov->Plot($locale);
        $plotOutline = $mov->PlotOutline($locale);
        $stars =& $mov->MovieToPerson_Stars();
        $writers =& $mov->MovieToPerson_Writers();
        $directors =& $mov->MovieToPerson_Directors();
        $otherSiteLinks =& $mov->OtherSiteLinks();
        $reviewLinks =& $mov->ReviewLinks();
        $trailerLinks =& $mov->TrailerLinks();
        $topics =& $mov->Topics();
        $nowPlaying = $mov->NowPlaying();
        $visible = $mov->Visible();
        $id = $mov->ID();
        if (isset($user)) {
            $location = $user->PlayTimesLocation();
        } else {
            $location = $session->PlayTimesLocation();
        }
        $playTimesURL = htmlentities($link->URLPlugged($location, $mov->GoogleID()));
        print "<br/>";
        if ($editable) {
            ?>
            <?php 
            if (!$mov->IsNew()) {
                ?>
                <form name="frmSnarf" method="post" action="<?php 
                echo $thisURI;
                ?>
">
                    <b><?php 
                echo GetCap('capURL');
                ?>
: </b>
                    <input type="text" size="52" name="txtURL" value="<?php 
                echo $url;
                ?>
"/>
                    <input type="submit" name="btnSnarf" value="<?php 
                echo GetCap('capSnarfPictureURL');
                ?>
"/>
                    <input type="hidden" name="blnPost" value="1"/>
                </form>
            <?php 
            }
            ?>
            <form name="frm" method="post" action="<?php 
            echo $PHP_SELF . "?id={$id}";
            ?>
">
                <table>
                    <tr>
                        <td>
                            <b><?php 
            echo GetCap('capTitle');
            ?>
: </b>
                            <input type="text" name="txtTitle" value="<?php 
            echo $title;
            ?>
"/>
                            &nbsp;&nbsp;
                            <b><?php 
            echo GetCap('capDate');
            ?>
: </b>
                            <input type="text" name="txtReleaseDate" value="<?php 
            echo $releaseDate;
            ?>
"/>
                            &nbsp;&nbsp;
                            <b><?php 
            echo GetCap('capNowPlaying');
            ?>
: </b>
                            <input type="checkbox" name="chkNowPlaying" value="1" <?php 
            echo $nowPlaying ? 'checked="checked"' : '';
            ?>
/>
                            &nbsp;&nbsp;
                            <b><?php 
            echo GetCap('capVisible');
            ?>
: </b>
                            <input type="checkbox" name="chkVisible" value="1" <?php 
            echo $visible ? 'checked="checked"' : '';
            ?>
/>
                        </td>
                    </tr>
                </table>

        <?php 
        }
        ?>
            <table bgcolor=#dddddd frame="border" width=800>
                <?php 
        if (!$editable) {
            ?>
                    <tr>
                        <td colspan="2">
                            <font size="12"><?php 
            echo $title;
            ?>
</font>
                        </td>
                    </tr>
                <tr> 
                <?php 
        }
        ?>
                    <td valign="top">
                        <?php 
        if (file_exists($mov->MainPicture())) {
            ?>
                            <img src="<?php 
            echo $mov->MainPicture();
            ?>
" alt=""/>
                        <?php 
        }
        ?>
                    </td>
                    <td valign="top">
                        <table>
                            <?php 
        /* If the below form were printed while $editable==true
           if would be nested in another form and cause lagic problems */
        if (!$editable) {
            ?>
                                <tr>
                                    <td>
                                        <b><?php 
            echo GetCap('capPlayTimes');
            ?>
</b>:
                                    </td>
                                    <?php 
            if ($location == "" || $_GET['changePlayTimesLocation'] == 1) {
                ?>
                                        <td valign="top">
                                            <b><?php 
                echo GetCap('capEnterCityStateOrZip');
                ?>
<br/></b>
                                                <form name="frmLocation0" method="post" action="<?php 
                echo $PHP_SELF;
                ?>
?id=<?php 
                echo $id;
                ?>
">
                                                    <input type="text" name="txtLocation" value="<?php 
                echo $location;
                ?>
" />
                                                    <input type="submit" name="btnLocation" value="<?php 
                echo GetCap('capShowPlayTimes');
                ?>
"/>
                                                </form>
                                        </td>
                                    <?php 
            } else {
                print "<td><a href=\"{$playTimesURL}\">" . GetCap('capShowPlayTimes') . " ({$location})</a>&nbsp;&nbsp;";
                print "<a href=\"{$PHP_SELF}?id={$id}&amp;changePlayTimesLocation=1\">[" . GetCap('capChangeLocation') . "]</a></td>";
            }
            ?>
                                </tr>
                            <?php 
        }
        ?>
                            <tr>
                                <td>
                                    <b><?php 
        echo GetCap('capCategories');
        ?>
</b>:
                                </td>
                                <td>
                                    <?php 
        $m2cs =& $mov->MovieToCategories();
        foreach ($m2cs as $m2c) {
            $cat =& $m2c->Category();
            $catID = $cat->ID();
            $name = $cat->Name($locale);
            print "<a href=\"movies.php?catID={$catID}\">{$name}</a> ";
        }
        if ($editable && !$mov->IsNew()) {
            ?>
                                        <sup><a href="<?php 
            echo 'movieToCategories.php?movID=' . $mov->ID();
            ?>
"><?php 
            echo '[' . GetCap('capE') . ']';
            ?>
</a></sup>
                                    <?php 
        }
        ?>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <?php 
        if ($stars->Count() > 1) {
            print "<b>" . GetCap('capStars') . ": </b>";
        } else {
            print "<b>" . GetCap('capStar') . ": </b>";
        }
        ?>
                                </td>
                                <td>
                                    <?php 
        foreach ($stars as $m2p) {
            $m2pID = $m2p->ID();
            $per =& $m2p->Person();
            $perID = $per->ID();
            $name = $per->Name();
            print "<a href=\"person.php?id={$perID}&amp;movID={$id}\">{$name}</a> ";
            if ($editable) {
                print "<sup><a href=\"movieToPerson.php?id={$m2pID}&amp;returnURI={$thisURIEncoded}\">[" . GetCap('capE') . "]</a></sup>";
                $deleteURI = GetDeleteURI($m2pID, 'MovieToPerson', 'MoviesToPerson');
                print "<sup><a href=\"{$deleteURI}\">[" . GetCap('capD') . "]</a></sup>";
            }
        }
        if ($editable && !$mov->IsNew()) {
            if (!$mov->IsNew()) {
                print "&nbsp;<a href=\"movieToPerson.php?movID={$id}&amp;relationship=s&amp;returnURI={$thisURIEncoded}\">[" . GetCap('capAdd') . "]</a>";
            }
        }
        ?>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <?php 
        if ($directors->Count() > 1) {
            print "<b>" . GetCap('capDirectors') . ": </b>";
        } else {
            print "<b>" . GetCap('capDirector') . ": </b>";
        }
        ?>
                                </td>
                                <td>
                                    <?php 
        foreach ($directors as $m2p) {
            $m2pID = $m2p->ID();
            $per =& $m2p->Person();
            $perID = $per->ID();
            $name = $per->Name();
            print "<a href=\"person.php?id={$perID}&amp;movID={$id}\">{$name}</a> ";
            if ($editable) {
                print "<sup><a href=\"movieToPerson.php?id={$m2pID}&amp;returnURI={$thisURIEncoded}\">[" . GetCap('capE') . "]</a></sup>";
                $deleteURI = GetDeleteURI($m2pID, 'MovieToPerson', 'MoviesToPerson');
                print "<sup><a href=\"{$deleteURI}\">[" . GetCap('capD') . "]</a></sup>";
            }
        }
        if ($editable && !$mov->IsNew()) {
            print "&nbsp;<a href=\"movieToPerson.php?movID={$id}&amp;relationship=d&amp;returnURI={$thisURIEncoded}\">[" . GetCap('capAdd') . "]</a>";
        }
        ?>
                                </td>
                           </tr>
                           <tr>
                                <td>
                                <?php 
        if ($writers->Count() > 1) {
            print "<b>" . GetCap('capWriters') . ": </b>";
        } else {
            print "<b>" . GetCap('capWriter') . ": </b>";
        }
        ?>
                                </td>
                                <td>
                                    <?php 
        foreach ($writers as $m2p) {
            $m2pID = $m2p->ID();
            $per =& $m2p->Person();
            $perID = $per->ID();
            $name = $per->Name();
            print "<a href=\"person.php?id={$perID}&amp;movID={$id}\">{$name}</a> ";
            if ($editable) {
                print "<sup><a href=\"movieToPerson.php?id={$m2pID}&amp;returnURI={$thisURIEncoded}\">[" . GetCap('capE') . "]</a></sup>";
                $deleteURI = GetDeleteURI($m2pID, 'MovieToPerson', 'MoviesToPerson');
                print "<sup><a href=\"{$deleteURI}\">[" . GetCap('capD') . "]</a></sup>";
            }
        }
        if ($editable && !$mov->IsNew()) {
            print "&nbsp;<a href=\"movieToPerson.php?movID={$id}&amp;relationship=w&amp;returnURI={$thisURIEncoded}\">[" . GetCap('capAdd') . "]</a>";
        }
        ?>
                                </td>
                            </tr>
                            <tr>
                                <td valign="top">
                                    <?php 
        $capPlot = GetCap('capPlot');
        print "<b>{$capPlot}: </b>";
        ?>
                                </td>
                                <td>
                                    <?php 
        $plotWrapped = wordwrap($plotOutline, 75, '<br />');
        if ($editable) {
            print "<textarea rows=\"5\" cols=\"75\" name=\"txtPlotOutline\">{$plotOutline}</textarea>";
        } else {
            echo $plotWrapped;
        }
        ?>
                                </td>
                            </tr>
                            <?php 
        if ($editable) {
            ?>
                            <tr>
                                <td valign="top">
                                    <b><?php 
            echo GetCap('capPreview');
            ?>
:</b><br />
                                    <?php 
            echo '<b>(' . strlen($plotOutline) . ')</b>';
            ?>
                                </td>
                                <td>
                                    <?php 
            echo $plotWrapped;
            ?>
                                </td>
                            </tr>
                            <?php 
        }
        ?>
                            <tr>
                                <td>
                                    <b><?php 
        echo GetCap('capTrailers');
        ?>
: </b>
                                </td>
                                <td>
                                    <?php 
        foreach ($trailerLinks as $link) {
            ?>
                                            <a href="<?php 
            echo $link->URL();
            ?>
"><?php 
            echo GetCap($link->Source());
            ?>
</a>
                                            <?php 
            if ($editable) {
                $deleteURI = GetDeleteURI($link->ID(), 'Link');
                ?>
                                                <sup><a href="<?php 
                echo "link.php?id=" . $link->ID() . "&amp;instanceID={$id}&amp;classID={$classID}&amp;returnURI={$thisURIEncoded}";
                ?>
"> <?php 
                echo '[' . GetCap('capE') . ']';
                ?>
 </a></sup>
                                                <sup><a href="<?php 
                echo $deleteURI;
                ?>
"><?php 
                echo '[' . GetCap('capD') . ']';
                ?>
</a></sup>
                                            <?php 
            }
            ?>
                                        <?php 
        }
        if ($editable && !$mov->IsNew()) {
            print "&nbsp;<a href=\"link.php?type=t&amp;instanceID={$id}&amp;classID={$classID}&amp;returnURI={$thisURIEncoded}\">[" . GetCap('capAdd') . "]</a>";
        }
        ?>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <b><?php 
        echo GetCap('capReviews');
        ?>
: </b>
                                </td>
                                <td>
                                    <?php 
        foreach ($reviewLinks as $link) {
            ?>
                                            <a href="<?php 
            echo $link->URL();
            ?>
"><?php 
            echo GetCap($link->Source()) . ' (' . $link->Author() . ')';
            ?>
</a>
                                            <?php 
            if ($editable) {
                $deleteURI = GetDeleteURI($link->ID(), 'Link');
                ?>
                                                <sup><a href="<?php 
                echo "link.php?id=" . $link->ID() . "&amp;instanceID={$id}&amp;classID={$classID}&amp;returnURI={$thisURIEncoded}";
                ?>
"> <?php 
                echo '[' . GetCap('capE') . ']';
                ?>
 </a></sup>
                                                <sup><a href="<?php 
                echo $deleteURI;
                ?>
"><?php 
                echo '[' . GetCap('capD') . ']';
                ?>
</a></sup>
                                            <?php 
            }
            ?>
                                        <?php 
        }
        if ($editable && !$mov->IsNew()) {
            print "&nbsp;<a href=\"link.php?type=r&amp;instanceID={$id}&amp;classID={$classID}&amp;returnURI={$thisURIEncoded}\">[" . GetCap('capAdd') . "]</a>";
        }
        ?>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <b><?php 
        echo GetCap('capOtherSites');
        ?>
: </b>
                                </td>
                                <td>
                                    <?php 
        foreach ($otherSiteLinks as $link) {
            ?>
                                            <a href="<?php 
            echo $link->URL();
            ?>
"><?php 
            echo GetCap($link->Source());
            ?>
</a>
                                            <?php 
            if ($editable) {
                $deleteURI = GetDeleteURI($link->ID(), 'Link');
                ?>
                                                <sup><a href="<?php 
                echo "link.php?id=" . $link->ID() . "&amp;instanceID={$id}&amp;classID={$classID}&amp;returnURI={$thisURIEncoded}";
                ?>
"> <?php 
                echo '[' . GetCap('capE') . ']';
                ?>
 </a></sup>
                                                <sup><a href="<?php 
                echo $deleteURI;
                ?>
"><?php 
                echo '[' . GetCap('capD') . ']';
                ?>
</a></sup>
                                            <?php 
            }
            ?>
                                        <?php 
        }
        if ($editable && !$mov->IsNew()) {
            print "&nbsp;<a href=\"link.php?type=o&amp;instanceID={$id}&amp;classID={$classID}&amp;returnURI={$thisURIEncoded}\">[" . GetCap('capAdd') . "]</a>";
        }
        ?>
                                    <input type="hidden" name="blnPost" value="1" />
                                </td>
                            </tr>
                            <?php 
        if ($editable) {
            ?>
                                <tr>
                                    <?php 
            echo '<td><b>' . GetCap('capGoogleID') . ":</b></td><td><input type=\"text\" name=\"txtGoogleID\" value=\"{$gid}\"/></td>";
            ?>
                                </tr>
                            <?php 
        }
        ?>
                        </table>
                    </td>
                </tr>
                <?php 
        if ($editable) {
            ?>
                    <tr>
                        <td>&nbsp;</td>
                        <td> <input type="submit" name="btnSubmit" value="<?php 
            echo GetCap('capSubmit');
            ?>
"/> </td>
                    </tr>
                <?php 
        }
        ?>
            </table>
         <?php 
        if ($editable) {
            echo "</form>";
        }
        ?>

         <br />
         <form name="frmBB" method="post" action="<?php 
        echo $PHP_SELF;
        ?>
">
            <table>
                <tr>
                    <td>
                        <?php 
        echo '<b>' . GetCap('capMessageBoard') . '</b>';
        ?>
 &nbsp; &nbsp;
                        [<?php 
        echo "<a href=\"bbs.php?movID={$id}\">" . GetCap('capNewTopic') . "</a>";
        ?>
]
                    </td>
                </tr>
            </table>
            <table border="1">
                <tr>
                    <td>
                        <table>
                            <tr>
                                <td>
                                    <b><?php 
        echo GetCap('capTopics') . str_repeat('&nbsp;', 60);
        ?>
</b>
                                </td>
                                <td>
                                    <b><?php 
        echo GetCap('capUsers');
        ?>
</b>
                                </td>
                            <?php 
        if ($user != null && $user->IsMaintainer()) {
            ?>
                                        <td>
                                            <b><?php 
            echo GetCap('capBowdlerisation');
            ?>
</b>
                                        </td>
                                    <?php 
        }
        ?>
                            </tr>
                        <?php 
        $alt = false;
        foreach ($topics as $topic) {
            $alt = !$alt;
            if ($alt) {
                $rowAttr = $topicRowAlt1;
            } else {
                $rowAttr = $topicRowAlt2;
            }
            $topID = $topic->ID();
            $sub = $topic->Subject();
            $username = $topic->Username();
            $viewCount = $topic->ViewCount();
            if (!$topic->RecursiveDisabled() || $user != null && $user->IsMaintainer()) {
                ?>
                                    <tr <?php 
                echo $rowAttr;
                ?>
>
                                        <td>
                                            <?php 
                echo "<a href=\"bbs.php?id={$topID}\">{$sub}</a>";
                ?>
                                        </td>
                                        <td>
                                            <?php 
                echo "<a href=\"user.php?username={$username}\">{$username}</a>";
                ?>
                                        </td>
                                        <?php 
                if ($editable) {
                    if ($topic->RecursiveDisabled()) {
                        echo "<td><a href=\"movie.php?id={$id}&amp;postID={$topID}&amp;enableThread=1\">" . GetCap('capEnable') . "</a></td>";
                    } else {
                        echo "<td><a href=\"movie.php?id={$id}&amp;postID={$topID}&amp;disableThread=1\">" . GetCap('capDisable') . "</a></td>";
                    }
                }
                ?>
                                    </tr>
                                <?php 
            }
        }
        ?>
                        </table>
                    </td>
                </tr>
            </table>
        </form>
        <?php 
    } catch (Exception $ex) {
        ProcessException($ex);
    }
}
Esempio n. 12
0
function main()
{
    try {
        BlockIfViolation();
        global $user;
        global $PHP_SELF;
        $disable = $_GET['disable'] == '1' ? true : false;
        $disableThread = $_GET['disableThread'] == '1' ? true : false;
        $ignore = $_GET['ignore'] == '1' ? true : false;
        $postID = $_GET['postID'];
        $postCounts = array();
        $bbsRpts = new BBSReports('resolvedState=' . RESOLVED_STATE_UNRESOLVED);
        foreach ($bbsRpts as $rpt) {
            $postCounts[$rpt->PostID()]++;
        }
        arsort($postCounts, SORT_NUMERIC);
        $remove = array();
        if ($disableThread) {
            $post = new Post($postID);
            $post->DisableRecursivly();
            foreach ($bbsRpts as $rpt) {
                if ($rpt->PostID() == $postID) {
                    $rpt->ResolvedState(RESOLVED_STATE_DISABLED);
                    unset($postCounts[$postID]);
                }
            }
            UpdateObject($bbsRpts);
            UpdateObject($post);
        }
        if ($disable) {
            $post = new Post($postID);
            $post->Disabled(true);
            foreach ($bbsRpts as $rpt) {
                if ($rpt->PostID() == $postID) {
                    $rpt->ResolvedState(RESOLVED_STATE_DISABLED);
                    unset($postCounts[$postID]);
                }
            }
            UpdateObject($bbsRpts);
            UpdateObject($post);
        }
        if ($ignore) {
            foreach ($bbsRpts as $rpt) {
                if ($rpt->PostID() == $postID) {
                    $rpt->ResolvedState(RESOLVED_STATE_IGNORED);
                    unset($postCounts[$postID]);
                }
            }
            UpdateObject($bbsRpts);
        }
        if (count($postCounts) == 0) {
            print GetCap('capNoUnresolvedAbuses');
        } else {
            ?>
            <table>
                <?php 
            foreach ($postCounts as $postID => $postCount) {
                $post = new Post($postID);
                $username = $post->Username();
                $text = $post->Text();
                $parent =& $post->Parent();
                $parID =& $parent->ID();
                $mov =& $post->Movie();
                $movTitle = $mov->Title();
                $movID = $mov->ID();
                $subject = $parent->Subject();
                $rpts =& $bbsRpts->GetBy('postID', $postID);
                $spamCnt = $rpts->SpamCount();
                $abuseCnt = $rpts->AbuseCount();
                ?>
                    <tr>
                        <td>
                            &nbsp;
                        </td>
                        <td>
                            <?php 
                echo "<a href=\"{$PHP_SELF}?postID={$postID}&amp;disable=1\">" . GetCap('capDisable') . "</a>&nbsp;|&nbsp;";
                if ($post->IsTopic()) {
                    echo "<a href=\"{$PHP_SELF}?postID={$postID}&amp;disableThread=1\">" . GetCap('capDisableThread') . "</a>&nbsp;|&nbsp;";
                }
                echo "<a href=\"{$PHP_SELF}?postID={$postID}&amp;ignore=1\">" . GetCap('capIgnore') . "</a>";
                ?>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <?php 
                echo GetCap('capID');
                ?>
                        </td>
                        <td>
                            <?php 
                echo $postID;
                ?>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <?php 
                echo GetCap('capMovie');
                ?>
                        </td>
                        <td>
                            <a href="movie.php?id=<?php 
                echo $movID;
                ?>
"><?php 
                echo $movTitle;
                ?>
</a>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <?php 
                echo GetCap('capPost');
                ?>
                        </td>
                        <td>
                            <a href="bbs.php?id=<?php 
                echo $parID;
                ?>
"><?php 
                echo $subject;
                ?>
</a>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <?php 
                echo GetCap('capText');
                ?>
                        </td>
                        <td>
                            <?php 
                echo $text;
                ?>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <?php 
                echo GetCap('capSpam');
                ?>
                        </td>
                        <td>
                            <?php 
                echo $spamCnt;
                ?>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <?php 
                echo GetCap('capAbuse');
                ?>
                        </td>
                        <td>
                            <?php 
                echo $abuseCnt;
                ?>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <?php 
                echo GetCap('capTotal');
                ?>
                        </td>
                        <td>
                            <?php 
                echo $postCount;
                ?>
                        </td>
                    </tr>
                    <?php 
                foreach ($rpts as $rpt) {
                    $comments = $rpt->Comments();
                    $type = $rpt->Type();
                    $rptUser =& $rpt->User();
                    $username = $rptUser->Username();
                    ?>
                        <tr>
                            <td>
                                <?php 
                    print "&nbsp;&nbsp;&nbsp;&nbsp;";
                    print "<a href=\"user.php?username={$username}\">{$username}</a>";
                    ?>
                            </td>
                            <td>
                                <?php 
                    if ($type == REPORT_TYPE_SPAM) {
                        print " [" . strtoupper(GetCap('capSpam')) . "]";
                    } elseif ($type == REPORT_TYPE_ABUSE) {
                        print " [" . strtoupper(GetCap('capAbuse')) . "]";
                    }
                    if ($comments != "") {
                        print " \"{$comments}\"";
                    }
                    ?>
                            </td>
                        </tr>
                        <?php 
                }
            }
            ?>
            </table>
        <?php 
        }
    } catch (Exception $ex) {
        ProcessException($ex);
    }
    require_once 'tailer.php';
}