Marks a story as viewed.

@param string $id
The ID of the story.
@param int $screenshot_count
Amount of times screenshotted. Defaults to 0.

@return bool
TRUE if successful, FALSE otherwise.
428015
public function markStoryViewed($id, $screenshot_count = 0) {
		// Make sure we're logged in and have a valid access token.
		if (!$this->auth_token || !$this->username) {
			return FALSE;
		}

		// Mark story as viewed.
		$timestamp = parent::timestamp();
		$result = parent::post(
			'/update_stories',
			array(
				'friend_stories' => json_encode(array(
					array(
						'id' => $id,
						'screenshot_count' => $screenshot_count,
						'timestamp' => $timestamp,
					),
				)),
				'timestamp' => $timestamp,
				'username' => $this->username,
			),
			array(
				$this->auth_token,
				$timestamp,
			)
		);

		return is_null($result);
	}
329769
private function hasChild($rows, $id)
    {
        foreach ($rows as $row) {
            if ($row['parent_id'] == $id) {
                return true;
            }
        }

        return false;
    }
57182
protected function createScreenshot()
    {
        $image = imagecreatefromstring($this->webDriver->screenshotAsImage());
        if (false === $image) {
            throw new WebDriver_Exception("Invalid screenshot data");
        }
        return $image;
    }
1225987
public function read($ID)
    {
        $member = Member::currentUser();
        if (!$member) {
            return false;
        }

        if ($ID) {
            $notification = InternalNotification::get()
                ->filter([
                    'ID' => $ID,
                    'ToID' => $member->ID,
                    'IsRead' => false
                ])->first();
            if ($notification) {
                $notification->IsRead = true;
                $notification->write();
                return true;
            }
        }
        return false;
    }
680392
public function runSingleApiCallAction($id)
        {


            $sLico = SystemSettings::get("lico");
            $iLvdc = SystemSettings::get("lvdc");

            if ($iLvdc < strtotime("-7 days")) {
                $aRemoteApps = RemoteAppQuery::create()->filterByWebsiteHash(null, \Criteria::ISNOTNULL);
                $lico        = $sLico . "/api/lvdc/" . base64_encode($this->_getSiteURL()) . "/" . $aRemoteApps->count();
                try {
                    $res = @file_get_contents($lico);
                    if ($res === false) {
                        throw new \Exception($this->get("translator")->trans("license.update.failed_lico"));
                    }
                    $oResult = json_decode($res);

                    if ($oResult->valid !== true) {
                        $aResponse = array(
                            "error"   => true,
                            "message" => $oResult->message
                        );
                    } else {
                        SystemSettings::set("lvdc", time());
                    }

                } catch (\Exception $e) {
                    $aResponse = array(
                        "error"   => true,
                        "message" => $e->getMessage()
                    );
                }
            }


            try {

                if (!isset($aResponse)) {
                    $command = new ApiCommand();
                    $command->setContainer($this->container);
                    $input  = new ArgvInput(array(
                                                'control:remote:cron',
                                                '--app=' . $id,
                                                '--force'
                                            ));


                    $output = new BufferedOutput();
                    // Run the command
                    $retval     = $command->run($input, $output);
                    $oRemoteApp = RemoteAppQuery::create()->findOneById($id);
                    $sJsonData  = $this->renderView('SlashworksAppBundle:RemoteApp:data.json.twig', array('entities' => array($oRemoteApp)));
                    $aData      = json_decode($sJsonData, true);

                    $sReturn = $output->fetch();
                    $aReturn = json_decode($sReturn, true);

                    if($aReturn !== false){
                        if(is_array($aReturn)){
                            if($aReturn['status'] === false) {
                                $this->get('logger')->error($aReturn['message'], array("Method" => __METHOD__, "RemoteApp" => $oRemoteApp->getName(), "RemoteURL" => $oRemoteApp->getFullApiUrl()));
                                $aResponse = $aReturn;
                            }elseif($aReturn['status'] === true) {
                                $this->get('logger')->info("Api-Call successful", array("Method" => __METHOD__, "RemoteApp" => $oRemoteApp->getName()));
                                $aResponse = $aData;
                            } else {
                                $this->get('logger')->error("Unknown error in ".__FILE__." on line ".__LINE__, array("Method" => __METHOD__, "RemoteApp" => $oRemoteApp->getName(), "RemoteURL" => $oRemoteApp->getFullApiUrl()));
                                $aResponse = array("error" => true);
                            }
                        }
                    }else {

                        if (!$retval) {
                            $this->get('logger')->info("Api-Call successful", array("Method" => __METHOD__, "RemoteApp" => $oRemoteApp->getName()));
                            $aResponse = $aData;
                        } else {
                            $this->get('logger')->error("Unknown error in ".__FILE__." on line ".__LINE__, array("Method" => __METHOD__, "RemoteApp" => $oRemoteApp->getName(), "RemoteURL" => $oRemoteApp->getFullApiUrl()));
                            $aResponse = array("error" => true);
                        }
                    }
                }
            } catch (\Exception $e) {
                $this->get('logger')->error($e->getMessage());
                $aResponse = array(
                    "error"   => true,
                    "message" => $e->getMessage()
                );
            }

            $response = new Response(json_encode($aResponse));
            $response->headers->set('Content-Type', 'application/json');

            return $response;
        }
520757
function(id) {
		if (this.current_id != id) {
			this.current_id = id;
			this._timenav.goToId(this.current_id);
			this._storyslider.goToId(this.current_id, false, true);
			this.fire("change", {unique_id: this.current_id}, this);
		}
	}
958189
public function onceUsingId( $id )
	{
		$acct = $this->auth->retrieveById( $id );

		if ( !is_null( $acct ) )
		{
			$this->setAcct( $acct );

			return true;
		}

		return false;
	}
820282
public View getView(int id){
		if(config.commandLogging){
			Log.d(config.commandLoggingTag, "getView("+id+")");
		}
		
		return getView(id, 0);
	}
460892
public function handleShowViewer(int $id): void
	{
		if ($this->request->isAjax()) {
			$this->template->viewImage = $this->getStorage()->get($id);

			$this->redrawControl('viewer');
		} else {
			throw new AbortException;
		}
	}
120766
public function postComment($id)
    {
        $text = isset($_POST["text"]) ? $_POST["text"] : "nothingfound";

        if ($text == "nothingfound") {
            return false;
        }
        $user = $this->di->get("session")->get("user");
        $comment = new Comment($this->di->get("db"));
        $comment->text = $text;
        $comment->parentId = $id;
        $comment->user = $user;
        $comment->save();
        return true;
    }
1260384
public static function template_viewed($id) {
        $params = self::validate_parameters(self::view_book_parameters(), array(
            'id' => $id
        ));

        $template = api::read_template($params['id']);
        self::validate_context($template->get_context());

        return api::template_viewed($params['id']);
    }
323706
public function markJobFailed($id, $message = null)
    {
        $entity = $this->get($id);
        $data = ['completed' => false, 'stats' => ['tries' => ($entity->stats['tries'] + 1), 'message' => $entity->stats['message'] . ($entity->stats['tries'] + 1) . '. ' . $message . PHP_EOL]];
        $this->patchEntity($entity, $data, ['validate' => false]);
        return $this->save($entity);
    }
231521
public function websitesCount($id)
    {
        // I know eloquent does this, but having trouble so hand crafting using DB
        $record =  DB::table('websites')->where('website_type_id', '=', $id)->get();
        return count($record);
    }
949683
public function checkPreviousToken($id, $text = false) {
		$token = $this->peekPrvsToken();
		return $this->checkToken($token, $id, $text);
	}
545835
public function markJobDone($id)
    {
        $entity = $this->get($id);
        $data = ['completed' => true, 'stats' => ['tries' => ($entity->stats['tries'] + 1), 'message' => $entity->stats['message'] . ($entity->stats['tries'] + 1) . '. ' . 'Success!' . PHP_EOL]];
        $this->patchEntity($entity, $data, ['validate' => false]);
        return $this->save($entity);
    }
164822
public final function get_record_snapshot($tablename, $id) {
        global $DB;

        if ($this->restored) {
            throw new \coding_exception('It is not possible to get snapshots from restored events');
        }

        if (isset($this->recordsnapshots[$tablename][$id])) {
            return clone($this->recordsnapshots[$tablename][$id]);
        }

        $record = $DB->get_record($tablename, array('id'=>$id));
        $this->recordsnapshots[$tablename][$id] = $record;

        return $record;
    }
286750
public function has($id)
    {
        if (!$this->count()) {
            return false;
        }

        $tempFiles = $this->session->get('mediamanager.temp_files');

        return isset($tempFiles[$id]);
    }