Ejemplo n.º 1
0
Archivo: Links.php Proyecto: rjha/sc
 static function getHtml($map, $template, $classMap)
 {
     $currentUrl = Url::current();
     $pos = strpos($currentUrl, '?');
     //remove the part after ? from Url
     if ($pos !== false) {
         $currentUrl = substr($currentUrl, 0, $pos);
     }
     $bucket = array();
     $activeName = NULL;
     foreach ($map as $url => $name) {
         //links to store
         if (!array_key_exists($name, $bucket)) {
             $record = array();
             $record["name"] = $name;
             $record["url"] = $url;
             $record["class"] = $classMap["normal"];
             $bucket[$name] = $record;
         }
         if (strcmp($url, $currentUrl) == 0) {
             //name to highlight
             $activeName = $name;
         }
     }
     if (!is_null($activeName)) {
         $bucket[$activeName]["class"] = $classMap["active"];
     }
     $view = new \stdClass();
     $view->records = array_values($bucket);
     $html = Template::render($template, $view);
     return $html;
 }
Ejemplo n.º 2
0
Archivo: Comment.php Proyecto: rjha/sc
 static function getWidget($row, $options = NULL)
 {
     $html = NULL;
     $view = new \stdClass();
     $template = '/fragments/comment/text.tmpl';
     if (is_null($options)) {
         $options = ~UIConstants::COMMENT_ALL;
     }
     $view->id = $row['id'];
     $view->title = $row['title'];
     $view->postId = $row['post_id'];
     $view->itemId = PseudoId::encode($view->postId);
     $view->comment = $row['description'];
     $view->createdOn = AppUtil::convertDBTime($row['created_on']);
     $view->showUser = false;
     if ($options & UIConstants::COMMENT_USER) {
         $view->loginId = $row['login_id'];
         $view->pubUserId = PseudoId::encode($view->loginId);
         $view->userName = $row['user_name'];
         $view->showUser = true;
     }
     $encodedId = PseudoId::encode($view->id);
     $params = array('id' => $encodedId, 'q' => base64_encode(Url::current()));
     $view->editUrl = Url::createUrl('/qa/comment/edit.php', $params);
     $view->deleteUrl = Url::createUrl('/qa/comment/delete.php', $params);
     $html = Template::render($template, $view);
     return $html;
 }
Ejemplo n.º 3
0
Archivo: Feedback.php Proyecto: rjha/sc
 static function get($row)
 {
     $html = NULL;
     $view = new \stdClass();
     $template = '/fragments/monitor/feedback.tmpl';
     $view->id = $row['id'];
     $params = array("id" => $row['id'], "q" => base64_encode(Url::current()));
     $view->deleteUrl = Url::createUrl("/monitor/feedback/delete.php", $params);
     $view->description = $row['feedback'];
     $view->name = $row['name'];
     $view->phone = $row['phone'];
     $view->email = $row['email'];
     $html = Template::render($template, $view);
     return $html;
 }
Ejemplo n.º 4
0
if (strcmp($gSessionLogin->provider, Login::MIK) != 0) {
    $message = "change password only works for 3mik logins!";
    throw new UIException(array($message));
}
$userDao = new \com\indigloo\sc\dao\User();
$userDBRow = $userDao->getonLoginId($loginId);
//tokens for use in next screen
$ftoken = Util::getMD5GUID();
$email = $userDBRow["email"];
$femail = Util::encrypt($email);
$gWeb = \com\indigloo\core\Web::getInstance();
$gWeb->store("change.password.email", $femail);
$gWeb->store("change.password.token", $ftoken);
$title = $userDBRow["email"];
$qUrl = base64_encode(Url::current());
$fUrl = Url::current();
$submitUrl = "/user/account/form/change-password.php";
?>

<!DOCTYPE html>
<html>

       <head>
        <title> Change password - <?php 
echo $title;
?>
  </title>
        <?php 
include APP_WEB_DIR . '/inc/meta.inc';
?>
        <?php 
Ejemplo n.º 5
0
Archivo: index.php Proyecto: rjha/sc
$analyticDao = new \com\indigloo\sc\dao\Analytic();
$counters = $analyticDao->getUserCounters($loginId);
$activityDao = new \com\indigloo\sc\dao\Activity();
$feedDataObj = $activityDao->getUserFeeds($loginId, 20);
//suggestions are editor picks right now
$postDao = new \com\indigloo\sc\dao\Post();
//post featured filter
$filters = array();
$model = new \com\indigloo\sc\model\Post();
$filter = new Filter($model);
$filter->add($model::FEATURED, Filter::EQ, TRUE);
array_push($filters, $filter);
// pick 12 posts from editor picks
$postDBRows = $postDao->getPosts(12, $filters);
$dashItemHelp = \com\indigloo\sc\html\Site::getDashItemHelp($counters["post_count"]);
$params = array("q" => base64_encode(Url::current()));
$linkInvitation = Url::createUrl("/user/invite.php", $params);
?>


<!DOCTYPE html>
<html>

    <head>
        <title>  Dashboard - <?php 
echo $loginName;
?>
  </title>
        <?php 
include APP_WEB_DIR . '/inc/meta.inc';
?>
Ejemplo n.º 6
0
Archivo: Post.php Proyecto: rjha/sc
 static function getAdminWidget($postDBRow, $score = 0)
 {
     $html = NULL;
     $voptions = array("abbreviate" => true, "group" => true);
     $view = self::createPostView($postDBRow, $voptions);
     if ($view->hasImage) {
         $template = '/fragments/widget/admin/image.tmpl';
         //Add thumbnail width and height
         $td = Util::foldX($view->width, $view->height, 100);
         $view->twidth = $td["width"];
         $view->theight = $td["height"];
     } else {
         $template = '/fragments/widget/admin/text.tmpl';
     }
     $params = array('id' => $view->itemId, 'q' => base64_encode(Url::current()));
     $view->editUrl = Url::createUrl('/qa/edit.php', $params);
     $view->deleteUrl = Url::createUrl('/qa/delete.php', $params);
     $view->feature = $postDBRow['fp_bit'] == 0 ? true : false;
     $view->unfeature = $postDBRow['fp_bit'] == 1 ? true : false;
     $view->status = $view->unfeature ? "F" : "";
     $view->score = $score > 0 ? $score : "";
     $html = Template::render($template, $view);
     return $html;
 }
Ejemplo n.º 7
0
Archivo: Post.php Proyecto: rjha/sc
 function process($params, $options)
 {
     if (is_null($params) || empty($params)) {
         $controller = new \com\indigloo\sc\controller\Http400();
         $controller->process();
         exit;
     }
     $itemId = Util::getArrayKey($params, "item_id");
     if ($itemId < 1200) {
         //@todo remove permanent redirect
         $redirectUrl = "/item/" . PseudoId::encode($itemId);
         header("HTTP/1.1 301 Moved Permanently");
         header("Location: " . $redirectUrl);
         exit;
     }
     $postDao = new \com\indigloo\sc\dao\Post();
     $postId = PseudoId::decode($itemId);
     $postDBRow = $postDao->getOnId($postId);
     if (empty($postDBRow)) {
         //not found
         $controller = new \com\indigloo\sc\controller\Http404();
         $controller->process();
         exit;
     }
     $options = array();
     $options["group"] = true;
     $postView = \com\indigloo\sc\html\Post::createPostView($postDBRow, $options);
     // links is separate from postView for historical reasons
     $linksJson = $postDBRow['links_json'];
     $dblinks = json_decode($linksJson);
     $links = array();
     foreach ($dblinks as $link) {
         $link = Url::addHttp($link);
         array_push($links, $link);
     }
     /* data for facebook/google+ dialogs */
     $itemObj = new \stdClass();
     $itemObj->appId = Config::getInstance()->get_value("facebook.app.id");
     $itemObj->host = Url::base();
     /* google+ cannot redirect to local box */
     $itemObj->netHost = "http://www.3mik.com";
     $itemObj->callback = $itemObj->host . "/callback/fb-share.php";
     if ($postView->hasImage) {
         /* use original image for og snippets, smaller images may be ignored */
         /* facebook and google+ dialogs need absolute URL */
         $itemObj->picture = $postView->srcImage;
     } else {
         $itemObj->picture = $itemObj->host . "/css/asset/sc/logo.png";
     }
     //do not urlencode - as we use this value as canonical url
     $itemObj->link = $itemObj->host . "/item/" . $itemId;
     $itemObj->netLink = $itemObj->netHost . "/item/" . $itemId;
     // title in DB is 128 chars long.
     // here on page we want to use a 70 char title.
     // also used in item images alt text
     // item description should be 160 chars.
     $itemObj->title = Util::abbreviate($postView->title, 70);
     $itemObj->title = sprintf("item %s - %s", $itemId, $itemObj->title);
     $itemObj->description = Util::abbreviate($postView->description, 160);
     $itemObj->description = sprintf("item %s - %s by user %s", $itemId, $itemObj->description, $postView->userName);
     $strItemObj = json_encode($itemObj);
     //make the item json string form safe
     $strItemObj = Util::formSafeJson($strItemObj);
     /* likes data */
     $bookmarkDao = new \com\indigloo\sc\dao\Bookmark();
     $likeDBRows = $bookmarkDao->getLikeOnItemId($itemId);
     $gWeb = \com\indigloo\core\Web::getInstance();
     /* sticky is used by comment form */
     $sticky = new Sticky($gWeb->find(Constants::STICKY_MAP, true));
     $gRegistrationPopup = false;
     $loginIdInSession = \com\indigloo\sc\auth\Login::tryLoginIdInSession();
     //show registration popup
     if (is_null($loginIdInSession)) {
         $register_popup = $gWeb->find("sc:browser:registration:popup");
         $register_popup = is_null($register_popup) ? false : $register_popup;
         if (!$register_popup) {
             $gRegistrationPopup = true;
             $gWeb->store("sc:browser:registration:popup", true);
         }
     }
     $group_slug = $postDBRow["group_slug"];
     $groupDao = new \com\indigloo\sc\dao\Group();
     $group_names = $groupDao->tokenizeSlug($group_slug, ",", true);
     $pageTitle = $itemObj->title;
     $metaKeywords = SeoData::getMetaKeywords($group_names);
     $pageUrl = Url::base() . Url::current();
     $file = APP_WEB_DIR . '/view/item.php';
     include $file;
 }
Ejemplo n.º 8
0
Archivo: groups.php Proyecto: rjha/sc
                <div class="span8">
                    <?php 
FormMessage::render();
?>
                        <div id="form-wrapper">
                            <form name="web-form1" action="/monitor/form/group/featured.php" method="POST">
                                
                                <?php 
echo \com\indigloo\sc\html\Site::renderAddBox();
?>
                                <?php 
echo \com\indigloo\sc\html\Site::renderSlugPanel($dbslug);
?>
                                
                                <input type="hidden" name="fUrl" value="<?php 
echo Url::current();
?>
" />
                                <div class="p10">
                                    <button class="btn b" type="submit" name="save" value="Save"><span>Update</span></button>
                                 
                                </div>
                            </form>
                        </div>
                </div>
                
            </div>
        </div> <!-- container -->

        <?php 
echo \com\indigloo\sc\util\Asset::version("/js/bundle.js");