function auto_share($userid, $quizid, $badge = FALSE, $badge_name = FALSE) { $auth = $this->auth($userid); $row1 = $this->db->query("SELECT point, amount FROM score WHERE user_id='{$userid}' AND quiz_id='{$quizid}' LIMIT 1")->row(); $row2 = $this->db->query("SELECT share_created, share_took, share_onehundred, share_badge FROM user WHERE username='******' LIMIT 1")->row(); $send = FALSE; if ($badge == FALSE) { if ($row1->point > $row1->amount && $row2->share_created == 1) { $tweet = 'I just created the quiz \'' . get_title($quizid, FALSE) . '\' on @OneExtraLap! Come & take it! ' . get_quiz_link($quizid); $send = TRUE; } if ($row1->point == $row1->amount && $row2->share_onehundred == 1) { $tweet = 'I just got 100% in the quiz \'' . get_title($quizid, FALSE) . '\' on @OneExtraLap! You can do it too! ' . get_quiz_link($quizid); $send = TRUE; } elseif ($row1->point <= $row1->amount && $row2->share_took == 1) { $tweet = 'I just got ' . get_percentage($row1->point, $row1->amount) . ' in the quiz \'' . get_title($quizid, FALSE) . '\' on @OneExtraLap! Can you beat me? ' . get_quiz_link($quizid); $send = TRUE; } } else { if ($row2->share_badge == 1) { $badge_info = get_badge($badge); $tweet = 'I just unlocked the badge \'' . $badge_name . '\' on @OneExtraLap! http://oneextralap.com/badges/' . $badge; $send = TRUE; } } if ($send == TRUE) { $this->twitter->call('statuses/update', array('status' => trim($tweet))); return TRUE; } return FALSE; }
echo get_quiz_link($quizid); ?> " target="_blank">Facebook</a> | <a href="mailto:?subject=Check out this awesome quiz on OneExtraLap: <?php echo $title; ?> &body=Go ahead and take the quiz if you can! <?php echo get_quiz_link($quizid); ?> (PS: OneExtraLap is a social quizzing website, and it is pretty addictive!)">Email</a> </div> <div class="clear"></div> <div class="left">Link</div> <div class="right"> <input type="text" value="<?php echo get_quiz_link($quizid); ?> " class="quizlink" onclick="this.select()" /> </div> <div class="clear"></div> <?php if ($this->config->item('enable_tag') !== FALSE && $tag != FALSE) { ?> <div class="left">Tags</div> <div class="right"> <?php $tag_number = 1; foreach ($tag->result() as $row) { if ($tag_number != 1) { echo ','; }