public function __construct()
 {
     new Accesshandler("friends");
     if (loggedIn()) {
         new MenuItem(array("name" => "friends", "label" => translate("friends"), "page" => "friends", "menu" => "my_account", "weight" => 50));
         new MenuItem(array("name" => "friend_requests", "label" => translate("friend_requests"), "page" => "Friendrequests", "menu" => "my_account", "weight" => 100));
         new Usersetting(array("name" => "notify_when_friend_request_sent", "field_type" => "dropdown", "options" => array("email" => "Email", "site" => "Site", "both" => "Both", "none" => "None"), "tab" => "notifications", "default_value" => "both"));
         new Usersetting(array("name" => "notify_when_friend_request", "field_type" => "dropdown", "options" => array("email" => "Email", "site" => "Site", "both" => "Both", "none" => "None"), "tab" => "notifications", "default_value" => "both"));
         if (currentPage() == "profile" && pageArray(1)) {
             if (pageArray(1) != getLoggedInUserGuid()) {
                 if (!FriendsPlugin::requestSent(getLoggedInUserGuid(), pageArray(1))) {
                     if (!FriendsPlugin::friends(pageArray(1), getLoggedInUserGuid())) {
                         new MenuItem(array("name" => "add_friend", "label" => translate("add_friend"), "page" => addTokenToURL("action/addFriend/" . pageArray(1)), "menu" => "profile", "weight" => 10, "link_class" => "list-group-item list-group-item-info confirm"));
                     } else {
                         new MenuItem(array("name" => "remove_friend", "label" => translate("remove_friend"), "page" => addTokenToURL("action/removeFriend/" . pageArray(1)), "menu" => "profile", "weight" => 10, "link_class" => "list-group-item list-group-item-warning confirm"));
                     }
                 } else {
                     new MenuItem(array("name" => "friend_request_sent", "label" => translate("friendship_requested"), "page" => "friend", "menu" => "profile", "weight" => 20, "link_class" => "list-group-item confirm"));
                 }
             }
         }
     }
     new ViewExtension("profile/left", "friends/profile", "after");
     new ViewExtension('pages/home_stats', 'pages/friend_stats');
     new ViewExtension("user/buttons", "friends/friend_button");
 }
 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));
 }
 /**
  * Creates notification page html
  */
 public function __construct()
 {
     $user_guid = getLoggedInUserGuid();
     $access = getIgnoreAccess();
     setIgnoreAccess();
     $notifications = listEntities(array("type" => "Notification", "metadata_name" => "owner_guid", "metadata_value" => $user_guid));
     setIgnoreAccess($access);
     $buttons = getSiteURL() . "action/deleteAllNotifications/{$user_guid}";
     $buttons = addTokenToURL($buttons);
     $buttons = "<a href='{$buttons}' class='btn btn-danger'>Dismiss All</a>";
     $page = drawPage(array("header" => "Notifications", "body" => $notifications, "button" => $buttons));
     $this->html = $page;
 }
 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));
 }
<?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");
if ($guid != getLoggedInUserGuid()) {
    $url = addTokenToURL(getSiteURL() . "action/loginas/{$guid}");
    echo "<a href='{$url}' class='btn btn-danger btn-xs'>Login As</a>";
}
<?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();
$delete_url = addTokenToURL(getSiteURL() . "action/deleteLogo");
echo display("input/file", array("name" => "avatar", "class" => "form-control"));
echo display("input/submit", array("class" => "btn btn-success", "label" => "Upload"));
echo "<a href='{$delete_url}' class='btn btn-danger confirm'>Delete</a>";
$title = $group->title;
$description = truncate($group->description);
$owner_guid = $group->owner_guid;
$owner = getEntity($owner_guid);
$by = "Created by: <a href='" . $owner->getURL() . "'>" . $owner->full_name . "</a>" . friendlytime($group->time_created);
$members = GroupsPlugin::memberCount($group);
switch ($group->membership) {
    case "public":
        $type = "Public";
        break;
    case "friends":
        $type = "Friends";
}
if (GroupsPlugin::loggedInUserCanJoin($group)) {
    $join_url = getSiteURL() . "action/joinGroup/{$guid}";
    $join_url = addTokenToURL($join_url);
    $button = "<p style='margin-top:10px;'><a href='{$join_url}' class='btn btn-success btn-sm'>Join Group</a></p>";
}
echo <<<HTML
<div class='panel panel-default'>
    <div class='panel-body'>
        <div class="media">
            <div class="media-left">
                <a href="{$url}">
                    {$icon}
                </a>
            </div>
            <div class="media-body">
                
                <h4 class="media-heading"><a href='{$url}'>{$title}</a></h4>
                {$description}<br/>
Example #8
0
                </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>
                </div>
            </div>
        </div>
    </div>
<?php 
} else {
    ?>
    <h2 class='text-center'>Your cart is empty.</h2>
<?php 
}
 * Contact Shane Barron admin@socia.us for more information.
 */
namespace SocialApparatus;

denyDirect();
$guid = Vars::get("guid");
$view_type = Vars::get("view_type");
$photo = getEntity($guid);
switch ($view_type) {
    case "gallery":
    default:
        $buttons = NULL;
        $url = $photo->getURL();
        $icon = $photo->icon(EXTRALARGE, "img-responsive");
        if ($photo->owner_guid == getLoggedInUserGuid()) {
            $delete_url = addTokenToURL(getSiteURL() . "action/deletePhoto/{$guid}");
            $buttons = <<<HTML
                    <div class='btn-group pull-right'>
                        <a href='{$delete_url}' class='btn btn-danger btn-xs confirm'>Delete</a>
                    </div>
HTML;
        }
        echo <<<HTML
<div class='col-lg-3 masonry_element'>
    <div class='panel panel-default'>
        <div class='panel-heading clearfix'>
            {$buttons}
            {$photo->title} 
        </div>
        <div class='panel-body'>
            <a href='{$url}'>
 static function getAll($menu_name, $item_class = "", $parent = "ul", $child = "li", $child_wrapper = true)
 {
     $menus = Cache::get("menus", "page");
     $return = NULL;
     if (!empty($menus[$menu_name])) {
         $menuarray = $menus[$menu_name];
         if (!empty($menuarray)) {
             if (count($menuarray) > 1) {
                 uasort($menuarray, function ($a, $b) {
                     if ($a->weight == $b->weight) {
                         return $a->name < $b->name ? -1 : 1;
                     }
                     return $a->weight < $b->weight ? -1 : 1;
                 });
             }
             foreach ($menuarray as $menuitemname => $menu) {
                 $list_class = isset($menu->list_class) ? $menu->list_class : "";
                 $label = display("output/editor", array("value" => $menu->label));
                 if (isset($menu->title)) {
                     $title = $menu->title;
                 } else {
                     $title = $menu->label;
                 }
                 if (isset($menu->page) && $menu->page == "#" || !isset($menu->page)) {
                     $submenu = getMenuItems($menuitemname);
                     $return .= "<{$child} class='dropdown {$item_class} {$list_class}'>";
                     $return .= "<a href='#' class='dropdown-toggle' data-toggle='dropdown' role='button' aria-expanded='false' title='{$title}'>" . $label . "</a>";
                     $return .= "<{$parent} class='dropdown-menu' role='menu'>";
                     $return .= $submenu;
                     $return .= "</{$parent}>";
                     $return .= "</{$child}>";
                 } else {
                     $link_class = isset($menu->link_class) && $menu->link_class ? $menu->link_class : NULL;
                     $external = $menu->external;
                     if (!$external) {
                         $link = getSiteURL() . $menu->page;
                         if (strpos($link, 'action') !== false) {
                             $link = addTokenToURL($link);
                         }
                     } else {
                         $link = $menu->page;
                     }
                     $active_class = $menuitemname == currentPage() || $menu->page == currentPage() ? "active" : NULL;
                     if ($child_wrapper) {
                         $return .= "<{$child} class='{$active_class} {$item_class} {$list_class}' title='{$title}'>";
                     }
                     if ($menu->button_class) {
                         $return .= "<form action='{$link}'>";
                         $return .= "<button class='{$menu->button_class}'>{$label}</button>";
                         $return .= "</form>";
                     } else {
                         $return .= "<a class='{$link_class}' href='{$link}' title='{$title}' data-toggle='tooltip' data-placement='bottom'>{$label}</a>";
                     }
                     if ($child_wrapper) {
                         $return .= "</{$child}>";
                     }
                 }
             }
             return $return;
         }
     }
     return NULL;
 }
     die;
 }
 if ($message->to != getLoggedInUserGuid() && $message->from != getLoggedInUserGuid()) {
     die;
 }
 $to = $message->to;
 $from = $message->from;
 $to_user = getEntity($to);
 $from_user = getEntity($from);
 $icon1 = $to_user->icon(SMALL);
 $icon2 = $from_user->icon(SMALL);
 $to_user_url = $to_user->getURL();
 $from_user_url = $from_user->getURL();
 $icons = "<span class='pull-right' style='height:32px;width:32px;background:#F5F8FA;margin-left:4px;border-radius:8px;'><a href='{$to_user_url}'>{$icon1}</a></span>";
 $icons .= "<span class='pull-right' style='height:32px;width:32px;background:#F5F8FA;margin-left:4px;border-radius:8px;'><a href='{$from_user_url}'>{$icon2}</a></span>";
 $delete_url = addTokenToURL(getSiteURL() . "action/deleteMessage/" . $message->guid);
 $buttons = "<a class='pull-right btn btn-danger btn-xs confirm' href='{$delete_url}' style='margin-left:8px;'>Delete Messages</a>";
 $message_entities = listEntities(array("type" => "Messageelement", "metadata_name" => "container_guid", "metadata_value" => $guid));
 ?>
 <div class="panel">
     <div class="panel-heading">
         <?php 
 echo $buttons;
 echo $icons;
 echo $message->subject;
 ?>
     </div>
     <div class="panel-body">
         <?php 
 echo $message_entities;
 ?>
 *  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");
if ($guid && loggedIn()) {
    if (getLoggedInUserGuid() != $guid) {
        if (FriendsPlugin::requestSent(getLoggedInUserGuid(), $guid)) {
            echo "<span class='btn btn-info btn-xs' title='Friendship Requested' data-toggle='tooltip'><i class='fa fa-user'></i></span>";
        } else {
            if (FriendsPlugin::friends($guid, getLoggedInUserGuid())) {
                $remove_friend_url = addTokenToURL(getSiteURL() . "action/removeFriend/{$guid}");
                echo "<a href='{$remove_friend_url}' data-toggle='tooltip' title='Remove Friend' class='btn btn-warning btn-xs'><i class='fa fa-minus'></i></a>";
            } else {
                $add_friend_url = addTokenToURL(getSiteURL() . "action/addFriend/{$guid}");
                echo "<a href='{$add_friend_url}' data-toggle='tooltip' title='Add Friend' class='btn btn-success btn-xs'><i class='fa fa-plus'></i></a>";
            }
        }
    }
}
 * 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();
$guid = Vars::get("guid");
$page = getEntity($guid);
$body = truncate($page->body);
$edit_url = getSiteURL() . "editCustomPage/" . $guid;
$delete_url = addTokenToURL(getSiteURL() . "action/deletePage/" . $guid);
echo <<<HTML
<li class='well well-sm' id="guid_{$guid}">
    <a href='{$delete_url}' class='btn btn-danger pull-right confirm'>Delete</a>
    <a href='{$edit_url}' class='btn btn-info pull-right'>Edit</a>
    <h4>Name:  {$page->name}</h4>
    <h4>Menu Label:  {$page->label}</h4>
    <h4>Title:  {$page->title}</h4>
    <h4>Body:  </h4>
    {$body}
</li>
HTML
;
namespace SocialApparatus;

denyDirect();
setlocale(LC_MONETARY, 'en_US');
$guid = Vars("guid");
$hidden = $hidden_text = NULL;
$product = getEntity($guid);
$icon = $product->icon(EXTRALARGE, "img-responsive", false);
$description = display("output/editor", array("value" => $product->description));
$interval = EcommercePlugin::$intervals[$product->interval];
$price = money_format('%(#10n', $product->price) . "&nbsp;<small>" . $interval . "</small>";
$cart_url = addTokenToURL(getSiteURL() . "action/addToCart/" . $guid);
$button = "<a href='{$cart_url}' class='btn btn-success btn-lg btn-block' style='margin-top:20px;'>Add to Cart</a>";
if (adminLoggedIn()) {
    $edit_url = getSiteURL() . "store/edit_product/{$guid}";
    $delete_url = addTokenToURL(getSiteURL() . "action/deleteProduct/{$guid}");
    $buttons = "<a href='{$edit_url}' class='btn btn-xs btn-info'>Edit</a>";
    $buttons .= "<a href='{$delete_url}' class='btn btn-xs btn-danger confirm'>Delete</a>";
} else {
    $buttons = "";
}
if ($product->hidden) {
    $hidden = "style='border:2px solid red;'";
    $hidden_text = "<strong> (Hidden)</strong>";
}
echo <<<HTML
<div class='well well-sm' {$hidden}>
    <div class='btn-group pull-right'>
        {$buttons}
    </div>
    <div class='container-fluid'>
 */
namespace SocialApparatus;

$guid = Vars("guid");
$report = getEntity($guid);
$owner = getEntity($report->owner_guid);
$full_name = $owner->full_name;
$owner_url = $owner->getURL();
$avatar = $owner->icon(MEDIUM, "media-object");
$reason = $report->reason;
$page = $report->page;
if ($report->closed) {
    $url = addTokenToURL(getSiteUrl() . "action/openReport/{$guid}");
    $button = "<a href='{$url}' class='btn btn-danger confirm'>Reopen</a>";
} else {
    $url = addTokenToURL(getSiteURL() . "action/closeReport/{$guid}");
    $button = "<a href='{$url}' class='btn btn-danger confirm'>Close</a>";
}
echo <<<HTML
<div class='well well-sm'>
    <div class="media">
        <div class="media-left">
            <a href="{$owner_url}">
               {$avatar}
            </a>
        </div>
        <div class="media-body">
            <h4 class="media-heading">{$full_name}</h4>
            <p><a href='{$page}' target='_blank'>{$page}</a></p>
            <p>{$reason}</p>
        </div>
 * unless prior written permission is obtained from SocialApparatus.
 * 
 * Contact Shane Barron admin@socia.us for more information.
 */
namespace SocialApparatus;

denyDirect();
$guid = Vars::get("guid");
$status = getEntity($guid);
$owner_guid = $status->owner_guid;
$owner = getEntity($owner_guid);
$icon = $owner->icon(MEDIUM, "media-object");
$url = $owner->getURL();
$body = $status->description;
$timeago = display("output/friendly_time", array("timestamp" => $status->time_created));
$delete_url = addTokenToURL(getSiteURL() . "action/deleteProfileStatus/{$guid}");
$button = $owner_guid == getLoggedInUserGuid() ? "<a class='btn btn-danger btn-xs pull-right confirm' title='Delete' data-toggle='tooltip' href='{$delete_url}'><i class='fa fa-times'></i></a>" : "";
echo <<<HTML

<div class="well">
    {$button}
    <div class="media">
        <div class="media-left">
            <a href="{$url}">
                {$icon}
            </a>
        </div>
        <div class="media-body">
            {$owner->full_name} posted:<br/>
            {$body}
            {$timeago}
 * unless prior written permission is obtained from SocialApparatus.
 * 
 * Contact Shane Barron admin@socia.us for more information.
 */
namespace SocialApparatus;

denyDirect();
$guid = Vars::get('guid');
$comment = getEntity($guid);
classGateKeeper($comment, "Comment");
$owner_guid = $comment->owner_guid;
$owner = getEntity($owner_guid);
$url = $owner->getURL();
$icon = $owner->icon(SMALL);
$time = display("output/friendly_time", array("timestamp" => $comment->time_created));
$delete_url = addTokenToURL(getSiteURL() . "action/deleteComment/{$guid}");
$button = $owner_guid == getLoggedInUserGuid() ? "<a href='{$delete_url}' class='btn btn-danger btn-xs pull-right confirm' data-toggle='tooltip' title='Delete'><i class='fa fa-times'></i></a>" : "";
$page = <<<HTML
<li class='comment_{$guid}'>
    {$button}
    <div class="commenterImage">
        <a href="{$url}" title="{$owner->first_name} {$owner->last_name}">
            {$icon}
        </a>
    </div>
    <div class="commentText">
        <p class=""><strong><a href="{$url}">{$owner->first_name} {$owner->last_name}</a></strong> {$comment->body}</p> {$time}
    </div>
</li>
HTML;
echo $page;
$description = display("output/editor", array("value" => $category->description));
switch ($view_type) {
    default:
    case "list":
        $description = truncate($description);
        break;
    case "entity":
        break;
}
$order = adminLoggedIn() ? $category->order : "";
$url = $category->getURL();
$topics = getEntities(array("type" => "Forumtopic", "metadata_name" => "container_guid", "metadata_value" => $guid, "count" => true));
$comments = getEntities(array("type" => "Forumcomment", "metadata_name" => "category_guid", "metadata_value" => $guid, "count" => true));
if (adminLoggedIn()) {
    $edit_url = getSiteURL() . "forum/editCategory/{$guid}";
    $delete_url = addTokenToURL(getSiteURL() . "action/deleteCategory/{$guid}");
    $buttons = <<<HTML
<span class='pull-right btn-group'>
    <a href='{$edit_url}' class='btn btn-info btn-sm'>Edit</a>
    <a href='{$delete_url}' class='btn btn-danger btn-sm confirm'>Delete</a>
</span>
HTML;
} else {
    $buttons = NULL;
}
echo <<<HTML
<div class='panel panel-default'>
    <div class='panel-heading'>
        {$buttons}
        <a href='{$url}'><h3 class='panel-header'>{$order} {$category->title}</h3></a>
    </div>
$guid = Vars::get("guid");
$view_type = Vars::get("view_type");
$topic = getEntity($guid);
$description = display("output/editor", array("value" => $topic->description));
switch ($view_type) {
    default:
    case "list":
        $description = truncate($description);
        break;
    case "entity":
        break;
}
$comments = getEntities(array("type" => "Forumcomment", "metadata_name" => "container_guid", "metadata_value" => $guid, "count" => true));
$url = $topic->getURL();
$edit_url = getSiteURL() . "forum/editTopic/{$guid}";
$delete_url = addTokenToURL(getSiteURL() . "action/deleteTopic/{$guid}");
echo <<<HTML
<div class='panel panel-default'>
    <div class='panel-heading'>
HTML;
if (adminLoggedIn()) {
    echo <<<HTML
        <span class='pull-right btn-group'>
            <a href='{$edit_url}' class='btn btn-info btn-sm'>Edit</a>
            <a href='{$delete_url}' class='btn btn-danger btn-sm confirm'>Delete</a>
        </span>
HTML;
}
echo <<<HTML
        <a href='{$url}'><h3 class='panel-header'>{$topic->title}</h3></a>
    </div>
            </div>
            <div class="media-body">
                <h4 class="media-heading"><a href='{$url}'>{$sender->full_name}</a></h4>
            </div>
        </div>
    </div>
    <div class='panel-footer'>
    {$buttons}
    </div>
</div>
HTML;
} else {
    $recipient = getEntity($recipient_guid);
    $avatar = $recipient->icon(SMALL, "media-object");
    $url = $recipient->getURL();
    $withdraw_url = addTokenToURL(getSiteURL() . "action/withdrawFriendrequest/{$guid}");
    $buttons = "<a href='{$withdraw_url}' class='btn btn-danger btn-xs confirm'>WithDraw</a>";
    echo <<<HTML
    <div class='panel panel-default'>
        <div class='panel-body'>
            <div class="media">
                <div class="media-left">
                    <a href="{$url}">
                        {$avatar}
                    </a>
                </div>
                <div class="media-body">
                    <h4 class="media-heading"><a href='{$url}'>{$recipient->full_name}</a></h4>
                </div>
            </div>
        </div>
 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));
 }
 * 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();
Plugin::getPluginsFromFileSystem();
$access = getIgnoreAccess();
setIgnoreAccess();
$plugin_array = getEntities(array("type" => "Plugin", "order_by" => "plugin_order"));
setIgnoreAccess($access);
$plugins = viewEntityList($plugin_array);
$body = <<<HTML
<ul class="sortable-list" style="list-style:none;margin-left:0px;padding-left:0px;">
    {$plugins}
</ul>
HTML;
$header = "Plugins";
$url = addTokenToURL(getSiteURL() . "action/EnableAllPlugins");
$url2 = addTokenToURL(getSiteURL() . "action/DisableAllPlugins");
$button = "<a href='{$url}' class='btn btn-warning confirm'>Enable All Plugins</a>";
$button .= "<a href='{$url2}' class='btn btn-danger confirm'>Disable All Plugins</a>";
echo display("page_elements/page_header", array("text" => $header, "button" => $button));
echo $body;
    ?>
    </table>
    <h2>Subscriptions</h2>
    <table class='table table-striped table-hover table-bordered'>
        <tr>
            <th>ID</th>
            <th>Start Date</th>
            <th>Current Period</th>
            <th>Plan</th>
            <th>Status</th>
            <th>Actions</th>
        </tr>
        <?php 
    foreach ($subscriptions['data'] as $subscription) {
        $plan = $subscription->plan;
        $cancel_url = addTokenToURL(getSiteURL() . "action/cancelSubscription/" . $subscription->id);
        ?>
            <tr>
                <td><?php 
        echo $subscription->id;
        ?>
</td>
                <td><?php 
        echo date("m/d/Y", $subscription->start);
        ?>
</td>
                <td><?php 
        echo date("m/d/Y", $subscription->current_period_start) . " to " . date("m/d/Y", $subscription->current_period_end);
        ?>
</td>
                <td><?php 
 * 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");
$view_type = Vars::get("view_type");
$heading = $description = $created = NULL;
$entity = getEntity($guid);
$url = $entity->getURL();
$icon = $entity->icon(MEDIUM, "media-object");
$type = $entity->type;
$delete_url = addTokenToURL(getSiteURL() . "action/delete" . $type . "/" . $guid);
$edit_url = getSiteURL() . $type . "/edit/" . $guid;
if (isset($entity->time_created)) {
    $created = display("output/friendly_time", array("timestamp" => $entity->time_created));
}
if (isset($entity->description)) {
    $description = display("output/editor", array("value" => truncate($entity->description)));
}
if (adminLoggedIn() || $entity->owner_guid == $guid) {
    $delete_button = "<a href='{$delete_url}' class='btn btn-danger btn-xs'><i class='fa fa-times'></i></a>";
    $edit_button = "<a href='{$edit_url}' class='btn btn-info btn-xs'><i class='fa fa-pencil'></i></a>";
    $heading = <<<HTML
    <div class="panel-heading clearfix">
        <div class="pull-right">
            {$edit_button}
            {$delete_button}
 * 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();
$content = NULL;
$tables = Dbase::getAllTables(false);
foreach ($tables as $key => $name) {
    if ($name != "entities") {
        $purge_url = addTokenToURL(getSiteURL() . "action/purgeTable/{$name}");
        $delete_url = addTokenToURL(getSiteURL() . "action/deleteTable/{$name}");
        $query = "SELECT COUNT(*) FROM `{$name}`";
        $results = Dbase::getResultsArray($query);
        if ($results) {
            $records = $results[0]['COUNT(*)'];
            $buttons = "<a href='{$purge_url}' class='btn btn-warning btn-xs confirm'>Purge</a>";
            if ($name != "User") {
                $buttons .= "<a href='{$delete_url}' class='btn btn-danger btn-xs confirm'>Delete</a>";
            }
            $content .= <<<HTML
<tr>
    <td>{$name}</td>
    <td>{$records}</td>
    <td>{$buttons}</td>
</tr>
Example #26
0
$user_two = getEntity($user_two_guid);
$icon = $user_two->icon(MEDIUM, "media-object");
$url = $user_two->getURL();
$sitename = getSiteName();
$name = $user_two->full_name;
$messages = display("chat/messages", array("guid" => $guid));
if ($chat->user_one == getLoggedInUserGuid()) {
    $closed = $chat->user_one_closed;
    $minimized = $chat->user_one_maximized ? "" : "style='display:none;'";
    $icon = $chat->user_one_maximized ? "glyphicon glyphicon-minus" : "glyphicon glyphicon-plus";
} else {
    $closed = $chat->user_two_closed;
    $minimized = $chat->user_two_maximized ? "" : "style='display:none;'";
    $icon = $chat->user_two_maximized ? "glyphicon glyphicon-minus" : "glyphicon glyphicon-plus";
}
$delete_url = addTokenToURL(getSiteURL() . "action/DeleteChatMessages/" . $guid);
if (!$closed) {
    ?>
    <div class="chat-window" id="chat_window_<?php 
    echo $guid;
    ?>
">
        <div class="container-fluid">
            <div class="panel panel-default" style="margin-bottom:0px;">
                <div class="panel-heading top-bar clearfix">
                    <div class="col-md-7 col-xs-7">
                        <h3 class="panel-title"><span class="glyphicon glyphicon-comment"></span>&nbsp;<?php 
    echo $user_two->full_name;
    ?>
</h3>
                    </div>
Example #27
0
    $view_type = "list";
}
$size = Vars::get("size");
if (!$size) {
    $size = MEDIUM;
}
$created = "Uploaded: by " . $name . " " . display("output/friendly_time", array("timestamp" => $file->time_created));
$icon = Image::getImageURL($file->guid, $size);
$body_before = display("file/body_before", array("guid" => $guid));
$body_after = display("file/body_after", array("guid" => $guid));
$media_left_before = display("file:list:media:left:before", array("guid" => $guid));
$media_left_after = display("file:list:media:left:after", array("guid" => $guid));
$media_right_before = display("file:list:media:right:before", array("guid" => $guid));
$media_right_after = display("file:list:media:right:after", array("guid" => $guid));
if (getLoggedInUserGuid() == $file->owner_guid) {
    $buttons = "<a href='" . addTokenToURL(getSiteURL() . 'action/deleteFile/' . $guid) . "' class='btn btn-danger confirm'><i class='fa fa-times'></i></a>";
}
$filename = $file->filename;
switch ($view_type) {
    case "list":
    default:
        $core_output = <<<HTML
<div class="well well-sm">
    <div class="media">
        <input type="hidden" class="guid" value="{$guid}"/>
        <div class="media-left">
            {$media_left_before}
            <a href="{$url}" title="{$file->title}" data-toggle="tooltip" >
                <img class="media-object img-rounded" data-title="{$file->title}" title="{$file->title}" src="{$icon}" style='width:64px;' alt="{$file->title}">
            </a>
            {$media_left_after}
    if (isset($plugin->requires) && is_array($plugin->requires)) {
        foreach ($plugin->requires as $required_plugin) {
            $required_plugin_entity = Plugin::getPluginByName($required_plugin);
            if ($required_plugin_entity) {
                if ($required_plugin_entity->status == "enabled") {
                    $requirements .= "<span class='enabled_plugin_link' onclick='sitejs.gotoplugin({$required_plugin_entity->guid})'>{$required_plugin}</span> , ";
                } else {
                    $requirements .= "<span class='disabled_plugin_link' onclick='sitejs.gotoplugin({$required_plugin_entity->guid})'>{$required_plugin}</span> , ";
                }
            }
        }
    }
    $requirements = substr($requirements, 0, -3);
}
$enable_plugin_url = addTokenToURL(getSiteURL() . "action/enablePlugin/{$guid}");
$disable_plugin_url = addTokenToURL(getSiteURL() . "action/disablePlugin/{$guid}");
if ($plugin->status == "disabled") {
    $link = "<a href='{$enable_plugin_url}' class='pull-right btn btn-xs btn-success'><i class='fa fa-plus-circle'></i> Enable</a>";
    $class = "plugin-disabled";
    echo <<<HTML
<li class="alert alert-danger {$class}" id="guid_{$guid}" style="cursor:move;">
    {$link}
    <p><strong>{$plugin->label}</strong></p>
    <p>Requires:  {$requirements}</p>
</li>
HTML;
} else {
    $link = "<a href='{$disable_plugin_url}' class='pull-right btn btn-xs btn-danger'><i class='fa fa-minus-circle'></i> Disable</a>";
    $class = "plugin-enabled";
    echo <<<HTML
<li class="alert alert-success {$class}" id="guid_{$guid}" style="cursor:move;">