".$frm->checkbox($name.'['.$key.'][file]',$file, false, array('label'=>$file))."
+ $text .= "
".$frm->text($name.'['.$key.'][name]', $default, $size, 'placeholder='.$file . $req. $pat)."
+ $text .= "
".$frm->text($name.'['.$key.'][name]', $default, $size, 'placeholder='.$file . $req. $pat)."
".TPVLAN_CONV_15."
";
// $text .= "
".$frm->checkbox('css['.$key.'][file]',$file, false, array('label'=>$file))."
";
// $text .= "
".$frm->text('css['.$key.'][name]', $default, $size, 'placeholder='.$placeholder . $req. $pat)."
";
@@ -711,11 +713,11 @@ TEMPLATE;
case 'date':
- $text = $frm->datepicker($name, time(), 'format=yyyy-mm-dd'.$req);
+ $text = $frm->datepicker($name, time(), 'format=yyyy-mm-dd'.$req.'&size=block-level');
break;
case 'description':
- $text = $frm->textarea($name,$default, 3, 100, $req); // pattern not supported.
+ $text = $frm->textarea($name,$default, 3, 100, $req,'&size=block-level'); // pattern not supported.
break;
@@ -733,7 +735,7 @@ TEMPLATE;
default:
- $text = $frm->text($name, $default, $size, 'placeholder='.$placeholder . $req. $pat);
+ $text = $frm->text($name, $default, $size, 'placeholder='.$placeholder . $req. $pat.'&size=block-level');
break;
}
diff --git a/e107_handlers/admin_log_class.php b/e107_handlers/admin_log_class.php
index 6dc8a3693..a7b38b0db 100644
--- a/e107_handlers/admin_log_class.php
+++ b/e107_handlers/admin_log_class.php
@@ -143,6 +143,7 @@ class e_admin_log
* @param integer $event_type [optional] Log level eg. E_LOG_INFORMATIVE, E_LOG_NOTICE, E_LOG_WARNING, E_LOG_FATAL
* @param string $event_code [optional] - eg. 'BOUNCE'
* @param integer $target [optional] LOG_TO_ADMIN, LOG_TO_AUDIT, LOG_TO_ROLLING
+ * @param array $user - user to attribute the log to. array('user_id'=>2, 'user_name'=>'whoever');
* @return e_admin_log
*
* Alternative admin log entry point - compatible with legacy calls, and a bit simpler to use than the generic entry point.
@@ -157,7 +158,7 @@ class e_admin_log
*
*/
- public function add($event_title, $event_detail, $event_type = E_LOG_INFORMATIVE , $event_code = '', $target = LOG_TO_ADMIN )
+ public function add($event_title, $event_detail, $event_type = E_LOG_INFORMATIVE , $event_code = '', $target = LOG_TO_ADMIN, $userData=null )
{
if ($event_code == '')
{
@@ -203,7 +204,7 @@ class e_admin_log
}
- $this->e_log_event($event_type, -1, $event_code, $event_title, $event_detail, FALSE, $target);
+ $this->e_log_event($event_type, -1, $event_code, $event_title, $event_detail, FALSE, $target, $userData);
return $this;
}
@@ -231,12 +232,13 @@ class e_admin_log
* LOG_TO_ADMIN - admin log
* LOG_TO_AUDIT - audit log
* LOG_TO_ROLLING - rolling log
- *
+ * @param array $userData - attribute user to log entry. array('user_id'=>2, 'user_name'=>'whatever');
* @return none
* @todo - check microtime() call
+ * @deprecated - use add() method instead.
*/
- public function e_log_event($importance, $source_call, $eventcode = "GEN", $event_title = "Untitled", $explain = "", $finished = FALSE, $target_logs = LOG_TO_AUDIT )
+ public function e_log_event($importance, $source_call, $eventcode = "GEN", $event_title = "Untitled", $explain = "", $finished = FALSE, $target_logs = LOG_TO_AUDIT, $userData=null )
{
$e107 = e107::getInstance();
$pref = e107::getPref();
@@ -256,10 +258,26 @@ class e_admin_log
//---------------------------------------
// Calculations common to all logs
//---------------------------------------
+
$userid = deftrue('USER') ? USERID : 0;
$userstring = deftrue('USER') ? USERNAME : 'LAN_ANONYMOUS';
$userIP = e107::getIPHandler()->getIP(FALSE);
+ if(!empty($userData['user_id']))
+ {
+ $userid = $userData['user_id'];
+ }
+
+ if(!empty($userData['user_name']))
+ {
+ $userstring = $userData['user_name'];
+ }
+
+ if(!empty($userData['user_ip']))
+ {
+ $userIP = $userData['user_ip'];
+ }
+
$importance = $tp->toDB($importance, true, false, 'no_html');
$eventcode = $tp->toDB($eventcode, true, false, 'no_html');
@@ -390,35 +408,71 @@ class e_admin_log
*/
function user_audit($event_type, $event_data, $id = '', $u_name = '')
{
- global $e107,$tp;
list($time_usec, $time_sec) = explode(" ", microtime()); // Log event time immediately to minimise uncertainty
+
$time_usec = $time_usec * 1000000;
// See whether we should log this
$user_logging_opts = e107::getConfig()->get('user_audit_opts');
- if (!isset($user_logging_opts[$event_type]))
- return; // Finished if not set to log this event type
+ if (!isset($user_logging_opts[$event_type])) // Finished if not set to log this event type
+ {
+ return;
+ }
- if ($this->rldb == NULL)
- $this->rldb = new db; // Better use our own db - don't know what else is going on
+ if($this->rldb == null)
+ {
+ $this->rldb = e107::getDb('rldb'); // Better use our own db - don't know what else is going on
+ }
+
+ if(!empty($id))
+ {
+ $userid = $id;
+ }
+ else
+ {
+ $userid = (USER === true) ? USERID : 0;
+ }
+
+ if(!empty($u_name))
+ {
+ $userstring = $u_name;
+ }
+ else
+ {
+ $userstring = (USER === true ? USERNAME : "LAN_ANONYMOUS");
+ }
+
+ $userIP = e107::getIPHandler()->getIP(false);
- if ($id) $userid = $id;
- else $userid = (USER === TRUE) ? USERID : 0;
- if ($u_name) $userstring = $u_name;
- else $userstring = (USER === true ? USERNAME : "LAN_ANONYMOUS");
- $userIP = e107::getIPHandler()->getIP(FALSE);
$eventcode = 'USER_'.$event_type;
$title = 'LAN_AUDIT_LOG_0'.$event_type; // This creates a string which will be displayed as a constant
- $spacer = '';
+ /* $spacer = '';
$detail = '';
+
foreach ($event_data as $k=>$v)
{
$detail .= $spacer.$k.'=>'.$v;
$spacer = '
';
}
- $this->rldb->db_Insert("audit_log", "0, ".intval($time_sec).', '.intval($time_usec).", '{$eventcode}', {$userid}, '{$userstring}', '{$userIP}', '{$title}', '{$detail}' ");
+ */
+
+ $insertQry = array(
+ 'dblog_id' => 0,
+ 'dblog_datestamp' => intval($time_sec),
+ 'dblog_microtime' => intval($time_usec),
+ 'dblog_eventcode' => $eventcode,
+ 'dblog_user_id' => $userid,
+ 'dblog_user_name' => $userstring,
+ 'dblog_ip' => $userIP,
+ 'dblog_title' => $title,
+ 'dblog_remarks' => print_r($event_data,true),
+ );
+
+ $this->rldb->insert("audit_log", $insertQry);
+
+ // $this->rldb->insert("audit_log", "0, ".intval($time_sec).', '.intval($time_usec).", '{$eventcode}', {$userid}, '{$userstring}', '{$userIP}', '{$title}', '{$detail}' ");
}
diff --git a/e107_handlers/comment_class.php b/e107_handlers/comment_class.php
index ec5287690..5222ea101 100644
--- a/e107_handlers/comment_class.php
+++ b/e107_handlers/comment_class.php
@@ -481,7 +481,9 @@ class comment
$COMMENT_TEMPLATE['item'] = str_replace("row", "row-fluid", $COMMENT_TEMPLATE['item']);
}
-
+
+ e107::getParser()->setThumbSize(100,100); // BC FIx. Set a default image size, in case the template doesn't have one.
+
if (vartrue($pref['nested_comments']))
{
// $width2 = 100 - $width;
@@ -1150,7 +1152,7 @@ class comment
{
$comment = $ns->tablerender(COMLAN_9, $comment, 'comment', true );
}
-
+
diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php
index 7f5b626ba..d7561078e 100644
--- a/e107_handlers/e_parse_class.php
+++ b/e107_handlers/e_parse_class.php
@@ -1431,7 +1431,7 @@ class e_parse extends e_parser
$linktext = (!empty($textReplace)) ? $textReplace : '\\2';
$external = (!empty($opts['ext'])) ? 'rel="external"' : '';
- $text = preg_replace("#(^|[\s])([\w]+?://(?:[\w-%]+?)(?:\.[\w-%]+?)+.*?)(?=$|[\s[\]<]|\.\s|\.$|,\s|,$)#is", "\\1
".$linktext."", $text);
+ $text = preg_replace("#(^|[\s]| )([\w]+?:\/\/(?:[\w-%]+?)(?:\.[\w-%]+?)+.*?)(?=$|[\s[\]<]|\.\s|\.$|,\s|,$| )#is", "\\1
".$linktext."", $text);
$text = preg_replace("#(^|[\s])((?:www|ftp)(?:\.[\w-%]+?){2}.*?)(?=$|[\s[\]<]|\.\s|\.$|,\s|,$)#is", "\\1
".$linktext."", $text);
break;
diff --git a/e107_handlers/login.php b/e107_handlers/login.php
index 28f230f6c..5350a4892 100644
--- a/e107_handlers/login.php
+++ b/e107_handlers/login.php
@@ -251,10 +251,11 @@ class userlogin
// Problem is that USERCLASS_LIST just contains 'guest' and 'everyone' at this point
$class_list = $this->userMethods->addCommonClasses($this->userData, TRUE);
- $user_logging_opts = e107::getConfig()->get('user_audit_opts');
- if (isset($user_logging_opts[USER_AUDIT_LOGIN]) && in_array(varset($pref['user_audit_class'],''),$class_list))
+ // $user_logging_opts = e107::getConfig()->get('user_audit_opts');
+
+ if (in_array(varset($pref['user_audit_class'],''), $class_list))
{ // Need to note in user audit trail
- $this->e107->admin_log->user_audit(USER_AUDIT_LOGIN,'', $user_id,$user_name);
+ e107::getLog()->user_audit(USER_AUDIT_LOGIN,'', $user_id, $user_name);
}
$edata_li = array('user_id' => $user_id, 'user_name' => $user_name, 'class_list' => implode(',',$class_list), 'remember_me' => $autologin, 'user_admin'=>$user_admin, 'user_email'=> $user_email);
diff --git a/e107_handlers/model_class.php b/e107_handlers/model_class.php
index 4d9bba3ec..0aa09acac 100644
--- a/e107_handlers/model_class.php
+++ b/e107_handlers/model_class.php
@@ -3001,7 +3001,8 @@ class e_admin_model extends e_front_model
if(is_numeric($id)) $id = intval($id);
else $id = "'".e107::getParser()->toDB($id)."'";
$table = $this->getModelTable();
- $res = $sql->db_Delete($table, $this->getFieldIdName().'='.$id);
+ $where = $this->getFieldIdName().'='.$id;
+ $res = $sql->delete($table, $where);
$this->_db_qry = $sql->getLastQuery();
if(!$res)
@@ -3017,8 +3018,13 @@ class e_admin_model extends e_front_model
}
else
{
- e107::getAdminLog()->addSuccess($table,false);
- e107::getAdminLog()->addArray($sqlQry)->save('ADMINUI_03');
+ if($table != 'admin_log')
+ {
+ $logData = array('TABLE'=>$table, 'WHERE'=>$where);
+ e107::getAdminLog()->addSuccess($table,false);
+ e107::getAdminLog()->addArray($logData)->save('ADMINUI_03');
+ }
+
$this->clearCache();
}
return $res;
@@ -3595,7 +3601,7 @@ class e_admin_tree_model extends e_front_tree_model
$table = $this->getModelTable();
$sqlQry = $this->getFieldIdName().' IN (\''.$idstr.'\')';
- $res = $sql->db_Delete($table, $sqlQry);
+ $res = $sql->delete($table, $sqlQry);
$this->_db_errno = $sql->getLastErrorNumber();
$this->_db_errmsg = $sql->getLastErrorText();
@@ -3627,9 +3633,11 @@ class e_admin_tree_model extends e_front_tree_model
}
}
- $logData = array('TABLE'=>$table, 'WHERE'=>$sqlQry);
- e107::getAdminLog()->addArray($logData)->save('ADMINUI_03');
-
+ if($table != 'admin_log')
+ {
+ $logData = array('TABLE'=>$table, 'WHERE'=>$sqlQry);
+ e107::getAdminLog()->addArray($logData)->save('ADMINUI_03');
+ }
return $res;
}
diff --git a/e107_handlers/notify_class.php b/e107_handlers/notify_class.php
index df221c4e2..5b14eddac 100644
--- a/e107_handlers/notify_class.php
+++ b/e107_handlers/notify_class.php
@@ -216,7 +216,7 @@ class notify
}
- if(E107_DEBUG_LEVEL > 0)
+ if(E107_DEBUG_LEVEL > 0 || deftrue('e_DEBUG_NOTIFY'))
{
$data = array('id'=>$id, 'subject'=>$subject, 'recipients'=> $recipients, 'prefs'=>$this->notify_prefs['event'][$id], 'message'=>$message);
diff --git a/e107_handlers/upload_handler.php b/e107_handlers/upload_handler.php
index cf1b498e9..0344165f5 100644
--- a/e107_handlers/upload_handler.php
+++ b/e107_handlers/upload_handler.php
@@ -191,6 +191,7 @@ function process_uploaded_files($uploaddir, $fileinfo = FALSE, $options = NULL)
$c = 0;
$tp = e107::getParser();
+ $uploadfile = null;
foreach ($files['name'] as $key=>$name)
{
@@ -299,6 +300,8 @@ function process_uploaded_files($uploaddir, $fileinfo = FALSE, $options = NULL)
if (!$first_error) // All tests passed - can store it somewhere
{
+ $uploaded[$c] = e107::getFile()->get_file_info($uploadfile,true);
+
$uploaded[$c]['name'] = $name;
$uploaded[$c]['rawname'] = $raw_name;
$uploaded[$c]['origname'] = $origname;
@@ -306,6 +309,8 @@ function process_uploaded_files($uploaddir, $fileinfo = FALSE, $options = NULL)
$uploaded[$c]['size'] = 0;
$uploaded[$c]['index'] = $key; // Store the actual index from the file_userfile array
+ // e107::getMessage()->addDebug(print_a($uploaded[$c],true));
+
// Store as flat file
if ((!$ul_temp_dir && @move_uploaded_file($uploadfile, $destination_file)) || ($ul_temp_dir && @rename($uploadfile, $destination_file))) // This should work on all hosts
{
diff --git a/e107_handlers/user_handler.php b/e107_handlers/user_handler.php
index 58f86e08a..7bf50ee4e 100644
--- a/e107_handlers/user_handler.php
+++ b/e107_handlers/user_handler.php
@@ -878,7 +878,7 @@ Following fields auto-filled in code as required:
{ // Valid user!
if ($row['user_ban'] != $newVal) // We could implement a hierarchy here, so that an important status isn't overridden by a lesser one
{ // Only update if needed
- $db->db_Update('user', '`user_ban` = '.$newVal.', `user_email` = \'\' WHERE `user_id` = '.$row['user_id'].' LIMIT 1');
+ $db->update('user', '`user_ban` = '.$newVal.', `user_email` = \'\' WHERE `user_id` = '.$row['user_id'].' LIMIT 1');
// Add to user audit log TODO: Should we log to admin log as well?
$adminLog = e107::getAdminLog();
$adminLog->user_audit($logEvent, array('user_ban' => $newVal, 'user_email' => $row['user_email']), $row['user_id'], $row['user_loginname']);
@@ -947,7 +947,13 @@ class e_user_provider
}
}
}
-
+
+ private function log($class,$method,$line)
+ {
+ // e107::getLog()->add('XUP Debug', ($class.':'.$method.'-'.$line), E_LOG_INFORMATIVE, "XUP_DEBUG");
+ }
+
+
public function setBackUrl($url)
{
# system/xup/endpoint by default
@@ -956,6 +962,7 @@ class e_user_provider
public function getProvider()
{
+ // $this->log(__CLASS__, __METHOD__, __LINE__);
return $this->_provider;
}
@@ -975,6 +982,7 @@ class e_user_provider
public function userId()
{
+
if($this->adapter && $this->adapter->getUserProfile()->identifier)
{
return $this->getProvider().'_'.$this->adapter->getUserProfile()->identifier;
@@ -1009,7 +1017,8 @@ class e_user_provider
$redirectUrl = e107::getUrl()->create($redirectUrl);
}
}
-
+
+
if(e107::getUser()->isUser())
{
if($redirectUrl)
@@ -1022,14 +1031,17 @@ class e_user_provider
$this->adapter = $this->hybridauth->authenticate($this->getProvider());
$profile = $this->adapter->getUserProfile();
-
+
+ $this->log(__CLASS__, __METHOD__, __LINE__);
// returned back, if success...
if($profile->identifier)
{
+
$sql = e107::getDb();
$userMethods = e107::getUserSession();
$plainPwd = $userMethods->generateRandomString('************'); // auto plain passwords
+
// TODO - auto login name, shouldn't be used if system set to user_email login...
$userdata['user_loginname'] = $this->getProvider().$userMethods->generateUserLogin(e107::getPref('predefinedLoginName', '_..#..#..#'));
@@ -1064,11 +1076,14 @@ class e_user_provider
// user_name, user_xup, user_email and user_loginname shouldn't match
$insert = (!empty($userdata['user_email'])) ? "OR user_email='".$userdata['user_email']."' " : "";
+
+ $this->log(__CLASS__, __METHOD__, __LINE__);
- if($sql->count("user", "(*)", "user_xup='".$sql->escape($this->userId())."' ".$insert." OR user_loginname='{$userdata['user_loginname']}' OR user_name='{$userdata['user_name']}'"))
+ if($uid = $sql->retrieve("user", "user_id", "user_xup='".$sql->escape($this->userId())."' ".$insert." OR user_loginname='{$userdata['user_loginname']}' OR user_name='{$userdata['user_name']}'"))
{
// $this->login($redirectUrl); // auto-login
e107::getUser()->loginProvider($this->userId());
+
if($redirectUrl)
{
e107::getRedirect()->redirect($redirectUrl);
@@ -1080,7 +1095,8 @@ class e_user_provider
if(empty($userdata['user_email']) && e107::getPref('disable_emailcheck', 0)==0) // Allow it if set-up that way.
{
- throw new Exception( "Signup failed! Can't access user email - registration without an email is impossible.".print_a($userdata,true), 4); // TODO lan
+ // Twitter will not provide email addresses.
+ // throw new Exception( "Signup failed! Can't access user email - registration without an email is impossible.".print_a($userdata,true), 4); // TODO lan
}
// other fields
@@ -1108,9 +1124,11 @@ class e_user_provider
// user model error
if($user->hasError())
{
+ e107::getLog()->add('XUP Signup Failure', $userdata, E_LOG_WARNING, "XUP_SIGNUP");
throw new Exception($user->renderMessages(), 5);
}
+
### Successful signup!
//$user->set('provider', $this->getProvider());
$userdata = $user->getData();
@@ -1125,7 +1143,7 @@ class e_user_provider
if(true === $ret) return $this;
// send email
- if($emailAfterSuccess)
+ if($emailAfterSuccess && !empty($userdata['user_email']))
{
$user->set('user_password', $plainPwd)->email('signup');
}
@@ -1146,6 +1164,8 @@ class e_user_provider
return true;
}
+ $this->log(__CLASS__, __METHOD__, __LINE__);
+
return false;
}
@@ -1153,6 +1173,7 @@ class e_user_provider
public function login($redirectUrl = true)
{
+
if(!e107::getPref('social_login_active', false))
{
throw new Exception( "Signup failed! This feature is disabled.", 100); // TODO lan
@@ -1174,7 +1195,8 @@ class e_user_provider
$redirectUrl = e107::getUrl()->create($redirectUrl);
}
}
-
+
+
if(e107::getUser()->isUser())
{
if($redirectUrl)
@@ -1186,7 +1208,8 @@ class e_user_provider
$this->adapter = $this->hybridauth->authenticate($this->getProvider());
$check = e107::getUser()->setProvider($this)->loginProvider($this->userId(), false);
-
+
+
if($redirectUrl)
{
e107::getRedirect()->redirect($redirectUrl);
diff --git a/e107_handlers/user_model.php b/e107_handlers/user_model.php
index 2d9bd8035..392502a48 100644
--- a/e107_handlers/user_model.php
+++ b/e107_handlers/user_model.php
@@ -1557,7 +1557,9 @@ class e_user extends e_user_model
$userlogin = new userlogin();
$userlogin->login($xup, '', 'provider', false, true);
- $userdata = $userlogin->getUserData();
+ $userdata = $userlogin->getUserData();
+
+ e107::getLog()->add('XUP Debug', (__CLASS__.':'.__METHOD__.'-'.__LINE__), E_LOG_INFORMATIVE, "XUP_DEBUG");
$this->setSessionData(true)->setData($userdata);
@@ -1681,21 +1683,49 @@ class e_user extends e_user_model
// query DB
$sql = e107::getDb();
$where = array();
+ $userdata = array();
+
foreach ($connected as $providerId)
{
$adapter = Hybrid_Auth::getAdapter($providerId);
if(!$adapter->getUserProfile()->identifier) continue;
-
- $id = $providerId.'_'.$adapter->getUserProfile()->identifier;
+
+ $profile = $adapter->getUserProfile();
+
+ $userdata['user_name'] = $sql->escape($profile->displayName);
+ $userdata['user_image'] = $profile->photoURL; // avatar
+
+ $id = $providerId.'_'.$profile->identifier;
$where[] = "user_xup='".$sql->escape($id)."'";
}
+
+
$where = implode(' OR ', $where);
- if($sql->db_Select('user', 'user_id, user_password, user_xup', $where))
+ if($sql->select('user', 'user_id, user_name, user_image, user_password, user_xup', $where))
{
- $user = $sql->db_Fetch();
+
+ $user = $sql->fetch();
e107::getUserSession()->makeUserCookie($user);
$this->setSessionData();
+
+ // Update display name or avatar image if they have changed.
+ if(($userdata['user_name'] != $user['user_name']) || ($userdata['user_image'] != $user['user_image']))
+ {
+
+ if($sql->update('user', "user_name='".$userdata['user_name']."', user_image='".$userdata['user_image']."' WHERE user_id=".$user['user_id']." LIMIT 1")!==false)
+ {
+ e107::getLog()->add('User Profile Updated', $userdata, E_LOG_INFORMATIVE, "XUP_LOGIN", LOG_TO_ADMIN, array('user_id'=>$user['user_id'],'user_name'=>$user['user_name']));
+ }
+ else
+ {
+ e107::getLog()->add('User Profile Update Failed', $userdata, E_LOG_WARNING, "XUP_LOGIN", LOG_TO_ADMIN, array('user_id'=>$user['user_id'],'user_name'=>$user['user_name']));
+ }
+ }
+
+ unset($user['user_password']);
+ e107::getLog()->user_audit(USER_AUDIT_LOGIN,'', $user['user_id'], $user['user_name']);
+ // e107::getLog()->add('XUP Login', $user, E_LOG_INFORMATIVE, "LOGIN", LOG_TO_ROLLING, array('user_id'=>$user['user_id'],'user_name'=>$user['user_name']));
}
return $this;
diff --git a/e107_languages/English/admin/lan_admin_log.php b/e107_languages/English/admin/lan_admin_log.php
index 09ce6e318..4d88c6a95 100644
--- a/e107_languages/English/admin/lan_admin_log.php
+++ b/e107_languages/English/admin/lan_admin_log.php
@@ -71,6 +71,7 @@ define("RL_LAN_069", "Download Name");
define("RL_LAN_071", "User registration (ignores class setting above)");
define("RL_LAN_072", "Signup email acknowledgement (ignores class setting above)");
define("RL_LAN_073", "Login/Logout");
+
define("RL_LAN_075", "Change display name");
define("RL_LAN_076", "Change password");
define("RL_LAN_077", "Change email address");
diff --git a/e107_plugins/news/templates/news_template.php b/e107_plugins/news/templates/news_template.php
index 17cbb2ef4..e3cc1e7ff 100644
--- a/e107_plugins/news/templates/news_template.php
+++ b/e107_plugins/news/templates/news_template.php
@@ -80,25 +80,30 @@ $NEWS_TEMPLATE['default']['item'] = '
';
*/
+$NEWS_WRAPPER['default']['item']['NEWSIMAGE: item=1'] = '
{---}';
+
$NEWS_TEMPLATE['default']['item'] = '
- {SETIMAGE: w=900&h=300}
+ {SETIMAGE: w=400&h=400}
{NEWSTITLELINK}
-
{GLYPH=user} {NEWSAUTHOR}
-
-
-
{GLYPH=time} {NEWSDATE=short}
-
{GLYPH=tags} {NEWSTAGS} {GLYPH=folder-open} {NEWSCATEGORY}
+
+
+
+
{GLYPH=user} {NEWSAUTHOR} {GLYPH=time} {NEWSDATE=short}
+
{GLYPH=tags} {NEWSTAGS} {GLYPH=folder-open} {NEWSCATEGORY}
-
+
{NEWSIMAGE: item=1}
-
-
+
{NEWSSUMMARY}
{NEWSVIDEO: item=1}
+
{NEWSBODY}
+
+
{EXTENDED}
+
{NEWSCOMMENTLINK: glyph=comments&class=btn btn-default}{PRINTICON: class=btn btn-default}{PDFICON}{SOCIALSHARE}{ADMINOPTIONS: class=btn btn-default}
@@ -121,7 +126,7 @@ $NEWS_TEMPLATE['view']['item'] = '
{SETIMAGE: w=900&h=600}
{NEWSTITLELINK}
-
{NEWSSUMMARY}
+
{GLYPH=user} {NEWSAUTHOR} {GLYPH=time} {NEWSDATE=short}
@@ -132,7 +137,10 @@ $NEWS_TEMPLATE['view']['item'] = '
{NEWSIMAGE: item=1}
+
{NEWSSUMMARY}
+
{NEWSBODY=body}
+
{NEWSVIDEO: item=1}
{NEWSVIDEO: item=2}
@@ -155,7 +163,7 @@ $NEWS_TEMPLATE['view']['item'] = '
{NEWSVIDEO: item=4}
{NEWSVIDEO: item=5}
-
+
{NEWSBODY=extended}
@@ -171,6 +179,7 @@ $NEWS_TEMPLATE['view']['item'] = '
{NEWSRELATED}
{NEWSNAVLINK}
+
';
//$NEWS_MENU_TEMPLATE['view']['separator'] = '
';
@@ -201,7 +210,11 @@ $NEWS_TEMPLATE['category']['item'] = '
### Related 'start' - Options: Core 'single' shortcodes including {SETIMAGE}
### Related 'item' - Options: {RELATED_URL} {RELATED_IMAGE} {RELATED_TITLE} {RELATED_SUMMARY}
### Related 'end' - Options: Options: Core 'single' shortcodes including {SETIMAGE}
-
+/*
$NEWS_TEMPLATE['related']['start'] = "
".defset('LAN_RELATED', 'Related')."
";
+$NEWS_TEMPLATE['related']['end'] = "";*/
+
+$NEWS_TEMPLATE['related']['start'] = '{SETIMAGE: w=350&h=350&crop=1}
YOU MIGHT ALSO LIKE
';
+$NEWS_TEMPLATE['related']['item'] = '
';
+$NEWS_TEMPLATE['related']['end'] = '
';
\ No newline at end of file
diff --git a/e107_plugins/social/admin_config.php b/e107_plugins/social/admin_config.php
index 9566d0463..c16ae10a5 100644
--- a/e107_plugins/social/admin_config.php
+++ b/e107_plugins/social/admin_config.php
@@ -263,8 +263,12 @@ class social_ui extends e_admin_ui
{
$this->testUrl = SITEURL."?route=system/xup/test";
- $notice = "Note: In most cases you will need to obtain an id and secret key from one of the providers. Click the blue links below to configure.
-
You may test your configuration with the following URL:
".$this->testUrl."";
+ $notice = "Note: In most cases you will need to obtain an id and secret key from one of the providers. Click the blue links to the right to configure.
+
You may test your configuration with the following URL:
".$this->testUrl."";
+
+ $callBack = SITEURL."index.php";
+ $notice .= "
Your callback URL is:
".$callBack."";
+
return array("caption"=>"Help",'text'=> $notice);
diff --git a/submitnews.php b/submitnews.php
index 9bdd822a8..a6c3b02b4 100644
--- a/submitnews.php
+++ b/submitnews.php
@@ -25,7 +25,6 @@ if (!isset($pref['subnews_class']))
}
-
if (!check_class($pref['subnews_class']))
{
$ns->tablerender(LAN_UI_403_TITLE_ERROR, LAN_UI_403_BODY_ERROR);
@@ -33,218 +32,320 @@ if (!check_class($pref['subnews_class']))
exit;
}
-if (isset($_POST['submitnews_submit']) && $_POST['submitnews_title'] && $_POST['submitnews_item'])
-{
- $ip = e107::getIPHandler()->getIP(FALSE);
- $fp = new floodprotect;
- if ($fp->flood("submitnews", "submitnews_datestamp") == FALSE)
- {
- e107::redirect();
- exit;
- }
-
- $submitnews_user = (USER ? USERNAME : trim($tp->toDB($_POST['submitnews_name'])));
- $submitnews_email = (USER ? USEREMAIL : trim(check_email($tp->toDB($_POST['submitnews_email']))));
- $submitnews_title = $tp->toDB($_POST['submitnews_title']);
- $submitnews_item = $tp->toDB($_POST['submitnews_item']);
- $submitnews_item = str_replace("src="e107_images", "src="".SITEURL."e107_images", $submitnews_item);
- $submitnews_file = "";
- $submitnews_error = FALSE;
- if (!$submitnews_user || !$submitnews_email)
- {
- $message = SUBNEWSLAN_7;
- $submitnews_error = TRUE;
- }
-
- // ==== Process File Upload ====
- if (FILE_UPLOADS && $_FILES['file_userfile'] && vartrue($pref['subnews_attach']) && vartrue($pref['upload_enabled']) && check_class($pref['upload_class']))
- {
- require_once(e_HANDLER.'upload_handler.php');
- $uploaded = process_uploaded_files(e_UPLOAD, FALSE, array('file_mask' => 'jpg,gif,png', 'max_file_count' => 1));
-
- if (($uploaded === FALSE) || !is_array($uploaded))
- { // Non-specific error
- $submitnews_error = TRUE;
- $message = SUBNEWSLAN_8;
- }
- else
- {
- $submitnews_filearray = array();
-
- foreach($uploaded as $c=>$v)
- {
- if (varset($uploaded[$c]['error'],0) != 0)
- {
- $submitnews_error = TRUE;
- $message = handle_upload_messages($uploaded);
- }
- else
- {
- if (isset($uploaded[$c]['name']) && isset($uploaded[$c]['type']) && isset($uploaded[$c]['size']))
- {
- $filename = $uploaded[$c]['name'];
- $filetype = $uploaded[$c]['type'];
- $filesize = $uploaded[$c]['size'];
- $fileext = substr(strrchr($filename, "."), 1);
- $today = getdate();
- $submitnews_file = USERID."_".$today[0]."_".$c."_".str_replace(" ", "_", substr($submitnews_title, 0, 6)).".".$fileext;
-
- if (is_numeric($pref['subnews_resize']) && ($pref['subnews_resize'] > 30) && ($pref['subnews_resize'] < 5000))
- {
- require_once(e_HANDLER.'resize_handler.php');
-
- if (!resize_image(e_UPLOAD.$filename, e_UPLOAD.$submitnews_file, $pref['subnews_resize']))
- {
- rename(e_UPLOAD.$filename, e_UPLOAD.$submitnews_file);
- }
- }
- elseif ($filename)
- {
- rename(e_UPLOAD.$filename, e_UPLOAD.$submitnews_file);
- }
- }
- }
-
- if ($filename && file_exists(e_UPLOAD.$submitnews_file))
- {
- $submitnews_filearray[] = $submitnews_file;
- }
-
- }
- }
-
- }
-
- if ($submitnews_error === FALSE)
- {
- $sql->insert("submitnews", "0, '$submitnews_user', '$submitnews_email', '$submitnews_title', '".intval($_POST['cat_id'])."', '$submitnews_item', '".time()."', '$ip', '0', '".implode(',',$submitnews_filearray)."' ");
-
- $edata_sn = array("user" => $submitnews_user, "email" => $submitnews_email, "itemtitle" => $submitnews_title, "catid" => intval($_POST['cat_id']), "item" => $submitnews_item, "image" => $submitnews_file, "ip" => $ip);
-
- e107::getEvent()->trigger("subnews", $edata_sn); // bc
- e107::getEvent()->trigger("user_news_submit", $edata_sn);
-
- $mes = e107::getMessage();
- $mes->addSuccess(LAN_134);
- echo $mes->render();
-
- // $ns->tablerender(LAN_133, "
".LAN_134."
");
- require_once(FOOTERF);
- exit;
- }
- else
- {
- message_handler("P_ALERT", $message);
- }
-}
-
-$text = "";
if (!defined("USER_WIDTH")) { define("USER_WIDTH","width:95%"); }
+class submitNews
+{
- if (!empty($pref['news_subheader']))
+ private $minWidth = 1024;
+ private $minHeight = 768;
+
+
+ function __construct()
{
+ $mes = e107::getMessage();
+
+ $minDimensions = e107::pref('core','subnews_attach_minsize',false);
+
+ if(empty($minDimensions))
+ {
+ $this->minWidth = 0;
+ $this->minHeight = 0;
+ }
+ else
+ {
+ $tmp = explode('×',$minDimensions);
+ $this->minWidth = intval($tmp[0]);
+ $this->minHeight = intval($tmp[1]);
+ }
+
+ if(isset($_POST['submitnews_submit']) && !empty($_POST['submitnews_title']) && !empty($_POST['submitnews_item']))
+ {
+ $this->process();
+ }
+
+ echo $mes->render();
+
+ $this->form();
+ }
+
+
+ function process()
+ {
+ $ip = e107::getIPHandler()->getIP(FALSE);
+ $tp = e107::getParser();
+ $pref = e107::pref('core');
+ $sql = e107::getDb();
+ $mes = e107::getMessage();
+
+ $fp = new floodprotect;
+
+ if ($fp->flood("submitnews", "submitnews_datestamp") == false)
+ {
+ e107::redirect();
+ exit;
+ }
+
+ $submitnews_user = (USER ? USERNAME : trim($tp->toDB($_POST['submitnews_name'])));
+ $submitnews_email = (USER ? USEREMAIL : trim(check_email($tp->toDB($_POST['submitnews_email']))));
+ $submitnews_title = $tp->toDB($_POST['submitnews_title']);
+ $submitnews_item = $tp->toDB($_POST['submitnews_item']);
+ // $submitnews_item = str_replace("src="e107_images", "src="".SITEURL."e107_images", $submitnews_item);
+ $submitnews_file = "";
+ $submitnews_error = false;
+ $submitnews_filearray = array();
+
+ if (!$submitnews_user || !$submitnews_email)
+ {
+ $message = SUBNEWSLAN_7;
+ $submitnews_error = TRUE;
+ }
+
+ // ==== Process File Upload ====
+ if (FILE_UPLOADS && !empty($_FILES['file_userfile']) && vartrue($pref['subnews_attach']) && vartrue($pref['upload_enabled']) && check_class($pref['upload_class']))
+ {
+ $uploaded = e107::getFile()->getUploaded(e_UPLOAD, 'unique', array('file_mask' => 'jpg,gif,png', 'max_file_count' => 3));
+
+ if (empty($uploaded)) // Non-specific error
+ {
+ $submitnews_error = true;
+ $message = SUBNEWSLAN_8;
+ }
+ else
+ {
+ foreach($uploaded as $c=>$v)
+ {
+ // Check if images is too small.
+ if(!empty($this->minWidth) && !empty($v['img-width']) && (intval($v['img-width']) < $this->minWidth || intval($v['img-width']) < $this->minHeight))
+ {
+ //TODO Lan and review wording.
+ $mes->addWarning("One of your images has dimensions smaller than ".$this->minWidth."px x ".$this->minHeight."px. Please correct the attachment and submit the form again. ");
+
+ return false;
+ }
+
+ if (varset($uploaded[$c]['error'],0) != 0)
+ {
+ $submitnews_error = TRUE;
+ $message = handle_upload_messages($uploaded);
+ }
+ else
+ {
+ if (isset($uploaded[$c]['name']) && isset($uploaded[$c]['type']) && isset($uploaded[$c]['size']))
+ {
+ $filename = $uploaded[$c]['name'];
+ $filetype = $uploaded[$c]['type'];
+ $filesize = $uploaded[$c]['size'];
+ $fileext = substr(strrchr($filename, "."), 1);
+
+ $today = getdate();
+
+ $submitnews_file = USERID."_".$today[0]."_".$c."_".str_replace(" ", "_", substr($submitnews_title, 0, 6)).".".$fileext;
+
+ if (is_numeric($pref['subnews_resize']) && ($pref['subnews_resize'] > 30) && ($pref['subnews_resize'] < 5000))
+ {
+ require_once(e_HANDLER.'resize_handler.php');
+
+ if (!resize_image(e_UPLOAD.$filename, e_UPLOAD.$submitnews_file, $pref['subnews_resize']))
+ {
+ rename(e_UPLOAD.$filename, e_UPLOAD.$submitnews_file);
+ }
+ }
+ elseif ($filename)
+ {
+ rename(e_UPLOAD.$filename, e_UPLOAD.$submitnews_file);
+ }
+ }
+ }
+
+ if ($filename && file_exists(e_UPLOAD.$submitnews_file))
+ {
+ $submitnews_filearray[] = $submitnews_file;
+ }
+
+ }
+ }
+
+ }
+
+ if ($submitnews_error === false)
+ {
+
+ $insertQry = array(
+ 'submitnews_id' => 0,
+ 'submitnews_name' => $submitnews_user,
+ 'submitnews_email' => $submitnews_email,
+ 'submitnews_title' => $submitnews_title,
+ 'submitnews_category' => intval($_POST['cat_id']),
+ 'submitnews_item' => $submitnews_item,
+ 'submitnews_datestamp' => time(),
+ 'submitnews_ip' => $ip,
+ 'submitnews_auth' => '0',
+ 'submitnews_file' => implode(',',$submitnews_filearray),
+ );
+
+ if(!$sql->insert("submitnews", $insertQry))
+ {
+ $mes->addError(LAN_134);
+ return false;
+ }
+
+
+ // $sql->insert("submitnews", "0, '$submitnews_user', '$submitnews_email', '$submitnews_title', '".intval($_POST['cat_id'])."', '$submitnews_item', '".time()."', '$ip', '0', '".implode(',',$submitnews_filearray)."' ");
+
+ $edata_sn = array("user" => $submitnews_user, "email" => $submitnews_email, "itemtitle" => $submitnews_title, "catid" => intval($_POST['cat_id']), "item" => $submitnews_item, "image" => $submitnews_file, "ip" => $ip);
+
+ e107::getEvent()->trigger("subnews", $edata_sn); // bc
+ e107::getEvent()->trigger("user_news_submit", $edata_sn);
+
+
+ $mes->addSuccess(LAN_134);
+ // echo $mes->render();
+ unset($_POST);
+
+ // $ns->tablerender(LAN_133, "
".LAN_134."
");
+
+ }
+ else
+ {
+ // message_handler("P_ALERT", $message);
+ $mes->addWarning($message);
+ }
+ }
+
+
+ function form()
+ {
+
+ $tp = e107::getParser();
+ $sql = e107::getDb();
+ $ns = e107::getRender();
+ $pref = e107::pref('core');
+
+ $text = "";
+
+ if (!empty($pref['news_subheader']))
+ {
+ $text .= $tp->toHTML($pref['news_subheader'], true, "BODY");
+ }
+
+
$text .= "
+
";
+
+ $ns->tablerender(LAN_136, $text);
+
- ".$tp->toHTML($pref['news_subheader'], true, "BODY")."
- ";
}
-$text .= "
-
";
-
-$ns->tablerender(LAN_136, $text);
-
-
-
- if(!vartrue($pref['subnews_htmlarea'])) // check after bbarea is called.
- {
- e107::wysiwyg(false);
- }
require_once(FOOTERF);