function __construct()
 {
     adminGateKeeper();
     $title = "Create a Custom Page";
     $body = drawForm(array("name" => "create_custom_page", "method" => "post", "action" => "CreateCustomPage"));
     $this->html = drawpage($title, $body);
 }
function val_email_form($character_get, $con, $username)
{
    if (isset($_POST['Send'])) {
        $new_email = mysqli_real_escape_string($con, $_POST['email']);
        $password = mysqli_real_escape_string($con, $_POST['password']);
        //check if password is correct, check if email is valid
        $get_password = utils::mysqli_result(mysqli_query($con, "SELECT password FROM user WHERE username = '******'"), 0, 0);
        $get_salt = utils::mysqli_result(mysqli_query($con, "SELECT salt FROM user WHERE username = '******'"), 0, 0);
        //hash provided pw with salt
        $newpassword_hash = crypt($password, $get_salt);
        if ($newpassword_hash == $get_password) {
            //passwords match, check if email is valid (again)
            if (!filter_var($new_email, FILTER_VALIDATE_EMAIL)) {
                echo "Invalid email format";
                return;
            } else {
                //email is valid, password is valid, proceed to change
                $update_email = mysqli_query($con, "UPDATE user SET email = '{$new_email}' WHERE username ='******' ");
                if ($update_email) {
                    echo "Email changed sucessfully";
                } else {
                    echo "There was an error processing your request. Try again later.";
                }
            }
        } else {
            echo "Wrong password";
            return;
        }
        //validation goes here
    } else {
        drawForm($character_get, $username);
    }
}
function val_password_form($character_get, $username, $con)
{
    if (isset($_POST['Send'])) {
        $oldpassword = $_POST['oldpassword'];
        $newpassword1 = $_POST['newpassword1'];
        $newpassword2 = $_POST['newpassword2'];
        $user = $_POST['user'];
        //hash the provided password with the salt and match it against the one stored in the database
        $salt = utils::mysqli_result(mysqli_query($con, "SELECT salt FROM user WHERE username = '******'"), 0, 0);
        $oldpassword_crypt = crypt($oldpassword, $salt);
        $find_current_password = utils::mysqli_result(mysqli_query($con, "SELECT password FROM user WHERE username = '******'"), 0, 0);
        if ($find_current_password != $oldpassword_crypt) {
            echo "Incorrect password";
        } else {
            if ($newpassword1 != $newpassword2) {
                echo "The new passwords provided don't match";
            } else {
                //passwords match.
                //generate new salt
                //hash the new password and store it in the database
                $cost = 10;
                $new_salt = strtr(base64_encode(mcrypt_create_iv(16, MCRYPT_DEV_URANDOM)), '+', '.');
                $new_salt = sprintf("\$2a\$%02d\$", $cost) . $new_salt;
                $newpassword_hash = crypt($newpassword1, $new_salt);
                $update_password = mysqli_query($con, "UPDATE user SET password = '******', salt = '{$new_salt}' WHERE username = '******'") or die(mysqli_error(${$con}));
                if ($update_password) {
                    echo "Password successfully changed";
                }
            }
        }
        //validation goes here
    } else {
        drawForm($character_get, $username);
    }
}
 public function __construct()
 {
     $title = $body = $button = NULL;
     switch (pageArray(1)) {
         case "all":
         default:
             if (loggedIn()) {
                 $admin_groups = Setting::get("admin_groups");
                 if (!$admin_groups) {
                     $admin_groups = "users";
                 }
                 if ($admin_groups == "admin" && adminLoggedIn() || $admin_groups == "user") {
                     $button = "<a href='" . getSiteURL() . "groups/create' class='btn btn-success'>Create a Group</a>";
                 }
             }
             $title = "Groups";
             $body = display("pages/groups");
             break;
         case "create":
             $admin_groups = Setting::get("admin_groups");
             if (!$admin_groups) {
                 $admin_groups = "user";
             }
             if ($admin_groups == "admin" && adminLoggedIn() || $admin_groups == "user") {
                 $title = "Create a Group";
                 $body = drawForm(array("name" => "create_group", "action" => "createGroup", "method" => "post", "files" => true));
             }
             break;
         case "view":
             $guid = pageArray(2);
             $group = getEntity($guid);
             $edit_url = getSiteURL() . "groups/edit/{$guid}";
             $delete_url = addTokenToURL(getSiteURL() . "action/deleteGroup/{$guid}");
             if ($group->ownerIsLoggedIn()) {
                 $button = "<a href='{$edit_url}' class='btn btn-warning'>Edit Group</a>";
                 $button .= "<a href='{$delete_url}' class='btn btn-danger confirm'>Delete Group</a>";
             }
             if (GroupsPlugin::loggedInUserCanJoin($group)) {
                 $join_group_url = addTokenToURL(getSiteURL() . "action/JoinGroup/" . $group->guid);
                 $button .= "<a href='{$join_group_url}' class='btn btn-success confirm'>Join Group</a>";
             }
             if ($group->loggedInUserIsMember() && $group->owner_guid != getLoggedInUserGuid()) {
                 $leave_group_url = addTokenToURL(getSiteURL() . "action/LeaveGroup/" . $group->guid);
                 $button .= "<a href='{$leave_group_url}' class='btn btn-danger confirm'>Leave Group</a>";
             }
             $title = $group->title;
             $body = display("pages/group");
             break;
         case "edit":
             $guid = pageArray(2);
             $group = getEntity($guid);
             $title = "Edit " . $group->title;
             $body = drawForm(array("name" => "edit_group", "action" => "editGroup", "method" => "post", "files" => true));
             break;
     }
     $this->html = drawPage(array("header" => $title, "body" => $body, "button" => $button));
 }
 public function __construct()
 {
     $title = $body = $buttons = $breadcrumbs = NULL;
     switch (pageArray(1)) {
         default:
             $body = display("pages/forum");
             $title = "Forum Categories";
             if (adminLoggedIn()) {
                 $add_category_url = getSiteURL() . "forum/add_category";
                 $buttons = "<a href='{$add_category_url}' class='btn btn-danger'>Add a Category</a>";
             }
             $breadcrumbs = array(array("link" => getSiteURL() . "forum", "label" => "Categories"));
             break;
         case 'add_category':
             adminGateKeeper();
             $body = drawForm(array("name" => "add_category", "method" => "post", "action" => "addCategory"));
             $title = "Add a Forum Category";
             break;
         case 'category':
             $guid = pageArray(2);
             if ($guid) {
                 $category = getEntity($guid);
                 $body = display("forum/category");
                 if (loggedIn()) {
                     $add_topic_url = getSiteURL() . "forum/add_topic/{$guid}";
                     $buttons = "<a href='{$add_topic_url}' class='btn btn-success'>Add Topic</a>";
                 }
             }
             $breadcrumbs = array(array("link" => getSiteURL() . "forum", "label" => "Categories"), array("link" => getSiteURL() . "forum/category/" . $category->guid, "label" => $category->title));
             break;
         case "add_topic":
             gateKeeper();
             $category_guid = pageArray(2);
             $category = getEntity($category_guid);
             $body = drawForm(array("name" => "add_topic", "method" => "post", "action" => "addTopic"));
             $title = "Add a topic to {$category->title}";
             break;
         case "topic":
             $topic = getEntity(pageArray(2));
             $category = getEntity($topic->container_guid);
             $breadcrumbs = array(array("link" => getSiteURL() . "forum", "label" => "Categories"), array("link" => getSiteURL() . "forum/category/" . $category->guid, "label" => $category->title), array("link" => getSiteURL() . "forum/topic/" . $topic->guid, "label" => $topic->title));
             $body = display("forum/topic");
             break;
         case "editCategory":
             adminGateKeeper();
             $title = "Edit Forum Category";
             $body = drawForm(array("name" => "edit_category", "method" => "post", "action" => "editCategory'"));
             break;
         case "editTopic":
             adminGateKeeper();
             $title = "Edit Forum Topic";
             $body = drawForm(array("name" => "edit_topic", "method" => "post", "action" => "editTopic"));
             break;
     }
     $this->html = drawPage(array("header" => $title, "body" => $body, "button" => $buttons, "breadcrumbs" => $breadcrumbs));
 }
 public function __construct()
 {
     $title = $buttons = $body = NULL;
     if (BlogsPlugin::userCanCreateBlog()) {
         $body = display("page_elements/blogs_tabs");
         $buttons = "<a href='" . getSiteURL() . "blogs/add' class='btn btn-success'>Add a Blog</a>";
     }
     switch (pageArray(1)) {
         case "all_blogs":
         default:
             $title = "Blogs";
             $body .= display("pages/all_blogs");
             break;
         case "friends_blogs":
             $title = translate("friends_blogs");
             $body .= display("pages/friends_blogs");
             break;
         case "my_blogs":
             $title = "My Blogs";
             $body .= display("pages/my_blogs");
             break;
         case "add":
             if (BlogsPlugin::userCanCreateBlog()) {
                 $title = "Add a Blog";
                 $body = drawForm(array("name" => "add_blog", "method" => "post", "action" => "addBlog"));
             }
             break;
         case "view":
             $guid = pageArray(2);
             $blog = getEntity($guid);
             if ($blog) {
                 $title = $blog->title;
             }
             $owner = getEntity($blog->owner_guid);
             $title .= " <small>by {$owner->full_name}</small>";
             $body = display("pages/blog");
             if (getLoggedInUserGuid() == $blog->owner_guid) {
                 $edit_url = getSiteURL() . "blogs/edit/{$guid}";
                 $delete_url = addTokenToURL(getSiteURL() . "action/deleteBlog/{$guid}");
                 $buttons = "<a href='{$edit_url}' class='btn btn-warning'>Edit</a>";
                 $buttons .= "<a href='{$delete_url}' class='btn btn-danger confirm'>Delete</a>";
             }
             break;
         case "edit":
             $buttons = NULL;
             $title = "Edit your blog";
             $body = drawForm(array("name" => "edit_blog", "method" => "post", "action" => "addBlog"));
             break;
     }
     $this->html = drawPage(array("header" => $title, "body" => $body, "button" => $buttons));
 }
 /**
  * Creates html for forgot password page
  */
 public function __construct()
 {
     $code = pageArray(1);
     $email = pageArray(2);
     if ($code && $email) {
         $access = getIgnoreAccess();
         setIgnoreAccess();
         $user = getEntities(array("type" => "User", "metadata_name_value_pairs" => array(array("name" => "email", "value" => $email), array("name" => "password_reset_code", "value" => $code))));
         setIgnoreAccess($access);
         if ($user) {
             $user = $user[0];
             new Vars("guid", $user->guid);
             new Vars("code", $code);
             $form = drawForm(array("name" => "new_password", "method" => "post", "action" => "newPassword"));
             $header = "Enter your new password.";
             $this->html = drawPage($header, $form);
             $this->html = drawPage(array("header" => $header, "body" => $form));
         }
     } else {
         $form = drawForm(array("name" => "forgot_password", "method" => "post", "action" => "ForgotPassword"));
         $this->html = drawPage(array("header" => "Reset Your Password", "body" => $form));
     }
 }
    public function __construct()
    {
        $page = pageArray();
        switch ($page[1]) {
            case "upload":
                $form = drawForm(array("name" => "file/upload", "method" => "post", "action" => "fileUpload", "enctype" => "multipart/form-data"));
                new Vars("container_guid", pageArray());
                $this->html = drawPage(array("header" => "Upload File", "body" => $form));
                break;
            default:
                if (is_numeric($page[1])) {
                    $guid = $page[1];
                    $file = getEntity($page[1]);
                    $image_url = Image::getImageURL($guid);
                    $image_title = $file->name;
                    $left_content = "<a href='{$image_url}' data-lightbox='image-{$guid}' data-title='{$image_title}'><img src='{$image_url}' class='img-responsive' alt=''/></a>";
                    $right_content = html_entity_decode($file->description);
                    $comments = display("output/block_comments", array("guid" => $guid, "show_form" => true));
                    $download_button = "<a href='" . getSiteURL() . "views/output/file_download.php?guid={$guid}' class='btn btn-success btn-block' style='margin-top:18px;'>Download</a>";
                    $body = <<<HTML
        <div class='col-sm-4'>
            {$left_content}
            {$download_button}
        </div>
        <div class='col-sm-8'>
            <div class='well'>
                {$right_content}
            </div>
            {$comments}
        </div>
HTML;
                    $this->html = drawPage(array("header" => $file->title, "body" => $body));
                }
                return false;
                break;
        }
    }
 function __construct()
 {
     $header = $body = NULL;
     switch (pageArray(1)) {
         default:
             gateKeeper();
             $header = "Report this page to the site admin.";
             $body = drawForm(array("name" => "reportThis", "action" => "reportThis", "method" => "post"));
             break;
         case "reportSent":
             $header = "Your report has been sent.";
             $body = "<p>Thank you for your report.  Our community relies on users like you to keep it safe.</p><p>We will review your report, and make a decision within 24 hours.</p>";
             break;
         case "view":
             switch (pageArray(2)) {
                 default:
                     break;
                 case "":
                     break;
             }
             break;
     }
     $this->html = drawPage(array("header" => $header, "body" => $body));
 }
<?php

/* * ***********************************************************************
 * 
 * SocialApparatus CONFIDENTIAL
 * __________________
 * 
 *  [2002] - [2017] SocialApparatus (http://SocialApparatus.co) 
 *  All Rights Reserved.
 * 
 * NOTICE:  All information contained herein is, and remains the property of SocialApparatus 
 * and its suppliers, if any.  The intellectual  and technical concepts contained herein 
 * are proprietary to SocialApparatus and its suppliers and may be covered by U.S. and Foreign 
 * Patents, patents in process, and are protected by trade secret or copyright law. 
 * 
 * Dissemination of this information or reproduction of this material is strictly forbidden 
 * unless prior written permission is obtained from SocialApparatus.
 * 
 * Contact Shane Barron admin@socia.us for more information.
 */
namespace SocialApparatus;

denyDirect();
$guid = Vars::get('guid');
$lead = translate("verification_email_sent:lead");
$form = drawForm(array("name" => "resend_verification_email", "action" => "ResendEmailVerification", "method" => "post"));
$body = <<<HTML
<p class="lead">{$lead}</p>
<p class="text-center">{$form}</p>
HTML;
echo drawPage(array("header" => translate("verification_email_sent:heading"), "body" => $body));
 public function __construct()
 {
     gateKeeper();
     $title = $body = $button = $wrapper_class = NULL;
     switch (pageArray(1)) {
         case "view":
             $guid = pageArray(2);
             $video = getEntity($guid);
             if ($video) {
                 if ($video->title) {
                     $title = $video->title;
                 } else {
                     $title = "&nbsp;";
                 }
                 if (getLoggedInUserGuid() == $video->owner_guid || adminLoggedIn()) {
                     $delete_url = addTokenToURL(getSiteURL() . "action/deleteVideo/{$guid}");
                     $button = "<a class='btn btn-info' href='" . getSiteURL() . "videos/edit/{$guid}'>Edit</a>";
                     $button .= "<a class='btn btn-danger confirm' href='{$delete_url}'>Delete</a>";
                 }
                 $body = display("pages/video");
             } else {
                 forward();
             }
             break;
         case "edit":
             $title = "Edit Video Details";
             $body = drawForm(array("name" => "edit_video", "method" => "post", "action" => "editVideo"));
             break;
         case "add":
             $title = "Add a Video";
             $body = drawForm(array("name" => "add_video", "method" => "post", "action" => "AddVideo", "enctype" => "multipart/form-data"));
             break;
         default:
         case "albums":
             switch (pageArray(2)) {
                 default:
                     $guid = pageArray(1);
                     if (!$guid) {
                         $guid = getLoggedInUserGuid();
                     }
                     $user = getEntity($guid);
                     if ($guid == getLoggedInUserGuid()) {
                         $name = "My";
                     } else {
                         $name = $user->full_name . "'s";
                     }
                     $title = $name . " Video Albums";
                     $body = display("pages/video_albums");
                     $button = "<a class='btn btn-success' href='" . getSiteURL() . "videos/albums/add'>Create an Album</a>";
                     break;
                 case "add":
                     $title = "Add a Video Album";
                     $body = drawForm(array("name" => "add_video_album", "method" => "post", "action" => "addVideoalbum", "class" => "add_video_album_form", "enctype" => "multipart/form-data"));
                     break;
                 case "view":
                     $guid = pageArray(3);
                     $album = getEntity($guid);
                     $title = $album->title;
                     $body = display("pages/video_album");
                     $delete_url = getSiteURL() . "action/deleteVideoalbum/{$guid}";
                     $delete_url = addTokenToURL($delete_url);
                     if (getLoggedInUserGuid() == $album->owner_guid || adminLoggedIn()) {
                         $button = "<a class='btn btn-info' href='" . getSiteURL() . "videos/albums/edit/{$guid}'>Edit Album</a>";
                         $button .= "<a class='btn btn-danger' href='{$delete_url}'>Delete Album</a>";
                     }
                     $button .= "<a class='btn btn-success' href='" . getSiteURL() . "videos/add/{$guid}'>Add Video</a>";
                     $wrapper_class = "masonry4col";
                     break;
                 case "edit":
                     $body = drawForm(array("name" => "edit_video_album", "method" => "post", "action" => "editVideoalbum", "enctype" => "multipart/form-data"));
                     $title = "Edit Album";
                     break;
             }
     }
     $this->html = drawPage(array("header" => $title, "body" => $body, "button" => $button, "wrapper_class" => $wrapper_class));
 }
 function __construct()
 {
     $guid = NULL;
     $header = Setting::get("store_name");
     $body = $button = NULL;
     $category = pageArray(1);
     $category_entity = getEntity(array("type" => "Productcategory", "metadata_name" => "short_name", "metadata_value" => $category));
     if ($category_entity) {
         $guid = $category_entity->guid;
     }
     if (!$guid) {
         $first_category = getEntity(array("type" => "Productcategory"));
         if ($first_category) {
             $guid = $first_category->guid;
         }
     }
     if (adminLoggedIn()) {
         $button = "<a href='" . getSiteURL() . "store/create_category' class='btn btn-default'>Create a Category</a>";
         $button .= "<a href='" . getSiteURL() . "store/create_product/{$guid}' class='btn btn-success'>Create Product</a>";
         $button .= "<a href='" . getSiteURL() . "store/edit_category/{$guid}' class='btn btn-info'>Edit Category</a>";
     } else {
         $button = NULL;
     }
     switch (pageArray(1)) {
         case "categories":
         default:
             $body = display("pages/store");
             break;
         case "create_category":
             adminGateKeeper();
             $header = "Create a Category";
             $body = drawForm(array("name" => "create_product_category", "method" => "post", "action" => "CreateProductCategory"));
             break;
         case "create_product":
             adminGateKeeper();
             $guid = pageArray(2);
             $category = getEntity($guid);
             $label = $category->label;
             $header = "Create a new product in the {$label} category";
             $body = drawForm(array("name" => "create_product", "method" => "post", "action" => "CreateProduct", "enctype" => "multipart/form-data"));
             break;
         case "register":
             $header = "Please register to continue.";
             $body = "<h2 class='text-center'>Register</h2>";
             $body .= "<div class='row'>";
             $body .= "<div class='col-md-4 col-md-offset-4'>";
             $body .= drawForm(array("name" => "register", "method" => "post", "action" => "register"));
             $body .= "</div>";
             $body .= "</div>";
             $body .= "<h2 class='text-center'>Already have an account?  <a href='" . getSiteURL() . "login?referer=cart'>Login</a></h2>";
             break;
         case "edit_category":
             $header = "Edit Category";
             $body = drawForm(array("name" => "edit_product_category", "action" => "EditProductCategory", "method" => "post"));
             break;
         case "edit_product":
             $header = "Edit Product";
             $body = drawForm(array("name" => "edit_product", "action" => "EditProduct", "method" => "post", "enctype" => "multipart/form-data"));
             break;
     }
     $this->html = drawPage(array("header" => $header, "body" => $body, "button" => $button));
 }
 function __construct()
 {
     $body = drawForm(array("name" => "edit_custom_page", "action" => "editCustomPage", "method" => "post"));
     $title = "Edit Custom Page";
     $this->html = drawPage($title, $body);
 }
 *  [2002] - [2017] SocialApparatus (http://SocialApparatus.co) 
 *  All Rights Reserved.
 * 
 * NOTICE:  All information contained herein is, and remains the property of SocialApparatus 
 * and its suppliers, if any.  The intellectual  and technical concepts contained herein 
 * are proprietary to SocialApparatus and its suppliers and may be covered by U.S. and Foreign 
 * Patents, patents in process, and are protected by trade secret or copyright law. 
 * 
 * Dissemination of this information or reproduction of this material is strictly forbidden 
 * unless prior written permission is obtained from SocialApparatus.
 * 
 * Contact Shane Barron admin@socia.us for more information.
 */
namespace SocialApparatus;

denyDirect();
gateKeeper();
$owner = getLoggedInUser();
$current_avatar = $owner->icon(EXTRALARGE, "img-responsive");
$form = drawForm(array("name" => "edit_avatar", "action" => "editAvatar", "method" => "post", "enctype" => "multipart/form-data"));
$body = <<<HTML
<div class='row edit_avatar_form'>
    <div class="col-sm-4">
        {$current_avatar}
    </div>
    <div class="col-sm-8">
        {$form}
    </div>
</div>
HTML;
echo drawPage(array("header" => "Edit Avatar", "body" => $body));
 * and its suppliers, if any.  The intellectual  and technical concepts contained herein 
 * are proprietary to SocialApparatus and its suppliers and may be covered by U.S. and Foreign 
 * Patents, patents in process, and are protected by trade secret or copyright law. 
 * 
 * Dissemination of this information or reproduction of this material is strictly forbidden 
 * unless prior written permission is obtained from SocialApparatus.
 * 
 * Contact Shane Barron admin@socia.us for more information.
 */
namespace SocialApparatus;

denyDirect();
if (loggedIn()) {
    $guid = pageArray(1);
    $user = getEntity($guid);
    $form = drawForm(array("name" => "update_status", "method" => "post", "action" => "UpdateStatus"));
    $params = array("type" => "Profilestatus", "limit" => 10, "offset" => 0, "metadata_name" => "container_guid", "metadata_value" => $guid, "order_by" => "time_created", "order_reverse" => true);
    $status = display("ajax/entity_list", array("params" => $params, "id" => "profile_status", "title" => NULL));
    if ($guid == getLoggedInUserGuid()) {
        echo <<<HTML
<div class='panel panel-success'>
    <div class='panel-heading'>
       <h4 class='panel-title'>What's on your mind?</h4>
    </div>
    <div class='panel-body status_panel_body'>
        {$form}
        <div id='ajax_profile_status'>
            {$status}
        </div>
    </div>
</div>
<?php

/* * ***********************************************************************
 * 
 * SocialApparatus CONFIDENTIAL
 * __________________
 * 
 *  [2002] - [2017] SocialApparatus (http://SocialApparatus.co) 
 *  All Rights Reserved.
 * 
 * NOTICE:  All information contained herein is, and remains the property of SocialApparatus 
 * and its suppliers, if any.  The intellectual  and technical concepts contained herein 
 * are proprietary to SocialApparatus and its suppliers and may be covered by U.S. and Foreign 
 * Patents, patents in process, and are protected by trade secret or copyright law. 
 * 
 * Dissemination of this information or reproduction of this material is strictly forbidden 
 * unless prior written permission is obtained from SocialApparatus.
 * 
 * Contact Shane Barron admin@socia.us for more information.
 */
namespace SocialApparatus;

denyDirect();
adminGateKeeper();
$form = drawForm(array("name" => "add_profile_field", 'method' => 'POST', 'action' => 'add_profile_field'));
echo drawPage(array("header" => 'Add Profile Field', "body" => $form));
<?php

/* * ***********************************************************************
 * 
 * SocialApparatus CONFIDENTIAL
 * __________________
 * 
 *  [2002] - [2017] SocialApparatus (http://SocialApparatus.co) 
 *  All Rights Reserved.
 * 
 * NOTICE:  All information contained herein is, and remains the property of SocialApparatus 
 * and its suppliers, if any.  The intellectual  and technical concepts contained herein 
 * are proprietary to SocialApparatus and its suppliers and may be covered by U.S. and Foreign 
 * Patents, patents in process, and are protected by trade secret or copyright law. 
 * 
 * Dissemination of this information or reproduction of this material is strictly forbidden 
 * unless prior written permission is obtained from SocialApparatus.
 * 
 * Contact Shane Barron admin@socia.us for more information.
 */
namespace SocialApparatus;

denyDirect();
gateKeeper();
$form = drawForm(array("name" => "edit_profile", "method" => "post", "action" => "editProfile", "class" => "edit_profile_form"));
echo drawPage(array("header" => "Edit Profile", "body" => $form));
 *  [2002] - [2017] SocialApparatus (http://SocialApparatus.co) 
 *  All Rights Reserved.
 * 
 * NOTICE:  All information contained herein is, and remains the property of SocialApparatus 
 * and its suppliers, if any.  The intellectual  and technical concepts contained herein 
 * are proprietary to SocialApparatus and its suppliers and may be covered by U.S. and Foreign 
 * Patents, patents in process, and are protected by trade secret or copyright law. 
 * 
 * Dissemination of this information or reproduction of this material is strictly forbidden 
 * unless prior written permission is obtained from SocialApparatus.
 * 
 * Contact Shane Barron admin@socia.us for more information.
 */
namespace SocialApparatus;

denyDirect();
reverseGatekeeper();
$form = drawForm(array("name" => "register", "method" => "post", "action" => "register"));
$body = <<<HTML
<div class="container">
  <div class="row">
    <div class="Absolute-Center is-Responsive">
      <h2 class='text-center'>Register</h2>
      <div class="col-sm-12 col-md-10 col-md-offset-1">
      {$form}
      </div>  
    </div>    
  </div>
</div>
HTML;
echo drawPage(array("body" => $body, "header" => NULL, "button" => NULL));
<?php

/* * ***********************************************************************
 * 
 * SocialApparatus CONFIDENTIAL
 * __________________
 * 
 *  [2002] - [2017] SocialApparatus (http://SocialApparatus.co) 
 *  All Rights Reserved.
 * 
 * NOTICE:  All information contained herein is, and remains the property of SocialApparatus 
 * and its suppliers, if any.  The intellectual  and technical concepts contained herein 
 * are proprietary to SocialApparatus and its suppliers and may be covered by U.S. and Foreign 
 * Patents, patents in process, and are protected by trade secret or copyright law. 
 * 
 * Dissemination of this information or reproduction of this material is strictly forbidden 
 * unless prior written permission is obtained from SocialApparatus.
 * 
 * Contact Shane Barron admin@socia.us for more information.
 */
namespace SocialApparatus;

denyDirect();
echo drawForm(array("name" => "random_users", "method" => "post", "action" => "RandomUsers"));
<?php

/* * ***********************************************************************
 * 
 * SocialApparatus CONFIDENTIAL
 * __________________
 * 
 *  [2002] - [2017] SocialApparatus (http://SocialApparatus.co) 
 *  All Rights Reserved.
 * 
 * NOTICE:  All information contained herein is, and remains the property of SocialApparatus 
 * and its suppliers, if any.  The intellectual  and technical concepts contained herein 
 * are proprietary to SocialApparatus and its suppliers and may be covered by U.S. and Foreign 
 * Patents, patents in process, and are protected by trade secret or copyright law. 
 * 
 * Dissemination of this information or reproduction of this material is strictly forbidden 
 * unless prior written permission is obtained from SocialApparatus.
 * 
 * Contact Shane Barron admin@socia.us for more information.
 */
namespace SocialApparatus;

denyDirect();
$header = "Homepage Settings";
$body = drawForm(array("name" => "edit_homepage", "method" => "post", "action" => "EditHomepage"));
echo display("page_elements/page_header", array("text" => $header));
echo $body;
    }
    ?>
        </div>
        <div class="panel-footer">
            <div class="row text-center">
                <div class="col-xs-8">
                    <h4 class="text-right">Total <strong>$<?php 
    echo money_format('%(#10n', $total);
    ?>
</strong></h4>
                </div>
                <div class="col-xs-4" style="padding-top:14px;">
                    <?php 
    $label = "Checkout";
    if (loggedIn()) {
        echo drawForm(array("name" => "stripe_button", "method" => "post", "action" => "ChargeCard", "total" => $total, "label" => $label));
    } else {
        ?>
                        <a class="btn btn-success btn-block btn-lg" href="<?php 
        echo getSiteURL();
        ?>
store/register">
                            Checkout
                        </a>
    <?php 
    }
    ?>
                    <a href='<?php 
    echo addTokenToURL(getSiteURL() . "action/emptyCart");
    ?>
' class='btn btn-warning confirm' style='margin-top:8px;'>Empty Cart</a>
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 *
 *
 * @author     Shane Barron <*****@*****.**>
 * @author     Aaustin Barron <*****@*****.**>
 * @copyright  2015 SocialApparatus
 * @license    http://opensource.org/licenses/MIT MIT
 * @version    1
 * @link       http://socialapparatus.com
 */
namespace SocialApparatus;

denyDirect();
adminGateKeeper();
$body = drawForm(array("name" => "ecommerce_settings", "method" => "post", "action" => "EcommerceSettings", "class" => "ecommerce_settings_form"));
echo display("page_elements/page_header", array("text" => "Ecommerce Settings"));
echo $body;
<?php

/* * ***********************************************************************
 * 
 * SocialApparatus CONFIDENTIAL
 * __________________
 * 
 *  [2002] - [2017] SocialApparatus (http://SocialApparatus.co) 
 *  All Rights Reserved.
 * 
 * NOTICE:  All information contained herein is, and remains the property of SocialApparatus 
 * and its suppliers, if any.  The intellectual  and technical concepts contained herein 
 * are proprietary to SocialApparatus and its suppliers and may be covered by U.S. and Foreign 
 * Patents, patents in process, and are protected by trade secret or copyright law. 
 * 
 * Dissemination of this information or reproduction of this material is strictly forbidden 
 * unless prior written permission is obtained from SocialApparatus.
 * 
 * Contact Shane Barron admin@socia.us for more information.
 */
namespace SocialApparatus;

denyDirect();
$body = drawForm(array("name" => "video_settings", "method" => "post", "action" => "VideoSettings"));
$header = "Video Settings";
echo display("page_elements/page_header", array("text" => $header));
echo $body;
 * Contact Shane Barron admin@socia.us for more information.
 */
namespace SocialApparatus;

denyDirect();
$current_tab = pageArray(1);
if (!$current_tab) {
    $current_tab = "notifications";
}
$tabs = Usersetting::listTabs();
$body = <<<HTML
<div>
    <ul class="nav nav-pills">
HTML;
if ($tabs) {
    foreach ($tabs as $tab) {
        if ($tab) {
            $label = translate("user_setting:{$tab}");
            $body .= <<<HTML
        <li role="presentation" class="active"><a href="#">{$label}</a></li>
    </ul>
HTML;
        }
    }
    $body .= <<<HTML
    <hr>
</div>
HTML;
    $body .= drawForm(array("name" => "user_settings", "method" => "post", "action" => "updateUserSettings"));
}
echo drawPage(array("header" => "My Settings", "body" => $body));
 * 
 * SocialApparatus CONFIDENTIAL
 * __________________
 * 
 *  [2002] - [2017] SocialApparatus (http://SocialApparatus.co) 
 *  All Rights Reserved.
 * 
 * NOTICE:  All information contained herein is, and remains the property of SocialApparatus 
 * and its suppliers, if any.  The intellectual  and technical concepts contained herein 
 * are proprietary to SocialApparatus and its suppliers and may be covered by U.S. and Foreign 
 * Patents, patents in process, and are protected by trade secret or copyright law. 
 * 
 * Dissemination of this information or reproduction of this material is strictly forbidden 
 * unless prior written permission is obtained from SocialApparatus.
 * 
 * Contact Shane Barron admin@socia.us for more information.
 */
namespace SocialApparatus;

denyDirect();
$guid = pageArray(2);
$topic = getEntity($guid);
$count = getEntities(array("type" => "Forumcomment", "metadata_name" => "container_guid", "metadata_value" => $guid, "count" => true));
$pagination = display("page_elements/pagination", array('count' => $count, 'offset' => getInput("offset", 0), 'limit' => 5, 'url' => getSiteURL() . "forum/topic/" . $guid, "order_by" => "time_created", "order_reverse" => true));
echo $topic->view();
$comments = listEntities(array("type" => "Forumcomment", "metadata_name" => "container_guid", "metadata_value" => $guid, "limit" => 5, "order_by" => "time_created", "order_reverse" => false, "offset" => getInput("offset", 0)));
echo $comments;
echo $pagination;
if (loggedIn()) {
    echo drawForm(array("name" => "add_forum_comment", "method" => "post", "action" => "addForumComment"));
}
 * are proprietary to SocialApparatus and its suppliers and may be covered by U.S. and Foreign 
 * Patents, patents in process, and are protected by trade secret or copyright law. 
 * 
 * Dissemination of this information or reproduction of this material is strictly forbidden 
 * unless prior written permission is obtained from SocialApparatus.
 * 
 * Contact Shane Barron admin@socia.us for more information.
 */
namespace SocialApparatus;

denyDirect();
$guid = Vars::get("guid");
$reverse = Vars::get("reverse");
if (!$reverse) {
    $reverse = false;
}
if ($guid && loggedIn()) {
    $form = "<button class='btn btn-info btn-xs show_inline_comment_form'>Add Comment</button>";
    $form .= drawForm(array("name" => "add_inline_comment", "method" => "post", "action" => "addComment", "class" => "inline_comment_form", "inputs" => array("guid" => $guid)));
    echo $form;
}
$comments = <<<HTML
        
<div class='bar-loader'></div>
<ul class="commentList comment_list_{$guid}">
HTML;
$comments .= display("output/comments", array("guid" => $guid, "count" => 4, "reverse" => true, "offset" => 0));
$comments .= <<<HTML
</ul>
HTML;
echo $comments;
/* * ***********************************************************************
 * 
 * SocialApparatus CONFIDENTIAL
 * __________________
 * 
 *  [2002] - [2017] SocialApparatus (http://SocialApparatus.co) 
 *  All Rights Reserved.
 * 
 * NOTICE:  All information contained herein is, and remains the property of SocialApparatus 
 * and its suppliers, if any.  The intellectual  and technical concepts contained herein 
 * are proprietary to SocialApparatus and its suppliers and may be covered by U.S. and Foreign 
 * Patents, patents in process, and are protected by trade secret or copyright law. 
 * 
 * Dissemination of this information or reproduction of this material is strictly forbidden 
 * unless prior written permission is obtained from SocialApparatus.
 * 
 * Contact Shane Barron admin@socia.us for more information.
 */
namespace SocialApparatus;

denyDirect();
gateKeeper();
$owner = getLoggedInUser();
$limit = 9;
$offset = getInput("offset", 0);
$filter = getInput("filter", NULL);
$friends = FriendsPlugin::getFriends($owner, $offset, $limit, $filter);
$body = viewEntityList($friends, "list");
echo drawPage(array("header" => translate("friends"), "body" => $body, "button" => drawForm(array("name" => "friend_search", "method" => "get", "page" => "friends"))));
 * NOTICE:  All information contained herein is, and remains the property of SocialApparatus 
 * and its suppliers, if any.  The intellectual  and technical concepts contained herein 
 * are proprietary to SocialApparatus and its suppliers and may be covered by U.S. and Foreign 
 * Patents, patents in process, and are protected by trade secret or copyright law. 
 * 
 * Dissemination of this information or reproduction of this material is strictly forbidden 
 * unless prior written permission is obtained from SocialApparatus.
 * 
 * Contact Shane Barron admin@socia.us for more information.
 */
namespace SocialApparatus;

denyDirect();
$guid = Vars::get("guid");
$reverse = Vars::get("reverse");
if (!$reverse) {
    $reverse = false;
}
if ($guid && loggedIn()) {
    $form = drawForm(array("name" => "add_comment", "method" => "post", "action" => "addComment", "inputs" => array("guid" => $guid)));
    echo $form;
}
$comments = <<<HTML
        <div class='bar-loader'></div>
<ul class="commentList comment_list_{$guid}">
HTML;
$comments .= display("output/comments", array("guid" => $guid, "count" => 4, "reverse" => true, "offset" => 0));
$comments .= <<<HTML
</ul>
HTML;
echo $comments;
denyDirect();
$scope = getScope();
if ($scope == "web") {
    if (loggedIn()) {
        $video_albums = listEntities(array("type" => "Videoalbum", "metadata_name" => "owner_guid", "metadata_value" => getLoggedInUserGuid(), "view_type" => "videopicker_gallery"));
        ?>
        <div class="modal fade" id="insert_video_modal" tabindex="-1" role="dialog" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-body clearfix">
                        <h3>Select an album/video.</h3>
                        <?php 
        echo $video_albums;
        ?>
                        <div id="videos" class="clearfix"></div>
                        <h3>-or-</h3>
                        <?php 
        echo drawForm(array("name" => "upload_video", "method" => "post", "action" => "UploadVideo", "enctype" => "multipart/form-data"));
        ?>
                    </div>
                    <div class="modal-footer">
                        <input type="hidden" name="editor_id" value="">
                        <button type="button" class="btn btn-warning" data-dismiss="modal">Cancel</button>
                    </div>
                </div>
            </div>
        </div>
        <?php 
    }
}
/* * ***********************************************************************
 * 
 * SocialApparatus CONFIDENTIAL
 * __________________
 * 
 *  [2002] - [2017] SocialApparatus (http://SocialApparatus.co) 
 *  All Rights Reserved.
 * 
 * NOTICE:  All information contained herein is, and remains the property of SocialApparatus 
 * and its suppliers, if any.  The intellectual  and technical concepts contained herein 
 * are proprietary to SocialApparatus and its suppliers and may be covered by U.S. and Foreign 
 * Patents, patents in process, and are protected by trade secret or copyright law. 
 * 
 * Dissemination of this information or reproduction of this material is strictly forbidden 
 * unless prior written permission is obtained from SocialApparatus.
 * 
 * Contact Shane Barron admin@socia.us for more information.
 */
namespace SocialApparatus;

denyDirect();
$vars = Vars::get("called_by");
$guid = pageArray(1);
$owner = getEntity($guid);
$friends = FriendsPlugin::getFriends($owner, 0, 1000);
$friends_list = viewEntityList($friends, "gallery");
$find_friends_url = getSiteURL() . "members";
$search_friends_form = drawForm(array("name" => "search_friends", "method" => "get", "page" => "searchFriends", "class" => "form-inline"));
$friends_text = translate("friends");
$find_friends_text = translate("find_friends");
echo display("page_elements/panel", array("heading" => "<a href='{$find_friends_url}' class='btn btn-success btn-xs pull-right'>{$find_friends_text}</a>{$friends_text}", "body" => $friends_list, "footer" => $search_friends_form));