Skip to content

Commit

Permalink
Updated comments [#5 state:resolved]
Browse files Browse the repository at this point in the history
  • Loading branch information
leveille committed Jan 30, 2009
1 parent 7e96c98 commit 2631c61
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 63 deletions.
112 changes: 58 additions & 54 deletions smc/core/libraries/Block.php
Expand Up @@ -23,11 +23,11 @@ function __construct()
$this->_sanitize = new Sanitize();
}

/***
DESCRIPTION: Creates a content block
@data (string), @desc (string)
POST: A content block is created
***/
/**
* Creates a content block
* @param string $data
* @param string $desc
*/
public function create($data, $desc)
{
$this->_db = Database::connect();
Expand Down Expand Up @@ -57,12 +57,12 @@ public function create($data, $desc)
}
}

/***
DESCRIPTION: Grabs data for a content block and wraps it in a _wrapper
@id (int)
POST: data is wrapped and returned in _wrapper
***/
public function get($id = int)
/**
* Grabs data for a content block and wraps it in a _wrapper
* @return block content
* @param string $id
*/
public function get($id)
{
$cache = new Cache();
if(Cache::isEnabled()) {
Expand Down Expand Up @@ -102,11 +102,12 @@ public function get($id = int)
return $content;
}

/***
DESCRIPTION: Grabs raw content block from the database for an id
@id (int)
***/
public function getUnwrapped($id = int)
/**
* Grabs raw content block from the database for an id
* @return Block content
* @param object $id
*/
public function getUnwrapped($id)
{
$cache = new Cache();
if(Cache::isEnabled()) {
Expand Down Expand Up @@ -141,10 +142,10 @@ public function getUnwrapped($id = int)
return $this->_sanitize->filter($data['block']);
}

/***
DESCRIPTION: grabs all content blocks
POST: Returns the result set as encoded json
***/
/**
* grabs all content blocks
* @return json_encoded content blocks
*/
public function getContentBlocks()
{
$this->_db = Database::connect();
Expand Down Expand Up @@ -177,12 +178,13 @@ public function getContentBlocks()
return '{"results":' . json_encode($arr) . '}';
}

/***
DESCRIPTION: updates content of a content block
@id (int), @content (string), @description (string)
POST: content block is updated w/ new content
***/
public function blockUpdate($id = int, $content, $description)
/**
* updates content of a content block
* @param string $id
* @param string $content
* @param string $description
*/
public function blockUpdate($id, $content, $description)
{
$this->_db = Database::connect();
$clean = array();
Expand Down Expand Up @@ -210,12 +212,13 @@ public function blockUpdate($id = int, $content, $description)
}
}

/***
DESCRIPTION: updates content of a content block
@id (int), @content (string), @description (string)
POST: content block is updated w/ new content
***/
public function blockUpdateAll($id = int, $content, $description)
/**
* updates content of a content block
* @param string $id
* @param string $content
* @param string $description
*/
public function blockUpdateAll($id, $content, $description)
{
$this->_db = Database::connect();
$clean = array();
Expand Down Expand Up @@ -244,12 +247,11 @@ public function blockUpdateAll($id = int, $content, $description)
}
}

/***
DESCRIPTION: deletes a content block
@id (int)
POST: content block is removed
***/
public function blockDelete($id = int)
/**
* deletes a content block
* @param string $id
*/
public function blockDelete($id)
{
$this->_db = Database::connect();
$clean = array();
Expand All @@ -267,13 +269,15 @@ public function blockDelete($id = int)
$cache->delete($clean['id']);
}
}

/***
DESCRIPTION: creates an editable wrapper for content blocks
@id (int), @data (string), @description (string)
POST: Query data is returned with 0 or more records
***/
private function _wrapper($id = int, $data, $description)

/**
* creates an editable wrapper for content blocks
* @return content block
* @param string $id
* @param string $data
* @param string $description
*/
private function _wrapper($id, $data, $description)
{
if($this->_isAdmin() || $this->_isEditor()) {
return sprintf('<div id="%s" class="editable" title="%s">%s</div>', $id, $description, $data);
Expand All @@ -282,19 +286,19 @@ private function _wrapper($id = int, $data, $description)
}
}

/***
DESCRIPTION: checks to see if user is admin
POST: Returns true or false
***/
/**
* checks to see if user is admin
* @return bool
*/
private function _isAdmin()
{
return (isset($_SESSION['isAdmin']) && $_SESSION['isAdmin'] == true);
}
/***
DESCRIPTION: checks to see if user is an editor
POST: Returns true or false
***/

/**
* checks to see if user is an editor
* @return bool
*/
private function _isEditor()
{
return (isset($_SESSION['isEditor']) && $_SESSION['isEditor'] == true);
Expand Down
18 changes: 9 additions & 9 deletions smc/core/libraries/Login.php
Expand Up @@ -17,11 +17,12 @@ class Login
{
private $_db;

/***
DESCRIPTION: validates a username and password for login
PRE: string alphanum username and password
POST: Query data is returned with 0 or more records
***/
/**
* tries to fetch a queryset based on username/password
* @return queryset object
* @param string $username
* @param string $password
*/
public function validate($username, $password)
{
$this->_db = Database::connect();
Expand Down Expand Up @@ -51,10 +52,9 @@ public function validate($username, $password)
return $data;
}

/***
DESCRIPTION: logout
POST: Terminates session
***/
/**
* logout
*/
public function logout()
{
$_SESSION = array();
Expand Down

0 comments on commit 2631c61

Please sign in to comment.