mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 17:21:39 +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
|
||||
/**
|
||||
* @class sessionAdminController
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief The admin controller class of the session module
|
||||
**/
|
||||
/**
|
||||
* @class sessionAdminController
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* @brief Initialization
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief The action to clean up the Derby session
|
||||
**/
|
||||
function procSessionAdminClear() {
|
||||
$oSessionController = &getController('session');
|
||||
$oSessionController->gc(0);
|
||||
|
||||
$this->add('result',Context::getLang('session_cleared'));
|
||||
}
|
||||
}
|
||||
?>
|
||||
$this->add('result',Context::getLang('session_cleared'));
|
||||
}
|
||||
}
|
||||
/* End of file session.admin.controller.php */
|
||||
/* Location: ./modules/session/session.admin.controller.php */
|
||||
|
|
|
|||
|
|
@ -1,26 +1,27 @@
|
|||
<?php
|
||||
/**
|
||||
* @class sessionAdminView
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief The admin view class of the session module
|
||||
**/
|
||||
/**
|
||||
* @class sessionAdminView
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief The admin view class of the session module
|
||||
*/
|
||||
class sessionAdminView extends session
|
||||
{
|
||||
/**
|
||||
* @brief Initialization
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
}
|
||||
|
||||
class sessionAdminView extends session {
|
||||
|
||||
/**
|
||||
* @brief Initialization
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configure
|
||||
**/
|
||||
function dispSessionAdminIndex() {
|
||||
// Set the template file
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('index');
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
/**
|
||||
* @brief Configure
|
||||
*/
|
||||
function dispSessionAdminIndex()
|
||||
{
|
||||
// Set the template file
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('index');
|
||||
}
|
||||
}
|
||||
/* End of file session.admin.view.php */
|
||||
/* Location: ./modules/session/session.admin.view.php */
|
||||
|
|
|
|||
|
|
@ -1,81 +1,88 @@
|
|||
<?php
|
||||
/**
|
||||
* @class session
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief session module's high class
|
||||
* @version 0.1
|
||||
*
|
||||
* The session management class
|
||||
**/
|
||||
/**
|
||||
* @class session
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief session module's high class
|
||||
* @version 0.1
|
||||
*
|
||||
* 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() {
|
||||
if(Context::isInstalled()) $this->session_started= true;
|
||||
}
|
||||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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"));
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
|
||||
return new Object();
|
||||
}
|
||||
/**
|
||||
* @brief Execute update
|
||||
*/
|
||||
function moduleUpdate()
|
||||
{
|
||||
$oDB = &DB::getInstance();
|
||||
$oModuleModel = &getModel('module');
|
||||
|
||||
/**
|
||||
* @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->isTableExists('session')) $oDB->createTableByXmlFile($this->module_path.'schemas/session.xml');
|
||||
|
||||
/**
|
||||
* @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->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
|
||||
**/
|
||||
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 encode
|
||||
*/
|
||||
function serializeSession($data)
|
||||
{
|
||||
if(!count($data)) return;
|
||||
|
||||
/**
|
||||
* @brief session string encode
|
||||
**/
|
||||
function serializeSession($data) {
|
||||
if(!count($data)) return;
|
||||
$str = '';
|
||||
foreach($data as $key => $val) $str .= $key.'|'.serialize($val);
|
||||
return substr($str, 0, strlen($str)-1).'}';
|
||||
}
|
||||
|
||||
$str = '';
|
||||
foreach($data as $key => $val) $str .= $key.'|'.serialize($val);
|
||||
return substr($str, 0, strlen($str)-1).'}';
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Re-generate the cache file
|
||||
**/
|
||||
function recompileCache() {
|
||||
}
|
||||
}
|
||||
?>
|
||||
/**
|
||||
* @brief Re-generate the cache file
|
||||
*/
|
||||
function recompileCache()
|
||||
{
|
||||
}
|
||||
}
|
||||
/* End of file session.class.php */
|
||||
/* Location: ./modules/session/session.class.php */
|
||||
|
|
|
|||
|
|
@ -1,128 +1,151 @@
|
|||
<?php
|
||||
/**
|
||||
* @class sessionController
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief The controller class of the session module
|
||||
**/
|
||||
/**
|
||||
* @class sessionController
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief The controller class of the session module
|
||||
*/
|
||||
class sessionController extends session
|
||||
{
|
||||
/**
|
||||
* @brief Initialization
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
}
|
||||
|
||||
class sessionController extends session {
|
||||
function open()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initialization
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
function close()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
function open() {
|
||||
return true;
|
||||
}
|
||||
function write($session_key, $val)
|
||||
{
|
||||
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() {
|
||||
return true;
|
||||
}
|
||||
$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;
|
||||
}
|
||||
|
||||
function write($session_key, $val) {
|
||||
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);
|
||||
}
|
||||
|
||||
$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);
|
||||
$args->val = $val;
|
||||
$args->cur_mid = Context::get('mid');
|
||||
if(!$args->cur_mid)
|
||||
{
|
||||
$module_info = Context::get('current_module_info');
|
||||
$args->cur_mid = $module_info->mid;
|
||||
}
|
||||
|
||||
$args->expired = date("YmdHis", time()+$this->lifetime);
|
||||
$args->val = $val;
|
||||
$args->cur_mid = Context::get('mid');
|
||||
if(!$args->cur_mid) {
|
||||
$module_info = Context::get('current_module_info');
|
||||
$args->cur_mid = $module_info->mid;
|
||||
}
|
||||
if(Context::get('is_logged'))
|
||||
{
|
||||
$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);
|
||||
}
|
||||
|
||||
if(Context::get('is_logged')) {
|
||||
$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;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function destroy($session_key) {
|
||||
if(!$session_key || !$this->session_started) return;
|
||||
//remove session from cache
|
||||
$oCacheHandler = &CacheHandler::getInstance('object');
|
||||
if($oCacheHandler->isSupport()) {
|
||||
$cache_key = 'object:'.$session_key;
|
||||
$oCacheHandler->delete($cache_key);
|
||||
}
|
||||
//remove session from db
|
||||
$args->session_key = $session_key;
|
||||
executeQuery('session.deleteSession', $args);
|
||||
return true;
|
||||
}
|
||||
function destroy($session_key)
|
||||
{
|
||||
if(!$session_key || !$this->session_started) return;
|
||||
//remove session from cache
|
||||
$oCacheHandler = &CacheHandler::getInstance('object');
|
||||
if($oCacheHandler->isSupport())
|
||||
{
|
||||
$cache_key = 'object:'.$session_key;
|
||||
$oCacheHandler->delete($cache_key);
|
||||
}
|
||||
//remove session from db
|
||||
$args->session_key = $session_key;
|
||||
executeQuery('session.deleteSession', $args);
|
||||
return true;
|
||||
}
|
||||
|
||||
function gc($maxlifetime) {
|
||||
if(!$this->session_started) return;
|
||||
$expired_sessions = executeQueryArray('session.getExpiredSessions');
|
||||
if($expired_session){
|
||||
foreach ($expired_sessions as $session_key){
|
||||
//remove session from cache
|
||||
$oCacheHandler = &CacheHandler::getInstance('object');
|
||||
if($oCacheHandler->isSupport()) {
|
||||
$cache_key = 'object:'.$session_key;
|
||||
$oCacheHandler->delete($cache_key);
|
||||
}
|
||||
}
|
||||
}
|
||||
executeQuery('session.gcSession');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
?>
|
||||
function gc($maxlifetime)
|
||||
{
|
||||
if(!$this->session_started) return;
|
||||
$expired_sessions = executeQueryArray('session.getExpiredSessions');
|
||||
if($expired_session)
|
||||
{
|
||||
foreach ($expired_sessions as $session_key)
|
||||
{
|
||||
//remove session from cache
|
||||
$oCacheHandler = &CacheHandler::getInstance('object');
|
||||
if($oCacheHandler->isSupport())
|
||||
{
|
||||
$cache_key = 'object:'.$session_key;
|
||||
$oCacheHandler->delete($cache_key);
|
||||
}
|
||||
}
|
||||
}
|
||||
executeQuery('session.gcSession');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/* End of file session.controller.php */
|
||||
/* Location: ./modules/session/session.controller.php */
|
||||
|
|
|
|||
|
|
@ -1,100 +1,113 @@
|
|||
<?php
|
||||
/**
|
||||
* @class sessionModel
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief The Model class of the session module
|
||||
**/
|
||||
/**
|
||||
* @class sessionModel
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initialization
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
function read($session_key)
|
||||
{
|
||||
if(!$session_key || !$this->session_started) return;
|
||||
|
||||
function getLifeTime() {
|
||||
return $this->lifetime;
|
||||
}
|
||||
|
||||
function read($session_key) {
|
||||
if(!$session_key || !$this->session_started) return;
|
||||
|
||||
$oCacheHandler = &CacheHandler::getInstance('object');
|
||||
if($oCacheHandler->isSupport()){
|
||||
$cache_key = 'object:'.$session_key;
|
||||
$output->data = $oCacheHandler->get($cache_key);
|
||||
$oCacheHandler = &CacheHandler::getInstance('object');
|
||||
if($oCacheHandler->isSupport())
|
||||
{
|
||||
$cache_key = 'object:'.$session_key;
|
||||
$output->data = $oCacheHandler->get($cache_key);
|
||||
}
|
||||
if(!$output->data)
|
||||
{
|
||||
$args->session_key = $session_key;
|
||||
$columnList = array('session_key', 'cur_mid', 'val');
|
||||
$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) {
|
||||
|
||||
$args->session_key = $session_key;
|
||||
$columnList = array('session_key', 'cur_mid', 'val');
|
||||
$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);
|
||||
}
|
||||
// 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);
|
||||
}
|
||||
|
||||
// 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
|
||||
* Requires "object" argument because multiple arguments are expected
|
||||
* limit_count : the number of objects
|
||||
* page : the page number
|
||||
* period_time: "n" specifies the time range in minutes since the last update
|
||||
* mid: a user who belong to a specified mid
|
||||
**/
|
||||
function getLoggedMembers($args) {
|
||||
if(!$args->site_srl) {
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
$args->site_srl = (int)$site_module_info->site_srl;
|
||||
}
|
||||
if(!$args->list_count) $args->list_count = 20;
|
||||
if(!$args->page) $args->page = 1;
|
||||
if(!$args->period_time) $args->period_time = 3;
|
||||
$args->last_update = date("YmdHis", time() - $args->period_time*60);
|
||||
/**
|
||||
* @brief Get a list of currently connected users
|
||||
* Requires "object" argument because multiple arguments are expected
|
||||
* limit_count : the number of objects
|
||||
* page : the page number
|
||||
* period_time: "n" specifies the time range in minutes since the last update
|
||||
* mid: a user who belong to a specified mid
|
||||
*/
|
||||
function getLoggedMembers($args)
|
||||
{
|
||||
if(!$args->site_srl)
|
||||
{
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
$args->site_srl = (int)$site_module_info->site_srl;
|
||||
}
|
||||
if(!$args->list_count) $args->list_count = 20;
|
||||
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);
|
||||
if(!$output->toBool()) return $output;
|
||||
$output = executeQueryArray('session.getLoggedMembers', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
$member_srls = array();
|
||||
if(count($output->data)) {
|
||||
foreach($output->data as $key => $val) {
|
||||
$member_srls[$key] = $val->member_srl;
|
||||
$member_keys[$val->member_srl] = $key;
|
||||
}
|
||||
}
|
||||
$member_srls = array();
|
||||
if(count($output->data))
|
||||
{
|
||||
foreach($output->data as $key => $val)
|
||||
{
|
||||
$member_srls[$key] = $val->member_srl;
|
||||
$member_keys[$val->member_srl] = $key;
|
||||
}
|
||||
}
|
||||
|
||||
if(Context::get('is_logged')) {
|
||||
$logged_info = Context::get('logged_info');
|
||||
if(!in_array($logged_info->member_srl, $member_srls)) {
|
||||
$member_srls[0] = $logged_info->member_srl;
|
||||
$member_keys[$logged_info->member_srl] = 0;
|
||||
}
|
||||
}
|
||||
if(Context::get('is_logged'))
|
||||
{
|
||||
$logged_info = Context::get('logged_info');
|
||||
if(!in_array($logged_info->member_srl, $member_srls))
|
||||
{
|
||||
$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_output = executeQueryArray('member.getMembers', $member_args);
|
||||
if($member_output->data) {
|
||||
foreach($member_output->data as $key => $val) {
|
||||
$output->data[$member_keys[$val->member_srl]] = $val;
|
||||
}
|
||||
}
|
||||
$member_args->member_srl = implode(',',$member_srls);
|
||||
$member_output = executeQueryArray('member.getMembers', $member_args);
|
||||
if($member_output->data)
|
||||
{
|
||||
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
|
||||
/**
|
||||
* @class spamfilterAdminController
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief The admin controller class of the spamfilter module
|
||||
**/
|
||||
/**
|
||||
* @class spamfilterAdminController
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* @brief Initialization
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminConfigBlock');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
}
|
||||
|
||||
|
||||
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');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
function procSpamfilterAdminInsertDeniedIP()
|
||||
{
|
||||
//스팸IP 추가
|
||||
$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;
|
||||
}
|
||||
|
||||
function procSpamfilterAdminInsertDeniedIP(){
|
||||
//스팸IP 추가
|
||||
$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>';
|
||||
$this->setMessage(Context::getLang('success_registed').$message_fail);
|
||||
|
||||
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', 'dispSpamfilterAdminDeniedIPList');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
}
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminDeniedIPList');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
function procSpamfilterAdminInsertDeniedWord()
|
||||
{
|
||||
//스팸 키워드 추가
|
||||
$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(){
|
||||
//스팸 키워드 추가
|
||||
$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);
|
||||
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');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminDeniedWordList');
|
||||
$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 />';
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Delete the banned IP
|
||||
**/
|
||||
function procSpamfilterAdminDeleteDeniedIP() {
|
||||
$ipaddress = Context::get('ipaddress');
|
||||
$output = $this->deleteIP($ipaddress);
|
||||
$output->add('fail_list',$fail_word);
|
||||
return $output;
|
||||
}
|
||||
|
||||
$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 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);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
/**
|
||||
* @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);
|
||||
}
|
||||
}
|
||||
/* End of file spamfilter.admin.controller.php */
|
||||
/* Location: ./modules/spamfilter/spamfilter.admin.controller.php */
|
||||
|
|
|
|||
|
|
@ -3,14 +3,13 @@
|
|||
* @class spamfilterAdminView
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief The admin view class of the spamfilter module
|
||||
**/
|
||||
|
||||
*/
|
||||
class spamfilterAdminView extends spamfilter
|
||||
{
|
||||
/**
|
||||
* @brief Initialization
|
||||
**/
|
||||
function init()
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
// Set template path
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
|
|
@ -18,7 +17,7 @@ class spamfilterAdminView extends spamfilter
|
|||
|
||||
/**
|
||||
* @brief Output the list of banned IPs
|
||||
**/
|
||||
*/
|
||||
function dispSpamfilterAdminDeniedIPList()
|
||||
{
|
||||
// Get the list of denied IP addresses and words
|
||||
|
|
@ -36,7 +35,7 @@ class spamfilterAdminView extends spamfilter
|
|||
|
||||
/**
|
||||
* @brief Output the list of banned words
|
||||
**/
|
||||
*/
|
||||
function dispSpamfilterAdminDeniedWordList()
|
||||
{
|
||||
// Get the list of denied IP addresses and words
|
||||
|
|
@ -53,7 +52,7 @@ class spamfilterAdminView extends spamfilter
|
|||
|
||||
/**
|
||||
* @brief Configure auto block
|
||||
**/
|
||||
*/
|
||||
function dispSpamfilterAdminConfigBlock()
|
||||
{
|
||||
// Get configurations (using module model object)
|
||||
|
|
@ -63,5 +62,6 @@ class spamfilterAdminView extends spamfilter
|
|||
|
||||
$this->setTemplateFile('config_block');
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
||||
/* End of file spamfilter.admin.view.php */
|
||||
/* Location: ./modules/spamfilter/spamfilter.admin.view.php */
|
||||
|
|
|
|||
|
|
@ -1,101 +1,109 @@
|
|||
<?php
|
||||
/**
|
||||
* @class spamfilter
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief The parent class of the spamfilter module
|
||||
**/
|
||||
/**
|
||||
* @class spamfilter
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @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
|
||||
**/
|
||||
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');
|
||||
/**
|
||||
* @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)
|
||||
*/
|
||||
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;
|
||||
|
||||
/**
|
||||
* @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;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
/**
|
||||
* @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');
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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');
|
||||
}
|
||||
return new Object(0,'success_updated');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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');
|
||||
}
|
||||
|
||||
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() {
|
||||
}
|
||||
}
|
||||
?>
|
||||
/**
|
||||
* @brief Re-generate the cache file
|
||||
*/
|
||||
function recompileCache()
|
||||
{
|
||||
}
|
||||
}
|
||||
/* End of file spamfilter.class.php */
|
||||
/* Location: ./modules/spamfilter/spamfilter.class.controller.php */
|
||||
|
|
|
|||
|
|
@ -1,171 +1,184 @@
|
|||
<?php
|
||||
/**
|
||||
* @class spamfilterController
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief The controller class for the spamfilter module
|
||||
**/
|
||||
/**
|
||||
* @class spamfilterController
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @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
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
/**
|
||||
* @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();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
$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->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();
|
||||
|
||||
/**
|
||||
* @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();
|
||||
}
|
||||
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->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();
|
||||
/**
|
||||
* @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();
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
/**
|
||||
* @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();
|
||||
}
|
||||
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();
|
||||
/**
|
||||
* @brief Inspect the trackback creation time and IP
|
||||
*/
|
||||
function triggerInsertTrackback(&$obj)
|
||||
{
|
||||
if($_SESSION['avoid_log']) return new Object();
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* @brief Inspect the trackback creation time and IP
|
||||
**/
|
||||
function triggerInsertTrackback(&$obj) {
|
||||
if($_SESSION['avoid_log']) return new Object();
|
||||
// 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->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');
|
||||
// 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
|
||||
$output = $oFilterModel->isDeniedIP();
|
||||
if(!$output->toBool()) return $output;
|
||||
// Check if there is a ban on the word
|
||||
$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');
|
||||
list($ipA,$ipB,$ipC,$ipD) = explode('.',$_SERVER['REMOTE_ADDR']);
|
||||
$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');
|
||||
}
|
||||
*/
|
||||
|
||||
list($ipA,$ipB,$ipC,$ipD) = explode('.',$_SERVER['REMOTE_ADDR']);
|
||||
$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();
|
||||
}
|
||||
|
||||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief IP registration
|
||||
* The registered IP address is considered as a spammer
|
||||
**/
|
||||
function insertIP($ipaddress_list, $description = null) {
|
||||
print_r($ipaddress_list);
|
||||
$regExr = "/^((\d{1,3}(?:.(\d{1,3}|\*)){3})\s*(\/\/(.*)\s*)?)*\s*$/";
|
||||
if(!preg_match($regExr,$ipaddress_list)) return new Object(-1, 'msg_invalid');
|
||||
$ipaddress_list = str_replace("\r","",$ipaddress_list);
|
||||
$ipaddress_list = explode("\n",$ipaddress_list);
|
||||
foreach($ipaddress_list as $ipaddressValue) {
|
||||
preg_match("/(\d{1,3}(?:.(\d{1,3}|\*)){3})\s*(\/\/(.*)\s*)?/",$ipaddressValue,$matches);
|
||||
if($ipaddress=trim($matches[1])) {
|
||||
$args->ipaddress = $ipaddress;
|
||||
if(!$description && $matches[4]) $args->description = $matches[4];
|
||||
else $args->description = $description;
|
||||
}
|
||||
$output = executeQuery('spamfilter.insertDeniedIP', $args);
|
||||
if(!$output->toBool()) $fail_list .= $ipaddress.'<br/>';
|
||||
/**
|
||||
* @brief IP registration
|
||||
* The registered IP address is considered as a spammer
|
||||
*/
|
||||
function insertIP($ipaddress_list, $description = null)
|
||||
{
|
||||
print_r($ipaddress_list);
|
||||
$regExr = "/^((\d{1,3}(?:.(\d{1,3}|\*)){3})\s*(\/\/(.*)\s*)?)*\s*$/";
|
||||
if(!preg_match($regExr,$ipaddress_list)) return new Object(-1, 'msg_invalid');
|
||||
$ipaddress_list = str_replace("\r","",$ipaddress_list);
|
||||
$ipaddress_list = explode("\n",$ipaddress_list);
|
||||
foreach($ipaddress_list as $ipaddressValue)
|
||||
{
|
||||
preg_match("/(\d{1,3}(?:.(\d{1,3}|\*)){3})\s*(\/\/(.*)\s*)?/",$ipaddressValue,$matches);
|
||||
if($ipaddress=trim($matches[1]))
|
||||
{
|
||||
$args->ipaddress = $ipaddress;
|
||||
if(!$description && $matches[4]) $args->description = $matches[4];
|
||||
else $args->description = $description;
|
||||
}
|
||||
$output = executeQuery('spamfilter.insertDeniedIP', $args);
|
||||
if(!$output->toBool()) $fail_list .= $ipaddress.'<br/>';
|
||||
}
|
||||
|
||||
$output->add('fail_list',$fail_list);
|
||||
return $output;
|
||||
$output->add('fail_list',$fail_list);
|
||||
return $output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Log registration
|
||||
* 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() {
|
||||
$output = executeQuery('spamfilter.insertLog');
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
?>
|
||||
/**
|
||||
* @brief Log registration
|
||||
* 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()
|
||||
{
|
||||
$output = executeQuery('spamfilter.insertLog');
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
/* End of file spamfilter.controller.php */
|
||||
/* Location: ./modules/spamfilter/spamfilter.controller.php */
|
||||
|
|
|
|||
|
|
@ -1,144 +1,155 @@
|
|||
<?php
|
||||
/**
|
||||
* @class spamfilterModel
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief The Model class of the spamfilter module
|
||||
**/
|
||||
/**
|
||||
* @class spamfilterModel
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @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
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
/**
|
||||
* @brief Return the list of registered IP addresses which were banned
|
||||
*/
|
||||
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
|
||||
**/
|
||||
function getConfig() {
|
||||
// Get configurations (using the module model object)
|
||||
$oModuleModel = &getModel('module');
|
||||
return $oModuleModel->getModuleConfig('spamfilter');
|
||||
}
|
||||
/**
|
||||
* @brief Check if the ipaddress is in the list of banned IP addresses
|
||||
*/
|
||||
function isDeniedIP()
|
||||
{
|
||||
$ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||
|
||||
/**
|
||||
* @brief Return the list of registered IP addresses which were banned
|
||||
**/
|
||||
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;
|
||||
}
|
||||
$ip_list = $this->getDeniedIPList();
|
||||
if(!count($ip_list)) return new Object();
|
||||
|
||||
/**
|
||||
* @brief Check if the ipaddress is in the list of banned IP addresses
|
||||
**/
|
||||
function isDeniedIP() {
|
||||
$ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||
$count = count($ip_list);
|
||||
for($i=0;$i<$count;$i++)
|
||||
{
|
||||
$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');
|
||||
}
|
||||
|
||||
$ip_list = $this->getDeniedIPList();
|
||||
if(!count($ip_list)) return new Object();
|
||||
return new Object();
|
||||
}
|
||||
|
||||
$count = count($ip_list);
|
||||
for($i=0;$i<$count;$i++) {
|
||||
$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');
|
||||
}
|
||||
|
||||
return new Object();
|
||||
}
|
||||
/**
|
||||
* @brief Return the list of registered Words which were banned
|
||||
*/
|
||||
function getDeniedWordList()
|
||||
{
|
||||
$args->sort_index = "hit";
|
||||
$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
|
||||
**/
|
||||
function getDeniedWordList() {
|
||||
$args->sort_index = "hit";
|
||||
$output = executeQuery('spamfilter.getDeniedWordList', $args);
|
||||
if(!$output->data) return;
|
||||
if(!is_array($output->data)) return array($output->data);
|
||||
return $output->data;
|
||||
}
|
||||
/**
|
||||
* @brief Check if the text, received as a parameter, is banned or not
|
||||
*/
|
||||
function isDeniedWord($text)
|
||||
{
|
||||
$word_list = $this->getDeniedWordList();
|
||||
if(!count($word_list)) return new Object();
|
||||
|
||||
/**
|
||||
* @brief Check if the text, received as a parameter, is banned or not
|
||||
**/
|
||||
function isDeniedWord($text) {
|
||||
$word_list = $this->getDeniedWordList();
|
||||
if(!count($word_list)) return new Object();
|
||||
$count = count($word_list);
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
$count = count($word_list);
|
||||
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();
|
||||
}
|
||||
|
||||
return new Object();
|
||||
}
|
||||
/**
|
||||
* @brief Check the specified time
|
||||
*/
|
||||
function checkLimited()
|
||||
{
|
||||
$config = $this->getConfig();
|
||||
|
||||
/**
|
||||
* @brief Check the specified time
|
||||
**/
|
||||
function checkLimited() {
|
||||
$config = $this->getConfig();
|
||||
|
||||
if($config->limits != 'Y') return new Object();
|
||||
$limit_count = '3';
|
||||
$interval = '10';
|
||||
if($config->limits != 'Y') return new Object();
|
||||
$limit_count = '3';
|
||||
$interval = '10';
|
||||
|
||||
$count = $this->getLogCount($interval);
|
||||
$count = $this->getLogCount($interval);
|
||||
|
||||
$ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||
// Ban the IP address if the interval is exceeded
|
||||
if($count>=$limit_count) {
|
||||
$oSpamFilterController = &getController('spamfilter');
|
||||
$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) {
|
||||
$message = sprintf(Context::getLang('msg_alert_limited_by_config'), $interval);
|
||||
$ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||
// Ban the IP address if the interval is exceeded
|
||||
if($count>=$limit_count)
|
||||
{
|
||||
$oSpamFilterController = &getController('spamfilter');
|
||||
$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)
|
||||
{
|
||||
$message = sprintf(Context::getLang('msg_alert_limited_by_config'), $interval);
|
||||
|
||||
$oSpamFilterController = &getController('spamfilter');
|
||||
$oSpamFilterController->insertLog();
|
||||
$oSpamFilterController = &getController('spamfilter');
|
||||
$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');
|
||||
|
||||
/**
|
||||
* @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();
|
||||
}
|
||||
|
||||
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'];
|
||||
|
||||
/**
|
||||
* @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;
|
||||
$args->regdate = date("YmdHis", time()-$time);
|
||||
$output = executeQuery('spamfilter.getLogCount', $args);
|
||||
$count = $output->data->count;
|
||||
return $count;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
$args->ipaddress = $ipaddress;
|
||||
$args->regdate = date("YmdHis", time()-$time);
|
||||
$output = executeQuery('spamfilter.getLogCount', $args);
|
||||
$count = $output->data->count;
|
||||
return $count;
|
||||
}
|
||||
}
|
||||
/* End of file spamfilter.model.php */
|
||||
/* Location: ./modules/spamfilter/spamfilter.model.php */
|
||||
|
|
|
|||
|
|
@ -1,17 +1,19 @@
|
|||
<?php
|
||||
/**
|
||||
* @class tagAdminController
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief admin controller class of the tag module
|
||||
**/
|
||||
|
||||
class tagAdminController extends tag {
|
||||
/**
|
||||
* @brief Delete all tags for a particular module
|
||||
**/
|
||||
function deleteModuleTags($module_srl) {
|
||||
$args->module_srl = $module_srl;
|
||||
return executeQuery('tag.deleteModuleTags', $args);
|
||||
}
|
||||
}
|
||||
?>
|
||||
/**
|
||||
* @class tagAdminController
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief admin controller class of the tag module
|
||||
*/
|
||||
class tagAdminController extends tag
|
||||
{
|
||||
/**
|
||||
* @brief Delete all tags for a particular module
|
||||
*/
|
||||
function deleteModuleTags($module_srl)
|
||||
{
|
||||
$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
|
||||
/**
|
||||
* @class tag
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief high class of the tag module
|
||||
**/
|
||||
/**
|
||||
* @class tag
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @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');
|
||||
|
||||
/**
|
||||
* @brief Implement if additional tasks are necessary when installing
|
||||
**/
|
||||
function moduleInstall() {
|
||||
$oModuleController = &getController('module');
|
||||
$oDB = &DB::getInstance();
|
||||
return new Object();
|
||||
}
|
||||
|
||||
$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 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;
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
|
||||
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');
|
||||
|
||||
/**
|
||||
* @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'))
|
||||
$oModuleController->insertTrigger('document.insertDocument', 'tag', 'controller', 'triggerInsertTag', 'after');
|
||||
|
||||
if(!$oModuleModel->getTrigger('document.insertDocument', 'tag', 'controller', 'triggerInsertTag', 'after'))
|
||||
$oModuleController->insertTrigger('document.insertDocument', 'tag', 'controller', 'triggerInsertTag', 'after');
|
||||
if(!$oModuleModel->getTrigger('document.updateDocument', 'tag', 'controller', 'triggerArrangeTag', 'before'))
|
||||
$oModuleController->insertTrigger('document.updateDocument', 'tag', 'controller', 'triggerArrangeTag', 'before');
|
||||
|
||||
if(!$oModuleModel->getTrigger('document.updateDocument', 'tag', 'controller', 'triggerArrangeTag', 'before'))
|
||||
$oModuleController->insertTrigger('document.updateDocument', 'tag', 'controller', 'triggerArrangeTag', 'before');
|
||||
if(!$oModuleModel->getTrigger('document.updateDocument', 'tag', 'controller', 'triggerInsertTag', 'after'))
|
||||
$oModuleController->insertTrigger('document.updateDocument', 'tag', 'controller', 'triggerInsertTag', 'after');
|
||||
|
||||
if(!$oModuleModel->getTrigger('document.updateDocument', 'tag', 'controller', 'triggerInsertTag', 'after'))
|
||||
$oModuleController->insertTrigger('document.updateDocument', 'tag', 'controller', 'triggerInsertTag', 'after');
|
||||
if(!$oModuleModel->getTrigger('document.deleteDocument', 'tag', 'controller', 'triggerDeleteTag', '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'))
|
||||
$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');
|
||||
}
|
||||
|
||||
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
|
||||
/**
|
||||
* @class tagController
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief tag module's controller class
|
||||
**/
|
||||
/**
|
||||
* @class tagController
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @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();
|
||||
|
||||
/**
|
||||
* @brief Initialization
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
foreach($tag_list as $tag)
|
||||
{
|
||||
if(!trim($tag)) continue;
|
||||
$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
|
||||
**/
|
||||
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();
|
||||
/**
|
||||
* @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;
|
||||
|
||||
foreach($tag_list as $tag) {
|
||||
if(!trim($tag)) continue;
|
||||
$arranged_tag_list[] = trim($tag);
|
||||
}
|
||||
if(!count($arranged_tag_list)) $obj->tags = null;
|
||||
else $obj->tags = implode(',',$arranged_tag_list);
|
||||
return new Object();
|
||||
}
|
||||
$tag_list = explode(',',$tags);
|
||||
$tag_count = count($tag_list);
|
||||
for($i=0;$i<$tag_count;$i++)
|
||||
{
|
||||
unset($args->tag);
|
||||
$args->tag = trim($tag_list[$i]);
|
||||
if(!$args->tag) continue;
|
||||
$output = executeQuery('tag.insertTag', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
return new Object();
|
||||
}
|
||||
|
||||
$tag_list = explode(',',$tags);
|
||||
$tag_count = count($tag_list);
|
||||
for($i=0;$i<$tag_count;$i++) {
|
||||
unset($args->tag);
|
||||
$args->tag = trim($tag_list[$i]);
|
||||
if(!$args->tag) continue;
|
||||
$output = executeQuery('tag.insertTag', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
}
|
||||
/**
|
||||
* @brief Delete the tag trigger a specific article
|
||||
* document_srl delete tag belongs to
|
||||
*/
|
||||
function triggerDeleteTag(&$obj)
|
||||
{
|
||||
$document_srl = $obj->document_srl;
|
||||
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
|
||||
* document_srl delete tag belongs to
|
||||
**/
|
||||
function triggerDeleteTag(&$obj) {
|
||||
$document_srl = $obj->document_srl;
|
||||
if(!$document_srl) return new Object();
|
||||
/**
|
||||
* @brief module delete trigger to delete all the tags
|
||||
*/
|
||||
function triggerDeleteModuleTags(&$obj)
|
||||
{
|
||||
$module_srl = $obj->module_srl;
|
||||
if(!$module_srl) return new Object();
|
||||
|
||||
$args->document_srl = $document_srl;
|
||||
return executeQuery('tag.deleteTag', $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief module delete trigger to delete all the tags
|
||||
**/
|
||||
function triggerDeleteModuleTags(&$obj) {
|
||||
$module_srl = $obj->module_srl;
|
||||
if(!$module_srl) return new Object();
|
||||
|
||||
$oTagController = &getAdminController('tag');
|
||||
return $oTagController->deleteModuleTags($module_srl);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
$oTagController = &getAdminController('tag');
|
||||
return $oTagController->deleteModuleTags($module_srl);
|
||||
}
|
||||
}
|
||||
/* End of file tag.controller.php */
|
||||
/* Location: ./modules/tag/tag.controller.php */
|
||||
|
|
|
|||
|
|
@ -1,86 +1,92 @@
|
|||
<?php
|
||||
/**
|
||||
* @class tagModel
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief tag model class of the module
|
||||
**/
|
||||
/**
|
||||
* @class tagModel
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief tag model class of the module
|
||||
*/
|
||||
class tagModel extends tag
|
||||
{
|
||||
/**
|
||||
* @brief Initialization
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
}
|
||||
|
||||
class tagModel extends tag {
|
||||
|
||||
/**
|
||||
* @brief Initialization
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Imported Tag List
|
||||
* Many of the specified module in order to extract the number of tags
|
||||
**/
|
||||
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;
|
||||
/**
|
||||
* @brief Imported Tag List
|
||||
* Many of the specified module in order to extract the number of tags
|
||||
*/
|
||||
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;
|
||||
|
||||
/**
|
||||
* @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.getTagList', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
$output = executeQueryArray('tag.getDocumentsTagList', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
$output = $this->getDocumentsTagList($args);
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
?>
|
||||
unset($args);
|
||||
$args->document_srl = $document_srl;
|
||||
$output = $this->getDocumentsTagList($args);
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
/* End of file tag.model.php */
|
||||
/* Location: ./modules/tag/tag.model.php */
|
||||
|
|
|
|||
|
|
@ -1,140 +1,150 @@
|
|||
<?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
|
||||
* trackback module admin controller class
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/trackback
|
||||
* @version 0.1
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
class trackbackAdminController extends trackback {
|
||||
/**
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
function init() {
|
||||
}
|
||||
function init()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Trackbacks delete selected in admin page
|
||||
* @return void|Object
|
||||
*/
|
||||
function procTrackbackAdminDeleteChecked() {
|
||||
// An error appears if no document is selected
|
||||
$cart = Context::get('cart');
|
||||
if(!is_array($cart)) $trackback_srl_list= explode('|@|', $cart);
|
||||
else $trackback_srl_list = $cart;
|
||||
/**
|
||||
* Trackbacks delete selected in admin page
|
||||
* @return void|Object
|
||||
*/
|
||||
function procTrackbackAdminDeleteChecked()
|
||||
{
|
||||
// An error appears if no document is selected
|
||||
$cart = Context::get('cart');
|
||||
if(!is_array($cart)) $trackback_srl_list= explode('|@|', $cart);
|
||||
else $trackback_srl_list = $cart;
|
||||
|
||||
$trackback_count = count($trackback_srl_list);
|
||||
if(!$trackback_count) return $this->stop('msg_cart_is_null');
|
||||
$trackback_count = count($trackback_srl_list);
|
||||
if(!$trackback_count) return $this->stop('msg_cart_is_null');
|
||||
|
||||
$oTrackbackController = &getController('trackback');
|
||||
// Delete the post
|
||||
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()
|
||||
$oTrackbackController = &getController('trackback');
|
||||
// Delete the post
|
||||
for($i=0;$i<$trackback_count;$i++)
|
||||
{
|
||||
$trackback_srl = (int)Context::get('trackback_srl');
|
||||
$trackback_srl = trim($trackback_srl_list[$i]);
|
||||
if(!$trackback_srl) continue;
|
||||
|
||||
$oTrackbackAdminModel = &getAdminModel('trackback');
|
||||
//$columnList = array('trackback_srl');
|
||||
$args->trackbackSrlList = array($trackback_srl);
|
||||
$oTrackbackController->deleteTrackback($trackback_srl, true);
|
||||
}
|
||||
|
||||
$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
|
||||
* @param int $module_srl
|
||||
* @param string $enable_trackback 'Y' or 'N'
|
||||
* @return Object
|
||||
*/
|
||||
function setTrackbackModuleConfig($module_srl, $enable_trackback) {
|
||||
$config->enable_trackback = $enable_trackback;
|
||||
/**
|
||||
* Trackback modular set function
|
||||
* @param int $module_srl
|
||||
* @param string $enable_trackback 'Y' or 'N'
|
||||
* @return Object
|
||||
*/
|
||||
function setTrackbackModuleConfig($module_srl, $enable_trackback)
|
||||
{
|
||||
$config->enable_trackback = $enable_trackback;
|
||||
|
||||
$oModuleController = &getController('module');
|
||||
$oModuleController->insertModulePartConfig('trackback', $module_srl, $config);
|
||||
return new Object();
|
||||
}
|
||||
$oModuleController = &getController('module');
|
||||
$oModuleController->insertModulePartConfig('trackback', $module_srl, $config);
|
||||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* Modules belonging to remove all trackbacks
|
||||
* @param int $module_srl
|
||||
* @return object
|
||||
*/
|
||||
function deleteModuleTrackbacks($module_srl) {
|
||||
// Delete
|
||||
$args->module_srl = $module_srl;
|
||||
$output = executeQuery('trackback.deleteModuleTrackbacks', $args);
|
||||
/**
|
||||
* Modules belonging to remove all trackbacks
|
||||
* @param int $module_srl
|
||||
* @return object
|
||||
*/
|
||||
function deleteModuleTrackbacks($module_srl)
|
||||
{
|
||||
// Delete
|
||||
$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
|
||||
/**
|
||||
* @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
|
||||
* @brief trackback module admin model class
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/trackback
|
||||
* @version 0.1
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
class trackbackAdminModel extends trackback {
|
||||
/**
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
function init() {
|
||||
}
|
||||
function init()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Trackbacks Bringing all the time in reverse order (administrative)
|
||||
* @param object $obj
|
||||
* @return object
|
||||
*/
|
||||
function getTotalTrackbackList($obj) {
|
||||
// Search options
|
||||
$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'));
|
||||
/**
|
||||
* Trackbacks Bringing all the time in reverse order (administrative)
|
||||
* @param object $obj
|
||||
* @return object
|
||||
*/
|
||||
function getTotalTrackbackList($obj)
|
||||
{
|
||||
// Search options
|
||||
$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) {
|
||||
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($search_target && $search_keyword)
|
||||
{
|
||||
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;
|
||||
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));
|
||||
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
|
||||
/**
|
||||
* trackbackAdminView class
|
||||
* trackback module admin view class
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/trackback
|
||||
* @version 0.1
|
||||
*/
|
||||
class trackbackAdminView extends trackback
|
||||
{
|
||||
/**
|
||||
* trackbackAdminView class
|
||||
* trackback module admin view class
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/trackback
|
||||
* @version 0.1
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
class trackbackAdminView extends trackback {
|
||||
/**
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
function init() {
|
||||
}
|
||||
function init()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Display output list (administrative)
|
||||
* @return void
|
||||
*/
|
||||
function dispTrackbackAdminList() {
|
||||
// Wanted set
|
||||
$oModuleModel = &getModel('module');
|
||||
$config = $oModuleModel->getModuleConfig('trackback');
|
||||
Context::set('config',$config);
|
||||
/**
|
||||
* Display output list (administrative)
|
||||
* @return void
|
||||
*/
|
||||
function dispTrackbackAdminList()
|
||||
{
|
||||
// Wanted set
|
||||
$oModuleModel = &getModel('module');
|
||||
$config = $oModuleModel->getModuleConfig('trackback');
|
||||
Context::set('config',$config);
|
||||
|
||||
// Options to get a list
|
||||
$args->page = Context::get('page'); // / "Page
|
||||
$args->list_count = 30; // / "One page of posts to show the
|
||||
$args->page_count = 10; // / "Number of pages that appear in the page navigation
|
||||
// Options to get a list
|
||||
$args->page = Context::get('page'); // / "Page
|
||||
$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->sort_index = 'list_order'; // / "Sorting values
|
||||
$args->module_srl = Context::get('module_srl');
|
||||
// Get a list
|
||||
$oTrackbackAdminModel = &getAdminModel('trackback');
|
||||
$output = $oTrackbackAdminModel->getTotalTrackbackList($args);
|
||||
$args->sort_index = 'list_order'; // / "Sorting values
|
||||
$args->module_srl = Context::get('module_srl');
|
||||
// Get a list
|
||||
$oTrackbackAdminModel = &getAdminModel('trackback');
|
||||
$output = $oTrackbackAdminModel->getTotalTrackbackList($args);
|
||||
|
||||
// To write to a template parameter settings
|
||||
Context::set('total_count', $output->total_count);
|
||||
Context::set('total_page', $output->total_page);
|
||||
Context::set('page', $output->page);
|
||||
Context::set('trackback_list', $output->data);
|
||||
Context::set('page_navigation', $output->page_navigation);
|
||||
//Security
|
||||
$security = new Security();
|
||||
$security->encodeHTML('config.');
|
||||
$security->encodeHTML('trackback_list..');
|
||||
// To write to a template parameter settings
|
||||
Context::set('total_count', $output->total_count);
|
||||
Context::set('total_page', $output->total_page);
|
||||
Context::set('page', $output->page);
|
||||
Context::set('trackback_list', $output->data);
|
||||
Context::set('page_navigation', $output->page_navigation);
|
||||
//Security
|
||||
$security = new Security();
|
||||
$security->encodeHTML('config.');
|
||||
$security->encodeHTML('trackback_list..');
|
||||
|
||||
// Set a template
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('trackback_list');
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
// Set a template
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('trackback_list');
|
||||
}
|
||||
}
|
||||
/* End of file trackback.admin.view.php */
|
||||
/* Location: ./modules/trackback/trackback.admin.view.php */
|
||||
|
|
|
|||
|
|
@ -1,89 +1,94 @@
|
|||
<?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
|
||||
* trackback module's high class
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/trackback
|
||||
* @version 0.1
|
||||
* Implement if additional tasks are necessary when installing
|
||||
* @return Object
|
||||
*/
|
||||
class trackback extends ModuleObject {
|
||||
/**
|
||||
* Implement if additional tasks are necessary when installing
|
||||
* @return Object
|
||||
*/
|
||||
function moduleInstall() {
|
||||
// Register action forward (to use in administrator mode)
|
||||
$oModuleController = &getController('module');
|
||||
$oModuleController->insertActionForward('trackback', 'controller', 'trackback');
|
||||
// 2007. 10. 17 posts deleted and will be deleted when the trigger property Trackbacks
|
||||
$oModuleController->insertTrigger('document.deleteDocument', 'trackback', 'controller', 'triggerDeleteDocumentTrackbacks', 'after');
|
||||
// 2007. 10. 17 modules are deleted when you delete all registered triggers that add Trackbacks
|
||||
$oModuleController->insertTrigger('module.deleteModule', 'trackback', 'controller', 'triggerDeleteModuleTrackbacks', 'after');
|
||||
// 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');
|
||||
function moduleInstall()
|
||||
{
|
||||
// Register action forward (to use in administrator mode)
|
||||
$oModuleController = &getController('module');
|
||||
$oModuleController->insertActionForward('trackback', 'controller', 'trackback');
|
||||
// 2007. 10. 17 posts deleted and will be deleted when the trigger property Trackbacks
|
||||
$oModuleController->insertTrigger('document.deleteDocument', 'trackback', 'controller', 'triggerDeleteDocumentTrackbacks', 'after');
|
||||
// 2007. 10. 17 modules are deleted when you delete all registered triggers that add Trackbacks
|
||||
$oModuleController->insertTrigger('module.deleteModule', 'trackback', 'controller', 'triggerDeleteModuleTrackbacks', 'after');
|
||||
// 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
|
||||
* @return bool
|
||||
*/
|
||||
function checkUpdate() {
|
||||
$oModuleModel = &getModel('module');
|
||||
// 2007. 10. 17 posts deleted, even when the comments will be deleted trigger property
|
||||
if(!$oModuleModel->getTrigger('document.deleteDocument', 'trackback', 'controller', 'triggerDeleteDocumentTrackbacks', 'after')) return true;
|
||||
// 2007. 10. 17 modules are deleted when you delete all registered triggers that add Trackbacks
|
||||
if(!$oModuleModel->getTrigger('module.deleteModule', 'trackback', 'controller', 'triggerDeleteModuleTrackbacks', 'after')) return true;
|
||||
// 2007. 10. Yeokingeul sent from the popup menu features 18 additional posts
|
||||
if(!$oModuleModel->getTrigger('document.getDocumentMenu', 'trackback', 'controller', 'triggerSendTrackback', 'after')) return true;
|
||||
// 2007. 10. The ability to receive 19 additional modular yeokingeul
|
||||
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'trackback', 'view', 'triggerDispTrackbackAdditionSetup', 'before')) return true;
|
||||
/**
|
||||
* A method to check if successfully installed
|
||||
* @return bool
|
||||
*/
|
||||
function checkUpdate()
|
||||
{
|
||||
$oModuleModel = &getModel('module');
|
||||
// 2007. 10. 17 posts deleted, even when the comments will be deleted trigger property
|
||||
if(!$oModuleModel->getTrigger('document.deleteDocument', 'trackback', 'controller', 'triggerDeleteDocumentTrackbacks', 'after')) return true;
|
||||
// 2007. 10. 17 modules are deleted when you delete all registered triggers that add Trackbacks
|
||||
if(!$oModuleModel->getTrigger('module.deleteModule', 'trackback', 'controller', 'triggerDeleteModuleTrackbacks', 'after')) return true;
|
||||
// 2007. 10. Yeokingeul sent from the popup menu features 18 additional posts
|
||||
if(!$oModuleModel->getTrigger('document.getDocumentMenu', 'trackback', 'controller', 'triggerSendTrackback', 'after')) 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
|
||||
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'trackback', 'controller', 'triggerCopyModule', 'after')) return true;
|
||||
// 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;
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute update
|
||||
* @return Object
|
||||
*/
|
||||
function moduleUpdate() {
|
||||
$oModuleModel = &getModel('module');
|
||||
$oModuleController = &getController('module');
|
||||
// 2007. 10. 17 posts deleted, even when the comments will be deleted trigger property
|
||||
if(!$oModuleModel->getTrigger('document.deleteDocument', 'trackback', 'controller', 'triggerDeleteDocumentTrackbacks', 'after'))
|
||||
$oModuleController->insertTrigger('document.deleteDocument', 'trackback', 'controller', 'triggerDeleteDocumentTrackbacks', 'after');
|
||||
// 2007. 10. 17 modules are deleted when you delete all registered triggers that add Trackbacks
|
||||
if(!$oModuleModel->getTrigger('module.deleteModule', 'trackback', 'controller', 'triggerDeleteModuleTrackbacks', 'after'))
|
||||
$oModuleController->insertTrigger('module.deleteModule', 'trackback', 'controller', 'triggerDeleteModuleTrackbacks', 'after');
|
||||
// 2007. 10. Yeokingeul sent from the popup menu features 18 additional posts
|
||||
if(!$oModuleModel->getTrigger('document.getDocumentMenu', 'trackback', 'controller', 'triggerSendTrackback', 'after'))
|
||||
$oModuleController->insertTrigger('document.getDocumentMenu', 'trackback', 'controller', 'triggerSendTrackback', 'after');
|
||||
// 2007. 10. The ability to receive 19 additional modular yeokingeul
|
||||
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'trackback', 'view', 'triggerDispTrackbackAdditionSetup', 'before'))
|
||||
$oModuleController->insertTrigger('module.dispAdditionSetup', 'trackback', 'view', 'triggerDispTrackbackAdditionSetup', 'before');
|
||||
/**
|
||||
* Execute update
|
||||
* @return Object
|
||||
*/
|
||||
function moduleUpdate()
|
||||
{
|
||||
$oModuleModel = &getModel('module');
|
||||
$oModuleController = &getController('module');
|
||||
// 2007. 10. 17 posts deleted, even when the comments will be deleted trigger property
|
||||
if(!$oModuleModel->getTrigger('document.deleteDocument', 'trackback', 'controller', 'triggerDeleteDocumentTrackbacks', 'after'))
|
||||
$oModuleController->insertTrigger('document.deleteDocument', 'trackback', 'controller', 'triggerDeleteDocumentTrackbacks', 'after');
|
||||
// 2007. 10. 17 modules are deleted when you delete all registered triggers that add Trackbacks
|
||||
if(!$oModuleModel->getTrigger('module.deleteModule', 'trackback', 'controller', 'triggerDeleteModuleTrackbacks', 'after'))
|
||||
$oModuleController->insertTrigger('module.deleteModule', 'trackback', 'controller', 'triggerDeleteModuleTrackbacks', 'after');
|
||||
// 2007. 10. Yeokingeul sent from the popup menu features 18 additional posts
|
||||
if(!$oModuleModel->getTrigger('document.getDocumentMenu', 'trackback', 'controller', 'triggerSendTrackback', 'after'))
|
||||
$oModuleController->insertTrigger('document.getDocumentMenu', 'trackback', 'controller', 'triggerSendTrackback', 'after');
|
||||
// 2007. 10. The ability to receive 19 additional modular yeokingeul
|
||||
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
|
||||
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'trackback', 'controller', 'triggerCopyModule', 'after'))
|
||||
{
|
||||
$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'trackback', 'controller', 'triggerCopyModule', 'after');
|
||||
}
|
||||
// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
|
||||
if(!$oModuleModel->getTrigger('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
|
||||
* @return void
|
||||
*/
|
||||
function recompileCache() {
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
/**
|
||||
* Re-generate the cache file
|
||||
* @return void
|
||||
*/
|
||||
function recompileCache()
|
||||
{
|
||||
}
|
||||
}
|
||||
/* End of file trackback.class.php */
|
||||
/* Location: ./modules/trackback/trackback.class.php */
|
||||
|
|
|
|||
|
|
@ -1,373 +1,393 @@
|
|||
<?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
|
||||
* trackback module's Controller class
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/trackback
|
||||
* @version 0.1
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
class trackbackController extends trackback {
|
||||
/**
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
function init() {
|
||||
}
|
||||
function init()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Trackbacks sent
|
||||
* @return object
|
||||
*/
|
||||
function procTrackbackSend() {
|
||||
// Yeokingeul to post numbers and shipping addresses Wanted
|
||||
$document_srl = Context::get('target_srl');
|
||||
$trackback_url = Context::get('trackback_url');
|
||||
$charset = Context::get('charset');
|
||||
if(!$document_srl || !$trackback_url || !$charset) return new Object(-1, 'msg_invalid_request');
|
||||
// Login Information Wanted
|
||||
$logged_info = Context::get('logged_info');
|
||||
if(!$logged_info->member_srl) return new Object(-1, 'msg_not_permitted');
|
||||
// Posts of the information obtained permission to come and check whether
|
||||
$oDocumentModel = &getModel('document');
|
||||
$oDocument = $oDocumentModel->getDocument($document_srl);
|
||||
if(!$oDocument->isExists() || !$oDocument->getSummary()) return new Object(-1, 'msg_invalid_request');
|
||||
if($oDocument->getMemberSrl() != $logged_info->member_srl) return new Object(-1, 'msg_not_permitted');
|
||||
// Specify the title of the module, the current article
|
||||
$oModuleModel = &getModel('module');
|
||||
$module_info = $oModuleModel->getModuleInfoByModuleSrl($oDocument->get('module_srl'));
|
||||
Context::setBrowserTitle($module_info->browser_title);
|
||||
// Shipping yeokingeul
|
||||
$output = $this->sendTrackback($oDocument, $trackback_url, $charset);
|
||||
if($output->toBool() && !in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
|
||||
global $lang;
|
||||
htmlHeader();
|
||||
alertScript($lang->success_registed);
|
||||
reload(true);
|
||||
closePopupScript();
|
||||
htmlFooter();
|
||||
Context::close();
|
||||
exit;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Trackback List
|
||||
* @return void
|
||||
*/
|
||||
function procTrackbackGetList()
|
||||
/**
|
||||
* Trackbacks sent
|
||||
* @return object
|
||||
*/
|
||||
function procTrackbackSend()
|
||||
{
|
||||
// Yeokingeul to post numbers and shipping addresses Wanted
|
||||
$document_srl = Context::get('target_srl');
|
||||
$trackback_url = Context::get('trackback_url');
|
||||
$charset = Context::get('charset');
|
||||
if(!$document_srl || !$trackback_url || !$charset) return new Object(-1, 'msg_invalid_request');
|
||||
// Login Information Wanted
|
||||
$logged_info = Context::get('logged_info');
|
||||
if(!$logged_info->member_srl) return new Object(-1, 'msg_not_permitted');
|
||||
// Posts of the information obtained permission to come and check whether
|
||||
$oDocumentModel = &getModel('document');
|
||||
$oDocument = $oDocumentModel->getDocument($document_srl);
|
||||
if(!$oDocument->isExists() || !$oDocument->getSummary()) return new Object(-1, 'msg_invalid_request');
|
||||
if($oDocument->getMemberSrl() != $logged_info->member_srl) return new Object(-1, 'msg_not_permitted');
|
||||
// Specify the title of the module, the current article
|
||||
$oModuleModel = &getModel('module');
|
||||
$module_info = $oModuleModel->getModuleInfoByModuleSrl($oDocument->get('module_srl'));
|
||||
Context::setBrowserTitle($module_info->browser_title);
|
||||
// Shipping yeokingeul
|
||||
$output = $this->sendTrackback($oDocument, $trackback_url, $charset);
|
||||
if($output->toBool() && !in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
|
||||
{
|
||||
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);
|
||||
htmlHeader();
|
||||
alertScript($lang->success_registed);
|
||||
reload(true);
|
||||
closePopupScript();
|
||||
htmlFooter();
|
||||
Context::close();
|
||||
exit;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
if(is_array($output->data)) $trackbackList = $output->data;
|
||||
else
|
||||
{
|
||||
unset($_SESSION['trackback_management']);
|
||||
$trackbackList = array();
|
||||
$this->setMessage($lang->no_trackbacks);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 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;
|
||||
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
|
||||
{
|
||||
unset($_SESSION['trackback_management']);
|
||||
$trackbackList = array();
|
||||
$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
|
||||
* @parma array $menu_list
|
||||
*/
|
||||
function triggerSendTrackback(&$menu_list) {
|
||||
$logged_info = Context::get('logged_info');
|
||||
if(!$logged_info->member_srl) return new Object();
|
||||
// Post number and the current login information requested Wanted
|
||||
$document_srl = Context::get('target_srl');
|
||||
$oDocumentModel = &getModel('document');
|
||||
$oDocument = $oDocumentModel->getDocument($document_srl);
|
||||
if(!$oDocument->isExists()) return new Object();
|
||||
if($oDocument->getMemberSrl() != $logged_info->member_srl) return new Object();
|
||||
// Add a link sent yeokingeul
|
||||
$oDocumentController = &getController('document');
|
||||
$url = getUrl('','module','trackback','act','dispTrackbackSend','document_srl', $document_srl);
|
||||
$oDocumentController->addDocumentPopupMenu($url,'cmd_send_trackback','','popup');
|
||||
/**
|
||||
* Trackbacks send documents from the popup menu add a menu
|
||||
* @parma array $menu_list
|
||||
*/
|
||||
function triggerSendTrackback(&$menu_list)
|
||||
{
|
||||
$logged_info = Context::get('logged_info');
|
||||
if(!$logged_info->member_srl) return new Object();
|
||||
// Post number and the current login information requested Wanted
|
||||
$document_srl = Context::get('target_srl');
|
||||
$oDocumentModel = &getModel('document');
|
||||
$oDocument = $oDocumentModel->getDocument($document_srl);
|
||||
if(!$oDocument->isExists()) return new Object();
|
||||
if($oDocument->getMemberSrl() != $logged_info->member_srl) return new Object();
|
||||
// Add a link sent yeokingeul
|
||||
$oDocumentController = &getController('document');
|
||||
$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
|
||||
* @param object $obj
|
||||
* @return Object
|
||||
*/
|
||||
function triggerDeleteDocumentTrackbacks(&$obj) {
|
||||
$document_srl = $obj->document_srl;
|
||||
if(!$document_srl) return new Object();
|
||||
/**
|
||||
* Delete document in the document to delete the trigger Trackbacks
|
||||
* @param object $obj
|
||||
* @return Object
|
||||
*/
|
||||
function triggerDeleteDocumentTrackbacks(&$obj)
|
||||
{
|
||||
$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
|
||||
* @param object $obj
|
||||
* @return Object
|
||||
*/
|
||||
function triggerDeleteModuleTrackbacks(&$obj) {
|
||||
$module_srl = $obj->module_srl;
|
||||
if(!$module_srl) return new Object();
|
||||
/**
|
||||
* Deletion module that deletes all the trigger yeokingeul
|
||||
* @param object $obj
|
||||
* @return Object
|
||||
*/
|
||||
function triggerDeleteModuleTrackbacks(&$obj)
|
||||
{
|
||||
$module_srl = $obj->module_srl;
|
||||
if(!$module_srl) return new Object();
|
||||
|
||||
$oTrackbackController = &getAdminController('trackback');
|
||||
return $oTrackbackController->deleteModuleTrackbacks($module_srl);
|
||||
}
|
||||
$oTrackbackController = &getAdminController('trackback');
|
||||
return $oTrackbackController->deleteModuleTrackbacks($module_srl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Trackback inserted
|
||||
* @return Object
|
||||
*/
|
||||
function trackback() {
|
||||
// Output is set to XMLRPC
|
||||
Context::setRequestMethod("XMLRPC");
|
||||
// When receiving the necessary variables yeokingeul Wanted
|
||||
$obj = Context::gets('document_srl','blog_name','url','title','excerpt');
|
||||
if(!$obj->document_srl || !$obj->url || !$obj->title || !$obj->excerpt) return $this->stop('fail');
|
||||
// Checks for correct trackback url
|
||||
$given_key = Context::get('key');
|
||||
$oTrackbackModel = &getModel('trackback');
|
||||
$key = $oTrackbackModel->getTrackbackKey($obj->document_srl);
|
||||
if($key != $given_key) return $this->stop('fail');
|
||||
// Yeokingeul module out of the default settings
|
||||
$module_srl = Context::get('module_srl');
|
||||
$oModuleModel = &getModel('module');
|
||||
$config = $oModuleModel->getModulePartConfig('trackback', $module_srl);
|
||||
$enable_trackback = $config->enable_trackback;
|
||||
if(!$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');
|
||||
/**
|
||||
* Trackback inserted
|
||||
* @return Object
|
||||
*/
|
||||
function trackback()
|
||||
{
|
||||
// Output is set to XMLRPC
|
||||
Context::setRequestMethod("XMLRPC");
|
||||
// When receiving the necessary variables yeokingeul Wanted
|
||||
$obj = Context::gets('document_srl','blog_name','url','title','excerpt');
|
||||
if(!$obj->document_srl || !$obj->url || !$obj->title || !$obj->excerpt) return $this->stop('fail');
|
||||
// Checks for correct trackback url
|
||||
$given_key = Context::get('key');
|
||||
$oTrackbackModel = &getModel('trackback');
|
||||
$key = $oTrackbackModel->getTrackbackKey($obj->document_srl);
|
||||
if($key != $given_key) return $this->stop('fail');
|
||||
// Yeokingeul module out of the default settings
|
||||
$module_srl = Context::get('module_srl');
|
||||
$oModuleModel = &getModel('module');
|
||||
$config = $oModuleModel->getModulePartConfig('trackback', $module_srl);
|
||||
$enable_trackback = $config->enable_trackback;
|
||||
if(!$enable_trackback)
|
||||
{
|
||||
$config = $oModuleModel->getModuleConfig('trackback');
|
||||
$enable_trackback = $config->enable_trackback;
|
||||
}
|
||||
|
||||
return $this->insertTrackback($obj);
|
||||
}
|
||||
// If managers were banned does not Trackbacks
|
||||
if($enable_trackback == 'N') return $this->stop('fail');
|
||||
|
||||
/**
|
||||
* 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;
|
||||
return $this->insertTrackback($obj);
|
||||
}
|
||||
|
||||
if(!$manual_inserted) {
|
||||
// Imported document model object, it permits you to wonbongeul
|
||||
$oDocumentModel = &getModel('document');
|
||||
$oDocument = $oDocumentModel->getDocument($document_srl);
|
||||
// If you do not allow two or trackback wonbongeul error display
|
||||
if(!$oDocument->isExists()) return $this->stop('fail');
|
||||
if(!$oDocument->allowTrackback()) return new Object(-1,'fail');
|
||||
/**
|
||||
* 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;
|
||||
|
||||
$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;
|
||||
if(!$manual_inserted)
|
||||
{
|
||||
// Imported document model object, it permits you to wonbongeul
|
||||
$oDocumentModel = &getModel('document');
|
||||
$oDocument = $oDocumentModel->getDocument($document_srl);
|
||||
// If you do not allow two or trackback wonbongeul error display
|
||||
if(!$oDocument->isExists()) return $this->stop('fail');
|
||||
if(!$oDocument->allowTrackback()) return new Object(-1,'fail');
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 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');
|
||||
return new Object();
|
||||
}
|
||||
|
||||
$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;
|
||||
/**
|
||||
* 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');
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
/**
|
||||
* 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');
|
||||
return $output;
|
||||
}
|
||||
|
||||
// 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());
|
||||
$oModuleController->replaceDefinedLangCode($obj->blog_name);
|
||||
$obj->title = $oDocument->getTitleText();
|
||||
$obj->excerpt = $oDocument->getSummary(200);
|
||||
$obj->url = getFullUrl('','document_srl',$oDocument->document_srl);
|
||||
// Information sent by
|
||||
$http = parse_url($trackback_url);
|
||||
|
||||
// blog_name, title, excerpt, url charset of the string to the requested change
|
||||
if($charset && function_exists('iconv')) {
|
||||
foreach($obj as $key=>$val) {
|
||||
$obj->{$key} = iconv('UTF-8',$charset,$val);
|
||||
}
|
||||
}
|
||||
$obj->blog_name = str_replace(array('<','>','&','"'), array('<','>','&','"'), Context::getBrowserTitle());
|
||||
$oModuleController->replaceDefinedLangCode($obj->blog_name);
|
||||
$obj->title = $oDocument->getTitleText();
|
||||
$obj->excerpt = $oDocument->getSummary(200);
|
||||
$obj->url = getFullUrl('','document_srl',$oDocument->document_srl);
|
||||
|
||||
$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')
|
||||
// blog_name, title, excerpt, url charset of the string to the requested change
|
||||
if($charset && function_exists('iconv'))
|
||||
{
|
||||
foreach($obj as $key=>$val)
|
||||
{
|
||||
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
|
||||
{
|
||||
if($xmlDoc->response->message->body)
|
||||
{
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* End of file trackback.controller.php */
|
||||
/* Location: ./modules/trackback/trackback.controller.php */
|
||||
|
|
|
|||
|
|
@ -1,180 +1,193 @@
|
|||
<?php
|
||||
/**
|
||||
* trackbackModel class
|
||||
* trackback module model class
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/trackback
|
||||
* @version 0.1
|
||||
*/
|
||||
class trackbackModel extends trackback
|
||||
{
|
||||
/**
|
||||
* trackbackModel class
|
||||
* trackback module model class
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/trackback
|
||||
* @version 0.1
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
class trackbackModel extends trackback {
|
||||
/**
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
function init() {
|
||||
}
|
||||
function init()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Wanted a trackback information
|
||||
* @param int $trackback_srl
|
||||
* @param array $columnList
|
||||
* @return object
|
||||
*/
|
||||
function getTrackback($trackback_srl, $columnList = array()) {
|
||||
$args->trackback_srl = $trackback_srl;
|
||||
$output = executeQuery('trackback.getTrackback', $args, $columnList);
|
||||
return $output;
|
||||
}
|
||||
/**
|
||||
* Wanted a trackback information
|
||||
* @param int $trackback_srl
|
||||
* @param array $columnList
|
||||
* @return object
|
||||
*/
|
||||
function getTrackback($trackback_srl, $columnList = array())
|
||||
{
|
||||
$args->trackback_srl = $trackback_srl;
|
||||
$output = executeQuery('trackback.getTrackback', $args, $columnList);
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Trackbacks document_srl corresponding to the bringing of the total number of
|
||||
* @param int $document_srl
|
||||
* @return int
|
||||
*/
|
||||
function getTrackbackCount($document_srl) {
|
||||
$args->document_srl = $document_srl;
|
||||
$output = executeQuery('trackback.getTrackbackCount', $args);
|
||||
$total_count = $output->data->count;
|
||||
/**
|
||||
* Trackbacks document_srl corresponding to the bringing of the total number of
|
||||
* @param int $document_srl
|
||||
* @return int
|
||||
*/
|
||||
function getTrackbackCount($document_srl)
|
||||
{
|
||||
$args->document_srl = $document_srl;
|
||||
$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;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
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
|
||||
* 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;
|
||||
/**
|
||||
* 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);
|
||||
|
||||
return (int)$total_count;
|
||||
}
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
/**
|
||||
* 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);
|
||||
$trackback_list = $output->data;
|
||||
|
||||
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);
|
||||
|
||||
/**
|
||||
* 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 $output;
|
||||
}
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
/**
|
||||
* Fixed in time for the entire yeokingeul Wanted to Register
|
||||
* @param int $time
|
||||
* @param string $ipaddress
|
||||
* @param string $url
|
||||
* @param string $blog_name
|
||||
* @param string $title
|
||||
* @param string excerpt
|
||||
* @return int
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fixed in time for the entire yeokingeul Wanted to Register
|
||||
* @param int $time
|
||||
* @param string $ipaddress
|
||||
* @param string $url
|
||||
* @param string $blog_name
|
||||
* @param string $title
|
||||
* @param string excerpt
|
||||
* @return int
|
||||
*/
|
||||
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
|
||||
* Adds the key value in the trackback url.
|
||||
* @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));
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return by creating a trackback url
|
||||
* Adds the key value in the trackback url.
|
||||
* @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));
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return keys by generating
|
||||
* 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
|
||||
* @return string
|
||||
*/
|
||||
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));
|
||||
}
|
||||
}
|
||||
?>
|
||||
/**
|
||||
* Return keys by generating
|
||||
* 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
|
||||
* @return string
|
||||
*/
|
||||
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));
|
||||
}
|
||||
}
|
||||
/* End of file trackback.model.php */
|
||||
/* Location: ./modules/trackback/trackback.model.php */
|
||||
|
|
|
|||
|
|
@ -1,71 +1,77 @@
|
|||
<?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
|
||||
* @brief trackback module's view class
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/trackback
|
||||
* @version 0.1
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
class trackbackView extends trackback {
|
||||
/**
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
function init() {
|
||||
}
|
||||
function init()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Display output list (administrative)
|
||||
* @return void
|
||||
*/
|
||||
function dispTrackbackSend() {
|
||||
$document_srl = Context::get('document_srl');
|
||||
if(!$document_srl) return $this->stop('msg_invalid_request');
|
||||
/**
|
||||
* Display output list (administrative)
|
||||
* @return void
|
||||
*/
|
||||
function dispTrackbackSend()
|
||||
{
|
||||
$document_srl = Context::get('document_srl');
|
||||
if(!$document_srl) return $this->stop('msg_invalid_request');
|
||||
|
||||
$logged_info = Context::get('logged_info');
|
||||
if(!$logged_info->member_srl) return $this->stop('msg_not_permitted');
|
||||
// Wanted Original article information
|
||||
$oDocumentModel = &getModel('document');
|
||||
$oDocument = $oDocumentModel->getDocument($document_srl);
|
||||
if(!$oDocument->isExists()) return $this->stop('msg_invalid_document');
|
||||
if($oDocument->isSecret()) return $this->stop('msg_invalid_request');
|
||||
$logged_info = Context::get('logged_info');
|
||||
if(!$logged_info->member_srl) return $this->stop('msg_not_permitted');
|
||||
// Wanted Original article information
|
||||
$oDocumentModel = &getModel('document');
|
||||
$oDocument = $oDocumentModel->getDocument($document_srl);
|
||||
if(!$oDocument->isExists()) return $this->stop('msg_invalid_document');
|
||||
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);
|
||||
// Set a template
|
||||
$this->setLayoutFile('popup_layout');
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('send_trackback_form');
|
||||
}
|
||||
Context::set('oDocument', $oDocument);
|
||||
// Set a template
|
||||
$this->setLayoutFile('popup_layout');
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('send_trackback_form');
|
||||
}
|
||||
|
||||
/**
|
||||
* An additional set of parts for a service module
|
||||
* Use the form out of the settings for trackback
|
||||
* @param string $obj
|
||||
* @return Object
|
||||
*/
|
||||
function triggerDispTrackbackAdditionSetup(&$obj) {
|
||||
$current_module_srl = Context::get('module_srl');
|
||||
$current_module_srls = Context::get('module_srls');
|
||||
/**
|
||||
* An additional set of parts for a service module
|
||||
* Use the form out of the settings for trackback
|
||||
* @param string $obj
|
||||
* @return Object
|
||||
*/
|
||||
function triggerDispTrackbackAdditionSetup(&$obj)
|
||||
{
|
||||
$current_module_srl = Context::get('module_srl');
|
||||
$current_module_srls = Context::get('module_srls');
|
||||
|
||||
if(!$current_module_srl && !$current_module_srls) {
|
||||
// Get information of the current module
|
||||
$current_module_info = Context::get('current_module_info');
|
||||
$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');
|
||||
$trackback_config = $oTrackbackModel->getTrackbackModuleConfig($current_module_srl);
|
||||
Context::set('trackback_config', $trackback_config);
|
||||
// Set a template file
|
||||
$oTemplate = &TemplateHandler::getInstance();
|
||||
$tpl = $oTemplate->compile($this->module_path.'tpl', 'trackback_module_config');
|
||||
$obj .= $tpl;
|
||||
if(!$current_module_srl && !$current_module_srls)
|
||||
{
|
||||
// Get information of the current module
|
||||
$current_module_info = Context::get('current_module_info');
|
||||
$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');
|
||||
$trackback_config = $oTrackbackModel->getTrackbackModuleConfig($current_module_srl);
|
||||
Context::set('trackback_config', $trackback_config);
|
||||
// Set a template file
|
||||
$oTemplate = &TemplateHandler::getInstance();
|
||||
$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());
|
||||
$output = $oAdminController->restoreTrash($originObject);
|
||||
|
||||
if(!$output->toBool()) {
|
||||
if(!$output->toBool())
|
||||
{
|
||||
$oDB->rollback();
|
||||
return new Object(-1, $output->message);
|
||||
}
|
||||
|
|
@ -189,7 +190,8 @@ class trashAdminController extends trash
|
|||
$trashSrls = Context::get('trash_srls');
|
||||
if($trashSrls) $trashSrlList = explode(',', $trashSrls);
|
||||
|
||||
if(count($trashSrlList) > 0) {
|
||||
if(count($trashSrlList) > 0)
|
||||
{
|
||||
$oTrashModel = &getModel('trash');
|
||||
$args->trashSrl = $trashSrlList;
|
||||
$output = $oTrashModel->getTrashList($args);
|
||||
|
|
@ -220,6 +222,5 @@ class trashAdminController extends trash
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/* End of file trash.controller.php */
|
||||
/* Location: ./modules/trash/trash.controller.php */
|
||||
/* End of file trash.admin.controller.php */
|
||||
/* Location: ./modules/trash/trash.admin.controller.php */
|
||||
|
|
|
|||
|
|
@ -7,12 +7,14 @@
|
|||
* @package /modules/trash
|
||||
* @version 0.1
|
||||
*/
|
||||
class trashAdminView extends trash {
|
||||
class trashAdminView extends trash
|
||||
{
|
||||
/**
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
function init() {
|
||||
function init()
|
||||
{
|
||||
// 템플릿 경로 지정 (board의 경우 tpl에 관리자용 템플릿 모아놓음)
|
||||
$template_path = sprintf("%stpl/",$this->module_path);
|
||||
$this->setTemplatePath($template_path);
|
||||
|
|
@ -22,7 +24,8 @@ class trashAdminView extends trash {
|
|||
* Trash list
|
||||
* @return void
|
||||
*/
|
||||
function dispTrashAdminList() {
|
||||
function dispTrashAdminList()
|
||||
{
|
||||
$args->page = Context::get('page'); // /< 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
|
||||
|
|
@ -47,4 +50,5 @@ class trashAdminView extends trash {
|
|||
$this->setTemplateFile('trash_list');
|
||||
}
|
||||
}
|
||||
?>
|
||||
/* End of file trash.admin.view.php */
|
||||
/* Location: ./modules/trash/trash.admin.view.php */
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
<?php
|
||||
require_once(_XE_PATH_.'modules/trash/model/TrashVO.php');
|
||||
|
||||
/**
|
||||
* trash class
|
||||
* trash the module's high class
|
||||
|
|
@ -7,15 +9,14 @@
|
|||
* @package /modules/trash
|
||||
* @version 0.1
|
||||
*/
|
||||
|
||||
require_once(_XE_PATH_.'modules/trash/model/TrashVO.php');
|
||||
|
||||
class trash extends ModuleObject {
|
||||
class trash extends ModuleObject
|
||||
{
|
||||
/**
|
||||
* Implement if additional tasks are necessary when installing
|
||||
* @return Object
|
||||
*/
|
||||
function moduleInstall() {
|
||||
function moduleInstall()
|
||||
{
|
||||
return new Object();
|
||||
}
|
||||
|
||||
|
|
@ -23,7 +24,8 @@ class trash extends ModuleObject {
|
|||
* A method to check if successfully installed
|
||||
* @return bool
|
||||
*/
|
||||
function checkUpdate() {
|
||||
function checkUpdate()
|
||||
{
|
||||
//$oDB = &DB::getInstance();
|
||||
//$oModuleModel = &getModel('module');
|
||||
|
||||
|
|
@ -34,12 +36,13 @@ class trash extends ModuleObject {
|
|||
* Execute update
|
||||
* @return Object
|
||||
*/
|
||||
function moduleUpdate() {
|
||||
function moduleUpdate()
|
||||
{
|
||||
//$oDB = &DB::getInstance();
|
||||
//$oModuleModel = &getModel('module');
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/* End of file trash.model.php */
|
||||
/* Location: ./modules/trash/trash.model.php */
|
||||
|
|
|
|||
|
|
@ -7,12 +7,15 @@
|
|||
* @package /modules/trash
|
||||
* @version 0.1
|
||||
*/
|
||||
class trashView extends trash {
|
||||
class trashView extends trash
|
||||
{
|
||||
/**
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
function init() {
|
||||
function init()
|
||||
{
|
||||
}
|
||||
}
|
||||
?>
|
||||
/* End of file trash.view.php */
|
||||
/* Location: ./modules/trash/trash.view.php */
|
||||
|
|
|
|||
|
|
@ -1,78 +1,79 @@
|
|||
<?php
|
||||
/**
|
||||
* @class widgetAdminView
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief admin view class for widget modules
|
||||
**/
|
||||
/**
|
||||
* @class widgetAdminView
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @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();
|
||||
|
||||
/**
|
||||
* @brief Initialization
|
||||
**/
|
||||
function init() {
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
}
|
||||
$security = new Security($widget_list);
|
||||
$widget_list = $security->encodeHTML('..', '..author..');
|
||||
|
||||
/**
|
||||
* @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()
|
||||
foreach($widget_list as $no => $widget)
|
||||
{
|
||||
$oView = &getView('widget');
|
||||
Context::set('in_admin', true);
|
||||
$this->setTemplateFile('widget_generate_code');
|
||||
return $oView->dispWidgetGenerateCode();
|
||||
$widget_list[$no]->description = nl2br(trim($widget->description));
|
||||
}
|
||||
|
||||
/**
|
||||
* @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");
|
||||
Context::set('widget_list', $widget_list);
|
||||
Context::set('tCount', count($widget_list));
|
||||
|
||||
$document_srl = Context::get('document_srl');
|
||||
$oDocumentModel = &getModel('document');
|
||||
$oDocument = $oDocumentModel->getDocument($document_srl);
|
||||
Context::set('oDocument', $oDocument);
|
||||
$this->setTemplateFile('downloaded_widget_list');
|
||||
}
|
||||
|
||||
$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);
|
||||
function dispWidgetAdminGenerateCode()
|
||||
{
|
||||
$oView = &getView('widget');
|
||||
Context::set('in_admin', true);
|
||||
$this->setTemplateFile('widget_generate_code');
|
||||
return $oView->dispWidgetGenerateCode();
|
||||
}
|
||||
|
||||
$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');
|
||||
$this->setLayoutFile("default_layout");
|
||||
$this->setTemplateFile('add_content_widget');
|
||||
$document_srl = Context::get('document_srl');
|
||||
$oDocumentModel = &getModel('document');
|
||||
$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
|
||||
/**
|
||||
* @class widget
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief widget module's high class
|
||||
**/
|
||||
/**
|
||||
* @class widget
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @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
|
||||
**/
|
||||
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');
|
||||
/**
|
||||
* @brief a method to check if successfully installed
|
||||
*/
|
||||
function checkUpdate()
|
||||
{
|
||||
$oModuleModel = &getModel('module');
|
||||
// widget compile display.after trigger for further (04/14/2009)
|
||||
if(!$oModuleModel->getTrigger('display', 'widget', 'controller', 'triggerWidgetCompile', 'before')) return true;
|
||||
|
||||
return new Object();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief a method to check if successfully installed
|
||||
**/
|
||||
function checkUpdate() {
|
||||
$oModuleModel = &getModel('module');
|
||||
// widget compile display.after trigger for further (04/14/2009)
|
||||
if(!$oModuleModel->getTrigger('display', 'widget', 'controller', 'triggerWidgetCompile', 'before')) return true;
|
||||
/**
|
||||
* @brief Execute update
|
||||
*/
|
||||
function moduleUpdate()
|
||||
{
|
||||
$oModuleModel = &getModel('module');
|
||||
$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
|
||||
**/
|
||||
function moduleUpdate() {
|
||||
$oModuleModel = &getModel('module');
|
||||
$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 new Object(0, 'success_updated');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Re-generate the cache file
|
||||
**/
|
||||
function recompileCache() {
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
/**
|
||||
* @brief Re-generate the cache file
|
||||
*/
|
||||
function recompileCache()
|
||||
{
|
||||
}
|
||||
}
|
||||
/* End of file widget.class.php */
|
||||
/* Location: ./modules/widget/widget.class.php */
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,403 +1,430 @@
|
|||
<?php
|
||||
/**
|
||||
* @class widgetModel
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @version 0.1
|
||||
* @brief Model class for widget modules
|
||||
**/
|
||||
/**
|
||||
* @class widgetModel
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @version 0.1
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* @brief Initialization
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Wanted widget's path
|
||||
**/
|
||||
function getWidgetPath($widget_name) {
|
||||
$path = sprintf('./widgets/%s/', $widget_name);
|
||||
if(is_dir($path)) return $path;
|
||||
/**
|
||||
* @brief Wanted widget style path
|
||||
*/
|
||||
function getWidgetStylePath($widgetStyle_name)
|
||||
{
|
||||
$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
|
||||
**/
|
||||
function getWidgetStylePath($widgetStyle_name) {
|
||||
$path = sprintf('./widgetstyles/%s/', $widgetStyle_name);
|
||||
if(is_dir($path)) return $path;
|
||||
/**
|
||||
* @brief Wanted photos of the type and information
|
||||
* Download a widget with type (generation and other means)
|
||||
*/
|
||||
function getDownloadedWidgetList()
|
||||
{
|
||||
$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);
|
||||
|
||||
/**
|
||||
* @brief Wanted widget style path
|
||||
**/
|
||||
function getWidgetStyleTpl($widgetStyle_name) {
|
||||
$path = $this->getWidgetStylePath($widgetStyle_name);
|
||||
$tpl = sprintf('%swidgetstyle.html', $path);
|
||||
return $tpl;
|
||||
}
|
||||
// get easyinstall remove url
|
||||
$packageSrl = $oAutoinstallModel->getPackageSrlByPath($widget_info->path);
|
||||
$widget_info->remove_url = $oAutoinstallModel->getRemoveUrlByPackageSrl($packageSrl);
|
||||
|
||||
/**
|
||||
* @brief Wanted photos of the type and information
|
||||
* Download a widget with type (generation and other means)
|
||||
**/
|
||||
function getDownloadedWidgetList() {
|
||||
$oAutoinstallModel = &getModel('autoinstall');
|
||||
// get easyinstall need update
|
||||
$package = $oAutoinstallModel->getInstalledPackages($packageSrl);
|
||||
$widget_info->need_update = $package[$packageSrl]->need_update;
|
||||
|
||||
// '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 update url
|
||||
if ($widget_info->need_update == 'Y')
|
||||
{
|
||||
$widget_info->update_url = $oAutoinstallModel->getUpdateUrlByPackageSrl($packageSrl);
|
||||
}
|
||||
|
||||
// get easyinstall remove url
|
||||
$packageSrl = $oAutoinstallModel->getPackageSrlByPath($widget_info->path);
|
||||
$widget_info->remove_url = $oAutoinstallModel->getRemoveUrlByPackageSrl($packageSrl);
|
||||
$list[] = $widget_info;
|
||||
}
|
||||
return $list;
|
||||
}
|
||||
|
||||
// get easyinstall need update
|
||||
$package = $oAutoinstallModel->getInstalledPackages($packageSrl);
|
||||
$widget_info->need_update = $package[$packageSrl]->need_update;
|
||||
/**
|
||||
* @brief Wanted photos of the type and information
|
||||
* 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
|
||||
if ($widget_info->need_update == 'Y')
|
||||
$list[] = $widgetStyle_info;
|
||||
}
|
||||
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;
|
||||
}
|
||||
return $list;
|
||||
}
|
||||
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;
|
||||
|
||||
/**
|
||||
* @brief Wanted photos of the type and information
|
||||
* 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);
|
||||
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);
|
||||
|
||||
$list[] = $widgetStyle_info;
|
||||
}
|
||||
return $list;
|
||||
}
|
||||
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];
|
||||
|
||||
/**
|
||||
* @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());
|
||||
$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));
|
||||
|
||||
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;
|
||||
$options = $var->options;
|
||||
if(!$options) continue;
|
||||
|
||||
$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') {
|
||||
// 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;
|
||||
$buff = '<?php if(!defined("__ZBXE__")) exit(); '.$buff.' ?>';
|
||||
FileHandler::writeFile($cache_file, $buff);
|
||||
|
||||
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++) {
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
if(file_exists($cache_file)) @include($cache_file);
|
||||
return $widgetStyle_info;
|
||||
}
|
||||
}
|
||||
/* End of file widget.model.php */
|
||||
/* Location: ./modules/widget/widget.model.php */
|
||||
|
|
|
|||
|
|
@ -1,138 +1,148 @@
|
|||
<?php
|
||||
/**
|
||||
* @class widgetView
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief View class of the widget modules
|
||||
**/
|
||||
/**
|
||||
* @class widgetView
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @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
|
||||
**/
|
||||
function init() {
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
}
|
||||
/**
|
||||
* @brief Widget details of the skin (skin.xml) a pop-out
|
||||
*/
|
||||
function dispWidgetSkinInfo()
|
||||
{
|
||||
$widget = Context::get('selected_widget');
|
||||
$skin = Context::get('skin');
|
||||
|
||||
/**
|
||||
* @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');
|
||||
}
|
||||
$path = sprintf('./widgets/%s/', $widget);
|
||||
// Wanted widget is selected information
|
||||
$oModuleModel = &getModel('module');
|
||||
$skin_info = $oModuleModel->loadSkinInfo($path, $skin);
|
||||
|
||||
/**
|
||||
* @brief Widget details of the skin (skin.xml) a pop-out
|
||||
**/
|
||||
function dispWidgetSkinInfo() {
|
||||
$widget = Context::get('selected_widget');
|
||||
$skin = Context::get('skin');
|
||||
Context::set('skin_info',$skin_info);
|
||||
// Specifies the widget to pop up
|
||||
$this->setLayoutFile('popup_layout');
|
||||
// Set a template file
|
||||
$this->setTemplateFile('skin_info');
|
||||
}
|
||||
|
||||
$path = sprintf('./widgets/%s/', $widget);
|
||||
// Wanted widget is selected information
|
||||
$oModuleModel = &getModel('module');
|
||||
$skin_info = $oModuleModel->loadSkinInfo($path, $skin);
|
||||
/**
|
||||
* @brief Widget's code generator
|
||||
*/
|
||||
function dispWidgetGenerateCode()
|
||||
{
|
||||
// Wanted widget is selected information
|
||||
$oWidgetModel = &getModel('widget');
|
||||
|
||||
Context::set('skin_info',$skin_info);
|
||||
// Specifies the widget to pop up
|
||||
$this->setLayoutFile('popup_layout');
|
||||
// Set a template file
|
||||
$this->setTemplateFile('skin_info');
|
||||
}
|
||||
$widget_list = $oWidgetModel->getDownloadedWidgetList();
|
||||
$selected_widget = Context::get('selected_widget');
|
||||
if(!$selected_widget) $selected_widget = $widget_list[0]->widget;
|
||||
|
||||
/**
|
||||
* @brief Widget's code generator
|
||||
**/
|
||||
function dispWidgetGenerateCode() {
|
||||
// Wanted widget is selected information
|
||||
$oWidgetModel = &getModel('widget');
|
||||
$widget_info = $oWidgetModel->getWidgetInfo($selected_widget);
|
||||
Context::set('widget_info', $widget_info);
|
||||
Context::set('widget_list', $widget_list);
|
||||
Context::set('selected_widget', $selected_widget);
|
||||
|
||||
$widget_list = $oWidgetModel->getDownloadedWidgetList();
|
||||
$selected_widget = Context::get('selected_widget');
|
||||
if(!$selected_widget) $selected_widget = $widget_list[0]->widget;
|
||||
$oModuleModel = &getModel('module');
|
||||
// Get a list of module categories
|
||||
$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);
|
||||
Context::set('widget_info', $widget_info);
|
||||
Context::set('widget_list', $widget_list);
|
||||
Context::set('selected_widget', $selected_widget);
|
||||
// Get a list of groups
|
||||
$oMemberModel = &getModel('member');
|
||||
$group_list = $oMemberModel->getGroups($site_module_info->site_srl);
|
||||
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');
|
||||
// Get a list of module categories
|
||||
$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);
|
||||
Context::set('mid_list',$module_categories);
|
||||
// Menu Get a list
|
||||
$output = executeQueryArray('menu.getMenus');
|
||||
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');
|
||||
}
|
||||
|
||||
// Get a list of groups
|
||||
$oMemberModel = &getModel('member');
|
||||
$group_list = $oMemberModel->getGroups($site_module_info->site_srl);
|
||||
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;
|
||||
}
|
||||
/**
|
||||
* @brief Managing pop-up pages used in the generated code
|
||||
*/
|
||||
function dispWidgetGenerateCodeInPage()
|
||||
{
|
||||
$oWidgetModel = &getModel('widget');
|
||||
$widget_list = $oWidgetModel->getDownloadedWidgetList();
|
||||
Context::set('widget_list',$widget_list);
|
||||
// When there is no widget is selected in the first widget
|
||||
if(!Context::get('selected_widget')) Context::set('selected_widget',$widget_list[0]->widget);
|
||||
|
||||
Context::set('mid_list',$module_categories);
|
||||
// Menu Get a list
|
||||
$output = executeQueryArray('menu.getMenus');
|
||||
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');
|
||||
}
|
||||
$this->dispWidgetGenerateCode();
|
||||
$this->setLayoutFile('default_layout');
|
||||
$this->setTemplateFile('widget_generate_code_in_page');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Managing pop-up pages used in the generated code
|
||||
**/
|
||||
function dispWidgetGenerateCodeInPage() {
|
||||
$oWidgetModel = &getModel('widget');
|
||||
$widget_list = $oWidgetModel->getDownloadedWidgetList();
|
||||
Context::set('widget_list',$widget_list);
|
||||
// When there is no widget is selected in the first widget
|
||||
if(!Context::get('selected_widget')) Context::set('selected_widget',$widget_list[0]->widget);
|
||||
/**
|
||||
* @brief Create widget style code page used in the pop-up management
|
||||
*/
|
||||
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_generate_code_in_page');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Create widget style code page used in the pop-up management
|
||||
**/
|
||||
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');
|
||||
}
|
||||
}
|
||||
?>
|
||||
$this->dispWidgetGenerateCode();
|
||||
$this->setLayoutFile('default_layout');
|
||||
$this->setTemplateFile('widget_style_generate_code_in_page');
|
||||
}
|
||||
}
|
||||
/* End of file widget.view.php */
|
||||
/* Location: ./modules/widget/widget.view.php */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue