/*+********************************************************************************
 * The contents of this file are subject to the vtiger CRM Public License Version 1.0
 * ("License"); You may not use this file except in compliance with the License
 * The Original Code is:  vtiger CRM Open Source
 * The Initial Developer of the Original Code is vtiger.
 * Portions created by vtiger are Copyright (C) vtiger.
 * All Rights Reserved.
 ********************************************************************************/
require_once 'include/database/PearDatabase.php';
require_once 'include/ComboUtil.php';
$fld_module = vtlib_purify($_REQUEST["fld_module"]);
$tableName = vtlib_purify($_REQUEST["table_name"]);
$fldPickList = vtlib_purify($_REQUEST['listarea']);
$roleid = vtlib_purify($_REQUEST['roleid']);
//changed by dingjianting on 2006-10-1 for picklist editor
$fldPickList = utf8RawUrlDecode($fldPickList);
$uitype = vtlib_purify($_REQUEST['uitype']);
global $adb, $default_charset;
$sql = "select picklistid from vtiger_picklist where name=?";
$picklistid = $adb->query_result($adb->pquery($sql, array($tableName)), 0, 'picklistid');
//Deleting the already existing values
$qry = "select roleid,picklistvalueid from vtiger_role2picklist left join vtiger_{$tableName} on vtiger_{$tableName}.picklist_valueid=vtiger_role2picklist.picklistvalueid where roleid=? and picklistid=? and presence=1";
$res = $adb->pquery($qry, array($roleid, $picklistid));
$num_row = $adb->num_rows($res);
for ($s = 0; $s < $num_row; $s++) {
    $valid = $adb->query_result($res, $s, 'picklistvalueid');
    $sql = "delete from vtiger_role2picklist where roleid=? and picklistvalueid=?";
    $adb->pquery($sql, array($roleid, $valid));
}
$pickArray = explode("\n", $fldPickList);
$count = count($pickArray);
Пример #2
0
<?php

require_once 'include/logging.php';
require_once 'modules/Memdays/Memdays.php';
require_once 'include/database/PearDatabase.php';
require_once 'modules/Memdays/ModuleConfig.php';
global $adb;
$local_log =& LoggerManager::getLogger('MemdaysAjax');
$ajaxaction = $_REQUEST["ajxaction"];
if ($ajaxaction == "DETAILVIEW") {
    $crmid = $_REQUEST["recordid"];
    $tablename = $_REQUEST["tableName"];
    $fieldname = $_REQUEST["fldName"];
    $fieldvalue = utf8RawUrlDecode($_REQUEST["fieldValue"]);
    if ($crmid != "") {
        if ((!isset($is_disable_approve) || isset($is_disable_approve) && !$is_disable_approve) && (isset($module_enable_approve) && $module_enable_approve)) {
            $sql = "select approved from ec_memdays where deleted=0 and memdaysid='" . $crmid . "'";
            $result = $adb->query($sql);
            $approved = $adb->query_result($result, 0, "approved");
            if ($approved == 1) {
                echo ":#:FAILURE";
                die;
            }
        }
        $modObj = new Memdays();
        $modObj->retrieve_entity_info($crmid, "Memdays");
        $modObj->column_fields[$fieldname] = $fieldvalue;
        $modObj->id = $crmid;
        $modObj->mode = "edit";
        $modObj->save("Memdays");
        if ($modObj->id != "") {
Пример #3
0
/*+**********************************************************************************
 * The contents of this file are subject to the vtiger CRM Public License Version 1.0
 * ("License"); You may not use this file except in compliance with the License
 * The Original Code is:  vtiger CRM Open Source
 * The Initial Developer of the Original Code is vtiger.
 * Portions created by vtiger are Copyright (C) vtiger.
 * All Rights Reserved.
 ************************************************************************************/
global $currentModule;
$modObj = CRMEntity::getInstance($currentModule);
$ajaxaction = $_REQUEST["ajxaction"];
if ($ajaxaction == 'DETAILVIEW') {
    $crmid = $_REQUEST['recordid'];
    $tablename = $_REQUEST['tableName'];
    $fieldname = $_REQUEST['fldName'];
    $fieldvalue = utf8RawUrlDecode($_REQUEST['fieldValue']);
    if ($crmid != '') {
        $modObj->retrieve_entity_info($crmid, $currentModule);
        //Added to avoid the comment save, when we edit other fields through ajax edit
        if ($fieldname != 'comments') {
            $modObj->column_fields['comments'] = '';
        }
        $modObj->column_fields[$fieldname] = $fieldvalue;
        $modObj->id = $crmid;
        $modObj->mode = 'edit';
        list($saveerror, $errormessage, $error_action, $returnvalues) = $modObj->preSaveCheck($_REQUEST);
        if ($saveerror) {
            // there is an error so we report error
            echo ':#:ERR' . $errormessage;
        } else {
            $modObj->save($currentModule);
Пример #4
0
$allowedTypesInt = [ITEM_VALUE_TYPE_UINT64 => 1];
$functions = ['abschange[<]' => ['description' => _('Absolute difference between last and previous value is < N'), 'allowed_types' => $allowedTypesAny], 'abschange[>]' => ['description' => _('Absolute difference between last and previous value is > N'), 'allowed_types' => $allowedTypesAny], 'abschange[=]' => ['description' => _('Absolute difference between last and previous value is = N'), 'allowed_types' => $allowedTypesAny], 'abschange[<>]' => ['description' => _('Absolute difference between last and previous value is NOT N'), 'allowed_types' => $allowedTypesAny], 'avg[<]' => ['description' => _('Average value of a period T is < N'), 'params' => $param1SecCount, 'allowed_types' => $allowedTypesNumeric], 'avg[>]' => ['description' => _('Average value of a period T is > N'), 'params' => $param1SecCount, 'allowed_types' => $allowedTypesNumeric], 'avg[=]' => ['description' => _('Average value of a period T is = N'), 'params' => $param1SecCount, 'allowed_types' => $allowedTypesNumeric], 'avg[<>]' => ['description' => _('Average value of a period T is NOT N'), 'params' => $param1SecCount, 'allowed_types' => $allowedTypesNumeric], 'delta[<]' => ['description' => _('Difference between MAX and MIN value of a period T is < N'), 'params' => $param1SecCount, 'allowed_types' => $allowedTypesNumeric], 'delta[>]' => ['description' => _('Difference between MAX and MIN value of a period T is > N'), 'params' => $param1SecCount, 'allowed_types' => $allowedTypesNumeric], 'delta[=]' => ['description' => _('Difference between MAX and MIN value of a period T is = N'), 'params' => $param1SecCount, 'allowed_types' => $allowedTypesNumeric], 'delta[<>]' => ['description' => _('Difference between MAX and MIN value of a period T is NOT N'), 'params' => $param1SecCount, 'allowed_types' => $allowedTypesNumeric], 'change[<]' => ['description' => _('Difference between last and previous value is < N'), 'allowed_types' => $allowedTypesAny], 'change[>]' => ['description' => _('Difference between last and previous value is > N'), 'allowed_types' => $allowedTypesAny], 'change[=]' => ['description' => _('Difference between last and previous value is = N'), 'allowed_types' => $allowedTypesAny], 'change[<>]' => ['description' => _('Difference between last and previous value is NOT N'), 'allowed_types' => $allowedTypesAny], 'count[<]' => ['description' => _('Number of successfully retrieved values V (which fulfill operator O) for period T is < N'), 'params' => $param3SecVal, 'allowed_types' => $allowedTypesAny], 'count[>]' => ['description' => _('Number of successfully retrieved values V (which fulfill operator O) for period T is > N'), 'params' => $param3SecVal, 'allowed_types' => $allowedTypesAny], 'count[=]' => ['description' => _('Number of successfully retrieved values V (which fulfill operator O) for period T is = N'), 'params' => $param3SecVal, 'allowed_types' => $allowedTypesAny], 'count[<>]' => ['description' => _('Number of successfully retrieved values V (which fulfill operator O) for period T is NOT N'), 'params' => $param3SecVal, 'allowed_types' => $allowedTypesAny], 'diff[=]' => ['description' => _('Difference between last and preceding values, then N = 1, 0 - otherwise'), 'allowed_types' => $allowedTypesAny], 'diff[<>]' => ['description' => _('Difference between last and preceding values, then N NOT 1, 0 - otherwise'), 'allowed_types' => $allowedTypesAny], 'last[<]' => ['description' => _('Last (most recent) T value is < N'), 'params' => $param1SecCount, 'allowed_types' => $allowedTypesAny], 'last[>]' => ['description' => _('Last (most recent) T value is > N'), 'params' => $param1SecCount, 'allowed_types' => $allowedTypesAny], 'last[=]' => ['description' => _('Last (most recent) T value is = N'), 'params' => $param1SecCount, 'allowed_types' => $allowedTypesAny], 'last[<>]' => ['description' => _('Last (most recent) T value is NOT N'), 'params' => $param1SecCount, 'allowed_types' => $allowedTypesAny], 'max[<]' => ['description' => _('Maximum value for period T is < N'), 'params' => $param1SecCount, 'allowed_types' => $allowedTypesNumeric], 'max[>]' => ['description' => _('Maximum value for period T is > N'), 'params' => $param1SecCount, 'allowed_types' => $allowedTypesNumeric], 'max[=]' => ['description' => _('Maximum value for period T is = N'), 'params' => $param1SecCount, 'allowed_types' => $allowedTypesNumeric], 'max[<>]' => ['description' => _('Maximum value for period T is NOT N'), 'params' => $param1SecCount, 'allowed_types' => $allowedTypesNumeric], 'min[<]' => ['description' => _('Minimum value for period T is < N'), 'params' => $param1SecCount, 'allowed_types' => $allowedTypesNumeric], 'min[>]' => ['description' => _('Minimum value for period T is > N'), 'params' => $param1SecCount, 'allowed_types' => $allowedTypesNumeric], 'min[=]' => ['description' => _('Minimum value for period T is = N'), 'params' => $param1SecCount, 'allowed_types' => $allowedTypesNumeric], 'min[<>]' => ['description' => _('Minimum value for period T is NOT N'), 'params' => $param1SecCount, 'allowed_types' => $allowedTypesNumeric], 'percentile[<]' => ['description' => _('Percentile P of a period T is < N'), 'params' => $param3SecPercent, 'allowed_types' => $allowedTypesNumeric], 'percentile[>]' => ['description' => _('Percentile P of a period T is > N'), 'params' => $param3SecPercent, 'allowed_types' => $allowedTypesNumeric], 'percentile[=]' => ['description' => _('Percentile P of a period T is = N'), 'params' => $param3SecPercent, 'allowed_types' => $allowedTypesNumeric], 'percentile[<>]' => ['description' => _('Percentile P of a period T is NOT N'), 'params' => $param3SecPercent, 'allowed_types' => $allowedTypesNumeric], 'prev[<]' => ['description' => _('Previous value is < N'), 'allowed_types' => $allowedTypesAny], 'prev[>]' => ['description' => _('Previous value is > N'), 'allowed_types' => $allowedTypesAny], 'prev[=]' => ['description' => _('Previous value is = N'), 'allowed_types' => $allowedTypesAny], 'prev[<>]' => ['description' => _('Previous value is NOT N'), 'allowed_types' => $allowedTypesAny], 'str[=]' => ['description' => _('Find string V in last (most recent) value. N = 1 - if found, 0 - otherwise'), 'params' => $param2SecCount, 'allowed_types' => $allowedTypesAny], 'str[<>]' => ['description' => _('Find string V in last (most recent) value. N NOT 1 - if found, 0 - otherwise'), 'params' => $param2SecCount, 'allowed_types' => $allowedTypesAny], 'strlen[<]' => ['description' => _('Length of last (most recent) T value in characters is < N'), 'params' => $param1SecCount, 'allowed_types' => $allowedTypesStr], 'strlen[>]' => ['description' => _('Length of last (most recent) T value in characters is > N'), 'params' => $param1SecCount, 'allowed_types' => $allowedTypesStr], 'strlen[=]' => ['description' => _('Length of last (most recent) T value in characters is = N'), 'params' => $param1SecCount, 'allowed_types' => $allowedTypesStr], 'strlen[<>]' => ['description' => _('Length of last (most recent) T value in characters is NOT N'), 'params' => $param1SecCount, 'allowed_types' => $allowedTypesStr], 'sum[<]' => ['description' => _('Sum of values of a period T is < N'), 'params' => $param1SecCount, 'allowed_types' => $allowedTypesNumeric], 'sum[>]' => ['description' => _('Sum of values of a period T is > N'), 'params' => $param1SecCount, 'allowed_types' => $allowedTypesNumeric], 'sum[=]' => ['description' => _('Sum of values of a period T is = N'), 'params' => $param1SecCount, 'allowed_types' => $allowedTypesNumeric], 'sum[<>]' => ['description' => _('Sum of values of a period T is NOT N'), 'params' => $param1SecCount, 'allowed_types' => $allowedTypesNumeric], 'date[<]' => ['description' => _('Current date is < N'), 'allowed_types' => $allowedTypesAny], 'date[>]' => ['description' => _('Current date is > N'), 'allowed_types' => $allowedTypesAny], 'date[=]' => ['description' => _('Current date is = N'), 'allowed_types' => $allowedTypesAny], 'date[<>]' => ['description' => _('Current date is NOT N'), 'allowed_types' => $allowedTypesAny], 'dayofweek[<]' => ['description' => _('Day of week is < N'), 'allowed_types' => $allowedTypesAny], 'dayofweek[>]' => ['description' => _('Day of week is > N'), 'allowed_types' => $allowedTypesAny], 'dayofweek[=]' => ['description' => _('Day of week is = N'), 'allowed_types' => $allowedTypesAny], 'dayofweek[<>]' => ['description' => _('Day of week is NOT N'), 'allowed_types' => $allowedTypesAny], 'dayofmonth[<]' => ['description' => _('Day of month is < N'), 'allowed_types' => $allowedTypesAny], 'dayofmonth[>]' => ['description' => _('Day of month is > N'), 'allowed_types' => $allowedTypesAny], 'dayofmonth[=]' => ['description' => _('Day of month is = N'), 'allowed_types' => $allowedTypesAny], 'dayofmonth[<>]' => ['description' => _('Day of month is NOT N'), 'allowed_types' => $allowedTypesAny], 'fuzzytime[=]' => ['description' => _('Difference between item timestamp value and Zabbix server timestamp is over T seconds, then N = 0, 1 - otherwise'), 'params' => $param1Sec, 'allowed_types' => $allowedTypesAny], 'fuzzytime[<>]' => ['description' => _('Difference between item timestamp value and Zabbix server timestamp is over T seconds, then N NOT 0, 1 - otherwise'), 'params' => $param1Sec, 'allowed_types' => $allowedTypesAny], 'regexp[=]' => ['description' => _('Regular expression V matching last value in period T, then N = 1, 0 - otherwise'), 'params' => $param2SecCount, 'allowed_types' => $allowedTypesAny], 'regexp[<>]' => ['description' => _('Regular expression V matching last value in period T, then N NOT 1, 0 - otherwise'), 'params' => $param2SecCount, 'allowed_types' => $allowedTypesAny], 'iregexp[=]' => ['description' => _('Regular expression V matching last value in period T, then N = 1, 0 - otherwise (non case-sensitive)'), 'params' => $param2SecCount, 'allowed_types' => $allowedTypesAny], 'iregexp[<>]' => ['description' => _('Regular expression V matching last value in period T, then N NOT 1, 0 - otherwise (non case-sensitive)'), 'params' => $param2SecCount, 'allowed_types' => $allowedTypesAny], 'logeventid[=]' => ['description' => _('Event ID of last log entry matching regular expression T, then N = 1, 0 - otherwise'), 'params' => $param1Str, 'allowed_types' => $allowedTypesLog], 'logeventid[<>]' => ['description' => _('Event ID of last log entry matching regular expression T, then N NOT 1, 0 - otherwise'), 'params' => $param1Str, 'allowed_types' => $allowedTypesLog], 'logseverity[<]' => ['description' => _('Log severity of the last log entry is < N'), 'allowed_types' => $allowedTypesLog], 'logseverity[>]' => ['description' => _('Log severity of the last log entry is > N'), 'allowed_types' => $allowedTypesLog], 'logseverity[=]' => ['description' => _('Log severity of the last log entry is = N'), 'allowed_types' => $allowedTypesLog], 'logseverity[<>]' => ['description' => _('Log severity of the last log entry is NOT N'), 'allowed_types' => $allowedTypesLog], 'logsource[=]' => ['description' => _('Log source of the last log entry matching parameter T, then N = 1, 0 - otherwise'), 'params' => $param1Str, 'allowed_types' => $allowedTypesLog], 'logsource[<>]' => ['description' => _('Log source of the last log entry matching parameter T, then N NOT 1, 0 - otherwise'), 'params' => $param1Str, 'allowed_types' => $allowedTypesLog], 'now[<]' => ['description' => _('Number of seconds since the Epoch is < N'), 'allowed_types' => $allowedTypesAny], 'now[>]' => ['description' => _('Number of seconds since the Epoch is > N'), 'allowed_types' => $allowedTypesAny], 'now[=]' => ['description' => _('Number of seconds since the Epoch is = N'), 'allowed_types' => $allowedTypesAny], 'now[<>]' => ['description' => _('Number of seconds since the Epoch is NOT N'), 'allowed_types' => $allowedTypesAny], 'time[<]' => ['description' => _('Current time is < N'), 'allowed_types' => $allowedTypesAny], 'time[>]' => ['description' => _('Current time is > N'), 'allowed_types' => $allowedTypesAny], 'time[=]' => ['description' => _('Current time is = N'), 'allowed_types' => $allowedTypesAny], 'time[<>]' => ['description' => _('Current time is NOT N'), 'allowed_types' => $allowedTypesAny], 'nodata[=]' => ['description' => _('No data received during period of time T, then N = 1, 0 - otherwise'), 'params' => $param1Sec, 'allowed_types' => $allowedTypesAny], 'nodata[<>]' => ['description' => _('No data received during period of time T, then N NOT 1, 0 - otherwise'), 'params' => $param1Sec, 'allowed_types' => $allowedTypesAny], 'band[=]' => ['description' => _('Bitwise AND of last (most recent) T value and mask is = N'), 'params' => $paramSecIntCount, 'allowed_types' => $allowedTypesInt], 'band[<>]' => ['description' => _('Bitwise AND of last (most recent) T value and mask is NOT N'), 'params' => $paramSecIntCount, 'allowed_types' => $allowedTypesInt], 'forecast[<]' => ['description' => _('Forecast for next t seconds based on period T is < N'), 'params' => $paramForecast, 'allowed_types' => $allowedTypesNumeric], 'forecast[>]' => ['description' => _('Forecast for next t seconds based on period T is > N'), 'params' => $paramForecast, 'allowed_types' => $allowedTypesNumeric], 'forecast[=]' => ['description' => _('Forecast for next t seconds based on period T is = N'), 'params' => $paramForecast, 'allowed_types' => $allowedTypesNumeric], 'forecast[<>]' => ['description' => _('Forecast for next t seconds based on period T is NOT N'), 'params' => $paramForecast, 'allowed_types' => $allowedTypesNumeric], 'timeleft[<]' => ['description' => _('Time to reach threshold estimated based on period T is < N'), 'params' => $paramTimeleft, 'allowed_types' => $allowedTypesNumeric], 'timeleft[>]' => ['description' => _('Time to reach threshold estimated based on period T is > N'), 'params' => $paramTimeleft, 'allowed_types' => $allowedTypesNumeric], 'timeleft[=]' => ['description' => _('Time to reach threshold estimated based on period T is = N'), 'params' => $paramTimeleft, 'allowed_types' => $allowedTypesNumeric], 'timeleft[<>]' => ['description' => _('Time to reach threshold estimated based on period T is NOT N'), 'params' => $paramTimeleft, 'allowed_types' => $allowedTypesNumeric]];
order_result($functions, 'description');
//	VAR		TYPE	OPTIONAL FLAGS	VALIDATION	EXCEPTION
$fields = ['dstfrm' => [T_ZBX_STR, O_MAND, P_SYS, NOT_EMPTY, null], 'dstfld1' => [T_ZBX_STR, O_MAND, P_SYS, NOT_EMPTY, null], 'expression' => [T_ZBX_STR, O_OPT, null, null, null], 'itemid' => [T_ZBX_INT, O_OPT, null, null, 'isset({insert})'], 'parent_discoveryid' => [T_ZBX_INT, O_OPT, null, null, null], 'expr_type' => [T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({insert})'], 'params' => [T_ZBX_STR, O_OPT, null, 0, null], 'paramtype' => [T_ZBX_INT, O_OPT, null, IN(PARAM_TYPE_TIME . ',' . PARAM_TYPE_COUNTS), 'isset({insert})'], 'value' => [T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({insert})'], 'insert' => [T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null], 'cancel' => [T_ZBX_STR, O_OPT, P_SYS, null, null]];
check_fields($fields);
$dstfrm = getRequest('dstfrm', 0);
$dstfld1 = getRequest('dstfld1', '');
$itemId = getRequest('itemid', 0);
$value = getRequest('value', 0);
$params = getRequest('params', []);
$paramType = getRequest('paramtype');
$exprType = getRequest('expr_type', 'last[=]');
// opening the popup when editing an expression in the trigger constructor
if (isset($_REQUEST['expression']) && $_REQUEST['dstfld1'] == 'expr_temp') {
    $_REQUEST['expression'] = utf8RawUrlDecode($_REQUEST['expression']);
    $expressionData = new CTriggerExpression();
    $result = $expressionData->parse(getRequest('expression'));
    if ($result) {
        // only one item function macro is supported in an expression
        $functionMacroTokens = $result->getTokensByType(CTriggerExpressionParserResult::TOKEN_TYPE_FUNCTION_MACRO);
        if (count($functionMacroTokens) == 1) {
            $functionMacroToken = $functionMacroTokens[0];
            // function
            $function = $functionMacroToken['data']['functionName'];
            // determine param type
            $params = $functionMacroToken['data']['functionParams'];
            $paramNumber = in_array($function, ['regexp', 'iregexp', 'str']) ? 1 : 0;
            if (isset($params[$paramNumber][0]) && $params[$paramNumber][0] == '#') {
                $paramType = PARAM_TYPE_COUNTS;
                $params[$paramNumber] = substr($params[$paramNumber], 1);
 * The Initial Developer of the Original Code is vtiger.
 * Portions created by vtiger are Copyright (C) vtiger.
 * All Rights Reserved.
 ********************************************************************************/
require_once 'include/logging.php';
require_once 'include/database/PearDatabase.php';
global $adb;
$local_log =& LoggerManager::getLogger('VendorsAjax');
global $currentModule;
$modObj = CRMEntity::getInstance($currentModule);
$ajaxaction = $_REQUEST["ajxaction"];
if ($ajaxaction == "DETAILVIEW") {
    $crmid = vtlib_purify($_REQUEST["recordid"]);
    $tablename = vtlib_purify($_REQUEST["tableName"]);
    $fieldname = vtlib_purify($_REQUEST["fldName"]);
    $fieldvalue = utf8RawUrlDecode(vtlib_purify($_REQUEST["fieldValue"]));
    if ($crmid != "") {
        $modObj->retrieve_entity_info($crmid, "Vendors");
        $modObj->column_fields[$fieldname] = $fieldvalue;
        $modObj->id = $crmid;
        $modObj->mode = "edit";
        $modObj->save("Vendors");
        if ($modObj->id != "") {
            echo ":#:SUCCESS";
        } else {
            echo ":#:FAILURE";
        }
    } else {
        echo ":#:FAILURE";
    }
} elseif ($ajaxaction == "LOADRELATEDLIST" || $ajaxaction == "DISABLEMODULE") {
Пример #6
0
/*+*******************************************************************************
 * The contents of this file are subject to the vtiger CRM Public License Version 1.0
 * ("License"); You may not use this file except in compliance with the License
 * The Original Code is:  vtiger CRM Open Source
 * The Initial Developer of the Original Code is vtiger.
 * Portions created by vtiger are Copyright (C) vtiger.
 * All Rights Reserved.
 ********************************************************************************/
require_once 'modules/Documents/Documents.php';
require_once 'include/logging.php';
require_once 'include/database/PearDatabase.php';
global $adb;
$local_log =& LoggerManager::getLogger('index');
$folderid = $_REQUEST['record'];
$foldername = utf8RawUrlDecode($_REQUEST["foldername"]);
$folderdesc = utf8RawUrlDecode($_REQUEST["folderdesc"]);
if (isset($_REQUEST['savemode']) && $_REQUEST['savemode'] == 'Save') {
    if ($folderid == "") {
        $params = array();
        $sqlfid = "select max(folderid) from vtiger_attachmentsfolder";
        $fid = $adb->query_result($adb->pquery($sqlfid, $params), 0, 'max(folderid)') + 1;
        $params = array();
        $sqlseq = "select max(sequence) from vtiger_attachmentsfolder";
        $sequence = $adb->query_result($adb->pquery($sqlseq, $params), 0, 'max(sequence)') + 1;
        $params = array();
        $dbQuery = "select * from vtiger_attachmentsfolder";
        $result1 = $adb->pquery($dbQuery, array());
        $flag = 0;
        for ($i = 0; $i < $adb->num_rows($result1); $i++) {
            $dbfldrname = $adb->query_result($result1, $i, 'foldername');
            if ($dbfldrname == $foldername) {
Пример #7
0
/**
 * Decode the URL in Korean
 *
 * @param string $str The url
 * @return string
 */
function url_decode($str)
{
    return htmlspecialchars(utf8RawUrlDecode($str), null, 'UTF-8');
}
Пример #8
0
 /**
  * @brief Widget name and argument and produce a result and Return the results
  * Tags used in templateHandler $this-&gt; execute() will be replaced by the code running
  *
  * $Javascript_mode is true when editing your page by the code for handling Includes photos
  */
 function execute($widget, $args, $javascript_mode = false, $escaped = true)
 {
     // Save for debug run-time widget
     if (__DEBUG__ == 3) {
         $start = getMicroTime();
     }
     $before = microtime(true);
     // urldecode the value of args haejum
     $object_vars = get_object_vars($args);
     if (count($object_vars)) {
         foreach ($object_vars as $key => $val) {
             if (in_array($key, array('widgetbox_content', 'body', 'class', 'style', 'widget_sequence', 'widget', 'widget_padding_left', 'widget_padding_top', 'widget_padding_bottom', 'widget_padding_right', 'widgetstyle', 'document_srl'))) {
                 continue;
             }
             if ($escaped) {
                 $args->{$key} = utf8RawUrlDecode($val);
             }
         }
     }
     /**
      * Widgets widgetContent/widgetBox Wanted If you are not content
      */
     $widget_content = '';
     if ($widget != 'widgetContent' && $widget != 'widgetBox') {
         if (!is_dir(sprintf(_XE_PATH_ . 'widgets/%s/', $widget))) {
             return;
         }
         // Hold the contents of the widget parameter
         $widget_content = $this->getCache($widget, $args);
     }
     if ($widget == 'widgetBox') {
         $widgetbox_content = $args->widgetbox_content;
     }
     /**
      * Wanted specified by the administrator of the widget style
      */
     // Sometimes the wrong code, background-image: url (none) can be heard but none in this case, the request for the url so unconditionally Removed
     $style = preg_replace('/url\\((.+)(\\/?)none\\)/is', '', $args->style);
     // Find a style statement that based on the internal margin dropping pre-change
     $widget_padding_left = $args->widget_padding_left;
     $widget_padding_right = $args->widget_padding_right;
     $widget_padding_top = $args->widget_padding_top;
     $widget_padding_bottom = $args->widget_padding_bottom;
     $inner_style = sprintf("padding:%dpx %dpx %dpx %dpx !important;", $widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left);
     /**
      * Wanted widget output
      */
     $widget_content_header = '';
     $widget_content_body = '';
     $widget_content_footer = '';
     // If general call is given on page styles should return immediately dreamin '
     if (!$javascript_mode) {
         if ($args->id) {
             $args->id = ' id="' . $args->id . '" ';
         }
         switch ($widget) {
             // If a direct orthogonal addition information
             case 'widgetContent':
                 if ($args->document_srl) {
                     $oDocumentModel = getModel('document');
                     $oDocument = $oDocumentModel->getDocument($args->document_srl);
                     $body = $oDocument->getContent(false, false, false, false);
                 } else {
                     $body = base64_decode($args->body);
                 }
                 // Change the editor component
                 $oEditorController = getController('editor');
                 $body = $oEditorController->transComponent($body);
                 $widget_content_header = sprintf('<div class="xe-widget-wrapper ' . $args->css_class . '" %sstyle="%s"><div style="%s">', $args->id, $style, $inner_style);
                 $widget_content_body = $body;
                 $widget_content_footer = '</div></div>';
                 break;
                 // If the widget box; it could
             // If the widget box; it could
             case 'widgetBox':
                 $widget_content_header = sprintf('<div class="xe-widget-wrapper ' . $args->css_class . '" %sstyle="%s;"><div style="%s"><div>', $args->id, $style, $inner_style);
                 $widget_content_body = $widgetbox_content;
                 break;
                 // If the General wijetil
             // If the General wijetil
             default:
                 $widget_content_header = sprintf('<div class="xe-widget-wrapper ' . $args->css_class . '" %sstyle="%s">', $args->id, $style);
                 $widget_content_body = sprintf('<div style="*zoom:1;%s">%s</div>', $inner_style, $widget_content);
                 $widget_content_footer = '</div>';
                 break;
         }
         // Edit page is called when a widget if you add the code for handling
     } else {
         switch ($widget) {
             // If a direct orthogonal addition information
             case 'widgetContent':
                 if ($args->document_srl) {
                     $oDocumentModel = getModel('document');
                     $oDocument = $oDocumentModel->getDocument($args->document_srl);
                     $body = $oDocument->getContent(false, false, false);
                 } else {
                     $body = base64_decode($args->body);
                 }
                 // by args
                 $attribute = array();
                 if ($args) {
                     foreach ($args as $key => $val) {
                         if (in_array($key, array('class', 'style', 'widget_padding_top', 'widget_padding_right', 'widget_padding_bottom', 'widget_padding_left', 'widget', 'widgetstyle', 'document_srl'))) {
                             continue;
                         }
                         if (strpos($val, '|@|') > 0) {
                             $val = str_replace('|@|', ',', $val);
                         }
                         $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
                     }
                 }
                 $oWidgetController = getController('widget');
                 $widget_content_header = sprintf('<div class="widgetOutput ' . $args->css_class . '" widgetstyle="%s" style="%s" widget_padding_left="%s" widget_padding_right="%s" widget_padding_top="%s" widget_padding_bottom="%s" widget="widgetContent" document_srl="%d" %s>' . '<div class="widgetResize"></div>' . '<div class="widgetResizeLeft"></div>' . '<div class="widgetBorder">' . '<div style="%s">', $args->widgetstyle, $style, $args->widget_padding_left, $args->widget_padding_right, $args->widget_padding_top, $args->widget_padding_bottom, $args->document_srl, implode(' ', $attribute), $inner_style);
                 $widget_content_body = $body;
                 $widget_content_footer = sprintf('</div>' . '</div>' . '<div class="widgetContent" style="display:none;width:1px;height:1px;overflow:hidden;">%s</div>' . '</div>', base64_encode($body));
                 break;
                 // If the widget box; it could
             // If the widget box; it could
             case 'widgetBox':
                 // by args
                 $attribute = array();
                 if ($args) {
                     foreach ($args as $key => $val) {
                         if (in_array($key, array('class', 'style', 'widget_padding_top', 'widget_padding_right', 'widget_padding_bottom', 'widget_padding_left', 'widget', 'widgetstyle', 'document_srl'))) {
                             continue;
                         }
                         if (!is_numeric($val) && (!is_string($val) || strlen($val) == 0)) {
                             continue;
                         }
                         if (strpos($val, '|@|') > 0) {
                             $val = str_replace('|@|', ',', $val);
                         }
                         $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
                     }
                 }
                 $widget_content_header = sprintf('<div class="widgetOutput ' . $args->css_class . '" widgetstyle="%s" widget="widgetBox" style="%s;" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" %s >' . '<div class="widgetBoxResize"></div>' . '<div class="widgetBoxResizeLeft"></div>' . '<div class="widgetBoxBorder"><div class="nullWidget" style="%s">', $args->widgetstyle, $style, $widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left, implode(' ', $attribute), $inner_style);
                 $widget_content_body = $widgetbox_content;
                 break;
                 // If the General wijetil
             // If the General wijetil
             default:
                 // by args
                 $attribute = array();
                 if ($args) {
                     $allowed_key = array('class', 'style', 'widget_padding_top', 'widget_padding_right', 'widget_padding_bottom', 'widget_padding_left', 'widget');
                     foreach ($args as $key => $val) {
                         if (in_array($key, $allowed_key)) {
                             continue;
                         }
                         if (!is_numeric($val) && (!is_string($val) || strlen($val) == 0)) {
                             continue;
                         }
                         if (strpos($val, '|@|') > 0) {
                             $val = str_replace('|@|', ',', $val);
                         }
                         $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
                     }
                 }
                 $widget_content_header = sprintf('<div class="widgetOutput ' . $args->css_class . '" widgetstyle="%s" style="%s" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" widget="%s" %s >' . '<div class="widgetResize"></div>' . '<div class="widgetResizeLeft"></div>' . '<div class="widgetBorder">', $args->widgetstyle, $style, $widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left, $widget, implode(' ', $attribute));
                 $widget_content_body = sprintf('<div style="%s">%s</div>', $inner_style, $widget_content);
                 $widget_content_footer = '</div></div>';
                 break;
         }
     }
     // Compile the widget style.
     if ($args->widgetstyle) {
         $widget_content_body = $this->compileWidgetStyle($args->widgetstyle, $widget, $widget_content_body, $args, $javascript_mode);
     }
     $output = $widget_content_header . $widget_content_body . $widget_content_footer;
     // Debug widget creation time information added to the results
     if (__DEBUG__ == 3) {
         $GLOBALS['__widget_excute_elapsed__'] += getMicroTime() - $start;
     }
     $after = microtime(true);
     $elapsed_time = $after - $before;
     $slowlog = new stdClass();
     $slowlog->caller = "widget.execute";
     $slowlog->called = $widget;
     $slowlog->called_extension = $widget;
     writeSlowlog('widget', $elapsed_time, $slowlog);
     // Return result
     return $output;
 }
Пример #9
0
<?php

/*+********************************************************************************
 * The contents of this file are subject to the vtiger CRM Public License Version 1.0
 * ("License"); You may not use this file except in compliance with the License
 * The Original Code is:  vtiger CRM Open Source
 * The Initial Developer of the Original Code is vtiger.
 * Portions created by vtiger are Copyright (C) vtiger.
 * All Rights Reserved.
 ********************************************************************************/
require_once 'include/database/PearDatabase.php';
global $adb;
$profileid = vtlib_purify($_REQUEST['profileid']);
if ($default_charset == 'UTF-8') {
    $profilename = vtlib_purify($_REQUEST['profilename']);
    $profileDesc = vtlib_purify($_REQUEST['description']);
} else {
    $profilename = utf8RawUrlDecode($_REQUEST['profilename']);
    $profileDesc = utf8RawUrlDecode($_REQUEST['description']);
}
$query = "UPDATE vtiger_profile set profilename=?, description=? where profileid=?";
$adb->pquery($query, array($profilename, $profileDesc, $profileid));
Пример #10
0
 /**
  * process a submited msg
  */
 function submit($msg, $to = 0)
 {
     global $adb;
     //UTF-8 support added - ding
     $msg = utf8RawUrlDecode($msg);
     $msg = $this->msgParse($msg);
     $msg = htmlentities($msg);
     if (strlen($msg) == 0) {
         return;
     }
     //$sql = "insert into vtiger_chat_msg set chat_from=?, chat_to=?, born=now(), msg=?";
     $sql = "insert into vtiger_chat_msg(chat_from, chat_to, born, msg) values (?,?, now(), ?)";
     $params = array($_SESSION['chat_user'], $to, $msg);
     $res = $adb->pquery($sql, $params);
     $chat = "p";
     if ($to != 0) {
         $chat .= "v";
     }
     $res = $adb->pquery("insert into vtiger_chat_" . $chat . "chat set msg=LAST_INSERT_ID()", array());
 }
Пример #11
0
	static function editList( &$row, $lists, $fields, $option, $tabid, $paramsEditorHtml ) {
		global $_CB_database, $_CB_framework;

		HTML_comprofiler::secureAboveForm('editList');
		outputCbTemplate( 2 );
		outputCbJs( 2 );
		initToolTip(2);

		global $_CB_Backend_Title;
		$_CB_Backend_Title	=	array( 0 => array( 'cbicon-48-lists', htmlspecialchars( CBTxt::T('Community Builder List') ) . ": <small>" . ( $row->listid ? htmlspecialchars( CBTxt::T('Edit') ) . ' [ '. htmlspecialchars( getLangDefinition( $row->title ) ) .' ]' : htmlspecialchars( CBTxt::T('New') ) ) . '</small>' ) );

		if ( $row->listid && ( ! $row->published ) ) {
			echo '<div class="cbWarning">' . htmlspecialchars( CBTxt::T('List is not published') ) . '</div>' . "\n";
		}

		$notFoundFielIds		=	array();
		$fieldids				=	array();
		$col1options="";
		$col2options="";
		$col3options="";
		$col4options="";
		if($tabid >0) {
			$col1fields=explode('|*|',$row->col1fields);
			for ($i=0, $n=count( $col1fields ); $i < $n; $i++) {
				$col1field = $col1fields[$i];
				if(trim($col1field)!='' && trim($col1field)!=null) {
					$text			=	array_search($col1field,$fields);
					if ( is_string( $text ) ) {
						$col1options .= "<option value=\"".$col1field."\">". htmlspecialchars( getLangDefinition($text) ) ."\n";
						$fieldids[] = $col1field;
					} else {
						$notFoundFielIds[]	=	$col1field;
					}
				}
			}
			$col2fields=explode('|*|',$row->col2fields);
			for ($i=0, $n=count( $col2fields ); $i < $n; $i++) {
				$col2field = $col2fields[$i];
				if(trim($col2field)!='' && trim($col2field)!=null) {
					$text			=	array_search($col2field,$fields);
					if ( is_string( $text ) ) {
						$col2options .= "<option value=\"".$col2field."\">". htmlspecialchars( getLangDefinition($text) ) ."\n";
						$fieldids[]			=	$col2field;
					} else {
						$notFoundFielIds[]	=	$col2field;
					}
				}
			}
			$col3fields=explode('|*|',$row->col3fields);
			for ($i=0, $n=count( $col3fields ); $i < $n; $i++) {
				$col3field = $col3fields[$i];
				if(trim($col3field)!='' && trim($col3field)!=null) {
					$text			=	array_search($col3field,$fields);
					if ( is_string( $text ) ) {
						$col3options .= "<option value=\"".$col3field."\">". htmlspecialchars( getLangDefinition($text) ) ."\n";
						$fieldids[]			=	$col3field;
					} else {
						$notFoundFielIds[]	=	$col3field;
					}
				}
			}
			$col4fields=explode('|*|',$row->col4fields);
			for ($i=0, $n=count( $col4fields ); $i < $n; $i++) {
				$col4field = $col4fields[$i];
				if(trim($col4field)!='' && trim($col4field)!=null) {
					$text			=	array_search($col4field,$fields);
					if ( is_string( $text ) ) {
						$col4options .= "<option value=\"".$col4field."\">". htmlspecialchars( getLangDefinition($text) ) ."\n";
						$fieldids[]			=	$col4field;
					} else {
						$notFoundFielIds[]	=	$col4field;
					}
				}
			}
		}

		// this query is for listing displayable fields which are not yet in a column:
		$fieldsRemaining		=	array_diff( $fields, $fieldids );
		if ( count( $fieldsRemaining ) > 0 ) {
			$_CB_database->setQuery( "SELECT f.fieldid, f.title, f.name"
				. "\n FROM #__comprofiler_fields f"
				. "\n INNER JOIN #__comprofiler_plugin AS p ON (f.pluginid = p.id)"
				. "\n WHERE f.fieldid IN (" . implode( ',', $fieldsRemaining ) . ')'
				. "\n  AND p.published = 1"
			);
			$fields				=	$_CB_database->loadObjectList();
		} else {
			$fields				=	array();
		}

		$stripME				=	array(" ASC", " DESC","`");
		$sortsArray				=	explode( ', ', $row->sortfields );
		$SQLfunctions			=	array();
		$k						=	-1;
		foreach ( $sortsArray as $k => $v ) {
			$WhereIn			=	trim( str_replace($stripME, "", $v ) );
			if ( substr( $WhereIn, -1, 1 ) == ')') {
				$SQLfunctions[]	=	$WhereIn;
				unset( $sortsArray[$k] );
			} else {
				$sortsArray[$k]	=	$_CB_database->Quote( $WhereIn );
			}
		}
		$sortsArray[$k+1]		=	$_CB_database->Quote( 'onlinestatus' );		//TBD: refactor to field, temporarly in here...
		// this query is for listing sortable fields
		// sortsArray never empty, so this is ok:
		$_CB_database->setQuery( "SELECT f.title, f.name"
			. "\n FROM #__comprofiler_fields f"
			. "\n INNER JOIN #__comprofiler_plugin AS p ON (f.pluginid = p.id)"
			. "\n WHERE ( f.published = 1 OR f.name IN ('name','username') )"
			. "\n  AND f.name <> 'NA'"
			. "\n  AND f.tablecolumns <> ''"
			. "\n  AND p.published = 1"
			. "\n AND f.name NOT IN(" . implode( ',', $sortsArray ) . ")"
		);
/*
		$stripME = array(" ASC", " DESC","`");
		$WhereIn = str_replace($stripME, "", $row->sortfields);
		$WhereIn = "'".str_replace(", ","','",$WhereIn)."'";
		$_CB_database->setQuery( "SELECT f.title, f.name"
			. "\nFROM #__comprofiler_fields f"
			. "\nWHERE f.published = 1 AND f.name!='NA'"
			. "\nAND f.name NOT IN(".$WhereIn.")"
		);
*/
		$sortfields = $_CB_database->loadObjectList();
		if ( ( ! $_CB_database->getErrorNum() ) && ( count( $sortfields ) > 0 ) && ! in_array( 'RAND()', $SQLfunctions ) ) {
			$randomSort		=	new stdClass();
			$randomSort->title	=	CBTxt::T('Sort Randomly');
			$randomSort->name	=	"RAND()";
			$sortfields[]	=	$randomSort;
		}
		// this query is for listing filterable fields
		$_CB_database->setQuery( "SELECT f.title, f.name"
			. "\n FROM #__comprofiler_fields f"
			. "\n INNER JOIN #__comprofiler_plugin AS p ON (f.pluginid = p.id)"
			. "\n WHERE f.published = 1"
			. "\n  AND f.name <> 'NA'"
			. "\n  AND f.tablecolumns <> ''"
			. "\n  AND p.published = 1"
			. "\n   OR f.name IN ('name','username')"
		);
		$filterfields = $_CB_database->loadObjectList();



		$sortlists=explode(", ",str_replace("`","",$row->sortfields));
		$sortparts=array();
		$i=0;
		foreach($sortlists as $sortlist) {
			$sortlistpart=array();
			$sortlistpart=explode(" ",$sortlist);
			if(!ISSET($sortlistpart[1])) $sortlistpart[1]="";
			$sortparts[$i]['field']=$sortlistpart[0];
			$sortparts[$i]['dir']=$sortlistpart[1];
			if ( substr( $sortlistpart[0], -1, 1 ) != ')' ) {
				$_CB_database->setQuery("SELECT title FROM #__comprofiler_fields WHERE name='".$sortlistpart[0]."'",0,1);
				$sortparts[$i]['title']=$_CB_database->loadResult();
			} else {
				switch ( $sortlistpart[0] ) {
					case 'RAND()':
						$sortparts[$i]['title']	=	CBTxt::T('Sort Randomly');
						break;

					default:
						$sortparts[$i]['title']	=	CBTxt::T('Non-existing field') . ": " . $sortlistpart[0];
						break;
				}
			}
			$i++;
		}

if ( count( $notFoundFielIds ) > 0 ) {
	cbArrayToInts( $notFoundFielIds );
	$_CB_database->setQuery( "SELECT f.name, f.title, f.published, f.profile, p.published AS pluginpublished, p.name AS pluginname"
		. "\n FROM #__comprofiler_fields AS f"
		. "\n INNER JOIN #__comprofiler_plugin AS p ON (f.pluginid = p.id)"
		. "\n WHERE f.fieldid IN (" . implode( ',', $notFoundFielIds ) . ")"
	//	. "\n WHERE f.published = 1"
	//	. "\n  AND f.profile > 0"
	//	. "\n  AND p.published = 1"
		. "\n ORDER BY f.ordering"
	);
	$problemFields				=	$_CB_database->loadObjectList();
	if ( ( ! $_CB_database->getErrorNum() ) && ( count( $problemFields ) > 0 ) ) {
		echo '<div class="cbWarning">' . htmlspecialchars( CBTxt::T('Following fields are in list but not visible in here for following reason(s)') ) . ':<ul>';
		foreach ( $problemFields as $f ) {
			if ( $f->published != 1 ) {
				echo '<li>'. htmlspecialchars( sprintf(CBtxt::T('Field "%s (%s)" is not published !'), getLangDefinition( $f->title ), $f->name) ) . '</li>';
			}
			if ( $f->profile <= 0 ) {
				echo '<li>'. htmlspecialchars( sprintf(CBtxt::T('Field "%s (%s)" is not displayed on profile !'), getLangDefinition( $f->title ), $f->name) ) . '</li>';
			}
			if ( $f->pluginpublished != 1 ) {
				echo '<li>'. htmlspecialchars( sprintf(CBtxt::T('Field "%s (%s)" is from plugin "%s" but this plugin is not published !'), getLangDefinition( $f->title ), $f->name, $f->pluginname) ) . '</li>';
			}
		}
		echo '</ul>' . htmlspecialchars( CBTxt::T('If you save this users list now, the fields listed above will be removed from this users list. If you want to keep these fields in this list, cancel now and go to Components / Community Builder / Field Manager.') ) . '</div>' . "\n";
	}
}
	$editorSave_description		=	$_CB_framework->saveCmsEditorJS( 'description' );
	ob_start();
?>
function getObject(obj) {
	return document.getElementById(obj);
}
function shDiv(objID,sh) {
	var strObj;
	strObj = getObject(objID);
	if(sh==0) {
	strObj.style.display="none";
	} else {
	strObj.style.display="block";
	}
}
		function submitbutton(pressbutton) {
			if (pressbutton == 'showLists') {
		        <?php echo $editorSave_description; ?>
				submitform( pressbutton );
				return;
			}
			var coll = document.adminForm;
			var errorMSG = '';
			var iserror=0;
			if (coll.col1enabled.checked == true) coll.col1title.setAttribute('mosReq',1);
			if (coll.col2enabled.checked == true) coll.col2title.setAttribute('mosReq',1);
			if (coll.col3enabled.checked == true) coll.col3title.setAttribute('mosReq',1);
			if (coll.col4enabled.checked == true) coll.col4title.setAttribute('mosReq',1);
			getSortList(document.adminForm.sort);
			getFilterList(document.adminForm.filter);
		     if (coll != null) {
		       var elements = coll.elements;
		       // loop through all input elements in form
		       for (var i=0; i < elements.length; i++) {
		         // check if element is mandatory; here mosReq=1
		         if ((typeof(elements.item(i).getAttribute('mosReq')) != "undefined") && (elements.item(i).getAttribute('mosReq') == 1)) {
		           if (elements.item(i).value == '') {
		             //alert(elements.item(i).getAttribute('mosLabel') + ':' + elements.item(i).getAttribute('mosReq'));
		             // add up all error messages
		             errorMSG += elements.item(i).getAttribute('mosLabel') + ' : <?php echo _UE_REQUIRED_ERROR; ?>\n';
		             // notify user by changing background color, in this case to red
		             elements.item(i).style.backgroundColor = "red";
		             iserror=1;
		           }
		         }
		       }
		     }
			if(iserror==1) { alert(errorMSG); }
			else {
				selectAll(document.adminForm.col1);
				selectAll(document.adminForm.col2);
				selectAll(document.adminForm.col3);
				selectAll(document.adminForm.col4);
		        <?php echo $editorSave_description; ?>
				submitform( pressbutton );
			}

		}

    function addOption(selectObj, value)
    {
      optionSelected = (value == null);
      if(value == null) value = prompt('', '');
      if(value != null)
      {
        if(value.indexOf(',') != -1)
          alert('<?php echo addslashes( CBTxt::T('Commas are not allowed in size values') ); ?>');
        else
        {
          var i = selectObj.options.length;
          value = value.replace(/1\/2/g, '�');
          selectObj.options.length = i + 1;
          selectObj.options[i].value = (value != '' && value != ' ') ? value : ' ';
          selectObj.options[i].text = (value != '' && value != ' ') ? value : '[empty]';
          selectObj.options[i].selected = optionSelected;
// uncomment the line below if you want the select list to change it's size to match the number of options it contains.
//          selectObj.size = selectObj.options.length;
        }
      }
    }

    function editOptions(selectObj)
    {
      for(var i = 0; i < selectObj.options.length; i++)
      {
        if(selectObj.options[i].selected)
        {
          var value = prompt('', selectObj.options[i].value);
          if(value != null)
          {
            if(value.indexOf(',') != -1)
              alert('<?php echo addslashes( CBTxt::T('Commas are not allowed in size values') ); ?>');
            else
            {
              selectObj.options[i].value = value;
              selectObj.options[i].text = (value != '') ? value : '[empty]';
              selectObj.options[i].selected = true;
            }
          }
        }
      }
    }

    function deleteOptions(selectObj)
    {
      for(var i = 0; i < selectObj.options.length; i++)
      {
        if(selectObj.options[i].selected)
        {
          for(var j = i; j < selectObj.options.length - 1; j++)
          {
            selectObj.options[j].value = selectObj.options[j + 1].value;
            selectObj.options[j].text = selectObj.options[j + 1].text;
            selectObj.options[j].selected = selectObj.options[j + 1].selected;
          }
          selectObj.options.length = selectObj.options.length - 1;
          i--;
        }
      }
    }

    function moveOptions(selectObj, direction)
    {
      if(selectObj.selectedIndex != -1)
      {
        if(direction < 0)
        {
          for(i = 0; i < selectObj.options.length; i++)
          {
            swapValue = (i == 0 || selectObj.options[i + direction].selected) ? null : selectObj.options[i + direction].value;
            swapText = (i == 0 || selectObj.options[i + direction].selected) ? null : selectObj.options[i + direction].text;
            if(selectObj.options[i].selected && swapValue != null && swapText != null)
            {
              thisValue = selectObj.options[i].value;
              thisText = selectObj.options[i].text;
              selectObj.options[i].value = swapValue;
              selectObj.options[i].text = swapText;
              selectObj.options[i + direction].value = thisValue;
              selectObj.options[i + direction].text = thisText;
              selectObj.options[i].selected = false;
              selectObj.options[i + direction].selected = true;
            }
          }
        }
        else
        {
          for(i = selectObj.options.length - 1; i >= 0; i--)
          {
            swapValue = (i == selectObj.options.length - 1 || selectObj.options[i + direction].selected) ? null : selectObj.options[i + direction].value;
            swapText = (i == selectObj.options.length - 1 || selectObj.options[i + direction].selected) ? null : selectObj.options[i + direction].text;
            if(selectObj.options[i].selected && swapValue != null && swapText != null)
            {
              thisValue = selectObj.options[i].value;
              thisText = selectObj.options[i].text;
              selectObj.options[i].value = swapValue;
              selectObj.options[i].text = swapText;
              selectObj.options[i + direction].value = thisValue;
              selectObj.options[i + direction].text = thisText;
              selectObj.options[i].selected = false;
              selectObj.options[i + direction].selected = true;
            }
          }
        }
      }
    }
    var NS4 = (document.layers);

    function moveOption(fromObj, toObj)
    {
      for(var i = fromObj.options.length - 1; i >= 0; i--)
      {
        if(fromObj.options[i].selected)
        {
          fromObj.options[i].selected = false;
          var optionText = fromObj.options[i].text.replace(' [ASC]','');
	      optionText = optionText.replace(' [DESC]','');
          var optionValue = fromObj.options[i].value.replace(' ASC','');
	      optionValue = optionValue.replace(' DESC','');
          for(var j = i; j < fromObj.options.length - 1; j++)
          {
            fromObj.options[j].text = fromObj.options[j + 1].text;
            fromObj.options[j].value = fromObj.options[j + 1].value;
          }
          fromObj.options.length = fromObj.options.length - 1;
          toObjIndex = toObj.options.length;
          toObj.options.length = toObj.options.length + 1;
          toObj.options[toObjIndex].text = optionText;
          toObj.options[toObjIndex].value = optionValue;
          if(NS4)
            history.go(0);
        }
      }
    }

    function moveOption2(fromObj, toObj, appendValue)
    {
        if(fromObj.options[fromObj.selectedIndex].selected)
        {
	  fromObjIndex=fromObj.selectedIndex;
          fromObj.options[fromObjIndex].selected = false;
          optionText = fromObj.options[fromObjIndex].text+ ' ['+appendValue+']';
          optionValue = fromObj.options[fromObjIndex].value+' '+appendValue;
          for(var j = fromObjIndex; j < fromObj.options.length - 1; j++)
          {
            fromObj.options[j].text = fromObj.options[j + 1].text;
            fromObj.options[j].value = fromObj.options[j + 1].value;
          }
          fromObj.options.length = fromObj.options.length - 1;
          toObjIndex = toObj.options.length;
          toObj.options.length = toObj.options.length + 1;
          toObj.options[toObjIndex].text = optionText;
          toObj.options[toObjIndex].value = optionValue;
	  toObj.options[toObjIndex].selected=false;
          if(NS4)
            history.go(0);
        }

    }

    function moveOption3(fromObj, toObj, comparison, condition)
    {
        if(fromObj.options[fromObj.selectedIndex].selected)
        {
	  if((condition=='' || condition==null) && document.adminForm.condition.getAttribute('Req')==1) {
		alert('<?php echo addslashes( CBTxt::T('You must define a condition text!') ); ?>');
		return;
	  }
	  fromObjIndex=fromObj.selectedIndex;
          fromObj.options[fromObjIndex].selected = false;
          optionText = fromObj.options[fromObjIndex].text+ ' '+comparison+' '+condition;
	  condition=condition.replace("'", "\\'");
	  if(condition!='' && condition!=null) condition="'"+escape(condition)+"'";
          optionValue = fromObj.options[fromObjIndex].value+' '+comparison+condition;
          toObjIndex = toObj.options.length;
          toObj.options.length = toObj.options.length + 1;
          toObj.options[toObjIndex].text = optionText;
          toObj.options[toObjIndex].value = optionValue;
	  toObj.options[toObjIndex].selected=false;
          if(NS4)
            history.go(0);
        }

    }
    function moveOption4(fromObj, toObj)
    {
      for(var i = fromObj.options.length - 1; i >= 0; i--)
      {
        if(fromObj.options[i].selected)
        {
          fromObj.options[i].selected = false;
          for(var j = i; j < fromObj.options.length - 1; j++)
          {
            fromObj.options[j].text = fromObj.options[j + 1].text;
            fromObj.options[j].value = fromObj.options[j + 1].value;
          }
          fromObj.options.length = fromObj.options.length - 1;
          if(NS4)
            history.go(0);
        }
      }
    }


    function getSortList(selectObj) {
    	var sortfields='';
    	var j=0;
    	selectAll(selectObj);
    	if(selectObj.selectedIndex != -1)
    	{
    		for(i = 0; i < selectObj.options.length; i++)
    		{
    			if(j>0) sortfields +=  ', ';
    			sortfields +=  selectObj.options[i].value;
    			j++;
    		}
    		//alert(sortfields);
    		document.adminForm.sortfields.value=sortfields;
    	}
    }

	function getFilterList(selectObj) {
		var filterfields='';
		var j=0;
		var advType=getObject('ft2');
		var simType=getObject('ft1');
		//alert(simType.checked);
		if(simType.checked) {
			selectAll(selectObj);
			if(selectObj.selectedIndex != -1) {
				for(i = 0; i < selectObj.options.length; i++) {
					if(j>0) filterfields +=  ' AND ';
					filterfields +=  selectObj.options[i].value;
					j++;
				}
			}
			if(filterfields!="") {
				document.adminForm.filterfields.value="s("+filterfields+")";
			} else {
				document.adminForm.filterfields.value="";
			}
		} else {
			if(document.adminForm.advFilterText.value!="") {
				document.adminForm.filterfields.value="a("+escape(document.adminForm.advFilterText.value)+")";
			} else {
				document.adminForm.filterfields.value="";
			}
		}
	}

    function selectAll(selectObj)
    {
      if(selectObj.options.length)
        for(i = 0; i < selectObj.options.length; i++)
          selectObj.options[i].selected = true;
      return false;
    }

    function loadUGIDs(selectObj)
    {
	var UGIDs='';
	var j=0;
      if(selectObj.selectedIndex != -1)
      {
          for(i = 0; i < selectObj.options.length; i++)
          {
		if(selectObj.options[i].selected) {
			if(j>0) UGIDs +=  ', ';
			UGIDs +=  selectObj.options[i].value;
			j++;
		}
          }
		document.adminForm.usergroupids.value=UGIDs;
        }
    }
    function enableListColumn(colnum) {
	var oForm;
	var colName;
	oForm=document.adminForm;
	colName="col"+colnum+"enabled";
	if(oForm.elements[colName].checked) {
		//alert("Enabled");
		oForm.col1title.readOnly=false;
		oForm.col1captions.disabled=false;
		//document.col1.disabled=false;
		oForm.col1up.disabled=false;
		oForm.col1down.disabled=false;
		oForm.col1remove.disabled=false;
		oForm.addcol1.disabled=false;
	} else {
		//alert("Disabled");
		oForm.col1title.readOnly=true;
		oForm.col1captions.disabled=true;
		//document.col1.disabled=true;
		oForm.col1up.disabled=true;
		oForm.col1down.disabled=true;
		oForm.col1remove.disabled=true;
		oForm.addcol1.disabled=true;
	}

    }
	function filterCondition(needCond) {
		if(needCond==0) {
			document.adminForm.condition.value="";
			document.adminForm.condition.readOnly=true;
			document.adminForm.condition.setAttribute("Req",0);
		} else {
			document.adminForm.condition.value="";
			document.adminForm.condition.readOnly=false;
			document.adminForm.condition.setAttribute("Req",1);
		}

	}

<?php
		$jsListsJs		=	ob_get_contents();
		ob_end_clean();
		$_CB_framework->document->addHeadScriptDeclaration( $jsListsJs );
?>
	<form action="<?php echo $_CB_framework->backendUrl( 'index.php?option=com_comprofiler&task=saveList' ); ?>" method="POST" name="adminForm">
	<table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform">
		<tr>
			<td width="20%"><?php echo htmlspecialchars( CBTxt::T('URL for menu link to this list') ); ?>:</td>
			<td align=left  width="40%"><?php
		if ( $row->listid ) {
			$url	=	'index.php?option=com_comprofiler&amp;task=usersList&amp;listid=' . (int) $row->listid;
			echo '<a href="' . $_CB_framework->getCfg('live_site') . '/' . $url . '" target="_blank">' . $url . '</a>';
		} else {
			echo htmlspecialchars( CBTxt::T('You need to save this new list first to see the direct menu link url.') );
		}
			?></td>
			<td width="40%">&nbsp;</td>
		</tr>
		<tr>
			<td width="20%"><?php echo htmlspecialchars( CBTxt::T('URL for search link to this list') ); ?>:</td>
			<td align=left  width="40%"><?php
		if ( $row->listid ) {
			$url	=	'index.php?option=com_comprofiler&amp;task=usersList&amp;listid=' . (int) $row->listid . '&amp;searchmode=1';
			echo '<a href="' . $_CB_framework->getCfg('live_site') . '/' . $url . '" target="_blank">' . $url . '</a>';
		} else {
			echo htmlspecialchars( CBTxt::T('You need to save this new list first to see the direct menu link url.') );
		}
			?></td>
			<td width="40%"><?php echo htmlspecialchars( CBTxt::T('Only fields appearing in list columns and on profiles and which are have the searchable attribute ON will appear in search criterias of the list.') ); ?></td>
		</tr>
		<tr>
			<td><?php echo htmlspecialchars( CBTxt::T('Title') ); ?>:</td>
			<td align=left><input type="text" name="title" mosReq="1" mosLabel="<?php echo htmlspecialchars( CBTxt::T('Title') ); ?>" class="inputbox" value="<?php echo htmlspecialchars($row->title); ?>" /></td>
			<td><?php echo htmlspecialchars( CBTxt::T('Title appears in frontend on top of the list.') ); ?></td>
		</tr>
		<tr>
			<td><?php echo htmlspecialchars( CBTxt::T('Description') ); ?>:</td>
			<td align=left><?php echo $_CB_framework->displayCmsEditor( 'description', $row->description, 600, 200, 50, 7 );
				// <textarea name="description" cols="50" rows="7">< ?php echo htmlspecialchars($row->description); ? ></textarea>
			?></td>
			<td><?php echo htmlspecialchars( CBTxt::T('Description appears in frontend under the title of the list.') ); ?></td>
		</tr>
		<tr>
			<td><?php echo htmlspecialchars( CBTxt::T('User Group to allow access to') ); ?>:</td>
			<td><?php echo $lists['useraccessgroup']; ?></td>
			<td><?php echo htmlspecialchars( CBTxt::T('All groups above that level will also have access to the list.') ); ?></td>
		</tr>
		<tr>
			<td><?php echo htmlspecialchars( CBTxt::T('User Groups to Include in List') ); ?>:</td>
			<td><?php echo $lists['usergroups']; ?></td>
			<td><strong><font color="red"><?php echo htmlspecialchars( CBTxt::T('Multiple choices') ); ?>:</font> <?php echo htmlspecialchars( CBTxt::T('CTRL/CMD-click to add/remove single choices.') ); ?></strong></td>
		</tr>
		<tr>
			<td><?php echo htmlspecialchars( CBTxt::T('Published') ); ?>:</td>
			<td><?php echo $lists['published']; ?></td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td><?php echo htmlspecialchars( CBTxt::T('Default') ); ?>:</td>
			<td><?php echo $lists['default']; ?></td>
			<td><strong><font color="red"><?php echo htmlspecialchars( CBTxt::T('WARNING') ); ?>:</font></strong> <?php echo htmlspecialchars( CBTxt::T('The default list should be the one with the lowest user groups access rights !') ); ?></td>
		</tr>
		<tr>
			<td><?php echo htmlspecialchars( CBTxt::T('Sort By') ); ?>:</td>
			<td>
				<select name="sortfieldlist">
					<?php
						for ($i=0, $n=count( $sortfields ); $i < $n; $i++) {
							$sortfield =& $sortfields[$i];
							if ( substr( $sortfield->name, -1, 1 ) != ')' ) {
								$sortfieldName	=	'`' . $sortfield->name . '`';
							} else {
								$sortfieldName	=	$sortfield->name;
							}
							echo "<option value=\"" . $sortfieldName . "\">". htmlspecialchars( getLangDefinition($sortfield->title) ) ."</option>\n";
						}
					?>
				</select><select name=direction><option value="ASC"><?php echo htmlspecialchars( CBTxt::T('ASC') ); ?></option><option value="DESC"><?php echo htmlspecialchars( CBTxt::T('DESC') ); ?></option></select><input type=button onclick="moveOption2(this.form.sortfieldlist, sort, this.form.direction.value);" value=" <?php echo htmlspecialchars( CBTxt::T('Add') ); ?> "><br />
				<select id=sort name=sort size="5" multiple  mosReq="1" mosLabel="<?php echo htmlspecialchars( CBTxt::T('Sort By') ); ?>">
					<?php
						for ($i=0, $n=count( $sortparts ); $i < $n; $i++) {
							$sortpart = $sortparts[$i];
							if( $sortpart['field'] != '' ) {
								if ( substr( $sortpart['field'], -1, 1 ) != ')' ) {
									$sortfiNam		=	'`' . $sortpart['field'] . '`';
								} else {
									$sortfiNam		=	$sortpart['field'];
								}
								echo '<option value="' . $sortfiNam . ' ' . $sortpart['dir'] . '">' . htmlspecialchars( getLangDefinition($sortpart['title']) ) . ' [' . $sortpart['dir'] . "]</option>\n";
							}
						}

					?>
				</select><br />
				<input type=button onclick="moveOptions(sort, -1);" value=" <?php echo htmlspecialchars( CBTxt::T('+') ); ?> " />
				<input type=button onclick="moveOptions(sort, 1);" value=" <?php echo htmlspecialchars( CBTxt::T('-') ); ?> " />
				<br />
				<input type=button onclick="moveOption(this.form.sort,this.form.sortfieldlist);" value=" <?php echo htmlspecialchars( CBTxt::T('Remove') ); ?> ">
			</td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td><?php echo htmlspecialchars( CBTxt::T('Filter') ); ?>:</td>
			<td colspan="2">
<?php

		$simChecked="";
		$advChecked="";
		$simStyle="display:none;";
		$advStyle="display:none;";
		//echo $row->filterfields;
		$filttype=substr($row->filterfields,0,1);
		$row->filterfields=substr($row->filterfields,2,-1);
		//substr($row->filterfields,1,-1)
		// echo "row->filterfields=".$row->filterfields;
		if($filttype=="a") {
			$advChecked="CHECKED";
			$advStyle="display:block;";
		} else {
			$simChecked="checked=\"checked\"";
			$simStyle="display:block;";
		}
		$filterlists=explode(" AND ",$row->filterfields);
		$filterparts=array();
		$i=0;
		foreach($filterlists as $filterlist) {

			$filterlistpart=array();
			$filterlistpart=explode(" ",$filterlist);
			$filterparts[$i]['field']=str_replace("`","",$filterlistpart[0]);
			$_CB_database->setQuery("SELECT title FROM #__comprofiler_fields WHERE name='".$filterparts[$i]['field']."'", 0, 1);
			$filtertitle=$_CB_database->loadResult();
			$filterparts[$i]['value']=$filterlist;
			$filterparts[$i]['title']=str_replace(array("'","`"),"",str_replace($filterparts[$i]['field'],getLangDefinition($filtertitle),$filterlist));

			$i++;
		}
?>
				<label for=ft1 ><input type="radio" <?php echo $simChecked; ?> id="ft1" onclick="javascript:shDiv('simFilter',1);shDiv('advFilter',0);" name=filtertype value="0" checked="checked" /><?php echo htmlspecialchars( CBTxt::T('Simple') ); ?> </label><label for=ft2 ><input type="radio" <?php echo $advChecked; ?> onclick="javascript:shDiv('simFilter',0);shDiv('advFilter',1);" id="ft2" name="filtertype" value="1" /><?php echo htmlspecialchars( CBTxt::T('Advanced') ); ?> </label>
				<br />
				<div id="simFilter" name="simFilter" style="<?php echo $simStyle; ?>" >
				<select name="filterfieldlist">
					<?php
						foreach ($filterfields AS $filterfield) {
							echo "<option value=\"`".$filterfield->name."`\">". htmlspecialchars( getLangDefinition($filterfield->title) ) ."\n";
						}

					?>
				</select>
				<select name=comparison onchange="javascript:filterCondition(this.options[this.selectedIndex].getAttribute('needCond'));">
					<option value=">" needCond="1"><?php echo htmlspecialchars( CBTxt::T('Greater Than') ); ?></option>
					<option value=">=" needCond="1"><?php echo htmlspecialchars( CBTxt::T('Greater Than or Equal To') ); ?></option>
					<option value="&lt;" needCond="1"><?php echo htmlspecialchars( CBTxt::T('Less Than') ); ?></option>
					<option value="&lt;=" needCond="1"><?php echo htmlspecialchars( CBTxt::T('Less Than or Equal To') ); ?></option>
					<option value="=" needCond="1"><?php echo htmlspecialchars( CBTxt::T('Equal To') ); ?></option>
					<option value="!=" needCond="1"><?php echo htmlspecialchars( CBTxt::T('Not Equal To') ); ?></option>
					<option value="= ''" needCond="0"><?php echo htmlspecialchars( CBTxt::T('Is Empty') ); ?></option>
					<option value="!= ''" needCond="0"><?php echo htmlspecialchars( CBTxt::T('Is Not Empty') ); ?></option>
					<option value="IS NULL" needCond="0"><?php echo htmlspecialchars( CBTxt::T('Is NULL') ); ?></option>
					<option value="IS NOT NULL"  needCond="0"><?php echo htmlspecialchars( CBTxt::T('Is Not NULL') ); ?></option>
					<option value="LIKE"  needCond="1"><?php echo htmlspecialchars( CBTxt::T('Like') ); ?></option>
				</select>
				<input type=text name=condition value="" Req=1 />
				<input type=button onclick="moveOption3(this.form.filterfieldlist, filter, this.form.comparison.value, this.form.condition.value);" value=" <?php echo htmlspecialchars( CBTxt::T('Add') ); ?> ">
				<br />
				<select id=filter name=filter size="5" multiple  mosReq=0 mosLabel="<?php echo htmlspecialchars( CBTxt::T('Filter By') ); ?>">
					<?php
						foreach ($filterparts AS $filterpart) {
							if($filterpart['value']!='') {
								echo "<option value=\"".$filterpart['value']."\">".stripslashes(utf8RawUrlDecode($filterpart['title']))."\n";	//BB todo sortout htmlspecialchars...not compatible with utf8rawdecode
							}
						}

					?>
				</select><br />
				<input type=button onclick="moveOptions(filter, -1);" value=" <?php echo htmlspecialchars( CBTxt::T('+') ); ?> " />
				<input type=button onclick="moveOptions(filter, 1);" value=" <?php echo htmlspecialchars( CBTxt::T('-') ); ?> " />
				<br />
				<input type=button onclick="moveOption4(this.form.filter,this.form.filterfieldlist);" value=" <?php echo htmlspecialchars( CBTxt::T('Remove') ); ?> ">
				</div>
				<div id="advFilter" name="advFilter" style="<?php echo $advStyle; ?>">
					<textarea name="advFilterText" cols="50" rows="7"><?php echo stripslashes(utf8RawUrlDecode($row->filterfields)); 	//BB todo sortout htmlspecialchars...not compatible with utf8rawdecode
					?></textarea>
				</div>
			</td>
		</tr>
	</table>
	<table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform">
		<tr>
			<td width="100%" colspan="3" style="text-align:center;">
				<?php echo CBTxt::T('<strong>Note:</strong> fields must be on profile to appear in this list and be visible on the users-list.'); ?>
			</td>
		</tr>
		<tr>
			<td width="33%">
				<?php echo htmlspecialchars( CBTxt::T('Enable Column 1') ); ?>: <input type=checkbox <?php /* onclick="javascript:enableListColumn(1);" */ ?> name="col1enabled" <?php if($row->col1enabled == 1) echo ' checked="checked" ';  ?> value=1 ><br />
				<?php echo htmlspecialchars( CBTxt::T('Column 1 Title') ); ?>:<br />
				<input type="text" name="col1title" mosReq=0 mosLabel="<?php echo htmlspecialchars( CBTxt::T('Column 1 Title') ); ?>" class="inputbox" value="<?php echo htmlspecialchars($row->col1title); ?>" /><br />
				<?php echo htmlspecialchars( CBTxt::T('Column 1 Captions') ); ?>:<input type=checkbox name=col1captions <?php if($row->col1captions == 1) echo " CHECKED ";  ?> value=1 ><br />
				<select id=col1 size="5" multiple name=col1[] >
					<?php
					echo $col1options;
					?>
				</select><br />
				<input name=col1up type=button onclick="moveOptions(col1, -1);" value=" <?php echo htmlspecialchars( CBTxt::T('+') ); ?> " />
				<input name=col1down type=button onclick="moveOptions(col1, 1);" value=" <?php echo htmlspecialchars( CBTxt::T('-') ); ?> " />
				<br />
				<input name=col1remove type=button onclick="moveOption(col1,this.form.fieldlist);" value=" <?php echo htmlspecialchars( CBTxt::T('Remove') ); ?> ">
			</td>
			<td width="33%" rowspan=3 valign=center align=center><?php echo htmlspecialchars( CBTxt::T('Field List') ); ?>:<br />
				<input name=addcol1 type=button onclick="moveOption(this.form.fieldlist, col1);" value=" <?php echo htmlspecialchars( CBTxt::T('<- Add') ); ?> ">
				<input type=button onclick="moveOption(this.form.fieldlist, col2);" value=" <?php echo htmlspecialchars( CBTxt::T('Add ->') ); ?> "><br />
				<select name="fieldlist" size="10" multiple>
					<?php
						foreach ( $fields as $field ) {
							echo "<option value=\"".$field->fieldid."\">".htmlspecialchars( getLangDefinition($field->title) )."\n";
						}

					?>
				</select><br />
				<input type=button onclick="moveOption(this.form.fieldlist, col3);" value=" <?php echo htmlspecialchars( CBTxt::T('<- Add') ); ?> ">
				<input type=button onclick="moveOption(this.form.fieldlist, col4);" value=" <?php echo htmlspecialchars( CBTxt::T('Add ->') ); ?> ">
			</td>
			<td width="33%">
				<?php echo htmlspecialchars( CBTxt::T('Enable Column 2') ); ?>: <input type=checkbox name=col2enabled <?php if($row->col2enabled == 1) echo " CHECKED ";  ?> value=1 ><br />
				<?php echo htmlspecialchars( CBTxt::T('Column 2 Title') ); ?>:<br />
				<input type="text" name="col2title" mosReq=0 mosLabel="<?php echo htmlspecialchars( CBTxt::T('Column 2 Title') ); ?>" class="inputbox" value="<?php echo htmlspecialchars($row->col2title); ?>" /><br />
				<?php echo htmlspecialchars( CBTxt::T('Column 2 Captions') ); ?>:<input type=checkbox name=col2captions <?php if($row->col2captions == 1) echo " CHECKED ";  ?> value=1 ><br />
				<select id=col2 size="5" multiple name=col2[] >
					<?php
					echo $col2options;
					?>
				</select><br />
				<input type=button onclick="moveOptions(col2, -1);" value=" <?php echo htmlspecialchars( CBTxt::T('+') ); ?> " />
				<input type=button onclick="moveOptions(col2, 1);" value=" <?php echo htmlspecialchars( CBTxt::T('-') ); ?> " />
				<br />
				<input type=button onclick="moveOption(col2,this.form.fieldlist);" value=" <?php echo htmlspecialchars( CBTxt::T('Remove') ); ?> ">
			</td>
		</tr>
		<tr>
		</tr>
		<tr>
			<td width="33%">
				<?php echo htmlspecialchars( CBTxt::T('Enable Column 3') ); ?>: <input type=checkbox name=col3enabled <?php if($row->col3enabled == 1) echo " CHECKED ";  ?> value=1 /><br />
				<?php echo htmlspecialchars( CBTxt::T('Column 3 Title') ); ?>:<br />
				<input type="text" name="col3title" mosReq=0 mosLabel="<?php echo htmlspecialchars( CBTxt::T('Column 3 Title') ); ?>" class="inputbox" value="<?php echo htmlspecialchars($row->col3title); ?>" /><br />
				<?php echo htmlspecialchars( CBTxt::T('Column 3 Captions') ); ?>:<input type=checkbox name=col3captions <?php if($row->col3captions == 1) echo " CHECKED ";  ?> value=1 ><br />
				<select id=col3 size="5" multiple name=col3[]>
					<?php
					echo $col3options;
					?>
				</select><br />
				<input type=button onclick="moveOptions(col3, -1);" value=" <?php echo htmlspecialchars( CBTxt::T('+') ); ?> " />
				<input type=button onclick="moveOptions(col3, 1);" value=" <?php echo htmlspecialchars( CBTxt::T('-') ); ?> " />
				<br />
				<input type=button onclick="moveOption(col3,this.form.fieldlist);" value=" <?php echo htmlspecialchars( CBTxt::T('Remove') ); ?> ">
			</td>
			<td width="33%">
				<?php echo htmlspecialchars( CBTxt::T('Enable Column 4') ); ?>: <input type=checkbox name=col4enabled <?php if($row->col4enabled == 1) echo " CHECKED ";  ?> value=1 ><br />
				<?php echo htmlspecialchars( CBTxt::T('Column 4 Title') ); ?>:<br />
				<input type="text" name="col4title" mosReq=0 mosLabel="<?php echo htmlspecialchars( CBTxt::T('Column 4 Title') ); ?>" class="inputbox" value="<?php echo htmlspecialchars($row->col4title); ?>" /><br />
				<?php echo htmlspecialchars( CBTxt::T('Column 4 Captions') ); ?>:<input type=checkbox name=col4captions <?php if($row->col4captions == 1) echo " CHECKED ";  ?> value=1 ><br />
				<select id=col4 size="5" multiple name=col4[]>
					<?php
					echo $col4options;
					?>
				</select><br />
				<input type=button onclick="moveOptions(col4, -1);" value=" <?php echo htmlspecialchars( CBTxt::T('+') ); ?> " />
				<input type=button onclick="moveOptions(col4, 1);" value=" <?php echo htmlspecialchars( CBTxt::T('-') ); ?> " />
				<br />
				<input type=button onclick="moveOption(col4,this.form.fieldlist);" value=" <?php echo htmlspecialchars( CBTxt::T('Remove') ); ?> ">
			</td>
		</tr>
	</table>
<?php
	// params:
	if ( $paramsEditorHtml ) {
		foreach ( $paramsEditorHtml as $paramsEditorHtmlBlock ) {
?>
		<table class="adminform" cellspacing="0" cellpadding="0" width="100%">
			<tr>
				<th colspan="2">
					<?php echo $paramsEditorHtmlBlock['title']; ?>
				</th>
			</tr>
			<tr>
				<td>
					<?php echo $paramsEditorHtmlBlock['content']; ?>
				</td>
			</tr>
		</table>
<?php
		}
	}
?>

  <table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform">
		<tr>
			<td colspan="3">&nbsp;</td>
		</tr>

  </table>
  <input type="hidden" name="sortfields" value="<?php echo $row->sortfields; ?>" />
  <input type="hidden" name="filterfields" value="<?php echo $row->filterfields; ?>" />
  <input type="hidden" name="usergroupids" value="<?php echo $row->usergroupids; ?>" />
  <input type="hidden" name="listid" value="<?php echo $row->listid; ?>" />
  <input type="hidden" name="ordering" value="<?php echo $row->ordering; ?>" />
  <input type="hidden" name="option" value="com_comprofiler" />
  <input type="hidden" name="task" value="" />
  <?php
	echo cbGetSpoofInputTag( 'list' );
  ?>
</form>

<?php
	}
Пример #12
0
	function drawUsersList( $uid, $listid, $searchFormValuesRAW ) {
		global $_CB_database, $_CB_framework, $ueConfig, $Itemid, $_PLUGINS;
	
		$search					=	null;
		$searchGET				=	cbGetParam( $searchFormValuesRAW, 'search' );
		$limitstart				=	(int) cbGetParam( $searchFormValuesRAW, 'limitstart', 0 );
		$searchmode				=	(int) cbGetParam( $searchFormValuesRAW, 'searchmode', 0 );
		$randomParam			=	(int) cbGetParam( $searchFormValuesRAW, 'rand', 0 );
	
		// old search on formated name:
	
	/*	if ( $searchPOST || count( $_POST ) ) {
			// simple spoof check security
			cbSpoofCheck( 'usersList' );
			if ( cbGetParam( $searchFormValuesRAW, "action" ) == "search" ) {
				$search			=	$searchPOST;
			}
		} else
			if ( isset( $searchFormValuesRAW['limitstart'] ) ) {
				$search				=	stripslashes( $searchGET );
			}
	*/
		// get my user and gets the list of user lists he is allowed to see (ACL):
	
		$myCbUser				=&	CBuser::getInstance( $uid );
		if ( $myCbUser === null ) {
			$myCbUser			=&	CBuser::getInstance( null );
		}
		$myUser					=&	$myCbUser->getUserData();
	/*
		$myUser					=	new moscomprofilerUser( $_CB_database );
		if ( $uid ) {
			$myUser->load( (int) $uid );
		}
	*/
		$useraccessgroupSQL		=	" AND useraccessgroupid IN (".implode(',',getChildGIDS(userGID($uid))).")";
		$_CB_database->setQuery( "SELECT listid, title FROM #__comprofiler_lists WHERE published=1" . $useraccessgroupSQL . " ORDER BY ordering" );
		$plists					=	$_CB_database->loadObjectList();
		$lists					=	array();
		$publishedlists			=	array();
	
		for ( $i=0, $n=count( $plists ); $i < $n; $i++ ) {
			$plist				=&	$plists[$i];
			$listTitleNoHtml	=	strip_tags( cbReplaceVars( getLangDefinition( $plist->title ), $myUser, false, false ) );
		   	$publishedlists[]	=	moscomprofilerHTML::makeOption( $plist->listid, $listTitleNoHtml );
		}
	
		// select either list selected or default list to which he has access (ACL):
	
		if ( $listid == 0 ) {
			$_CB_database->setQuery( "SELECT listid FROM #__comprofiler_lists "
			. "\n WHERE `default`=1 AND published=1" . $useraccessgroupSQL );
			$listid				=	(int) $_CB_database->loadresult();
			if ( $listid == 0 && ( count( $plists ) > 0 ) ) {
				$listid			=	(int) $plists[0]->listid;
			}
		}
		if ( ! ( $listid > 0 ) ) {
			echo _UE_NOLISTFOUND;
			return;
		}
	
		// generates the drop-down list of lists:
	
		if ( count( $plists ) > 1 ) {
			$lists['plists']	=	moscomprofilerHTML::selectList( $publishedlists, 'listid', 'class="inputbox" size="1" onchange="this.form.submit();"', 'value', 'text', $listid, 1 );
		}
	
		// loads the list record:
	
		$row					=	new moscomprofilerLists( $_CB_database );
		if ( ( ! $row->load( (int) $listid ) ) || ( $row->published != 1 ) ) {
			echo _UE_LIST_DOES_NOT_EXIST;
			return;
		}
		if ( ! allowAccess( $row->useraccessgroupid,'RECURSE', userGID($uid) ) ) {
			echo _UE_NOT_AUTHORIZED;
			return;
		}
	
		$params					=	new cbParamsBase( $row->params );
	
		$hotlink_protection		=	$params->get( 'hotlink_protection', 0 );
		if ( $hotlink_protection == 1 ) {
			if ( ( $searchGET !== null ) || $limitstart ) {
				cbSpoofCheck( 'usersList', 'GET' );
			}
		}
	
		$limit					=	(int) $params->get( 'list_limit' );
		if ( $limit == 0 ) {
			$limit				=	(int) $ueConfig['num_per_page'];
		}
	
		$showPaging				=	$params->get( 'list_paging', 1 );
		if ( $showPaging != 1 ) {
			$limitstart			=	0;
		}
	
		$isModerator			=	isModerator( $_CB_framework->myId() );
	
		$_PLUGINS->loadPluginGroup( 'user' );
		// $plugSearchFieldsArray	=	$_PLUGINS->trigger( 'onStartUsersList', array( &$listid, &$row, &$search, &$limitstart, &$limit ) );
		$_PLUGINS->trigger( 'onStartUsersList', array( &$listid, &$row, &$search, &$limitstart, &$limit ) );
	
		// handles the users allowed to be listed in the list by ACL:
	
		$allusergids			=	array();
		$usergids				=	explode( ',', $row->usergroupids );
	/*	This was a bug tending to list admins when "public backend" was checked, and all frontend users when "public backend was checked. Now just ignore them:
		foreach( $usergids AS $usergid ) {
			$allusergids[]		=	$usergid;
			if ($usergid==29 || $usergid==30) {
				$groupchildren	=	array();
				$groupchildren	=	$_CB_framework->acl->get_group_children( $usergid, 'ARO','RECURSE' );
				$allusergids	=	array_merge($allusergids,$groupchildren);
			}
		}
	*/
		$allusergids			=	array_diff( $usergids, array( 29, 30 ) );
		$usergids				=	implode( ",", $allusergids );
	
		// build SQL Select query:
	
		$random					=	0;
		if( $row->sortfields != '' ) {
			$matches			=	null;
			if ( preg_match( '/^RAND\(\)\s(ASC|DESC)$/', $row->sortfields, $matches ) ) {
				// random sorting needs to have same seed on pages > 1 to not have probability to show same users:
				if ( $limitstart ) {
					$random		=	(int) $randomParam;
				}
				if ( ! $random ) {
					$random		=	rand( 0, 32767 );
				}
				$row->sortfields =	'RAND(' . (int) $random . ') ' . $matches[1];
			}
			$orderby			=	"\n ORDER BY " . $row->sortfields;
		}
		$filterby				=	'';
		if ( $row->filterfields != '' ) {
			$filterRules		=	utf8RawUrlDecode( substr( $row->filterfields, 1 ) );
	
			if ( $_CB_framework->myId() ) {
				$user			=	new moscomprofilerUser( $_CB_database );
				if ( $user->load( (int) $_CB_framework->myId() ) ) {
					$filterRules	=	cbReplaceVars( $filterRules, $user, array( $_CB_database, 'getEscaped' ), false, array() );
				}
			}
			$filterby			=	" AND ". $filterRules;
		}
	
		// Prepare part after SELECT .... " and before "FROM" :
	
		$tableReferences		=	array( '#__comprofiler' => 'ue', '#__users' => 'u' );
	
		// Fetch all fields:
	
		$tabs					=	$myCbUser->_getCbTabs();		//	new cbTabs( 0, 1 );		//TBD: later: this private method should not be called here, but the whole users-list should go into there and be called here.
	
		$allFields				=	$tabs->_getTabFieldsDb( null, $myUser, 'list' );
		// $_CB_database->setQuery( "SELECT * FROM #__comprofiler_fields WHERE published = 1" );
		// $allFields				=	$_CB_database->loadObjectList( 'fieldid', 'moscomprofilerFields', array( &$_CB_database ) );
	
	
		//Make columns array. This array will later be constructed from the tabs table:
	
		$columns				=	array();
	
		for ( $i = 1; $i < 50; ++$i ) {
			$enabledVar			=	"col".$i."enabled";
	
			if ( ! isset( $row->$enabledVar ) ) {
				break;
			}
			$titleVar			=	"col".$i."title";
			$fieldsVar			=	"col".$i."fields";
			$captionsVar		=	"col".$i."captions";
	
			if ( $row->$enabledVar == 1 ) {
				$col			=	new stdClass();
				$col->fields	=	( $row->$fieldsVar ? explode( '|*|', $row->$fieldsVar ) : array() );
				$col->title		=	$row->$titleVar;
				$col->titleRendered		=	$myCbUser->replaceUserVars( $col->title );
				$col->captions	=	$row->$captionsVar;
				// $col->sort	=	1; //All columns can be sorted
				$columns[$i]	=	$col;
			}
		}
	
		// build fields and tables accesses, also check for searchable fields:
	
		$searchableFields		=	array();
		$fieldsSQL				=	cbUsersList::getFieldsSQL( $columns, $allFields, $tableReferences, $searchableFields, $params );
	
		$_PLUGINS->trigger( 'onAfterUsersListFieldsSql', array( &$columns, &$allFields, &$tableReferences ) );
	
		$tablesSQL				=	array();
		$joinsSQL				=	array();
		$tablesWhereSQL			=	array(	'block'		=>	'u.block = 0',
											'approved'	=>	'ue.approved = 1',
											'confirmed'	=>	'ue.confirmed = 1'
										 );
	
		if ( checkJversion() == 2 ) {
			$joinsSQL[]				=	'JOIN #__user_usergroup_map g ON g.`user_id` = u.`id`';
		}
	
		if ( ! $isModerator ) {
			$tablesWhereSQL['banned']	=	'ue.banned = 0';
		}
		if ( $usergids ) {
			if ( checkJversion() == 2 ) {
				$tablesWhereSQL['gid']	=	'g.group_id IN (' . $usergids . ')';
			} else {
				$tablesWhereSQL['gid']	=	'u.gid IN (' . $usergids . ')';
			}
		}
	
		foreach ( $tableReferences as $table => $name ) {
			$tablesSQL[]				=	$table . ' ' . $name;
			if ( $name != 'u' ) {
				$tablesWhereSQL[]		=	"u.`id` = " . $name . ".`id`";
			}
		}
	
		// handles search criterias:
	
		$list_compare_types		=	$params->get( 'list_compare_types', 0 );
		$searchVals				=	new stdClass();
		$searchesFromFields		=	$tabs->applySearchableContents( $searchableFields, $searchVals, $searchFormValuesRAW, $list_compare_types );
		$whereFields			=	$searchesFromFields->reduceSqlFormula( $tableReferences, $joinsSQL, TRUE );
		if ( $whereFields ) {
			$tablesWhereSQL[]	=	'(' . $whereFields . ')';
	/*
			if ( $search === null ) {
				$search			=	'';
			}
	*/
		}
	
		$_PLUGINS->trigger( 'onBeforeUsersListBuildQuery', array( &$tablesSQL, &$joinsSQL, &$tablesWhereSQL ) );
	
		$queryFrom				=	"FROM " . implode( ', ', $tablesSQL )
								.	( count( $joinsSQL ) ? "\n " . implode( "\n ", $joinsSQL ) : '' )
								.	"\n WHERE " . implode( "\n AND ", $tablesWhereSQL );
	
		// handles old formatted names search:
	/*
		if ( $search != '' ) {
			$searchSQL			=	cbEscapeSQLsearch( strtolower( $_CB_database->getEscaped( $search ) ) );
			$queryFrom 			.=	" AND (";
	
			$searchFields		=	array();
			if ( $ueConfig['name_format']!='3' ) {
				$searchFields[]	=	"u.name LIKE '%%s%'";
			}
			if ( $ueConfig['name_format']!='1' ) {
				$searchFields[]	=	"u.username LIKE '%%s%'";
			}
			if ( is_array( $plugSearchFieldsArray ) ) {
				foreach ( $plugSearchFieldsArray as $v ) {
					if ( is_array( $v ) ) {
						$searchFields	=	array_merge( $searchFields, $v );
					}
				}
			}
			$queryFrom			.=	str_replace( '%s', $searchSQL, implode( " OR ", $searchFields ) );
			$queryFrom			.=	")";
		}
	*/
		$queryFrom				.=	" " . $filterby;
	
		$_PLUGINS->trigger( 'onBeforeUsersListQuery', array( &$queryFrom, 1, $listid ) );	// $uid = 1
	
		$errorMsg		=	null;
	
		// counts number of users and loads the listed fields of the users if not in search-form-only mode:
	
		if ( $searchmode == 0 ) {
			if ( checkJversion() == 2 ) {
				$_CB_database->setQuery( "SELECT COUNT(DISTINCT u.id) " . $queryFrom );
			} else {
			$_CB_database->setQuery( "SELECT COUNT(*) " . $queryFrom );
			}
			$total					=	$_CB_database->loadResult();
	
			if ( ( $limit > $total ) || ( $limitstart >= $total ) ) {
				$limitstart			=	0;
			}
	
			// $query					=	"SELECT u.id, ue.banned, '' AS 'NA' " . ( $fieldsSQL ? ", " . $fieldsSQL . " " : '' ) . $queryFrom . " " . $orderby
			if ( checkJversion() == 2 ) {
				$query				=	"SELECT DISTINCT ue.*, u.*, '' AS 'NA' " . ( $fieldsSQL ? ", " . $fieldsSQL . " " : '' ) . $queryFrom . " " . $orderby;
			} else {
				$query				=	"SELECT ue.*, u.*, '' AS 'NA' " . ( $fieldsSQL ? ", " . $fieldsSQL . " " : '' ) . $queryFrom . " " . $orderby;
			}
			$_CB_database->setQuery( $query, (int) $limitstart, (int) $limit );
			$users				=	$_CB_database->loadObjectList( null, 'moscomprofilerUser', array( &$_CB_database ) );
	
			if ( ! $_CB_database->getErrorNum() ) {
				// creates the CBUsers in cache corresponding to the $users:
				foreach ( array_keys( $users ) as $k) {
					CBuser::setUserGetCBUserInstance( $users[$k] );
				}
			} else {
				$users			=	array();
				$errorMsg		=	_UE_ERROR_IN_QUERY_TURN_SITE_DEBUG_ON_TO_VIEW;
			}
	
			if ( count( get_object_vars( $searchVals ) ) > 0 ) {
				$search			=	'';
			} else {
				$search			=	null;
			}
	
		} else {
			$total				=	null;
			$users				=	array();
			if ( $search === null ) {
				$search			=	'';
			}
		}
	
		// Compute itemId of users in users-list:
	
		if ( $Itemid ) {
			$option_itemid		=	(int) $Itemid;
		} else {
			$option_itemid		=	getCBprofileItemid( 0 );
		}
		HTML_comprofiler::usersList( $row, $users, $columns, $allFields, $lists, $listid, $search, $searchmode, $option_itemid, $limitstart, $limit, $total, $myUser, $searchableFields, $searchVals, $tabs, $list_compare_types, $showPaging, $hotlink_protection, $errorMsg, $random );
	}
Пример #13
0
 /**
  * @brief 위젯이름과 인자를 받아서 결과를 생성하고 결과 리턴
  * 태그 사용 templateHandler에서 $this->execute()를 실행하는 코드로 대체하게 된다
  *
  * $javascript_mode가 true일 경우 페이지 수정시 위젯 핸들링을 위한 코드까지 포함함
  **/
 function execute($widget, $args, $javascript_mode = false)
 {
     // 디버그를 위한 위젯 실행 시간 저장
     if (__DEBUG__ == 3) {
         $start = getMicroTime();
     }
     // args값에서 urldecode를 해줌
     $object_vars = get_object_vars($args);
     if (count($object_vars)) {
         foreach ($object_vars as $key => $val) {
             if (in_array($key, array('widgetbox_content', 'body', 'class', 'style', 'widget_sequence', 'widget', 'widget_padding_left', 'widget_padding_top', 'widget_padding_bottom', 'widget_padding_right', 'widgetstyle', 'document_srl'))) {
                 continue;
             }
             $args->{$key} = utf8RawUrlDecode($val);
         }
     }
     /**
      * 위젯이 widgetContent/ widgetBox가 아니라면 내용을 구함
      **/
     $widget_content = '';
     if ($widget != 'widgetContent' && $widget != 'widgetBox') {
         if (!is_dir(sprintf(_XE_PATH_ . 'widgets/%s/', $widget))) {
             return;
         }
         // 위젯의 내용을 담을 변수
         $widget_content = $this->getCache($widget, $args);
     }
     if ($widget == 'widgetBox') {
         $widgetbox_content = $args->widgetbox_content;
     }
     /**
      * 관리자가 지정한 위젯의 style을 구함
      **/
     // 가끔 잘못된 코드인 background-image:url(none)이 들어 있을 수가 있는데 이럴 경우 none에 대한 url을 요청하므로 무조건 제거함
     $style = preg_replace('/url\\((.+)(\\/?)none\\)/is', '', $args->style);
     // 내부 여백을 둔 것을 구해서 style문으로 미리 변경해 놓음
     $widget_padding_left = $args->widget_padding_left;
     $widget_padding_right = $args->widget_padding_right;
     $widget_padding_top = $args->widget_padding_top;
     $widget_padding_bottom = $args->widget_padding_bottom;
     $inner_style = sprintf("padding:%dpx %dpx %dpx %dpx !important; padding:none !important;", $widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left);
     /**
      * 위젯 출력물을 구함
      **/
     $widget_content_header = '';
     $widget_content_body = '';
     $widget_content_footer = '';
     // 일반 페이지 호출일 경우 지정된 스타일만 꾸면서 바로 return 함
     if (!$javascript_mode) {
         if ($args->id) {
             $args->id = ' id="' . $args->id . '" ';
         }
         switch ($widget) {
             // 내용 직접 추가일 경우
             case 'widgetContent':
                 if ($args->document_srl) {
                     $oDocumentModel =& getModel('document');
                     $oDocument = $oDocumentModel->getDocument($args->document_srl);
                     $body = $oDocument->getContent(false, false, false, false);
                 } else {
                     $body = base64_decode($args->body);
                 }
                 // 에디터컴포넌트 변경
                 $oEditorController =& getController('editor');
                 $body = $oEditorController->transComponent($body);
                 $widget_content_header = sprintf('<div %sstyle="overflow:hidden;%s"><div style="%s">', $args->id, $style, $inner_style);
                 $widget_content_body = $body;
                 $widget_content_footer = '</div></div>';
                 break;
                 // 위젯 박스일 경우
             // 위젯 박스일 경우
             case 'widgetBox':
                 $widget_content_header = sprintf('<div %sstyle="overflow:hidden;%s;"><div style="%s"><div>', $args->id, $style, $inner_style);
                 $widget_content_body = $widgetbox_content;
                 break;
                 // 일반 위젯일 경우
             // 일반 위젯일 경우
             default:
                 $widget_content_header = sprintf('<div %sstyle="overflow:hidden;%s">', $args->id, $style);
                 $widget_content_body = sprintf('<div style="*zoom:1;%s">%s</div>', $inner_style, $widget_content);
                 $widget_content_footer = '</div>';
                 break;
         }
         // 페이지 수정시에 호출되었을 경우 위젯 핸들링을 위한 코드 추가
     } else {
         switch ($widget) {
             // 내용 직접 추가일 경우
             case 'widgetContent':
                 if ($args->document_srl) {
                     $oDocumentModel =& getModel('document');
                     $oDocument = $oDocumentModel->getDocument($args->document_srl);
                     $body = $oDocument->getContent(false, false, false);
                 } else {
                     $body = base64_decode($args->body);
                 }
                 // args 정리
                 $attribute = array();
                 if ($args) {
                     foreach ($args as $key => $val) {
                         if (in_array($key, array('class', 'style', 'widget_padding_top', 'widget_padding_right', 'widget_padding_bottom', 'widget_padding_left', 'widget', 'widgetstyle', 'document_srl'))) {
                             continue;
                         }
                         if (strpos($val, '|@|') > 0) {
                             $val = str_replace('|@|', ',', $val);
                         }
                         $attribute[] = sprintf('%s="%s"', $key, str_replace('"', '\\"', $val));
                     }
                 }
                 $oWidgetController =& getController('widget');
                 $widget_content_header = sprintf('<div class="widgetOutput" widgetstyle="%s" style="%s" widget_padding_left="%s" widget_padding_right="%s" widget_padding_top="%s" widget_padding_bottom="%s" widget="widgetContent" document_srl="%d" %s>' . '<div class="widgetResize"></div>' . '<div class="widgetResizeLeft"></div>' . '<div class="widgetBorder">' . '<div style="%s">', $args->widgetstyle, $style, $args->widget_padding_left, $args->widget_padding_right, $args->widget_padding_top, $args->widget_padding_bottom, $args->document_srl, implode(' ', $attribute), $inner_style);
                 $widget_content_body = $body;
                 $widget_content_footer = sprintf('</div><div class="clear"></div>' . '</div>' . '<div class="widgetContent" style="display:none;width:1px;height:1px;overflow:hidden;">%s</div>' . '</div>', base64_encode($body));
                 break;
                 // 위젯 박스일 경우
             // 위젯 박스일 경우
             case 'widgetBox':
                 // args 정리
                 $attribute = array();
                 if ($args) {
                     foreach ($args as $key => $val) {
                         if (in_array($key, array('class', 'style', 'widget_padding_top', 'widget_padding_right', 'widget_padding_bottom', 'widget_padding_left', 'widget', 'widgetstyle', 'document_srl'))) {
                             continue;
                         }
                         if (strpos($val, '|@|') > 0) {
                             $val = str_replace('|@|', ',', $val);
                         }
                         $attribute[] = sprintf('%s="%s"', $key, str_replace('"', '\\"', $val));
                     }
                 }
                 $widget_content_header = sprintf('<div class="widgetOutput" widgetstyle="%s" widget="widgetBox" style="%s;" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" %s >' . '<div class="widgetBoxResize"></div>' . '<div class="widgetBoxResizeLeft"></div>' . '<div class="widgetBoxBorder"><div class="nullWidget" style="%s">', $args->widgetstyle, $style, $widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left, implode(' ', $attribute), $inner_style);
                 $widget_content_body = $widgetbox_content;
                 break;
                 // 일반 위젯일 경우
             // 일반 위젯일 경우
             default:
                 // args 정리
                 $attribute = array();
                 if ($args) {
                     foreach ($args as $key => $val) {
                         if (in_array($key, array('class', 'style', 'widget_padding_top', 'widget_padding_right', 'widget_padding_bottom', 'widget_padding_left', 'widget'))) {
                             continue;
                         }
                         if (strlen($val) == 0) {
                             continue;
                         }
                         if (strpos($val, '|@|') > 0) {
                             $val = str_replace('|@|', ',', $val);
                         }
                         $attribute[] = sprintf('%s="%s"', $key, str_replace('"', '\\"', $val));
                     }
                 }
                 $widget_content_header = sprintf('<div class="widgetOutput" widgetstyle="%s" style="%s" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" widget="%s" %s >' . '<div class="widgetResize"></div>' . '<div class="widgetResizeLeft"></div>' . '<div class="widgetBorder">', $args->widgetstyle, $style, $widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left, $widget, implode(' ', $attribute));
                 $widget_content_body = sprintf('<div style="%s">%s</div><div class="clear"></div>', $inner_style, $widget_content);
                 $widget_content_footer = '</div></div>';
                 break;
         }
     }
     // 위젯 스타일을 컴파일 한다.
     if ($args->widgetstyle) {
         $widget_content_body = $this->complieWidgetStyle($args->widgetstyle, $widget, $widget_content_body, $args, $javascript_mode);
     }
     $output = $widget_content_header . $widget_content_body . $widget_content_footer;
     // 위젯 결과물 생성 시간을 debug 정보에 추가
     if (__DEBUG__ == 3) {
         $GLOBALS['__widget_excute_elapsed__'] += getMicroTime() - $start;
     }
     // 결과 return
     return $output;
 }