*  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("guid");
$message_entity = getEntity($guid);
$from_guid = $message_entity->from;
$from_user = getEntity($from_guid);
$icon = $from_user->icon(MEDIUM, "media-object");
$message_body = display("output/editor", array("value" => $message_entity->message));
$url = $from_user->getURL();
$timeago = display("output/friendly_time", array("timestamp" => $message_entity->time_created));
$read = $message_entity->read;
if ($read == "false" && $message_entity->to == getLoggedInUserGuid()) {
    $class = "unread";
} else {
    $class = "";
}
if (getLoggedInUserGuid() == $message_entity->to) {
    $message_entity->read = "true";
 *  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();
$tabs = Vars("tabs");
$content = NULL;
foreach ($tabs as $label => $url) {
    $current = currentURL();
    if (currentURL() == $url) {
        $class = 'active';
    } else {
        $class = '';
    }
    $content .= <<<HTML
<li role='presentation' class='{$class}'>
     <a href='{$url}' aria-controls='' role='tab'>{$label}</a>       
</li>
HTML;
}
echo <<<HTML
 * 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();
$label = Vars::get("label");
$class = Vars::get("class");
$cancel = Vars("cancel");
if (!$label) {
    $label = "Save";
}
if (!$class) {
    $class = "btn btn-success";
}
if ($cancel) {
    echo <<<HTML
<span class='btn-group'>
HTML;
}
echo <<<HTML
    <input type="submit" class="{$class}" value="{$label}">
HTML;
if ($cancel) {
 * 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;

include_once dirname(dirname(__FILE__)) . "/engine/start.php";
$view = getInput("view", "", false);
$vars = getInput("vars", "", false);
$session = getInput("session", "", false);
if ($session) {
    Vars("session", $session);
}
if (is_array($vars)) {
    foreach ($vars as $key => $value) {
        new Vars($key, $value);
    }
}
echo display($view);
 * 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();
$user_guid = pageArray(1);
if (!is_numeric($user_guid)) {
    $user_guid = pageArray(2);
}
if (!$user_guid) {
    $user_guid = Vars("guid");
    if (!$user_guid) {
        $user_guid = getLoggedInUserGuid();
    } else {
        $user = getEntity($user_guid);
        if (!is_a($user, "SocialApparatus\\User")) {
            $user_guid = getLoggedInUserGuid();
        }
    }
}
if ($user_guid) {
    $user = getEntity($user_guid);
    $status_html = display("output/editor", array("value" => $user->profile_status));
    echo "<blockquote>";
    echo $status_html;
    echo "</blockquote>";
<?php

/**
 *
 * Copyright (c) 2016 SocialApparatus
 *
 * @author      Shane Barron <*****@*****.**>
 * @project     Project Name
 * @license     GNU General Public License (GPL) version 2
 * @version     1.0
 * @link        http://socia.us
 */
namespace SocialApparatus;

$class = Vars("class");
$class .= " phone_input";
$value = Vars("value");
new Vars("class", $class);
echo display("input/text", array("value" => $value));
 * 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;

$class = Vars("class");
$heading = Vars("heading");
$body = Vars("body");
$footer = Vars("footer");
if (!$class) {
    $class = "panel-default";
}
if ($heading) {
    $heading = <<<HTML
<div class="panel-heading">
    <h3 class="panel-title">{$heading}</h3>
</div>       
HTML;
}
if ($footer) {
    $footer = <<<HTML
            
<div class="panel-footer">{$footer}</div>
HTML;
if ($disabled) {
    $disabled = "disabled";
} else {
    $disabled = NULL;
}
$autocomplete = Vars::get("autocomplete");
if ($autocomplete) {
    $autocomplete = "autocomplete='{$autocomplete}'";
} else {
    $autocomplete = NULL;
}
$prepend = Vars::get("prepend");
$extend = Vars::get("extend");
$class = Vars::get("class");
$placeholder = Vars::get("placeholder");
$form_group = Vars("form_group");
if ($form_group) {
    $body = "<div class='form-group'>";
} else {
    $body = NULL;
}
if ($label) {
    $body .= "<label for='{$name}'>{$label}</label>&nbsp;";
}
if ($prepend || $extend) {
    $body .= "<div class='input-group'>";
}
if ($prepend) {
    $body .= "<div class='input-group-addon'>{$prepend}</div>";
}
$body .= "<input style='{$style}' name='{$name}' placeholder='{$placeholder}'  type='text' class='{$class} jscolor' value='{$value}' {$required} {$disabled} {$autocomplete}>";
 * 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();
$count = Vars('count');
$offset = Vars('offset');
$limit = Vars('limit');
$url = Vars('url');
if (strpos($url, '?') !== false) {
    $chr = "&";
} else {
    $chr = "?";
}
if ($count >= $limit) {
    $total_pages = (int) ceil($count / $limit);
    $current_page = (int) ceil($offset / $limit) + 1;
    $pages = array();
    $start_page = max(min([$current_page - 2, $total_pages - 4]), 1);
    $prev_offset = $offset - $limit;
    if ($prev_offset < 1) {
        $prev_offset = null;
    }
    $pages['prev'] = array('text' => "Previous", 'href' => "{$chr}offset=" . ((int) $offset - (int) $limit));
 * 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();
$value = Vars::get("value");
$name = Vars::get("name");
$label = Vars::get("label");
$required = Vars::get("required");
$style = Vars::get("style");
$data = Vars("data");
if ($data) {
    $data = json_encode($data);
} else {
    $data = "[]";
}
$id = rand(0, 10000);
if ($required) {
    $required = "required='required'";
} else {
    $required = NULL;
}
$disabled = Vars::get("disabled");
if ($disabled) {
    $disabled = "disabled";
} else {
 *
 *
 *
 * @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();
$total = Vars("total");
$user = getLoggedInUser();
$label = Vars("label");
if (!$label) {
    $label = "Purchase";
}
?>
<script
    src="https://checkout.stripe.com/checkout.js" class="stripe-button"
    data-key="<?php 
echo EcommercePlugin::publishableKey();
?>
"
    data-name="<?php 
echo getSiteName();
?>
"
    data-email ="<?php 
 * 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();
$params = Vars("params");
$id = Vars("id");
$wrapper = Vars("wrapper");
$wrapper_class = Vars("wrapper_class");
$title = Vars("title");
$panel = Vars("panel");
$wrapper_id = "entity_list_{$id}";
if (!$wrapper) {
    $wrapper = "div";
}
$wrapper_header = "<{$wrapper} class='{$wrapper_class}' id='{$wrapper_id}'>";
$wrapper_footer = "</{$wrapper}>";
if (!isset($params['limit'])) {
    $params['limit'] = 10;
}
if (!isset($params['offset'])) {
    $params['offset'] = 0;
}
$body = listEntities($params);
$count_shown = ($params['offset'] + 1) * $params['limit'];
$params2 = $params;
} else {
    $guid = Vars("guid");
    $owner = getEntity($guid);
    if (!is_a($owner, "SocialApparatus\\User")) {
        if (loggedIn()) {
            $guid = getLoggedInUserGuid();
            $owner = getLoggedInUser();
        }
    }
}
if ($guid == getLoggedInUserGuid()) {
    $button = "<a href='" . getSiteURL() . "editAvatar' class='btn btn-info edit_avatar_button'><i class='fa fa-pencil'></i></a>";
} else {
    $button = NULL;
}
$show_extensions = Vars("show_extensions");
$logged_in_user = getLoggedInUser();
$owner = getEntity($guid);
$icon = $owner->icon(EXTRALARGE, "img-responsive");
$extensions = display("profile_owner_block_body", array("guid" => $guid));
$name = $owner->full_name;
$url = $owner->getURL();
$page = <<<HTML
<div class='panel panel-default'>
    <div class='panel-body'>
        <div style='position:relative;' id='profile_avatar'>
            {$button}
            <div class='text-center'><a href='{$url}'>{$icon}</a></div>
        </div>
        <h2 class='text-center'><a href='{$url}'>{$name}</a></h2>
        {$extensions}
<?php

/**
 *
 * Copyright (c) 2016 SocialApparatus
 *
 * @author      Shane Barron <*****@*****.**>
 * @project     Project Name
 * @license     GNU General Public License (GPL) version 2
 * @version     1.0
 * @link        http://socia.us
 */
namespace SocialApparatus;

$contents = Vars("contents");
$class = Vars("class");
if (!$class) {
    $class = "default";
}
$count = 0;
?>
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
    <?php 
foreach ($contents as $content) {
    $expanded = $count == 0 ? "true" : "false";
    $in = $count == 0 ? "in" : "";
    $header = $content['header'];
    $body = $content['body'];
    ?>
        <div class="panel panel-<?php 
    echo $class;
<?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();
$class = Vars("class");
$label = Vars("label");
$url = Vars("url");
$url = normalizeURL($url);
echo <<<HTML
<a href='{$url}' class='{$class}'>{$label}</a>
HTML
;
 * 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;

$id = Vars("id");
$heading = Vars("heading");
$body = Vars("body");
$save_button_id = Vars("save_button_id");
$save_button_text = Vars("save_button_text");
$save_button_class = Vars("save_button_class");
$show_close_button = Vars("show_close_button");
$close_button_text = Vars("close_button_text");
$close_button_class = Vars("close_button_class");
if (!$save_button_text) {
    $save_button_text = "Close";
}
if (!$save_button_class) {
    $save_button_class = "btn btn-success";
}
$close_button = NULL;
if (!$close_button_text) {
    $close_button_text = "Close";
}
if (!$close_button_class) {
    $close_button_class = "btn btn-default";
}
if ($show_close_button) {
    $close_button = "<button type='button' class='{$close_button_class}' data-dismiss='modal'>Close</button>";