/** * Outputs legacy user edit display * * @deprecated 2.0 * * @param UserTable $user * @param string $option * @param int $newCBuser * @param array $postdata */ public function edituser($user, $option, $newCBuser, &$postdata) { global $_CB_framework, $_CB_Backend_Title, $_PLUGINS; $results = $_PLUGINS->trigger('onBeforeUserProfileEditDisplay', array(&$user, 2)); if ($_PLUGINS->is_errors()) { cbRedirect($_CB_framework->backendViewUrl('showusers'), $_PLUGINS->getErrorMSG(), 'error'); } _CBsecureAboveForm('edituser'); cbimport('cb.validator'); outputCbTemplate(2); initToolTip(2); outputCbJs(2); $tabs = new cbTabs($_CB_framework->getUi() == 2 && !isset($_REQUEST['tab']) ? 1 : 0, 2); // use cookies in backend to remember selected tab. $tabcontent = $tabs->getEditTabs($user, $postdata, 'htmledit', 'divs'); $_CB_Backend_Title = array(0 => array('fa fa-user', $user->id ? CBTxt::T('COMMUNITY_BUILDER_EDIT_USER_USERNAME', 'Community Builder: Edit User [[username]]', array('[username]' => $user->username)) : CBTxt::T('Community Builder: New User'))); cbValidator::loadValidation(); if (is_array($results)) { echo implode('', $results); } $return = '<form action="' . $_CB_framework->backendUrl('index.php') . '" method="post" name="adminForm" id="cbcheckedadminForm" enctype="multipart/form-data" autocomplete="off" class="cb_form form-auto cbValidation">' . $tabcontent . '<input type="hidden" name="id" value="' . (int) $user->id . '" />' . '<input type="hidden" name="newCBuser" value="' . (int) $newCBuser . '" />' . '<input type="hidden" name="option" value="com_comprofiler" />' . '<input type="hidden" name="view" value="save" />' . cbGetSpoofInputTag('user') . '<div class="cbIconsBottom">' . getFieldIcons(2, true, true, '', '', true) . '</div>' . '</form>'; echo $return; }
function editfield( &$row, $lists, $fieldvalues, $option, $paramsEditorHtml ) { global $_CB_framework, $_CB_database; _CBsecureAboveForm('editfield'); outputCbTemplate( 2 ); outputCbJs( 2 ); initToolTip( 2 ); global $_CB_Backend_Title; $_CB_Backend_Title = array( 0 => array( 'cbicon-48-fields', CBTxt::T('Community Builder Field') . ': <small>' . ( $row->fieldid ? CBTxt::T('Edit') . ' [ ' . htmlspecialchars( getLangDefinition( $row->title ) ) . ' ] ' : CBTxt::T('New') ) . '</small>' ) ); if ( $row->fieldid && ( ! $row->published ) ) { echo '<div class="cbWarning">' . CBTxt::T('Field is not published') . '</div>' . "\n"; } if ( $row->pluginid ) { $plugin = new moscomprofilerPlugin( $_CB_database ); if ( ! $plugin->load( (int) $row->pluginid ) ) { echo '<div class="cbWarning">' . CBTxt::T('Plugin is not installed') . '</div>' . "\n"; } else { if ( ! $plugin->published ) { echo '<div class="cbWarning">' . CBTxt::T('Plugin is not published') . '</div>' . "\n"; } } } // $_CB_framework->outputCbJQuery( "var cbTypeState = $('#type').val(); $('#type').change(function() { if ( cbTypeState != $('#type').val() ) submitbutton('reloadField') } ).change();" ); // outputCbJs( 2 ); if($row->fieldid > 0) { $_CB_framework->outputCbJQuery( 'document.adminForm.name.readOnly=true; document.adminForm.name.disabled=true; document.adminForm.type.disabled=true;'); } // disableAll(); // selType('".$row->type."'); $editorSave_description = $_CB_framework->saveCmsEditorJS( 'description' ); $editorSave_default = $_CB_framework->saveCmsEditorJS( 'default' ); ob_start(); ?> function submitbutton(pressbutton) { if ( (pressbutton == 'showField') || (pressbutton == 'reloadField') ) { document.adminForm.type.disabled=false; <?php echo $editorSave_description; if ( $row->type == 'editorta' ) { echo $editorSave_default; } ?> submitform(pressbutton); return; } var coll = document.adminForm; var errorMSG = ''; var iserror=0; 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 { document.adminForm.type.disabled=false; <?php echo $editorSave_description; if ( $row->type == 'editorta' ) { echo $editorSave_default; } ?> submitform(pressbutton); } } <?php $jsTop = ob_get_contents(); ob_end_clean(); $_CB_framework->document->addHeadScriptDeclaration( $jsTop ); ob_start(); ?> function insertRow() { // Create and insert rows and cells into the first body. // var i = $('#adminForm input[name=valueCount]').val( Number( $('#adminForm input[name=valueCount]').val() ) + 1 ).val(); // $('#fieldValuesBody').append('<tr><td><input id=\"vNames'+i+'\" name=\"vNames[' + i + ']\" /></td></tr>'); var i = $('#adminForm input[name=valueCount]').val( Number( $('#adminForm input[name=valueCount]').val() ) + 1 ).val(); $('#fieldValuesList').append('<li><input id=\"vNames'+i+'\" name=\"vNames[]\" /></li>'); $('#vNames'+i).hide().slideDown('medium').focus(); } function disableAll() { $('#divValues,#divColsRows,#divWeb,#divText').hide().css('visibility','visible'); $('#vNames0').attr('mosReq','0'); } function selType(sType) { var elem; //alert(sType); disableAll(); switch (sType) { case 'editorta': case 'textarea': $('#divText,#divColsRows').show(); break; case 'emailaddress': case 'password': case 'text': case 'integer': case 'predefined': $('#divText').show(); break; case 'select': case 'multiselect': $('#divValues').show(); $('#vNames0').attr('mosReq','1'); break; case 'radio': case 'multicheckbox': $('#divValues,#divColsRows').show(); $('#vNames0').attr('mosReq','1'); break; case 'webaddress': $('#divText,#divWeb').show(); break; case 'delimiter': default: } } function prep4SQL(o){ if(o.value!='') { var cbsqloldvalue, cbsqlnewvalue; o.value=o.value.replace('cb_',''); cbsqloldvalue = o.value; o.value=o.value.replace(/[^a-zA-Z0-9]+/g,''); cbsqlnewvalue = o.value; o.value='cb_' + o.value; if (cbsqloldvalue != cbsqlnewvalue) { alert('<?php echo addslashes( CBTxt::T('Warning: SQL name of field has been changed to fit SQL constraints') ); ?>'); } } } var cbTypeState = $('#type').val(); $('#type').change(function() { selType(this.options[this.selectedIndex].value); if ( cbTypeState != $('#type').val() ) submitbutton('reloadField') } ).change(); $('#name').change(function() { if ( ! $('#name').attr('disabled') ) { prep4SQL(this); } } ).change(); $('#insertrow').click(function() { insertRow(); } ); $('#fieldValuesList').sortable( { items: 'li', containment: 'parent', animated: true, placeholder: 'fieldValuesList-selected' } ); // $('#mainparams').sortable( { items: 'tr', containment: 'parent', animated: true } ); /* $('#adminForm').submit(function() { return submitbutton(''); } ); */ disableAll(); selType('<?php echo $row->type; ?>'); <?php $jsContent = ob_get_contents(); ob_end_clean(); $_CB_framework->outputCbJQuery( $jsContent, 'ui-all' ); ?> <form action="<?php echo $_CB_framework->backendUrl( 'index.php?option=com_comprofiler&task=saveField' ); ?>" method="POST" id="adminForm" name="adminForm"> <?php if ( $paramsEditorHtml ) { ?> <table cellspacing="0" cellpadding="0" width="100%"> <tr valign="top"> <td width="60%" valign="top"> <?php } ?> <table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform" id="mainparams"> <tr> <td width="20%"><?php echo CBTxt::T('Type'); ?>:</td> <td width="20%"><?php echo $lists['type']; ?></td> <td> </td> </tr> <tr> <td width="20%"><?php echo CBTxt::T('Tab'); ?>:</td> <td width="20%"><?php echo $lists['tabs']; ?></td> <td> </td> </tr> <tr> <td width="20%"><?php echo CBTxt::T('Name'); ?>:</td> <td align=left width="20%"><input type="text" id="name" name="name" maxlength='64' mosReq="1" mosLabel="<?php echo htmlspecialchars( CBTxt::T('Name') ); ?>" class="inputbox" value="<?php echo htmlspecialchars( $row->name ); ?>" /></td> <td> </td> </tr> <tr> <td width="20%"><?php echo CBTxt::T('Title'); ?>:</td> <td width="20%" 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> </td> </tr> <tr> <td colspan="3"><?php echo CBTxt::T('Description/"i" field-tip: text or HTML'); ?>:</td> </tr> <tr> <td colspan="3" align=left><?php echo $_CB_framework->displayCmsEditor( 'description', $row->description, 600 /* ( $row->type == 'delimiter' ? 600 : 286 ) */ , 200, 50, 7 ); // <textarea name="description" cols="40" rows="6" maxlength='255' mosReq="0" mosLabel="Description" class="inputbox">< ?php echo htmlspecialchars( $row->description ); ? ></textarea> ?></td> </tr> <?php if ( $row->type != 'delimiter' ) { ?> <tr> <?php if ( $row->type == 'editorta' ) { ?> <td colspan="3"><?php echo CBTxt::T('Pre-filled default value at registration only'); ?>:</td> </tr> <tr> <td colspan="3"><?php echo $_CB_framework->displayCmsEditor( 'cb_default', $row->default, 600, 200, 50, 7 ); ?></td> <?php } else { ?> <td width="20%"><?php echo CBTxt::T('Pre-filled default value at registration only'); ?>:</td> <td width="20%"> <input type="text" name="cb_default" mosLabel="<?php echo htmlspecialchars( CBTxt::T('Default value') ); ?>" class="inputbox" value="<?php echo htmlspecialchars( $row->default ); ?>" /> </td> <td> </td><?php } ?> </tr> <?php } ?> <tr> <td width="20%"><?php echo CBTxt::T('Required'); ?>?:</td> <td width="20%"><?php echo $lists['required']; ?></td> <td> </td> </tr> <tr> <td width="20%"><?php echo CBTxt::T('Show on Profile'); ?>?:</td> <td width="20%"><?php echo $lists['profile']; ?></td> <td> </td> </tr> <tr> <td width="20%"><?php echo CBTxt::T('Display field title in Profile'); ?>?:</td> <td width="20%"><?php echo $lists['displaytitle']; ?></td> <td> </td> </tr> <tr> <td width="20%"><?php echo CBTxt::T('Searchable in users-lists'); ?>?:</td> <td width="20%"><?php echo $lists['searchable']; ?></td> <td> </td> </tr> <tr> <td width="20%"><?php echo CBTxt::T('User Read Only'); ?>?:</td> <td width="20%"><?php echo $lists['readonly']; ?></td> <td> </td> </tr> <tr> <td width="20%"><?php echo CBTxt::T('Show at Registration'); ?>?:</td> <td width="20%"><?php echo $lists['registration']; ?></td> <td> </td> </tr> <tr> <td width="20%"><?php echo CBTxt::T('Published'); ?>:</td> <td width="20%"><?php echo ( $row->sys == 1 ? ( $row->published ? _UE_YES : _UE_NO ) . ' (' . CBTxt::T('System-fields cannot be published/unpublished here.') . ( in_array( $row->name, array( 'name', 'firstname', 'middlename', 'lastname' ) ) ? ' ' . CBTxt::T('Name-fields publishing depends on your setting in global CB config.') . ')' : ')' ) : $lists['published'] ); ?></td> <td> </td> </tr> <tr> <td width="20%"><?php echo CBTxt::T('Size'); ?>:</td> <td width="20%"><input type="text" name="size" mosLabel="<?php echo htmlspecialchars( CBTxt::T('Size') ); ?>" class="inputbox" value="<?php echo htmlspecialchars( $row->size ); ?>" /></td> <td> </td> </tr> </table> <div id="page1" class="pagetext"> </div> <div id="divText" class="pagetext"> <table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform"> <tr> <td width="20%"><?php echo CBTxt::T('Max Length'); ?>:</td> <td width="20%"><input type="text" name="maxlength" mosLabel="<?php echo htmlspecialchars( CBTxt::T('Max Length') ); ?>" class="inputbox" value="<?php echo htmlspecialchars( $row->maxlength ); ?>" /></td> <td> </td> </tr> </table> </div> <div id="divColsRows" class="pagetext"> <table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform"> <tr> <td width="20%"><?php echo CBTxt::T('Cols'); ?>:</td> <td width="20%"><input type="text" name="cols" mosLabel="<?php echo htmlspecialchars( CBTxt::T('Cols') ); ?>" class="inputbox" value="<?php echo htmlspecialchars( $row->cols ); ?>" /></td> <td> </td> </tr> <tr> <td width="20%"><?php echo CBTxt::T('Rows'); ?>:</td> <td width="20%"><input type="text" name="rows" mosLabel="<?php echo htmlspecialchars( CBTxt::T('Rows') ); ?>" class="inputbox" value="<?php echo htmlspecialchars( $row->rows ); ?>" /></td> <td> </td> </tr> </table> </div> <div id="divWeb" class="pagetext"> <table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform"> <tr> <td width="20%"><?php echo CBTxt::T('Type'); ?>:</td> <td width="20%"><?php echo $lists['webaddresstypes']; ?></td> <td> </td> </tr> </table> </div> <div id="divValues" style="text-align:left;"> <?php echo CBTxt::T('Use the table below to add new values.'); ?><br /> <input type=button id="insertrow" value="<?php echo htmlspecialchars( CBTxt::T('Add a Value') ); ?>" /> <table align="left" id="divFieldValues" cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform" > <thead> <tr> <th width="20%"><?php echo CBTxt::T('Name'); ?></th> </tr> </thead> <tbody id="fieldValuesBody"> <tr> <td> <ul id="fieldValuesList"> <?php //echo "count:".count( $fieldvalues ); //print_r (array_values($fieldvalues)); for ($i=0, $n=count( $fieldvalues ); $i < $n; $i++) { //print "count:".$i; $fieldvalue = $fieldvalues[$i]; if ($i==0) $req =1; else $req = 0; echo "\n<li><input type='text' mosReq='$req' mosLabel='" . htmlspecialchars( CBTxt::T('Value') ) . "' value=\"" . htmlspecialchars( $fieldvalue->fieldtitle ) . "\" name=\"vNames[]\" id=\"vNames".$i."\" /></li>\n"; } if(count( $fieldvalues )< 1) { echo "\n<li><input type='text' mosReq='0' mosLabel='" . htmlspecialchars( CBTxt::T('Value') ) . "' value='' name='vNames[]' /></li>\n"; $i=0; } ?> </ul> </td> </tr> </tbody> </table> </div> <?php /* //echo "count:".count( $fieldvalues ); //print_r (array_values($fieldvalues)); for ($i=0, $n=count( $fieldvalues ); $i < $n; $i++) { //print "count:".$i; $fieldvalue = $fieldvalues[$i]; if ($i==0) $req =1; else $req = 0; echo "<tr>\n<td width=\"20%\"><input type='text' mosReq='$req' mosLabel='" . htmlspecialchars( CBTxt::T('Value') ) . "' value=\"" . htmlspecialchars( $fieldvalue->fieldtitle ) . "\" name=\"vNames[".$i."]\" id=\"vNames".$i."\" /></td></tr>\n"; } if(count( $fieldvalues )< 1) { echo "<tr>\n<td width=\"20%\"><input type='text' mosReq='0' mosLabel='" . htmlspecialchars( CBTxt::T('Value') ) . "' value='' name=vNames[0] /></td></tr>\n"; $i=0; } ?> </tbody> </table> </div> <?php */ if ( $paramsEditorHtml ) { ?> </td> <td width="40%" valign="top"> <?php 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 } ?> </td> </tr> </table> <?php } ?> <table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform"> <tr> <td colspan="3"> </td> </tr> </table> <input type="hidden" name="valueCount" value=<?php echo $i; ?> /> <input type="hidden" name="oldtabid" value="<?php echo htmlspecialchars( $row->tabid ); ?>" /> <input type="hidden" name="fieldid" value="<?php echo (int) $row->fieldid; ?>" /> <input type="hidden" name="ordering" value="<?php echo htmlspecialchars( $row->ordering ); ?>" /> <input type="hidden" name="option" value="<?php echo $option; ?>" /> <input type="hidden" name="task" value="" /> <?php echo cbGetSpoofInputTag( 'field' ); ?> </form> <?php }
/** * Installs the plugin By in-place Discovery * * @param string $plgFile Directory discovered * @return boolean Success */ private function installPluginDisc($plgFile) { global $_CB_framework; // Try extending time, as unziping/ftping took already quite some... : @set_time_limit(240); _CBsecureAboveForm('showPlugins'); outputCbTemplate(2); outputCbJs(2); initToolTip(2); $installer = new cbInstallerPlugin(); // Check if file xml exists if (!$plgFile) { cbInstaller::showInstallMessage(CBTxt::T('No file selected'), CBTxt::T('Install new plugin from discovery - error'), false); return false; } $path = _cbPathName($_CB_framework->getCfg('absolute_path') . '/components/com_comprofiler/plugin/' . $plgFile); if (!is_dir($path)) { $path = dirname($path); } if (!is_dir($path)) { cbInstaller::showInstallMessage(CBTxt::T('FILE_DOES_NOT_EXIST_FILE', 'File does not exist - [file]', array('[file]' => $path)), CBTxt::T('INSTALL_NEW_PLUGIN_FROM_DISCOVERY_ERROR', 'Install new plugin from discovery - error'), false); return false; } $ret = $installer->install($path, true); cbInstaller::showInstallMessage($installer->getError(), CBTxt::T('INSTALL_NEW_PLUGIN_FROM_DISCOVERY_ERROR_FILE_STATUS', 'Install new plugin from discovery - [file] - [status]', array('[file]' => $path, '[status]' => $ret ? CBTxt::T('Success') : CBTxt::T('Failed'))), $ret); return $ret; }
function edituser($user, $option, $newCBuser, &$postdata) { global $_CB_framework, $_PLUGINS; $results = $_PLUGINS->trigger('onBeforeUserProfileEditDisplay', array(&$user, 2)); if ($_PLUGINS->is_errors()) { echo "<script type=\"text/javascript\">alert(\"" . str_replace(array("\n", '<br />'), array('\\n', '\\n'), addslashes($_PLUGINS->getErrorMSG())) . "\"); window.history.go(-1); </script>\n"; exit; } _CBsecureAboveForm('edituser'); outputCbTemplate(2); initToolTip(2); $tabs = new cbTabs($_CB_framework->getUi() == 2 && !isset($_REQUEST['tab']) ? 1 : 0, 2); // use cookies in backend to remember selected tab. $tabcontent = $tabs->getEditTabs($user, $postdata); outputCbJs(2); global $_CB_Backend_Title; //OLD: $_CB_Backend_Title = array( 0 => array( 'cbicon-48-users', "Community Builder User: <small>" . ( $user->id ? "Edit" . ' [ '. $user->username .' ]' : "New" ) . '</small>' ) ); //NEW: $_CB_Backend_Title = array(0 => array('cbicon-48-users', CBTxt::T('Community Builder User') . ": <small>" . ($user->id ? CBTxt::T('Edit') . ' [ ' . $user->username . ' ]' : CBTxt::T('New')) . '</small>')); ob_start(); if (defined('_CB_VALIDATE_NEW')) { cbimport('cb.validator'); cbValidator::renderGenericJs(); ?> $('div.cbtoolbaractions .cbtoolbaraction').click( function() { if ( $(this).attr('href') ) { var taskVal = $(this).attr('href').substring(1); } else if ( $(this).attr('value') ) { taskVal = $(this).attr('value').substring(1); } $('#cbcheckedadminForm input[name=task]').val( taskVal ); if (taskVal == 'showusers') { $('#cbcheckedadminForm')[0].submit(); } else { $('#cbcheckedadminForm').submit(); } return false; } ); <?php $cbjavascript = ob_get_contents(); ob_end_clean(); $_CB_framework->outputCbJQuery($cbjavascript, array('metadata', 'validate')); } else { // old way: ?> var cbDefaultFieldbackgroundColor; function cbFrmSubmitButton() { var me = this.elements; <?php $version = checkJversion(); if ($version == 1) { // var r = new RegExp("^[a-zA-Z](([\.\-a-zA-Z0-9@])?[a-zA-Z0-9]*)*$", "i"); ?> var r = new RegExp("^[\<|\>|\"|\'|\%|\;|\(|\)|\&|\+|\-]*$", "i"); <?php } elseif ($version == -1) { ?> var r = new RegExp("[^A-Za-z0-9]", "i"); <?php } else { ?> var r = new RegExp("[\<|\>|\"|\'|\%|\;|\(|\)|\&|\+|\-]", "i"); <?php } ?> var errorMSG = ''; var iserror=0; if (cbDefaultFieldbackgroundColor === undefined) cbDefaultFieldbackgroundColor = ((me['username'].style.getPropertyValue) ? me['username'].style.getPropertyValue("backgroundColor") : me['username'].style.backgroundColor); <?php echo $tabs->fieldJS; ?> if (me['username'].value == "") { errorMSG += "<?php echo str_replace(array("\n", "\r"), ' ', CBTxt::html_entity_decode(_REGWARN_UNAME)); ?> \n"; me['username'].style.backgroundColor = "red"; iserror=1; } else if (r.exec(me['username'].value) || (me['username'].value.length < 3)) { errorMSG += "<?php echo str_replace(array("\n", "\r"), ' ', sprintf(CBTxt::html_entity_decode(_VALID_AZ09), CBTxt::html_entity_decode(_PROMPT_UNAME), 2)); ?> \n"; me['username'].style.backgroundColor = "red"; iserror=1; } else if (me['username'].style.backgroundColor.slice(0,3)=="red") { me['username'].style.backgroundColor = cbDefaultFieldbackgroundColor; } if ((me['password'].value != "") && (me['password'].value != me['password__verify'].value)){ errorMSG += "<?php echo CBTxt::html_entity_decode(_REGWARN_VPASS2); ?> \n"; me['password'].style.backgroundColor = "red"; me['password__verify'].style.backgroundColor = "red"; iserror=1; } else { if (me['password'].style.backgroundColor.slice(0,3)=="red") me['password'].style.backgroundColor = cbDefaultFieldbackgroundColor; if (me['password__verify'].style.backgroundColor.slice(0,3)=="red") me['password__verify'].style.backgroundColor = cbDefaultFieldbackgroundColor; } if (!$('input[name^=\"gid\"],select[name^=\"gid\"]').val()) { errorMSG += '<?php echo addslashes(CBTxt::T('You must assign user to a group.')); ?> ' + "\n"; iserror=1; } // loop through all input elements in form var fieldErrorMessages = new Array; for (var i=0; i < me.length; i++) { // check if element is mandatory; here mosReq=1 if ( (typeof(me[i].getAttribute('mosReq')) != "undefined") && ( me[i].getAttribute('mosReq') == 1) ) { if (me[i].type == 'radio' || me[i].type == 'checkbox') { var rOptions = me[me[i].getAttribute('name')]; var rChecked = 0; if(rOptions.length > 1) { for (var r=0; r < rOptions.length; r++) { if ( (typeof(rOptions[r].getAttribute('mosReq')) != "undefined") && ( rOptions[r].getAttribute('mosReq') == 1) ) { if (rOptions[r].checked) { rChecked=1; } } } } else { if (me[i].checked) { rChecked=1; } } if(rChecked==0) { for (var k=0; k < me.length; k++) { if (me[i].getAttribute('name') == me[k].getAttribute('name')) { if (me[k].checked) { rChecked=1; break; } } } } if(rChecked==0) { var alreadyFlagged = false; for (var j = 0, n = fieldErrorMessages.length; j < n; j++) { if (fieldErrorMessages[j] == me[i].getAttribute('name')) { alreadyFlagged = true; break } } if ( ! alreadyFlagged ) { fieldErrorMessages.push(me[i].getAttribute('name')); // add up all error messages errorMSG += me[i].getAttribute('mosLabel') + ' : <?php echo CBTxt::html_entity_decode(_UE_REQUIRED_ERROR); ?> \n'; // notify user by changing background color, in this case to red me[i].style.backgroundColor = "red"; iserror=1; } } else if (me[i].style.backgroundColor.slice(0,3)=="red") me[i].style.backgroundColor = cbDefaultFieldbackgroundColor; } if (me[i].value == '') { // add up all error messages errorMSG += me[i].getAttribute('mosLabel') + ' : <?php echo CBTxt::html_entity_decode(_UE_REQUIRED_ERROR); ?> \n'; // notify user by changing background color, in this case to red me[i].style.backgroundColor = "red"; iserror=1; } else if (me[i].style.backgroundColor.slice(0,3)=="red") me[i].style.backgroundColor = cbDefaultFieldbackgroundColor; } } if(iserror==1) { alert(errorMSG); return false; } else { return true; } } $('#cbcheckedadminForm').submit( cbFrmSubmitButton ); $('div.cbtoolbaractions .cbtoolbaraction').click( function() { if ( $(this).attr('href') ) { var taskVal = $(this).attr('href').substring(1); } else if ( $(this).attr('value') ) { taskVal = $(this).attr('value').substring(1); } $('#cbcheckedadminForm input[name=task]').val( taskVal ); if (taskVal == 'showusers') { $('#userEditTable input').val(''); $('#cbcheckedadminForm')[0].submit(); } else { $('#cbcheckedadminForm').submit(); } return false; } ); <?php $cbjavascript = ob_get_contents(); ob_end_clean(); $_CB_framework->outputCbJQuery($cbjavascript); // end of old way } if (is_array($results)) { echo implode('', $results); } $this->_overideWebFxLayout(); ?> <div id="cbErrorMessages"></div> <form action="<?php echo $_CB_framework->backendUrl('index.php'); ?> " method="post" name="adminForm" id="cbcheckedadminForm" enctype="multipart/form-data" autocomplete="off"> <?php echo "<table cellspacing='0' cellpadding='4' border='0' width='100%' id='userEditTable'><tr><td width='100%'>\n"; echo $tabcontent; echo "</td></tr></table>"; ?> <input type="hidden" name="id" value="<?php echo $user->id; ?> " /> <input type="hidden" name="newCBuser" value="<?php echo $newCBuser; ?> " /> <input type="hidden" name="option" value="<?php echo $option; ?> " /> <input type="hidden" name="task" value="save" /> <?php echo cbGetSpoofInputTag('user'); ?> </form> <div style="align:center;"> <?php echo getFieldIcons(2, true, true, "", "", true); if (isset($_REQUEST['tab'])) { $_CB_framework->outputCbJQuery("showCBTab( '" . addslashes(urldecode(stripslashes(cbGetParam($_REQUEST, 'tab')))) . "' );"); } ?> </div> <?php }
function finishInstallation($option) { global $_CB_framework, $ueConfig, $task; // Try extending time, as unziping/ftping took already quite some... : @set_time_limit(240); _CBsecureAboveForm('finishInstallation'); $tgzFile = $_CB_framework->getCfg('absolute_path') . '/administrator/components/com_comprofiler/pluginsfiles.tgz'; $installerFile = $_CB_framework->getCfg('absolute_path') . '/administrator/components/com_comprofiler/'; if (file_exists($installerFile . 'comprofiler.xml')) { $installerFile .= 'comprofiler.xml'; } elseif (file_exists($installerFile . 'comprofilej.xml')) { $installerFile .= 'comprofilej.xml'; } elseif (file_exists($installerFile . 'comprofileg.xml')) { $installerFile .= 'comprofileg.xml'; } if (!file_exists($tgzFile)) { echo CBTxt::T('UE_NOT_AUTHORIZED', 'You are not authorized to view this page!'); return; } $installer = new cbInstallerPlugin(); $client = 2; // Check that the zlib is available if (!extension_loaded('zlib')) { cbInstaller::renderInstallMessage(CBTxt::T('The installer cannot continue before zlib is installed'), CBTxt::T('Installer - Error'), $installer->returnTo($option, $task, $client)); return; } if (!$installer->upload($tgzFile, true, false)) { cbInstaller::renderInstallMessage(sprintf(CBTxt::T('Uncompressing %s failed.'), $tgzFile), CBTxt::T('Installer - Error'), $installer->returnTo($option, '', 2)); return; } $adminFS = cbAdminFileSystem::getInstance(); $installFrom = $installer->installDir(); $filesList = cbReadDirectory($installFrom, '.', true); // check if core directories exist as are needed to install plugins: $baseDir = $_CB_framework->getCfg('absolute_path') . '/components/com_comprofiler'; if (!$adminFS->is_dir($baseDir . '/plugin')) { if (!$adminFS->mkdir($baseDir . '/plugin')) { cbInstaller::renderInstallMessage(sprintf(CBTxt::T('Failed to create directory "%s"'), $baseDir . '/plugin'), CBTxt::T('Installer - Error'), $installer->returnTo($option, '', 2)); return; } if (!$adminFS->copy($baseDir . '/index.html', $baseDir . '/plugin/index.html')) { cbInstaller::renderInstallMessage(sprintf(CBTxt::T('Failed to create index "%s"'), $baseDir . '/plugin/index.html'), CBTxt::T('Installer - Error'), $installer->returnTo($option, '', 2)); return; } } if (!$adminFS->is_dir($baseDir . '/plugin/language')) { if (!$adminFS->mkdir($baseDir . '/plugin/language')) { cbInstaller::renderInstallMessage(sprintf(CBTxt::T('Failed to create directory "%s"'), $baseDir . '/plugin/language'), CBTxt::T('Installer - Error'), $installer->returnTo($option, '', 2)); return; } if (!$adminFS->copy($baseDir . '/index.html', $baseDir . '/plugin/language/index.html')) { cbInstaller::renderInstallMessage(sprintf(CBTxt::T('Failed to create index "%s"'), $baseDir . '/plugin/language/index.html'), CBTxt::T('Installer - Error'), $installer->returnTo($option, '', 2)); return; } } if (!$adminFS->is_dir($baseDir . '/plugin/templates')) { if (!$adminFS->mkdir($baseDir . '/plugin/templates')) { cbInstaller::renderInstallMessage(sprintf(CBTxt::T('Failed to create directory "%s"'), $baseDir . '/plugin/templates'), CBTxt::T('Installer - Error'), $installer->returnTo($option, '', 2)); return; } if (!$adminFS->copy($baseDir . '/index.html', $baseDir . '/plugin/templates/index.html')) { cbInstaller::renderInstallMessage(sprintf(CBTxt::T('Failed to create index "%s"'), $baseDir . '/plugin/templates/index.html'), CBTxt::T('Installer - Error'), $installer->returnTo($option, '', 2)); return; } } if (!$adminFS->is_dir($baseDir . '/plugin/user')) { if (!$adminFS->mkdir($baseDir . '/plugin/user')) { cbInstaller::renderInstallMessage(sprintf(CBTxt::T('Failed to create directory "%s"'), $baseDir . '/plugin/user'), CBTxt::T('Installer - Error'), $installer->returnTo($option, '', 2)); return; } if (!$adminFS->copy($baseDir . '/index.html', $baseDir . '/plugin/user/index.html')) { cbInstaller::renderInstallMessage(sprintf(CBTxt::T('Failed to create index "%s"'), $baseDir . '/plugin/user/index.html'), CBTxt::T('Installer - Error'), $installer->returnTo($option, '', 2)); return; } } // install core plugins: foreach ($filesList as $file) { if (preg_match('/^.+\\.xml$/i', $file)) { $plgPath = $installFrom . (substr($installFrom, -1, 1) == '/' ? '' : '/') . $file; $plgXml = new \CBLib\Xml\SimpleXMLElement(trim(file_get_contents($plgPath))); if ($plgXml->getName() == 'cbinstall') { $plgDir = dirname($plgPath) . '/'; $plgInstaller = new cbInstallerPlugin(); if (!$plgInstaller->install($plgDir)) { cbInstaller::renderInstallMessage(sprintf(CBTxt::T('Installing plugin failed with error: %s : %s'), $plgInstaller->i_elementname ? $plgInstaller->i_elementname : $file, $plgInstaller->getError()), CBTxt::T('Installer - Error'), $installer->returnTo($option, '', 2)); return; } } } } $result = $adminFS->deldir(_cbPathName($installFrom . '/')); if ($result === false) { cbInstaller::renderInstallMessage(CBTxt::T('Deleting expanded tgz file directory failed with an error.'), CBTxt::T('Installer - Error'), $installer->returnTo($option, '', 2)); } $tgzFileOS = _cbPathName($tgzFile, false); $result = $adminFS->unlink($tgzFileOS); if ($result === false) { cbInstaller::renderInstallMessage(sprintf(CBTxt::T('Deleting file %s failed with an error.'), $tgzFileOS), CBTxt::T('Installer - Error'), $installer->returnTo($option, '', 2)); } // adapt published fields to global CB config (regarding name type) _cbAdaptNameFieldsPublished($ueConfig); $htmlToDisplay = $_CB_framework->getUserState('com_comprofiler_install'); // clears the session buffer memory after installaion done: $_CB_framework->setUserState('com_comprofiler_install', ''); $installerXml = new SimpleXMLElement(file_get_contents($installerFile)); if (is_object($installerXml)) { $description = $installerXml->getElementByPath('description'); if ($description !== false) { echo '<h2>' . $description->data() . '</h2>'; } } echo $htmlToDisplay; echo '<div style="color:green;font-size:18px;font-weight:bold;margin-top:15px;margin-bottom:15px;">' . CBTxt::Th('Installation done.') . '</div>' . '<div style="color:green;font-size:18px;font-weight:bold;margin-top:15px;margin-bottom:15px;">' . CBTxt::Th('Now is a great time to checkout the <a href="[help_url]" target="_blank">Getting Started</a> resources.', null, array('[help_url]' => 'http://www.joomlapolis.com/documentation/community-builder/getting-started?pk_campaign=in-cb&pk_kwd=installedwelcomescreen')) . '</div>' . '<div style="margin-bottom:10px;">' . '<div style="font-size:12px;"><a href="http://www.joomlapolis.com/cb-solutions?pk_campaign=in-cb&pk_kwd=installedwelcomescreen" target="_blank">' . CBTxt::Th('Click here to see more CB Plugins (Languages, Fields, Tabs, Signup-Connect, Paid Memberships and over 30 more) by CB Team at joomlapolis.com') . '</a></div>' . '<div style="font-size:12px;"><a href="http://extensions.joomla.org/extensions/clients-a-communities/communities/210" target="_blank">' . CBTxt::Th('Click here to see our CB listing on the Joomla! Extensions Directory (JED) and find third-party add-ons for your website.') . '</a></div>' . '<div style="font-size:12px;margin:10px 0 25px;">or <a href="index.php?option=com_comprofiler&view=showconfig" class="btn btn-primary">' . CBTxt::Th('Start to Configure Community Builder') . '</a></div>' . '</div>'; $_CB_framework->setUserState("com_comprofiler_install", ''); }
function showUsers(&$rows, &$pageNav, $search, $option, &$lists, &$pluginColumns, $inputTextExtras, $searchTabContent, $canAdmin, $canManage, $canCreate, $canEdit, $canEditOwn, $canEditState) { global $_CB_framework; _CBsecureAboveForm('showUsers'); outputCbTemplate(2); outputCbJs(2); global $_CB_Backend_Title; $_CB_Backend_Title = array(0 => array('cbicon-48-user', CBTxt::T('CB User Manager'))); /* * Auto-submission was a pain: added 2 buttons in advanced search. ob_start(); $('#cbUserListsSearcher select,#cbUserListsSearcher input,#cbUserListsSearcher textarea').live('change', function() { if ( $(this).parent('div').hasClass('cbSearchKind') ) { if ( $(this).val() == '' ) { $(this).parents('form')[0].submit(); } } else { $(this).parents('form')[0].submit(); } }); $cbjavascript = ob_get_contents(); ob_end_clean(); $_CB_framework->outputCbJQuery( $cbjavascript ); */ $_CB_framework->outputCbJQuery(''); $colspans = 13 + count($pluginColumns); ?> <form action="<?php echo $_CB_framework->backendUrl('index.php'); ?> " method="post" name="adminForm" class="cb_form" id="cbshowusersform"> <?php $this->_userslistFilters($search, $lists, $inputTextExtras, $searchTabContent); ?> <table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist"> <thead> <tr> <th align="center" colspan="<?php echo $colspans; ?> "> <?php echo $pageNav->writePagesLinks(); ?> </th> </tr> <tr> <th width="1%" class="title"><?php echo CBTxt::T('#'); ?> </th> <th width="3%" class="title"> <input type="checkbox" name="toggle" value="" <?php echo 'onClick="cbToggleAll( this, ' . count($rows) . ', \'cb\' );"'; ?> /> </th> <th width="23%" class="title"><?php echo CBTxt::T('Name'); ?> </th> <th width="12%" class="title"><?php echo CBTxt::T('UserName'); ?> </th> <th width="3%" class="title" nowrap="nowrap"><?php echo CBTxt::T('Logged In'); ?> </th> <?php foreach ($pluginColumns as $name => $content) { ?> <th width="15%" class="title"><?php echo $name; ?> </th> <?php } ?> <th width="12%" class="title"><?php echo CBTxt::T('Group'); ?> </th> <th width="13%" class="title"><?php echo CBTxt::T('E-Mail'); ?> </th> <th width="8%" class="title"><?php echo CBTxt::T('Registered'); ?> </th> <th width="8%" class="title" nowrap="nowrap"><?php echo CBTxt::T('Last Visit'); ?> </th> <th width="3%" class="title"><?php echo CBTxt::T('Enabled'); ?> </th> <th width="3%" class="title"><?php echo CBTxt::T('Confirmed'); ?> </th> <th width="3%" class="title"><?php echo CBTxt::T('Approved'); ?> </th> <th width="1%" class="title"><?php echo CBTxt::T('ID'); ?> </th> </tr> </thead> <tbody> <?php $k = 0; $imgpath = '../components/com_comprofiler/images/'; for ($i = 0, $n = count($rows); $i < $n; $i++) { $row =& $rows[$i]; $img = $row->block ? 'publish_x.png' : 'tick.png'; $task = $row->block ? 'unblock' : 'block'; $hover1 = $row->block ? CBTxt::T('Blocked') : CBTxt::T('Enabled'); switch ($row->approved) { case 0: $img2 = 'pending.png'; $task2 = 'approve'; $hover = CBTxt::T('Pending Approval'); break; case 1: $img2 = 'tick.png'; $task2 = 'reject'; $hover = CBTxt::T('Approved'); break; case 2: $img2 = 'publish_x.png'; $task2 = 'approve'; $hover = CBTxt::T('Rejected'); break; } $img3 = $row->confirmed ? 'tick.png' : 'publish_x.png'; // $task3 = $row->confirmed ? 'reject' : 'approve'; $hover3 = $row->confirmed ? CBTxt::T('confirmed') : CBTxt::T('unconfirmed'); ?> <tr class="<?php echo "row{$k}"; ?> "> <td><?php echo $i + 1 + $pageNav->limitstart; ?> </td> <td> <input type="checkbox" id="cb<?php echo $i; ?> " name="cid[]" value="<?php echo $row->id; ?> " onClick="cbIsChecked(this.checked);" /> </td> <td> <?php if ($canEdit && $row->id != $_CB_framework->myId() || $canEditOwn && $row->id == $_CB_framework->myId()) { ?> <a href="#edit" onClick="return cbListItemTask( this, 'edit', null, null, 'cb', '<?php echo $i; ?> ' )"> <?php echo htmlspecialchars($row->name); ?> </a> <?php } else { echo htmlspecialchars($row->name); } if (checkJversion() >= 2) { ?> <div class="fltrt"> <?php if (version_compare(checkJversion('release'), '2.5', '>=') && $canManage) { if ($row->note_count) { // Filter notes: echo '<a href="' . JRoute::_('index.php?option=com_users&view=notes&filter_search=uid:' . (int) $row->id) . '">' . JHtml::_('image', 'admin/filter_16.png', 'COM_USERS_NOTES', array('title' => JText::_('COM_USERS_FILTER_NOTES'), 'height' => '16', 'width' => '16'), true) . '</a>'; // Show notes: echo '<a class="modal"' . ' href="' . JRoute::_('index.php?option=com_users&view=notes&tmpl=component&layout=modal&u_id=' . (int) $row->id) . '"' . ' rel="{handler: \'iframe\', size: {x: 800, y: 450}}">' . JHtml::_('image', 'menu/icon-16-user-note.png', 'COM_USERS_NOTES', array('title' => JText::plural('COM_USERS_N_USER_NOTES', $row->note_count), 'height' => '16', 'width' => '16'), true) . '</a>'; } if ($canCreate) { echo '<a href="' . JRoute::_('index.php?option=com_users&task=note.add&u_id=' . (int) $row->id) . '">' . JHtml::_('image', 'admin/note_add_16.png', 'COM_USERS_NOTES', array('title' => JText::_('COM_USERS_ADD_NOTE'), 'height' => '16', 'width' => '16'), true) . '</a>'; } } ?> </div> <?php if (($_CB_framework->acl->amIaSuperAdmin() || $canAdmin && $canManage) && $_CB_framework->getCfg('debug')) { ?> <div class="fltrt"> <a href="<?php echo JRoute::_('index.php?option=com_users&view=debuguser&user_id=' . (int) $row->id); ?> "> <?php echo JHtml::_('image', 'menu/icon-16-stats.png', 'COM_USERS_DEBUG_USER', array('title' => JText::_('COM_USERS_DEBUG_USER'), 'height' => '16', 'width' => '16'), true); ?> </a></div> <?php } } ?> </td> <td><?php echo htmlspecialchars($row->username); ?> </td> <td align="center"><?php echo $row->loggedin ? '<img src="' . $imgpath . 'tick.png" width="16" height="16" border="0" alt="" />' : ''; ?> </td> <?php foreach ($pluginColumns as $name => $content) { ?> <td><?php echo $content[$row->id]; ?> </td> <?php } ?> <td><?php echo $row->groupname; ?> </td> <td><a href="mailto:<?php echo htmlspecialchars($row->email); ?> "><?php echo htmlspecialchars($row->email); ?> </a></td> <td><?php echo cbFormatDate($row->registerDate); ?> </td> <td><?php echo cbFormatDate($row->lastvisitDate); ?> </td> <td width="10%"> <?php if ($canEditState) { ?> <a href="javascript: void(0);" onClick="return cbListItemTask( this, '<?php echo $task; ?> ', null, null, 'cb', '<?php echo $i; ?> ' )"> <?php } ?> <img src="<?php echo $imgpath . $img; ?> " width="16" height="16" border="0" title="<?php echo $hover1; ?> " alt="<?php echo $hover1; ?> " /> <?php if ($canEditState) { ?> </a> <?php } ?> </td> <td width="10%"> <img src="<?php echo $imgpath . $img3; ?> " width="16" height="16" border="0" title="<?php echo $hover3; ?> " alt="<?php echo $hover3; ?> " /> </td> <td width="10%"> <?php if ($canEditState) { ?> <a href="javascript: void(0);" onClick="return cbListItemTask( this, '<?php echo $task2; ?> ', null, null, 'cb', '<?php echo $i; ?> ' )"> <?php } ?> <img src="<?php echo $imgpath . $img2; ?> " width="16" height="16" border="0" title="<?php echo $hover; ?> " alt="<?php echo $hover; ?> " /> <?php if ($canEditState) { ?> </a> <?php } ?> </td> <td><?php echo $row->id; ?> </td> </tr> <?php $k = 1 - $k; } ?> </tbody> <tfoot> <tr> <th align="center" colspan="<?php echo $colspans; ?> "> <?php echo $pageNav->getListFooter(); ?> </th> </tr> </tfoot> </table> <input type="hidden" name="option" value="<?php echo $option; ?> " /> <input type="hidden" name="task" value="showusers" /> <input type="hidden" name="boxchecked" value="0" /> <?php echo cbGetSpoofInputTag('user'); ?> </form> <?php }
/** * Sends legacy mass mailer * * @deprecated 2.0 * * @param UserTable[] $rows * @param string $emailSubject * @param string $emailBody * @param string $emailAttach * @param string $emailFromName * @param string $emailFromAddr * @param string $emailReplyName * @param string $emailReplyAddr * @param int $emailsPerBatch * @param int $emailsBatch * @param int $emailPause * @param bool $simulationMode * @param array $pluginRows * @return void */ public function startEmailUsers($rows, $emailSubject, $emailBody, $emailAttach, $emailFromName, $emailFromAddr, $emailReplyName, $emailReplyAddr, $emailsPerBatch, $emailsBatch, $emailPause, $simulationMode, $pluginRows) { global $_CB_framework, $_CB_Backend_Title; _CBsecureAboveForm('showUsers'); outputCbTemplate(2); outputCbJs(2); $_CB_Backend_Title = array(0 => array('fa fa-envelope-o', CBTxt::T('Community Builder: Sending Mass Mailer'))); $userIds = array(); foreach ($rows as $row) { $userIds[] = (int) $row->id; } $cbSpoofField = cbSpoofField(); $cbSpoofString = cbSpoofString(null, 'cbadmingui'); $regAntiSpamFieldName = cbGetRegAntiSpamFieldName(); $regAntiSpamValues = cbGetRegAntiSpams(); cbGetRegAntiSpamInputTag($regAntiSpamValues); $maximumBatches = count($rows) / $emailsPerBatch; if ($maximumBatches < 1) { $maximumBatches = 1; } $progressPerBatch = round(100 / $maximumBatches); $delayInMilliseconds = $emailPause ? 0 : $emailPause * 1000; $js = "var cbbatchemail = function( batch, emailsbatch, emailsperbatch ) {" . "\$.ajax({" . "type: 'POST'," . "url: '" . addslashes($_CB_framework->backendViewUrl('ajaxemailusers', false, array(), 'raw')) . "'," . "dataType: 'json'," . "data: {" . "emailsubject: '" . addslashes($emailSubject) . "'," . "emailbody: '" . addslashes(rawurlencode($emailBody)) . "'," . "emailattach: '" . addslashes($emailAttach) . "'," . "emailfromname: '" . addslashes($emailFromName) . "'," . "emailfromaddr: '" . addslashes($emailFromAddr) . "'," . "emailreplyname: '" . addslashes($emailReplyName) . "'," . "emailreplyaddr: '" . addslashes($emailReplyAddr) . "'," . "emailsperbatch: emailsperbatch," . "emailsbatch: emailsbatch," . "emailpause: '" . addslashes($emailPause) . "'," . "simulationmode: '" . addslashes($simulationMode) . "'," . "cid: " . json_encode($userIds) . "," . $cbSpoofField . ": '" . addslashes($cbSpoofString) . "'," . $regAntiSpamFieldName . ": '" . addslashes($regAntiSpamValues[0]) . "'" . "}," . "success: function( data, textStatus, jqXHR ) {" . "if ( data.result == 1 ) {" . "var progress = ( " . (int) $progressPerBatch . " * batch ) + '%';" . "\$( '#cbProgressIndicatorBar > .progress-bar' ).css({ width: progress });" . "\$( '#cbProgressIndicatorBar > .progress-bar > span' ).html( progress );" . "\$( '#cbProgressIndicator' ).html( data.htmlcontent );" . "setTimeout( cbbatchemail( ( batch + 1 ), ( emailsbatch + emailsperbatch ), emailsperbatch ), " . (int) $delayInMilliseconds . " );" . "} else if ( data.result == 2 ) {" . "\$( '#cbProgressIndicatorBar' ).removeClass( 'progress-striped active' );" . "\$( '#cbProgressIndicatorBar > .progress-bar' ).css({ width: '100%' });" . "\$( '#cbProgressIndicatorBar > .progress-bar' ).addClass( 'progress-bar-success' );" . "\$( '#cbProgressIndicatorBar > .progress-bar > span' ).html( '100%' );" . "\$( '#cbProgressIndicator' ).html( data.htmlcontent );" . "} else {" . "\$( '#cbProgressIndicatorBar' ).removeClass( 'progress-striped active' );" . "\$( '#cbProgressIndicatorBar > .progress-bar' ).css({ width: '100%' });" . "\$( '#cbProgressIndicatorBar > .progress-bar' ).addClass( 'progress-bar-danger' );" . "\$( '#cbProgressIndicatorBar > .progress-bar > span' ).html( '" . addslashes(CBTxt::T('Email failed to send')) . "' );" . "\$( '#cbProgressIndicator' ).html( data.htmlcontent );" . "}" . "}," . "error: function( jqXHR, textStatus, errorThrown ) {" . "\$( '#cbProgressIndicatorBar' ).removeClass( 'progress-striped active' );" . "\$( '#cbProgressIndicatorBar > .progress-bar' ).css({ width: '100%' });" . "\$( '#cbProgressIndicatorBar > .progress-bar' ).addClass( 'progress-bar-danger' );" . "\$( '#cbProgressIndicatorBar > .progress-bar > span' ).html( '" . addslashes(CBTxt::T('Email failed to send')) . "' );" . "\$( '#cbProgressIndicator' ).html( errorThrown );" . "}" . "});" . "};" . "cbbatchemail( 1, " . (int) $emailsBatch . ", " . (int) $emailsPerBatch . " );"; $_CB_framework->outputCbJQuery($js); $return = '<form action="' . $_CB_framework->backendUrl('index.php') . '" method="post" id="cbmailbatchform" name="adminForm" class="cb_form form-auto cbEmailUsersBatchForm">'; if ($simulationMode) { $return .= '<div class="form-group cb_form_line clearfix">' . '<label class="control-label col-sm-3">' . CBTxt::T('MASS_MAILER_SIMULATION_MODE_LABEL', 'Simulation Mode') . '</label>' . '<div class="cb_field col-sm-9">' . '<div><input type="checkbox" name="simulationmode" id="simulationmode" checked="checked" disabled="disabled" /> <label for="simulationmode">' . CBTxt::T('Do not send emails, just show me how it works') . '</label></div>' . '</div>' . '</div>'; } $return .= $this->_pluginRows($pluginRows) . '<div class="form-group cb_form_line clearfix">' . '<label class="control-label col-sm-3">' . CBTxt::T('SEND_EMAIL_TO_TOTAL_USERS', 'Send Email to [total] users', array('[total]' => (int) count($rows))) . '</label>' . '<div class="cb_field col-sm-9">' . '<div>' . '<div id="cbProgressIndicatorBar" class="progress progress-striped active">' . '<div class="progress-bar" style="width: 0%;">' . '<span></span>' . '</div>' . '</div>' . '<div id="cbProgressIndicator"></div>' . '</div>' . '</div>' . '</div>' . $this->_pluginRows($pluginRows); if (!$simulationMode) { $return .= '<input type="hidden" name="simulationmode" value="' . htmlspecialchars($simulationMode) . '" />'; } $return .= '<input type="hidden" name="option" value="com_comprofiler" />' . '<input type="hidden" name="view" value="ajaxemailusers" />' . '<input type="hidden" name="boxchecked" value="0" />'; foreach ($rows as $row) { $return .= '<input type="hidden" name="cid[]" value="' . (int) $row->id . '">'; } $return .= cbGetSpoofInputTag('user') . '</form>'; echo $return; }
function edittab(&$row, $option, &$lists, $tabid, &$paramsEditorHtml) { global $_CB_framework, $task, $_CB_database, $_PLUGINS; _CBsecureAboveForm('edittab'); outputCbTemplate(2); outputCbJs(2); initToolTip(2); $_CB_framework->outputCbJQuery(''); global $_CB_Backend_Title; $_CB_Backend_Title = array(0 => array('cbicon-48-tabs', CBTxt::T('Community Builder Tab') . ": <small>" . ($row->tabid ? CBTxt::T('Edit') . ' [ ' . htmlspecialchars(getLangDefinition($row->title)) . ' ]' : CBTxt::T('New')) . '</small>')); if ($row->tabid && !$row->enabled) { echo '<div class="cbWarning">' . CBTxt::T('Tab is not published') . '</div>' . "\n"; } $editorSave_description = $_CB_framework->saveCmsEditorJS('description'); ob_start(); ?> function submitbutton(pressbutton) { var form = document.adminForm; if (pressbutton == 'showTab') { <?php echo $editorSave_description; ?> cbsubmitform( pressbutton ); return; } var r = new RegExp("[^0-9A-Za-z]", "i"); // do field validation if (jQuery.trim(form.title.value) == "") { alert('<?php echo addslashes(CBTxt::T('You must provide a title.')); ?> '); } else { <?php echo $editorSave_description; ?> cbsubmitform( pressbutton ); } } <?php $js = ob_get_contents(); ob_end_clean(); $_CB_framework->document->addHeadScriptDeclaration($js); ?> <div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div> <form action="<?php echo $_CB_framework->backendUrl('index.php?option=com_comprofiler&task=saveTab'); ?> " method="POST" name="adminForm"> <table cellspacing="0" cellpadding="0" width="100%"> <tr valign="top"> <td width="60%" valign="top"> <table class="adminform"> <tr> <th colspan="3"> <?php echo CBTxt::T('Tab Details'); ?> </th> </tr> <tr> <td width="20%"><?php echo CBTxt::T('Title'); ?> :</td> <td width="35%"><input type="text" name="title" class="inputbox" size="40" value="<?php echo htmlspecialchars($row->title); ?> " /></td> <td width="45%"><?php echo CBTxt::T('Title as will appear on tab.'); ?> </td> </tr> <tr> <td colspan="3"><?php echo CBTxt::T('Description: This description appears only on user edit, not on profile (For profile text, use delimiter fields)'); ?> :</td> </tr> <tr> <td colspan="3" align="left"><?php echo $_CB_framework->displayCmsEditor('description', $row->description, 600, 200, 50, 10); // <textarea name="description" class="inputbox" cols="40" rows="10">< ?php echo htmlspecialchars( $row->description ); ? ></textarea> ?> </td> </tr> <tr> <td><?php echo CBTxt::T('Publish'); ?> :</td> <td><?php echo $lists['enabled']; ?> </td> <td> </td> </tr> <tr> <td><?php echo CBTxt::T('Profile ordering'); ?> :</td> <td><?php echo $lists['ordering']; ?> </td> <td><?php echo CBTxt::T('Tabs and fields on profile are ordered as follows:'); ?> <ol> <li><?php echo CBTxt::T('position of tab on user profile (top-down, left-right)'); ?> </li> <li><?php echo CBTxt::T('This ordering of tab on position of user profile'); ?> </li> <li><?php echo CBTxt::T('ordering of field within tab position of user profile.'); ?> </li></ol> </td> </tr> <tr> <td><?php echo CBTxt::T('Registration ordering'); ?> <br /><?php echo CBTxt::T('(default value: 10)'); ?> :</td> <td><?php echo $lists['ordering_register']; ?> </td> <td><?php echo CBTxt::T('Tabs and fields on registration are ordered as follows:'); ?> <ol> <li><?php echo CBTxt::T('This registration ordering of tab'); ?> </li> <li><?php echo CBTxt::T('position of tab on user profile (top-down, left-right)'); ?> </li> <li><?php echo CBTxt::T('ordering of tab on position of user profile'); ?> </li> <li><?php echo CBTxt::T('ordering of field within tab position of user profile.'); ?> </li></ol> </td> </tr> <tr> <td><?php echo CBTxt::T('Position'); ?> :</td> <td><?php echo $lists['position']; ?> </td> <td><?php echo CBTxt::T('Position on profile and ordering on registration.'); ?> </td> </tr> <tr> <td><?php echo CBTxt::T('Display type'); ?> :</td> <td><?php echo $lists['displaytype']; ?> </td> <td><?php echo CBTxt::T('In which way the content of this tab will be displayed on the profile.'); ?> </td> </tr> <tr> <td><?php echo CBTxt::Th('View Access Level'); ?> :</td> <td><?php echo $lists['viewaccesslevel']; ?> </td> <td><?php echo CBTxt::Th('Only users which are in groups assigned to this View Access Level will see this tab.') . ($lists['useraccessgroup'] ? ' (' . CBTxt::Th('New method working in all Joomla and Mambo versions') . ')' : ''); ?> </td> </tr> <?php if ($lists['useraccessgroup']) { ?> <tr> <td><?php echo CBTxt::Th('User Group to allow access to') . (checkJversion() >= 2 ? '<br /><em>(' . CBTxt::Th("Old deprecated method of Joomla 1.5, do not use here") . '. ' . CBTxt::Th('Keep setting "-- Everybody --" and Use View Access Level above instead') . ')</em>' : ''); ?> :</td> <td><?php echo $lists['useraccessgroup']; ?> </td> <td><?php echo CBTxt::Ph('Old Joomla [VERSION] method', array('[VERSION]' => '1.0 and 1.5 and Mambo')) . ': ' . CBTxt::Th('This method is kept for backwards compatibility but will be removed at next major Community Builder version.') . '<br />' . CBTxt::Th('Use View Access Level above instead and set this Group setting to - "Everybody" -.') . ' ' . CBTxt::Th('All groups above that level will also have access to this tab.'); ?> </td> </tr> <?php } ?> </table> </td> <td width="40%"> <table class="adminform"> <tr> <th colspan="2"> <?php echo CBTxt::T('Parameters'); ?> </th> </tr> <tr> <td> <?php if ($row->tabid && $row->pluginid > 0) { $plugin = new moscomprofilerPlugin($_CB_database); $plugin->load((int) $row->pluginid); // fail if checked out not by 'me' if ($plugin->checked_out && $plugin->checked_out != $_CB_framework->myId()) { echo "<script type=\"text/javascript\">alert('" . addslashes(sprintf(CBTxt::T('The plugin %s is currently being edited by another administrator'), $plugin->name)) . "'); document.location.href='" . $_CB_framework->backendUrl("index.php?option={$option}") . "'</script>\n"; exit(0); } // get params values if ($plugin->type !== "language" && $plugin->id) { $_PLUGINS->loadPluginGroup($plugin->type, array((int) $plugin->id), 0); } $element = $_PLUGINS->loadPluginXML('editTab', $row->pluginclass, $plugin->id); /* $xmlfile = $_CB_framework->getCfg('absolute_path') . '/components/com_comprofiler/plugin/' .$plugin->type . '/'.$plugin->folder . '/' . $plugin->element .'.xml'; // $params = new cbParameters( $row->params, $xmlfile ); cbimport('cb.xml.simplexml'); $xmlDoc = new CBSimpleXML(); if ( $xmlDoc->loadFile( $xmlfile ) ) { $element =& $xmlDoc->document; } else { $element = null; } */ $pluginParams = new cbParamsBase($plugin->params); $params = new cbParamsEditorController($row->params, $element, $element, $plugin, $row->tabid); $params->setPluginParams($pluginParams); $options = array('option' => $option, 'task' => $task, 'pluginid' => $row->pluginid, 'tabid' => $row->tabid); $params->setOptions($options); echo $params->draw('params', 'tabs', 'tab', 'class', $row->pluginclass); } else { echo '<em>' . CBTxt::T('No Parameters') . '</em>'; } 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 } } ?> </td> </tr> </table> </td> </tr> </table> <input type="hidden" name="tabid" value="<?php echo $row->tabid; ?> " /> <input type="hidden" name="option" value="<?php echo $option; ?> " /> <input type="hidden" name="task" value="" /> <?php if (!$lists['useraccessgroup']) { ?> <input type="hidden" name="useraccessgroupid" value="-2" /> <?php } echo cbGetSpoofInputTag('tab'); ?> </form> <?php }
static function secureAboveForm( $functionName ) { return _CBsecureAboveForm( $functionName ); }
/** * Writes the edit form for new and existing module * * A new record is defined when <var>$row</var> is passed with the <var>id</var> * property set to 0. * @param moscomprofilerPlugin $row * @param array of string $lists An array of select lists * @param cbParamsEditor $params * @param string $option of component. * */ function editPlugin(&$row, &$lists, &$params, $options) { global $_CB_framework, $_PLUGINS; _CBsecureAboveForm('editPlugin'); outputCbTemplate(2); outputCbJs(2); initToolTip(2); $nameA = ''; $filesInstalled = true; if ($row->id) { $nameA = '[ ' . htmlspecialchars(getLangDefinition($row->name)) . ' ]'; $xmlfile = $_PLUGINS->getPluginXmlPath($row); $filesInstalled = file_exists($xmlfile); } global $_CB_Backend_Title; $_CB_Backend_Title = array(0 => array('cbicon-48-plugins', CBTxt::T('Community Builder Plugin') . ": <small>" . ($row->id ? CBTxt::T('Edit') . ' ' . $nameA : CBTxt::T('New')) . '</small>')); if ($row->id && !$row->published) { echo '<div class="cbWarning">' . CBTxt::T('Plugin is not published') . '</div>' . "\n"; } ?> <form action="<?php echo $_CB_framework->backendUrl('index.php'); ?> " method="post" name="adminForm"> <table cellspacing="0" cellpadding="0" width="100%"> <tr valign="top"> <td width="60%" valign="top"> <table class="adminform"> <tr> <th colspan="2"> <?php echo CBTxt::T('Plugin Common Settings'); ?> </th> </tr> <tr> <td width="100" align="left"> <?php echo CBTxt::T('Name'); ?> : </td> <td> <input class="text_area" type="text" name="name" size="35" value="<?php echo htmlspecialchars($row->name); /* ideally a translation of this field should be given and this field be not editable */ ?> " /> </td> </tr> <tr> <td valign="top" align="left"> <?php echo CBTxt::T('Plugin Order'); ?> : </td> <td> <?php echo $lists['ordering']; ?> </td> </tr> <tr> <td valign="top" align="left"> <?php echo CBTxt::T('Access Level'); ?> : </td> <td> <?php echo $lists['access']; ?> </td> </tr> <tr> <td valign="top"> <?php echo CBTxt::T('Published'); ?> : </td> <td> <?php echo $lists['published']; ?> </td> </tr> <tr> <td valign="top" colspan="2"> </td> </tr> <tr> <td valign="top"> <?php echo CBTxt::T('Description'); ?> : </td> <td> <?php echo CBTxt::T($row->description); ?> </td> </tr> <tr> <td valign="top" align="left"> <?php echo CBTxt::T('Folder / File'); ?> : </td> <td> <?php echo $lists['type'] . "/" . htmlspecialchars($row->element) . ".php"; ?> </td> </tr> </table> <?php if ($filesInstalled && $row->id) { $settingsHtml = $params->draw('params', 'views', 'view', 'type', 'settings'); if ($settingsHtml) { ?> <table class="adminform"> <tr> <th> <?php echo htmlspecialchars($row->name); ?> <?php echo CBTxt::T('Specific Plugin Settings'); ?> </th> </tr> <tr> <td width="100%" align="left"><?php echo $settingsHtml; ?> </td> </tr> </table> <?php } } ?> </td> <td width="40%"> <table class="adminform" cellspacing="0" cellpadding="0" width="100%"> <tr> <th colspan="2"> <?php echo CBTxt::T('Parameters'); ?> </th> </tr> <tr> <td> <?php if ($filesInstalled && $row->id) { echo $params->draw(); } elseif (!$filesInstalled) { echo '<strong><font style="color:red;">' . CBTxt::T('Plugin not installed') . '</font></strong><br />'; echo $params->draw(); } else { echo '<em>' . CBTxt::T('No Parameters') . '</em>'; } ?> </td> </tr> </table> </td> </tr> </table> <input type="hidden" name="option" value="<?php echo $options['option']; ?> " /> <input type="hidden" name="id" value="<?php echo $row->id; ?> " /> <input type="hidden" name="task" value="editPlugin" /> <?php echo cbGetSpoofInputTag('plugin'); ?> </form> <?php }
function showUsers( &$rows, &$pageNav, $search, $option, &$lists, &$pluginColumns, $inputTextExtras, $searchTabContent ) { global $_CB_framework; _CBsecureAboveForm('showUsers'); outputCbTemplate( 2 ); outputCbJs( 2 ); global $_CB_Backend_Title; $_CB_Backend_Title = array( 0 => array( 'cbicon-48-user', CBTxt::T('CB User Manager') ) ); /* * Auto-submission was a pain: added 2 buttons in advanced search. ob_start(); $('#cbUserListsSearcher select,#cbUserListsSearcher input,#cbUserListsSearcher textarea').live('change', function() { if ( $(this).parent('div').hasClass('cbSearchKind') ) { if ( $(this).val() == '' ) { $(this).parents('form')[0].submit(); } } else { $(this).parents('form')[0].submit(); } }); $cbjavascript = ob_get_contents(); ob_end_clean(); $_CB_framework->outputCbJQuery( $cbjavascript ); */ $_CB_framework->outputCbJQuery( '' ); $colspans = 13 + count( $pluginColumns ); ?> <form action="<?php echo $_CB_framework->backendUrl( 'index.php' ); ?>" method="post" name="adminForm" class="cb_form" id="cbshowusersform"> <?php $this->_userslistFilters( $search, $lists, $inputTextExtras, $searchTabContent ); ?> <table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist"> <thead> <tr> <th align="center" colspan="<?php echo $colspans; ?>"> <?php echo $pageNav->writePagesLinks(); ?></th> </tr> <tr> <th width="1%" class="title"><?php echo CBTxt::T('#'); ?></th> <th width="3%" class="title"> <input type="checkbox" name="toggle" value="" <?php echo 'onClick="checkAll(' . count($rows) . ');"'; ?> /> </th> <th width="15%" class="title"><?php echo CBTxt::T('Name'); ?></th> <th width="10%" class="title"><?php echo CBTxt::T('UserName'); ?></th> <th width="5%" class="title" nowrap="nowrap"><?php echo CBTxt::T('Logged In'); ?></th> <?php foreach ( $pluginColumns as $name => $content ) { ?> <th width="15%" class="title"><?php echo $name; ?></th> <?php } ?> <th width="15%" class="title"><?php echo CBTxt::T('Group'); ?></th> <th width="15%" class="title"><?php echo CBTxt::T('E-Mail'); ?></th> <th width="10%" class="title"><?php echo CBTxt::T('Registered'); ?></th> <th width="10%" class="title" nowrap="nowrap"><?php echo CBTxt::T('Last Visit'); ?></th> <th width="5%" class="title"><?php echo CBTxt::T('Enabled'); ?></th> <th width="5%" class="title"><?php echo CBTxt::T('Confirmed'); ?></th> <th width="5%" class="title"><?php echo CBTxt::T('Approved'); ?></th> <th width="1%" class="title"><?php echo CBTxt::T('ID'); ?></th> </tr> </thead> <tbody> <?php $k = 0; $imgpath='../components/com_comprofiler/images/'; for ($i=0, $n=count( $rows ); $i < $n; $i++) { $row =& $rows[$i]; $img = $row->block ? 'publish_x.png' : 'tick.png'; $task = $row->block ? 'unblock' : 'block'; $hover1 = $row->block ? CBTxt::T('Blocked') : CBTxt::T('Enabled'); switch ($row->approved) { case 0: $img2 = 'pending.png'; $task2 = 'approve'; $hover = CBTxt::T('Pending Approval'); break; case 1: $img2 = 'tick.png'; $task2 = 'reject'; $hover = CBTxt::T('Approved'); break; case 2: $img2 = 'publish_x.png'; $task2 = 'approve'; $hover = CBTxt::T('Rejected'); break; } $img3 = $row->confirmed ? 'tick.png' : 'publish_x.png'; // $task3 = $row->confirmed ? 'reject' : 'approve'; $hover3 = $row->confirmed ? CBTxt::T('confirmed') : CBTxt::T('unconfirmed'); ?> <tr class="<?php echo "row$k"; ?>"> <td><?php echo $i+1+$pageNav->limitstart;?></td> <td><input type="checkbox" id="cb<?php echo $i;?>" name="cid[]" value="<?php echo $row->id; ?>" onClick="isChecked(this.checked);" /></td> <td> <a href="#edit" onClick="return listItemTask('cb<?php echo $i;?>','edit')"> <?php echo $row->name; ?> </a> </td> <td><?php echo $row->username; ?></td> <td align="center"><?php echo $row->loggedin ? '<img src="' . $imgpath . 'tick.png" width="16" height="16" border="0" alt="" />': ''; ?></td> <?php foreach ( $pluginColumns as $name => $content ) { ?> <td><?php echo $content[$row->id]; ?></td> <?php } ?> <td><?php echo $row->groupname; ?></td> <td><a href="mailto:<?php echo htmlspecialchars( $row->email ); ?>"><?php echo htmlspecialchars( $row->email ); ?></a></td> <td><?php echo cbFormatDate( $row->registerDate ); ?></td> <td><?php echo cbFormatDate( $row->lastvisitDate ); ?></td> <td width="10%"><a href="javascript: void(0);" onClick="return listItemTask('cb<?php echo $i;?>','<?php echo $task;?>')"><img src="<?php echo $imgpath.$img;?>" width="16" height="16" border="0" title="<?php echo $hover1; ?>" alt="<?php echo $hover1; ?>" /></a></td> <td width="10%"><img src="<?php echo $imgpath.$img3;?>" width="16" height="16" border="0" title="<?php echo $hover3; ?>" alt="<?php echo $hover3; ?>" /></td> <td width="10%"><a href="javascript: void(0);" onClick="return listItemTask('cb<?php echo $i;?>','<?php echo $task2;?>')"><img src="<?php echo $imgpath.$img2;?>" width="16" height="16" border="0" title="<?php echo $hover; ?>" alt="<?php echo $hover; ?>" /></a></td> <td><?php echo $row->id; ?></td> </tr> <?php $k = 1 - $k; } ?> </tbody> <tfoot> <tr> <th align="center" colspan="<?php echo $colspans; ?>"> <?php echo $pageNav->getListFooter(); ?></th> </tr> </tfoot> </table> <input type="hidden" name="option" value="<?php echo $option;?>" /> <input type="hidden" name="task" value="showusers" /> <input type="hidden" name="boxchecked" value="0" /> <?php echo cbGetSpoofInputTag( 'user' ); ?> </form> <?php }