Close Connection when there is no connection value.

git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@13161 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
misol 2013-09-25 15:29:32 +00:00
parent 034a5c0288
commit f70ce644ce
1410 changed files with 7188 additions and 53541 deletions

View file

@ -96,13 +96,16 @@ class pointAdminController extends point
{
$args = Context::getRequestVars();
foreach($args as $key => $val)
$configTypeList = array('insert_document', 'insert_comment', 'upload_file', 'download_file', 'read_document', 'voted', 'blamed');
foreach($configTypeList AS $config)
{
preg_match("/^(insert_document|insert_comment|upload_file|download_file|read_document|voted|blamed)_([0-9]+)$/", $key, $matches);
if(!$matches[1]) continue;
$name = $matches[1];
$module_srl = $matches[2];
if(strlen($val)>0) $module_config[$module_srl][$name] = (int)$val;
if(is_array($args->{$config}))
{
foreach($args->{$config} AS $key=>$value)
{
$module_config[$key][$config] = $value;
}
}
}
$oModuleController = &getController('module');
@ -197,7 +200,7 @@ class pointAdminController extends point
*/
function procPointAdminReCal()
{
set_time_limit(0);
@set_time_limit(0);
// Get per-module points information
$oModuleModel = &getModel('module');
$config = $oModuleModel->getModuleConfig('point');

View file

@ -81,11 +81,11 @@ class pointController extends point
$cur_point = $oPointModel->getPoint($member_srl, true);
$point = $module_config['insert_document'];
if(!isset($point)) $point = $config->insert_document;
if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document;
$cur_point += $point;
// Add points for attaching a file
$point = $module_config['upload_file'];
if(!isset($point)) $point = $config->upload_file;
if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count;
// Increase the point
$this->setPoint($member_srl,$cur_point);
@ -117,11 +117,11 @@ class pointController extends point
$cur_point = $oPointModel->getPoint($oDocument->get('member_srl'), true);
$point = $module_config['insert_document'];
if(!isset($point)) $point = $config->insert_document;
if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document;
$cur_point += $point;
// Add points for attaching a file
$point = $module_config['upload_file'];
if(!isset($point)) $point = $config->upload_file;
if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count;
// Increase the point
$this->setPoint($oDocument->get('member_srl'), $cur_point);
@ -147,7 +147,7 @@ class pointController extends point
$module_config = $oModuleModel->getModulePartConfig('point',$oDocument->get('module_srl'));
// The process related to clearing the post comments
$comment_point = $module_config['insert_comment'];
if(!isset($comment_point)) $comment_point = $config->insert_comment;
if(strlen($comment_point) == 0 && !is_int($comment_point)) $comment_point = $config->insert_comment;
// If there are comment points, attempt to deduct
if($comment_point>0) return new Object();
// Get all the comments related to this post
@ -201,13 +201,13 @@ class pointController extends point
$module_config = $oModuleModel->getModulePartConfig('point', $module_srl);
$point = $module_config['insert_document'];
if(!isset($point)) $point = $config->insert_document;
if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document;
// if the point is set to decrease when writing a document, make sure it does not increase the points when deleting an article
if($point < 0) return new Object();
$cur_point -= $point;
// Add points related to deleting an attachment
$point = $module_config['upload_file'];
if(!isset($point)) $point = $config->upload_file;
if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
if($obj->uploaded_count) $cur_point -= $point * $obj->uploaded_count;
// Increase the point
$this->setPoint($member_srl,$cur_point);
@ -237,7 +237,7 @@ class pointController extends point
$cur_point = $oPointModel->getPoint($member_srl, true);
$point = $module_config['insert_comment'];
if(!isset($point)) $point = $config->insert_comment;
if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment;
// Increase the point
$cur_point += $point;
$this->setPoint($member_srl,$cur_point);
@ -269,7 +269,7 @@ class pointController extends point
$cur_point = $oPointModel->getPoint($member_srl, true);
$point = $module_config['insert_comment'];
if(!isset($point)) $point = $config->insert_comment;
if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment;
// if the point is set to decrease when writing a comment, make sure it does not increase the points when deleting a comment
if($point < 0) return new Object();
// Increase the point
@ -308,7 +308,7 @@ class pointController extends point
$cur_point = $oPointModel->getPoint($member_srl, true);
$point = $module_config['upload_file'];
if(!isset($point)) $point = $config->upload_file;
if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
// Increase the point
$cur_point -= $point;
$this->setPoint($member_srl,$cur_point);
@ -334,7 +334,7 @@ class pointController extends point
// If it is set not to allow downloading for non-logged in users, do not permit
if(!Context::get('is_logged'))
{
if($config->disable_download == 'Y' && isset($module_config['download_file'])) return new Object(-1,'msg_not_permitted_download');
if($config->disable_download == 'Y' && strlen($module_config['download_file']) == 0 && !is_int($module_config['download_file'])) return new Object(-1,'msg_not_permitted_download');
else return new Object();
}
// Get the points of the member
@ -342,7 +342,7 @@ class pointController extends point
$cur_point = $oPointModel->getPoint($member_srl, true);
// Get the points
$point = $module_config['download_file'];
if(!isset($point)) $point = $config->download_file;
if(strlen($point) == 0 && !is_int($point)) $point = $config->download_file;
// If points are less than 0, and if downloading a file is not allowed in this case, give an errors
if($cur_point + $point < 0 && $config->disable_download == 'Y') return new Object(-1,'msg_cannot_download');
@ -371,7 +371,7 @@ class pointController extends point
$cur_point = $oPointModel->getPoint($member_srl, true);
// Get the points
$point = $module_config['download_file'];
if(!isset($point)) $point = $config->download_file;
if(strlen($point) == 0 && !is_int($point)) $point = $config->download_file;
// Increase the point
$cur_point += $point;
$this->setPoint($member_srl,$cur_point);
@ -399,7 +399,7 @@ class pointController extends point
$module_config = $oModuleModel->getModulePartConfig('point', $obj->get('module_srl'));
// Get hits points
$point = $module_config['read_document'];
if(!isset($point)) $point = $config->read_document;
if(strlen($point) == 0 && !is_int($point)) $point = $config->read_document;
// Pass if there are no requested points
if(!$point) return new Object();
// In case of a registered member, if it is read but cannot just pass, then get the current points
@ -455,12 +455,12 @@ class pointController extends point
if( $obj->point > 0 )
{
$point = $module_config['voted'];
if(!isset($point)) $point = $config->voted;
if(strlen($point) == 0 && !is_int($point)) $point = $config->voted;
}
else
{
$point = $module_config['blamed'];
if(!isset($point)) $point = $config->blamed;
if(strlen($point) == 0 && !is_int($point)) $point = $config->blamed;
}
if(!$point) return new Object();

View file

@ -131,7 +131,7 @@ class pointModel extends point
// if search keyword is emtpy, show all list
if(!$search_keyword)
{
unset($args, $search_target);
unset($args->is_admin, $args->is_denied, $args->selected_group_srl, $search_target);
}
if($search_target && $search_keyword)

View file

@ -1,16 +1,17 @@
<!--#include("./header.html")-->
<div cond="$XE_VALIDATOR_MESSAGE" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/point/tpl/config/1'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
<p>{$XE_VALIDATOR_MESSAGE}</p>
</div>
<form ruleset="insertConfig" action="./" method="post" class="x_form-horizontal">
<input type="hidden" name="module" value="point" />
<input type="hidden" name="act" value="procPointAdminInsertConfig" />
<input type="hidden" name="xe_validator_id" value="modules/point/tpl/config/1" />
<section class="section">
<h1>{$lang->is_default}</h1>
<div class="x_control-group">
<label for="max_level" class="x_control-label">{$lang->max_level}</label>
<div class="x_controls">
<input type="number" min="0" max="1000" value="{$config->max_level}" name="max_level" id="max_level" style="width:50px" />
<input type="number" min="0" max="1000" value="{$config->max_level}" name="max_level" id="max_level" />
{$lang->about_max_level}
</div>
</div>
@ -24,31 +25,31 @@
<div class="x_control-group">
<label class="x_control-label">{$lang->give_point}</label>
<div class="x_controls">
<input type="number" value="{$config->signup_point}" name="signup_point" id="signup_point" style="width:50px;text-align:right" /> :
<input type="number" value="{$config->signup_point}" name="signup_point" id="signup_point" style="text-align:right" /> :
<label for="signup_point" class="x_inline">{$lang->point_signup}</label>
<br />
<input type="number" value="{$config->login_point}" name="login_point" id="login_point" style="width:50px;text-align:right" /> :
<input type="number" value="{$config->login_point}" name="login_point" id="login_point" style="text-align:right" /> :
<label for="login_point" class="x_inline">{$lang->cmd_login}</label>
<br />
<input type="number" name="insert_document" value="{$config->insert_document}" id="insert_document" style="width:50px;text-align:right" /> :
<input type="number" name="insert_document" value="{$config->insert_document}" id="insert_document" style="text-align:right" /> :
<label for="insert_document" class="x_inline">{$lang->point_insert_document}</label>
<br />
<input type="number" name="insert_comment" value="{$config->insert_comment}" id="insert_comment" style="width:50px;text-align:right" /> :
<input type="number" name="insert_comment" value="{$config->insert_comment}" id="insert_comment" style="text-align:right" /> :
<label for="insert_comment" class="x_inline">{$lang->point_insert_comment}</label>
<br />
<input type="number" name="upload_file" value="{$config->upload_file}" id="upload_file" style="width:50px;text-align:right" /> :
<input type="number" name="upload_file" value="{$config->upload_file}" id="upload_file" style="text-align:right" /> :
<label for="upload_file" class="x_inline">{$lang->point_upload_file}</label>
<br />
<input type="number" name="download_file" value="{$config->download_file}" id="download_file" style="width:50px;text-align:right" /> :
<input type="number" name="download_file" value="{$config->download_file}" id="download_file" style="text-align:right" /> :
<label for="download_file" class="x_inline">{$lang->point_download_file}</label>
<br />
<input type="number" name="read_document" value="{$config->read_document}" id="read_document" style="width:50px;text-align:right" /> :
<input type="number" name="read_document" value="{$config->read_document}" id="read_document" style="text-align:right" /> :
<label for="read_document" class="x_inline">{$lang->point_read_document}</label>
<br />
<input type="number" name="voted" value="{$config->voted}" style="width:50px;text-align:right" id="voted" /> :
<input type="number" name="voted" value="{$config->voted}" style="text-align:right" id="voted" /> :
<label for="voted" class="x_inline">{$lang->point_voted}</label>
<br />
<input type="number" name="blamed" value="{$config->blamed}" id="blamed" style="width:50px;text-align:right" /> :
<input type="number" name="blamed" value="{$config->blamed}" id="blamed" style="text-align:right" /> :
<label for="blamed" class="x_inline">{$lang->point_blamed}</label>
</div>
</div>

View file

@ -1,6 +1,6 @@
<load target="js/point_admin.js" usecdn="true" />
<div class="x_page-header">
<h1>{$lang->point} {$lang->cmd_management} <a class="x_icon-question-sign" href="./help/index.html#UMAN_member_point" target="_blank">{$lang->help}</a></h1>
<h1>{$lang->point} {$lang->cmd_management} <a class="x_icon-question-sign" href="./admin/help/index.html#UMAN_member_point" target="_blank">{$lang->help}</a></h1>
</div>
<ul class="x_nav x_nav-tabs" cond="$module=='admin'">
<li class="x_active"|cond="$act=='dispPointAdminConfig'"><a href="{getUrl('act','dispPointAdminConfig')}">{$lang->cmd_point_config}</a></li>

View file

@ -1,6 +1,6 @@
<include target="header.html" />
<load target="js/point_admin.js" usecdn="true" />
<div cond="$XE_VALIDATOR_MESSAGE" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/point/tpl/member_list/1'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
<p>{$XE_VALIDATOR_MESSAGE}</p>
</div>
<p>{$lang->about_point_module} {$lang->point_update_desc}</p>
@ -26,7 +26,7 @@
<option loop="$lang->search_target_list => $key,$val" value="{$key}" selected="selected"|cond="$search_target==$key">{$val}</option>
</select>
<span class="x_input-append">
<input type="search" required name="search_keyword" value="{htmlspecialchars($search_keyword)}" title="{$lang->cmd_search}" style="width:100px" />
<input type="search" required name="search_keyword" required value="{htmlspecialchars($search_keyword)}" title="{$lang->cmd_search}" style="width:100px" />
<button type="submit" class="x_btn x_btn-inverse">{$lang->cmd_search}</button>
<a href="{getUrl('','module',$module,'act',$act)}" class="x_btn">{$lang->cmd_cancel}</a>
</span>
@ -52,6 +52,7 @@
<form action="./" method="get" style="margin:0">
<input type="hidden" name="module" value="point" />
<input type="hidden" name="member_srl" value="{$val->member_srl}" />
<input type="hidden" name="xe_validator_id" value="modules/point/tpl/member_list/1" />
<input type="text" name="orgpoint" value="{$val->point}" disabled="disabled" style="width:40px;text-align:right" />
-&gt;
<span class="x_input-append">
@ -127,7 +128,7 @@
<option loop="$lang->search_target_list => $key,$val" value="{$key}" selected="selected"|cond="$search_target==$key">{$val}</option>
</select>
<span class="x_input-append">
<input type="search" name="search_keyword" value="{htmlspecialchars($search_keyword)}" title="{$lang->cmd_search}" style="width:100px" />
<input type="search" name="search_keyword" required value="{htmlspecialchars($search_keyword)}" title="{$lang->cmd_search}" style="width:100px" />
<button type="submit" class="x_btn x_btn-inverse">{$lang->cmd_search}</button>
<a href="{getUrl('','module',$module,'act',$act)}" class="x_btn">{$lang->cmd_cancel}</a>
</span>
@ -140,5 +141,6 @@
<input type="hidden" name="act" value="procPointAdminUpdatePoint" />
<input type="hidden" id="update_member_srl" name="member_srl" value="" />
<input type="hidden" id="update_point" name="point" />
<input type="hidden" name="xe_validator_id" value="modules/point/tpl/member_list/1" />
</form>

View file

@ -1,11 +1,12 @@
<!--#include("./header.html")-->
<div cond="$XE_VALIDATOR_MESSAGE" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/point/tpl/module_cofig/1'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
<p>{$XE_VALIDATOR_MESSAGE}</p>
</div>
<p>{$lang->about_module_point}</p>
<form action="./" method="post" id="fo_point">
<input type="hidden" name="module" value="point" />
<input type="hidden" name="act" value="procPointAdminInsertModuleConfig" />
<input type="hidden" name="xe_validator_id" value="modules/point/tpl/module_cofig/1" />
<table class="x_table x_table-striped x_table-hover">
<thead>
<tr>
@ -22,13 +23,13 @@
<tbody>
<tr loop="$mid_list => $key,$val">
<th scope="row">{$val->browser_title}({$val->mid})</th>
<td class="nowr"><input type="number" style="width:40px;text-align:right" name="insert_document_{$val->module_srl}" value="{$module_config[$val->module_srl]['insert_document']}" title="{$config->point_name}" /> {$config->point_name}</td>
<td class="nowr"><input type="number" style="width:40px;text-align:right" name="insert_comment_{$val->module_srl}" value="{$module_config[$val->module_srl]['insert_comment']}" title="{$config->point_name}" /> {$config->point_name}</td>
<td class="nowr"><input type="number" style="width:40px;text-align:right" name="upload_file_{$val->module_srl}" value="{$module_config[$val->module_srl]['upload_file']}" title="{$config->point_name}" /> {$config->point_name}</td>
<td class="nowr"><input type="number" style="width:40px;text-align:right" name="download_file_{$val->module_srl}" value="{$module_config[$val->module_srl]['download_file']}" title="{$config->point_name}" /> {$config->point_name}</td>
<td class="nowr"><input type="number" style="width:40px;text-align:right" name="read_document_{$val->module_srl}" value="{$module_config[$val->module_srl]['read_document']}" title="{$config->point_name}" /> {$config->point_name}</td>
<td class="nowr"><input type="number" style="width:40px;text-align:right" name="voted_{$val->module_srl}" value="{$module_config[$val->module_srl]['voted']}" title="{$config->point_name}" /> {$config->point_name}</td>
<td class="nowr"><input type="number" style="width:40px;text-align:right" name="blamed_{$val->module_srl}" value="{$module_config[$val->module_srl]['blamed']}" title="{$config->point_name}" /> {$config->point_name}</td>
<td class="nowr"><input type="number" style="width:40px;text-align:right" name="insert_document[{$val->module_srl}]" value="{$module_config[$val->module_srl]['insert_document']}" title="{$config->point_name}" /> {$config->point_name}</td>
<td class="nowr"><input type="number" style="width:40px;text-align:right" name="insert_comment[{$val->module_srl}]" value="{$module_config[$val->module_srl]['insert_comment']}" title="{$config->point_name}" /> {$config->point_name}</td>
<td class="nowr"><input type="number" style="width:40px;text-align:right" name="upload_file[{$val->module_srl}]" value="{$module_config[$val->module_srl]['upload_file']}" title="{$config->point_name}" /> {$config->point_name}</td>
<td class="nowr"><input type="number" style="width:40px;text-align:right" name="download_file[{$val->module_srl}]" value="{$module_config[$val->module_srl]['download_file']}" title="{$config->point_name}" /> {$config->point_name}</td>
<td class="nowr"><input type="number" style="width:40px;text-align:right" name="read_document[{$val->module_srl}]" value="{$module_config[$val->module_srl]['read_document']}" title="{$config->point_name}" /> {$config->point_name}</td>
<td class="nowr"><input type="number" style="width:40px;text-align:right" name="voted[{$val->module_srl}]" value="{$module_config[$val->module_srl]['voted']}" title="{$config->point_name}" /> {$config->point_name}</td>
<td class="nowr"><input type="number" style="width:40px;text-align:right" name="blamed[{$val->module_srl}]" value="{$module_config[$val->module_srl]['blamed']}" title="{$config->point_name}" /> {$config->point_name}</td>
</tr>
</tbody>
</table>

View file

@ -11,49 +11,50 @@
<div class="x_control-group">
<label for="insert_document" class="x_control-label">{$lang->point_insert_document}</label>
<div class="x_controls">
<input type="number" name="insert_document" id="insert_document" value="{$module_config['insert_document']}" style="width:40px" /> {$module_config['point_name']}
<input type="number" name="insert_document" id="insert_document" value="{$module_config['insert_document']}" /> {$module_config['point_name']}
</div>
</div>
<div class="x_control-group">
<label for="insert_comment" class="x_control-label">{$lang->point_insert_comment}</label>
<div class="x_controls">
<input type="number" name="insert_comment" id="insert_comment" value="{$module_config['insert_comment']}" style="width:40px" /> {$module_config['point_name']}
<input type="number" name="insert_comment" id="insert_comment" value="{$module_config['insert_comment']}" /> {$module_config['point_name']}
</div>
</div>
<div class="x_control-group">
<label for="upload_file" class="x_control-label">{$lang->point_upload_file}</label>
<div class="x_controls">
<input type="number" name="upload_file" id="upload_file" value="{$module_config['upload_file']}" style="width:40px" /> {$module_config['point_name']}
<input type="number" name="upload_file" id="upload_file" value="{$module_config['upload_file']}" /> {$module_config['point_name']}
</div>
</div>
<div class="x_control-group">
<label for="download_file" class="x_control-label">{$lang->point_download_file}</label>
<div class="x_controls">
<input type="number" name="download_file" id="download_file" value="{$module_config['download_file']}" style="width:40px" /> {$module_config['point_name']}
<input type="number" name="download_file" id="download_file" value="{$module_config['download_file']}" /> {$module_config['point_name']}
</div>
</div>
<div class="x_control-group">
<label for="read_document" class="x_control-label">{$lang->point_read_document}</label>
<div class="x_controls">
<input type="number" name="read_document" id="read_document" value="{$module_config['read_document']}" style="width:40px" /> {$module_config['point_name']}
<input type="number" name="read_document" id="read_document" value="{$module_config['read_document']}" /> {$module_config['point_name']}
</div>
</div>
<div class="x_control-group">
<label for="voted" class="x_control-label">{$lang->point_voted}</label>
<div class="x_controls">
<input type="number" name="voted" id="voted" value="{$module_config['voted']}" style="width:40px" /> {$module_config['point_name']}
<input type="number" name="voted" id="voted" value="{$module_config['voted']}" /> {$module_config['point_name']}
</div>
</div>
<div class="x_control-group">
<label for="blamed" class="x_control-label">{$lang->point_blamed}</label>
<div class="x_controls">
<input type="number" name="blamed" id="blamed" value="{$module_config['blamed']}" style="width:40px" /> {$module_config['point_name']}
<input type="number" name="blamed" id="blamed" value="{$module_config['blamed']}" /> {$module_config['point_name']}
</div>
</div>
<div class="x_clearfix btnArea">
<button class="x_btn x_pull-left" type="button" onclick="doPointReset('{$module_config['module_srl']?$module_config['module_srl']:$module_srls}')">{$lang->cmd_reset}</button>
<input class="x_btn x_btn-primary x_pull-right" type="submit" value="{$lang->cmd_save}">
<button class="x_btn x_btn-warning x_pull-left" type="button" onclick="doPointReset('{$module_config['module_srl']?$module_config['module_srl']:$module_srls}')">{$lang->cmd_reset}</button>
<span class="x_pull-right">
<input class="x_btn x_btn-primary" type="submit" value="{$lang->cmd_save}">
</span>
</div>
</form>
</section>