@@ -57,14 +57,16 @@

/**
* @author Dmitri Snytkine
* @todo handle various MongoExceptions by wrapping
* methods in try/catch blocks and add logging
* to log errors
* @todo handle various MongoExceptions by wrapping
* methods in try/catch blocks and add logging
* to log errors
*/
class Mongo implements \Lampcms\Interfaces\Cache
{

/**
* Mongo object
*
* @var object of type \Mongo (php's \Mongo class, NOT Lampcms Mongo)
*/
protected $Mongo;
@@ -103,7 +105,7 @@ class Mongo implements \Lampcms\Interfaces\Cache

public static function factory(Registry $Registry)
{
$Ini = $Registry->Ini;
$Ini = $Registry->Ini;
$aConfig = $Ini->getSection('CACHE_MONGO');
d('cp');
$Mongo = $Registry->Mongo->getMongo();
@@ -117,16 +119,19 @@ public static function factory(Registry $Registry)
/**
* Constructor
*
* @param string $server connection string
* (may contain username/password)
* like this:
* @param \Lampcms\Cache\Mongo|\Mongo $Mongo $Mongo
* @param string $db name of database
*
* @param string $db name of database
* @param string $collection name of collection
*
* @param string $collection name of collection
* @param null $nameSpace
* @param bool $compress is true then will store values compressed with gzip
* to save space (extra processing overhead will be incured to compress/uncompress)
*
* @param bool $compress is true then will store values compressed with gzip
* to save space (extra processing overhead will be incured to compress/uncompress)
* @throws \LogicException
* @internal param string $server connection string
* (may contain username/password)
* like this:
*/
public function __construct(\Mongo $Mongo, $db, $collection, $nameSpace = null, $compress = false)
{
@@ -145,7 +150,7 @@ public function __construct(\Mongo $Mongo, $db, $collection, $nameSpace = null,
$this->bCompress = (bool)$compress;
}

$this->Mongo = $Mongo;
$this->Mongo = $Mongo;
$this->_collection = $Mongo->selectCollection($db, $collection); //$this->_db->selectCollection($collection);
$this->_collection->ensureIndex(array('tags' => 1));
}
@@ -154,7 +159,9 @@ public function __construct(\Mongo $Mongo, $db, $collection, $nameSpace = null,
/**
* Test if a cache is available or not (for the given id)
*
* @param string $id Cache id
* @param $key
*
* @internal param string $id Cache id
* @return mixed|false (a cache is not available) or "last modified" timestamp (int) of the available cache record
*/
public function test($key)
@@ -172,8 +179,11 @@ public function test($key)
/**
* Remove a cache record
*
* @param string $id Cache id
* @return boolean True if no problem
* @param string $key
* @param int $exp
*
* @internal param string $id Cache id
* @return bool|void True if no problem
*/
public function delete($key, $exp = 0)
{
@@ -202,9 +212,9 @@ public function delete($key, $exp = 0)


/**
* Maintainance function to remove expired entries
* Maintenance function to remove expired entries
* This should be run from special script
* that instatiates this object and calls
* that instantiates this object and calls
* this method periodically via cron
*
*/
@@ -222,7 +232,7 @@ public function clean()
public function getIds()
{
$cursor = $this->_collection->find();
$ret = array();
$ret = array();
while ($tmp = $cursor->getNext()) {
$ret[] = $tmp['_id'];
}
@@ -245,15 +255,17 @@ public function flush()


/**
* Return an array of everying
* Return an array of everything
* that is stored under this key, not just the value
* but also the extra fields
* 'created' and 'exp' (expiration)
* the actual data is in the 'd' key
*
* @param string $id cache id
* @param $key
*
* @internal param string $id cache id
* @return mixed null if not found
* or array
* or array
*/
public function getRawData($key)
{
@@ -265,11 +277,16 @@ public function getRawData($key)

/**
* Set item into cache
* @param string $key cache key
* @param mixed $value array|string|object|int|bool
* @param int $ttl expiration time either as unix timestamp
* or numer of seconds, in case of number of seconds, it cannot
* be > 2592000 (30 days)
*
* @param string $key cache key
* @param mixed $value array|string|object|int|bool
* @param int $ttl expiration time either as unix timestamp
* or number of seconds, in case of number of seconds, it cannot
* be > 2592000 (30 days)
* @param array|null $tags
*
* @throws \InvalidArgumentException
* @return array result of calling MongoCollection->save()
*/
public function set($key, $value, $ttl = 0, array $tags = null)
{
@@ -279,8 +296,8 @@ public function set($key, $value, $ttl = 0, array $tags = null)
throw new \InvalidArgumentException('Cannot set resource into cache. Only serializable object, array, string, int, double or bool can be set as value');
}

$ttl = (int)$ttl;
$now = time();
$ttl = (int)$ttl;
$now = time();
$isSerialized = false;

/**
@@ -315,13 +332,13 @@ public function set($key, $value, $ttl = 0, array $tags = null)
throw new \InvalidArgumentException($err);
}

$value = serialize($value);
$value = serialize($value);
$isSerialized = true;
d('serialized object: ' . $value);

} elseif ($this->bCompress && is_array($value)) {

$value = \serialize($value);
$value = \serialize($value);
$isSerialized = true;
}

@@ -335,10 +352,10 @@ public function set($key, $value, $ttl = 0, array $tags = null)
}

d('cp');
$aData = array('_id' => $this->nameSpace . $key,
'd' => $data,
'created' => $now,
'exp' => $exp);
$aData = array('_id' => $this->nameSpace . $key,
'd' => $data,
'created' => $now,
'exp' => $exp);

d('aData: ' . print_r($aData, true));
if ($isSerialized) {
@@ -362,8 +379,8 @@ public function set($key, $value, $ttl = 0, array $tags = null)
* Add item to cache but only if it does not already exist
*
* @param string $key
* @param mixed $value
* @param int $ttl
* @param mixed $value
* @param int $ttl
*/
public function add($key, $value, $ttl = 0)
{
@@ -387,7 +404,7 @@ public function setMulti(array $aItems, $ttl = 0)
*
* @return mixed string | false if data with this key does not exist
* If value is found but is expired, then the item is removed from cache
* as a way to do mainainance without relying on cron job
* as a way to do maintenance without relying on cron job
* and false is returned
*/
public function get($key)
@@ -396,13 +413,15 @@ public function get($key)
d('looking for key: ' . $key);
d('in collection: ' . $this->_collection->getName() . ' in DB: ' . $this->_collection->db);
$ret = $this->_collection->findOne(array('_id' => $key));
d('ret: ' . print_r($ret, 1));

if (empty($ret)) {
d('not found ' . $key);

return false;
}

d('found result in cache');

return $this->getData($ret);
}

@@ -414,13 +433,16 @@ public function get($key)
* MongoDB find() functions which is just one call to mongo
* vs multiple findOne() calls
* should be a bit faster
*
* @param array $aKeys
*
* @return array array of found key=>value pairs
*/
public function getMulti(array $aKeys)
{
/**
* Prepend namespace to every key
*
* @var unknown_type
*/
$a = array();
@@ -451,7 +473,7 @@ public function getMulti(array $aKeys)
* have the same name of keys as
* in the original array
*/
$key = substr($tmp['_id'], $len);
$key = substr($tmp['_id'], $len);
$ret[$key] = $data;
}
}
@@ -464,6 +486,7 @@ public function getMulti(array $aKeys)

/**
* Decode the value and return it
*
* @param array $a
* array represents one Mongo Document (one row)
*
@@ -473,7 +496,7 @@ public function getMulti(array $aKeys)
* is immediately deleted from Mongo collection
*
* If found and not expired then the data is returned.
* If data is determied to be in gzipped format, it is
* If data is determined to be in gzipped format, it is
* uncompressed before it is returned
*/
protected function getData(array $a)
@@ -512,9 +535,10 @@ protected function getData(array $a)
/**
* Increment numeric value of $key
*
* @param $key
* @param $int
* @return unknown_type
* @param $key
* @param int $int
*
* @return bool true
*/
public function increment($key, $int = 1)
{
@@ -531,8 +555,11 @@ public function increment($key, $int = 1)

/**
* Decrement numeric value of $key
*
* @param string $key
* @param int $int
* @param int $int
*
* @return bool
*/
public function decrement($key, $int = 1)
{
@@ -58,8 +58,6 @@
class Activate extends WebPage
{

protected $aRequired = array('eid', 'hash');

/**
* Object of type User
* representing the user whose account is being activated
@@ -66,7 +66,7 @@ class Loginlinkedin extends WebPage
//,location:(name) cannot be used together with locationlocation:(country:(code)) it generates duplicate field exception
const PROFILE_URL = 'http://api.linkedin.com/v1/people/~:(id,first-name,last-name,industry,picture-url,public-profile-url,location,summary,interests,date-of-birth,twitter-accounts,phone-numbers,skills,im-accounts,educations,certifications,languages)';

protected $callback = '/index.php?a=loginlinkedin';
protected $callback = '{_WEB_ROOT_}/{_loginlinkedin_}';

/**
* Array of Tumblr's
@@ -128,8 +128,12 @@ class Loginlinkedin extends WebPage
protected function main()
{

$routerCallback = $this->Registry->Router->getCallback();
$this->callback = $routerCallback($this->callback);
d('$this->callback'. $this->callback);

if (!extension_loaded('oauth')) {
throw new \Exception('Unable to use Tumblr API because OAuth extension is not available');
throw new \Exception('Unable to use LinkedIn API because OAuth extension is not available');
}

/**
@@ -159,7 +163,7 @@ protected function main()
} catch (\OAuthException $e) {
e('OAuthException: ' . $e->getMessage());

throw new \Exception('Something went wrong during authorization. Please try again later' . $e->getMessage());
throw new \Exception('@@Something went wrong during authorization. Please try again later@@' . $e->getMessage());
}


@@ -169,12 +173,7 @@ protected function main()
* in session and redirect to linkedin authorization page
*/
if (empty($_SESSION['linkedin_oauth']) || empty($this->Request['oauth_token'])) {
/**
* Currently Tumblr does not handle "Deny" response of user
* too well - they just redirect back to this url
* without any clue that user declined to authorize
* our application.
*/

$this->step1();
} else {
$this->step2();
@@ -184,12 +183,11 @@ protected function main()

/**
* Generate oAuth request token
* and redirect to linkedin for authentication
*
* @return object $this
* and redirect to Linkedin for authentication
*
* @throws Exception in case something goes wrong during
* @throws \Exception in case something goes wrong during
* this stage
* @return \Lampcms\Controllers\object $this
*/
protected function step1()
{
@@ -237,9 +235,9 @@ protected function step1()
* Step 2 in oAuth process
* this is when linkedin redirected the user back
* to our callback url, which calls this controller
* @return object $this
*
* @throws Exception in case something goes wrong with oAuth class
* @throws \Exception in case something goes wrong with oAuth class
* @return \Lampcms\Controllers\object $this
*/
protected function step2()
{
@@ -295,9 +293,9 @@ protected function step2()
$this->closeWindow();

} catch (\OAuthException $e) {
e('OAuthException: ' . $e->getMessage() . ' ' . print_r($e, 1));
e('OAuthException: ' . $e->getMessage());

$err = 'Something went wrong during authorization. Please try again later' . $e->getMessage();
$err = '@@Something went wrong during authorization. Please try again later@@' . $e->getMessage();
throw new \Exception($err);
}

@@ -385,7 +383,7 @@ protected function createNewUser()
/**
* This will mark this userobject is new user
* and will be persistent for the duration of this session ONLY
* This way we can know it's a newsly registered user
* This way we can know it's a newly registered user
* and ask the user to provide email address but only
* during the same session
*/
@@ -406,12 +404,14 @@ protected function createNewUser()
* Parses the XML returned from LinkedIn API
* and creates array of $this->aData from it
*
* @param string xml xml string received from LinkedIn API
*
* @return object $this
* @param $xml
*
* @throws \Lampcms\DevException
* @throws \Lampcms\Exception if xml could not
* be parsed for any reason
* be parsed for any reason
* @internal param \Lampcms\Controllers\xml $string xml string received from LinkedIn API
*
* @return \Lampcms\Controllers\object $this
*/
protected function parseXML($xml)
{
@@ -479,7 +479,7 @@ protected function parseXML($xml)
* Adds data from LinkedIn API, including
* oauth token, secret to the
* User object
* avatar from LinkedIn, Contry Code, City
* avatar from LinkedIn, Country Code, City
* and 'about' are added ONLY if they
* don't already exist in User
*
@@ -517,7 +517,7 @@ protected function updateUser()

/**
* Update the following field ONLY
* if they DONT already exists in this user's record!
* if they DON'T already exists in this user's record!
*
* This means that if record exists and is an empty
* string - don't update this because it usually means
@@ -585,7 +585,9 @@ protected function getUserByLinkedInId($lid)
/**
* Return html that contains JS window.close code and nothing else
*
* @return unknown_type
* @param array $a
*
* @return \Lampcms\Controllers\unknown_type
*/
protected function closeWindow(array $a = array())
{
@@ -655,7 +657,7 @@ protected function redirectToSite($url)
setTimeout(myredirect, 300);
' .
Responder::JS_CLOSE .
'<div class="centered"><a href="' . $url . '">If you are not redirected in 2 seconds, click here to authenticate with linkedin</a></div>' .
'<div class="centered"><a href="' . $url . '">@@If you are not redirected in 2 seconds, click here to authenticate with LinkedIn@@</a></div>' .
Responder::PAGE_CLOSE;

d('exiting with this $s: ' . $s);
@@ -75,7 +75,9 @@ class Register extends WebPage
{
protected $permission = 'register';


/**
* @todo translate string
*/
const EMAIL_BODY = 'Welcome to %1$s!
IMPORTANT: You Must use the link below to activate your account
@@ -324,7 +326,11 @@ protected function createEmailRecord()
*/
protected function makeActivationLink()
{
$tpl = $this->Registry->Ini->SITE_URL . '/aa/%d/%s';
$routerCallback = $this->Registry->Router->getCallback();
$uri = $routerCallback('{_WEB_ROOT_}/{_activate_}');
d('uri: '.$uri);

$tpl = $this->Registry->Ini->SITE_URL . $uri.'/%d/%s';
$link = \sprintf($tpl, $this->oEmail['_id'], $this->oEmail['code']);
d('activation link: ' . $link);

@@ -336,7 +342,7 @@ protected function sendActivationEmail()
{
$sActivationLink = $this->makeActivationLink();
$siteName = $this->Registry->Ini->SITE_NAME;
$body = vsprintf(self::EMAIL_BODY, array($siteName, $this->username, $this->pwd, $sActivationLink));
$body = \vsprintf(self::EMAIL_BODY, array($siteName, $this->username, $this->pwd, $sActivationLink));
$subject = sprintf(self::SUBJECT, $this->Registry->Ini->SITE_NAME);

$this->Registry->Mailer->mail($this->email, $subject, $body);
@@ -54,18 +54,21 @@
use Lampcms\WebPage;
use Lampcms\String;

//use Lampcms\Mailer;

/**
* Class responsible for
* displaying the forgot password
* form, processing the form,
* generating a new ramdom password
* generating a new random password
* for user
* and emailing it to user
*/
class Remindpwd extends WebPage
{

/**
* @todo translate string
*/
const EMAIL_BODY = 'Hi there, %1$s
You have requested to reset your password on %2$s because you have forgotten your password.
@@ -147,10 +150,10 @@ class Remindpwd extends WebPage


/**
* Remders and processes the form
* Renders and processes the form
*
* @return string page with html form
* @param array $arrParams array of GET or POST params
* @internal param array $arrParams array of GET or POST params
*/
protected function main()
{
@@ -181,9 +184,8 @@ protected function main()
* If user exists, set the $this->forgottenUid
* to the value of this user's id
*
* @throws \Lampcms\Exception
* @return bool true if user found, otherwise false
* and in case of false also sets form errors
* so that user will see the form with errors
*/
protected function validateUser()
{
@@ -231,7 +233,7 @@ protected function validateUser()
* Actually maybe it's better if user could just login
* then edit profile and become regular user...
*
* But how would we do that? We would bacially activate
* But how would we do that? We would basically activate
* a user on first login.
*/
d('$aResult: ' . \print_r($aResult, 1));
@@ -244,7 +246,7 @@ protected function validateUser()
*/

if (empty($aResult['email'])) {
throw new \Lampcms\Exception('This is an external account and you have not provided a valid email address for it');
throw new \Lampcms\Exception('@@This is an external account and you have not provided a valid email address for it@@');
}

/**
@@ -267,10 +269,8 @@ protected function validateUser()
* It checks to make sure this string does not already exist
* in the PASSWORD_CHANGE table
*
* @return object $this
*
* @throws LampcmsException in case a unique string
* could not be generated
* @throws \Lampcms\Exception
* @return \Lampcms\Controllers\object $this
*/
protected function generateCode()
{
@@ -305,7 +305,7 @@ protected function generateCode()
} while (!$done && ($counter < 50));

if (!$done) {
throw new \Lampcms\Exception('Error: Unable to generate random string at this time, please try again in 30 seconds');
throw new \Lampcms\Exception('@@Unable to generate random string at this time, please try again in 30 seconds@@');
}

$this->randomString = $aData['_id'];
@@ -318,18 +318,20 @@ protected function generateCode()
* Prepares the body, subject and from
* and email to user
*
* @todo translate strings instead of using constants
* of this class
*
* @return object $this
*/
protected function emailCode()
{
$link = $this->Registry->Ini->SITE_URL . '/index.php?a=resetpwd&uid=' . $this->uid . '&r=' . $this->randomString;
$body = vsprintf(self::EMAIL_BODY, array($this->login, $this->Registry->Ini->SITE_NAME, $link));
$subject = sprintf(self::SUBJECT, $this->Registry->Ini->SITE_NAME);
$routerCallback = $this->Registry->Router->getCallback();
$uri = $routerCallback('{_WEB_ROOT_}/{_resetpwd_}');
d('uri: '.$uri);

$link = $this->Registry->Ini->SITE_URL . $uri.'/' . $this->uid . '/' . $this->randomString;
$body = \vsprintf(self::EMAIL_BODY, array($this->login, $this->Registry->Ini->SITE_NAME, $link));
$subject = \sprintf(self::SUBJECT, $this->Registry->Ini->SITE_NAME);

//Mailer::factory($this->Registry)->mail($this->emailAddress, $subject, $body);
$this->Registry->Mailer->mail($this->emailAddress, $subject, $body);

return $this;
@@ -81,7 +81,6 @@ class Resetpwd extends WebPage
You can also change your password after you log in.
';

protected $aRequired = array('uid', 'r');

protected $username;

@@ -108,7 +107,7 @@ protected function main()
->emailPwd();

$this->aPageVars['title'] = '@@Password reset@@';
$this->aPageVars['body'] = '<div class="frm1">' . sprintf(self::TPL_SUCCESS, $this->email) . '</div>';
$this->aPageVars['body'] = '<div class="frm1">' . \sprintf(self::TPL_SUCCESS, $this->email) . '</div>';
}


@@ -133,11 +132,12 @@ protected function generatePassword()
protected function savePassword()
{
d('$this->newPwd: ' . $this->newPwd);
$uid = $this->Router->getNumber(1);

$salted = String::hashPassword($this->newPwd);
$newdata = array('$set' => array("pwd" => $salted));
$newdata = array('$set' => array('pwd' => $salted));

$this->Registry->Mongo->USERS->update(array('_id' => (int)$this->Request['uid']), $newdata);
$this->Registry->Mongo->USERS->update(array('_id' => (int)$uid), $newdata);

return $this;
}
@@ -166,13 +166,14 @@ protected function savePassword()
protected function validateCode()
{
$timeOffset = (time() - 86500);
$uid = (int)$this->Request['uid'];
$uid = $this->Router->getNumber(1); //(int)$this->Request['uid'];
$hash = $this->Router->getSegment(2);

$aResult = $this->Registry->Mongo->PASSWORD_CHANGE
->findOne(array('_id' => $this->Request['r'],
->findOne(array('_id' => $hash,
'i_uid' => $uid));

d('$aResult ' . print_r($aResult, true));
d('$aResult ' . \print_r($aResult, true));

if (empty($aResult)) {

@@ -218,8 +219,9 @@ protected function validateCode()
protected function markCodeUsed()
{
$newdata = array('$set' => array('i_used' => time()));
$hash = $this->Router->getSegment(2);

$this->Registry->Mongo->PASSWORD_CHANGE->update(array('_id' => $this->Request['r']), $newdata);
$this->Registry->Mongo->PASSWORD_CHANGE->update(array('_id' => $hash), $newdata);

return $this;
}
@@ -234,9 +236,10 @@ protected function markCodeUsed()
protected function saveFailedAttempt()
{
$ip = Request::getIP();
$uid = $this->Router->getNumber(1);

$aData = array(
'i_uid' => (int)$this->Request['uid'],
'i_uid' => (int)$uid,
'i_ts' => time());

$res = $this->saveResourceLocation('1', $ip, $aData, 'PASSWORD_CHANGE');
@@ -260,6 +263,7 @@ protected function checkHacks()
{
$ipHacks = 0;
$uidHacks = 0;
$uid = $this->Router->getNumber(1);

$timeOffset = time() - 86400;
$cur = $this->Registry->Mongo->PASSWORD_CHANGE->find(array('i_ts' > $timeOffset));
@@ -273,7 +277,7 @@ protected function checkHacks()
$ipHacks += 1;
}

if ($this->Request['uid'] == $aVal['i_uid']) {
if ($uid == $aVal['i_uid']) {
$uidHacks += 1;
}

@@ -95,7 +95,7 @@ class Viewqtags extends Viewquestions
* Select items according to conditions passed in GET
* Conditions can be == 'unanswered', 'hot', 'recent' (default)
*
* @return \Lampcms\Controllers\Viewqtags
* @return \Lampcms\Controllers\Viewqtags|\Lampcms\Controllers\Viewquestions
*/
protected function getCursor()
{
@@ -163,7 +163,7 @@ protected function getCursor()
* sense to process any further methods
*
* @see wwwViewquestions::sendCacheHeaders()
* @return \Lampcms\Controllers\Viewqtags
* @return \Lampcms\Controllers\Viewqtags|\Lampcms\Controllers\Viewquestions
*/
protected function sendCacheHeaders()
{
@@ -187,14 +187,14 @@ protected function sendCacheHeaders()
* (non-PHPdoc)
*
* @see Lampcms\Controllers.Viewquestions::makeCounterBlock()
* @return \Lampcms\Controllers\Viewqtags
* @return object $this
*/
protected function makeCounterBlock()
{

$text = '@@Unique Tags@@';

$description = 'A tag is a keyword or label that categorizes your question with other, similar questions. Using the right tags makes it easier for others to find and answer your question.';
$description = '@@A tag is a keyword or label that categorizes your question with other, similar questions. Using the right tags makes it easier for others to find and answer your question@@.';

$this->aPageVars['topRight'] = \tplCounterblock::parse(array($this->count, $text, $description), false);

@@ -137,7 +137,7 @@ protected function main()
->sendCacheHeaders();

$this->aPageVars['title'] = $this->title;
$this->aPageVars['description'] = $this->_('My cool site');
$this->aPageVars['description'] = '@@My Website@@';
$this->makeTopTabs()
->makeQlistHeader()
->makeCounterBlock()
@@ -301,12 +301,14 @@ protected function makeRecentTags()
{

$aUserTags = $this->Registry->Viewer['a_f_t'];
d('$aUserTags: '.print_r($aUserTags, 1));
if (!empty($aUserTags)) {
$s = $this->getSortedRecentTags($aUserTags);
} else {
$s = $this->Registry->Cache->get('qrecent');
}

d('recent tags: '.$s);
$tags = \tplBoxrecent::parse(array('tags' => $s,
'title' => '@@Recent Tags@@'));
d('cp');
@@ -459,17 +461,17 @@ protected function makeFollowedTags()
protected function getSortedRecentTags(array $aUserTags, $type = 'recent')
{

$limit = 30;
$limit = $this->Registry->Ini->MAX_RECENT_TAGS;
if ('unanswered' === $type) {
$cur = $this->Registry->Mongo->UNANSWERED_TAGS->find(array(), array('tag', 'i_count'))->sort(array('i_ts' => -1))->limit($limit);
} else {
$cur = $this->Registry->Mongo->QUESTION_TAGS->find(array('i_count' => array('$gt' => 0)), array('tag', 'i_count'))->sort(array('i_ts' => -1))->limit($limit);
}

d('got ' . $cur->count(true) . ' tag results');
$aTags = iterator_to_array($cur);
$aTags = \iterator_to_array($cur);

d('aTags: ' . print_r($aTags, 1));
d('aTags: ' . \print_r($aTags, 1));
/**
* $aTags now looks like array of
* elements like this one:
@@ -226,7 +226,7 @@ public static function formatException(\Exception $e, $message = '', \Lampcms\I1
* @todo if Tr was passed here
* then we can translate string
*/
$message = (true === LAMPCMS_DEBUG) ? $e->getMessage() : 'Error occurred. Administrator has been notified or the error. We will fix this as soon as possible'; //$oTr->get('generic_error', 'exceptions');
$message = (defined('LAMPCMS_DEBUG') && true === LAMPCMS_DEBUG) ? $e->getMessage() : 'Error occurred. Administrator has been notified or the error. We will fix this as soon as possible'; //$oTr->get('generic_error', 'exceptions');

}
/**
@@ -623,10 +623,6 @@ class ExternalAuthException extends AuthException

}

class GFCAuthException extends ExternalAuthException
{

}

class TwitterAuthException extends ExternalAuthException
{
@@ -729,13 +725,13 @@ class HttpResponseCodeException extends HttpResponseErrorException
/**
* Constructor
*
* @param Exception $message
* @param int $httpCode http response code as received from http server
* @param int $code arbitrary code, usually used to indicate the level of error
* @param object $prevException object of type Exception containing the
* previous (inner) Exception
* @param Exception $message
* @param int $httpCode http response code as received from http server
* @param int $code arbitrary code, usually used to indicate the level of error
* @param \Lampcms\Exception|null|object $prevException object of type Exception containing the
* previous (inner) Exception
*
* @return void
* @return \Lampcms\HttpResponseCodeException
*/
public function __construct($message, $httpCode, $code = 0, Exception $prevException = null)
{
@@ -895,7 +891,7 @@ class AnswerParserException extends Exception
}

/**
* Base exception thrown by varios post filters like question filter,
* Base exception thrown by various post filters like question filter,
* comment filter, answer filter, etc...
*
* Each filter should extend this class.
@@ -915,7 +911,7 @@ class HTML2TextException extends Exception
}

/**
* Special type of exteption
* Special type of exception
* The purpose of this exception is to only
* show error message to user (Viewer) but
* NOT email an error to site admin
@@ -974,12 +970,14 @@ class FormException extends NoticeException
* Constructor
*
* @param string $message error message
* @param array $aFormFields regular array with names of form fields
* that caused validation error
*
* @param null $formFields
* @param array $aArgs additional optional array of args for
* vsprintf. This is in case we need to translate the error message
* and then apply the replacement vars.
*
* @internal param array $aFormFields regular array with names of form fields
* that caused validation error
*
*/
public function __construct($message, $formFields = null, array $aArgs = null)
{

This file was deleted.

@@ -70,7 +70,7 @@
class tplBoxrecent extends Lampcms\Template\Fast
{
protected static $vars = array(
'title' => 'Recent Tags',
'title' => '@@Recent Tags@@',
'id' => 'recent-tags',
'tags' => '');

@@ -79,4 +79,4 @@ class tplBoxrecent extends Lampcms\Template\Fast
<div class="title">%1$s</div>
%3$s
</div>';
}
}