Example #1
0
 public function test1($data)
 {
     $APIModel = new APIModel();
     $ret = '';
     $rets = (yield $APIModel->HttpMuticall($data));
     var_dump($rets);
     (yield $ret);
 }
 * You can contact X2Engine, Inc. P.O. Box 66752, Scotts Valley,
 * California 95067, USA. or at email address contact@x2engine.com.
 * 
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License version 3.
 * 
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * X2Engine" logo. If the display of the logo is not reasonably feasible for
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by X2Engine".
 *****************************************************************************************/
require '../protected/models/APIModel.php';
$attributes = $_POST['Contacts'];
$contact = new APIModel('admin', '21232f297a57a5a743894a0e4a801fc3', rtrim('TEST_BASE_URL_ALIAS_1', '/'));
$fieldMap = array('firstName' => 'firstName', 'lastName' => 'lastName', 'email' => 'email', 'phone' => 'phone', 'backgroundInfo' => 'backgroundInfo');
foreach ($attributes as $key => $value) {
    if (isset($fieldMap[$key])) {
        $contact->{$fieldMap[$key]} = $value;
        // Found in field map, used mapped attribute
    } else {
        $contact->{$key} = $value;
        // No match anywhere, assume it's a Contact attribute
    }
}
if (isset($_POST['x2_key'])) {
    $contact->trackingKey = $_POST['x2_key'];
}
if ((int) $contact->contactCreate()) {
    ?>
Example #3
0
 private function processData()
 {
     if ($this->context == "Data was submitted") {
         $model = new APIModel();
         if ($this->verifyForm()) {
             if ($_SESSION['userid'] == "") {
                 echo "<script>\r\n\t\t\talert('Session variable not working');\r\n\t\t\t</script>";
             }
             $userid = $model->getID($this->userName);
             $albumID = $model->getAlbumID($userid, $this->albumName);
             if ($albumID == "Get ID Fail") {
                 echo "<script>\r\n\t\t\talert('Get ID FAILED!');\r\n\t\t\t</script>";
             }
             $pictureID = $model->getPhotoID($albumID, $this->pictureName);
             $result = $model->addTag($pictureID, $this->tagName, $_SESSION['userid']);
             if ($result == "Creation successful.") {
                 //session_register($this->username);
                 //echo $userID;
                 echo "<script>\r\n\t\t\talert('WE DID IT!');\r\n\t\t\t</script>";
             } else {
                 print $result;
             }
         }
     }
     if ($this->context2 == 1) {
         $model = new APIModel();
         $this->idphoto = $model->photoID($_SESSION['userid']);
         $this->albumList = $model->AlbumList($_SESSION['userid']);
         $this->captionList = $model->pictureTitles($_SESSION['userid']);
         $this->tagList = $model->tagZList($_SESSION['userid']);
         $result = $model->deleteTag($this->idphoto[$this->del], $this->tagList[$this->del]);
         if ($result == 1) {
             print '<script type="text/javascript">';
             print 'alert("The tag ' . $this->tagList[$this->del] . ' from the picture ' . $this->captionList[$this->del] . ' from Album ' . $this->AlbumList[$this->del] . ' is succesfuly deleted")';
             print '</script>';
         } else {
             print '<script type="text/javascript">';
             print 'alert("The tag ' . $this->tagList[$this->del] . ' from the picture ' . $this->captionList[$this->del] . ' from Album ' . $this->AlbumList[$this->del] . ' is NOT succesfuly  DELETED")';
             print '</script>';
         }
     }
 }
Example #4
0
    private function processData()
    {
        if ($this->context == "Data was submitted") {
            $model = new APIModel();
            if ($this->verifyForm()) {
                $result = $model->login($this->username, $this->password);
                if ($result == "Login Succesful!") {
                    //session_register($this->username);
                    $userID = $model->getID($this->username);
                    //echo $userID;
                    if ($userID != "Get ID Fail") {
                        $_SESSION['userid'] = $userID;
                        ?>
						<!--<form method="get" action="../createAlbum/createAlbum.php">
    				<input type="hidden" name="userid" value='<?php 
                        //echo $userID;
                        ?>
'>
    				<input type="submit">
						</form>-->

						<meta http-equiv="refresh" content="0; url=http://localhost:8888/CS460PA2/Newsfeed/newsFeed.php" />

						<?php 
                    }
                } else {
                    print $result;
                }
            }
        }
        if ($this->context == "guest") {
            $_SESSION['userid'] = -99;
            ?>
						

						<meta http-equiv="refresh" content="0; url=http://localhost:8888/CS460PA2/Newsfeed/newsFeed.php" />

						<?php 
        }
    }
    private function processData()
    {
        if ($this->context == "Data was submitted") {
            $model = new APIModel();
            if ($this->verifyForm()) {
                if ($_SESSION['userid'] == "") {
                    echo "<script>\r\n\t\t\talert('Session variable not working');\r\n\t\t\t</script>";
                }
                $result = $model->createFriend($_SESSION['userid'], $this->friendName);
                if ($result == "Creation successful.") {
                    //session_register($this->username);
                    //echo $userID;
                    print '<script type="text/javascript">';
                    print 'alert("The friend ' . $this->friendName . ' is succesfuly added")';
                    print '</script>';
                    ?>
						<!--<form method="get" action="../createAlbum/createAlbum.php">
    				<input type="hidden" name="userid" value='<?php 
                    //echo $userID;
                    ?>
'>
    				<input type="submit">
						</form>-->

						<!--<meta http-equiv="refresh" content="0; url=http://localhost:8888/CS460PA2/addPicture/createPhoto.php" />-->

						<?php 
                } else {
                    print $result;
                }
            }
        }
        if ($this->context2 == 1) {
            $model = new APIModel();
            $this->list = $model->FriendList($_SESSION['userid']);
            $result = $model->deleteFriend($this->list[$this->del], $_SESSION['userid']);
            if ($result == 1) {
                print '<script type="text/javascript">';
                print 'alert("The friend ' . $this->list[$this->del] . ' is succesfuly deleted")';
                print '</script>';
            } else {
                print '<script type="text/javascript">';
                print 'alert("The friend ' . $this->list[$this->del] . ' is NOT succesfuly  DELETED")';
                print '</script>';
            }
        }
    }
Example #6
0
        gc_enable();
        gc_collect_cycles();
        echo "{$awardcount} records processed ... " . memory_get_usage() . " ...";
    }
} while ($awards->next());
unset($awards);
unset($Player);
unset($mundanes);
unset($parks);
unset($personas);
gc_enable();
gc_collect_cycles();
echo memory_get_usage();
echo "{$awardcount} Awards entered ...";
echo "<h2>Player Attendance</h2>";
$Attendance = new APIModel('Attendance');
$attendance->clear();
$attendance->find();
$attendancecount = 0;
do {
    if (isset($player_map[$attendance->mundanefk])) {
        $Attendance->AddAttendance(array('Token' => $Token, 'ClassId' => $class_map[$attendance->classfk], 'MundaneId' => $player_map[$attendance->mundanefk], 'Date' => $attendance->date, 'Credits' => max($attendance->credits, $attendance->eventcredits), 'ParkId' => $attendance->event ? 0 : $park_map[$attendance->park], 'KingdomId' => $KingdomId, 'EventCalendarDetailId' => 0));
        $attendancecount++;
    }
    if ($attendancecount % 250 == 0) {
        set_time_limit(10);
        gc_enable();
        gc_collect_cycles();
        echo "{$attendancecount} records processed ... " . memory_get_usage() . " ...";
    }
} while ($attendance->next());
 private function processData()
 {
     if ($this->context == "Data was submitted") {
         $model = new APIModel();
         if ($this->verifyForm()) {
             if ($_SESSION['userid'] == "") {
                 echo "<script>\r\n\t\t\talert('Session variable not working');\r\n\t\t\t</script>";
             }
             $result = $model->createAlbum($_SESSION['userid'], $this->albumName);
             if ($result == "Creation successful.") {
                 //session_register($this->username);
                 //echo $userID;
                 echo "<script>\r\n\t\t\talert('Album creation a success!!');\r\n\t\t\t</script>";
             } else {
                 print $result;
             }
         }
     }
     if ($this->context2 == 1) {
         $model = new APIModel();
         $this->list = $model->AlbumList($_SESSION['userid']);
         $result = $model->deleteAlbum($this->list[$this->del], $_SESSION['userid']);
         if ($result == 1) {
             print '<script type="text/javascript">';
             print 'alert("The album ' . $this->list[$this->del] . ' is succesfuly deleted")';
             print '</script>';
         } else {
             print '<script type="text/javascript">';
             print 'alert("The album ' . $this->list[$this->del] . ' is NOT succesfuly  DELETED")';
             print '</script>';
         }
     }
 }
    private function showHTML()
    {
        echo $_SESSION['userid'];
        ?>
		<!--<html>
<body>
 
<form action="createAlbumActivity.php" method="POST" enctype="multipart/form-data">
    <input type="file" name="file"/>
    <br />
    <input type="submit"/>
</form>
 
</body>
</html>-->

<html>
<head>
<title>Upload Image </title>
<script>
function createAlbum() {

	<?php 
        if ($_SESSION['userid'] != -99) {
            ?>

    window.location.href ="http://localhost:8888/CS460PA2/createAlbum/createAlbum.php";
<?php 
        }
        ?>
}
function createPhoto() {
		<?php 
        if ($_SESSION['userid'] != -99) {
            ?>
    window.location.href ="http://localhost:8888/CS460PA2/addPicture/createPhoto.php";
    <?php 
        }
        ?>
}
function addLike() {
		<?php 
        if ($_SESSION['userid'] != -99) {
            ?>
    window.location.href ="http://localhost:8888/CS460PA2/addLike/addLike.php";
    <?php 
        }
        ?>
}
function AddTag() {
		<?php 
        if ($_SESSION['userid'] != -99) {
            ?>
    window.location.href ="http://localhost:8888/CS460PA2/addTag/addTag.php";
    <?php 
        }
        ?>
}
function addComment() {
    window.location.href ="http://localhost:8888/CS460PA2/addComment/addComment.php";
}
function newsFeed() {
    window.location.href ="http://localhost:8888/CS460PA2/Newsfeed/newsFeed.php";
}
function addFriend() {
		<?php 
        if ($_SESSION['userid'] != -99) {
            ?>
    window.location.href ="http://localhost:8888/CS460PA2/addFriend/addFriend.php";
    	<?php 
        }
        ?>
}
function logout() {
    window.location.href ="http://localhost:8888/CS460PA2/Logout/Logout.php";
}
function showLike() {
    window.location.href ="http://localhost:8888/CS460PA2/showLikes/showLike.php";
}
function UserActivity() {
    window.location.href ="http://localhost:8888/CS460PA2/showContributers/showContributer.php";
}
function PopTag() {
    window.location.href ="http://localhost:8888/CS460PA2/showPopTags/showPopTags.php";
}
</script>
</head>
<body>
<br>
<button onclick="newsFeed()">Newsfeed</button><button onclick="addFriend()">Friend</button><button onclick="createAlbum()">CreateAlbum</button><button onclick="createPhoto()">CreatePicture</button><button onclick="addLike()">AddLike</button><button onclick="AddTag()">AddTag</button><button onclick="addComment()">AddComment</button><button onclick="showLike()">ListOfLikes</button><button onclick="UserActivity()">UserActivity</button><button onclick="PopTag()">PopularTags</button><button onclick="logout()">Logout</button>
<br>
<br>


<?php 
        $model = new APIModel();
        $this->peopleList = $model->ownerLIst();
        $result;
        $counter = 0;
        foreach ($this->peopleList as $x => $x_value) {
            $result[$counter] = $x;
            $this->contributionList[$counter] = $x_value;
            $counter = $counter + 1;
        }
        $this->arrlength = count($this->peopleList);
        echo "<table id= 'myTable' style='width:400px;'>";
        echo "  <caption>Contributer List</caption>";
        echo "<tr>";
        echo "<td>Users:</td>";
        echo "<td>Contributions:</td>";
        echo "</tr>";
        for ($x = 0; $x < $this->arrlength; $x++) {
            //echo $this->photoList[$x];
            echo "<tr>";
            echo "<td>" . $result[$x] . "</td>";
            echo "<td>" . $this->contributionList[$x] . "</td>";
            /*
            
            $image = imagecreatefromstring($this->photoList[$x]); 
            ob_start(); //You could also just output the $image via header() and bypass this buffer capture.
            				imagepng($image, null, 80);
            				$data = ob_get_contents();
            				ob_end_clean();
            				
            
            echo '<td><img src="data:image/png;base64,' .  base64_encode($this->photoList[$x])  . '" /></td>';
            */
        }
        ?>


</body>

</html>

		<?php 
    }
<pre>

<?php 
$TESTS = 1;
$DONOTWEBSERVICE = true;
include_once 'AuthorizationService.php';
$request = array('Username' => 'admin', 'Password' => 'password');
$Auth = new APIModel("Authorization");
$r = $Auth->Authorize($request);
print_r($r);
die;
if (APP_STAGE != 'DEV') {
    die('Running testrigs on a non-Dev system will delete your data! ' . APP_STAGE);
}
/*******************************************
 * Test Authorization Checks
 ******************************************/
/*******************************************
 * NO USER
 ******************************************/
echo "</pre><h2>Authorization: no user</h2><pre>";
$authp = array();
$authp[] = array(AUTH_ADMIN, 0, AUTH_ADMIN, false);
$authp[] = array(AUTH_KINGDOM, 1, AUTH_EDIT, false);
$authp[] = array(AUTH_KINGDOM, 1, AUTH_CREATE, false);
$authp[] = array(AUTH_PARK, 3, AUTH_EDIT, false);
$authp[] = array(AUTH_PARK, 3, AUTH_CREATE, false);
$authp[] = array(AUTH_EVENT, 1, AUTH_EDIT, false);
$authp[] = array(AUTH_EVENT, 1, AUTH_CREATE, false);
$authp[] = array(AUTH_UNIT, 1, AUTH_EDIT, false);
$authp[] = array(AUTH_UNIT, 1, AUTH_CREATE, false);
Example #10
0
<?php

$DONOTWEBSERVICE = true;
include_once 'CalendarService.php';
$request = array('Type' => 'Year', 'Date' => date("Y-m-d"));
$C = new APIModel("Calendar");
$r = $C->Next($request);
print_r($r);
die;
Example #11
0
        $values;
        $counter = 0;
        foreach ($temp as $x => $x_value) {
            $names[$counter] = $x;
            $values[$counter] = $x_value;
            $counter = $counter + 1;
        }
        // print_r($temp2);
        //echo "<br>";
        return $temp2;
    }
    public function allTags()
    {
        $photos = array();
        $this->mysqlconnect();
        $query = "SELECT * FROM tags_table  ";
        $id = 0;
        $result = $this->mysqli->query($query) or die('SELECT query failed: ' . mysql_error());
        for ($row = $result->fetch_assoc(); $row != FALSE; $row = $result->fetch_assoc()) {
            $name = stripslashes($row["tag"]);
            if ($name != "NA") {
                $photos[$id] = "{$name}";
            }
            $id++;
        }
        return $photos;
    }
}
//unit tests
$model = new APIModel();
$return = $model->ownerLIst();
Example #12
0
 function ImportKingdoms()
 {
     echo "<h2>Import Kingdoms</h2>";
     list($kingdom_id, $detail) = $this->LastStatus('kingdoms', array(14));
     $sql = "select * from kingdoms where kingdomID > {$kingdom_id} and kingdomID != 14 order by kingdomID";
     $kingdoms = $this->ORK2->query($sql);
     $Kingdom = new APIModel('Kingdom');
     echo $sql . "<p>";
     if ($kingdoms->size() > 0) {
         do {
             if ($kingdoms->kingdomID == 2) {
                 continue;
             }
             echo "Create Kingdom {$kingdoms->name}<br />";
             $kingdom = $Kingdom->CreateKingdom(array('Token' => $this->token, 'Name' => $kingdoms->name, 'Abbreviation' => $kingdoms->abbr, 'AveragePeriod' => 6, 'AttendancePeriodType' => 'Month', 'AttendanceMinimum' => 6, 'AttendanceCreditMinimum' => 9, 'DuesPeriod' => 6, 'DuesPeriodType' => 'Month', 'DuesAmount' => 6.0, 'KingdomDuesTake' => 3.0, 'HeraldryUrl' => 'http://www.amtgardrecords.com/images/kingdomthumbs/' . $kingdoms->kingdomthumb));
             $this->RecordTransfer('kingdoms', 'Kingdom', $kingdoms->kingdomID, $kingdom['Detail'], array());
         } while ($kingdoms->next());
     }
     echo "<h3>Import Kingdoms Complete</h3>";
 }
Example #13
0
 private function processData()
 {
     if ($this->context == "Data was submitted") {
         $model = new APIModel();
         /*echo "allPics is: ". $this->allPics;
         		echo "<br>";
         		echo "yourTags is: ". $this->yourTags;
         		echo "<br>";
         		echo "allTags is: ". $this->allTags;
         		echo "<br>";
         		*/
         if ($this->allPics == 1 && $this->yourTags == '' && $this->allTags == '' && $this->yourAlbums == '' && $this->allAlbums == '' && $this->yourPics == '' && $this->allBrowsePictures == '') {
             //echo "we here 1";
             $this->albumList = $model->allAlbumList();
             $this->captionList = $model->allCaptionsList();
             $this->photoList = $model->allgetImages();
             $this->dates = $model->allDateOfAlbums();
             $this->peopleList = $model->allOwnerList();
             $this->idphoto = $model->allPhotoIDList();
             // $this->likeList=$model->allLikeList();
             $this->arrlength = count($this->albumList);
             echo "<table id= 'myTable' style='width:800px;'>";
             echo "  <caption>All Pictures List</caption>";
             echo "<tr>";
             echo "<td>Owner:</td>";
             echo "<td>Album Name:</td>";
             echo "<td>DateOfALbum:</td>\t";
             echo " <td>Picture Name: </td>";
             echo "<td>Image:</td>";
             //  echo"<td>Likes:</td>";
             echo "</tr>";
             for ($x = 0; $x < $this->arrlength; $x++) {
                 //echo $this->photoList[$x];
                 echo "<tr>";
                 echo "<td>" . $this->peopleList[$x] . "</td>";
                 echo "<td>" . $this->albumList[$x] . "</td>";
                 echo "<td>" . $this->dates[$x] . "</td>";
                 echo "<td>" . $this->captionList[$x] . "</td>";
                 /*
                             	$image = imagecreatefromstring($this->photoList[$x]); 
                             	ob_start(); //You could also just output the $image via header() and bypass this buffer capture.
                 				imagepng($image, null, 80);
                 				$data = ob_get_contents();
                 				ob_end_clean();
                 				
                             	echo '<td><img src="data:image/png;base64,' .  base64_encode($this->photoList[$x])  . '" /></td>';
                             	//echo "<td>" .$this->likeList[$x]. "</td>";
                 */
                 $picid = $this->idphoto[$x];
                 echo "<td><img src =../Newsfeed/get.php?id=" . $picid . "> </td>";
             }
         } else {
             if ($this->allPics == '' && $this->yourTags != '' && $this->allTags == '' && $this->yourAlbums == '' && $this->allAlbums == '' && $this->yourPics == '' && $this->allBrowsePictures == '') {
                 $result = $model->verifyYourTag($_SESSION['userid'], $this->yourTags);
                 if ($result == "Tag Exists") {
                     $this->tagList = $model->yourTagtagZList($_SESSION['userid'], $this->yourTags);
                     $this->albumList = $model->yourTagAlbumList($_SESSION['userid'], $this->yourTags);
                     $this->captionList = $model->yourTagCaptionsList($_SESSION['userid'], $this->yourTags);
                     $this->photoList = $model->yourTaggetImages($_SESSION['userid'], $this->yourTags);
                     $this->dates = $model->yourTagDateOfAlbums($_SESSION['userid'], $this->yourTags);
                     $this->peopleList = $model->yourTagOwnerList($_SESSION['userid'], $this->yourTags);
                     $this->idphoto = $model->yourPhotoList($_SESSION['userid'], $this->yourTags);
                     //$this->likeList=$model->yourTagLikeList($this->yourTags);
                     $this->arrlength = count($this->albumList);
                     echo "<table id= 'myTable' style='width:800px;'>";
                     echo "  <caption>All Pictures By Your Tag List</caption>";
                     echo "<tr>";
                     echo "<td>Owner:</td>";
                     echo "<td>Album Name:</td>";
                     echo "<td>DateOfALbum:</td>\t";
                     echo " <td>Picture Name: </td>";
                     echo "<td>Tag:</td>";
                     echo "<td>Image:</td>";
                     // echo"<td>Likes:</td>";
                     echo "</tr>";
                     for ($x = 0; $x < $this->arrlength; $x++) {
                         //echo $this->photoList[$x];
                         echo "<tr>";
                         echo "<td>" . $this->peopleList[$x] . "</td>";
                         echo "<td>" . $this->albumList[$x] . "</td>";
                         echo "<td>" . $this->dates[$x] . "</td>";
                         echo "<td>" . $this->captionList[$x] . "</td>";
                         echo "<td>" . $this->tagList[$x] . "</td>";
                         $picid = $this->idphoto[$x];
                         echo "<td><img src =../Newsfeed/get.php?id=" . $picid . "> </td>";
                     }
                 } else {
                     echo "<script>\r\n\t\t\talert('You do not have a tag by this name');\r\n\t\t\t</script>";
                 }
             } else {
                 if ($this->allPics == '' && $this->yourTags == '' && $this->allTags != '' && $this->yourAlbums == '' && $this->allAlbums == '' && $this->yourPics == '' && $this->allBrowsePictures == '') {
                     $result = $model->verifyAllTag($this->allTags);
                     if ($result == "Tag Exists") {
                         $this->tagList = $model->allTagtagZList($this->allTags);
                         $this->albumList = $model->allTagAlbumList($this->allTags);
                         $this->captionList = $model->allTagCaptionsList($this->allTags);
                         $this->photoList = $model->allTaggetImages($this->allTags);
                         $this->dates = $model->allTagDateOfAlbums($this->allTags);
                         $this->peopleList = $model->allTagOwnerList($this->allTags);
                         $this->idphoto = $model->allPhotoList($this->allTags);
                         //$this->likeList=$model->allTagLikeList($this->allTags);
                         $this->arrlength = count($this->albumList);
                         echo "<table id= 'myTable' style='width:800px;'>";
                         echo "  <caption>All Pictures By Tag List</caption>";
                         echo "<tr>";
                         echo "<td>Owner:</td>";
                         echo "<td>Album Name:</td>";
                         echo "<td>DateOfALbum:</td>\t";
                         echo " <td>Picture Name: </td>";
                         echo "<td>Tag:</td>";
                         echo "<td>Image:</td>";
                         //   echo"<td>Likes:</td>";
                         echo "</tr>";
                         for ($x = 0; $x < $this->arrlength; $x++) {
                             //echo $this->photoList[$x];
                             echo "<tr>";
                             echo "<td>" . $this->peopleList[$x] . "</td>";
                             echo "<td>" . $this->albumList[$x] . "</td>";
                             echo "<td>" . $this->dates[$x] . "</td>";
                             echo "<td>" . $this->captionList[$x] . "</td>";
                             echo "<td>" . $this->tagList[$x] . "</td>";
                             /*
                             
                                         	$image = imagecreatefromstring($this->photoList[$x]); 
                                         	ob_start(); //You could also just output the $image via header() and bypass this buffer capture.
                             				imagepng($image, null, 80);
                             				$data = ob_get_contents();
                             				ob_end_clean();
                             				
                                         	echo '<td><img src="data:image/png;base64,' .  base64_encode($this->photoList[$x])  . '" /></td>';
                                         //	echo "<td>" .$this->likeList[$x]. "</td>";
                             */
                             $picid = $this->idphoto[$x];
                             echo "<td><img src =../Newsfeed/get.php?id=" . $picid . "> </td>";
                         }
                     } else {
                         echo "<script>\r\n\t\t\talert('This tag does not exist!');\r\n\t\t\t</script>";
                     }
                 } else {
                     if ($this->allPics == "" && $this->yourTags == '' && $this->allTags == '' && $this->yourAlbums == '' && $this->allAlbums == '' && $this->yourPics == '' && $this->allBrowsePictures == '') {
                         echo "<script>\r\n\t\t\talert('You messed up and didn't follow the directions!!!!!');\r\n\t\t\t</script>";
                     } else {
                         if ($this->allPics == "" && $this->yourTags == '' && $this->allTags == '' && $this->yourAlbums != '' && $this->allAlbums == '' && $this->yourPics == '' && $this->allBrowsePictures == '') {
                             $result = $model->verifyAlbum($_SESSION['userid'], $this->yourAlbums);
                             if ($result == "Album Exists") {
                                 $albumid = $model->getAlbumID($_SESSION['userid'], $this->yourAlbums);
                                 $this->albumList = $model->yourAlbumsAlbumList($albumid);
                                 $this->captionList = $model->yourAlbumsCaptionsList($albumid);
                                 $this->photoList = $model->yourAlbumsgetImages($albumid);
                                 $this->dates = $model->yourAlbumsDateOfAlbums($albumid);
                                 $this->peopleList = $model->yourAlbumsOwnerList($albumid);
                                 $this->idphoto = $model->yourAlbumsPhotoList($albumid);
                                 //$this->likeList=$model->allTagLikeList($this->allTags);
                                 $this->arrlength = count($this->albumList);
                                 echo "<table id= 'myTable' style='width:800px;'>";
                                 echo "  <caption>All Your Albums By Name List</caption>";
                                 echo "<tr>";
                                 echo "<td>Owner:</td>";
                                 echo "<td>Album Name:</td>";
                                 echo "<td>DateOfALbum:</td>\t";
                                 echo " <td>Picture Name: </td>";
                                 echo "<td>Image:</td>";
                                 //   echo"<td>Likes:</td>";
                                 echo "</tr>";
                                 for ($x = 0; $x < $this->arrlength; $x++) {
                                     //echo $this->photoList[$x];
                                     echo "<tr>";
                                     echo "<td>" . $this->peopleList[$x] . "</td>";
                                     echo "<td>" . $this->albumList[$x] . "</td>";
                                     echo "<td>" . $this->dates[$x] . "</td>";
                                     echo "<td>" . $this->captionList[$x] . "</td>";
                                     /*
                                     
                                                 	$image = imagecreatefromstring($this->photoList[$x]); 
                                                 	ob_start(); //You could also just output the $image via header() and bypass this buffer capture.
                                     				imagepng($image, null, 80);
                                     				$data = ob_get_contents();
                                     				ob_end_clean();
                                     				
                                                 	echo '<td><img src="data:image/png;base64,' .  base64_encode($this->photoList[$x])  . '" /></td>';
                                                 //	echo "<td>" .$this->likeList[$x]. "</td>";
                                     */
                                     $picid = $this->idphoto[$x];
                                     echo "<td><img src =../Newsfeed/get.php?id=" . $picid . "> </td>";
                                 }
                             } else {
                                 echo "<script>\r\n\t\t\talert('You don't have an album by this name!');\r\n\t\t\t</script>";
                             }
                         } else {
                             if ($this->allPics == "" && $this->yourTags == '' && $this->allTags == '' && $this->yourAlbums == '' && $this->allAlbums != '' && $this->yourPics == '' && $this->allBrowsePictures == '') {
                                 //echo $this->allAlbums;
                                 $result = $model->verifyAllAlbum($this->allAlbums);
                                 //echo $result;
                                 if ($result == "Album Exists") {
                                     $this->albumList = $model->allAlbumsAlbumList($this->allAlbums);
                                     $this->captionList = $model->allAlbumsCaptionsList($this->allAlbums);
                                     $this->photoList = $model->allAlbumsgetImages($this->allAlbums);
                                     $this->dates = $model->allAlbumsDateOfAlbums($this->allAlbums);
                                     $this->peopleList = $model->allAlbumsOwnerList($this->allAlbums);
                                     $this->idphoto = $model->allAlbumsPhotoList($this->allAlbums);
                                     //$this->likeList=$model->allTagLikeList($this->allTags);
                                     $this->arrlength = count($this->albumList);
                                     echo "<table id= 'myTable' style='width:800px;'>";
                                     echo "  <caption>All ALbums By Name List</caption>";
                                     echo "<tr>";
                                     echo "<td>Owner:</td>";
                                     echo "<td>Album Name:</td>";
                                     echo "<td>DateOfALbum:</td>\t";
                                     echo " <td>Picture Name: </td>";
                                     echo "<td>Image:</td>";
                                     //   echo"<td>Likes:</td>";
                                     echo "</tr>";
                                     for ($x = 0; $x < $this->arrlength; $x++) {
                                         //echo $this->photoList[$x];
                                         echo "<tr>";
                                         echo "<td>" . $this->peopleList[$x] . "</td>";
                                         echo "<td>" . $this->albumList[$x] . "</td>";
                                         echo "<td>" . $this->dates[$x] . "</td>";
                                         echo "<td>" . $this->captionList[$x] . "</td>";
                                         /*
                                         
                                                     	$image = imagecreatefromstring($this->photoList[$x]); 
                                                     	ob_start(); //You could also just output the $image via header() and bypass this buffer capture.
                                         				imagepng($image, null, 80);
                                         				$data = ob_get_contents();
                                         				ob_end_clean();
                                         				
                                                     	echo '<td><img src="data:image/png;base64,' .  base64_encode($this->photoList[$x])  . '" /></td>';
                                                     //	echo "<td>" .$this->likeList[$x]. "</td>";
                                         */
                                         $picid = $this->idphoto[$x];
                                         echo "<td><img src =../Newsfeed/get.php?id=" . $picid . "> </td>";
                                     }
                                 } else {
                                     echo "<script>\r\n\t\t\talert('The album you have chosen does not exist!');\r\n\t\t\t</script>";
                                 }
                             } else {
                                 if ($this->allPics == "" && $this->yourTags == '' && $this->allTags == '' && $this->yourAlbums == '' && $this->allAlbums == '' && $this->yourPics != '' && $this->allBrowsePictures == '') {
                                     $result = $model->verifyYourPics($_SESSION['userid'], $this->yourPics);
                                     if ($result == "Picture Exists") {
                                         $photoid = $model->getPhotoID($_SESSION['userid'], $this->yourPics);
                                         $this->albumList = $model->yourPicsAlbumList($photoid);
                                         $this->captionList = $model->yourPicsCaptionsList($photoid);
                                         $this->photoList = $model->yourPicsgetImages($photoid);
                                         $this->dates = $model->yourPicsDateOfAlbums($photoid);
                                         $this->peopleList = $model->yourPicsOwnerList($photoid);
                                         $this->idphoto = $model->yourPicsPhotoList($photoid);
                                         //$this->likeList=$model->allTagLikeList($this->allTags);
                                         $this->arrlength = count($this->albumList);
                                         echo "<table id= 'myTable' style='width:800px;'>";
                                         echo "  <caption>All Your Pictures By Name List</caption>";
                                         echo "<tr>";
                                         echo "<td>Owner:</td>";
                                         echo "<td>Album Name:</td>";
                                         echo "<td>DateOfALbum:</td>\t";
                                         echo " <td>Picture Name: </td>";
                                         echo "<td>Image:</td>";
                                         //   echo"<td>Likes:</td>";
                                         echo "</tr>";
                                         for ($x = 0; $x < $this->arrlength; $x++) {
                                             //echo $this->photoList[$x];
                                             echo "<tr>";
                                             echo "<td>" . $this->peopleList[$x] . "</td>";
                                             echo "<td>" . $this->albumList[$x] . "</td>";
                                             echo "<td>" . $this->dates[$x] . "</td>";
                                             echo "<td>" . $this->captionList[$x] . "</td>";
                                             /*
                                             
                                                         	$image = imagecreatefromstring($this->photoList[$x]); 
                                                         	ob_start(); //You could also just output the $image via header() and bypass this buffer capture.
                                             				imagepng($image, null, 80);
                                             				$data = ob_get_contents();
                                             				ob_end_clean();
                                             				
                                                         	echo '<td><img src="data:image/png;base64,' .  base64_encode($this->photoList[$x])  . '" /></td>';
                                                         //	echo "<td>" .$this->likeList[$x]. "</td>";
                                             */
                                             $picid = $this->idphoto[$x];
                                             echo "<td><img src =../Newsfeed/get.php?id=" . $picid . "> </td>";
                                         }
                                     } else {
                                         echo "<script>\r\n\t\t\talert('You do not own a picture by this name!');\r\n\t\t\t</script>";
                                     }
                                 } else {
                                     if ($this->allPics == "" && $this->yourTags == '' && $this->allTags == '' && $this->yourAlbums == '' && $this->allAlbums == '' && $this->yourPics == '' && $this->allBrowsePictures != '') {
                                         $result = $model->verifyAllPics($this->allBrowsePictures);
                                         if ($result == "Picture Exists") {
                                             $this->albumList = $model->allBrowsePicturesAlbumList($this->allBrowsePictures);
                                             $this->captionList = $model->allBrowsePicturesCaptionsList($this->allBrowsePictures);
                                             $this->photoList = $model->allBrowsePicturesgetImages($this->allBrowsePictures);
                                             $this->dates = $model->allBrowsePicturesDateOfAlbums($this->allBrowsePictures);
                                             $this->peopleList = $model->allBrowseOwnerList($this->allBrowsePictures);
                                             $this->idphoto = $model->allBrowsePhotoList($this->allBrowsePictures);
                                             //$this->likeList=$model->allTagLikeList($this->allTags);
                                             $this->arrlength = count($this->albumList);
                                             echo "<table id= 'myTable' style='width:800px;'>";
                                             echo "  <caption>All Pictures By Name List</caption>";
                                             echo "<tr>";
                                             echo "<td>Owner:</td>";
                                             echo "<td>Album Name:</td>";
                                             echo "<td>DateOfALbum:</td>\t";
                                             echo " <td>Picture Name: </td>";
                                             echo "<td>Image:</td>";
                                             //   echo"<td>Likes:</td>";
                                             echo "</tr>";
                                             for ($x = 0; $x < $this->arrlength; $x++) {
                                                 //echo $this->photoList[$x];
                                                 echo "<tr>";
                                                 echo "<td>" . $this->peopleList[$x] . "</td>";
                                                 echo "<td>" . $this->albumList[$x] . "</td>";
                                                 echo "<td>" . $this->dates[$x] . "</td>";
                                                 echo "<td>" . $this->captionList[$x] . "</td>";
                                                 /*
                                                 
                                                             	$image = imagecreatefromstring($this->photoList[$x]); 
                                                             	ob_start(); //You could also just output the $image via header() and bypass this buffer capture.
                                                 				imagepng($image, null, 80);
                                                 				$data = ob_get_contents();
                                                 				ob_end_clean();
                                                 				
                                                             	echo '<td><img src="data:image/png;base64,' .  base64_encode($this->photoList[$x])  . '" /></td>';
                                                             //	echo "<td>" .$this->likeList[$x]. "</td>";
                                                 */
                                                 $picid = $this->idphoto[$x];
                                                 echo "<td><img src =../Newsfeed/get.php?id=" . $picid . "> </td>";
                                             }
                                         } else {
                                             echo "<script>\r\n\t\t\talert('You do not own a picture by this name!');\r\n\t\t\t</script>";
                                         }
                                     } else {
                                         echo "<script>\r\n\t\t\talert('You messed up and didn't follow the directions!!!!!');\r\n\t\t\t</script>";
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
    private function processData()
    {
        if ($this->context == "Data was submitted") {
            $data_model = new APIModel();
            if ($this->verifyForm() == true) {
                $result = $data_model->addPerson($this->newUsername, $this->newPassword, $this->newEmail, $this->firstName, $this->lastName, $this->birthday, $this->hometown, $this->currentAddress, $this->education);
                if ($result == "Registration successful.") {
                    $_SESSION['userid'] = $data_model->getID($this->newUsername);
                    ?>

					<meta http-equiv="refresh" content="0; url=http://localhost:8888/CS460PA2/Newsfeed/newsFeed.php" />

					<!--<meta http-equiv="refresh" content="0; url=http://localhost:8888/Quartz4/Registration/welcome.php" />-->

					<?php 
                } else {
                    print $result;
                }
            }
        }
    }
Example #15
0
        }
        //Create Table if none exists
        $query = "CREATE TABLE `comments`\n\t\t(`userid` int NOT NULL,\n\t\t`photoid` int NOT NULL,\n\t\t`text` text NOT NULL,\n\t\t`dateOfCreation` text NOT NULL\n\t\t) ENGINE=MyISAM;";
        if ($mysqli->query($query)) {
            echo "comments photos created successfully\n";
            echo "<br>";
            echo "<br>";
        } else {
            echo 'Query failed: ' . $mysqli->error;
            echo "<br>";
            echo "<br>";
        }
        //Create Table if none exists
        $query = "CREATE TABLE `likes`\n\t\t(`userid` int NOT NULL,\n\t\t`photoid` int NOT NULL,\n\t\t`text` text NOT NULL,\n\t\t`dateOfCreation` text NOT NULL\n\t\t) ENGINE=MyISAM;";
        if ($mysqli->query($query)) {
            echo "likes  created successfully\n";
            echo "<br>";
            echo "<br>";
        } else {
            echo 'Query failed: ' . $mysqli->error;
            echo "<br>";
            echo "<br>";
        }
    }
}
$model = new APIModel();
$return = $model->printName("Joe");
echo "{$return}";
echo "<br>";
echo "<br>";
$model->createTables();