mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-10 12:32:14 +09:00
issue 2662 trash, widget, session, trackback, spamfilter, tag
git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12260 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
e1a22ca6f0
commit
5219a360c6
31 changed files with 3465 additions and 3173 deletions
|
|
@ -1,26 +1,28 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @class sessionAdminController
|
* @class sessionAdminController
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief The admin controller class of the session module
|
* @brief The admin controller class of the session module
|
||||||
**/
|
*/
|
||||||
|
class sessionAdminController extends session
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @brief Initialization
|
||||||
|
*/
|
||||||
|
function init()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
class sessionAdminController extends session {
|
/**
|
||||||
|
* @brief The action to clean up the Derby session
|
||||||
|
*/
|
||||||
|
function procSessionAdminClear()
|
||||||
|
{
|
||||||
|
$oSessionController = &getController('session');
|
||||||
|
$oSessionController->gc(0);
|
||||||
|
|
||||||
/**
|
$this->add('result',Context::getLang('session_cleared'));
|
||||||
* @brief Initialization
|
}
|
||||||
**/
|
}
|
||||||
function init() {
|
/* End of file session.admin.controller.php */
|
||||||
}
|
/* Location: ./modules/session/session.admin.controller.php */
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The action to clean up the Derby session
|
|
||||||
**/
|
|
||||||
function procSessionAdminClear() {
|
|
||||||
$oSessionController = &getController('session');
|
|
||||||
$oSessionController->gc(0);
|
|
||||||
|
|
||||||
$this->add('result',Context::getLang('session_cleared'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,27 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @class sessionAdminView
|
* @class sessionAdminView
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief The admin view class of the session module
|
* @brief The admin view class of the session module
|
||||||
**/
|
*/
|
||||||
|
class sessionAdminView extends session
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @brief Initialization
|
||||||
|
*/
|
||||||
|
function init()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
class sessionAdminView extends session {
|
/**
|
||||||
|
* @brief Configure
|
||||||
/**
|
*/
|
||||||
* @brief Initialization
|
function dispSessionAdminIndex()
|
||||||
**/
|
{
|
||||||
function init() {
|
// Set the template file
|
||||||
}
|
$this->setTemplatePath($this->module_path.'tpl');
|
||||||
|
$this->setTemplateFile('index');
|
||||||
/**
|
}
|
||||||
* @brief Configure
|
}
|
||||||
**/
|
/* End of file session.admin.view.php */
|
||||||
function dispSessionAdminIndex() {
|
/* Location: ./modules/session/session.admin.view.php */
|
||||||
// Set the template file
|
|
||||||
$this->setTemplatePath($this->module_path.'tpl');
|
|
||||||
$this->setTemplateFile('index');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
|
||||||
|
|
@ -1,81 +1,88 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @class session
|
* @class session
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief session module's high class
|
* @brief session module's high class
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
*
|
*
|
||||||
* The session management class
|
* The session management class
|
||||||
**/
|
*/
|
||||||
|
class session extends ModuleObject
|
||||||
|
{
|
||||||
|
var $lifetime = 18000;
|
||||||
|
var $session_started = false;
|
||||||
|
|
||||||
class session extends ModuleObject {
|
function session()
|
||||||
|
{
|
||||||
|
if(Context::isInstalled()) $this->session_started= true;
|
||||||
|
}
|
||||||
|
|
||||||
var $lifetime = 18000;
|
/**
|
||||||
var $session_started = false;
|
* @brief Additional tasks required to accomplish during the installation
|
||||||
|
*/
|
||||||
|
function moduleInstall()
|
||||||
|
{
|
||||||
|
$oDB = &DB::getInstance();
|
||||||
|
$oDB->addIndex("session","idx_session_update_mid", array("member_srl","last_update","cur_mid"));
|
||||||
|
|
||||||
function session() {
|
return new Object();
|
||||||
if(Context::isInstalled()) $this->session_started= true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Additional tasks required to accomplish during the installation
|
* @brief A method to check if the installation has been successful
|
||||||
**/
|
*/
|
||||||
function moduleInstall() {
|
function checkUpdate()
|
||||||
$oDB = &DB::getInstance();
|
{
|
||||||
$oDB->addIndex("session","idx_session_update_mid", array("member_srl","last_update","cur_mid"));
|
$oDB = &DB::getInstance();
|
||||||
|
if(!$oDB->isTableExists('session')) return true;
|
||||||
|
if(!$oDB->isColumnExists("session","cur_mid")) return true;
|
||||||
|
if(!$oDB->isIndexExists("session","idx_session_update_mid")) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return new Object();
|
/**
|
||||||
}
|
* @brief Execute update
|
||||||
|
*/
|
||||||
|
function moduleUpdate()
|
||||||
|
{
|
||||||
|
$oDB = &DB::getInstance();
|
||||||
|
$oModuleModel = &getModel('module');
|
||||||
|
|
||||||
/**
|
if(!$oDB->isTableExists('session')) $oDB->createTableByXmlFile($this->module_path.'schemas/session.xml');
|
||||||
* @brief A method to check if the installation has been successful
|
|
||||||
**/
|
|
||||||
function checkUpdate() {
|
|
||||||
$oDB = &DB::getInstance();
|
|
||||||
if(!$oDB->isTableExists('session')) return true;
|
|
||||||
if(!$oDB->isColumnExists("session","cur_mid")) return true;
|
|
||||||
if(!$oDB->isIndexExists("session","idx_session_update_mid")) return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
if(!$oDB->isColumnExists("session","cur_mid")) $oDB->addColumn('session',"cur_mid","varchar",128);
|
||||||
* @brief Execute update
|
|
||||||
**/
|
|
||||||
function moduleUpdate() {
|
|
||||||
$oDB = &DB::getInstance();
|
|
||||||
$oModuleModel = &getModel('module');
|
|
||||||
|
|
||||||
if(!$oDB->isTableExists('session')) $oDB->createTableByXmlFile($this->module_path.'schemas/session.xml');
|
|
||||||
|
|
||||||
if(!$oDB->isColumnExists("session","cur_mid")) $oDB->addColumn('session',"cur_mid","varchar",128);
|
if(!$oDB->isIndexExists("session","idx_session_update_mid")) $oDB->addIndex("session","idx_session_update_mid", array("member_srl","last_update","cur_mid"));
|
||||||
|
}
|
||||||
|
|
||||||
if(!$oDB->isIndexExists("session","idx_session_update_mid")) $oDB->addIndex("session","idx_session_update_mid", array("member_srl","last_update","cur_mid"));
|
/**
|
||||||
}
|
* @brief session string decode
|
||||||
|
*/
|
||||||
|
function unSerializeSession($val)
|
||||||
|
{
|
||||||
|
$vars = preg_split('/([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff^|]*)\|/', $val,-1,PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
|
||||||
|
for($i=0; $vars[$i]; $i++) $result[$vars[$i++]] = unserialize($vars[$i]);
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief session string decode
|
* @brief session string encode
|
||||||
**/
|
*/
|
||||||
function unSerializeSession($val) {
|
function serializeSession($data)
|
||||||
$vars = preg_split('/([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff^|]*)\|/', $val,-1,PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
|
{
|
||||||
for($i=0; $vars[$i]; $i++) $result[$vars[$i++]] = unserialize($vars[$i]);
|
if(!count($data)) return;
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
$str = '';
|
||||||
* @brief session string encode
|
foreach($data as $key => $val) $str .= $key.'|'.serialize($val);
|
||||||
**/
|
return substr($str, 0, strlen($str)-1).'}';
|
||||||
function serializeSession($data) {
|
}
|
||||||
if(!count($data)) return;
|
|
||||||
|
|
||||||
$str = '';
|
/**
|
||||||
foreach($data as $key => $val) $str .= $key.'|'.serialize($val);
|
* @brief Re-generate the cache file
|
||||||
return substr($str, 0, strlen($str)-1).'}';
|
*/
|
||||||
}
|
function recompileCache()
|
||||||
|
{
|
||||||
/**
|
}
|
||||||
* @brief Re-generate the cache file
|
}
|
||||||
**/
|
/* End of file session.class.php */
|
||||||
function recompileCache() {
|
/* Location: ./modules/session/session.class.php */
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
|
||||||
|
|
@ -1,128 +1,151 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @class sessionController
|
* @class sessionController
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief The controller class of the session module
|
* @brief The controller class of the session module
|
||||||
**/
|
*/
|
||||||
|
class sessionController extends session
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @brief Initialization
|
||||||
|
*/
|
||||||
|
function init()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
class sessionController extends session {
|
function open()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
function close()
|
||||||
* @brief Initialization
|
{
|
||||||
**/
|
return true;
|
||||||
function init() {
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function open() {
|
function write($session_key, $val)
|
||||||
return true;
|
{
|
||||||
}
|
if(!$session_key || !$this->session_started) return;
|
||||||
|
$oCacheHandler = &CacheHandler::getInstance('object');
|
||||||
|
if($oCacheHandler->isSupport())
|
||||||
|
{
|
||||||
|
$cache_key = 'object:'.$session_key;
|
||||||
|
$cache_vars = $oCacheHandler->get($cache_key);
|
||||||
|
}
|
||||||
|
|
||||||
function close() {
|
$args->session_key = $session_key;
|
||||||
return true;
|
if($cache_vars) $session_info = $cache_vars;
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
$output = executeQuery('session.getSession', $args);
|
||||||
|
$session_info = $output->data;
|
||||||
|
}
|
||||||
|
//if ip has changed delete the session from cache and db
|
||||||
|
if($session_info->session_key == $session_key && $session_info->ipaddress != $_SERVER['REMOTE_ADDR'])
|
||||||
|
{
|
||||||
|
if($oCacheHandler->isSupport()) $oCacheHandler->delete($cache_key);
|
||||||
|
executeQuery('session.deleteSession', $args);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
function write($session_key, $val) {
|
$args->expired = date("YmdHis", time()+$this->lifetime);
|
||||||
if(!$session_key || !$this->session_started) return;
|
$args->val = $val;
|
||||||
$oCacheHandler = &CacheHandler::getInstance('object');
|
$args->cur_mid = Context::get('mid');
|
||||||
if($oCacheHandler->isSupport()) {
|
if(!$args->cur_mid)
|
||||||
$cache_key = 'object:'.$session_key;
|
{
|
||||||
$cache_vars = $oCacheHandler->get($cache_key);
|
$module_info = Context::get('current_module_info');
|
||||||
}
|
$args->cur_mid = $module_info->mid;
|
||||||
|
}
|
||||||
$args->session_key = $session_key;
|
|
||||||
if($cache_vars) $session_info = $cache_vars;
|
|
||||||
else {
|
|
||||||
$output = executeQuery('session.getSession', $args);
|
|
||||||
$session_info = $output->data;
|
|
||||||
}
|
|
||||||
//if ip has changed delete the session from cache and db
|
|
||||||
if($session_info->session_key == $session_key && $session_info->ipaddress != $_SERVER['REMOTE_ADDR']) {
|
|
||||||
if($oCacheHandler->isSupport()) $oCacheHandler->delete($cache_key);
|
|
||||||
executeQuery('session.deleteSession', $args);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$args->expired = date("YmdHis", time()+$this->lifetime);
|
if(Context::get('is_logged'))
|
||||||
$args->val = $val;
|
{
|
||||||
$args->cur_mid = Context::get('mid');
|
$logged_info = Context::get('logged_info');
|
||||||
if(!$args->cur_mid) {
|
$args->member_srl = $logged_info->member_srl;
|
||||||
$module_info = Context::get('current_module_info');
|
}
|
||||||
$args->cur_mid = $module_info->mid;
|
else
|
||||||
}
|
{
|
||||||
|
$args->member_srl = 0;
|
||||||
|
}
|
||||||
|
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||||
|
$args->last_update = date("YmdHis", time());
|
||||||
|
$diff = $args->last_update - $cache_vars->last_update;
|
||||||
|
//verify if session values have changed
|
||||||
|
if($val == $cache_vars->val)
|
||||||
|
{
|
||||||
|
// if more than 5 minutes passed than modify the db session also
|
||||||
|
if($diff > 300)
|
||||||
|
{
|
||||||
|
//put session into cache
|
||||||
|
if($oCacheHandler->isSupport())
|
||||||
|
{
|
||||||
|
$cache_key = 'object:'.$session_key;
|
||||||
|
$oCacheHandler->put($cache_key,$args);
|
||||||
|
}
|
||||||
|
//put session into db
|
||||||
|
if($session_info->session_key) $output = executeQuery('session.updateSession', $args);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//put session into cache
|
||||||
|
if($oCacheHandler->isSupport())
|
||||||
|
{
|
||||||
|
$cache_key = 'object:'.$session_key;
|
||||||
|
$oCacheHandler->put($cache_key,$args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//put session into cache
|
||||||
|
if($oCacheHandler->isSupport())
|
||||||
|
{
|
||||||
|
$cache_key = 'object:'.$session_key;
|
||||||
|
$oCacheHandler->put($cache_key,$args);
|
||||||
|
}
|
||||||
|
//put session into db
|
||||||
|
if($session_info->session_key) $output = executeQuery('session.updateSession', $args);
|
||||||
|
else $output = executeQuery('session.insertSession', $args);
|
||||||
|
}
|
||||||
|
|
||||||
if(Context::get('is_logged')) {
|
return true;
|
||||||
$logged_info = Context::get('logged_info');
|
}
|
||||||
$args->member_srl = $logged_info->member_srl;
|
|
||||||
} else {
|
|
||||||
$args->member_srl = 0;
|
|
||||||
}
|
|
||||||
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
|
|
||||||
$args->last_update = date("YmdHis", time());
|
|
||||||
$diff = $args->last_update - $cache_vars->last_update;
|
|
||||||
//verify if session values have changed
|
|
||||||
if($val == $cache_vars->val){
|
|
||||||
// if more than 5 minutes passed than modify the db session also
|
|
||||||
if($diff > 300){
|
|
||||||
//put session into cache
|
|
||||||
if($oCacheHandler->isSupport()) {
|
|
||||||
$cache_key = 'object:'.$session_key;
|
|
||||||
$oCacheHandler->put($cache_key,$args);
|
|
||||||
}
|
|
||||||
//put session into db
|
|
||||||
if($session_info->session_key) $output = executeQuery('session.updateSession', $args);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//put session into cache
|
|
||||||
if($oCacheHandler->isSupport()) {
|
|
||||||
$cache_key = 'object:'.$session_key;
|
|
||||||
$oCacheHandler->put($cache_key,$args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//put session into cache
|
|
||||||
if($oCacheHandler->isSupport()) {
|
|
||||||
$cache_key = 'object:'.$session_key;
|
|
||||||
$oCacheHandler->put($cache_key,$args);
|
|
||||||
}
|
|
||||||
//put session into db
|
|
||||||
if($session_info->session_key) $output = executeQuery('session.updateSession', $args);
|
|
||||||
else $output = executeQuery('session.insertSession', $args);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function destroy($session_key) {
|
function destroy($session_key)
|
||||||
if(!$session_key || !$this->session_started) return;
|
{
|
||||||
//remove session from cache
|
if(!$session_key || !$this->session_started) return;
|
||||||
$oCacheHandler = &CacheHandler::getInstance('object');
|
//remove session from cache
|
||||||
if($oCacheHandler->isSupport()) {
|
$oCacheHandler = &CacheHandler::getInstance('object');
|
||||||
$cache_key = 'object:'.$session_key;
|
if($oCacheHandler->isSupport())
|
||||||
$oCacheHandler->delete($cache_key);
|
{
|
||||||
}
|
$cache_key = 'object:'.$session_key;
|
||||||
//remove session from db
|
$oCacheHandler->delete($cache_key);
|
||||||
$args->session_key = $session_key;
|
}
|
||||||
executeQuery('session.deleteSession', $args);
|
//remove session from db
|
||||||
return true;
|
$args->session_key = $session_key;
|
||||||
}
|
executeQuery('session.deleteSession', $args);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
function gc($maxlifetime) {
|
function gc($maxlifetime)
|
||||||
if(!$this->session_started) return;
|
{
|
||||||
$expired_sessions = executeQueryArray('session.getExpiredSessions');
|
if(!$this->session_started) return;
|
||||||
if($expired_session){
|
$expired_sessions = executeQueryArray('session.getExpiredSessions');
|
||||||
foreach ($expired_sessions as $session_key){
|
if($expired_session)
|
||||||
//remove session from cache
|
{
|
||||||
$oCacheHandler = &CacheHandler::getInstance('object');
|
foreach ($expired_sessions as $session_key)
|
||||||
if($oCacheHandler->isSupport()) {
|
{
|
||||||
$cache_key = 'object:'.$session_key;
|
//remove session from cache
|
||||||
$oCacheHandler->delete($cache_key);
|
$oCacheHandler = &CacheHandler::getInstance('object');
|
||||||
}
|
if($oCacheHandler->isSupport())
|
||||||
}
|
{
|
||||||
}
|
$cache_key = 'object:'.$session_key;
|
||||||
executeQuery('session.gcSession');
|
$oCacheHandler->delete($cache_key);
|
||||||
return true;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
executeQuery('session.gcSession');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* End of file session.controller.php */
|
||||||
|
/* Location: ./modules/session/session.controller.php */
|
||||||
|
|
|
||||||
|
|
@ -1,100 +1,113 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @class sessionModel
|
* @class sessionModel
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief The Model class of the session module
|
* @brief The Model class of the session module
|
||||||
**/
|
*/
|
||||||
|
class sessionModel extends session
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @brief Initialization
|
||||||
|
*/
|
||||||
|
function init()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
class sessionModel extends session {
|
function getLifeTime()
|
||||||
|
{
|
||||||
|
return $this->lifetime;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
function read($session_key)
|
||||||
* @brief Initialization
|
{
|
||||||
**/
|
if(!$session_key || !$this->session_started) return;
|
||||||
function init() {
|
|
||||||
}
|
|
||||||
|
|
||||||
function getLifeTime() {
|
$oCacheHandler = &CacheHandler::getInstance('object');
|
||||||
return $this->lifetime;
|
if($oCacheHandler->isSupport())
|
||||||
}
|
{
|
||||||
|
$cache_key = 'object:'.$session_key;
|
||||||
function read($session_key) {
|
$output->data = $oCacheHandler->get($cache_key);
|
||||||
if(!$session_key || !$this->session_started) return;
|
}
|
||||||
|
if(!$output->data)
|
||||||
$oCacheHandler = &CacheHandler::getInstance('object');
|
{
|
||||||
if($oCacheHandler->isSupport()){
|
$args->session_key = $session_key;
|
||||||
$cache_key = 'object:'.$session_key;
|
$columnList = array('session_key', 'cur_mid', 'val');
|
||||||
$output->data = $oCacheHandler->get($cache_key);
|
$output = executeQuery('session.getSession', $args, $columnList);
|
||||||
|
// Confirm there is a table created if read error occurs
|
||||||
|
if(!$output->toBool())
|
||||||
|
{
|
||||||
|
$oDB = &DB::getInstance();
|
||||||
|
if(!$oDB->isTableExists('session')) $oDB->createTableByXmlFile($this->module_path.'schemas/session.xml');
|
||||||
|
if(!$oDB->isColumnExists("session","cur_mid")) $oDB->addColumn('session',"cur_mid","varchar",128);
|
||||||
|
$output = executeQuery('session.getSession', $args);
|
||||||
}
|
}
|
||||||
if(!$output->data) {
|
// Check if there is a table created in case there is no "cur_mid" value in the sessions information
|
||||||
|
if(!isset($output->data->cur_mid))
|
||||||
$args->session_key = $session_key;
|
{
|
||||||
$columnList = array('session_key', 'cur_mid', 'val');
|
$oDB = &DB::getInstance();
|
||||||
$output = executeQuery('session.getSession', $args, $columnList);
|
if(!$oDB->isColumnExists("session","cur_mid")) $oDB->addColumn('session',"cur_mid","varchar",128);
|
||||||
// Confirm there is a table created if read error occurs
|
|
||||||
if(!$output->toBool()) {
|
|
||||||
$oDB = &DB::getInstance();
|
|
||||||
if(!$oDB->isTableExists('session')) $oDB->createTableByXmlFile($this->module_path.'schemas/session.xml');
|
|
||||||
if(!$oDB->isColumnExists("session","cur_mid")) $oDB->addColumn('session',"cur_mid","varchar",128);
|
|
||||||
$output = executeQuery('session.getSession', $args);
|
|
||||||
}
|
|
||||||
// Check if there is a table created in case there is no "cur_mid" value in the sessions information
|
|
||||||
if(!isset($output->data->cur_mid)) {
|
|
||||||
$oDB = &DB::getInstance();
|
|
||||||
if(!$oDB->isColumnExists("session","cur_mid")) $oDB->addColumn('session',"cur_mid","varchar",128);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return $output->data->val;
|
}
|
||||||
}
|
return $output->data->val;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get a list of currently connected users
|
* @brief Get a list of currently connected users
|
||||||
* Requires "object" argument because multiple arguments are expected
|
* Requires "object" argument because multiple arguments are expected
|
||||||
* limit_count : the number of objects
|
* limit_count : the number of objects
|
||||||
* page : the page number
|
* page : the page number
|
||||||
* period_time: "n" specifies the time range in minutes since the last update
|
* period_time: "n" specifies the time range in minutes since the last update
|
||||||
* mid: a user who belong to a specified mid
|
* mid: a user who belong to a specified mid
|
||||||
**/
|
*/
|
||||||
function getLoggedMembers($args) {
|
function getLoggedMembers($args)
|
||||||
if(!$args->site_srl) {
|
{
|
||||||
$site_module_info = Context::get('site_module_info');
|
if(!$args->site_srl)
|
||||||
$args->site_srl = (int)$site_module_info->site_srl;
|
{
|
||||||
}
|
$site_module_info = Context::get('site_module_info');
|
||||||
if(!$args->list_count) $args->list_count = 20;
|
$args->site_srl = (int)$site_module_info->site_srl;
|
||||||
if(!$args->page) $args->page = 1;
|
}
|
||||||
if(!$args->period_time) $args->period_time = 3;
|
if(!$args->list_count) $args->list_count = 20;
|
||||||
$args->last_update = date("YmdHis", time() - $args->period_time*60);
|
if(!$args->page) $args->page = 1;
|
||||||
|
if(!$args->period_time) $args->period_time = 3;
|
||||||
|
$args->last_update = date("YmdHis", time() - $args->period_time*60);
|
||||||
|
|
||||||
$output = executeQueryArray('session.getLoggedMembers', $args);
|
$output = executeQueryArray('session.getLoggedMembers', $args);
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
|
|
||||||
$member_srls = array();
|
$member_srls = array();
|
||||||
if(count($output->data)) {
|
if(count($output->data))
|
||||||
foreach($output->data as $key => $val) {
|
{
|
||||||
$member_srls[$key] = $val->member_srl;
|
foreach($output->data as $key => $val)
|
||||||
$member_keys[$val->member_srl] = $key;
|
{
|
||||||
}
|
$member_srls[$key] = $val->member_srl;
|
||||||
}
|
$member_keys[$val->member_srl] = $key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(Context::get('is_logged')) {
|
if(Context::get('is_logged'))
|
||||||
$logged_info = Context::get('logged_info');
|
{
|
||||||
if(!in_array($logged_info->member_srl, $member_srls)) {
|
$logged_info = Context::get('logged_info');
|
||||||
$member_srls[0] = $logged_info->member_srl;
|
if(!in_array($logged_info->member_srl, $member_srls))
|
||||||
$member_keys[$logged_info->member_srl] = 0;
|
{
|
||||||
}
|
$member_srls[0] = $logged_info->member_srl;
|
||||||
}
|
$member_keys[$logged_info->member_srl] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!count($member_srls)) return $output;
|
if(!count($member_srls)) return $output;
|
||||||
|
|
||||||
$member_args->member_srl = implode(',',$member_srls);
|
$member_args->member_srl = implode(',',$member_srls);
|
||||||
$member_output = executeQueryArray('member.getMembers', $member_args);
|
$member_output = executeQueryArray('member.getMembers', $member_args);
|
||||||
if($member_output->data) {
|
if($member_output->data)
|
||||||
foreach($member_output->data as $key => $val) {
|
{
|
||||||
$output->data[$member_keys[$val->member_srl]] = $val;
|
foreach($member_output->data as $key => $val)
|
||||||
}
|
{
|
||||||
}
|
$output->data[$member_keys[$val->member_srl]] = $val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
/* End of file session.model.php */
|
||||||
|
/* Location: ./modules/session/session.model.php */
|
||||||
|
|
|
||||||
|
|
@ -1,127 +1,137 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @class spamfilterAdminController
|
* @class spamfilterAdminController
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief The admin controller class of the spamfilter module
|
* @brief The admin controller class of the spamfilter module
|
||||||
**/
|
*/
|
||||||
|
class spamfilterAdminController extends spamfilter
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @brief Initialization
|
||||||
|
*/
|
||||||
|
function init()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
class spamfilterAdminController extends spamfilter {
|
function procSpamfilterAdminInsertConfig()
|
||||||
|
{
|
||||||
|
// Get the default information
|
||||||
|
$argsConfig = Context::gets('limits','check_trackback');
|
||||||
|
$flag = Context::get('flag');
|
||||||
|
//interval, limit_count
|
||||||
|
if($argsConfig->check_trackback!='Y') $argsConfig->check_trackback = 'N';
|
||||||
|
if($argsConfig->limits!='Y') $argsConfig->limits = 'N';
|
||||||
|
// Create and insert the module Controller object
|
||||||
|
$oModuleController = &getController('module');
|
||||||
|
$moduleConfigOutput = $oModuleController->insertModuleConfig('spamfilter',$argsConfig);
|
||||||
|
if(!$moduleConfigOutput->toBool()) return $moduleConfigOutput;
|
||||||
|
|
||||||
/**
|
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminConfigBlock');
|
||||||
* @brief Initialization
|
$this->setRedirectUrl($returnUrl);
|
||||||
**/
|
}
|
||||||
function init() {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
function procSpamfilterAdminInsertDeniedIP()
|
||||||
function procSpamfilterAdminInsertConfig() {
|
{
|
||||||
|
//스팸IP 추가
|
||||||
// Get the default information
|
$ipaddress_list = Context::get('ipaddress_list');
|
||||||
$argsConfig = Context::gets('limits','check_trackback');
|
$oSpamfilterController = &getController('spamfilter');
|
||||||
$flag = Context::get('flag');
|
if($ipaddress_list)
|
||||||
//interval, limit_count
|
{
|
||||||
if($argsConfig->check_trackback!='Y') $argsConfig->check_trackback = 'N';
|
$output = $oSpamfilterController->insertIP($ipaddress_list);
|
||||||
if($argsConfig->limits!='Y') $argsConfig->limits = 'N';
|
if(!$output->toBool() && !$output->get('fail_list')) return $output;
|
||||||
// Create and insert the module Controller object
|
|
||||||
$oModuleController = &getController('module');
|
|
||||||
$moduleConfigOutput = $oModuleController->insertModuleConfig('spamfilter',$argsConfig);
|
|
||||||
if(!$moduleConfigOutput->toBool()) return $moduleConfigOutput;
|
|
||||||
|
|
||||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminConfigBlock');
|
|
||||||
$this->setRedirectUrl($returnUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function procSpamfilterAdminInsertDeniedIP(){
|
if($output->get('fail_list')) $message_fail = '<em>'.sprintf(Context::getLang('msg_faillist'),$output->get('fail_list')).'</em>';
|
||||||
//스팸IP 추가
|
$this->setMessage(Context::getLang('success_registed').$message_fail);
|
||||||
$ipaddress_list = Context::get('ipaddress_list');
|
|
||||||
$oSpamfilterController = &getController('spamfilter');
|
|
||||||
if($ipaddress_list){
|
|
||||||
$output = $oSpamfilterController->insertIP($ipaddress_list);
|
|
||||||
if(!$output->toBool() && !$output->get('fail_list')) return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($output->get('fail_list')) $message_fail = '<em>'.sprintf(Context::getLang('msg_faillist'),$output->get('fail_list')).'</em>';
|
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminDeniedIPList');
|
||||||
$this->setMessage(Context::getLang('success_registed').$message_fail);
|
$this->setRedirectUrl($returnUrl);
|
||||||
|
}
|
||||||
|
|
||||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminDeniedIPList');
|
function procSpamfilterAdminInsertDeniedWord()
|
||||||
$this->setRedirectUrl($returnUrl);
|
{
|
||||||
|
//스팸 키워드 추가
|
||||||
|
$word_list = Context::get('word_list');
|
||||||
|
if($word_list)
|
||||||
|
{
|
||||||
|
$output = $this->insertWord($word_list);
|
||||||
|
if(!$output->toBool() && !$output->get('fail_list')) return $output;
|
||||||
}
|
}
|
||||||
function procSpamfilterAdminInsertDeniedWord(){
|
if($output->get('fail_list')) $message_fail = '<em>'.sprintf(Context::getLang('msg_faillist'),$output->get('fail_list')).'</em>';
|
||||||
//스팸 키워드 추가
|
$this->setMessage(Context::getLang('success_registed').$message_fail);
|
||||||
$word_list = Context::get('word_list');
|
|
||||||
if($word_list){
|
|
||||||
$output = $this->insertWord($word_list);
|
|
||||||
if(!$output->toBool() && !$output->get('fail_list')) return $output;
|
|
||||||
}
|
|
||||||
if($output->get('fail_list')) $message_fail = '<em>'.sprintf(Context::getLang('msg_faillist'),$output->get('fail_list')).'</em>';
|
|
||||||
$this->setMessage(Context::getLang('success_registed').$message_fail);
|
|
||||||
|
|
||||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminDeniedWordList');
|
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminDeniedWordList');
|
||||||
$this->setRedirectUrl($returnUrl);
|
$this->setRedirectUrl($returnUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Delete the banned IP
|
||||||
|
*/
|
||||||
|
function procSpamfilterAdminDeleteDeniedIP()
|
||||||
|
{
|
||||||
|
$ipaddress = Context::get('ipaddress');
|
||||||
|
$output = $this->deleteIP($ipaddress);
|
||||||
|
|
||||||
|
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminDeniedIPList');
|
||||||
|
return $this->setRedirectUrl($returnUrl, $output);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Delete the prohibited Word
|
||||||
|
*/
|
||||||
|
function procSpamfilterAdminDeleteDeniedWord()
|
||||||
|
{
|
||||||
|
$word = Context::get('word');
|
||||||
|
//$word = base64_decode(Context::get('word'));
|
||||||
|
$output = $this->deleteWord($word);
|
||||||
|
|
||||||
|
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminDeniedWordList','active','word');
|
||||||
|
return $this->setRedirectUrl($returnUrl, $output);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Delete IP
|
||||||
|
* Remove the IP address which was previously registered as a spammers
|
||||||
|
*/
|
||||||
|
function deleteIP($ipaddress)
|
||||||
|
{
|
||||||
|
if(!$ipaddress) return;
|
||||||
|
|
||||||
|
$args->ipaddress = $ipaddress;
|
||||||
|
return executeQuery('spamfilter.deleteDeniedIP', $args);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Register the spam word
|
||||||
|
* The post, which contains the newly registered spam word, should be considered as a spam
|
||||||
|
*/
|
||||||
|
function insertWord($word_list)
|
||||||
|
{
|
||||||
|
if(!preg_match("/^(.{2,40}\s*)*$/",$word_list)) return new Object(-1, 'msg_invalid');
|
||||||
|
|
||||||
|
$word_list = str_replace("\r","",$word_list);
|
||||||
|
$word_list = explode("\n",$word_list);
|
||||||
|
$fail_word = '';
|
||||||
|
foreach($word_list as $word)
|
||||||
|
{
|
||||||
|
if(trim($word)) $args->word = $word;
|
||||||
|
$output = executeQuery('spamfilter.insertDeniedWord', $args);
|
||||||
|
if(!$output->toBool()) $fail_word .= $word.'<br />';
|
||||||
}
|
}
|
||||||
|
$output->add('fail_list',$fail_word);
|
||||||
/**
|
return $output;
|
||||||
* @brief Delete the banned IP
|
}
|
||||||
**/
|
|
||||||
function procSpamfilterAdminDeleteDeniedIP() {
|
|
||||||
$ipaddress = Context::get('ipaddress');
|
|
||||||
$output = $this->deleteIP($ipaddress);
|
|
||||||
|
|
||||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminDeniedIPList');
|
/**
|
||||||
return $this->setRedirectUrl($returnUrl, $output);
|
* @brief Remove the spam word
|
||||||
}
|
* Remove the word which was previously registered as a spam word
|
||||||
|
*/
|
||||||
/**
|
function deleteWord($word)
|
||||||
* @brief Delete the prohibited Word
|
{
|
||||||
**/
|
if(!$word) return;
|
||||||
function procSpamfilterAdminDeleteDeniedWord() {
|
$args->word = $word;
|
||||||
$word = Context::get('word');
|
return executeQuery('spamfilter.deleteDeniedWord', $args);
|
||||||
//$word = base64_decode(Context::get('word'));
|
}
|
||||||
$output = $this->deleteWord($word);
|
}
|
||||||
|
/* End of file spamfilter.admin.controller.php */
|
||||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminDeniedWordList','active','word');
|
/* Location: ./modules/spamfilter/spamfilter.admin.controller.php */
|
||||||
return $this->setRedirectUrl($returnUrl, $output);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Delete IP
|
|
||||||
* Remove the IP address which was previously registered as a spammers
|
|
||||||
**/
|
|
||||||
function deleteIP($ipaddress) {
|
|
||||||
if(!$ipaddress) return;
|
|
||||||
|
|
||||||
$args->ipaddress = $ipaddress;
|
|
||||||
return executeQuery('spamfilter.deleteDeniedIP', $args);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Register the spam word
|
|
||||||
* The post, which contains the newly registered spam word, should be considered as a spam
|
|
||||||
**/
|
|
||||||
function insertWord($word_list) {
|
|
||||||
if(!preg_match("/^(.{2,40}\s*)*$/",$word_list)) return new Object(-1, 'msg_invalid');
|
|
||||||
|
|
||||||
$word_list = str_replace("\r","",$word_list);
|
|
||||||
$word_list = explode("\n",$word_list);
|
|
||||||
$fail_word = '';
|
|
||||||
foreach($word_list as $word) {
|
|
||||||
if(trim($word)) $args->word = $word;
|
|
||||||
$output = executeQuery('spamfilter.insertDeniedWord', $args);
|
|
||||||
if(!$output->toBool()) $fail_word .= $word.'<br />';
|
|
||||||
}
|
|
||||||
$output->add('fail_list',$fail_word);
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Remove the spam word
|
|
||||||
* Remove the word which was previously registered as a spam word
|
|
||||||
**/
|
|
||||||
function deleteWord($word) {
|
|
||||||
if(!$word) return;
|
|
||||||
$args->word = $word;
|
|
||||||
return executeQuery('spamfilter.deleteDeniedWord', $args);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,13 @@
|
||||||
* @class spamfilterAdminView
|
* @class spamfilterAdminView
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief The admin view class of the spamfilter module
|
* @brief The admin view class of the spamfilter module
|
||||||
**/
|
*/
|
||||||
|
|
||||||
class spamfilterAdminView extends spamfilter
|
class spamfilterAdminView extends spamfilter
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @brief Initialization
|
* @brief Initialization
|
||||||
**/
|
*/
|
||||||
function init()
|
function init()
|
||||||
{
|
{
|
||||||
// Set template path
|
// Set template path
|
||||||
$this->setTemplatePath($this->module_path.'tpl');
|
$this->setTemplatePath($this->module_path.'tpl');
|
||||||
|
|
@ -18,7 +17,7 @@ class spamfilterAdminView extends spamfilter
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Output the list of banned IPs
|
* @brief Output the list of banned IPs
|
||||||
**/
|
*/
|
||||||
function dispSpamfilterAdminDeniedIPList()
|
function dispSpamfilterAdminDeniedIPList()
|
||||||
{
|
{
|
||||||
// Get the list of denied IP addresses and words
|
// Get the list of denied IP addresses and words
|
||||||
|
|
@ -36,7 +35,7 @@ class spamfilterAdminView extends spamfilter
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Output the list of banned words
|
* @brief Output the list of banned words
|
||||||
**/
|
*/
|
||||||
function dispSpamfilterAdminDeniedWordList()
|
function dispSpamfilterAdminDeniedWordList()
|
||||||
{
|
{
|
||||||
// Get the list of denied IP addresses and words
|
// Get the list of denied IP addresses and words
|
||||||
|
|
@ -53,7 +52,7 @@ class spamfilterAdminView extends spamfilter
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configure auto block
|
* @brief Configure auto block
|
||||||
**/
|
*/
|
||||||
function dispSpamfilterAdminConfigBlock()
|
function dispSpamfilterAdminConfigBlock()
|
||||||
{
|
{
|
||||||
// Get configurations (using module model object)
|
// Get configurations (using module model object)
|
||||||
|
|
@ -63,5 +62,6 @@ class spamfilterAdminView extends spamfilter
|
||||||
|
|
||||||
$this->setTemplateFile('config_block');
|
$this->setTemplateFile('config_block');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
/* End of file spamfilter.admin.view.php */
|
||||||
|
/* Location: ./modules/spamfilter/spamfilter.admin.view.php */
|
||||||
|
|
|
||||||
|
|
@ -1,101 +1,109 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @class spamfilter
|
* @class spamfilter
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief The parent class of the spamfilter module
|
* @brief The parent class of the spamfilter module
|
||||||
**/
|
*/
|
||||||
|
class spamfilter extends ModuleObject
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @brief Additional tasks required to accomplish during the installation
|
||||||
|
*/
|
||||||
|
function moduleInstall()
|
||||||
|
{
|
||||||
|
// Register action forward (to use in administrator mode)
|
||||||
|
$oModuleController = &getController('module');
|
||||||
|
// 2007.12.7 The triggers which try to perform spam filtering when new posts/comments/trackbacks are registered
|
||||||
|
$oModuleController->insertTrigger('document.insertDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before');
|
||||||
|
$oModuleController->insertTrigger('comment.insertComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before');
|
||||||
|
$oModuleController->insertTrigger('trackback.insertTrackback', 'spamfilter', 'controller', 'triggerInsertTrackback', 'before');
|
||||||
|
// 2008-12-17 Add a spamfilter for post modification actions
|
||||||
|
$oModuleController->insertTrigger('comment.updateComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before');
|
||||||
|
$oModuleController->insertTrigger('document.updateDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before');
|
||||||
|
|
||||||
class spamfilter extends ModuleObject {
|
return new Object();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Additional tasks required to accomplish during the installation
|
* @brief A method to check if the installation has been successful
|
||||||
**/
|
*/
|
||||||
function moduleInstall() {
|
function checkUpdate()
|
||||||
// Register action forward (to use in administrator mode)
|
{
|
||||||
$oModuleController = &getController('module');
|
$oDB = &DB::getInstance();
|
||||||
// 2007.12.7 The triggers which try to perform spam filtering when new posts/comments/trackbacks are registered
|
$oModuleModel = &getModel('module');
|
||||||
$oModuleController->insertTrigger('document.insertDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before');
|
// 2007.12.7 The triggers which try to perform spam filtering when new posts/comments/trackbacks are registered
|
||||||
$oModuleController->insertTrigger('comment.insertComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before');
|
if(!$oModuleModel->getTrigger('document.insertDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before')) return true;
|
||||||
$oModuleController->insertTrigger('trackback.insertTrackback', 'spamfilter', 'controller', 'triggerInsertTrackback', 'before');
|
if(!$oModuleModel->getTrigger('comment.insertComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before')) return true;
|
||||||
// 2008-12-17 Add a spamfilter for post modification actions
|
if(!$oModuleModel->getTrigger('trackback.insertTrackback', 'spamfilter', 'controller', 'triggerInsertTrackback', 'before')) return true;
|
||||||
$oModuleController->insertTrigger('comment.updateComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before');
|
// 2008-12-17 Add a spamfilter for post modification actions
|
||||||
$oModuleController->insertTrigger('document.updateDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before');
|
if(!$oModuleModel->getTrigger('comment.updateComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before')) return true;
|
||||||
|
if(!$oModuleModel->getTrigger('document.updateDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before')) return true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the hit count field (hit)
|
||||||
|
*/
|
||||||
|
if(!$oDB->isColumnExists('spamfilter_denied_word', 'hit')) return true;
|
||||||
|
if(!$oDB->isColumnExists('spamfilter_denied_word', 'latest_hit')) return true;
|
||||||
|
|
||||||
return new Object();
|
if(!$oDB->isColumnExists('spamfilter_denied_ip', 'description')) return true;
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
return false;
|
||||||
* @brief A method to check if the installation has been successful
|
}
|
||||||
**/
|
|
||||||
function checkUpdate() {
|
|
||||||
$oDB = &DB::getInstance();
|
|
||||||
$oModuleModel = &getModel('module');
|
|
||||||
// 2007.12.7 The triggers which try to perform spam filtering when new posts/comments/trackbacks are registered
|
|
||||||
if(!$oModuleModel->getTrigger('document.insertDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before')) return true;
|
|
||||||
if(!$oModuleModel->getTrigger('comment.insertComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before')) return true;
|
|
||||||
if(!$oModuleModel->getTrigger('trackback.insertTrackback', 'spamfilter', 'controller', 'triggerInsertTrackback', 'before')) return true;
|
|
||||||
// 2008-12-17 Add a spamfilter for post modification actions
|
|
||||||
if(!$oModuleModel->getTrigger('comment.updateComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before')) return true;
|
|
||||||
if(!$oModuleModel->getTrigger('document.updateDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before')) return true;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the hit count field (hit)
|
* @brief Execute update
|
||||||
**/
|
*/
|
||||||
if(!$oDB->isColumnExists('spamfilter_denied_word', 'hit')) return true;
|
function moduleUpdate()
|
||||||
if(!$oDB->isColumnExists('spamfilter_denied_word', 'latest_hit')) return true;
|
{
|
||||||
|
$oDB = &DB::getInstance();
|
||||||
|
$oModuleModel = &getModel('module');
|
||||||
|
$oModuleController = &getController('module');
|
||||||
|
// 2007.12.7 The triggers which try to perform spam filtering when new posts/comments/trackbacks are registered
|
||||||
|
if(!$oModuleModel->getTrigger('document.insertDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before'))
|
||||||
|
$oModuleController->insertTrigger('document.insertDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before');
|
||||||
|
if(!$oModuleModel->getTrigger('comment.insertComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before'))
|
||||||
|
$oModuleController->insertTrigger('comment.insertComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before');
|
||||||
|
if(!$oModuleModel->getTrigger('trackback.insertTrackback', 'spamfilter', 'controller', 'triggerInsertTrackback', 'before'))
|
||||||
|
$oModuleController->insertTrigger('trackback.insertTrackback', 'spamfilter', 'controller', 'triggerInsertTrackback', 'before');
|
||||||
|
// 2008-12-17 Add a spamfilter for post modification actions
|
||||||
|
if(!$oModuleModel->getTrigger('comment.updateComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before'))
|
||||||
|
{
|
||||||
|
$oModuleController->insertTrigger('comment.updateComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before');
|
||||||
|
}
|
||||||
|
// 2008-12-17 Add a spamfilter for post modification actions
|
||||||
|
if(!$oModuleModel->getTrigger('document.updateDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before'))
|
||||||
|
{
|
||||||
|
$oModuleController->insertTrigger('document.updateDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before');
|
||||||
|
}
|
||||||
|
|
||||||
if(!$oDB->isColumnExists('spamfilter_denied_ip', 'description')) return true;
|
/**
|
||||||
|
* Add the hit count field (hit)
|
||||||
|
*/
|
||||||
|
if(!$oDB->isColumnExists('spamfilter_denied_word', 'hit'))
|
||||||
|
{
|
||||||
|
$oDB->addColumn('spamfilter_denied_word','hit','number',12,0,true);
|
||||||
|
$oDB->addIndex('spamfilter_denied_word','idx_hit', 'hit');
|
||||||
|
}
|
||||||
|
if(!$oDB->isColumnExists('spamfilter_denied_word', 'latest_hit'))
|
||||||
|
{
|
||||||
|
$oDB->addColumn('spamfilter_denied_word','latest_hit','date');
|
||||||
|
$oDB->addIndex('spamfilter_denied_word','idx_latest_hit', 'latest_hit');
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
if(!$oDB->isColumnExists('spamfilter_denied_ip', 'description'))
|
||||||
}
|
{
|
||||||
|
$oDB->addColumn('spamfilter_denied_ip','description','varchar', 250);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
return new Object(0,'success_updated');
|
||||||
* @brief Execute update
|
}
|
||||||
**/
|
|
||||||
function moduleUpdate() {
|
|
||||||
$oDB = &DB::getInstance();
|
|
||||||
$oModuleModel = &getModel('module');
|
|
||||||
$oModuleController = &getController('module');
|
|
||||||
// 2007.12.7 The triggers which try to perform spam filtering when new posts/comments/trackbacks are registered
|
|
||||||
if(!$oModuleModel->getTrigger('document.insertDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before'))
|
|
||||||
$oModuleController->insertTrigger('document.insertDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before');
|
|
||||||
if(!$oModuleModel->getTrigger('comment.insertComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before'))
|
|
||||||
$oModuleController->insertTrigger('comment.insertComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before');
|
|
||||||
if(!$oModuleModel->getTrigger('trackback.insertTrackback', 'spamfilter', 'controller', 'triggerInsertTrackback', 'before'))
|
|
||||||
$oModuleController->insertTrigger('trackback.insertTrackback', 'spamfilter', 'controller', 'triggerInsertTrackback', 'before');
|
|
||||||
// 2008-12-17 Add a spamfilter for post modification actions
|
|
||||||
if(!$oModuleModel->getTrigger('comment.updateComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before')){
|
|
||||||
$oModuleController->insertTrigger('comment.updateComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before');
|
|
||||||
}
|
|
||||||
// 2008-12-17 Add a spamfilter for post modification actions
|
|
||||||
if(!$oModuleModel->getTrigger('document.updateDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before')){
|
|
||||||
$oModuleController->insertTrigger('document.updateDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the hit count field (hit)
|
* @brief Re-generate the cache file
|
||||||
**/
|
*/
|
||||||
if(!$oDB->isColumnExists('spamfilter_denied_word', 'hit')) {
|
function recompileCache()
|
||||||
$oDB->addColumn('spamfilter_denied_word','hit','number',12,0,true);
|
{
|
||||||
$oDB->addIndex('spamfilter_denied_word','idx_hit', 'hit');
|
}
|
||||||
}
|
}
|
||||||
if(!$oDB->isColumnExists('spamfilter_denied_word', 'latest_hit')) {
|
/* End of file spamfilter.class.php */
|
||||||
$oDB->addColumn('spamfilter_denied_word','latest_hit','date');
|
/* Location: ./modules/spamfilter/spamfilter.class.controller.php */
|
||||||
$oDB->addIndex('spamfilter_denied_word','idx_latest_hit', 'latest_hit');
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!$oDB->isColumnExists('spamfilter_denied_ip', 'description')) {
|
|
||||||
$oDB->addColumn('spamfilter_denied_ip','description','varchar', 250);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Object(0,'success_updated');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Re-generate the cache file
|
|
||||||
**/
|
|
||||||
function recompileCache() {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
|
||||||
|
|
@ -1,171 +1,184 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @class spamfilterController
|
* @class spamfilterController
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief The controller class for the spamfilter module
|
* @brief The controller class for the spamfilter module
|
||||||
**/
|
*/
|
||||||
|
class spamfilterController extends spamfilter
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @brief Initialization
|
||||||
|
*/
|
||||||
|
function init()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
class spamfilterController extends spamfilter {
|
/**
|
||||||
|
* @brief Call this function in case you need to stop the spam filter's usage during the batch work
|
||||||
|
*/
|
||||||
|
function setAvoidLog()
|
||||||
|
{
|
||||||
|
$_SESSION['avoid_log'] = true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialization
|
* @brief The routine process to check the time it takes to store a document, when writing it, and to ban IP/word
|
||||||
**/
|
*/
|
||||||
function init() {
|
function triggerInsertDocument(&$obj)
|
||||||
}
|
{
|
||||||
|
if($_SESSION['avoid_log']) return new Object();
|
||||||
|
// Check the login status, login information, and permission
|
||||||
|
$is_logged = Context::get('is_logged');
|
||||||
|
$logged_info = Context::get('logged_info');
|
||||||
|
$grant = Context::get('grant');
|
||||||
|
// In case logged in, check if it is an administrator
|
||||||
|
if($is_logged)
|
||||||
|
{
|
||||||
|
if($logged_info->is_admin == 'Y') return new Object();
|
||||||
|
if($grant->manager) return new Object();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
$oFilterModel = &getModel('spamfilter');
|
||||||
* @brief Call this function in case you need to stop the spam filter's usage during the batch work
|
// Check if the IP is prohibited
|
||||||
**/
|
$output = $oFilterModel->isDeniedIP();
|
||||||
function setAvoidLog() {
|
if(!$output->toBool()) return $output;
|
||||||
$_SESSION['avoid_log'] = true;
|
// Check if there is a ban on the word
|
||||||
}
|
$text = $obj->title.$obj->content;
|
||||||
|
$output = $oFilterModel->isDeniedWord($text);
|
||||||
|
if(!$output->toBool()) return $output;
|
||||||
|
// Check the specified time beside the modificaiton time
|
||||||
|
if($obj->document_srl == 0)
|
||||||
|
{
|
||||||
|
$output = $oFilterModel->checkLimited();
|
||||||
|
if(!$output->toBool()) return $output;
|
||||||
|
}
|
||||||
|
// Save a log
|
||||||
|
$this->insertLog();
|
||||||
|
|
||||||
/**
|
return new Object();
|
||||||
* @brief The routine process to check the time it takes to store a document, when writing it, and to ban IP/word
|
}
|
||||||
**/
|
|
||||||
function triggerInsertDocument(&$obj) {
|
|
||||||
if($_SESSION['avoid_log']) return new Object();
|
|
||||||
// Check the login status, login information, and permission
|
|
||||||
$is_logged = Context::get('is_logged');
|
|
||||||
$logged_info = Context::get('logged_info');
|
|
||||||
$grant = Context::get('grant');
|
|
||||||
// In case logged in, check if it is an administrator
|
|
||||||
if($is_logged) {
|
|
||||||
if($logged_info->is_admin == 'Y') return new Object();
|
|
||||||
if($grant->manager) return new Object();
|
|
||||||
}
|
|
||||||
|
|
||||||
$oFilterModel = &getModel('spamfilter');
|
/**
|
||||||
// Check if the IP is prohibited
|
* @brief The routine process to check the time it takes to store a comment, and to ban IP/word
|
||||||
$output = $oFilterModel->isDeniedIP();
|
*/
|
||||||
if(!$output->toBool()) return $output;
|
function triggerInsertComment(&$obj)
|
||||||
// Check if there is a ban on the word
|
{
|
||||||
$text = $obj->title.$obj->content;
|
if($_SESSION['avoid_log']) return new Object();
|
||||||
$output = $oFilterModel->isDeniedWord($text);
|
// Check the login status, login information, and permission
|
||||||
if(!$output->toBool()) return $output;
|
$is_logged = Context::get('is_logged');
|
||||||
// Check the specified time beside the modificaiton time
|
$logged_info = Context::get('logged_info');
|
||||||
if($obj->document_srl == 0){
|
$grant = Context::get('grant');
|
||||||
$output = $oFilterModel->checkLimited();
|
// In case logged in, check if it is an administrator
|
||||||
if(!$output->toBool()) return $output;
|
if($is_logged)
|
||||||
}
|
{
|
||||||
// Save a log
|
if($logged_info->is_admin == 'Y') return new Object();
|
||||||
$this->insertLog();
|
if($grant->manager) return new Object();
|
||||||
|
}
|
||||||
|
|
||||||
return new Object();
|
$oFilterModel = &getModel('spamfilter');
|
||||||
}
|
// Check if the IP is prohibited
|
||||||
|
$output = $oFilterModel->isDeniedIP();
|
||||||
|
if(!$output->toBool()) return $output;
|
||||||
|
// Check if there is a ban on the word
|
||||||
|
$text = $obj->content;
|
||||||
|
$output = $oFilterModel->isDeniedWord($text);
|
||||||
|
if(!$output->toBool()) return $output;
|
||||||
|
// If the specified time check is not modified
|
||||||
|
if(!$obj->__isupdate)
|
||||||
|
{
|
||||||
|
$output = $oFilterModel->checkLimited();
|
||||||
|
if(!$output->toBool()) return $output;
|
||||||
|
}
|
||||||
|
unset($obj->__isupdate);
|
||||||
|
// Save a log
|
||||||
|
$this->insertLog();
|
||||||
|
|
||||||
/**
|
return new Object();
|
||||||
* @brief The routine process to check the time it takes to store a comment, and to ban IP/word
|
}
|
||||||
**/
|
|
||||||
function triggerInsertComment(&$obj) {
|
|
||||||
if($_SESSION['avoid_log']) return new Object();
|
|
||||||
// Check the login status, login information, and permission
|
|
||||||
$is_logged = Context::get('is_logged');
|
|
||||||
$logged_info = Context::get('logged_info');
|
|
||||||
$grant = Context::get('grant');
|
|
||||||
// In case logged in, check if it is an administrator
|
|
||||||
if($is_logged) {
|
|
||||||
if($logged_info->is_admin == 'Y') return new Object();
|
|
||||||
if($grant->manager) return new Object();
|
|
||||||
}
|
|
||||||
|
|
||||||
$oFilterModel = &getModel('spamfilter');
|
/**
|
||||||
// Check if the IP is prohibited
|
* @brief Inspect the trackback creation time and IP
|
||||||
$output = $oFilterModel->isDeniedIP();
|
*/
|
||||||
if(!$output->toBool()) return $output;
|
function triggerInsertTrackback(&$obj)
|
||||||
// Check if there is a ban on the word
|
{
|
||||||
$text = $obj->content;
|
if($_SESSION['avoid_log']) return new Object();
|
||||||
$output = $oFilterModel->isDeniedWord($text);
|
|
||||||
if(!$output->toBool()) return $output;
|
|
||||||
// If the specified time check is not modified
|
|
||||||
if(!$obj->__isupdate){
|
|
||||||
$output = $oFilterModel->checkLimited();
|
|
||||||
if(!$output->toBool()) return $output;
|
|
||||||
}
|
|
||||||
unset($obj->__isupdate);
|
|
||||||
// Save a log
|
|
||||||
$this->insertLog();
|
|
||||||
|
|
||||||
return new Object();
|
$oFilterModel = &getModel('spamfilter');
|
||||||
}
|
// Confirm if the trackbacks have been added more than once to your document
|
||||||
|
$output = $oFilterModel->isInsertedTrackback($obj->document_srl);
|
||||||
|
if(!$output->toBool()) return $output;
|
||||||
|
|
||||||
/**
|
// Check if the IP is prohibited
|
||||||
* @brief Inspect the trackback creation time and IP
|
$output = $oFilterModel->isDeniedIP();
|
||||||
**/
|
if(!$output->toBool()) return $output;
|
||||||
function triggerInsertTrackback(&$obj) {
|
// Check if there is a ban on the word
|
||||||
if($_SESSION['avoid_log']) return new Object();
|
$text = $obj->blog_name.$obj->title.$obj->excerpt.$obj->url;
|
||||||
|
$output = $oFilterModel->isDeniedWord($text);
|
||||||
|
if(!$output->toBool()) return $output;
|
||||||
|
// Start Filtering
|
||||||
|
$oTrackbackModel = &getModel('trackback');
|
||||||
|
$oTrackbackController = &getController('trackback');
|
||||||
|
|
||||||
$oFilterModel = &getModel('spamfilter');
|
list($ipA,$ipB,$ipC,$ipD) = explode('.',$_SERVER['REMOTE_ADDR']);
|
||||||
// Confirm if the trackbacks have been added more than once to your document
|
$ipaddress = $ipA.'.'.$ipB.'.'.$ipC;
|
||||||
$output = $oFilterModel->isInsertedTrackback($obj->document_srl);
|
// In case the title and the blog name are indentical, investigate the IP address of the last 6 hours, delete and ban it.
|
||||||
if(!$output->toBool()) return $output;
|
if($obj->title == $obj->excerpt)
|
||||||
|
{
|
||||||
// Check if the IP is prohibited
|
$oTrackbackController->deleteTrackbackSender(60*60*6, $ipaddress, $obj->url, $obj->blog_name, $obj->title, $obj->excerpt);
|
||||||
$output = $oFilterModel->isDeniedIP();
|
$this->insertIP($ipaddress.'.*', 'AUTO-DENIED : trackback.insertTrackback');
|
||||||
if(!$output->toBool()) return $output;
|
return new Object(-1,'msg_alert_trackback_denied');
|
||||||
// Check if there is a ban on the word
|
}
|
||||||
$text = $obj->blog_name.$obj->title.$obj->excerpt.$obj->url;
|
// If trackbacks have been registered by one C-class IP address more than once for the last 30 minutes, ban the IP address and delete all the posts
|
||||||
$output = $oFilterModel->isDeniedWord($text);
|
/* 호스팅 환경을 감안하여 일단 이 부분은 동작하지 않도록 주석 처리
|
||||||
if(!$output->toBool()) return $output;
|
$count = $oTrackbackModel->getRegistedTrackback(30*60, $ipaddress, $obj->url, $obj->blog_name, $obj->title, $obj->excerpt);
|
||||||
// Start Filtering
|
if($count > 1) {
|
||||||
$oTrackbackModel = &getModel('trackback');
|
$oTrackbackController->deleteTrackbackSender(3*60, $ipaddress, $obj->url, $obj->blog_name, $obj->title, $obj->excerpt);
|
||||||
$oTrackbackController = &getController('trackback');
|
$this->insertIP($ipaddress.'.*');
|
||||||
|
return new Object(-1,'msg_alert_trackback_denied');
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
list($ipA,$ipB,$ipC,$ipD) = explode('.',$_SERVER['REMOTE_ADDR']);
|
return new Object();
|
||||||
$ipaddress = $ipA.'.'.$ipB.'.'.$ipC;
|
}
|
||||||
// In case the title and the blog name are indentical, investigate the IP address of the last 6 hours, delete and ban it.
|
|
||||||
if($obj->title == $obj->excerpt) {
|
|
||||||
$oTrackbackController->deleteTrackbackSender(60*60*6, $ipaddress, $obj->url, $obj->blog_name, $obj->title, $obj->excerpt);
|
|
||||||
$this->insertIP($ipaddress.'.*', 'AUTO-DENIED : trackback.insertTrackback');
|
|
||||||
return new Object(-1,'msg_alert_trackback_denied');
|
|
||||||
}
|
|
||||||
// If trackbacks have been registered by one C-class IP address more than once for the last 30 minutes, ban the IP address and delete all the posts
|
|
||||||
/* 호스팅 환경을 감안하여 일단 이 부분은 동작하지 않도록 주석 처리
|
|
||||||
$count = $oTrackbackModel->getRegistedTrackback(30*60, $ipaddress, $obj->url, $obj->blog_name, $obj->title, $obj->excerpt);
|
|
||||||
if($count > 1) {
|
|
||||||
$oTrackbackController->deleteTrackbackSender(3*60, $ipaddress, $obj->url, $obj->blog_name, $obj->title, $obj->excerpt);
|
|
||||||
$this->insertIP($ipaddress.'.*');
|
|
||||||
return new Object(-1,'msg_alert_trackback_denied');
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
return new Object();
|
/**
|
||||||
}
|
* @brief IP registration
|
||||||
|
* The registered IP address is considered as a spammer
|
||||||
/**
|
*/
|
||||||
* @brief IP registration
|
function insertIP($ipaddress_list, $description = null)
|
||||||
* The registered IP address is considered as a spammer
|
{
|
||||||
**/
|
print_r($ipaddress_list);
|
||||||
function insertIP($ipaddress_list, $description = null) {
|
$regExr = "/^((\d{1,3}(?:.(\d{1,3}|\*)){3})\s*(\/\/(.*)\s*)?)*\s*$/";
|
||||||
print_r($ipaddress_list);
|
if(!preg_match($regExr,$ipaddress_list)) return new Object(-1, 'msg_invalid');
|
||||||
$regExr = "/^((\d{1,3}(?:.(\d{1,3}|\*)){3})\s*(\/\/(.*)\s*)?)*\s*$/";
|
$ipaddress_list = str_replace("\r","",$ipaddress_list);
|
||||||
if(!preg_match($regExr,$ipaddress_list)) return new Object(-1, 'msg_invalid');
|
$ipaddress_list = explode("\n",$ipaddress_list);
|
||||||
$ipaddress_list = str_replace("\r","",$ipaddress_list);
|
foreach($ipaddress_list as $ipaddressValue)
|
||||||
$ipaddress_list = explode("\n",$ipaddress_list);
|
{
|
||||||
foreach($ipaddress_list as $ipaddressValue) {
|
preg_match("/(\d{1,3}(?:.(\d{1,3}|\*)){3})\s*(\/\/(.*)\s*)?/",$ipaddressValue,$matches);
|
||||||
preg_match("/(\d{1,3}(?:.(\d{1,3}|\*)){3})\s*(\/\/(.*)\s*)?/",$ipaddressValue,$matches);
|
if($ipaddress=trim($matches[1]))
|
||||||
if($ipaddress=trim($matches[1])) {
|
{
|
||||||
$args->ipaddress = $ipaddress;
|
$args->ipaddress = $ipaddress;
|
||||||
if(!$description && $matches[4]) $args->description = $matches[4];
|
if(!$description && $matches[4]) $args->description = $matches[4];
|
||||||
else $args->description = $description;
|
else $args->description = $description;
|
||||||
}
|
|
||||||
$output = executeQuery('spamfilter.insertDeniedIP', $args);
|
|
||||||
if(!$output->toBool()) $fail_list .= $ipaddress.'<br/>';
|
|
||||||
}
|
}
|
||||||
|
$output = executeQuery('spamfilter.insertDeniedIP', $args);
|
||||||
|
if(!$output->toBool()) $fail_list .= $ipaddress.'<br/>';
|
||||||
|
}
|
||||||
|
|
||||||
$output->add('fail_list',$fail_list);
|
$output->add('fail_list',$fail_list);
|
||||||
return $output;
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
/**
|
||||||
|
* @brief Log registration
|
||||||
/**
|
* Register the newly accessed IP address in the log. In case the log interval is withing a certain time,
|
||||||
* @brief Log registration
|
* register it as a spammer
|
||||||
* Register the newly accessed IP address in the log. In case the log interval is withing a certain time,
|
*/
|
||||||
* register it as a spammer
|
function insertLog()
|
||||||
**/
|
{
|
||||||
function insertLog() {
|
$output = executeQuery('spamfilter.insertLog');
|
||||||
$output = executeQuery('spamfilter.insertLog');
|
return $output;
|
||||||
return $output;
|
}
|
||||||
}
|
}
|
||||||
}
|
/* End of file spamfilter.controller.php */
|
||||||
?>
|
/* Location: ./modules/spamfilter/spamfilter.controller.php */
|
||||||
|
|
|
||||||
|
|
@ -1,144 +1,155 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @class spamfilterModel
|
* @class spamfilterModel
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief The Model class of the spamfilter module
|
* @brief The Model class of the spamfilter module
|
||||||
**/
|
*/
|
||||||
|
class spamfilterModel extends spamfilter
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @brief Initialization
|
||||||
|
*/
|
||||||
|
function init()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
class spamfilterModel extends spamfilter {
|
/**
|
||||||
|
* @brief Return the user setting values of the Spam filter module
|
||||||
|
*/
|
||||||
|
function getConfig()
|
||||||
|
{
|
||||||
|
// Get configurations (using the module model object)
|
||||||
|
$oModuleModel = &getModel('module');
|
||||||
|
return $oModuleModel->getModuleConfig('spamfilter');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialization
|
* @brief Return the list of registered IP addresses which were banned
|
||||||
**/
|
*/
|
||||||
function init() {
|
function getDeniedIPList()
|
||||||
}
|
{
|
||||||
|
$args->sort_index = "regdate";
|
||||||
|
$args->page = Context::get('page')?Context::get('page'):1;
|
||||||
|
$output = executeQuery('spamfilter.getDeniedIPList', $args);
|
||||||
|
if(!$output->data) return;
|
||||||
|
if(!is_array($output->data)) return array($output->data);
|
||||||
|
return $output->data;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Return the user setting values of the Spam filter module
|
* @brief Check if the ipaddress is in the list of banned IP addresses
|
||||||
**/
|
*/
|
||||||
function getConfig() {
|
function isDeniedIP()
|
||||||
// Get configurations (using the module model object)
|
{
|
||||||
$oModuleModel = &getModel('module');
|
$ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||||
return $oModuleModel->getModuleConfig('spamfilter');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
$ip_list = $this->getDeniedIPList();
|
||||||
* @brief Return the list of registered IP addresses which were banned
|
if(!count($ip_list)) return new Object();
|
||||||
**/
|
|
||||||
function getDeniedIPList() {
|
|
||||||
$args->sort_index = "regdate";
|
|
||||||
$args->page = Context::get('page')?Context::get('page'):1;
|
|
||||||
$output = executeQuery('spamfilter.getDeniedIPList', $args);
|
|
||||||
if(!$output->data) return;
|
|
||||||
if(!is_array($output->data)) return array($output->data);
|
|
||||||
return $output->data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
$count = count($ip_list);
|
||||||
* @brief Check if the ipaddress is in the list of banned IP addresses
|
for($i=0;$i<$count;$i++)
|
||||||
**/
|
{
|
||||||
function isDeniedIP() {
|
$ip = str_replace('.', '\.', str_replace('*','(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)',$ip_list[$i]->ipaddress));
|
||||||
$ipaddress = $_SERVER['REMOTE_ADDR'];
|
if(preg_match('/^'.$ip.'$/', $ipaddress, $matches)) return new Object(-1,'msg_alert_registered_denied_ip');
|
||||||
|
}
|
||||||
|
|
||||||
$ip_list = $this->getDeniedIPList();
|
return new Object();
|
||||||
if(!count($ip_list)) return new Object();
|
}
|
||||||
|
|
||||||
$count = count($ip_list);
|
/**
|
||||||
for($i=0;$i<$count;$i++) {
|
* @brief Return the list of registered Words which were banned
|
||||||
$ip = str_replace('.', '\.', str_replace('*','(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)',$ip_list[$i]->ipaddress));
|
*/
|
||||||
if(preg_match('/^'.$ip.'$/', $ipaddress, $matches)) return new Object(-1,'msg_alert_registered_denied_ip');
|
function getDeniedWordList()
|
||||||
}
|
{
|
||||||
|
$args->sort_index = "hit";
|
||||||
return new Object();
|
$output = executeQuery('spamfilter.getDeniedWordList', $args);
|
||||||
}
|
if(!$output->data) return;
|
||||||
|
if(!is_array($output->data)) return array($output->data);
|
||||||
|
return $output->data;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Return the list of registered Words which were banned
|
* @brief Check if the text, received as a parameter, is banned or not
|
||||||
**/
|
*/
|
||||||
function getDeniedWordList() {
|
function isDeniedWord($text)
|
||||||
$args->sort_index = "hit";
|
{
|
||||||
$output = executeQuery('spamfilter.getDeniedWordList', $args);
|
$word_list = $this->getDeniedWordList();
|
||||||
if(!$output->data) return;
|
if(!count($word_list)) return new Object();
|
||||||
if(!is_array($output->data)) return array($output->data);
|
|
||||||
return $output->data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
$count = count($word_list);
|
||||||
* @brief Check if the text, received as a parameter, is banned or not
|
for($i=0;$i<$count;$i++)
|
||||||
**/
|
{
|
||||||
function isDeniedWord($text) {
|
$word = $word_list[$i]->word;
|
||||||
$word_list = $this->getDeniedWordList();
|
if(preg_match('/'.preg_quote($word,'/').'/is', $text))
|
||||||
if(!count($word_list)) return new Object();
|
{
|
||||||
|
$args->word = $word;
|
||||||
|
$output = executeQuery('spamfilter.updateDeniedWordHit', $args);
|
||||||
|
return new Object(-1,sprintf(Context::getLang('msg_alert_denied_word'), $word));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$count = count($word_list);
|
return new Object();
|
||||||
for($i=0;$i<$count;$i++) {
|
}
|
||||||
$word = $word_list[$i]->word;
|
|
||||||
if(preg_match('/'.preg_quote($word,'/').'/is', $text)) {
|
|
||||||
$args->word = $word;
|
|
||||||
$output = executeQuery('spamfilter.updateDeniedWordHit', $args);
|
|
||||||
return new Object(-1,sprintf(Context::getLang('msg_alert_denied_word'), $word));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Object();
|
/**
|
||||||
}
|
* @brief Check the specified time
|
||||||
|
*/
|
||||||
|
function checkLimited()
|
||||||
|
{
|
||||||
|
$config = $this->getConfig();
|
||||||
|
|
||||||
/**
|
if($config->limits != 'Y') return new Object();
|
||||||
* @brief Check the specified time
|
$limit_count = '3';
|
||||||
**/
|
$interval = '10';
|
||||||
function checkLimited() {
|
|
||||||
$config = $this->getConfig();
|
|
||||||
|
|
||||||
if($config->limits != 'Y') return new Object();
|
|
||||||
$limit_count = '3';
|
|
||||||
$interval = '10';
|
|
||||||
|
|
||||||
$count = $this->getLogCount($interval);
|
$count = $this->getLogCount($interval);
|
||||||
|
|
||||||
$ipaddress = $_SERVER['REMOTE_ADDR'];
|
$ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||||
// Ban the IP address if the interval is exceeded
|
// Ban the IP address if the interval is exceeded
|
||||||
if($count>=$limit_count) {
|
if($count>=$limit_count)
|
||||||
$oSpamFilterController = &getController('spamfilter');
|
{
|
||||||
$oSpamFilterController->insertIP($ipaddress, 'AUTO-DENIED : Over limit');
|
$oSpamFilterController = &getController('spamfilter');
|
||||||
return new Object(-1, 'msg_alert_registered_denied_ip');
|
$oSpamFilterController->insertIP($ipaddress, 'AUTO-DENIED : Over limit');
|
||||||
}
|
return new Object(-1, 'msg_alert_registered_denied_ip');
|
||||||
// If the number of limited posts is not reached, keep creating.
|
}
|
||||||
if($count) {
|
// If the number of limited posts is not reached, keep creating.
|
||||||
$message = sprintf(Context::getLang('msg_alert_limited_by_config'), $interval);
|
if($count)
|
||||||
|
{
|
||||||
|
$message = sprintf(Context::getLang('msg_alert_limited_by_config'), $interval);
|
||||||
|
|
||||||
$oSpamFilterController = &getController('spamfilter');
|
$oSpamFilterController = &getController('spamfilter');
|
||||||
$oSpamFilterController->insertLog();
|
$oSpamFilterController->insertLog();
|
||||||
|
|
||||||
return new Object(-1, $message);
|
return new Object(-1, $message);
|
||||||
}
|
}
|
||||||
|
return new Object();
|
||||||
|
}
|
||||||
|
|
||||||
return new Object();
|
/**
|
||||||
}
|
* @brief Check if the trackbacks have already been registered to a particular article
|
||||||
|
*/
|
||||||
|
function isInsertedTrackback($document_srl)
|
||||||
|
{
|
||||||
|
$oTrackbackModel = &getModel('trackback');
|
||||||
|
$count = $oTrackbackModel->getTrackbackCountByIPAddress($document_srl, $_SERVER['REMOTE_ADDR']);
|
||||||
|
if($count>0) return new Object(-1, 'msg_alert_trackback_denied');
|
||||||
|
|
||||||
/**
|
return new Object();
|
||||||
* @brief Check if the trackbacks have already been registered to a particular article
|
}
|
||||||
**/
|
|
||||||
function isInsertedTrackback($document_srl) {
|
|
||||||
$oTrackbackModel = &getModel('trackback');
|
|
||||||
$count = $oTrackbackModel->getTrackbackCountByIPAddress($document_srl, $_SERVER['REMOTE_ADDR']);
|
|
||||||
if($count>0) return new Object(-1, 'msg_alert_trackback_denied');
|
|
||||||
|
|
||||||
return new Object();
|
/**
|
||||||
}
|
* @brief Return the number of logs recorded within the interval for the specified IPaddress
|
||||||
|
*/
|
||||||
|
function getLogCount($time = 60, $ipaddress='')
|
||||||
|
{
|
||||||
|
if(!$ipaddress) $ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||||
|
|
||||||
/**
|
$args->ipaddress = $ipaddress;
|
||||||
* @brief Return the number of logs recorded within the interval for the specified IPaddress
|
$args->regdate = date("YmdHis", time()-$time);
|
||||||
**/
|
$output = executeQuery('spamfilter.getLogCount', $args);
|
||||||
function getLogCount($time = 60, $ipaddress='') {
|
$count = $output->data->count;
|
||||||
if(!$ipaddress) $ipaddress = $_SERVER['REMOTE_ADDR'];
|
return $count;
|
||||||
|
}
|
||||||
$args->ipaddress = $ipaddress;
|
}
|
||||||
$args->regdate = date("YmdHis", time()-$time);
|
/* End of file spamfilter.model.php */
|
||||||
$output = executeQuery('spamfilter.getLogCount', $args);
|
/* Location: ./modules/spamfilter/spamfilter.model.php */
|
||||||
$count = $output->data->count;
|
|
||||||
return $count;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,19 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @class tagAdminController
|
* @class tagAdminController
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief admin controller class of the tag module
|
* @brief admin controller class of the tag module
|
||||||
**/
|
*/
|
||||||
|
class tagAdminController extends tag
|
||||||
class tagAdminController extends tag {
|
{
|
||||||
/**
|
/**
|
||||||
* @brief Delete all tags for a particular module
|
* @brief Delete all tags for a particular module
|
||||||
**/
|
*/
|
||||||
function deleteModuleTags($module_srl) {
|
function deleteModuleTags($module_srl)
|
||||||
$args->module_srl = $module_srl;
|
{
|
||||||
return executeQuery('tag.deleteModuleTags', $args);
|
$args->module_srl = $module_srl;
|
||||||
}
|
return executeQuery('tag.deleteModuleTags', $args);
|
||||||
}
|
}
|
||||||
?>
|
}
|
||||||
|
/* End of file tag.admin.controller.php */
|
||||||
|
/* Location: ./modules/tag/tag.admin.controller.php */
|
||||||
|
|
|
||||||
|
|
@ -1,88 +1,92 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @class tag
|
* @class tag
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief high class of the tag module
|
* @brief high class of the tag module
|
||||||
**/
|
*/
|
||||||
|
class tag extends ModuleObject
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @brief Implement if additional tasks are necessary when installing
|
||||||
|
*/
|
||||||
|
function moduleInstall()
|
||||||
|
{
|
||||||
|
$oModuleController = &getController('module');
|
||||||
|
$oDB = &DB::getInstance();
|
||||||
|
|
||||||
class tag extends ModuleObject {
|
$oDB->addIndex("tags","idx_tag", array("document_srl","tag"));
|
||||||
|
// 2007. 10. 17 document.insertDocument, updateDocument, deleteDocument trigger property for
|
||||||
|
$oModuleController->insertTrigger('document.insertDocument', 'tag', 'controller', 'triggerArrangeTag', 'before');
|
||||||
|
$oModuleController->insertTrigger('document.insertDocument', 'tag', 'controller', 'triggerInsertTag', 'after');
|
||||||
|
$oModuleController->insertTrigger('document.updateDocument', 'tag', 'controller', 'triggerArrangeTag', 'before');
|
||||||
|
$oModuleController->insertTrigger('document.updateDocument', 'tag', 'controller', 'triggerInsertTag', 'after');
|
||||||
|
$oModuleController->insertTrigger('document.deleteDocument', 'tag', 'controller', 'triggerDeleteTag', 'after');
|
||||||
|
// 2007. 10. 17 modules are deleted when you delete all registered triggers that add tag
|
||||||
|
$oModuleController->insertTrigger('module.deleteModule', 'tag', 'controller', 'triggerDeleteModuleTags', 'after');
|
||||||
|
|
||||||
/**
|
return new Object();
|
||||||
* @brief Implement if additional tasks are necessary when installing
|
}
|
||||||
**/
|
|
||||||
function moduleInstall() {
|
|
||||||
$oModuleController = &getController('module');
|
|
||||||
$oDB = &DB::getInstance();
|
|
||||||
|
|
||||||
$oDB->addIndex("tags","idx_tag", array("document_srl","tag"));
|
/**
|
||||||
// 2007. 10. 17 document.insertDocument, updateDocument, deleteDocument trigger property for
|
* @brief a method to check if successfully installed
|
||||||
$oModuleController->insertTrigger('document.insertDocument', 'tag', 'controller', 'triggerArrangeTag', 'before');
|
*/
|
||||||
$oModuleController->insertTrigger('document.insertDocument', 'tag', 'controller', 'triggerInsertTag', 'after');
|
function checkUpdate()
|
||||||
$oModuleController->insertTrigger('document.updateDocument', 'tag', 'controller', 'triggerArrangeTag', 'before');
|
{
|
||||||
$oModuleController->insertTrigger('document.updateDocument', 'tag', 'controller', 'triggerInsertTag', 'after');
|
$oModuleModel = &getModel('module');
|
||||||
$oModuleController->insertTrigger('document.deleteDocument', 'tag', 'controller', 'triggerDeleteTag', 'after');
|
$oDB = &DB::getInstance();
|
||||||
// 2007. 10. 17 modules are deleted when you delete all registered triggers that add tag
|
// 2007. 10. 17 trigger registration, if registered upset
|
||||||
$oModuleController->insertTrigger('module.deleteModule', 'tag', 'controller', 'triggerDeleteModuleTags', 'after');
|
if(!$oModuleModel->getTrigger('document.insertDocument', 'tag', 'controller', 'triggerArrangeTag', 'before')) return true;
|
||||||
|
if(!$oModuleModel->getTrigger('document.insertDocument', 'tag', 'controller', 'triggerInsertTag', 'after')) return true;
|
||||||
return new Object();
|
if(!$oModuleModel->getTrigger('document.updateDocument', 'tag', 'controller', 'triggerArrangeTag', 'before')) return true;
|
||||||
}
|
if(!$oModuleModel->getTrigger('document.updateDocument', 'tag', 'controller', 'triggerInsertTag', 'after')) return true;
|
||||||
|
if(!$oModuleModel->getTrigger('document.deleteDocument', 'tag', 'controller', 'triggerDeleteTag', 'after')) return true;
|
||||||
|
// 2007. 10. 17 modules are deleted when you delete all registered triggers that add tag
|
||||||
|
if(!$oModuleModel->getTrigger('module.deleteModule', 'tag', 'controller', 'triggerDeleteModuleTags', 'after')) return true;
|
||||||
|
// tag in the index column of the table tag
|
||||||
|
if(!$oDB->isIndexExists("tags","idx_tag")) return true;
|
||||||
|
|
||||||
/**
|
return false;
|
||||||
* @brief a method to check if successfully installed
|
}
|
||||||
**/
|
|
||||||
function checkUpdate() {
|
|
||||||
$oModuleModel = &getModel('module');
|
|
||||||
$oDB = &DB::getInstance();
|
|
||||||
// 2007. 10. 17 trigger registration, if registered upset
|
|
||||||
if(!$oModuleModel->getTrigger('document.insertDocument', 'tag', 'controller', 'triggerArrangeTag', 'before')) return true;
|
|
||||||
if(!$oModuleModel->getTrigger('document.insertDocument', 'tag', 'controller', 'triggerInsertTag', 'after')) return true;
|
|
||||||
if(!$oModuleModel->getTrigger('document.updateDocument', 'tag', 'controller', 'triggerArrangeTag', 'before')) return true;
|
|
||||||
if(!$oModuleModel->getTrigger('document.updateDocument', 'tag', 'controller', 'triggerInsertTag', 'after')) return true;
|
|
||||||
if(!$oModuleModel->getTrigger('document.deleteDocument', 'tag', 'controller', 'triggerDeleteTag', 'after')) return true;
|
|
||||||
// 2007. 10. 17 modules are deleted when you delete all registered triggers that add tag
|
|
||||||
if(!$oModuleModel->getTrigger('module.deleteModule', 'tag', 'controller', 'triggerDeleteModuleTags', 'after')) return true;
|
|
||||||
// tag in the index column of the table tag
|
|
||||||
if(!$oDB->isIndexExists("tags","idx_tag")) return true;
|
|
||||||
|
|
||||||
return false;
|
/**
|
||||||
}
|
* @brief Execute update
|
||||||
|
*/
|
||||||
|
function moduleUpdate()
|
||||||
|
{
|
||||||
|
$oModuleModel = &getModel('module');
|
||||||
|
$oModuleController = &getController('module');
|
||||||
|
$oDB = &DB::getInstance();
|
||||||
|
// 2007. 10. 17 document.insertDocument, updateDocument, deleteDocument trigger property for
|
||||||
|
if(!$oModuleModel->getTrigger('document.insertDocument', 'tag', 'controller', 'triggerArrangeTag', 'before'))
|
||||||
|
$oModuleController->insertTrigger('document.insertDocument', 'tag', 'controller', 'triggerArrangeTag', 'before');
|
||||||
|
|
||||||
/**
|
if(!$oModuleModel->getTrigger('document.insertDocument', 'tag', 'controller', 'triggerInsertTag', 'after'))
|
||||||
* @brief Execute update
|
$oModuleController->insertTrigger('document.insertDocument', 'tag', 'controller', 'triggerInsertTag', 'after');
|
||||||
**/
|
|
||||||
function moduleUpdate() {
|
|
||||||
$oModuleModel = &getModel('module');
|
|
||||||
$oModuleController = &getController('module');
|
|
||||||
$oDB = &DB::getInstance();
|
|
||||||
// 2007. 10. 17 document.insertDocument, updateDocument, deleteDocument trigger property for
|
|
||||||
if(!$oModuleModel->getTrigger('document.insertDocument', 'tag', 'controller', 'triggerArrangeTag', 'before'))
|
|
||||||
$oModuleController->insertTrigger('document.insertDocument', 'tag', 'controller', 'triggerArrangeTag', 'before');
|
|
||||||
|
|
||||||
if(!$oModuleModel->getTrigger('document.insertDocument', 'tag', 'controller', 'triggerInsertTag', 'after'))
|
if(!$oModuleModel->getTrigger('document.updateDocument', 'tag', 'controller', 'triggerArrangeTag', 'before'))
|
||||||
$oModuleController->insertTrigger('document.insertDocument', 'tag', 'controller', 'triggerInsertTag', 'after');
|
$oModuleController->insertTrigger('document.updateDocument', 'tag', 'controller', 'triggerArrangeTag', 'before');
|
||||||
|
|
||||||
if(!$oModuleModel->getTrigger('document.updateDocument', 'tag', 'controller', 'triggerArrangeTag', 'before'))
|
if(!$oModuleModel->getTrigger('document.updateDocument', 'tag', 'controller', 'triggerInsertTag', 'after'))
|
||||||
$oModuleController->insertTrigger('document.updateDocument', 'tag', 'controller', 'triggerArrangeTag', 'before');
|
$oModuleController->insertTrigger('document.updateDocument', 'tag', 'controller', 'triggerInsertTag', 'after');
|
||||||
|
|
||||||
if(!$oModuleModel->getTrigger('document.updateDocument', 'tag', 'controller', 'triggerInsertTag', 'after'))
|
if(!$oModuleModel->getTrigger('document.deleteDocument', 'tag', 'controller', 'triggerDeleteTag', 'after'))
|
||||||
$oModuleController->insertTrigger('document.updateDocument', 'tag', 'controller', 'triggerInsertTag', 'after');
|
$oModuleController->insertTrigger('document.deleteDocument', 'tag', 'controller', 'triggerDeleteTag', 'after');
|
||||||
|
// 2007. 10. 17 modules are deleted when you delete all registered triggers that add tag
|
||||||
|
if(!$oModuleModel->getTrigger('module.deleteModule', 'tag', 'controller', 'triggerDeleteModuleTags', 'after'))
|
||||||
|
$oModuleController->insertTrigger('module.deleteModule', 'tag', 'controller', 'triggerDeleteModuleTags', 'after');
|
||||||
|
// tag in the index column of the table tag
|
||||||
|
if(!$oDB->isIndexExists("tags","idx_tag"))
|
||||||
|
$oDB->addIndex("tags","idx_tag", array("document_srl","tag"));
|
||||||
|
|
||||||
if(!$oModuleModel->getTrigger('document.deleteDocument', 'tag', 'controller', 'triggerDeleteTag', 'after'))
|
return new Object(0, 'success_updated');
|
||||||
$oModuleController->insertTrigger('document.deleteDocument', 'tag', 'controller', 'triggerDeleteTag', 'after');
|
}
|
||||||
// 2007. 10. 17 modules are deleted when you delete all registered triggers that add tag
|
|
||||||
if(!$oModuleModel->getTrigger('module.deleteModule', 'tag', 'controller', 'triggerDeleteModuleTags', 'after'))
|
|
||||||
$oModuleController->insertTrigger('module.deleteModule', 'tag', 'controller', 'triggerDeleteModuleTags', 'after');
|
|
||||||
// tag in the index column of the table tag
|
|
||||||
if(!$oDB->isIndexExists("tags","idx_tag"))
|
|
||||||
$oDB->addIndex("tags","idx_tag", array("document_srl","tag"));
|
|
||||||
|
|
||||||
return new Object(0, 'success_updated');
|
/**
|
||||||
}
|
* @brief Re-generate the cache file
|
||||||
|
*/
|
||||||
/**
|
function recompileCache()
|
||||||
* @brief Re-generate the cache file
|
{
|
||||||
**/
|
}
|
||||||
function recompileCache() {
|
}
|
||||||
}
|
/* End of file tag.class.php */
|
||||||
}
|
/* Location: ./modules/tag/tag.class.php */
|
||||||
?>
|
|
||||||
|
|
|
||||||
|
|
@ -1,89 +1,95 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @class tagController
|
* @class tagController
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief tag module's controller class
|
* @brief tag module's controller class
|
||||||
**/
|
*/
|
||||||
|
class tagController extends tag
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @brief Initialization
|
||||||
|
*/
|
||||||
|
function init()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
class tagController extends tag {
|
/**
|
||||||
|
* @brief , (Comma) to clean up the tags attached to the trigger
|
||||||
|
*/
|
||||||
|
function triggerArrangeTag(&$obj)
|
||||||
|
{
|
||||||
|
if(!$obj->tags) return new Object();
|
||||||
|
// tags by variable
|
||||||
|
$tag_list = explode(',', $obj->tags);
|
||||||
|
$tag_count = count($tag_list);
|
||||||
|
$tag_list = array_unique($tag_list);
|
||||||
|
if(!count($tag_list)) return new Object();
|
||||||
|
|
||||||
/**
|
foreach($tag_list as $tag)
|
||||||
* @brief Initialization
|
{
|
||||||
**/
|
if(!trim($tag)) continue;
|
||||||
function init() {
|
$arranged_tag_list[] = trim($tag);
|
||||||
}
|
}
|
||||||
|
if(!count($arranged_tag_list)) $obj->tags = null;
|
||||||
|
else $obj->tags = implode(',',$arranged_tag_list);
|
||||||
|
return new Object();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief , (Comma) to clean up the tags attached to the trigger
|
* @brief Input trigger tag
|
||||||
**/
|
* Enter a Tag to delete that article and then re-enter all the tags using a method
|
||||||
function triggerArrangeTag(&$obj) {
|
*/
|
||||||
if(!$obj->tags) return new Object();
|
function triggerInsertTag(&$obj)
|
||||||
// tags by variable
|
{
|
||||||
$tag_list = explode(',', $obj->tags);
|
$module_srl = $obj->module_srl;
|
||||||
$tag_count = count($tag_list);
|
$document_srl = $obj->document_srl;
|
||||||
$tag_list = array_unique($tag_list);
|
$tags = $obj->tags;
|
||||||
if(!count($tag_list)) return new Object();
|
if(!$document_srl) return new Object();
|
||||||
|
// Remove all tags that article
|
||||||
|
$output = $this->triggerDeleteTag($obj);
|
||||||
|
if(!$output->toBool()) return $output;
|
||||||
|
// Re-enter the tag
|
||||||
|
$args->module_srl = $module_srl;
|
||||||
|
$args->document_srl = $document_srl;
|
||||||
|
|
||||||
foreach($tag_list as $tag) {
|
$tag_list = explode(',',$tags);
|
||||||
if(!trim($tag)) continue;
|
$tag_count = count($tag_list);
|
||||||
$arranged_tag_list[] = trim($tag);
|
for($i=0;$i<$tag_count;$i++)
|
||||||
}
|
{
|
||||||
if(!count($arranged_tag_list)) $obj->tags = null;
|
unset($args->tag);
|
||||||
else $obj->tags = implode(',',$arranged_tag_list);
|
$args->tag = trim($tag_list[$i]);
|
||||||
return new Object();
|
if(!$args->tag) continue;
|
||||||
}
|
$output = executeQuery('tag.insertTag', $args);
|
||||||
|
if(!$output->toBool()) return $output;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
return new Object();
|
||||||
* @brief Input trigger tag
|
}
|
||||||
* Enter a Tag to delete that article and then re-enter all the tags using a method
|
|
||||||
**/
|
|
||||||
function triggerInsertTag(&$obj) {
|
|
||||||
$module_srl = $obj->module_srl;
|
|
||||||
$document_srl = $obj->document_srl;
|
|
||||||
$tags = $obj->tags;
|
|
||||||
if(!$document_srl) return new Object();
|
|
||||||
// Remove all tags that article
|
|
||||||
$output = $this->triggerDeleteTag($obj);
|
|
||||||
if(!$output->toBool()) return $output;
|
|
||||||
// Re-enter the tag
|
|
||||||
$args->module_srl = $module_srl;
|
|
||||||
$args->document_srl = $document_srl;
|
|
||||||
|
|
||||||
$tag_list = explode(',',$tags);
|
/**
|
||||||
$tag_count = count($tag_list);
|
* @brief Delete the tag trigger a specific article
|
||||||
for($i=0;$i<$tag_count;$i++) {
|
* document_srl delete tag belongs to
|
||||||
unset($args->tag);
|
*/
|
||||||
$args->tag = trim($tag_list[$i]);
|
function triggerDeleteTag(&$obj)
|
||||||
if(!$args->tag) continue;
|
{
|
||||||
$output = executeQuery('tag.insertTag', $args);
|
$document_srl = $obj->document_srl;
|
||||||
if(!$output->toBool()) return $output;
|
if(!$document_srl) return new Object();
|
||||||
}
|
|
||||||
|
|
||||||
return new Object();
|
$args->document_srl = $document_srl;
|
||||||
}
|
return executeQuery('tag.deleteTag', $args);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Delete the tag trigger a specific article
|
* @brief module delete trigger to delete all the tags
|
||||||
* document_srl delete tag belongs to
|
*/
|
||||||
**/
|
function triggerDeleteModuleTags(&$obj)
|
||||||
function triggerDeleteTag(&$obj) {
|
{
|
||||||
$document_srl = $obj->document_srl;
|
$module_srl = $obj->module_srl;
|
||||||
if(!$document_srl) return new Object();
|
if(!$module_srl) return new Object();
|
||||||
|
|
||||||
$args->document_srl = $document_srl;
|
$oTagController = &getAdminController('tag');
|
||||||
return executeQuery('tag.deleteTag', $args);
|
return $oTagController->deleteModuleTags($module_srl);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/**
|
/* End of file tag.controller.php */
|
||||||
* @brief module delete trigger to delete all the tags
|
/* Location: ./modules/tag/tag.controller.php */
|
||||||
**/
|
|
||||||
function triggerDeleteModuleTags(&$obj) {
|
|
||||||
$module_srl = $obj->module_srl;
|
|
||||||
if(!$module_srl) return new Object();
|
|
||||||
|
|
||||||
$oTagController = &getAdminController('tag');
|
|
||||||
return $oTagController->deleteModuleTags($module_srl);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
|
||||||
|
|
@ -1,86 +1,92 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @class tagModel
|
* @class tagModel
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief tag model class of the module
|
* @brief tag model class of the module
|
||||||
**/
|
*/
|
||||||
|
class tagModel extends tag
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @brief Initialization
|
||||||
|
*/
|
||||||
|
function init()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
class tagModel extends tag {
|
/**
|
||||||
|
* @brief Imported Tag List
|
||||||
/**
|
* Many of the specified module in order to extract the number of tags
|
||||||
* @brief Initialization
|
*/
|
||||||
**/
|
function getTagList($obj)
|
||||||
function init() {
|
{
|
||||||
}
|
if($obj->mid)
|
||||||
|
{
|
||||||
/**
|
$oModuleModel = &getModel('module');
|
||||||
* @brief Imported Tag List
|
$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
|
||||||
* Many of the specified module in order to extract the number of tags
|
unset($obj->mid);
|
||||||
**/
|
|
||||||
function getTagList($obj) {
|
|
||||||
if($obj->mid) {
|
|
||||||
$oModuleModel = &getModel('module');
|
|
||||||
$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
|
|
||||||
unset($obj->mid);
|
|
||||||
}
|
|
||||||
// Module_srl passed the array may be a check whether the array
|
|
||||||
if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
|
|
||||||
else $args->module_srl = $obj->module_srl;
|
|
||||||
$args->list_count = $obj->list_count;
|
|
||||||
$args->count = $obj->sort_index;
|
|
||||||
|
|
||||||
$output = executeQueryArray('tag.getTagList', $args);
|
|
||||||
if(!$output->toBool()) return $output;
|
|
||||||
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief document_srl the import tag
|
|
||||||
**/
|
|
||||||
function getDocumentSrlByTag($obj){
|
|
||||||
if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
|
|
||||||
else $args->module_srl = $obj->module_srl;
|
|
||||||
|
|
||||||
$args->tag = $obj->tag;
|
|
||||||
$output = executeQueryArray('tag.getDocumentSrlByTag', $args);
|
|
||||||
if(!$output->toBool()) return $output;
|
|
||||||
|
|
||||||
return $output;
|
|
||||||
}
|
}
|
||||||
|
// Module_srl passed the array may be a check whether the array
|
||||||
|
if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
|
||||||
|
else $args->module_srl = $obj->module_srl;
|
||||||
|
$args->list_count = $obj->list_count;
|
||||||
|
$args->count = $obj->sort_index;
|
||||||
|
|
||||||
/**
|
$output = executeQueryArray('tag.getTagList', $args);
|
||||||
* @brief document used in the import tag
|
if(!$output->toBool()) return $output;
|
||||||
**/
|
|
||||||
function getDocumentsTagList($obj){
|
|
||||||
if(is_array($obj->document_srl)) $args->document_srl = implode(',', $obj->document_srl);
|
|
||||||
else $args->document_srl = $obj->document_srl;
|
|
||||||
|
|
||||||
$output = executeQueryArray('tag.getDocumentsTagList', $args);
|
return $output;
|
||||||
if(!$output->toBool()) return $output;
|
}
|
||||||
|
|
||||||
return $output;
|
/**
|
||||||
|
* @brief document_srl the import tag
|
||||||
|
*/
|
||||||
|
function getDocumentSrlByTag($obj)
|
||||||
|
{
|
||||||
|
if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
|
||||||
|
else $args->module_srl = $obj->module_srl;
|
||||||
|
|
||||||
|
$args->tag = $obj->tag;
|
||||||
|
$output = executeQueryArray('tag.getDocumentSrlByTag', $args);
|
||||||
|
if(!$output->toBool()) return $output;
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief document used in the import tag
|
||||||
|
*/
|
||||||
|
function getDocumentsTagList($obj)
|
||||||
|
{
|
||||||
|
if(is_array($obj->document_srl)) $args->document_srl = implode(',', $obj->document_srl);
|
||||||
|
else $args->document_srl = $obj->document_srl;
|
||||||
|
|
||||||
|
$output = executeQueryArray('tag.getDocumentsTagList', $args);
|
||||||
|
if(!$output->toBool()) return $output;
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Tag is used with a particular tag list
|
||||||
|
*/
|
||||||
|
function getTagWithUsedList($obj)
|
||||||
|
{
|
||||||
|
if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
|
||||||
|
else $args->module_srl = $obj->module_srl;
|
||||||
|
|
||||||
|
$args->tag = $obj->tag;
|
||||||
|
$output = $this->getDocumentSrlByTag($args);
|
||||||
|
$document_srl = array();
|
||||||
|
|
||||||
|
if($output->data)
|
||||||
|
{
|
||||||
|
foreach($output->data as $k => $v) $document_srl[] = $v->document_srl;
|
||||||
}
|
}
|
||||||
|
unset($args);
|
||||||
/**
|
$args->document_srl = $document_srl;
|
||||||
* @brief Tag is used with a particular tag list
|
$output = $this->getDocumentsTagList($args);
|
||||||
**/
|
return $output;
|
||||||
function getTagWithUsedList($obj){
|
}
|
||||||
if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
|
}
|
||||||
else $args->module_srl = $obj->module_srl;
|
/* End of file tag.model.php */
|
||||||
|
/* Location: ./modules/tag/tag.model.php */
|
||||||
$args->tag = $obj->tag;
|
|
||||||
$output = $this->getDocumentSrlByTag($args);
|
|
||||||
$document_srl = array();
|
|
||||||
|
|
||||||
if($output->data){
|
|
||||||
foreach($output->data as $k => $v) $document_srl[] = $v->document_srl;
|
|
||||||
}
|
|
||||||
unset($args);
|
|
||||||
$args->document_srl = $document_srl;
|
|
||||||
$output = $this->getDocumentsTagList($args);
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
|
||||||
|
|
@ -1,140 +1,150 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* trackbackAdminController class
|
||||||
|
* trackback module admin controller class
|
||||||
|
*
|
||||||
|
* @author NHN (developers@xpressengine.com)
|
||||||
|
* @package /modules/trackback
|
||||||
|
* @version 0.1
|
||||||
|
*/
|
||||||
|
class trackbackAdminController extends trackback
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* trackbackAdminController class
|
* Initialization
|
||||||
* trackback module admin controller class
|
* @return void
|
||||||
*
|
|
||||||
* @author NHN (developers@xpressengine.com)
|
|
||||||
* @package /modules/trackback
|
|
||||||
* @version 0.1
|
|
||||||
*/
|
*/
|
||||||
class trackbackAdminController extends trackback {
|
function init()
|
||||||
/**
|
{
|
||||||
* Initialization
|
}
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function init() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trackbacks delete selected in admin page
|
* Trackbacks delete selected in admin page
|
||||||
* @return void|Object
|
* @return void|Object
|
||||||
*/
|
*/
|
||||||
function procTrackbackAdminDeleteChecked() {
|
function procTrackbackAdminDeleteChecked()
|
||||||
// An error appears if no document is selected
|
{
|
||||||
$cart = Context::get('cart');
|
// An error appears if no document is selected
|
||||||
if(!is_array($cart)) $trackback_srl_list= explode('|@|', $cart);
|
$cart = Context::get('cart');
|
||||||
else $trackback_srl_list = $cart;
|
if(!is_array($cart)) $trackback_srl_list= explode('|@|', $cart);
|
||||||
|
else $trackback_srl_list = $cart;
|
||||||
|
|
||||||
$trackback_count = count($trackback_srl_list);
|
$trackback_count = count($trackback_srl_list);
|
||||||
if(!$trackback_count) return $this->stop('msg_cart_is_null');
|
if(!$trackback_count) return $this->stop('msg_cart_is_null');
|
||||||
|
|
||||||
$oTrackbackController = &getController('trackback');
|
$oTrackbackController = &getController('trackback');
|
||||||
// Delete the post
|
// Delete the post
|
||||||
for($i=0;$i<$trackback_count;$i++) {
|
for($i=0;$i<$trackback_count;$i++)
|
||||||
$trackback_srl = trim($trackback_srl_list[$i]);
|
|
||||||
if(!$trackback_srl) continue;
|
|
||||||
|
|
||||||
$oTrackbackController->deleteTrackback($trackback_srl, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->setMessage( sprintf(Context::getLang('msg_checked_trackback_is_deleted'), $trackback_count) );
|
|
||||||
|
|
||||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispTrackbackAdminList');
|
|
||||||
$this->setRedirectUrl($returnUrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Save Settings
|
|
||||||
* @return object
|
|
||||||
*/
|
|
||||||
function procTrackbackAdminInsertConfig() {
|
|
||||||
$config->enable_trackback = Context::get('enable_trackback');
|
|
||||||
if($config->enable_trackback != 'Y') $config->enable_trackback = 'N';
|
|
||||||
|
|
||||||
$oModuleController = &getController('module');
|
|
||||||
$output = $oModuleController->insertModuleConfig('trackback',$config);
|
|
||||||
|
|
||||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispTrackbackAdminList');
|
|
||||||
return $this->setRedirectUrl($returnUrl, $output);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Trackback Module Settings
|
|
||||||
* @return void|Object
|
|
||||||
*/
|
|
||||||
function procTrackbackAdminInsertModuleConfig() {
|
|
||||||
// Get variables
|
|
||||||
$module_srl = Context::get('target_module_srl');
|
|
||||||
if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl);
|
|
||||||
else $module_srl = array($module_srl);
|
|
||||||
|
|
||||||
$enable_trackback = Context::get('enable_trackback');
|
|
||||||
if(!in_array($enable_trackback, array('Y','N'))) $enable_trackback = 'N';
|
|
||||||
|
|
||||||
if(!$module_srl || !$enable_trackback) return new Object(-1, 'msg_invalid_request');
|
|
||||||
|
|
||||||
for($i=0;$i<count($module_srl);$i++) {
|
|
||||||
$srl = trim($module_srl[$i]);
|
|
||||||
if(!$srl) continue;
|
|
||||||
$output = $this->setTrackbackModuleConfig($srl, $enable_trackback);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->setError(-1);
|
|
||||||
$this->setMessage('success_updated', 'info');
|
|
||||||
|
|
||||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispBoardAdminContent');
|
|
||||||
$this->setRedirectUrl($returnUrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Trackback Module Settings
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function procTrackbackAdminAddCart()
|
|
||||||
{
|
{
|
||||||
$trackback_srl = (int)Context::get('trackback_srl');
|
$trackback_srl = trim($trackback_srl_list[$i]);
|
||||||
|
if(!$trackback_srl) continue;
|
||||||
|
|
||||||
$oTrackbackAdminModel = &getAdminModel('trackback');
|
$oTrackbackController->deleteTrackback($trackback_srl, true);
|
||||||
//$columnList = array('trackback_srl');
|
}
|
||||||
$args->trackbackSrlList = array($trackback_srl);
|
|
||||||
|
|
||||||
$output = $oTrackbackAdminModel->getTotalTrackbackList($args);
|
$this->setMessage( sprintf(Context::getLang('msg_checked_trackback_is_deleted'), $trackback_count) );
|
||||||
|
|
||||||
if(is_array($output->data))
|
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispTrackbackAdminList');
|
||||||
|
$this->setRedirectUrl($returnUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save Settings
|
||||||
|
* @return object
|
||||||
|
*/
|
||||||
|
function procTrackbackAdminInsertConfig()
|
||||||
|
{
|
||||||
|
$config->enable_trackback = Context::get('enable_trackback');
|
||||||
|
if($config->enable_trackback != 'Y') $config->enable_trackback = 'N';
|
||||||
|
|
||||||
|
$oModuleController = &getController('module');
|
||||||
|
$output = $oModuleController->insertModuleConfig('trackback',$config);
|
||||||
|
|
||||||
|
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispTrackbackAdminList');
|
||||||
|
return $this->setRedirectUrl($returnUrl, $output);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trackback Module Settings
|
||||||
|
* @return void|Object
|
||||||
|
*/
|
||||||
|
function procTrackbackAdminInsertModuleConfig()
|
||||||
|
{
|
||||||
|
// Get variables
|
||||||
|
$module_srl = Context::get('target_module_srl');
|
||||||
|
if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl);
|
||||||
|
else $module_srl = array($module_srl);
|
||||||
|
|
||||||
|
$enable_trackback = Context::get('enable_trackback');
|
||||||
|
if(!in_array($enable_trackback, array('Y','N'))) $enable_trackback = 'N';
|
||||||
|
|
||||||
|
if(!$module_srl || !$enable_trackback) return new Object(-1, 'msg_invalid_request');
|
||||||
|
|
||||||
|
for($i=0;$i<count($module_srl);$i++)
|
||||||
|
{
|
||||||
|
$srl = trim($module_srl[$i]);
|
||||||
|
if(!$srl) continue;
|
||||||
|
$output = $this->setTrackbackModuleConfig($srl, $enable_trackback);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->setError(-1);
|
||||||
|
$this->setMessage('success_updated', 'info');
|
||||||
|
|
||||||
|
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispBoardAdminContent');
|
||||||
|
$this->setRedirectUrl($returnUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trackback Module Settings
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function procTrackbackAdminAddCart()
|
||||||
|
{
|
||||||
|
$trackback_srl = (int)Context::get('trackback_srl');
|
||||||
|
|
||||||
|
$oTrackbackAdminModel = &getAdminModel('trackback');
|
||||||
|
//$columnList = array('trackback_srl');
|
||||||
|
$args->trackbackSrlList = array($trackback_srl);
|
||||||
|
|
||||||
|
$output = $oTrackbackAdminModel->getTotalTrackbackList($args);
|
||||||
|
|
||||||
|
if(is_array($output->data))
|
||||||
|
{
|
||||||
|
foreach($output->data AS $key=>$value)
|
||||||
{
|
{
|
||||||
foreach($output->data AS $key=>$value)
|
if($_SESSION['trackback_management'][$value->trackback_srl]) unset($_SESSION['trackback_management'][$value->trackback_srl]);
|
||||||
{
|
else $_SESSION['trackback_management'][$value->trackback_srl] = true;
|
||||||
if($_SESSION['trackback_management'][$value->trackback_srl]) unset($_SESSION['trackback_management'][$value->trackback_srl]);
|
|
||||||
else $_SESSION['trackback_management'][$value->trackback_srl] = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trackback modular set function
|
* Trackback modular set function
|
||||||
* @param int $module_srl
|
* @param int $module_srl
|
||||||
* @param string $enable_trackback 'Y' or 'N'
|
* @param string $enable_trackback 'Y' or 'N'
|
||||||
* @return Object
|
* @return Object
|
||||||
*/
|
*/
|
||||||
function setTrackbackModuleConfig($module_srl, $enable_trackback) {
|
function setTrackbackModuleConfig($module_srl, $enable_trackback)
|
||||||
$config->enable_trackback = $enable_trackback;
|
{
|
||||||
|
$config->enable_trackback = $enable_trackback;
|
||||||
|
|
||||||
$oModuleController = &getController('module');
|
$oModuleController = &getController('module');
|
||||||
$oModuleController->insertModulePartConfig('trackback', $module_srl, $config);
|
$oModuleController->insertModulePartConfig('trackback', $module_srl, $config);
|
||||||
return new Object();
|
return new Object();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modules belonging to remove all trackbacks
|
* Modules belonging to remove all trackbacks
|
||||||
* @param int $module_srl
|
* @param int $module_srl
|
||||||
* @return object
|
* @return object
|
||||||
*/
|
*/
|
||||||
function deleteModuleTrackbacks($module_srl) {
|
function deleteModuleTrackbacks($module_srl)
|
||||||
// Delete
|
{
|
||||||
$args->module_srl = $module_srl;
|
// Delete
|
||||||
$output = executeQuery('trackback.deleteModuleTrackbacks', $args);
|
$args->module_srl = $module_srl;
|
||||||
|
$output = executeQuery('trackback.deleteModuleTrackbacks', $args);
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
/* End of file trackback.admin.controller.php */
|
||||||
|
/* Location: ./modules/trackback/trackback.admin.controller.php */
|
||||||
|
|
|
||||||
|
|
@ -1,87 +1,93 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* @class trackbackAdminModel
|
||||||
|
* @brief trackback module admin model class
|
||||||
|
*
|
||||||
|
* @author NHN (developers@xpressengine.com)
|
||||||
|
* @package /modules/trackback
|
||||||
|
* @version 0.1
|
||||||
|
*/
|
||||||
|
class trackbackAdminModel extends trackback
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* @class trackbackAdminModel
|
* Initialization
|
||||||
* @brief trackback module admin model class
|
* @return void
|
||||||
*
|
|
||||||
* @author NHN (developers@xpressengine.com)
|
|
||||||
* @package /modules/trackback
|
|
||||||
* @version 0.1
|
|
||||||
*/
|
*/
|
||||||
class trackbackAdminModel extends trackback {
|
function init()
|
||||||
/**
|
{
|
||||||
* Initialization
|
}
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function init() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trackbacks Bringing all the time in reverse order (administrative)
|
* Trackbacks Bringing all the time in reverse order (administrative)
|
||||||
* @param object $obj
|
* @param object $obj
|
||||||
* @return object
|
* @return object
|
||||||
*/
|
*/
|
||||||
function getTotalTrackbackList($obj) {
|
function getTotalTrackbackList($obj)
|
||||||
// Search options
|
{
|
||||||
$search_target = $obj->search_target?$obj->search_target:trim(Context::get('search_target'));
|
// Search options
|
||||||
$search_keyword = $obj->search_keyword?$obj->search_keyword:trim(Context::get('search_keyword'));
|
$search_target = $obj->search_target?$obj->search_target:trim(Context::get('search_target'));
|
||||||
|
$search_keyword = $obj->search_keyword?$obj->search_keyword:trim(Context::get('search_keyword'));
|
||||||
|
|
||||||
if($search_target && $search_keyword) {
|
if($search_target && $search_keyword)
|
||||||
switch($search_target) {
|
|
||||||
case 'url' :
|
|
||||||
if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
|
|
||||||
$args->s_url = $search_keyword;
|
|
||||||
break;
|
|
||||||
case 'title' :
|
|
||||||
if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
|
|
||||||
$args->s_title= $search_keyword;
|
|
||||||
break;
|
|
||||||
case 'blog_name' :
|
|
||||||
if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
|
|
||||||
$args->s_blog_name= $search_keyword;
|
|
||||||
break;
|
|
||||||
case 'excerpt' :
|
|
||||||
if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
|
|
||||||
$args->s_excerpt = $search_keyword;
|
|
||||||
break;
|
|
||||||
case 'regdate' :
|
|
||||||
$args->s_regdate = $search_keyword;
|
|
||||||
break;
|
|
||||||
case 'ipaddress' :
|
|
||||||
$args->s_ipaddress= $search_keyword;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Variables
|
|
||||||
$args->sort_index = $obj->sort_index;
|
|
||||||
$args->page = $obj->page?$obj->page:1;
|
|
||||||
$args->list_count = $obj->list_count?$obj->list_count:20;
|
|
||||||
$args->page_count = $obj->page_count?$obj->page_count:10;
|
|
||||||
$args->s_module_srl = $obj->module_srl;
|
|
||||||
$args->exclude_module_srl = $obj->exclude_module_srl;
|
|
||||||
$args->trackbackSrlList = $obj->trackbackSrlList;
|
|
||||||
// trackback.getTotalTrackbackList query execution
|
|
||||||
$output = executeQuery('trackback.getTotalTrackbackList', $args);
|
|
||||||
// Return if no result or an error occurs
|
|
||||||
if(!$output->toBool()||!count($output->data)) return $output;
|
|
||||||
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return trackback count by date
|
|
||||||
* @param strgin $date
|
|
||||||
* @param array $moduleSrlList
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
function getTrackbackCountByDate($date = '', $moduleSrlList = array())
|
|
||||||
{
|
{
|
||||||
if($date) $args->regDate = date('Ymd', strtotime($date));
|
switch($search_target)
|
||||||
if(count($moduleSrlList)>0) $args->module_srl = $moduleSrlList;
|
{
|
||||||
|
case 'url' :
|
||||||
$output = executeQuery('trackback.getTrackbackCount', $args);
|
if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
|
||||||
if(!$output->toBool()) return 0;
|
$args->s_url = $search_keyword;
|
||||||
|
break;
|
||||||
return $output->data->count;
|
case 'title' :
|
||||||
|
if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
|
||||||
|
$args->s_title= $search_keyword;
|
||||||
|
break;
|
||||||
|
case 'blog_name' :
|
||||||
|
if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
|
||||||
|
$args->s_blog_name= $search_keyword;
|
||||||
|
break;
|
||||||
|
case 'excerpt' :
|
||||||
|
if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
|
||||||
|
$args->s_excerpt = $search_keyword;
|
||||||
|
break;
|
||||||
|
case 'regdate' :
|
||||||
|
$args->s_regdate = $search_keyword;
|
||||||
|
break;
|
||||||
|
case 'ipaddress' :
|
||||||
|
$args->s_ipaddress= $search_keyword;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
// Variables
|
||||||
?>
|
$args->sort_index = $obj->sort_index;
|
||||||
|
$args->page = $obj->page?$obj->page:1;
|
||||||
|
$args->list_count = $obj->list_count?$obj->list_count:20;
|
||||||
|
$args->page_count = $obj->page_count?$obj->page_count:10;
|
||||||
|
$args->s_module_srl = $obj->module_srl;
|
||||||
|
$args->exclude_module_srl = $obj->exclude_module_srl;
|
||||||
|
$args->trackbackSrlList = $obj->trackbackSrlList;
|
||||||
|
// trackback.getTotalTrackbackList query execution
|
||||||
|
$output = executeQuery('trackback.getTotalTrackbackList', $args);
|
||||||
|
// Return if no result or an error occurs
|
||||||
|
if(!$output->toBool()||!count($output->data)) return $output;
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return trackback count by date
|
||||||
|
* @param strgin $date
|
||||||
|
* @param array $moduleSrlList
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
function getTrackbackCountByDate($date = '', $moduleSrlList = array())
|
||||||
|
{
|
||||||
|
if($date) $args->regDate = date('Ymd', strtotime($date));
|
||||||
|
if(count($moduleSrlList)>0) $args->module_srl = $moduleSrlList;
|
||||||
|
|
||||||
|
$output = executeQuery('trackback.getTrackbackCount', $args);
|
||||||
|
if(!$output->toBool()) return 0;
|
||||||
|
|
||||||
|
return $output->data->count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* End of file trackback.admin.model.php */
|
||||||
|
/* Location: ./modules/trackback/trackback.admin.model.php */
|
||||||
|
|
|
||||||
|
|
@ -1,56 +1,59 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* trackbackAdminView class
|
||||||
|
* trackback module admin view class
|
||||||
|
*
|
||||||
|
* @author NHN (developers@xpressengine.com)
|
||||||
|
* @package /modules/trackback
|
||||||
|
* @version 0.1
|
||||||
|
*/
|
||||||
|
class trackbackAdminView extends trackback
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* trackbackAdminView class
|
* Initialization
|
||||||
* trackback module admin view class
|
* @return void
|
||||||
*
|
|
||||||
* @author NHN (developers@xpressengine.com)
|
|
||||||
* @package /modules/trackback
|
|
||||||
* @version 0.1
|
|
||||||
*/
|
*/
|
||||||
class trackbackAdminView extends trackback {
|
function init()
|
||||||
/**
|
{
|
||||||
* Initialization
|
}
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function init() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display output list (administrative)
|
* Display output list (administrative)
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function dispTrackbackAdminList() {
|
function dispTrackbackAdminList()
|
||||||
// Wanted set
|
{
|
||||||
$oModuleModel = &getModel('module');
|
// Wanted set
|
||||||
$config = $oModuleModel->getModuleConfig('trackback');
|
$oModuleModel = &getModel('module');
|
||||||
Context::set('config',$config);
|
$config = $oModuleModel->getModuleConfig('trackback');
|
||||||
|
Context::set('config',$config);
|
||||||
|
|
||||||
// Options to get a list
|
// Options to get a list
|
||||||
$args->page = Context::get('page'); // / "Page
|
$args->page = Context::get('page'); // / "Page
|
||||||
$args->list_count = 30; // / "One page of posts to show the
|
$args->list_count = 30; // / "One page of posts to show the
|
||||||
$args->page_count = 10; // / "Number of pages that appear in the page navigation
|
$args->page_count = 10; // / "Number of pages that appear in the page navigation
|
||||||
|
|
||||||
$args->sort_index = 'list_order'; // / "Sorting values
|
$args->sort_index = 'list_order'; // / "Sorting values
|
||||||
$args->module_srl = Context::get('module_srl');
|
$args->module_srl = Context::get('module_srl');
|
||||||
// Get a list
|
// Get a list
|
||||||
$oTrackbackAdminModel = &getAdminModel('trackback');
|
$oTrackbackAdminModel = &getAdminModel('trackback');
|
||||||
$output = $oTrackbackAdminModel->getTotalTrackbackList($args);
|
$output = $oTrackbackAdminModel->getTotalTrackbackList($args);
|
||||||
|
|
||||||
// To write to a template parameter settings
|
// To write to a template parameter settings
|
||||||
Context::set('total_count', $output->total_count);
|
Context::set('total_count', $output->total_count);
|
||||||
Context::set('total_page', $output->total_page);
|
Context::set('total_page', $output->total_page);
|
||||||
Context::set('page', $output->page);
|
Context::set('page', $output->page);
|
||||||
Context::set('trackback_list', $output->data);
|
Context::set('trackback_list', $output->data);
|
||||||
Context::set('page_navigation', $output->page_navigation);
|
Context::set('page_navigation', $output->page_navigation);
|
||||||
//Security
|
//Security
|
||||||
$security = new Security();
|
$security = new Security();
|
||||||
$security->encodeHTML('config.');
|
$security->encodeHTML('config.');
|
||||||
$security->encodeHTML('trackback_list..');
|
$security->encodeHTML('trackback_list..');
|
||||||
|
|
||||||
// Set a template
|
// Set a template
|
||||||
$this->setTemplatePath($this->module_path.'tpl');
|
$this->setTemplatePath($this->module_path.'tpl');
|
||||||
$this->setTemplateFile('trackback_list');
|
$this->setTemplateFile('trackback_list');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
/* End of file trackback.admin.view.php */
|
||||||
?>
|
/* Location: ./modules/trackback/trackback.admin.view.php */
|
||||||
|
|
|
||||||
|
|
@ -1,89 +1,94 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* trackback class
|
||||||
|
* trackback module's high class
|
||||||
|
*
|
||||||
|
* @author NHN (developers@xpressengine.com)
|
||||||
|
* @package /modules/trackback
|
||||||
|
* @version 0.1
|
||||||
|
*/
|
||||||
|
class trackback extends ModuleObject
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* trackback class
|
* Implement if additional tasks are necessary when installing
|
||||||
* trackback module's high class
|
* @return Object
|
||||||
*
|
|
||||||
* @author NHN (developers@xpressengine.com)
|
|
||||||
* @package /modules/trackback
|
|
||||||
* @version 0.1
|
|
||||||
*/
|
*/
|
||||||
class trackback extends ModuleObject {
|
function moduleInstall()
|
||||||
/**
|
{
|
||||||
* Implement if additional tasks are necessary when installing
|
// Register action forward (to use in administrator mode)
|
||||||
* @return Object
|
$oModuleController = &getController('module');
|
||||||
*/
|
$oModuleController->insertActionForward('trackback', 'controller', 'trackback');
|
||||||
function moduleInstall() {
|
// 2007. 10. 17 posts deleted and will be deleted when the trigger property Trackbacks
|
||||||
// Register action forward (to use in administrator mode)
|
$oModuleController->insertTrigger('document.deleteDocument', 'trackback', 'controller', 'triggerDeleteDocumentTrackbacks', 'after');
|
||||||
$oModuleController = &getController('module');
|
// 2007. 10. 17 modules are deleted when you delete all registered triggers that add Trackbacks
|
||||||
$oModuleController->insertActionForward('trackback', 'controller', 'trackback');
|
$oModuleController->insertTrigger('module.deleteModule', 'trackback', 'controller', 'triggerDeleteModuleTrackbacks', 'after');
|
||||||
// 2007. 10. 17 posts deleted and will be deleted when the trigger property Trackbacks
|
// 2007. 10. Yeokingeul sent from the popup menu features 18 additional posts
|
||||||
$oModuleController->insertTrigger('document.deleteDocument', 'trackback', 'controller', 'triggerDeleteDocumentTrackbacks', 'after');
|
$oModuleController->insertTrigger('document.getDocumentMenu', 'trackback', 'controller', 'triggerSendTrackback', 'after');
|
||||||
// 2007. 10. 17 modules are deleted when you delete all registered triggers that add Trackbacks
|
// 2007. 10. The ability to receive 19 additional modular yeokingeul
|
||||||
$oModuleController->insertTrigger('module.deleteModule', 'trackback', 'controller', 'triggerDeleteModuleTrackbacks', 'after');
|
$oModuleController->insertTrigger('module.dispAdditionSetup', 'trackback', 'view', 'triggerDispTrackbackAdditionSetup', 'before');
|
||||||
// 2007. 10. Yeokingeul sent from the popup menu features 18 additional posts
|
|
||||||
$oModuleController->insertTrigger('document.getDocumentMenu', 'trackback', 'controller', 'triggerSendTrackback', 'after');
|
|
||||||
// 2007. 10. The ability to receive 19 additional modular yeokingeul
|
|
||||||
$oModuleController->insertTrigger('module.dispAdditionSetup', 'trackback', 'view', 'triggerDispTrackbackAdditionSetup', 'before');
|
|
||||||
|
|
||||||
return new Object();
|
return new Object();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A method to check if successfully installed
|
* A method to check if successfully installed
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function checkUpdate() {
|
function checkUpdate()
|
||||||
$oModuleModel = &getModel('module');
|
{
|
||||||
// 2007. 10. 17 posts deleted, even when the comments will be deleted trigger property
|
$oModuleModel = &getModel('module');
|
||||||
if(!$oModuleModel->getTrigger('document.deleteDocument', 'trackback', 'controller', 'triggerDeleteDocumentTrackbacks', 'after')) return true;
|
// 2007. 10. 17 posts deleted, even when the comments will be deleted trigger property
|
||||||
// 2007. 10. 17 modules are deleted when you delete all registered triggers that add Trackbacks
|
if(!$oModuleModel->getTrigger('document.deleteDocument', 'trackback', 'controller', 'triggerDeleteDocumentTrackbacks', 'after')) return true;
|
||||||
if(!$oModuleModel->getTrigger('module.deleteModule', 'trackback', 'controller', 'triggerDeleteModuleTrackbacks', 'after')) return true;
|
// 2007. 10. 17 modules are deleted when you delete all registered triggers that add Trackbacks
|
||||||
// 2007. 10. Yeokingeul sent from the popup menu features 18 additional posts
|
if(!$oModuleModel->getTrigger('module.deleteModule', 'trackback', 'controller', 'triggerDeleteModuleTrackbacks', 'after')) return true;
|
||||||
if(!$oModuleModel->getTrigger('document.getDocumentMenu', 'trackback', 'controller', 'triggerSendTrackback', 'after')) return true;
|
// 2007. 10. Yeokingeul sent from the popup menu features 18 additional posts
|
||||||
// 2007. 10. The ability to receive 19 additional modular yeokingeul
|
if(!$oModuleModel->getTrigger('document.getDocumentMenu', 'trackback', 'controller', 'triggerSendTrackback', 'after')) return true;
|
||||||
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'trackback', 'view', 'triggerDispTrackbackAdditionSetup', 'before')) return true;
|
// 2007. 10. The ability to receive 19 additional modular yeokingeul
|
||||||
|
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'trackback', 'view', 'triggerDispTrackbackAdditionSetup', 'before')) return true;
|
||||||
|
|
||||||
// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
|
// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
|
||||||
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'trackback', 'controller', 'triggerCopyModule', 'after')) return true;
|
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'trackback', 'controller', 'triggerCopyModule', 'after')) return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute update
|
* Execute update
|
||||||
* @return Object
|
* @return Object
|
||||||
*/
|
*/
|
||||||
function moduleUpdate() {
|
function moduleUpdate()
|
||||||
$oModuleModel = &getModel('module');
|
{
|
||||||
$oModuleController = &getController('module');
|
$oModuleModel = &getModel('module');
|
||||||
// 2007. 10. 17 posts deleted, even when the comments will be deleted trigger property
|
$oModuleController = &getController('module');
|
||||||
if(!$oModuleModel->getTrigger('document.deleteDocument', 'trackback', 'controller', 'triggerDeleteDocumentTrackbacks', 'after'))
|
// 2007. 10. 17 posts deleted, even when the comments will be deleted trigger property
|
||||||
$oModuleController->insertTrigger('document.deleteDocument', 'trackback', 'controller', 'triggerDeleteDocumentTrackbacks', 'after');
|
if(!$oModuleModel->getTrigger('document.deleteDocument', 'trackback', 'controller', 'triggerDeleteDocumentTrackbacks', 'after'))
|
||||||
// 2007. 10. 17 modules are deleted when you delete all registered triggers that add Trackbacks
|
$oModuleController->insertTrigger('document.deleteDocument', 'trackback', 'controller', 'triggerDeleteDocumentTrackbacks', 'after');
|
||||||
if(!$oModuleModel->getTrigger('module.deleteModule', 'trackback', 'controller', 'triggerDeleteModuleTrackbacks', 'after'))
|
// 2007. 10. 17 modules are deleted when you delete all registered triggers that add Trackbacks
|
||||||
$oModuleController->insertTrigger('module.deleteModule', 'trackback', 'controller', 'triggerDeleteModuleTrackbacks', 'after');
|
if(!$oModuleModel->getTrigger('module.deleteModule', 'trackback', 'controller', 'triggerDeleteModuleTrackbacks', 'after'))
|
||||||
// 2007. 10. Yeokingeul sent from the popup menu features 18 additional posts
|
$oModuleController->insertTrigger('module.deleteModule', 'trackback', 'controller', 'triggerDeleteModuleTrackbacks', 'after');
|
||||||
if(!$oModuleModel->getTrigger('document.getDocumentMenu', 'trackback', 'controller', 'triggerSendTrackback', 'after'))
|
// 2007. 10. Yeokingeul sent from the popup menu features 18 additional posts
|
||||||
$oModuleController->insertTrigger('document.getDocumentMenu', 'trackback', 'controller', 'triggerSendTrackback', 'after');
|
if(!$oModuleModel->getTrigger('document.getDocumentMenu', 'trackback', 'controller', 'triggerSendTrackback', 'after'))
|
||||||
// 2007. 10. The ability to receive 19 additional modular yeokingeul
|
$oModuleController->insertTrigger('document.getDocumentMenu', 'trackback', 'controller', 'triggerSendTrackback', 'after');
|
||||||
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'trackback', 'view', 'triggerDispTrackbackAdditionSetup', 'before'))
|
// 2007. 10. The ability to receive 19 additional modular yeokingeul
|
||||||
$oModuleController->insertTrigger('module.dispAdditionSetup', 'trackback', 'view', 'triggerDispTrackbackAdditionSetup', 'before');
|
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'trackback', 'view', 'triggerDispTrackbackAdditionSetup', 'before'))
|
||||||
|
$oModuleController->insertTrigger('module.dispAdditionSetup', 'trackback', 'view', 'triggerDispTrackbackAdditionSetup', 'before');
|
||||||
|
|
||||||
// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
|
// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
|
||||||
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'trackback', 'controller', 'triggerCopyModule', 'after'))
|
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'trackback', 'controller', 'triggerCopyModule', 'after'))
|
||||||
{
|
{
|
||||||
$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'trackback', 'controller', 'triggerCopyModule', 'after');
|
$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'trackback', 'controller', 'triggerCopyModule', 'after');
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Object(0, 'success_updated');
|
return new Object(0, 'success_updated');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Re-generate the cache file
|
* Re-generate the cache file
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function recompileCache() {
|
function recompileCache()
|
||||||
}
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
/* End of file trackback.class.php */
|
||||||
|
/* Location: ./modules/trackback/trackback.class.php */
|
||||||
|
|
|
||||||
|
|
@ -1,373 +1,393 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* trackbackController class
|
||||||
|
* trackback module's Controller class
|
||||||
|
*
|
||||||
|
* @author NHN (developers@xpressengine.com)
|
||||||
|
* @package /modules/trackback
|
||||||
|
* @version 0.1
|
||||||
|
*/
|
||||||
|
class trackbackController extends trackback
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* trackbackController class
|
* Initialization
|
||||||
* trackback module's Controller class
|
* @return void
|
||||||
*
|
|
||||||
* @author NHN (developers@xpressengine.com)
|
|
||||||
* @package /modules/trackback
|
|
||||||
* @version 0.1
|
|
||||||
*/
|
*/
|
||||||
class trackbackController extends trackback {
|
function init()
|
||||||
/**
|
{
|
||||||
* Initialization
|
}
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function init() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trackbacks sent
|
* Trackbacks sent
|
||||||
* @return object
|
* @return object
|
||||||
*/
|
*/
|
||||||
function procTrackbackSend() {
|
function procTrackbackSend()
|
||||||
// Yeokingeul to post numbers and shipping addresses Wanted
|
{
|
||||||
$document_srl = Context::get('target_srl');
|
// Yeokingeul to post numbers and shipping addresses Wanted
|
||||||
$trackback_url = Context::get('trackback_url');
|
$document_srl = Context::get('target_srl');
|
||||||
$charset = Context::get('charset');
|
$trackback_url = Context::get('trackback_url');
|
||||||
if(!$document_srl || !$trackback_url || !$charset) return new Object(-1, 'msg_invalid_request');
|
$charset = Context::get('charset');
|
||||||
// Login Information Wanted
|
if(!$document_srl || !$trackback_url || !$charset) return new Object(-1, 'msg_invalid_request');
|
||||||
$logged_info = Context::get('logged_info');
|
// Login Information Wanted
|
||||||
if(!$logged_info->member_srl) return new Object(-1, 'msg_not_permitted');
|
$logged_info = Context::get('logged_info');
|
||||||
// Posts of the information obtained permission to come and check whether
|
if(!$logged_info->member_srl) return new Object(-1, 'msg_not_permitted');
|
||||||
$oDocumentModel = &getModel('document');
|
// Posts of the information obtained permission to come and check whether
|
||||||
$oDocument = $oDocumentModel->getDocument($document_srl);
|
$oDocumentModel = &getModel('document');
|
||||||
if(!$oDocument->isExists() || !$oDocument->getSummary()) return new Object(-1, 'msg_invalid_request');
|
$oDocument = $oDocumentModel->getDocument($document_srl);
|
||||||
if($oDocument->getMemberSrl() != $logged_info->member_srl) return new Object(-1, 'msg_not_permitted');
|
if(!$oDocument->isExists() || !$oDocument->getSummary()) return new Object(-1, 'msg_invalid_request');
|
||||||
// Specify the title of the module, the current article
|
if($oDocument->getMemberSrl() != $logged_info->member_srl) return new Object(-1, 'msg_not_permitted');
|
||||||
$oModuleModel = &getModel('module');
|
// Specify the title of the module, the current article
|
||||||
$module_info = $oModuleModel->getModuleInfoByModuleSrl($oDocument->get('module_srl'));
|
$oModuleModel = &getModel('module');
|
||||||
Context::setBrowserTitle($module_info->browser_title);
|
$module_info = $oModuleModel->getModuleInfoByModuleSrl($oDocument->get('module_srl'));
|
||||||
// Shipping yeokingeul
|
Context::setBrowserTitle($module_info->browser_title);
|
||||||
$output = $this->sendTrackback($oDocument, $trackback_url, $charset);
|
// Shipping yeokingeul
|
||||||
if($output->toBool() && !in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
|
$output = $this->sendTrackback($oDocument, $trackback_url, $charset);
|
||||||
global $lang;
|
if($output->toBool() && !in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
|
||||||
htmlHeader();
|
|
||||||
alertScript($lang->success_registed);
|
|
||||||
reload(true);
|
|
||||||
closePopupScript();
|
|
||||||
htmlFooter();
|
|
||||||
Context::close();
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Trackback List
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function procTrackbackGetList()
|
|
||||||
{
|
{
|
||||||
if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
|
|
||||||
$trackbackSrls = Context::get('trackback_srls');
|
|
||||||
if($trackbackSrls) $trackbackSrlList = explode(',', $trackbackSrls);
|
|
||||||
|
|
||||||
global $lang;
|
global $lang;
|
||||||
if(count($trackbackSrlList) > 0) {
|
htmlHeader();
|
||||||
$oTrackbackAdminModel = &getAdminModel('trackback');
|
alertScript($lang->success_registed);
|
||||||
$args->trackbackSrlList = $trackbackSrlList;
|
reload(true);
|
||||||
$args->list_count = 100;
|
closePopupScript();
|
||||||
$output = $oTrackbackAdminModel->getTotalTrackbackList($args);
|
htmlFooter();
|
||||||
|
Context::close();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
if(is_array($output->data)) $trackbackList = $output->data;
|
/**
|
||||||
else
|
* Trackback List
|
||||||
{
|
* @return void
|
||||||
unset($_SESSION['trackback_management']);
|
*/
|
||||||
$trackbackList = array();
|
function procTrackbackGetList()
|
||||||
$this->setMessage($lang->no_trackbacks);
|
{
|
||||||
}
|
if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
|
||||||
}
|
$trackbackSrls = Context::get('trackback_srls');
|
||||||
|
if($trackbackSrls) $trackbackSrlList = explode(',', $trackbackSrls);
|
||||||
|
|
||||||
|
global $lang;
|
||||||
|
if(count($trackbackSrlList) > 0)
|
||||||
|
{
|
||||||
|
$oTrackbackAdminModel = &getAdminModel('trackback');
|
||||||
|
$args->trackbackSrlList = $trackbackSrlList;
|
||||||
|
$args->list_count = 100;
|
||||||
|
$output = $oTrackbackAdminModel->getTotalTrackbackList($args);
|
||||||
|
|
||||||
|
if(is_array($output->data)) $trackbackList = $output->data;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
unset($_SESSION['trackback_management']);
|
||||||
$trackbackList = array();
|
$trackbackList = array();
|
||||||
$this->setMessage($lang->no_trackbacks);
|
$this->setMessage($lang->no_trackbacks);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$trackbackList = array();
|
||||||
|
$this->setMessage($lang->no_trackbacks);
|
||||||
|
}
|
||||||
|
|
||||||
$this->add('trackback_list', $trackbackList);
|
$this->add('trackback_list', $trackbackList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trackbacks send documents from the popup menu add a menu
|
* Trackbacks send documents from the popup menu add a menu
|
||||||
* @parma array $menu_list
|
* @parma array $menu_list
|
||||||
*/
|
*/
|
||||||
function triggerSendTrackback(&$menu_list) {
|
function triggerSendTrackback(&$menu_list)
|
||||||
$logged_info = Context::get('logged_info');
|
{
|
||||||
if(!$logged_info->member_srl) return new Object();
|
$logged_info = Context::get('logged_info');
|
||||||
// Post number and the current login information requested Wanted
|
if(!$logged_info->member_srl) return new Object();
|
||||||
$document_srl = Context::get('target_srl');
|
// Post number and the current login information requested Wanted
|
||||||
$oDocumentModel = &getModel('document');
|
$document_srl = Context::get('target_srl');
|
||||||
$oDocument = $oDocumentModel->getDocument($document_srl);
|
$oDocumentModel = &getModel('document');
|
||||||
if(!$oDocument->isExists()) return new Object();
|
$oDocument = $oDocumentModel->getDocument($document_srl);
|
||||||
if($oDocument->getMemberSrl() != $logged_info->member_srl) return new Object();
|
if(!$oDocument->isExists()) return new Object();
|
||||||
// Add a link sent yeokingeul
|
if($oDocument->getMemberSrl() != $logged_info->member_srl) return new Object();
|
||||||
$oDocumentController = &getController('document');
|
// Add a link sent yeokingeul
|
||||||
$url = getUrl('','module','trackback','act','dispTrackbackSend','document_srl', $document_srl);
|
$oDocumentController = &getController('document');
|
||||||
$oDocumentController->addDocumentPopupMenu($url,'cmd_send_trackback','','popup');
|
$url = getUrl('','module','trackback','act','dispTrackbackSend','document_srl', $document_srl);
|
||||||
|
$oDocumentController->addDocumentPopupMenu($url,'cmd_send_trackback','','popup');
|
||||||
|
|
||||||
return new Object();
|
return new Object();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete document in the document to delete the trigger Trackbacks
|
* Delete document in the document to delete the trigger Trackbacks
|
||||||
* @param object $obj
|
* @param object $obj
|
||||||
* @return Object
|
* @return Object
|
||||||
*/
|
*/
|
||||||
function triggerDeleteDocumentTrackbacks(&$obj) {
|
function triggerDeleteDocumentTrackbacks(&$obj)
|
||||||
$document_srl = $obj->document_srl;
|
{
|
||||||
if(!$document_srl) return new Object();
|
$document_srl = $obj->document_srl;
|
||||||
|
if(!$document_srl) return new Object();
|
||||||
|
|
||||||
return $this->deleteTrackbacks($document_srl, true);
|
return $this->deleteTrackbacks($document_srl, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletion module that deletes all the trigger yeokingeul
|
* Deletion module that deletes all the trigger yeokingeul
|
||||||
* @param object $obj
|
* @param object $obj
|
||||||
* @return Object
|
* @return Object
|
||||||
*/
|
*/
|
||||||
function triggerDeleteModuleTrackbacks(&$obj) {
|
function triggerDeleteModuleTrackbacks(&$obj)
|
||||||
$module_srl = $obj->module_srl;
|
{
|
||||||
if(!$module_srl) return new Object();
|
$module_srl = $obj->module_srl;
|
||||||
|
if(!$module_srl) return new Object();
|
||||||
|
|
||||||
$oTrackbackController = &getAdminController('trackback');
|
$oTrackbackController = &getAdminController('trackback');
|
||||||
return $oTrackbackController->deleteModuleTrackbacks($module_srl);
|
return $oTrackbackController->deleteModuleTrackbacks($module_srl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trackback inserted
|
* Trackback inserted
|
||||||
* @return Object
|
* @return Object
|
||||||
*/
|
*/
|
||||||
function trackback() {
|
function trackback()
|
||||||
// Output is set to XMLRPC
|
{
|
||||||
Context::setRequestMethod("XMLRPC");
|
// Output is set to XMLRPC
|
||||||
// When receiving the necessary variables yeokingeul Wanted
|
Context::setRequestMethod("XMLRPC");
|
||||||
$obj = Context::gets('document_srl','blog_name','url','title','excerpt');
|
// When receiving the necessary variables yeokingeul Wanted
|
||||||
if(!$obj->document_srl || !$obj->url || !$obj->title || !$obj->excerpt) return $this->stop('fail');
|
$obj = Context::gets('document_srl','blog_name','url','title','excerpt');
|
||||||
// Checks for correct trackback url
|
if(!$obj->document_srl || !$obj->url || !$obj->title || !$obj->excerpt) return $this->stop('fail');
|
||||||
$given_key = Context::get('key');
|
// Checks for correct trackback url
|
||||||
$oTrackbackModel = &getModel('trackback');
|
$given_key = Context::get('key');
|
||||||
$key = $oTrackbackModel->getTrackbackKey($obj->document_srl);
|
$oTrackbackModel = &getModel('trackback');
|
||||||
if($key != $given_key) return $this->stop('fail');
|
$key = $oTrackbackModel->getTrackbackKey($obj->document_srl);
|
||||||
// Yeokingeul module out of the default settings
|
if($key != $given_key) return $this->stop('fail');
|
||||||
$module_srl = Context::get('module_srl');
|
// Yeokingeul module out of the default settings
|
||||||
$oModuleModel = &getModel('module');
|
$module_srl = Context::get('module_srl');
|
||||||
$config = $oModuleModel->getModulePartConfig('trackback', $module_srl);
|
$oModuleModel = &getModel('module');
|
||||||
$enable_trackback = $config->enable_trackback;
|
$config = $oModuleModel->getModulePartConfig('trackback', $module_srl);
|
||||||
if(!$enable_trackback) {
|
$enable_trackback = $config->enable_trackback;
|
||||||
$config = $oModuleModel->getModuleConfig('trackback');
|
if(!$enable_trackback)
|
||||||
$enable_trackback = $config->enable_trackback;
|
{
|
||||||
}
|
$config = $oModuleModel->getModuleConfig('trackback');
|
||||||
|
$enable_trackback = $config->enable_trackback;
|
||||||
// If managers were banned does not Trackbacks
|
}
|
||||||
if($enable_trackback == 'N') return $this->stop('fail');
|
|
||||||
|
|
||||||
return $this->insertTrackback($obj);
|
// If managers were banned does not Trackbacks
|
||||||
}
|
if($enable_trackback == 'N') return $this->stop('fail');
|
||||||
|
|
||||||
/**
|
return $this->insertTrackback($obj);
|
||||||
* Trackback inserted
|
}
|
||||||
* @param object $obj
|
|
||||||
* @param bool $manual_inserted
|
|
||||||
* @return Object
|
|
||||||
*/
|
|
||||||
function insertTrackback($obj, $manual_inserted = false) {
|
|
||||||
// List trackback
|
|
||||||
$obj = Context::convertEncoding($obj);
|
|
||||||
if(!$obj->blog_name) $obj->blog_name = $obj->title;
|
|
||||||
$obj->excerpt = strip_tags($obj->excerpt);
|
|
||||||
// Call a trigger (before)
|
|
||||||
$output = ModuleHandler::triggerCall('trackback.insertTrackback', 'before', $obj);
|
|
||||||
if(!$output->toBool()) return $output;
|
|
||||||
// Document_srl see passed in GET, if an error ~
|
|
||||||
$document_srl = $obj->document_srl;
|
|
||||||
|
|
||||||
if(!$manual_inserted) {
|
/**
|
||||||
// Imported document model object, it permits you to wonbongeul
|
* Trackback inserted
|
||||||
$oDocumentModel = &getModel('document');
|
* @param object $obj
|
||||||
$oDocument = $oDocumentModel->getDocument($document_srl);
|
* @param bool $manual_inserted
|
||||||
// If you do not allow two or trackback wonbongeul error display
|
* @return Object
|
||||||
if(!$oDocument->isExists()) return $this->stop('fail');
|
*/
|
||||||
if(!$oDocument->allowTrackback()) return new Object(-1,'fail');
|
function insertTrackback($obj, $manual_inserted = false)
|
||||||
|
{
|
||||||
|
// List trackback
|
||||||
|
$obj = Context::convertEncoding($obj);
|
||||||
|
if(!$obj->blog_name) $obj->blog_name = $obj->title;
|
||||||
|
$obj->excerpt = strip_tags($obj->excerpt);
|
||||||
|
// Call a trigger (before)
|
||||||
|
$output = ModuleHandler::triggerCall('trackback.insertTrackback', 'before', $obj);
|
||||||
|
if(!$output->toBool()) return $output;
|
||||||
|
// Document_srl see passed in GET, if an error ~
|
||||||
|
$document_srl = $obj->document_srl;
|
||||||
|
|
||||||
$obj->module_srl = $oDocument->get('module_srl');
|
if(!$manual_inserted)
|
||||||
}
|
{
|
||||||
// Enter Trackbacks
|
// Imported document model object, it permits you to wonbongeul
|
||||||
$obj->trackback_srl = getNextSequence();
|
$oDocumentModel = &getModel('document');
|
||||||
$obj->list_order = $obj->trackback_srl*-1;
|
$oDocument = $oDocumentModel->getDocument($document_srl);
|
||||||
$output = executeQuery('trackback.insertTrackback', $obj);
|
// If you do not allow two or trackback wonbongeul error display
|
||||||
if(!$output->toBool()) return $output;
|
if(!$oDocument->isExists()) return $this->stop('fail');
|
||||||
// If there is more to enter the article number yeokingeul Rounds
|
if(!$oDocument->allowTrackback()) return new Object(-1,'fail');
|
||||||
if(!$manual_inserted) {
|
|
||||||
// trackback model object creation
|
|
||||||
$oTrackbackModel = &getModel('trackback');
|
|
||||||
// All the article number yeokingeul guhaeom
|
|
||||||
$trackback_count = $oTrackbackModel->getTrackbackCount($document_srl);
|
|
||||||
// document controller object creation
|
|
||||||
$oDocumentController = &getController('document');
|
|
||||||
// Update the number of posts that yeokingeul
|
|
||||||
$output = $oDocumentController->updateTrackbackCount($document_srl, $trackback_count);
|
|
||||||
// Return result
|
|
||||||
if(!$output->toBool()) return $output;
|
|
||||||
}
|
|
||||||
// Notify wonbongeul (notify_message) if there is a Send a message
|
|
||||||
if(!$manual_inserted) $oDocument->notify(Context::getLang('trackback'), $obj->excerpt);
|
|
||||||
// Call a trigger (after)
|
|
||||||
$output = ModuleHandler::triggerCall('trackback.insertTrackback', 'after', $obj);
|
|
||||||
if(!$output->toBool()) return $output;
|
|
||||||
|
|
||||||
return new Object();
|
$obj->module_srl = $oDocument->get('module_srl');
|
||||||
}
|
}
|
||||||
|
// Enter Trackbacks
|
||||||
|
$obj->trackback_srl = getNextSequence();
|
||||||
|
$obj->list_order = $obj->trackback_srl*-1;
|
||||||
|
$output = executeQuery('trackback.insertTrackback', $obj);
|
||||||
|
if(!$output->toBool()) return $output;
|
||||||
|
// If there is more to enter the article number yeokingeul Rounds
|
||||||
|
if(!$manual_inserted)
|
||||||
|
{
|
||||||
|
// trackback model object creation
|
||||||
|
$oTrackbackModel = &getModel('trackback');
|
||||||
|
// All the article number yeokingeul guhaeom
|
||||||
|
$trackback_count = $oTrackbackModel->getTrackbackCount($document_srl);
|
||||||
|
// document controller object creation
|
||||||
|
$oDocumentController = &getController('document');
|
||||||
|
// Update the number of posts that yeokingeul
|
||||||
|
$output = $oDocumentController->updateTrackbackCount($document_srl, $trackback_count);
|
||||||
|
// Return result
|
||||||
|
if(!$output->toBool()) return $output;
|
||||||
|
}
|
||||||
|
// Notify wonbongeul (notify_message) if there is a Send a message
|
||||||
|
if(!$manual_inserted) $oDocument->notify(Context::getLang('trackback'), $obj->excerpt);
|
||||||
|
// Call a trigger (after)
|
||||||
|
$output = ModuleHandler::triggerCall('trackback.insertTrackback', 'after', $obj);
|
||||||
|
if(!$output->toBool()) return $output;
|
||||||
|
|
||||||
/**
|
return new Object();
|
||||||
* Deleting a single yeokingeul
|
}
|
||||||
* @param int $trackback_srl
|
|
||||||
* @param bool $is_admin
|
|
||||||
* @return object
|
|
||||||
*/
|
|
||||||
function deleteTrackback($trackback_srl, $is_admin = false) {
|
|
||||||
// trackback model object creation
|
|
||||||
$oTrackbackModel = &getModel('trackback');
|
|
||||||
// Make sure that you want to delete Trackbacks
|
|
||||||
$trackback = $oTrackbackModel->getTrackback($trackback_srl);
|
|
||||||
if($trackback->data->trackback_srl != $trackback_srl) return new Object(-1, 'msg_invalid_request');
|
|
||||||
$document_srl = $trackback->data->document_srl;
|
|
||||||
// Call a trigger (before)
|
|
||||||
$output = ModuleHandler::triggerCall('trackback.deleteTrackback', 'before', $trackback);
|
|
||||||
if(!$output->toBool()) return $output;
|
|
||||||
// Create a document model object
|
|
||||||
$oDocumentModel = &getModel('document');
|
|
||||||
// Check if a permossion is granted
|
|
||||||
if(!$is_admin && !$oDocumentModel->isGranted($document_srl)) return new Object(-1, 'msg_not_permitted');
|
|
||||||
|
|
||||||
$args->trackback_srl = $trackback_srl;
|
/**
|
||||||
$output = executeQuery('trackback.deleteTrackback', $args);
|
* Deleting a single yeokingeul
|
||||||
if(!$output->toBool()) return new Object(-1, 'msg_error_occured');
|
* @param int $trackback_srl
|
||||||
// Obtain the number of yeokingeul Update
|
* @param bool $is_admin
|
||||||
$trackback_count = $oTrackbackModel->getTrackbackCount($document_srl);
|
* @return object
|
||||||
// document controller object creation
|
*/
|
||||||
$oDocumentController = &getController('document','controller');
|
function deleteTrackback($trackback_srl, $is_admin = false)
|
||||||
// Update the number of posts that yeokingeul
|
{
|
||||||
$output = $oDocumentController->updateTrackbackCount($document_srl, $trackback_count);
|
// trackback model object creation
|
||||||
$output->add('document_srl', $document_srl);
|
$oTrackbackModel = &getModel('trackback');
|
||||||
// Call a trigger (before)
|
// Make sure that you want to delete Trackbacks
|
||||||
$output = ModuleHandler::triggerCall('trackback.deleteTrackback', 'after', $trackback);
|
$trackback = $oTrackbackModel->getTrackback($trackback_srl);
|
||||||
if(!$output->toBool()) return $output;
|
if($trackback->data->trackback_srl != $trackback_srl) return new Object(-1, 'msg_invalid_request');
|
||||||
|
$document_srl = $trackback->data->document_srl;
|
||||||
|
// Call a trigger (before)
|
||||||
|
$output = ModuleHandler::triggerCall('trackback.deleteTrackback', 'before', $trackback);
|
||||||
|
if(!$output->toBool()) return $output;
|
||||||
|
// Create a document model object
|
||||||
|
$oDocumentModel = &getModel('document');
|
||||||
|
// Check if a permossion is granted
|
||||||
|
if(!$is_admin && !$oDocumentModel->isGranted($document_srl)) return new Object(-1, 'msg_not_permitted');
|
||||||
|
|
||||||
return $output;
|
$args->trackback_srl = $trackback_srl;
|
||||||
}
|
$output = executeQuery('trackback.deleteTrackback', $args);
|
||||||
|
if(!$output->toBool()) return new Object(-1, 'msg_error_occured');
|
||||||
|
// Obtain the number of yeokingeul Update
|
||||||
|
$trackback_count = $oTrackbackModel->getTrackbackCount($document_srl);
|
||||||
|
// document controller object creation
|
||||||
|
$oDocumentController = &getController('document','controller');
|
||||||
|
// Update the number of posts that yeokingeul
|
||||||
|
$output = $oDocumentController->updateTrackbackCount($document_srl, $trackback_count);
|
||||||
|
$output->add('document_srl', $document_srl);
|
||||||
|
// Call a trigger (before)
|
||||||
|
$output = ModuleHandler::triggerCall('trackback.deleteTrackback', 'after', $trackback);
|
||||||
|
if(!$output->toBool()) return $output;
|
||||||
|
|
||||||
/**
|
return $output;
|
||||||
* Delete All RSS Trackback
|
}
|
||||||
* @param int $document_srl
|
|
||||||
* @return object
|
|
||||||
*/
|
|
||||||
function deleteTrackbacks($document_srl) {
|
|
||||||
// Delete
|
|
||||||
$args->document_srl = $document_srl;
|
|
||||||
$output = executeQuery('trackback.deleteTrackbacks', $args);
|
|
||||||
|
|
||||||
return $output;
|
/**
|
||||||
}
|
* Delete All RSS Trackback
|
||||||
|
* @param int $document_srl
|
||||||
|
* @return object
|
||||||
|
*/
|
||||||
|
function deleteTrackbacks($document_srl)
|
||||||
|
{
|
||||||
|
// Delete
|
||||||
|
$args->document_srl = $document_srl;
|
||||||
|
$output = executeQuery('trackback.deleteTrackbacks', $args);
|
||||||
|
|
||||||
/**
|
return $output;
|
||||||
* Trackbacks sent to
|
}
|
||||||
* After sending the results are not sticky and handling
|
|
||||||
* @param documentItem $oDocument
|
|
||||||
* @param string $trackback_url
|
|
||||||
* @param string $charset
|
|
||||||
* @return Object
|
|
||||||
*/
|
|
||||||
function sendTrackback($oDocument, $trackback_url, $charset) {
|
|
||||||
$oModuleController = &getController('module');
|
|
||||||
|
|
||||||
// Information sent by
|
/**
|
||||||
$http = parse_url($trackback_url);
|
* Trackbacks sent to
|
||||||
|
* After sending the results are not sticky and handling
|
||||||
|
* @param documentItem $oDocument
|
||||||
|
* @param string $trackback_url
|
||||||
|
* @param string $charset
|
||||||
|
* @return Object
|
||||||
|
*/
|
||||||
|
function sendTrackback($oDocument, $trackback_url, $charset)
|
||||||
|
{
|
||||||
|
$oModuleController = &getController('module');
|
||||||
|
|
||||||
$obj->blog_name = str_replace(array('<','>','&','"'), array('<','>','&','"'), Context::getBrowserTitle());
|
// Information sent by
|
||||||
$oModuleController->replaceDefinedLangCode($obj->blog_name);
|
$http = parse_url($trackback_url);
|
||||||
$obj->title = $oDocument->getTitleText();
|
|
||||||
$obj->excerpt = $oDocument->getSummary(200);
|
|
||||||
$obj->url = getFullUrl('','document_srl',$oDocument->document_srl);
|
|
||||||
|
|
||||||
// blog_name, title, excerpt, url charset of the string to the requested change
|
$obj->blog_name = str_replace(array('<','>','&','"'), array('<','>','&','"'), Context::getBrowserTitle());
|
||||||
if($charset && function_exists('iconv')) {
|
$oModuleController->replaceDefinedLangCode($obj->blog_name);
|
||||||
foreach($obj as $key=>$val) {
|
$obj->title = $oDocument->getTitleText();
|
||||||
$obj->{$key} = iconv('UTF-8',$charset,$val);
|
$obj->excerpt = $oDocument->getSummary(200);
|
||||||
}
|
$obj->url = getFullUrl('','document_srl',$oDocument->document_srl);
|
||||||
}
|
|
||||||
|
|
||||||
$content =
|
// blog_name, title, excerpt, url charset of the string to the requested change
|
||||||
sprintf(
|
if($charset && function_exists('iconv'))
|
||||||
"title=%s&".
|
{
|
||||||
"url=%s&".
|
foreach($obj as $key=>$val)
|
||||||
"blog_name=%s&".
|
|
||||||
"excerpt=%s",
|
|
||||||
urlencode($obj->title),
|
|
||||||
urlencode($obj->url),
|
|
||||||
urlencode($obj->blog_name),
|
|
||||||
urlencode($obj->excerpt)
|
|
||||||
);
|
|
||||||
|
|
||||||
$buff = FileHandler::getRemoteResource($trackback_url, $content, 3, 'POST', 'application/x-www-form-urlencoded');
|
|
||||||
|
|
||||||
$oXmlParser = new XmlParser();
|
|
||||||
$xmlDoc = $oXmlParser->parse($buff);
|
|
||||||
|
|
||||||
if($xmlDoc->response->error->body == '0')
|
|
||||||
{
|
{
|
||||||
return new Object(0, 'msg_trackback_send_success');
|
$obj->{$key} = iconv('UTF-8',$charset,$val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$content = sprintf(
|
||||||
|
"title=%s&".
|
||||||
|
"url=%s&".
|
||||||
|
"blog_name=%s&".
|
||||||
|
"excerpt=%s",
|
||||||
|
urlencode($obj->title),
|
||||||
|
urlencode($obj->url),
|
||||||
|
urlencode($obj->blog_name),
|
||||||
|
urlencode($obj->excerpt)
|
||||||
|
);
|
||||||
|
|
||||||
|
$buff = FileHandler::getRemoteResource($trackback_url, $content, 3, 'POST', 'application/x-www-form-urlencoded');
|
||||||
|
|
||||||
|
$oXmlParser = new XmlParser();
|
||||||
|
$xmlDoc = $oXmlParser->parse($buff);
|
||||||
|
|
||||||
|
if($xmlDoc->response->error->body == '0')
|
||||||
|
{
|
||||||
|
return new Object(0, 'msg_trackback_send_success');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if($xmlDoc->response->message->body)
|
||||||
|
{
|
||||||
|
return new Object(-1, sprintf('%s: %s', Context::getLang('msg_trackback_send_failed'), $xmlDoc->response->message->body));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if($xmlDoc->response->message->body)
|
return new Object(-1, 'msg_trackback_send_failed');
|
||||||
{
|
|
||||||
return new Object(-1, sprintf('%s: %s', Context::getLang('msg_trackback_send_failed'), $xmlDoc->response->message->body));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return new Object(-1, 'msg_trackback_send_failed');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Within a specific time of a specific ipaddress Trackbacks delete all
|
|
||||||
* @param int $time
|
|
||||||
* @param string $ipaddress
|
|
||||||
* @param string $url
|
|
||||||
* @param string $blog_name
|
|
||||||
* @param string $title
|
|
||||||
* @param string $excerpt
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function deleteTrackbackSender($time, $ipaddress, $url, $blog_name, $title, $excerpt) {
|
|
||||||
$obj->regdate = date("YmdHis",time()-$time);
|
|
||||||
$obj->ipaddress = $ipaddress;
|
|
||||||
$obj->url = $url;
|
|
||||||
$obj->blog_name = $blog_name;
|
|
||||||
$obj->title = $title;
|
|
||||||
$obj->excerpt = $excerpt;
|
|
||||||
$output = executeQueryArray('trackback.getRegistedTrackbacks', $obj);
|
|
||||||
if(!$output->data || !count($output->data)) return;
|
|
||||||
|
|
||||||
foreach($output->data as $trackback) {
|
|
||||||
$trackback_srl = $trackback->trackback_srl;
|
|
||||||
$this->deleteTrackback($trackback_srl, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function triggerCopyModule(&$obj)
|
|
||||||
{
|
|
||||||
$oModuleModel = &getModel('module');
|
|
||||||
$trackbackConfig = $oModuleModel->getModulePartConfig('trackback', $obj->originModuleSrl);
|
|
||||||
|
|
||||||
$oModuleController = &getController('module');
|
|
||||||
if(is_array($obj->moduleSrlList))
|
|
||||||
{
|
|
||||||
foreach($obj->moduleSrlList AS $key=>$moduleSrl)
|
|
||||||
{
|
|
||||||
$oModuleController->insertModulePartConfig('trackback', $moduleSrl, $trackbackConfig);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
/**
|
||||||
|
* Within a specific time of a specific ipaddress Trackbacks delete all
|
||||||
|
* @param int $time
|
||||||
|
* @param string $ipaddress
|
||||||
|
* @param string $url
|
||||||
|
* @param string $blog_name
|
||||||
|
* @param string $title
|
||||||
|
* @param string $excerpt
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function deleteTrackbackSender($time, $ipaddress, $url, $blog_name, $title, $excerpt)
|
||||||
|
{
|
||||||
|
$obj->regdate = date("YmdHis",time()-$time);
|
||||||
|
$obj->ipaddress = $ipaddress;
|
||||||
|
$obj->url = $url;
|
||||||
|
$obj->blog_name = $blog_name;
|
||||||
|
$obj->title = $title;
|
||||||
|
$obj->excerpt = $excerpt;
|
||||||
|
$output = executeQueryArray('trackback.getRegistedTrackbacks', $obj);
|
||||||
|
if(!$output->data || !count($output->data)) return;
|
||||||
|
|
||||||
|
foreach($output->data as $trackback)
|
||||||
|
{
|
||||||
|
$trackback_srl = $trackback->trackback_srl;
|
||||||
|
$this->deleteTrackback($trackback_srl, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function triggerCopyModule(&$obj)
|
||||||
|
{
|
||||||
|
$oModuleModel = &getModel('module');
|
||||||
|
$trackbackConfig = $oModuleModel->getModulePartConfig('trackback', $obj->originModuleSrl);
|
||||||
|
|
||||||
|
$oModuleController = &getController('module');
|
||||||
|
if(is_array($obj->moduleSrlList))
|
||||||
|
{
|
||||||
|
foreach($obj->moduleSrlList AS $key=>$moduleSrl)
|
||||||
|
{
|
||||||
|
$oModuleController->insertModulePartConfig('trackback', $moduleSrl, $trackbackConfig);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* End of file trackback.controller.php */
|
||||||
|
/* Location: ./modules/trackback/trackback.controller.php */
|
||||||
|
|
|
||||||
|
|
@ -1,180 +1,193 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* trackbackModel class
|
||||||
|
* trackback module model class
|
||||||
|
*
|
||||||
|
* @author NHN (developers@xpressengine.com)
|
||||||
|
* @package /modules/trackback
|
||||||
|
* @version 0.1
|
||||||
|
*/
|
||||||
|
class trackbackModel extends trackback
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* trackbackModel class
|
* Initialization
|
||||||
* trackback module model class
|
* @return void
|
||||||
*
|
|
||||||
* @author NHN (developers@xpressengine.com)
|
|
||||||
* @package /modules/trackback
|
|
||||||
* @version 0.1
|
|
||||||
*/
|
*/
|
||||||
class trackbackModel extends trackback {
|
function init()
|
||||||
/**
|
{
|
||||||
* Initialization
|
}
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function init() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wanted a trackback information
|
* Wanted a trackback information
|
||||||
* @param int $trackback_srl
|
* @param int $trackback_srl
|
||||||
* @param array $columnList
|
* @param array $columnList
|
||||||
* @return object
|
* @return object
|
||||||
*/
|
*/
|
||||||
function getTrackback($trackback_srl, $columnList = array()) {
|
function getTrackback($trackback_srl, $columnList = array())
|
||||||
$args->trackback_srl = $trackback_srl;
|
{
|
||||||
$output = executeQuery('trackback.getTrackback', $args, $columnList);
|
$args->trackback_srl = $trackback_srl;
|
||||||
return $output;
|
$output = executeQuery('trackback.getTrackback', $args, $columnList);
|
||||||
}
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trackbacks document_srl corresponding to the bringing of the total number of
|
* Trackbacks document_srl corresponding to the bringing of the total number of
|
||||||
* @param int $document_srl
|
* @param int $document_srl
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function getTrackbackCount($document_srl) {
|
function getTrackbackCount($document_srl)
|
||||||
$args->document_srl = $document_srl;
|
{
|
||||||
$output = executeQuery('trackback.getTrackbackCount', $args);
|
$args->document_srl = $document_srl;
|
||||||
$total_count = $output->data->count;
|
$output = executeQuery('trackback.getTrackbackCount', $args);
|
||||||
|
$total_count = $output->data->count;
|
||||||
|
|
||||||
return (int)$total_count;
|
return (int)$total_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trackbacks module_srl corresponding to the bringing of the total number of
|
||||||
|
* @param int $module_srl
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
function getTrackbackAllCount($module_srl)
|
||||||
|
{
|
||||||
|
$args->module_srl = $module_srl;
|
||||||
|
$output = executeQuery('trackback.getTrackbackCount', $args);
|
||||||
|
$total_count = $output->data->count;
|
||||||
|
|
||||||
/**
|
return (int)$total_count;
|
||||||
* Trackbacks module_srl corresponding to the bringing of the total number of
|
}
|
||||||
* @param int $module_srl
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
function getTrackbackAllCount($module_srl) {
|
|
||||||
$args->module_srl = $module_srl;
|
|
||||||
$output = executeQuery('trackback.getTrackbackCount', $args);
|
|
||||||
$total_count = $output->data->count;
|
|
||||||
|
|
||||||
return (int)$total_count;
|
/**
|
||||||
}
|
* For a particular document to a specific ip number of trackbacks recorded
|
||||||
|
* Im spamfilter method used in
|
||||||
|
* @param int $document_srl
|
||||||
|
* @param string $ipaddress
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
function getTrackbackCountByIPAddress($document_srl, $ipaddress)
|
||||||
|
{
|
||||||
|
$args->document_srl = $document_srl;
|
||||||
|
$args->ipaddress = $ipaddress;
|
||||||
|
$output = executeQuery('trackback.getTrackbackCountByIPAddress', $args);
|
||||||
|
$total_count = $output->data->count;
|
||||||
|
|
||||||
|
return (int)$total_count;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For a particular document to a specific ip number of trackbacks recorded
|
* Trackbacks certain documents belonging to the bringing of the list
|
||||||
* Im spamfilter method used in
|
* @param int $document_srl
|
||||||
* @param int $document_srl
|
* @return array
|
||||||
* @param string $ipaddress
|
*/
|
||||||
* @return int
|
function getTrackbackList($document_srl)
|
||||||
*/
|
{
|
||||||
function getTrackbackCountByIPAddress($document_srl, $ipaddress) {
|
$args->document_srl = $document_srl;
|
||||||
$args->document_srl = $document_srl;
|
$args->list_order = 'list_order';
|
||||||
$args->ipaddress = $ipaddress;
|
$output = executeQuery('trackback.getTrackbackList', $args);
|
||||||
$output = executeQuery('trackback.getTrackbackCountByIPAddress', $args);
|
|
||||||
$total_count = $output->data->count;
|
|
||||||
|
|
||||||
return (int)$total_count;
|
if(!$output->toBool()) return $output;
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
$trackback_list = $output->data;
|
||||||
* Trackbacks certain documents belonging to the bringing of the list
|
|
||||||
* @param int $document_srl
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
function getTrackbackList($document_srl) {
|
|
||||||
$args->document_srl = $document_srl;
|
|
||||||
$args->list_order = 'list_order';
|
|
||||||
$output = executeQuery('trackback.getTrackbackList', $args);
|
|
||||||
|
|
||||||
if(!$output->toBool()) return $output;
|
if(!is_array($trackback_list)) $trackback_list = array($trackback_list);
|
||||||
|
|
||||||
$trackback_list = $output->data;
|
return $trackback_list;
|
||||||
|
}
|
||||||
|
|
||||||
if(!is_array($trackback_list)) $trackback_list = array($trackback_list);
|
/**
|
||||||
|
* Bringing a mid Trackbacks
|
||||||
|
* @param object $obj
|
||||||
|
* @return object
|
||||||
|
*/
|
||||||
|
function getNewestTrackbackList($obj)
|
||||||
|
{
|
||||||
|
if($obj->mid)
|
||||||
|
{
|
||||||
|
$oModuleModel = &getModel('module');
|
||||||
|
$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
|
||||||
|
unset($obj->mid);
|
||||||
|
}
|
||||||
|
// Module_srl passed the array may be a check whether the array
|
||||||
|
if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
|
||||||
|
else $args->module_srl = $obj->module_srl;
|
||||||
|
$args->list_count = $obj->list_count;
|
||||||
|
if($obj->site_srl) $args->site_srl = (int)$obj->site_srl;
|
||||||
|
$args->sort_index = 'trackbacks.list_order';
|
||||||
|
$args->order = 'asc';
|
||||||
|
|
||||||
return $trackback_list;
|
$output = executeQueryArray('trackback.getNewestTrackbackList', $args);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
return $output;
|
||||||
* Bringing a mid Trackbacks
|
}
|
||||||
* @param object $obj
|
|
||||||
* @return object
|
|
||||||
*/
|
|
||||||
function getNewestTrackbackList($obj) {
|
|
||||||
if($obj->mid) {
|
|
||||||
$oModuleModel = &getModel('module');
|
|
||||||
$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
|
|
||||||
unset($obj->mid);
|
|
||||||
}
|
|
||||||
// Module_srl passed the array may be a check whether the array
|
|
||||||
if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
|
|
||||||
else $args->module_srl = $obj->module_srl;
|
|
||||||
$args->list_count = $obj->list_count;
|
|
||||||
if($obj->site_srl) $args->site_srl = (int)$obj->site_srl;
|
|
||||||
$args->sort_index = 'trackbacks.list_order';
|
|
||||||
$args->order = 'asc';
|
|
||||||
|
|
||||||
$output = executeQueryArray('trackback.getNewestTrackbackList', $args);
|
/**
|
||||||
|
* Return to a specific set of modules trackback
|
||||||
|
* @param int $module_srl
|
||||||
|
* @return object
|
||||||
|
*/
|
||||||
|
function getTrackbackModuleConfig($module_srl)
|
||||||
|
{
|
||||||
|
// Bringing trackback module config
|
||||||
|
$oModuleModel = &getModel('module');
|
||||||
|
$module_trackback_config = $oModuleModel->getModulePartConfig('trackback', $module_srl);
|
||||||
|
if(!$module_trackback_config)
|
||||||
|
{
|
||||||
|
$trackback_config = $oModuleModel->getModuleConfig('trackback');
|
||||||
|
$module_trackback_config->enable_trackback = $trackback_config->enable_trackback!='N'?'Y':'N';
|
||||||
|
}
|
||||||
|
$module_trackback_config->module_srl = $module_srl;
|
||||||
|
return $module_trackback_config;
|
||||||
|
}
|
||||||
|
|
||||||
return $output;
|
/**
|
||||||
}
|
* Fixed in time for the entire yeokingeul Wanted to Register
|
||||||
|
* @param int $time
|
||||||
/**
|
* @param string $ipaddress
|
||||||
* Return to a specific set of modules trackback
|
* @param string $url
|
||||||
* @param int $module_srl
|
* @param string $blog_name
|
||||||
* @return object
|
* @param string $title
|
||||||
*/
|
* @param string excerpt
|
||||||
function getTrackbackModuleConfig($module_srl) {
|
* @return int
|
||||||
// Bringing trackback module config
|
*/
|
||||||
$oModuleModel = &getModel('module');
|
function getRegistedTrackback($time, $ipaddress, $url, $blog_name, $title, $excerpt)
|
||||||
$module_trackback_config = $oModuleModel->getModulePartConfig('trackback', $module_srl);
|
{
|
||||||
if(!$module_trackback_config) {
|
$obj->regdate = date("YmdHis",time()-$time);
|
||||||
$trackback_config = $oModuleModel->getModuleConfig('trackback');
|
$obj->ipaddress = $ipaddress;
|
||||||
$module_trackback_config->enable_trackback = $trackback_config->enable_trackback!='N'?'Y':'N';
|
$obj->url = $url;
|
||||||
}
|
$obj->blog_name = $blog_name;
|
||||||
$module_trackback_config->module_srl = $module_srl;
|
$obj->title = $title;
|
||||||
return $module_trackback_config;
|
$obj->excerpt = $excerpt;
|
||||||
}
|
$output = executeQuery('trackback.getRegistedTrackback', $obj);
|
||||||
|
return $output->data->count;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fixed in time for the entire yeokingeul Wanted to Register
|
* Return by creating a trackback url
|
||||||
* @param int $time
|
* Adds the key value in the trackback url.
|
||||||
* @param string $ipaddress
|
* @param int $document_srl
|
||||||
* @param string $url
|
* @return string
|
||||||
* @param string $blog_name
|
*/
|
||||||
* @param string $title
|
function getTrackbackUrl($document_srl, $mid = NULL)
|
||||||
* @param string excerpt
|
{
|
||||||
* @return int
|
$url = getFullUrl('', 'mid', $mid, 'document_srl',$document_srl,'act','trackback','key',$this->getTrackbackKey($document_srl));
|
||||||
*/
|
return $url;
|
||||||
function getRegistedTrackback($time, $ipaddress, $url, $blog_name, $title, $excerpt) {
|
}
|
||||||
$obj->regdate = date("YmdHis",time()-$time);
|
|
||||||
$obj->ipaddress = $ipaddress;
|
|
||||||
$obj->url = $url;
|
|
||||||
$obj->blog_name = $blog_name;
|
|
||||||
$obj->title = $title;
|
|
||||||
$obj->excerpt = $excerpt;
|
|
||||||
$output = executeQuery('trackback.getRegistedTrackback', $obj);
|
|
||||||
return $output->data->count;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return by creating a trackback url
|
* Return keys by generating
|
||||||
* Adds the key value in the trackback url.
|
* db key value information, plus a 10 minute off-duty time together and hash values and deal with the results
|
||||||
* @param int $document_srl
|
* So was extended only url, 1, 10, 20-digit combination of letters only, one return
|
||||||
* @return string
|
* @param int $document_srl
|
||||||
*/
|
* @return string
|
||||||
function getTrackbackUrl($document_srl, $mid = NULL) {
|
*/
|
||||||
$url = getFullUrl('', 'mid', $mid, 'document_srl',$document_srl,'act','trackback','key',$this->getTrackbackKey($document_srl));
|
function getTrackbackKey($document_srl)
|
||||||
return $url;
|
{
|
||||||
}
|
$time = (int) (time()/(60*10));
|
||||||
|
$db_info = Context::getDBInfo();
|
||||||
/**
|
$key = md5($document_srl.$db_info->db_password.$time);
|
||||||
* Return keys by generating
|
return sprintf("%s%s%s",substr($key,1,1),substr($key,10,1),substr($key,20,1));
|
||||||
* db key value information, plus a 10 minute off-duty time together and hash values and deal with the results
|
}
|
||||||
* So was extended only url, 1, 10, 20-digit combination of letters only, one return
|
}
|
||||||
* @param int $document_srl
|
/* End of file trackback.model.php */
|
||||||
* @return string
|
/* Location: ./modules/trackback/trackback.model.php */
|
||||||
*/
|
|
||||||
function getTrackbackKey($document_srl) {
|
|
||||||
$time = (int) (time()/(60*10));
|
|
||||||
$db_info = Context::getDBInfo();
|
|
||||||
$key = md5($document_srl.$db_info->db_password.$time);
|
|
||||||
return sprintf("%s%s%s",substr($key,1,1),substr($key,10,1),substr($key,20,1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
|
||||||
|
|
@ -1,71 +1,77 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* @class trackbackView
|
||||||
|
* @brief trackback module's view class
|
||||||
|
*
|
||||||
|
* @author NHN (developers@xpressengine.com)
|
||||||
|
* @package /modules/trackback
|
||||||
|
* @version 0.1
|
||||||
|
*/
|
||||||
|
class trackbackView extends trackback
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* @class trackbackView
|
* Initialization
|
||||||
* @brief trackback module's view class
|
* @return void
|
||||||
*
|
|
||||||
* @author NHN (developers@xpressengine.com)
|
|
||||||
* @package /modules/trackback
|
|
||||||
* @version 0.1
|
|
||||||
*/
|
*/
|
||||||
class trackbackView extends trackback {
|
function init()
|
||||||
/**
|
{
|
||||||
* Initialization
|
}
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function init() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display output list (administrative)
|
* Display output list (administrative)
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function dispTrackbackSend() {
|
function dispTrackbackSend()
|
||||||
$document_srl = Context::get('document_srl');
|
{
|
||||||
if(!$document_srl) return $this->stop('msg_invalid_request');
|
$document_srl = Context::get('document_srl');
|
||||||
|
if(!$document_srl) return $this->stop('msg_invalid_request');
|
||||||
|
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
if(!$logged_info->member_srl) return $this->stop('msg_not_permitted');
|
if(!$logged_info->member_srl) return $this->stop('msg_not_permitted');
|
||||||
// Wanted Original article information
|
// Wanted Original article information
|
||||||
$oDocumentModel = &getModel('document');
|
$oDocumentModel = &getModel('document');
|
||||||
$oDocument = $oDocumentModel->getDocument($document_srl);
|
$oDocument = $oDocumentModel->getDocument($document_srl);
|
||||||
if(!$oDocument->isExists()) return $this->stop('msg_invalid_document');
|
if(!$oDocument->isExists()) return $this->stop('msg_invalid_document');
|
||||||
if($oDocument->isSecret()) return $this->stop('msg_invalid_request');
|
if($oDocument->isSecret()) return $this->stop('msg_invalid_request');
|
||||||
|
|
||||||
if($oDocument->getMemberSrl() != $logged_info->member_srl) return $this->stop('msg_not_permitted');
|
if($oDocument->getMemberSrl() != $logged_info->member_srl) return $this->stop('msg_not_permitted');
|
||||||
|
|
||||||
Context::set('oDocument', $oDocument);
|
Context::set('oDocument', $oDocument);
|
||||||
// Set a template
|
// Set a template
|
||||||
$this->setLayoutFile('popup_layout');
|
$this->setLayoutFile('popup_layout');
|
||||||
$this->setTemplatePath($this->module_path.'tpl');
|
$this->setTemplatePath($this->module_path.'tpl');
|
||||||
$this->setTemplateFile('send_trackback_form');
|
$this->setTemplateFile('send_trackback_form');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An additional set of parts for a service module
|
* An additional set of parts for a service module
|
||||||
* Use the form out of the settings for trackback
|
* Use the form out of the settings for trackback
|
||||||
* @param string $obj
|
* @param string $obj
|
||||||
* @return Object
|
* @return Object
|
||||||
*/
|
*/
|
||||||
function triggerDispTrackbackAdditionSetup(&$obj) {
|
function triggerDispTrackbackAdditionSetup(&$obj)
|
||||||
$current_module_srl = Context::get('module_srl');
|
{
|
||||||
$current_module_srls = Context::get('module_srls');
|
$current_module_srl = Context::get('module_srl');
|
||||||
|
$current_module_srls = Context::get('module_srls');
|
||||||
|
|
||||||
if(!$current_module_srl && !$current_module_srls) {
|
if(!$current_module_srl && !$current_module_srls)
|
||||||
// Get information of the current module
|
{
|
||||||
$current_module_info = Context::get('current_module_info');
|
// Get information of the current module
|
||||||
$current_module_srl = $current_module_info->module_srl;
|
$current_module_info = Context::get('current_module_info');
|
||||||
if(!$current_module_srl) return new Object();
|
$current_module_srl = $current_module_info->module_srl;
|
||||||
}
|
if(!$current_module_srl) return new Object();
|
||||||
// Imported trackback settings of the selected module
|
}
|
||||||
$oTrackbackModel = &getModel('trackback');
|
// Imported trackback settings of the selected module
|
||||||
$trackback_config = $oTrackbackModel->getTrackbackModuleConfig($current_module_srl);
|
$oTrackbackModel = &getModel('trackback');
|
||||||
Context::set('trackback_config', $trackback_config);
|
$trackback_config = $oTrackbackModel->getTrackbackModuleConfig($current_module_srl);
|
||||||
// Set a template file
|
Context::set('trackback_config', $trackback_config);
|
||||||
$oTemplate = &TemplateHandler::getInstance();
|
// Set a template file
|
||||||
$tpl = $oTemplate->compile($this->module_path.'tpl', 'trackback_module_config');
|
$oTemplate = &TemplateHandler::getInstance();
|
||||||
$obj .= $tpl;
|
$tpl = $oTemplate->compile($this->module_path.'tpl', 'trackback_module_config');
|
||||||
|
$obj .= $tpl;
|
||||||
|
|
||||||
return new Object();
|
return new Object();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
/* End of file trackback.view.php */
|
||||||
|
/* Location: ./modules/trackback/trackback.view.php */
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,8 @@ class trashAdminController extends trash
|
||||||
$originObject = unserialize($output->data->getSerializedObject());
|
$originObject = unserialize($output->data->getSerializedObject());
|
||||||
$output = $oAdminController->restoreTrash($originObject);
|
$output = $oAdminController->restoreTrash($originObject);
|
||||||
|
|
||||||
if(!$output->toBool()) {
|
if(!$output->toBool())
|
||||||
|
{
|
||||||
$oDB->rollback();
|
$oDB->rollback();
|
||||||
return new Object(-1, $output->message);
|
return new Object(-1, $output->message);
|
||||||
}
|
}
|
||||||
|
|
@ -189,7 +190,8 @@ class trashAdminController extends trash
|
||||||
$trashSrls = Context::get('trash_srls');
|
$trashSrls = Context::get('trash_srls');
|
||||||
if($trashSrls) $trashSrlList = explode(',', $trashSrls);
|
if($trashSrls) $trashSrlList = explode(',', $trashSrls);
|
||||||
|
|
||||||
if(count($trashSrlList) > 0) {
|
if(count($trashSrlList) > 0)
|
||||||
|
{
|
||||||
$oTrashModel = &getModel('trash');
|
$oTrashModel = &getModel('trash');
|
||||||
$args->trashSrl = $trashSrlList;
|
$args->trashSrl = $trashSrlList;
|
||||||
$output = $oTrashModel->getTrashList($args);
|
$output = $oTrashModel->getTrashList($args);
|
||||||
|
|
@ -220,6 +222,5 @@ class trashAdminController extends trash
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* End of file trash.admin.controller.php */
|
||||||
/* End of file trash.controller.php */
|
/* Location: ./modules/trash/trash.admin.controller.php */
|
||||||
/* Location: ./modules/trash/trash.controller.php */
|
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,14 @@
|
||||||
* @package /modules/trash
|
* @package /modules/trash
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
*/
|
*/
|
||||||
class trashAdminView extends trash {
|
class trashAdminView extends trash
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Initialization
|
* Initialization
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function init() {
|
function init()
|
||||||
|
{
|
||||||
// 템플릿 경로 지정 (board의 경우 tpl에 관리자용 템플릿 모아놓음)
|
// 템플릿 경로 지정 (board의 경우 tpl에 관리자용 템플릿 모아놓음)
|
||||||
$template_path = sprintf("%stpl/",$this->module_path);
|
$template_path = sprintf("%stpl/",$this->module_path);
|
||||||
$this->setTemplatePath($template_path);
|
$this->setTemplatePath($template_path);
|
||||||
|
|
@ -22,7 +24,8 @@ class trashAdminView extends trash {
|
||||||
* Trash list
|
* Trash list
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function dispTrashAdminList() {
|
function dispTrashAdminList()
|
||||||
|
{
|
||||||
$args->page = Context::get('page'); // /< Page
|
$args->page = Context::get('page'); // /< Page
|
||||||
$args->list_count = 30; // /< the number of posts to display on a single page
|
$args->list_count = 30; // /< the number of posts to display on a single page
|
||||||
$args->page_count = 5; // /< the number of pages that appear in the page navigation
|
$args->page_count = 5; // /< the number of pages that appear in the page navigation
|
||||||
|
|
@ -47,4 +50,5 @@ class trashAdminView extends trash {
|
||||||
$this->setTemplateFile('trash_list');
|
$this->setTemplateFile('trash_list');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
/* End of file trash.admin.view.php */
|
||||||
|
/* Location: ./modules/trash/trash.admin.view.php */
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
require_once(_XE_PATH_.'modules/trash/model/TrashVO.php');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* trash class
|
* trash class
|
||||||
* trash the module's high class
|
* trash the module's high class
|
||||||
|
|
@ -7,15 +9,14 @@
|
||||||
* @package /modules/trash
|
* @package /modules/trash
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
*/
|
*/
|
||||||
|
class trash extends ModuleObject
|
||||||
require_once(_XE_PATH_.'modules/trash/model/TrashVO.php');
|
{
|
||||||
|
|
||||||
class trash extends ModuleObject {
|
|
||||||
/**
|
/**
|
||||||
* Implement if additional tasks are necessary when installing
|
* Implement if additional tasks are necessary when installing
|
||||||
* @return Object
|
* @return Object
|
||||||
*/
|
*/
|
||||||
function moduleInstall() {
|
function moduleInstall()
|
||||||
|
{
|
||||||
return new Object();
|
return new Object();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -23,7 +24,8 @@ class trash extends ModuleObject {
|
||||||
* A method to check if successfully installed
|
* A method to check if successfully installed
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function checkUpdate() {
|
function checkUpdate()
|
||||||
|
{
|
||||||
//$oDB = &DB::getInstance();
|
//$oDB = &DB::getInstance();
|
||||||
//$oModuleModel = &getModel('module');
|
//$oModuleModel = &getModel('module');
|
||||||
|
|
||||||
|
|
@ -34,12 +36,13 @@ class trash extends ModuleObject {
|
||||||
* Execute update
|
* Execute update
|
||||||
* @return Object
|
* @return Object
|
||||||
*/
|
*/
|
||||||
function moduleUpdate() {
|
function moduleUpdate()
|
||||||
|
{
|
||||||
//$oDB = &DB::getInstance();
|
//$oDB = &DB::getInstance();
|
||||||
//$oModuleModel = &getModel('module');
|
//$oModuleModel = &getModel('module');
|
||||||
|
|
||||||
return new Object(0,'success_updated');
|
return new Object(0,'success_updated');
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
/* End of file trash.class.php */
|
||||||
|
/* Location: ./modules/trash/trash.class.php */
|
||||||
|
|
|
||||||
|
|
@ -93,4 +93,5 @@ class trashModel extends trash
|
||||||
$oTrashVO->setRegdate($stdObject->regdate);
|
$oTrashVO->setRegdate($stdObject->regdate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* End of file trash.model.php */
|
||||||
|
/* Location: ./modules/trash/trash.model.php */
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,15 @@
|
||||||
* @package /modules/trash
|
* @package /modules/trash
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
*/
|
*/
|
||||||
class trashView extends trash {
|
class trashView extends trash
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Initialization
|
* Initialization
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function init() {
|
function init()
|
||||||
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
/* End of file trash.view.php */
|
||||||
|
/* Location: ./modules/trash/trash.view.php */
|
||||||
|
|
|
||||||
|
|
@ -1,78 +1,79 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @class widgetAdminView
|
* @class widgetAdminView
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief admin view class for widget modules
|
* @brief admin view class for widget modules
|
||||||
**/
|
*/
|
||||||
|
class widgetAdminView extends widget
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @brief Initialization
|
||||||
|
*/
|
||||||
|
function init()
|
||||||
|
{
|
||||||
|
$this->setTemplatePath($this->module_path.'tpl');
|
||||||
|
}
|
||||||
|
|
||||||
class widgetAdminView extends widget {
|
/**
|
||||||
|
* @brief Showing a list of widgets
|
||||||
|
*/
|
||||||
|
function dispWidgetAdminDownloadedList()
|
||||||
|
{
|
||||||
|
// Set widget list
|
||||||
|
$oWidgetModel = &getModel('widget');
|
||||||
|
$widget_list = $oWidgetModel->getDownloadedWidgetList();
|
||||||
|
|
||||||
/**
|
$security = new Security($widget_list);
|
||||||
* @brief Initialization
|
$widget_list = $security->encodeHTML('..', '..author..');
|
||||||
**/
|
|
||||||
function init() {
|
|
||||||
$this->setTemplatePath($this->module_path.'tpl');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
foreach($widget_list as $no => $widget)
|
||||||
* @brief Showing a list of widgets
|
|
||||||
**/
|
|
||||||
function dispWidgetAdminDownloadedList() {
|
|
||||||
// Set widget list
|
|
||||||
$oWidgetModel = &getModel('widget');
|
|
||||||
$widget_list = $oWidgetModel->getDownloadedWidgetList();
|
|
||||||
|
|
||||||
$security = new Security($widget_list);
|
|
||||||
$widget_list = $security->encodeHTML('..', '..author..');
|
|
||||||
|
|
||||||
foreach($widget_list as $no => $widget)
|
|
||||||
{
|
|
||||||
$widget_list[$no]->description = nl2br(trim($widget->description));
|
|
||||||
}
|
|
||||||
|
|
||||||
Context::set('widget_list', $widget_list);
|
|
||||||
Context::set('tCount', count($widget_list));
|
|
||||||
|
|
||||||
$this->setTemplateFile('downloaded_widget_list');
|
|
||||||
}
|
|
||||||
|
|
||||||
function dispWidgetAdminGenerateCode()
|
|
||||||
{
|
{
|
||||||
$oView = &getView('widget');
|
$widget_list[$no]->description = nl2br(trim($widget->description));
|
||||||
Context::set('in_admin', true);
|
|
||||||
$this->setTemplateFile('widget_generate_code');
|
|
||||||
return $oView->dispWidgetGenerateCode();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
Context::set('widget_list', $widget_list);
|
||||||
* @brief For information on direct entry widget popup kkuhim
|
Context::set('tCount', count($widget_list));
|
||||||
**/
|
|
||||||
function dispWidgetAdminAddContent() {
|
|
||||||
$module_srl = Context::get('module_srl');
|
|
||||||
if(!$module_srl) return $this->stop("msg_invalid_request");
|
|
||||||
|
|
||||||
$document_srl = Context::get('document_srl');
|
$this->setTemplateFile('downloaded_widget_list');
|
||||||
$oDocumentModel = &getModel('document');
|
}
|
||||||
$oDocument = $oDocumentModel->getDocument($document_srl);
|
|
||||||
Context::set('oDocument', $oDocument);
|
|
||||||
|
|
||||||
$oModuleModel = &getModel('module');
|
function dispWidgetAdminGenerateCode()
|
||||||
$columnList = array('module_srl', 'mid');
|
{
|
||||||
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
|
$oView = &getView('widget');
|
||||||
Context::set('module_info', $module_info);
|
Context::set('in_admin', true);
|
||||||
// Editors settings of the module by calling getEditor
|
$this->setTemplateFile('widget_generate_code');
|
||||||
$oEditorModel = &getModel('editor');
|
return $oView->dispWidgetGenerateCode();
|
||||||
$editor = $oEditorModel->getModuleEditor('document',$module_srl, $module_srl,'module_srl','content');
|
}
|
||||||
Context::set('editor', $editor);
|
|
||||||
|
|
||||||
$security = new Security();
|
/**
|
||||||
$security->encodeHTML('member_config..');
|
* @brief For information on direct entry widget popup kkuhim
|
||||||
|
*/
|
||||||
|
function dispWidgetAdminAddContent()
|
||||||
|
{
|
||||||
|
$module_srl = Context::get('module_srl');
|
||||||
|
if(!$module_srl) return $this->stop("msg_invalid_request");
|
||||||
|
|
||||||
$this->setLayoutPath('./common/tpl');
|
$document_srl = Context::get('document_srl');
|
||||||
$this->setLayoutFile("default_layout");
|
$oDocumentModel = &getModel('document');
|
||||||
$this->setTemplateFile('add_content_widget');
|
$oDocument = $oDocumentModel->getDocument($document_srl);
|
||||||
|
Context::set('oDocument', $oDocument);
|
||||||
|
|
||||||
}
|
$oModuleModel = &getModel('module');
|
||||||
|
$columnList = array('module_srl', 'mid');
|
||||||
|
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
|
||||||
|
Context::set('module_info', $module_info);
|
||||||
|
// Editors settings of the module by calling getEditor
|
||||||
|
$oEditorModel = &getModel('editor');
|
||||||
|
$editor = $oEditorModel->getModuleEditor('document',$module_srl, $module_srl,'module_srl','content');
|
||||||
|
Context::set('editor', $editor);
|
||||||
|
|
||||||
}
|
$security = new Security();
|
||||||
?>
|
$security->encodeHTML('member_config..');
|
||||||
|
|
||||||
|
$this->setLayoutPath('./common/tpl');
|
||||||
|
$this->setLayoutFile("default_layout");
|
||||||
|
$this->setTemplateFile('add_content_widget');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* End of file widget.admin.view.php */
|
||||||
|
/* Location: ./modules/widget/widget.admin.view.php */
|
||||||
|
|
|
||||||
|
|
@ -1,56 +1,60 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @class widget
|
* @class widget
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief widget module's high class
|
* @brief widget module's high class
|
||||||
**/
|
*/
|
||||||
|
class widget extends ModuleObject
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @brief Implement if additional tasks are necessary when installing
|
||||||
|
*/
|
||||||
|
function moduleInstall()
|
||||||
|
{
|
||||||
|
// Create cache directory used by widget
|
||||||
|
FileHandler::makeDir('./files/cache/widget');
|
||||||
|
FileHandler::makeDir('./files/cache/widget_cache');
|
||||||
|
// Add this widget compile the trigger for the display.after
|
||||||
|
$oModuleController = &getController('module');
|
||||||
|
$oModuleController->insertTrigger('display', 'widget', 'controller', 'triggerWidgetCompile', 'before');
|
||||||
|
|
||||||
class widget extends ModuleObject {
|
return new Object();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Implement if additional tasks are necessary when installing
|
* @brief a method to check if successfully installed
|
||||||
**/
|
*/
|
||||||
function moduleInstall() {
|
function checkUpdate()
|
||||||
// Create cache directory used by widget
|
{
|
||||||
FileHandler::makeDir('./files/cache/widget');
|
$oModuleModel = &getModel('module');
|
||||||
FileHandler::makeDir('./files/cache/widget_cache');
|
// widget compile display.after trigger for further (04/14/2009)
|
||||||
// Add this widget compile the trigger for the display.after
|
if(!$oModuleModel->getTrigger('display', 'widget', 'controller', 'triggerWidgetCompile', 'before')) return true;
|
||||||
$oModuleController = &getController('module');
|
|
||||||
$oModuleController->insertTrigger('display', 'widget', 'controller', 'triggerWidgetCompile', 'before');
|
|
||||||
|
|
||||||
return new Object();
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief a method to check if successfully installed
|
* @brief Execute update
|
||||||
**/
|
*/
|
||||||
function checkUpdate() {
|
function moduleUpdate()
|
||||||
$oModuleModel = &getModel('module');
|
{
|
||||||
// widget compile display.after trigger for further (04/14/2009)
|
$oModuleModel = &getModel('module');
|
||||||
if(!$oModuleModel->getTrigger('display', 'widget', 'controller', 'triggerWidgetCompile', 'before')) return true;
|
$oModuleController = &getController('module');
|
||||||
|
// widget compile display.after trigger for further (04/14/2009)
|
||||||
|
if(!$oModuleModel->getTrigger('display', 'widget', 'controller', 'triggerWidgetCompile', 'before'))
|
||||||
|
{
|
||||||
|
$oModuleController->insertTrigger('display', 'widget', 'controller', 'triggerWidgetCompile', 'before');
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return new Object(0, 'success_updated');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Execute update
|
* @brief Re-generate the cache file
|
||||||
**/
|
*/
|
||||||
function moduleUpdate() {
|
function recompileCache()
|
||||||
$oModuleModel = &getModel('module');
|
{
|
||||||
$oModuleController = &getController('module');
|
}
|
||||||
// widget compile display.after trigger for further (04/14/2009)
|
}
|
||||||
if(!$oModuleModel->getTrigger('display', 'widget', 'controller', 'triggerWidgetCompile', 'before')) {
|
/* End of file widget.class.php */
|
||||||
$oModuleController->insertTrigger('display', 'widget', 'controller', 'triggerWidgetCompile', 'before');
|
/* Location: ./modules/widget/widget.class.php */
|
||||||
}
|
|
||||||
|
|
||||||
return new Object(0, 'success_updated');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Re-generate the cache file
|
|
||||||
**/
|
|
||||||
function recompileCache() {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,403 +1,430 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @class widgetModel
|
* @class widgetModel
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* @brief Model class for widget modules
|
* @brief Model class for widget modules
|
||||||
**/
|
*/
|
||||||
|
class widgetModel extends widget
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @brief Initialization
|
||||||
|
*/
|
||||||
|
function init()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
class widgetModel extends widget {
|
/**
|
||||||
|
* @brief Wanted widget's path
|
||||||
|
*/
|
||||||
|
function getWidgetPath($widget_name)
|
||||||
|
{
|
||||||
|
$path = sprintf('./widgets/%s/', $widget_name);
|
||||||
|
if(is_dir($path)) return $path;
|
||||||
|
|
||||||
/**
|
return "";
|
||||||
* @brief Initialization
|
}
|
||||||
**/
|
|
||||||
function init() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Wanted widget's path
|
* @brief Wanted widget style path
|
||||||
**/
|
*/
|
||||||
function getWidgetPath($widget_name) {
|
function getWidgetStylePath($widgetStyle_name)
|
||||||
$path = sprintf('./widgets/%s/', $widget_name);
|
{
|
||||||
if(is_dir($path)) return $path;
|
$path = sprintf('./widgetstyles/%s/', $widgetStyle_name);
|
||||||
|
if(is_dir($path)) return $path;
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Wanted widget style path
|
||||||
|
*/
|
||||||
|
function getWidgetStyleTpl($widgetStyle_name)
|
||||||
|
{
|
||||||
|
$path = $this->getWidgetStylePath($widgetStyle_name);
|
||||||
|
$tpl = sprintf('%swidgetstyle.html', $path);
|
||||||
|
return $tpl;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Wanted widget style path
|
* @brief Wanted photos of the type and information
|
||||||
**/
|
* Download a widget with type (generation and other means)
|
||||||
function getWidgetStylePath($widgetStyle_name) {
|
*/
|
||||||
$path = sprintf('./widgetstyles/%s/', $widgetStyle_name);
|
function getDownloadedWidgetList()
|
||||||
if(is_dir($path)) return $path;
|
{
|
||||||
|
$oAutoinstallModel = &getModel('autoinstall');
|
||||||
|
|
||||||
return "";
|
// 've Downloaded the widget and the widget's list of installed Wanted
|
||||||
}
|
$searched_list = FileHandler::readDir('./widgets');
|
||||||
|
$searched_count = count($searched_list);
|
||||||
|
if(!$searched_count) return;
|
||||||
|
sort($searched_list);
|
||||||
|
// D which pertain to the list of widgets loop spins return statement review the information you need
|
||||||
|
for($i=0;$i<$searched_count;$i++)
|
||||||
|
{
|
||||||
|
// The name of the widget
|
||||||
|
$widget = $searched_list[$i];
|
||||||
|
// Wanted information on the Widget
|
||||||
|
$widget_info = $this->getWidgetInfo($widget);
|
||||||
|
|
||||||
/**
|
// get easyinstall remove url
|
||||||
* @brief Wanted widget style path
|
$packageSrl = $oAutoinstallModel->getPackageSrlByPath($widget_info->path);
|
||||||
**/
|
$widget_info->remove_url = $oAutoinstallModel->getRemoveUrlByPackageSrl($packageSrl);
|
||||||
function getWidgetStyleTpl($widgetStyle_name) {
|
|
||||||
$path = $this->getWidgetStylePath($widgetStyle_name);
|
|
||||||
$tpl = sprintf('%swidgetstyle.html', $path);
|
|
||||||
return $tpl;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
// get easyinstall need update
|
||||||
* @brief Wanted photos of the type and information
|
$package = $oAutoinstallModel->getInstalledPackages($packageSrl);
|
||||||
* Download a widget with type (generation and other means)
|
$widget_info->need_update = $package[$packageSrl]->need_update;
|
||||||
**/
|
|
||||||
function getDownloadedWidgetList() {
|
|
||||||
$oAutoinstallModel = &getModel('autoinstall');
|
|
||||||
|
|
||||||
// 've Downloaded the widget and the widget's list of installed Wanted
|
// get easyinstall update url
|
||||||
$searched_list = FileHandler::readDir('./widgets');
|
if ($widget_info->need_update == 'Y')
|
||||||
$searched_count = count($searched_list);
|
{
|
||||||
if(!$searched_count) return;
|
$widget_info->update_url = $oAutoinstallModel->getUpdateUrlByPackageSrl($packageSrl);
|
||||||
sort($searched_list);
|
}
|
||||||
// D which pertain to the list of widgets loop spins return statement review the information you need
|
|
||||||
for($i=0;$i<$searched_count;$i++) {
|
|
||||||
// The name of the widget
|
|
||||||
$widget = $searched_list[$i];
|
|
||||||
// Wanted information on the Widget
|
|
||||||
$widget_info = $this->getWidgetInfo($widget);
|
|
||||||
|
|
||||||
// get easyinstall remove url
|
$list[] = $widget_info;
|
||||||
$packageSrl = $oAutoinstallModel->getPackageSrlByPath($widget_info->path);
|
}
|
||||||
$widget_info->remove_url = $oAutoinstallModel->getRemoveUrlByPackageSrl($packageSrl);
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
// get easyinstall need update
|
/**
|
||||||
$package = $oAutoinstallModel->getInstalledPackages($packageSrl);
|
* @brief Wanted photos of the type and information
|
||||||
$widget_info->need_update = $package[$packageSrl]->need_update;
|
* Download a widget with type (generation and other means)
|
||||||
|
*/
|
||||||
|
function getDownloadedWidgetStyleList()
|
||||||
|
{
|
||||||
|
// 've Downloaded the widget and the widget's list of installed Wanted
|
||||||
|
$searched_list = FileHandler::readDir('./widgetstyles');
|
||||||
|
$searched_count = count($searched_list);
|
||||||
|
if(!$searched_count) return;
|
||||||
|
sort($searched_list);
|
||||||
|
// D which pertain to the list of widgets loop spins return statement review the information you need
|
||||||
|
for($i=0;$i<$searched_count;$i++)
|
||||||
|
{
|
||||||
|
// The name of the widget
|
||||||
|
$widgetStyle = $searched_list[$i];
|
||||||
|
// Wanted information on the Widget
|
||||||
|
$widgetStyle_info = $this->getWidgetStyleInfo($widgetStyle);
|
||||||
|
|
||||||
// get easyinstall update url
|
$list[] = $widgetStyle_info;
|
||||||
if ($widget_info->need_update == 'Y')
|
}
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Modules conf/info.xml wanted to read the information
|
||||||
|
* It uses caching to reduce time for xml parsing ..
|
||||||
|
*/
|
||||||
|
function getWidgetInfo($widget)
|
||||||
|
{
|
||||||
|
// Get a path of the requested module. Return if not exists.
|
||||||
|
$widget_path = $this->getWidgetPath($widget);
|
||||||
|
if(!$widget_path) return;
|
||||||
|
// Read the xml file for module skin information
|
||||||
|
$xml_file = sprintf("%sconf/info.xml", $widget_path);
|
||||||
|
if(!file_exists($xml_file)) return;
|
||||||
|
// If the problem by comparing the cache file and include the return variable $widget_info
|
||||||
|
$cache_file = sprintf('./files/cache/widget/%s.%s.cache.php', $widget, Context::getLangType());
|
||||||
|
|
||||||
|
if(file_exists($cache_file)&&filemtime($cache_file)>filemtime($xml_file))
|
||||||
|
{
|
||||||
|
@include($cache_file);
|
||||||
|
return $widget_info;
|
||||||
|
}
|
||||||
|
// If no cache file exists, parse the xml and then return the variable.
|
||||||
|
$oXmlParser = new XmlParser();
|
||||||
|
$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
|
||||||
|
$xml_obj = $tmp_xml_obj->widget;
|
||||||
|
if(!$xml_obj) return;
|
||||||
|
|
||||||
|
$buff = '';
|
||||||
|
|
||||||
|
if($xml_obj->version && $xml_obj->attrs->version == '0.2')
|
||||||
|
{
|
||||||
|
// Title of the widget, version
|
||||||
|
$buff .= sprintf('$widget_info->widget = "%s";', $widget);
|
||||||
|
$buff .= sprintf('$widget_info->path = "%s";', $widget_path);
|
||||||
|
$buff .= sprintf('$widget_info->title = "%s";', $xml_obj->title->body);
|
||||||
|
$buff .= sprintf('$widget_info->description = "%s";', $xml_obj->description->body);
|
||||||
|
$buff .= sprintf('$widget_info->version = "%s";', $xml_obj->version->body);
|
||||||
|
sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
|
||||||
|
$date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
|
||||||
|
$buff .= sprintf('$widget_info->date = "%s";', $date);
|
||||||
|
$buff .= sprintf('$widget_info->homepage = "%s";', $xml_obj->link->body);
|
||||||
|
$buff .= sprintf('$widget_info->license = "%s";', $xml_obj->license->body);
|
||||||
|
$buff .= sprintf('$widget_info->license_link = "%s";', $xml_obj->license->attrs->link);
|
||||||
|
$buff .= sprintf('$widget_info->widget_srl = $widget_srl;');
|
||||||
|
$buff .= sprintf('$widget_info->widget_title = $widget_title;');
|
||||||
|
// Author information
|
||||||
|
if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
|
||||||
|
else $author_list = $xml_obj->author;
|
||||||
|
|
||||||
|
for($i=0; $i < count($author_list); $i++)
|
||||||
|
{
|
||||||
|
$buff .= sprintf('$widget_info->author['.$i.']->name = "%s";', $author_list[$i]->name->body);
|
||||||
|
$buff .= sprintf('$widget_info->author['.$i.']->email_address = "%s";', $author_list[$i]->attrs->email_address);
|
||||||
|
$buff .= sprintf('$widget_info->author['.$i.']->homepage = "%s";', $author_list[$i]->attrs->link);
|
||||||
|
}
|
||||||
|
|
||||||
|
// history
|
||||||
|
if($xml_obj->history)
|
||||||
|
{
|
||||||
|
if(!is_array($xml_obj->history)) $history_list[] = $xml_obj->history;
|
||||||
|
else $history_list = $xml_obj->history;
|
||||||
|
|
||||||
|
for($i=0; $i < count($history_list); $i++)
|
||||||
{
|
{
|
||||||
$widget_info->update_url = $oAutoinstallModel->getUpdateUrlByPackageSrl($packageSrl);
|
sscanf($history_list[$i]->attrs->date, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
|
||||||
|
$date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
|
||||||
|
$buff .= sprintf('$widget_info->history['.$i.']->description = "%s";', $history_list[$i]->description->body);
|
||||||
|
$buff .= sprintf('$widget_info->history['.$i.']->version = "%s";', $history_list[$i]->attrs->version);
|
||||||
|
$buff .= sprintf('$widget_info->history['.$i.']->date = "%s";', $date);
|
||||||
|
|
||||||
|
if($history_list[$i]->author)
|
||||||
|
{
|
||||||
|
(!is_array($history_list[$i]->author)) ? $obj->author_list[] = $history_list[$i]->author : $obj->author_list = $history_list[$i]->author;
|
||||||
|
|
||||||
|
for($j=0; $j < count($obj->author_list); $j++)
|
||||||
|
{
|
||||||
|
$buff .= sprintf('$widget_info->history['.$i.']->author['.$j.']->name = "%s";', $obj->author_list[$j]->name->body);
|
||||||
|
$buff .= sprintf('$widget_info->history['.$i.']->author['.$j.']->email_address = "%s";', $obj->author_list[$j]->attrs->email_address);
|
||||||
|
$buff .= sprintf('$widget_info->history['.$i.']->author['.$j.']->homepage = "%s";', $obj->author_list[$j]->attrs->link);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($history_list[$i]->log)
|
||||||
|
{
|
||||||
|
(!is_array($history_list[$i]->log)) ? $obj->log_list[] = $history_list[$i]->log : $obj->log_list = $history_list[$i]->log;
|
||||||
|
|
||||||
|
for($j=0; $j < count($obj->log_list); $j++) {
|
||||||
|
$buff .= sprintf('$widget_info->history['.$i.']->logs['.$j.']->text = "%s";', $obj->log_list[$j]->body);
|
||||||
|
$buff .= sprintf('$widget_info->history['.$i.']->logs['.$j.']->link = "%s";', $obj->log_list[$j]->attrs->link);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Title of the widget, version
|
||||||
|
$buff .= sprintf('$widget_info->widget = "%s";', $widget);
|
||||||
|
$buff .= sprintf('$widget_info->path = "%s";', $widget_path);
|
||||||
|
$buff .= sprintf('$widget_info->title = "%s";', $xml_obj->title->body);
|
||||||
|
$buff .= sprintf('$widget_info->description = "%s";', $xml_obj->author->description->body);
|
||||||
|
$buff .= sprintf('$widget_info->version = "%s";', $xml_obj->attrs->version);
|
||||||
|
sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d);
|
||||||
|
$date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
|
||||||
|
$buff .= sprintf('$widget_info->date = "%s";', $date);
|
||||||
|
$buff .= sprintf('$widget_info->widget_srl = $widget_srl;');
|
||||||
|
$buff .= sprintf('$widget_info->widget_title = $widget_title;');
|
||||||
|
// Author information
|
||||||
|
$buff .= sprintf('$widget_info->author[0]->name = "%s";', $xml_obj->author->name->body);
|
||||||
|
$buff .= sprintf('$widget_info->author[0]->email_address = "%s";', $xml_obj->author->attrs->email_address);
|
||||||
|
$buff .= sprintf('$widget_info->author[0]->homepage = "%s";', $xml_obj->author->attrs->link);
|
||||||
|
}
|
||||||
|
// Extra vars (user defined variables to use in a template)
|
||||||
|
$extra_var_groups = $xml_obj->extra_vars->group;
|
||||||
|
if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
|
||||||
|
if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
|
||||||
|
foreach($extra_var_groups as $group)
|
||||||
|
{
|
||||||
|
$extra_vars = $group->var;
|
||||||
|
if(!is_array($group->var)) $extra_vars = array($group->var);
|
||||||
|
|
||||||
|
if($extra_vars[0]->attrs->id || $extra_vars[0]->attrs->name)
|
||||||
|
{
|
||||||
|
$extra_var_count = count($extra_vars);
|
||||||
|
|
||||||
|
$buff .= sprintf('$widget_info->extra_var_count = "%s";', $extra_var_count);
|
||||||
|
for($i=0;$i<$extra_var_count;$i++)
|
||||||
|
{
|
||||||
|
unset($var);
|
||||||
|
unset($options);
|
||||||
|
$var = $extra_vars[$i];
|
||||||
|
|
||||||
|
$id = $var->attrs->id?$var->attrs->id:$var->attrs->name;
|
||||||
|
$name = $var->name->body?$var->name->body:$var->title->body;
|
||||||
|
$type = $var->attrs->type?$var->attrs->type:$var->type->body;
|
||||||
|
if($type =='filebox') $buff .= sprintf('$widget_info->extra_var->%s->filter = "%s";', $id, $var->type->attrs->filter);
|
||||||
|
if($type =='filebox') $buff .= sprintf('$widget_info->extra_var->%s->allow_multiple = "%s";', $id, $var->type->attrs->allow_multiple);
|
||||||
|
|
||||||
|
$buff .= sprintf('$widget_info->extra_var->%s->group = "%s";', $id, $group->title->body);
|
||||||
|
$buff .= sprintf('$widget_info->extra_var->%s->name = "%s";', $id, $name);
|
||||||
|
$buff .= sprintf('$widget_info->extra_var->%s->type = "%s";', $id, $type);
|
||||||
|
$buff .= sprintf('$widget_info->extra_var->%s->value = $vars->%s;', $id, $id);
|
||||||
|
$buff .= sprintf('$widget_info->extra_var->%s->description = "%s";', $id, str_replace('"','\"',$var->description->body));
|
||||||
|
|
||||||
|
$options = $var->options;
|
||||||
|
if(!$options) continue;
|
||||||
|
|
||||||
|
if(!is_array($options)) $options = array($options);
|
||||||
|
$options_count = count($options);
|
||||||
|
for($j=0;$j<$options_count;$j++)
|
||||||
|
{
|
||||||
|
$buff .= sprintf('$widget_info->extra_var->%s->options["%s"] = "%s";', $id, $options[$j]->value->body, $options[$j]->name->body);
|
||||||
|
|
||||||
|
if($options[$j]->attrs->default && $options[$j]->attrs->default=='true')
|
||||||
|
{
|
||||||
|
$buff .= sprintf('$widget_info->extra_var->%s->default_options["%s"] = true;', $id, $options[$j]->value->body);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($options[$j]->attrs->init && $options[$j]->attrs->init=='true')
|
||||||
|
{
|
||||||
|
$buff .= sprintf('$widget_info->extra_var->%s->init_options["%s"] = true;', $id, $options[$j]->value->body);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$buff = '<?php if(!defined("__ZBXE__")) exit(); '.$buff.' ?>';
|
||||||
|
FileHandler::writeFile($cache_file, $buff);
|
||||||
|
|
||||||
|
if(file_exists($cache_file)) @include($cache_file);
|
||||||
|
return $widget_info;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Modules conf/info.xml wanted to read the information
|
||||||
|
* It uses caching to reduce time for xml parsing ..
|
||||||
|
*/
|
||||||
|
function getWidgetStyleInfo($widgetStyle)
|
||||||
|
{
|
||||||
|
$widgetStyle_path = $this->getWidgetStylePath($widgetStyle);
|
||||||
|
if(!$widgetStyle_path) return;
|
||||||
|
$xml_file = sprintf("%sskin.xml", $widgetStyle_path);
|
||||||
|
if(!file_exists($xml_file)) return;
|
||||||
|
// If the problem by comparing the cache file and include the return variable $widgetStyle_info
|
||||||
|
$cache_file = sprintf('./files/cache/widgetstyles/%s.%s.cache.php', $widgetStyle, Context::getLangType());
|
||||||
|
|
||||||
|
if(file_exists($cache_file)&&filemtime($cache_file)>filemtime($xml_file))
|
||||||
|
{
|
||||||
|
@include($cache_file);
|
||||||
|
return $widgetStyle_info;
|
||||||
|
}
|
||||||
|
// If no cache file exists, parse the xml and then return the variable.
|
||||||
|
$oXmlParser = new XmlParser();
|
||||||
|
$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
|
||||||
|
$xml_obj = $tmp_xml_obj->widgetstyle;
|
||||||
|
if(!$xml_obj) return;
|
||||||
|
|
||||||
|
$buff = '';
|
||||||
|
// Title of the widget, version
|
||||||
|
$buff .= sprintf('$widgetStyle_info->widgetStyle = "%s";', $widgetStyle);
|
||||||
|
$buff .= sprintf('$widgetStyle_info->path = "%s";', $widgetStyle_path);
|
||||||
|
$buff .= sprintf('$widgetStyle_info->title = "%s";', $xml_obj->title->body);
|
||||||
|
$buff .= sprintf('$widgetStyle_info->description = "%s";', $xml_obj->description->body);
|
||||||
|
$buff .= sprintf('$widgetStyle_info->version = "%s";', $xml_obj->version->body);
|
||||||
|
sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
|
||||||
|
$date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
|
||||||
|
$buff .= sprintf('$widgetStyle_info->date = "%s";', $date);
|
||||||
|
$buff .= sprintf('$widgetStyle_info->homepage = "%s";', $xml_obj->link->body);
|
||||||
|
$buff .= sprintf('$widgetStyle_info->license = "%s";', $xml_obj->license->body);
|
||||||
|
$buff .= sprintf('$widgetStyle_info->license_link = "%s";', $xml_obj->license->attrs->link);
|
||||||
|
|
||||||
|
// preview
|
||||||
|
if(!$xml_obj->preview->body) $xml_obj->preview->body = 'preview.jpg';
|
||||||
|
$preview_file = sprintf("%s%s", $widgetStyle_path,$xml_obj->preview->body);
|
||||||
|
if(file_exists($preview_file)) $buff .= sprintf('$widgetStyle_info->preview = "%s";', $preview_file);
|
||||||
|
// Author information
|
||||||
|
if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
|
||||||
|
else $author_list = $xml_obj->author;
|
||||||
|
|
||||||
|
for($i=0; $i < count($author_list); $i++)
|
||||||
|
{
|
||||||
|
$buff .= sprintf('$widgetStyle_info->author['.$i.']->name = "%s";', $author_list[$i]->name->body);
|
||||||
|
$buff .= sprintf('$widgetStyle_info->author['.$i.']->email_address = "%s";', $author_list[$i]->attrs->email_address);
|
||||||
|
$buff .= sprintf('$widgetStyle_info->author['.$i.']->homepage = "%s";', $author_list[$i]->attrs->link);
|
||||||
|
}
|
||||||
|
|
||||||
|
// history
|
||||||
|
if($xml_obj->history)
|
||||||
|
{
|
||||||
|
if(!is_array($xml_obj->history)) $history_list[] = $xml_obj->history;
|
||||||
|
else $history_list = $xml_obj->history;
|
||||||
|
|
||||||
|
for($i=0; $i < count($history_list); $i++)
|
||||||
|
{
|
||||||
|
sscanf($history_list[$i]->attrs->date, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
|
||||||
|
$date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
|
||||||
|
$buff .= sprintf('$widgetStyle_info->history['.$i.']->description = "%s";', $history_list[$i]->description->body);
|
||||||
|
$buff .= sprintf('$widgetStyle_info->history['.$i.']->version = "%s";', $history_list[$i]->attrs->version);
|
||||||
|
$buff .= sprintf('$widgetStyle_info->history['.$i.']->date = "%s";', $date);
|
||||||
|
|
||||||
|
if($history_list[$i]->author)
|
||||||
|
{
|
||||||
|
(!is_array($history_list[$i]->author)) ? $obj->author_list[] = $history_list[$i]->author : $obj->author_list = $history_list[$i]->author;
|
||||||
|
|
||||||
|
for($j=0; $j < count($obj->author_list); $j++)
|
||||||
|
{
|
||||||
|
$buff .= sprintf('$widgetStyle_info->history['.$i.']->author['.$j.']->name = "%s";', $obj->author_list[$j]->name->body);
|
||||||
|
$buff .= sprintf('$widgetStyle_info->history['.$i.']->author['.$j.']->email_address = "%s";', $obj->author_list[$j]->attrs->email_address);
|
||||||
|
$buff .= sprintf('$widgetStyle_info->history['.$i.']->author['.$j.']->homepage = "%s";', $obj->author_list[$j]->attrs->link);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$list[] = $widget_info;
|
if($history_list[$i]->log)
|
||||||
}
|
{
|
||||||
return $list;
|
(!is_array($history_list[$i]->log)) ? $obj->log_list[] = $history_list[$i]->log : $obj->log_list = $history_list[$i]->log;
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
for($j=0; $j < count($obj->log_list); $j++)
|
||||||
* @brief Wanted photos of the type and information
|
{
|
||||||
* Download a widget with type (generation and other means)
|
$buff .= sprintf('$widgetStyle_info->history['.$i.']->logs['.$j.']->text = "%s";', $obj->log_list[$j]->body);
|
||||||
**/
|
$buff .= sprintf('$widgetStyle_info->history['.$i.']->logs['.$j.']->link = "%s";', $obj->log_list[$j]->attrs->link);
|
||||||
function getDownloadedWidgetStyleList() {
|
}
|
||||||
// 've Downloaded the widget and the widget's list of installed Wanted
|
}
|
||||||
$searched_list = FileHandler::readDir('./widgetstyles');
|
}
|
||||||
$searched_count = count($searched_list);
|
}
|
||||||
if(!$searched_count) return;
|
// Extra vars (user defined variables to use in a template)
|
||||||
sort($searched_list);
|
$extra_var_groups = $xml_obj->extra_vars->group;
|
||||||
// D which pertain to the list of widgets loop spins return statement review the information you need
|
if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
|
||||||
for($i=0;$i<$searched_count;$i++) {
|
if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
|
||||||
// The name of the widget
|
foreach($extra_var_groups as $group)
|
||||||
$widgetStyle = $searched_list[$i];
|
{
|
||||||
// Wanted information on the Widget
|
$extra_vars = $group->var;
|
||||||
$widgetStyle_info = $this->getWidgetStyleInfo($widgetStyle);
|
if(!is_array($group->var)) $extra_vars = array($group->var);
|
||||||
|
|
||||||
$list[] = $widgetStyle_info;
|
if($extra_vars[0]->attrs->id || $extra_vars[0]->attrs->name)
|
||||||
}
|
{
|
||||||
return $list;
|
$extra_var_count = count($extra_vars);
|
||||||
}
|
|
||||||
|
|
||||||
|
$buff .= sprintf('$widgetStyle_info->extra_var_count = "%s";', $extra_var_count);
|
||||||
|
for($i=0;$i<$extra_var_count;$i++)
|
||||||
|
{
|
||||||
|
unset($var);
|
||||||
|
unset($options);
|
||||||
|
$var = $extra_vars[$i];
|
||||||
|
|
||||||
/**
|
$id = $var->attrs->id?$var->attrs->id:$var->attrs->name;
|
||||||
* @brief Modules conf/info.xml wanted to read the information
|
$name = $var->name->body?$var->name->body:$var->title->body;
|
||||||
* It uses caching to reduce time for xml parsing ..
|
$type = $var->attrs->type?$var->attrs->type:$var->type->body;
|
||||||
**/
|
|
||||||
function getWidgetInfo($widget) {
|
|
||||||
// Get a path of the requested module. Return if not exists.
|
|
||||||
$widget_path = $this->getWidgetPath($widget);
|
|
||||||
if(!$widget_path) return;
|
|
||||||
// Read the xml file for module skin information
|
|
||||||
$xml_file = sprintf("%sconf/info.xml", $widget_path);
|
|
||||||
if(!file_exists($xml_file)) return;
|
|
||||||
// If the problem by comparing the cache file and include the return variable $widget_info
|
|
||||||
$cache_file = sprintf('./files/cache/widget/%s.%s.cache.php', $widget, Context::getLangType());
|
|
||||||
|
|
||||||
|
$buff .= sprintf('$widgetStyle_info->extra_var->%s->group = "%s";', $id, $group->title->body);
|
||||||
|
$buff .= sprintf('$widgetStyle_info->extra_var->%s->name = "%s";', $id, $name);
|
||||||
|
$buff .= sprintf('$widgetStyle_info->extra_var->%s->type = "%s";', $id, $type);
|
||||||
|
if($type =='filebox') $buff .= sprintf('$widgetStyle_info->extra_var->%s->filter = "%s";', $id, $var->attrs->filter);
|
||||||
|
if($type =='filebox') $buff .= sprintf('$widgetStyle_info->extra_var->%s->allow_multiple = "%s";', $id, $var->attrs->allow_multiple);
|
||||||
|
$buff .= sprintf('$widgetStyle_info->extra_var->%s->value = $vars->%s;', $id, $id);
|
||||||
|
$buff .= sprintf('$widgetStyle_info->extra_var->%s->description = "%s";', $id, str_replace('"','\"',$var->description->body));
|
||||||
|
|
||||||
if(file_exists($cache_file)&&filemtime($cache_file)>filemtime($xml_file)) {
|
$options = $var->options;
|
||||||
@include($cache_file);
|
if(!$options) continue;
|
||||||
return $widget_info;
|
|
||||||
}
|
|
||||||
// If no cache file exists, parse the xml and then return the variable.
|
|
||||||
$oXmlParser = new XmlParser();
|
|
||||||
$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
|
|
||||||
$xml_obj = $tmp_xml_obj->widget;
|
|
||||||
if(!$xml_obj) return;
|
|
||||||
|
|
||||||
$buff = '';
|
if(!is_array($options)) $options = array($options);
|
||||||
|
$options_count = count($options);
|
||||||
|
for($j=0;$j<$options_count;$j++)
|
||||||
|
{
|
||||||
|
$buff .= sprintf('$widgetStyle_info->extra_var->%s->options["%s"] = "%s";', $id, $options[$j]->value->body, $options[$j]->name->body);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if($xml_obj->version && $xml_obj->attrs->version == '0.2') {
|
$buff = '<?php if(!defined("__ZBXE__")) exit(); '.$buff.' ?>';
|
||||||
// Title of the widget, version
|
FileHandler::writeFile($cache_file, $buff);
|
||||||
$buff .= sprintf('$widget_info->widget = "%s";', $widget);
|
|
||||||
$buff .= sprintf('$widget_info->path = "%s";', $widget_path);
|
|
||||||
$buff .= sprintf('$widget_info->title = "%s";', $xml_obj->title->body);
|
|
||||||
$buff .= sprintf('$widget_info->description = "%s";', $xml_obj->description->body);
|
|
||||||
$buff .= sprintf('$widget_info->version = "%s";', $xml_obj->version->body);
|
|
||||||
sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
|
|
||||||
$date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
|
|
||||||
$buff .= sprintf('$widget_info->date = "%s";', $date);
|
|
||||||
$buff .= sprintf('$widget_info->homepage = "%s";', $xml_obj->link->body);
|
|
||||||
$buff .= sprintf('$widget_info->license = "%s";', $xml_obj->license->body);
|
|
||||||
$buff .= sprintf('$widget_info->license_link = "%s";', $xml_obj->license->attrs->link);
|
|
||||||
$buff .= sprintf('$widget_info->widget_srl = $widget_srl;');
|
|
||||||
$buff .= sprintf('$widget_info->widget_title = $widget_title;');
|
|
||||||
// Author information
|
|
||||||
if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
|
|
||||||
else $author_list = $xml_obj->author;
|
|
||||||
|
|
||||||
for($i=0; $i < count($author_list); $i++) {
|
if(file_exists($cache_file)) @include($cache_file);
|
||||||
$buff .= sprintf('$widget_info->author['.$i.']->name = "%s";', $author_list[$i]->name->body);
|
return $widgetStyle_info;
|
||||||
$buff .= sprintf('$widget_info->author['.$i.']->email_address = "%s";', $author_list[$i]->attrs->email_address);
|
}
|
||||||
$buff .= sprintf('$widget_info->author['.$i.']->homepage = "%s";', $author_list[$i]->attrs->link);
|
}
|
||||||
}
|
/* End of file widget.model.php */
|
||||||
|
/* Location: ./modules/widget/widget.model.php */
|
||||||
// history
|
|
||||||
if($xml_obj->history) {
|
|
||||||
if(!is_array($xml_obj->history)) $history_list[] = $xml_obj->history;
|
|
||||||
else $history_list = $xml_obj->history;
|
|
||||||
|
|
||||||
for($i=0; $i < count($history_list); $i++) {
|
|
||||||
sscanf($history_list[$i]->attrs->date, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
|
|
||||||
$date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
|
|
||||||
$buff .= sprintf('$widget_info->history['.$i.']->description = "%s";', $history_list[$i]->description->body);
|
|
||||||
$buff .= sprintf('$widget_info->history['.$i.']->version = "%s";', $history_list[$i]->attrs->version);
|
|
||||||
$buff .= sprintf('$widget_info->history['.$i.']->date = "%s";', $date);
|
|
||||||
|
|
||||||
if($history_list[$i]->author) {
|
|
||||||
(!is_array($history_list[$i]->author)) ? $obj->author_list[] = $history_list[$i]->author : $obj->author_list = $history_list[$i]->author;
|
|
||||||
|
|
||||||
for($j=0; $j < count($obj->author_list); $j++) {
|
|
||||||
$buff .= sprintf('$widget_info->history['.$i.']->author['.$j.']->name = "%s";', $obj->author_list[$j]->name->body);
|
|
||||||
$buff .= sprintf('$widget_info->history['.$i.']->author['.$j.']->email_address = "%s";', $obj->author_list[$j]->attrs->email_address);
|
|
||||||
$buff .= sprintf('$widget_info->history['.$i.']->author['.$j.']->homepage = "%s";', $obj->author_list[$j]->attrs->link);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($history_list[$i]->log) {
|
|
||||||
(!is_array($history_list[$i]->log)) ? $obj->log_list[] = $history_list[$i]->log : $obj->log_list = $history_list[$i]->log;
|
|
||||||
|
|
||||||
for($j=0; $j < count($obj->log_list); $j++) {
|
|
||||||
$buff .= sprintf('$widget_info->history['.$i.']->logs['.$j.']->text = "%s";', $obj->log_list[$j]->body);
|
|
||||||
$buff .= sprintf('$widget_info->history['.$i.']->logs['.$j.']->link = "%s";', $obj->log_list[$j]->attrs->link);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// Title of the widget, version
|
|
||||||
$buff .= sprintf('$widget_info->widget = "%s";', $widget);
|
|
||||||
$buff .= sprintf('$widget_info->path = "%s";', $widget_path);
|
|
||||||
$buff .= sprintf('$widget_info->title = "%s";', $xml_obj->title->body);
|
|
||||||
$buff .= sprintf('$widget_info->description = "%s";', $xml_obj->author->description->body);
|
|
||||||
$buff .= sprintf('$widget_info->version = "%s";', $xml_obj->attrs->version);
|
|
||||||
sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d);
|
|
||||||
$date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
|
|
||||||
$buff .= sprintf('$widget_info->date = "%s";', $date);
|
|
||||||
$buff .= sprintf('$widget_info->widget_srl = $widget_srl;');
|
|
||||||
$buff .= sprintf('$widget_info->widget_title = $widget_title;');
|
|
||||||
// Author information
|
|
||||||
$buff .= sprintf('$widget_info->author[0]->name = "%s";', $xml_obj->author->name->body);
|
|
||||||
$buff .= sprintf('$widget_info->author[0]->email_address = "%s";', $xml_obj->author->attrs->email_address);
|
|
||||||
$buff .= sprintf('$widget_info->author[0]->homepage = "%s";', $xml_obj->author->attrs->link);
|
|
||||||
}
|
|
||||||
// Extra vars (user defined variables to use in a template)
|
|
||||||
$extra_var_groups = $xml_obj->extra_vars->group;
|
|
||||||
if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
|
|
||||||
if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
|
|
||||||
foreach($extra_var_groups as $group){
|
|
||||||
$extra_vars = $group->var;
|
|
||||||
if(!is_array($group->var)) $extra_vars = array($group->var);
|
|
||||||
|
|
||||||
if($extra_vars[0]->attrs->id || $extra_vars[0]->attrs->name) {
|
|
||||||
$extra_var_count = count($extra_vars);
|
|
||||||
|
|
||||||
$buff .= sprintf('$widget_info->extra_var_count = "%s";', $extra_var_count);
|
|
||||||
for($i=0;$i<$extra_var_count;$i++) {
|
|
||||||
unset($var);
|
|
||||||
unset($options);
|
|
||||||
$var = $extra_vars[$i];
|
|
||||||
|
|
||||||
$id = $var->attrs->id?$var->attrs->id:$var->attrs->name;
|
|
||||||
$name = $var->name->body?$var->name->body:$var->title->body;
|
|
||||||
$type = $var->attrs->type?$var->attrs->type:$var->type->body;
|
|
||||||
if($type =='filebox') $buff .= sprintf('$widget_info->extra_var->%s->filter = "%s";', $id, $var->type->attrs->filter);
|
|
||||||
if($type =='filebox') $buff .= sprintf('$widget_info->extra_var->%s->allow_multiple = "%s";', $id, $var->type->attrs->allow_multiple);
|
|
||||||
|
|
||||||
$buff .= sprintf('$widget_info->extra_var->%s->group = "%s";', $id, $group->title->body);
|
|
||||||
$buff .= sprintf('$widget_info->extra_var->%s->name = "%s";', $id, $name);
|
|
||||||
$buff .= sprintf('$widget_info->extra_var->%s->type = "%s";', $id, $type);
|
|
||||||
$buff .= sprintf('$widget_info->extra_var->%s->value = $vars->%s;', $id, $id);
|
|
||||||
$buff .= sprintf('$widget_info->extra_var->%s->description = "%s";', $id, str_replace('"','\"',$var->description->body));
|
|
||||||
|
|
||||||
$options = $var->options;
|
|
||||||
if(!$options) continue;
|
|
||||||
|
|
||||||
if(!is_array($options)) $options = array($options);
|
|
||||||
$options_count = count($options);
|
|
||||||
for($j=0;$j<$options_count;$j++) {
|
|
||||||
$buff .= sprintf('$widget_info->extra_var->%s->options["%s"] = "%s";', $id, $options[$j]->value->body, $options[$j]->name->body);
|
|
||||||
|
|
||||||
if($options[$j]->attrs->default && $options[$j]->attrs->default=='true'){
|
|
||||||
$buff .= sprintf('$widget_info->extra_var->%s->default_options["%s"] = true;', $id, $options[$j]->value->body);
|
|
||||||
}
|
|
||||||
|
|
||||||
if($options[$j]->attrs->init && $options[$j]->attrs->init=='true'){
|
|
||||||
$buff .= sprintf('$widget_info->extra_var->%s->init_options["%s"] = true;', $id, $options[$j]->value->body);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$buff = '<?php if(!defined("__ZBXE__")) exit(); '.$buff.' ?>';
|
|
||||||
FileHandler::writeFile($cache_file, $buff);
|
|
||||||
|
|
||||||
if(file_exists($cache_file)) @include($cache_file);
|
|
||||||
return $widget_info;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Modules conf/info.xml wanted to read the information
|
|
||||||
* It uses caching to reduce time for xml parsing ..
|
|
||||||
**/
|
|
||||||
function getWidgetStyleInfo($widgetStyle) {
|
|
||||||
|
|
||||||
$widgetStyle_path = $this->getWidgetStylePath($widgetStyle);
|
|
||||||
if(!$widgetStyle_path) return;
|
|
||||||
$xml_file = sprintf("%sskin.xml", $widgetStyle_path);
|
|
||||||
if(!file_exists($xml_file)) return;
|
|
||||||
// If the problem by comparing the cache file and include the return variable $widgetStyle_info
|
|
||||||
$cache_file = sprintf('./files/cache/widgetstyles/%s.%s.cache.php', $widgetStyle, Context::getLangType());
|
|
||||||
|
|
||||||
if(file_exists($cache_file)&&filemtime($cache_file)>filemtime($xml_file)) {
|
|
||||||
@include($cache_file);
|
|
||||||
return $widgetStyle_info;
|
|
||||||
}
|
|
||||||
// If no cache file exists, parse the xml and then return the variable.
|
|
||||||
$oXmlParser = new XmlParser();
|
|
||||||
$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
|
|
||||||
$xml_obj = $tmp_xml_obj->widgetstyle;
|
|
||||||
if(!$xml_obj) return;
|
|
||||||
|
|
||||||
$buff = '';
|
|
||||||
// Title of the widget, version
|
|
||||||
$buff .= sprintf('$widgetStyle_info->widgetStyle = "%s";', $widgetStyle);
|
|
||||||
$buff .= sprintf('$widgetStyle_info->path = "%s";', $widgetStyle_path);
|
|
||||||
$buff .= sprintf('$widgetStyle_info->title = "%s";', $xml_obj->title->body);
|
|
||||||
$buff .= sprintf('$widgetStyle_info->description = "%s";', $xml_obj->description->body);
|
|
||||||
$buff .= sprintf('$widgetStyle_info->version = "%s";', $xml_obj->version->body);
|
|
||||||
sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
|
|
||||||
$date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
|
|
||||||
$buff .= sprintf('$widgetStyle_info->date = "%s";', $date);
|
|
||||||
$buff .= sprintf('$widgetStyle_info->homepage = "%s";', $xml_obj->link->body);
|
|
||||||
$buff .= sprintf('$widgetStyle_info->license = "%s";', $xml_obj->license->body);
|
|
||||||
$buff .= sprintf('$widgetStyle_info->license_link = "%s";', $xml_obj->license->attrs->link);
|
|
||||||
|
|
||||||
// preview
|
|
||||||
if(!$xml_obj->preview->body) $xml_obj->preview->body = 'preview.jpg';
|
|
||||||
$preview_file = sprintf("%s%s", $widgetStyle_path,$xml_obj->preview->body);
|
|
||||||
if(file_exists($preview_file)) $buff .= sprintf('$widgetStyle_info->preview = "%s";', $preview_file);
|
|
||||||
// Author information
|
|
||||||
if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
|
|
||||||
else $author_list = $xml_obj->author;
|
|
||||||
|
|
||||||
for($i=0; $i < count($author_list); $i++) {
|
|
||||||
$buff .= sprintf('$widgetStyle_info->author['.$i.']->name = "%s";', $author_list[$i]->name->body);
|
|
||||||
$buff .= sprintf('$widgetStyle_info->author['.$i.']->email_address = "%s";', $author_list[$i]->attrs->email_address);
|
|
||||||
$buff .= sprintf('$widgetStyle_info->author['.$i.']->homepage = "%s";', $author_list[$i]->attrs->link);
|
|
||||||
}
|
|
||||||
|
|
||||||
// history
|
|
||||||
if($xml_obj->history) {
|
|
||||||
if(!is_array($xml_obj->history)) $history_list[] = $xml_obj->history;
|
|
||||||
else $history_list = $xml_obj->history;
|
|
||||||
|
|
||||||
for($i=0; $i < count($history_list); $i++) {
|
|
||||||
sscanf($history_list[$i]->attrs->date, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
|
|
||||||
$date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
|
|
||||||
$buff .= sprintf('$widgetStyle_info->history['.$i.']->description = "%s";', $history_list[$i]->description->body);
|
|
||||||
$buff .= sprintf('$widgetStyle_info->history['.$i.']->version = "%s";', $history_list[$i]->attrs->version);
|
|
||||||
$buff .= sprintf('$widgetStyle_info->history['.$i.']->date = "%s";', $date);
|
|
||||||
|
|
||||||
if($history_list[$i]->author) {
|
|
||||||
(!is_array($history_list[$i]->author)) ? $obj->author_list[] = $history_list[$i]->author : $obj->author_list = $history_list[$i]->author;
|
|
||||||
|
|
||||||
for($j=0; $j < count($obj->author_list); $j++) {
|
|
||||||
$buff .= sprintf('$widgetStyle_info->history['.$i.']->author['.$j.']->name = "%s";', $obj->author_list[$j]->name->body);
|
|
||||||
$buff .= sprintf('$widgetStyle_info->history['.$i.']->author['.$j.']->email_address = "%s";', $obj->author_list[$j]->attrs->email_address);
|
|
||||||
$buff .= sprintf('$widgetStyle_info->history['.$i.']->author['.$j.']->homepage = "%s";', $obj->author_list[$j]->attrs->link);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($history_list[$i]->log) {
|
|
||||||
(!is_array($history_list[$i]->log)) ? $obj->log_list[] = $history_list[$i]->log : $obj->log_list = $history_list[$i]->log;
|
|
||||||
|
|
||||||
for($j=0; $j < count($obj->log_list); $j++) {
|
|
||||||
$buff .= sprintf('$widgetStyle_info->history['.$i.']->logs['.$j.']->text = "%s";', $obj->log_list[$j]->body);
|
|
||||||
$buff .= sprintf('$widgetStyle_info->history['.$i.']->logs['.$j.']->link = "%s";', $obj->log_list[$j]->attrs->link);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Extra vars (user defined variables to use in a template)
|
|
||||||
$extra_var_groups = $xml_obj->extra_vars->group;
|
|
||||||
if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
|
|
||||||
if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
|
|
||||||
foreach($extra_var_groups as $group){
|
|
||||||
$extra_vars = $group->var;
|
|
||||||
if(!is_array($group->var)) $extra_vars = array($group->var);
|
|
||||||
|
|
||||||
if($extra_vars[0]->attrs->id || $extra_vars[0]->attrs->name) {
|
|
||||||
$extra_var_count = count($extra_vars);
|
|
||||||
|
|
||||||
$buff .= sprintf('$widgetStyle_info->extra_var_count = "%s";', $extra_var_count);
|
|
||||||
for($i=0;$i<$extra_var_count;$i++) {
|
|
||||||
unset($var);
|
|
||||||
unset($options);
|
|
||||||
$var = $extra_vars[$i];
|
|
||||||
|
|
||||||
$id = $var->attrs->id?$var->attrs->id:$var->attrs->name;
|
|
||||||
$name = $var->name->body?$var->name->body:$var->title->body;
|
|
||||||
$type = $var->attrs->type?$var->attrs->type:$var->type->body;
|
|
||||||
|
|
||||||
|
|
||||||
$buff .= sprintf('$widgetStyle_info->extra_var->%s->group = "%s";', $id, $group->title->body);
|
|
||||||
$buff .= sprintf('$widgetStyle_info->extra_var->%s->name = "%s";', $id, $name);
|
|
||||||
$buff .= sprintf('$widgetStyle_info->extra_var->%s->type = "%s";', $id, $type);
|
|
||||||
if($type =='filebox') $buff .= sprintf('$widgetStyle_info->extra_var->%s->filter = "%s";', $id, $var->attrs->filter);
|
|
||||||
if($type =='filebox') $buff .= sprintf('$widgetStyle_info->extra_var->%s->allow_multiple = "%s";', $id, $var->attrs->allow_multiple);
|
|
||||||
$buff .= sprintf('$widgetStyle_info->extra_var->%s->value = $vars->%s;', $id, $id);
|
|
||||||
$buff .= sprintf('$widgetStyle_info->extra_var->%s->description = "%s";', $id, str_replace('"','\"',$var->description->body));
|
|
||||||
|
|
||||||
$options = $var->options;
|
|
||||||
if(!$options) continue;
|
|
||||||
|
|
||||||
if(!is_array($options)) $options = array($options);
|
|
||||||
$options_count = count($options);
|
|
||||||
for($j=0;$j<$options_count;$j++) {
|
|
||||||
$buff .= sprintf('$widgetStyle_info->extra_var->%s->options["%s"] = "%s";', $id, $options[$j]->value->body, $options[$j]->name->body);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$buff = '<?php if(!defined("__ZBXE__")) exit(); '.$buff.' ?>';
|
|
||||||
FileHandler::writeFile($cache_file, $buff);
|
|
||||||
|
|
||||||
if(file_exists($cache_file)) @include($cache_file);
|
|
||||||
return $widgetStyle_info;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
|
||||||
|
|
@ -1,138 +1,148 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @class widgetView
|
* @class widgetView
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief View class of the widget modules
|
* @brief View class of the widget modules
|
||||||
**/
|
*/
|
||||||
|
class widgetView extends widget
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @brief Initialization
|
||||||
|
*/
|
||||||
|
function init()
|
||||||
|
{
|
||||||
|
$this->setTemplatePath($this->module_path.'tpl');
|
||||||
|
}
|
||||||
|
|
||||||
class widgetView extends widget {
|
/**
|
||||||
|
* @brief Details of the widget (conf/info.xml) a pop-out
|
||||||
|
*/
|
||||||
|
function dispWidgetInfo()
|
||||||
|
{
|
||||||
|
// If people have skin widget widget output as a function of the skin More Details
|
||||||
|
if(Context::get('skin')) return $this->dispWidgetSkinInfo();
|
||||||
|
// Wanted widget is selected information
|
||||||
|
$oWidgetModel = &getModel('widget');
|
||||||
|
$widget_info = $oWidgetModel->getWidgetInfo(Context::get('selected_widget'));
|
||||||
|
Context::set('widget_info', $widget_info);
|
||||||
|
// Specifies the widget to pop up
|
||||||
|
$this->setLayoutFile('popup_layout');
|
||||||
|
// Set a template file
|
||||||
|
$this->setTemplateFile('widget_detail_info');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialization
|
* @brief Widget details of the skin (skin.xml) a pop-out
|
||||||
**/
|
*/
|
||||||
function init() {
|
function dispWidgetSkinInfo()
|
||||||
$this->setTemplatePath($this->module_path.'tpl');
|
{
|
||||||
}
|
$widget = Context::get('selected_widget');
|
||||||
|
$skin = Context::get('skin');
|
||||||
|
|
||||||
/**
|
$path = sprintf('./widgets/%s/', $widget);
|
||||||
* @brief Details of the widget (conf/info.xml) a pop-out
|
// Wanted widget is selected information
|
||||||
**/
|
$oModuleModel = &getModel('module');
|
||||||
function dispWidgetInfo() {
|
$skin_info = $oModuleModel->loadSkinInfo($path, $skin);
|
||||||
// If people have skin widget widget output as a function of the skin More Details
|
|
||||||
if(Context::get('skin')) return $this->dispWidgetSkinInfo();
|
|
||||||
// Wanted widget is selected information
|
|
||||||
$oWidgetModel = &getModel('widget');
|
|
||||||
$widget_info = $oWidgetModel->getWidgetInfo(Context::get('selected_widget'));
|
|
||||||
Context::set('widget_info', $widget_info);
|
|
||||||
// Specifies the widget to pop up
|
|
||||||
$this->setLayoutFile('popup_layout');
|
|
||||||
// Set a template file
|
|
||||||
$this->setTemplateFile('widget_detail_info');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
Context::set('skin_info',$skin_info);
|
||||||
* @brief Widget details of the skin (skin.xml) a pop-out
|
// Specifies the widget to pop up
|
||||||
**/
|
$this->setLayoutFile('popup_layout');
|
||||||
function dispWidgetSkinInfo() {
|
// Set a template file
|
||||||
$widget = Context::get('selected_widget');
|
$this->setTemplateFile('skin_info');
|
||||||
$skin = Context::get('skin');
|
}
|
||||||
|
|
||||||
$path = sprintf('./widgets/%s/', $widget);
|
/**
|
||||||
// Wanted widget is selected information
|
* @brief Widget's code generator
|
||||||
$oModuleModel = &getModel('module');
|
*/
|
||||||
$skin_info = $oModuleModel->loadSkinInfo($path, $skin);
|
function dispWidgetGenerateCode()
|
||||||
|
{
|
||||||
|
// Wanted widget is selected information
|
||||||
|
$oWidgetModel = &getModel('widget');
|
||||||
|
|
||||||
Context::set('skin_info',$skin_info);
|
$widget_list = $oWidgetModel->getDownloadedWidgetList();
|
||||||
// Specifies the widget to pop up
|
$selected_widget = Context::get('selected_widget');
|
||||||
$this->setLayoutFile('popup_layout');
|
if(!$selected_widget) $selected_widget = $widget_list[0]->widget;
|
||||||
// Set a template file
|
|
||||||
$this->setTemplateFile('skin_info');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
$widget_info = $oWidgetModel->getWidgetInfo($selected_widget);
|
||||||
* @brief Widget's code generator
|
Context::set('widget_info', $widget_info);
|
||||||
**/
|
Context::set('widget_list', $widget_list);
|
||||||
function dispWidgetGenerateCode() {
|
Context::set('selected_widget', $selected_widget);
|
||||||
// Wanted widget is selected information
|
|
||||||
$oWidgetModel = &getModel('widget');
|
|
||||||
|
|
||||||
$widget_list = $oWidgetModel->getDownloadedWidgetList();
|
$oModuleModel = &getModel('module');
|
||||||
$selected_widget = Context::get('selected_widget');
|
// Get a list of module categories
|
||||||
if(!$selected_widget) $selected_widget = $widget_list[0]->widget;
|
$module_categories = $oModuleModel->getModuleCategories();
|
||||||
|
// Get a mid list
|
||||||
|
$site_module_info = Context::get('site_module_info');
|
||||||
|
$args->site_srl = $site_module_info->site_srl;
|
||||||
|
$columnList = array('module_srl', 'module_category_srl', 'browser_title', 'mid');
|
||||||
|
$mid_list = $oModuleModel->getMidList($args, $columnList);
|
||||||
|
|
||||||
$widget_info = $oWidgetModel->getWidgetInfo($selected_widget);
|
// Get a list of groups
|
||||||
Context::set('widget_info', $widget_info);
|
$oMemberModel = &getModel('member');
|
||||||
Context::set('widget_list', $widget_list);
|
$group_list = $oMemberModel->getGroups($site_module_info->site_srl);
|
||||||
Context::set('selected_widget', $selected_widget);
|
Context::set('group_list', $group_list);
|
||||||
|
// module_category and module combination
|
||||||
|
if($module_categories)
|
||||||
|
{
|
||||||
|
foreach($mid_list as $module_srl => $module) {
|
||||||
|
$module_categories[$module->module_category_srl]->list[$module_srl] = $module;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$module_categories[0]->list = $mid_list;
|
||||||
|
}
|
||||||
|
|
||||||
$oModuleModel = &getModel('module');
|
Context::set('mid_list',$module_categories);
|
||||||
// Get a list of module categories
|
// Menu Get a list
|
||||||
$module_categories = $oModuleModel->getModuleCategories();
|
$output = executeQueryArray('menu.getMenus');
|
||||||
// Get a mid list
|
Context::set('menu_list',$output->data);
|
||||||
$site_module_info = Context::get('site_module_info');
|
// Wanted information on skin
|
||||||
$args->site_srl = $site_module_info->site_srl;
|
$skin_list = $oModuleModel->getSkins($widget_info->path);
|
||||||
$columnList = array('module_srl', 'module_category_srl', 'browser_title', 'mid');
|
Context::set('skin_list', $skin_list);
|
||||||
$mid_list = $oModuleModel->getMidList($args, $columnList);
|
// Specifies the widget to pop up
|
||||||
|
$this->setLayoutFile('popup_layout');
|
||||||
|
// Set a template file
|
||||||
|
$this->setTemplateFile('widget_generate_code');
|
||||||
|
}
|
||||||
|
|
||||||
// Get a list of groups
|
/**
|
||||||
$oMemberModel = &getModel('member');
|
* @brief Managing pop-up pages used in the generated code
|
||||||
$group_list = $oMemberModel->getGroups($site_module_info->site_srl);
|
*/
|
||||||
Context::set('group_list', $group_list);
|
function dispWidgetGenerateCodeInPage()
|
||||||
// module_category and module combination
|
{
|
||||||
if($module_categories) {
|
$oWidgetModel = &getModel('widget');
|
||||||
foreach($mid_list as $module_srl => $module) {
|
$widget_list = $oWidgetModel->getDownloadedWidgetList();
|
||||||
$module_categories[$module->module_category_srl]->list[$module_srl] = $module;
|
Context::set('widget_list',$widget_list);
|
||||||
}
|
// When there is no widget is selected in the first widget
|
||||||
} else {
|
if(!Context::get('selected_widget')) Context::set('selected_widget',$widget_list[0]->widget);
|
||||||
$module_categories[0]->list = $mid_list;
|
|
||||||
}
|
|
||||||
|
|
||||||
Context::set('mid_list',$module_categories);
|
$this->dispWidgetGenerateCode();
|
||||||
// Menu Get a list
|
$this->setLayoutFile('default_layout');
|
||||||
$output = executeQueryArray('menu.getMenus');
|
$this->setTemplateFile('widget_generate_code_in_page');
|
||||||
Context::set('menu_list',$output->data);
|
}
|
||||||
// Wanted information on skin
|
|
||||||
$skin_list = $oModuleModel->getSkins($widget_info->path);
|
|
||||||
Context::set('skin_list', $skin_list);
|
|
||||||
// Specifies the widget to pop up
|
|
||||||
$this->setLayoutFile('popup_layout');
|
|
||||||
// Set a template file
|
|
||||||
$this->setTemplateFile('widget_generate_code');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Managing pop-up pages used in the generated code
|
* @brief Create widget style code page used in the pop-up management
|
||||||
**/
|
*/
|
||||||
function dispWidgetGenerateCodeInPage() {
|
function dispWidgetStyleGenerateCodeInPage()
|
||||||
$oWidgetModel = &getModel('widget');
|
{
|
||||||
$widget_list = $oWidgetModel->getDownloadedWidgetList();
|
// Widget-style list
|
||||||
Context::set('widget_list',$widget_list);
|
$oWidgetModel = &getModel('widget');
|
||||||
// When there is no widget is selected in the first widget
|
$widgetStyle_list = $oWidgetModel->getDownloadedWidgetStyleList();
|
||||||
if(!Context::get('selected_widget')) Context::set('selected_widget',$widget_list[0]->widget);
|
Context::set('widgetStyle_list',$widgetStyle_list);
|
||||||
|
// Selected list of widget styles
|
||||||
|
$widgetstyle = Context::get('widgetstyle');
|
||||||
|
$widgetstyle_info = $oWidgetModel->getWidgetStyleInfo($widgetstyle);
|
||||||
|
if($widgetstyle && $widgetstyle_info)
|
||||||
|
{
|
||||||
|
Context::set('widgetstyle_info',$widgetstyle_info);
|
||||||
|
}
|
||||||
|
|
||||||
$this->dispWidgetGenerateCode();
|
$this->dispWidgetGenerateCode();
|
||||||
$this->setLayoutFile('default_layout');
|
$this->setLayoutFile('default_layout');
|
||||||
$this->setTemplateFile('widget_generate_code_in_page');
|
$this->setTemplateFile('widget_style_generate_code_in_page');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/**
|
/* End of file widget.view.php */
|
||||||
* @brief Create widget style code page used in the pop-up management
|
/* Location: ./modules/widget/widget.view.php */
|
||||||
**/
|
|
||||||
function dispWidgetStyleGenerateCodeInPage() {
|
|
||||||
// Widget-style list
|
|
||||||
$oWidgetModel = &getModel('widget');
|
|
||||||
$widgetStyle_list = $oWidgetModel->getDownloadedWidgetStyleList();
|
|
||||||
Context::set('widgetStyle_list',$widgetStyle_list);
|
|
||||||
// Selected list of widget styles
|
|
||||||
$widgetstyle = Context::get('widgetstyle');
|
|
||||||
$widgetstyle_info = $oWidgetModel->getWidgetStyleInfo($widgetstyle);
|
|
||||||
if($widgetstyle && $widgetstyle_info){
|
|
||||||
Context::set('widgetstyle_info',$widgetstyle_info);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->dispWidgetGenerateCode();
|
|
||||||
$this->setLayoutFile('default_layout');
|
|
||||||
$this->setTemplateFile('widget_style_generate_code_in_page');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue