} else { $story_3_id = 0; } if (isset($_GET['story-4']) && preg_match('/^story_([0-9]+)$/', $_GET['story-4'], $id)) { $story_4_id = $id[1]; } else { $story_4_id = 0; } if (isset($_GET['story-5']) && preg_match('/^story_([0-9]+)$/', $_GET['story-5'], $id)) { $story_5_id = $id[1]; } else { $story_5_id = 0; } if (isset($_GET['story-6']) && preg_match('/^story_([0-9]+)$/', $_GET['story-6'], $id)) { $story_6_id = $id[1]; } else { $story_6_id = 0; } if (isset($_GET['template']) && preg_match('/^template_[0-9]+$/', $_GET['template'])) { $template = $_GET['template']; } else { return false; } $db->query("UPDATE Content set isFeatured = 0 WHERE isFeatured = 1"); $sql = sprintf("REPLACE INTO FeaturedTemplate SET id = 1, template = '%s', story_1_id = %s, story_2_id = %s, story_3_id = %s, story_4_id = %s, story_5_id = %s, story_6_id = %s", $template, $story_1_id, $story_2_id, $story_3_id, $story_4_id, $story_5_id, $story_6_id); $db->query($sql); $db->query("UPDATE Content set isFeatured = 1 WHERE siteContentId IN ({$story_1_id}, {$story_2_id}, {$story_3_id}, {$story_4_id}, {$story_5_id}, {$story_6_id})"); // clear out the cache of the home top stories require_once PATH_CORE . '/classes/template.class.php'; $templateObj = new template($db); $templateObj->resetCache('home_feature');
<?php require_once PATH_CORE . '/classes/db.class.php'; $db = new cloudDatabase(); $results = $db->query("SELECT SQL_CALC_FOUND_ROWS Content.*,ContentImages.url as imageUrl,UserInfo.fbId FROM Content LEFT JOIN UserInfo ON Content.postedById = UserInfo.userid LEFT JOIN ContentImages ON (Content.siteContentId=ContentImages.siteContentId) ORDER BY Content.date DESC LIMIT 20"); $stories = array(); $story_ids = array(); while ($row = mysql_fetch_assoc($results)) { $stories[] = $row; } ?> <div class="stories" style="border: 1px solid black;"> <?php foreach ($stories as $story) { ?> <?php $story_id = "story_" . $story['siteContentId']; $story_ids[] = "'{$story_id}'"; ?> <div class="story" id="<?php echo $story_id; ?> " style="border: 1px solid black; margin: 10px; padding: 10px;"> <?php if ($story['imageUrl'] != '') { ?> <img alt="story image" style="max-width:100px;max-height:100px;" src="<?php echo $story['imageUrl']; ?> "/> <?php
$string = preg_replace('/[\\-]{2,}/', ' ', $string); return $string; } if (isset($_GET['id']) && preg_match('/^story_([0-9]+)$/i', $_GET['id'], $matches)) { $id = $matches[1]; } else { $id = ''; } if (isset($_GET['dropElId'])) { $dropElId = $_GET['dropElId']; } else { $dropElId = ''; } $type = preg_replace('/.*?-image-(mini|blurb)$/', '\\1', $dropElId); if ($id != '') { $story = mysql_fetch_assoc($db->query("SELECT Content.*,ContentImages.url as imageUrl FROM Content LEFT JOIN ContentImages ON (Content.siteContentId=ContentImages.siteContentId) WHERE Content.siteContentId = {$id}")); } else { return false; } //$story['caption'] = cleanDirty($story['caption']); $story['caption'] = htmlentities($story['caption'], ENT_QUOTES); $story['title'] = htmlentities($story['title'], ENT_QUOTES); echo "<?xml version=\"1.0\" ?>"; ?> <story> <?php if ($type == 'mini') { ?> <image><?php echo htmlentities("<img src=\"{$story['imageUrl']}\" />"); // {URL_BASE}/index.php?p=scaleImg&id={$story['imageid']}&x=40&y=30&fixed=x&crop
} $where = ''; if ($timeframe != '') { $where = "WHERE {$timeframe}"; } if ($type == 'actions') { $sql = "SELECT * FROM Log {$where}"; } else { if ($type == 'sessions') { $sql = "SELECT * FROM Log WHERE action = 'sessionsHour' AND t LIKE '" . date("Y-m-d", time()) . "%'"; } else { $sql = "SELECT *, (SELECT count(1) FROM User WHERE isMember = 1) as numUsers, (SELECT count(1) FROM User WHERE isMember = 0) as numNonUsers, (SELECT count(1) FROM User WHERE eligibility = 'team') as numActionTeam FROM Log {$where}"; } } //echo "<h1>SQL: $sql</h1>"; $results = $db->query($sql); $stats = array(); while ($row = mysql_fetch_assoc($results)) { $stats[] = $row; } //$actionTypes = array('vote','comment','readStory','readWire','invite','postStory','publishWire','publishStory','shareStory','referReader','postTwitter','signup','acceptedInvite','redeemed','wonPrize','completedChallenge','addedWidget','addedFeedHeadlines','friendSignup','addBookmarkTool','levelIncrease'); if ($type == 'actions') { $actionTypes = array('vote' => 'numVotes', 'comment' => 'numComments', 'shareStory' => 'numSharedStories', 'postStory' => 'numPostedStories', 'postBlog' => 'numPostedBlogs', 'publishStory' => 'numPublishedStories', 'readStory' => 'numReadStories', 'chatStory' => 'numChatStories', 'completedChallenge' => 'numCompletedChallenges'); $counts = array('numVotes' => 0, 'numComments' => 0, 'numSharedStories' => 0, 'numPostedStories' => 0, 'numPostedBlogs' => 0, 'numPublishedStories' => 0, 'numReadStories' => 0, 'numChatStories' => 0, 'numCompletedChallenges' => 0); } else { if ($type == 'sessions') { } else { if ($type == 'members') { $actionTypes = array('invite' => 'numInvites', 'signup' => 'numSignups', 'redeemed' => 'numPrizesRedeemed', 'acceptedInvite' => 'numAcceptedInvites'); $counts = array('numInvites' => 0, 'numSignups' => 0, 'numPrizesRedeemed' => 0, 'numAcceptedInvites' => 0, 'numTotalMembers' => 0, 'numTotalNonMembers' => 0, 'numActionTeamMembers' => 0); } else {