/** * render frontend overview * * @param object $rows * @param object $pageNav * @param moscomprofilerUser $user * @param object $plugin */ static function showOverview( $rows, $pageNav, $user, $plugin ) { global $_CB_framework; $generalTitle = $plugin->params->get( 'general_title', $plugin->name ); $_CB_framework->setPageTitle( cbgjClass::getOverride( 'category', true ) . ' ' . cbgjClass::getOverride( 'overview' ) ); if ( $generalTitle != '' ) { $_CB_framework->appendPathWay( htmlspecialchars( CBTxt::T( $generalTitle ) ), cbgjClass::getPluginURL() ); } $_CB_framework->appendPathWay( cbgjClass::getOverride( 'category', true ) . ' ' . cbgjClass::getOverride( 'overview' ), cbgjClass::getPluginURL( array( 'overview' ) ) ); $main = HTML_groupjiveOverviewMain::showOverviewMain( $rows, $pageNav, $user, $plugin ); $return = '<div class="gjOverview">'; if ( $plugin->params->get( 'general_panes', 1 ) ) { $return .= '<div class="gjHeader">' . HTML_groupjiveOverviewPanes::showOverviewPanes( $user, $plugin ) . '</div>' . '<div class="gjBody">' . $main . '</div>'; } else { $return .= $main; } $return .= '</div>'; echo $return; }
/** * output form validation jquery * * @param string $selector * @param string $params */ static function loadJquery( $selector, $params ) { global $_CB_framework; if ( ! $selector ) { $selector = '#gjForm'; } $js = "$( '" . addslashes( $selector ) . "' ).validate( {" . "submitHandler: function( form ) {" . "$( form ).find( 'input[type=\"submit\"]' ).attr( 'disabled', 'disabled' ).addClass( 'disabled' ).val( '" . addslashes( CBTxt::T( 'Loading...' ) ) . "' );" . "form.submit();" . "},"; if ( $params ) { $js .= $params . ( ( cbIsoUtf_substr( trim( $params ), -1 ) != ',' ) ? ',' : null ); } $js .= "ignoreTitle: true," . "errorClass: 'gjValidationError'," . "highlight: function( element, errorClass ) {" . "$( element ).parent().parent().addClass( 'error');" . "}," . "unhighlight: function( element, errorClass ) {" . "$( element ).parent().parent().removeClass( 'error' );" . "}," . "errorElement: 'div'," . "errorPlacement: function( error, element ) {" . "$( element ).parent().children().last().after( error );" . "}" . "});" . "$.extend( jQuery.validator.messages, {" . "required: '" . addslashes( CBTxt::T( 'This input is required.' ) ) . "'," . "remote: '" . addslashes( CBTxt::T( 'Please fix this input.' ) ) . "'," . "email: '" . addslashes( CBTxt::T( 'Please input a valid email address.' ) ) . "'," . "url: '" . addslashes( CBTxt::T( 'Please input a valid URL.' ) ) . "'," . "date: '" . addslashes( CBTxt::T( 'Please input a valid date.' ) ) . "'," . "dateISO: '" . addslashes( CBTxt::T( 'Please input a valid date (ISO).' ) ) . "'," . "number: '" . addslashes( CBTxt::T( 'Please input a valid number.' ) ) . "'," . "digits: '" . addslashes( CBTxt::T( 'Please input only digits.' ) ) . "'," . "creditcard: '" . addslashes( CBTxt::T( 'Please input a valid credit card number.' ) ) . "'," . "equalTo: '" . addslashes( CBTxt::T( 'Please input the same value again.' ) ) . "'," . "accept: '" . addslashes( CBTxt::T( 'Please input a value with a valid extension.' ) ) . "'," . "maxlength: $.validator.format('" . addslashes( CBTxt::T( 'Please input no more than {0} characters.' ) ) . "')," . "minlength: $.validator.format('" . addslashes( CBTxt::T( 'Please input at least {0} characters.' ) ) . "')," . "rangelength: $.validator.format('" . addslashes( CBTxt::T( 'Please input a value between {0} and {1} characters long.' ) ) . "')," . "range: $.validator.format('" . addslashes( CBTxt::T( 'Please input a value between {0} and {1}.' ) ) . "')," . "max: $.validator.format('" . addslashes( CBTxt::T( 'Please input a value less than or equal to {0}.' ) ) . "')," . "min: $.validator.format('" . addslashes( CBTxt::T( 'Please input a value greater than or equal to {0}.' ) ) . "')" . "});"; $_CB_framework->outputCbJQuery( $js, 'validate' ); }
/** * render frontend category message * * @param cbgjCategory $row * @param array $input * @param moscomprofilerUser $user * @param object $plugin */ static function showCategoryMessage( $row, $input, $user, $plugin ) { $row->setPathway( CBTxt::P( 'Message [groups]', array( '[groups]' => cbgjClass::getOverride( 'group', true ) ) ), cbgjClass::getPluginURL( array( 'categories', 'message', (int) $row->get( 'id' ) ) ) ); $return = '<div class="gjCategoryMessage">' . '<form action="' . cbgjClass::getPluginURL( array( 'categories', 'send', (int) $row->get( 'id' ) ) ) . '" method="post" enctype="multipart/form-data" name="gjForm" id="gjForm" class="gjForm form-horizontal">' . '<legend class="gjEditTitle">' . CBTxt::Ph( 'Message [groups]', array( '[groups]' => cbgjClass::getOverride( 'group', true ) ) ) . '</legend>' . '<div class="gjEditContentInput control-group">' . '<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Subject' ) . '</label>' . '<div class="gjEditContentInputField controls">' . $input['subject'] . '<span class="gjEditContentInputIcon help-inline">' . cbgjClass::getIcon( null, CBTxt::T( 'Required' ), 'icon-star' ) . cbgjClass::getIcon( CBTxt::P( 'Input [groups] message subject.', array( '[groups]' => cbgjClass::getOverride( 'group', true ) ) ) ) . '</span>' . '</div>' . '</div>' . '<div class="gjEditContentInput control-group">' . '<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Body' ) . '</label>' . '<div class="gjEditContentInputField controls">' . $input['body'] . '<span class="gjEditContentInputIcon help-inline">' . cbgjClass::getIcon( null, CBTxt::T( 'Required' ), 'icon-star' ) . cbgjClass::getIcon( CBTxt::P( 'Input [groups] message body.', array( '[groups]' => cbgjClass::getOverride( 'group', true ) ) ) ) . '</span>' . '</div>' . '</div>'; if ( $input['captcha'] !== false ) { $return .= '<div class="gjEditContentInput control-group">' . '<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Captcha' ) . '</label>' . '<div class="gjEditContentInputField controls">' . '<div style="margin-bottom: 5px;">' . $input['captcha']['code'] . '</div>' . '<div>' . $input['captcha']['input'] . '</div>' . '<span class="gjEditContentInputIcon help-inline">' . cbgjClass::getIcon( null, CBTxt::T( 'Required' ), 'icon-star' ) . '</span>' . '</div>' . '</div>'; } $return .= '<div class="gjButtonWrapper form-actions">' . '<input type="submit" value="' . htmlspecialchars( CBTxt::T( 'Send Message' ) ) . '" class="gjButton gjButtonSubmit btn btn-primary" /> ' . '<input type="button" value="' . htmlspecialchars( CBTxt::T( 'Cancel' ) ) . '" class="gjButton gjButtonCancel btn btn-mini" onclick="' . cbgjClass::getPluginURL( array( 'categories', 'show', (int) $row->get( 'id' ) ), CBTxt::T( 'Are you sure you want to cancel? All unsaved data will be lost!' ) ) . '" />' . '</div>' . cbGetSpoofInputTag( 'plugin' ) . '</form>' . '</div>'; echo $return; }
/** * render frontend overview message * * @param array $input * @param moscomprofilerUser $user * @param object $plugin */ static function showOverviewMessage( $input, $user, $plugin ) { global $_CB_framework; $generalTitle = $plugin->params->get( 'general_title', $plugin->name ); $pageTitle = CBTxt::P( 'Message [category]', array( '[category]' => cbgjClass::getOverride( 'category', true ) ) ); $_CB_framework->setPageTitle( htmlspecialchars( $pageTitle ) ); if ( $generalTitle != '' ) { $_CB_framework->appendPathWay( htmlspecialchars( CBTxt::T( $generalTitle ) ), cbgjClass::getPluginURL() ); } $_CB_framework->appendPathWay( htmlspecialchars( cbgjClass::getOverride( 'category', true ) . ' ' . cbgjClass::getOverride( 'overview' ) ), cbgjClass::getPluginURL( array( 'overview' ) ) ); $_CB_framework->appendPathWay( htmlspecialchars( $pageTitle ), cbgjClass::getPluginURL( array( 'overview', 'message' ) ) ); $return = '<div class="gjOverviewMessage">' . '<form action="' . cbgjClass::getPluginURL( array( 'overview', 'send' ) ) . '" method="post" enctype="multipart/form-data" name="gjForm" id="gjForm" class="gjForm form-horizontal">' . '<legend class="gjEditTitle">' . $pageTitle . '</legend>' . '<div class="gjEditContentInput control-group">' . '<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Subject' ) . '</label>' . '<div class="gjEditContentInputField controls">' . $input['subject'] . '<span class="gjEditContentInputIcon help-inline">' . cbgjClass::getIcon( null, CBTxt::T( 'Required' ), 'icon-star' ) . cbgjClass::getIcon( CBTxt::P( 'Input [categories] message subject.', array( '[categories]' => cbgjClass::getOverride( 'category', true ) ) ) ) . '</span>' . '</div>' . '</div>' . '<div class="gjEditContentInput control-group">' . '<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Body' ) . '</label>' . '<div class="gjEditContentInputField controls">' . $input['body'] . '<span class="gjEditContentInputIcon help-inline">' . cbgjClass::getIcon( null, CBTxt::T( 'Required' ), 'icon-star' ) . cbgjClass::getIcon( CBTxt::P( 'Input [categories] message body.', array( '[categories]' => cbgjClass::getOverride( 'category', true ) ) ) ) . '</span>' . '</div>' . '</div>' . '<div class="gjButtonWrapper form-actions">' . '<input type="submit" value="' . htmlspecialchars( CBTxt::T( 'Send Message' ) ) . '" class="gjButton gjButtonSubmit btn btn-primary" /> ' . '<input type="button" value="' . htmlspecialchars( CBTxt::T( 'Cancel' ) ) . '" class="gjButton gjButtonCancel btn btn-mini" onclick="' . cbgjClass::getPluginURL( array( 'overview' ), CBTxt::T( 'Are you sure you want to cancel? All unsaved data will be lost!' ) ) . '" />' . '</div>' . cbGetSpoofInputTag( 'plugin' ) . '</form>' . '</div>'; echo $return; }
/** * Generates HTML for expert kunena sidebar mode * * @param moscomprofilerUser $user * @param object $forum * @param object $model * @return mixed */ function ShowExpert( $user, $forum, $model, $params ) { $html = '<div>' . '<span class="view-username">' . $model->getFieldValue( $user, 'formatname', 'html', 'list' ) . '</span> ' . '<span class="msgusertype">(' . $user->usertype . ')</span>' . '</div>' . '<div>' . $model->getFieldValue( $user, 'avatar', 'html', 'list' ) . '</div>' . '<div class="viewcover">' . $model->getFieldValue( $user, 'forumrank' ) . '</div>' . '<div class="viewcover"><strong>' . CBTxt::T( 'Karma: ' ) . '</strong>' . $model->getFieldValue( $user, 'forumkarma' ) . '</div>' . '<div class="viewcover"><strong>' . CBTxt::T( 'Posts: ' ) . '</strong>' . $model->getFieldValue( $user, 'forumposts' ) . '</div>' . '<div>' . $model->getStatusIcon( $user ) . $model->getPMIcon( $user ) . $model->getProfileIcon( $user ) . '</div>'; return $html; }
/** * render frontend overview panes * * @param moscomprofilerUser $user * @param object $plugin * @return string */ static function showOverviewPanes( $user, $plugin ) { $overviewDesc = CBTxt::Th( $plugin->params->get( 'overview_desc', null ) ); $authorized = cbgjClass::getAuthorization( null, null, $user ); $categoryCount = count( cbgjData::getCategories( array( 'cat_access', 'mod_lvl1' ), array( 'parent', '=', 0 ) ) ); $return = '<legend class="gjHeaderTitle">' . cbgjClass::getOverride( 'category', true ) . ' ' . cbgjClass::getOverride( 'overview' ) . '</legend>' . '<div class="gjGrid row-fluid">' . '<div class="gjGridLeft span9">' . '<div class="gjGridLeftLogo span4">' . '<img alt="' . htmlspecialchars( CBTxt::T( 'Logo' ) ) . '" src="' . $plugin->livePath . '/images/' . $plugin->params->get( 'overview_logo', 'default_overview.png' ) . '" class="gjLogoDefault img-polaroid" />' . '</div>' . '<div class="gjGridLeftInfo span8">' . cbgjClass::getIntegrations( 'gj_onBeforeOverviewInfo', array( $user, $plugin ) ) . ( $categoryCount ? '<div>' . cbgjClass::getOverride( 'category', true ) . ': ' . $categoryCount . '</div>' : null ) . cbgjClass::getIntegrations( 'gj_onAfterOverviewInfo', array( $user, $plugin ) ) . '</div>'; if ( $overviewDesc ) { if ( $plugin->params->get( 'overview_desc_content', 0 ) ) { $overviewDesc = cbgjClass::prepareContentPlugins( $overviewDesc ); } $return .= '<div class="gjGridLeftDesc span12 well well-small">' . $overviewDesc . '</div>'; } $return .= '</div>' . '<div class="gjGridRight span3">' . cbgjClass::getIntegrations( 'gj_onBeforeOverviewMenu', array( $user, $plugin ), null, null ) . ( cbgjClass::hasAccess( 'cat_create', $authorized ) ? '<div><i class="icon-plus"></i> <a href="' . cbgjClass::getPluginURL( array( 'categories', 'new' ) ) . '">' . CBTxt::Ph( 'New [category]', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) . '</a></div>' : null ) . ( cbgjClass::hasAccess( 'usr_mod', $authorized ) && $categoryCount ? '<div><i class="icon-envelope"></i> <a href="' . cbgjClass::getPluginURL( array( 'overview', 'message' ) ) . '">' . CBTxt::Ph( 'Message [categories]', array( '[categories]' => cbgjClass::getOverride( 'category', true ) ) ) . '</a></div>' : null ) . ( cbgjClass::hasAccess( 'usr_panel', $authorized ) ? '<div><i class="icon-home"></i> <a href="' . cbgjClass::getPluginURL( array( 'panel' ) ) . '">' . CBTxt::Ph( 'My [panel]', array( '[panel]' => cbgjClass::getOverride( 'panel' ) ) ) . '</a></div>' : null ) . cbgjClass::getIntegrations( 'gj_onAfterOverviewMenu', array( $user, $plugin ), null, null ) . ( cbgjClass::hasAccess( 'gen_usr_notifications', $authorized ) ? '<div><i class="icon-info-sign"></i> <a href="' . cbgjClass::getPluginURL( array( 'notifications', 'show' ) ) . '">' . CBTxt::Th( 'Notifications' ) . '</a></div>' : null ) . '</div>' . '</div>'; return $return; }
function _cbadmin_emailUsers( &$rows, $emailSubject, $emailBody, $limitstart, $limit, $total, $simulationMode ) { global $_PLUGINS; // simple spoof check security cbSpoofCheck( 'cbadmingui' ); cbRegAntiSpamCheck(); $cbNotification = new cbNotification(); $mode = 1; // html $usernames = ''; foreach ( $rows as $row ) { $user = CBuser::getUserDataInstance( (int) $row->id ); $usernames .= ( $usernames ? ', ' : '' ) . htmlspecialchars( $user->username ); if ( $simulationMode ) { $usernames .= ' (' . htmlspecialchars( CBTxt::T('email not send: simulation mode') ) . ')'; } else { $extraStrings = array(); $_PLUGINS->trigger( 'onBeforeBackendUserEmail', array( &$user, &$emailSubject, &$emailBody, $mode, &$extraStrings, $simulationMode ) ); if ( ! $cbNotification->sendFromSystem( $user, $emailSubject, $this->_cbadmin_makeLinksAbsolute( $emailBody ), true, $mode, null, null, null, $extraStrings, false ) ) { $usernames .= ': <span class="cb_result_error">' . htmlspecialchars( CBTxt::T('Error sending email!') ) . '</span>'; } } } if ( $total < $limit ) { $limit = $total; } ob_start(); $usersView = _CBloadView( 'users' ); $usersView->ajaxResults( $usernames, $emailSubject, $this->_cbadmin_makeLinksAbsolute( $emailBody ), $limitstart, $limit, $total ); $html = ob_get_contents(); ob_end_clean(); $reply = array( 'result' => 1, 'htmlcontent' => $html ); if ( ! ( $total - ( $limitstart + $limit ) > 0 ) ) { $reply['result'] = 2; } echo json_encode( $reply ); sleep(3); }
function _cbadmin_ajaxBatch($ajaxUrl, $cssSelectorReply, $formSelector, $postArray, $delay, $limitstart = 0, $limit = 30, $textDuringExecution = null, $textWhenDone = null, $cssSelectorTitle, $titleTextWhenDone) { global $_CB_framework; $ajaxUrl = addslashes($ajaxUrl); $cbSpoofField = cbSpoofField(); $cbSpoofString = cbSpoofString(null, 'cbadmingui'); $regAntiSpamFieldName = cbGetRegAntiSpamFieldName(); $regAntiSpamValues = cbGetRegAntiSpams(); cbGetRegAntiSpamInputTag($regAntiSpamValues); // sets the cookie $regAntiSpZ = $regAntiSpamValues[0]; $postString = ''; foreach ($postArray as $k => $v) { if (is_array($v)) { foreach ($v as $vv) { $postString .= '&' . urlencode($k) . '[]=' . urlencode($vv); } } else { $postString .= '&' . urlencode($k) . '=' . urlencode($v); } } $postString = addslashes($postString); //$errorText = addslashes( $errorText ); $textWaiting = addslashes(CBTxt::T('Waiting delay for next batch...')); $textExecuting = addslashes($textDuringExecution ? $textDuringExecution : CBTxt::T('Executing')); $textFinished = addslashes($textWhenDone ? $textWhenDone : CBTxt::T('Done')); $textError = addslashes(CBTxt::T('ERROR!')); $titleTextWhenDone = addslashes($titleTextWhenDone); $_CB_framework->outputCbJQuery(<<<EOT \t{ \t\tvar cbanimate = function() { \t\t\t\$(this).animate({width:'100%'},20000,function(){ \t\t\t\t\$(this).animate({width:'0%'},1000,cbanimate); \t\t\t}); \t\t}; \t\tvar cbajaxjsonbatch = function(limitstart,limit,successFnct){ \t\t\t\$.ajax( {\ttype: 'POST', \t\t\t\t\t\turl: '{$ajaxUrl}', \t\t\t\t\t\tdata: \$('{$formSelector}').serialize() + '&{$cbSpoofField}=' + encodeURIComponent('{$cbSpoofString}') + '&{$regAntiSpamFieldName}=' + encodeURIComponent('{$regAntiSpZ}') + '{$postString}' + '&limitstart=' + limitstart, \t\t\t\t\t\tsuccess: function(response) { \t\t\t\t\t\t\t\$('{$cssSelectorReply}'+'Bar div').stop().animate( {width:'100%'},500).animate( {width:'0%'},200, function() { \$(this).css({"background-color":"#8f8"}) }); \t\t\t\t\t\t\t\$('{$cssSelectorReply}').fadeOut(400, function() { \t\t\t\t\t\t\t\t\$(this).html(response.htmlcontent).fadeIn(400, function() { \t\t\t\t\t\t\t\t\tif ( response.result == 1 ) { \t\t\t\t\t\t\t\t\t\$(this).each( function() { \t\t\t\t\t\t\t\t\t\t\$('{$cssSelectorReply}'+'Bar span').html('{$textWaiting}') \t\t\t\t\t\t\t\t\t\t.siblings('div').animate( {width:'100%'},{$delay}*1000,'linear', function() { \t\t\t\t\t\t\t\t\t\t\t\$(this).animate( {width:'0%'},200, function() { \t\t\t\t\t\t\t\t\t\t\t\tcbajaxjsonbatch(limitstart+limit,limit,successFnct); \t\t\t\t\t\t\t\t\t\t\t}); \t\t\t\t\t\t\t\t\t\t}); \t\t\t\t\t\t\t\t\t}); \t\t\t\t\t\t\t\t\t} else if ( response.result == 2 ) { \t\t\t\t\t\t\t\t\t\t\$('{$cssSelectorReply}'+'Bar span').html('{$textFinished}'); \t\t\t\t\t\t\t\t\t\tif (successFnct) { \t\t\t\t\t\t\t\t\t\t\tsuccessFnct.call(response); \t\t\t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t\t\t} else { \t\t\t\t\t\t\t\t\t\t\$('{$cssSelectorReply}'+'Bar span').html('{$textError}') \t\t\t\t\t\t\t\t\t\t.siblings('div').css({"background-color":"#fcc"}); \t\t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t\t}); \t\t\t\t\t\t\t}) \t\t\t\t\t\t}, \t\t\t\t\t\terror: function (XMLHttpRequest, textStatus, errorThrown) { \t\t\t\t\t\t\t\$('{$cssSelectorReply}'+'Bar div').stop().animate( {width:'100%'},500).css({"background-color":"#f87"}); \t\t\t\t\t\t\t\$('{$cssSelectorReply}'+'Bar span').html('{$textError}'); \t\t\t\t\t\t\t\$('{$cssSelectorReply}').hide().html( ( errorThrown ? errorThrown : textStatus ? textStatus : 'No additional message' ).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">") ).fadeIn('fast'); \t\t\t\t\t\t}, \t\t\t\t\t\tdataType: 'json' \t\t\t}); \t\t\t\$('{$cssSelectorReply}'+'Bar span').html('{$textExecuting}') \t\t\t.siblings('div').css({"background-color":"#ee8"}).each(cbanimate); \t\t}; \t\t \t\tvar cbTitleSetDone = function() { \t\t\t\$('{$cssSelectorTitle}').html('{$titleTextWhenDone}'); \t\t}; \t\t\tcbajaxjsonbatch({$limitstart},{$limit},cbTitleSetDone); \t} EOT ); }
public function getAccess() { global $_CB_framework; static $cache = array(); $id = $this->get( 'access' ); if ( ! isset( $cache[$id] ) ) { $access = array(); if ( $id ) foreach ( explode( '|*|', $id ) as $k => $v ) { if ( $v == -1 ) { $access[$k] = CBTxt::T( 'Everybody' ); } elseif ( $v == -2 ) { $access[$k] = CBTxt::T( 'All Non-Registered Users' ); } elseif ( $v == -3 ) { $access[$k] = CBTxt::T( 'All Registered Users' ); } elseif ( $v == -4 ) { $access[$k] = CBTxt::T( 'All Non-Moderators' ); } elseif ( $v == -5 ) { $access[$k] = CBTxt::T( 'All Moderators' ); } else { $access[$k] = CBTxt::T( $_CB_framework->acl->get_group_name( $v ) ); } } $cache[$id] = $access; } return $cache[$id]; }
/** * Returns the activity update corresponding to the logged values * * @param moscomprofilerFields $field * @param moscomprofilerActivity $activity * @param moscomprofilerUser $user * @param string $output NO 'htmledit' BUT: 'html', 'xml', 'json', 'php', 'csvheader', 'csv', 'rss', 'fieldslist' * @param boolean $htmlspecialchars TRUE: escape for display, FALSE: not escaped will display raw. * @return mixed */ function _formatFieldActivityOutput(&$field, &$activity, &$user, $output, $htmlspecialchars = true) { $name = $field->name; /* global $_CB_framework, $ueConfig; $value = '<a href="' . $_CB_framework->userProfileUrl( $user->id ) . '">' . getNameFormat( $user->name, $user->username, $ueConfig['name_format'] ) . '</a>' . ' updated his ' */ $value = $this->_formatFieldOutput($field->name, $activity->new_value, $output, $htmlspecialchars); switch ($output) { case 'html': case 'rss': case 'htmledit': $title = $this->getFieldTitle($field, $user, $output, 'profile'); if ($htmlspecialchars) { return sprintf('%s %s %s', '<span class="titleCell">' . $title . '</span>', '<span class="cbIs">' . CBTxt::Th('is now') . '</span>', '<span class="fieldCell">' . htmlspecialchars($value) . '</span>'); } else { return sprintf(CBTxt::T('%s is now %s'), $title, $value); //FIXME : LANGUAGE STRINGS FOR THIS ! } break; case 'xml': return '<' . $name . '>' . htmlspecialchars($value) . '</' . $name . '>'; // htmlspecialchars handled already by _formatFieldOutput break; case 'json': return "'" . $name . "' : '" . addslashes($value) . "'"; break; case 'php': return array($name => $value); break; case 'csvheader': case 'fieldslist': return $name; break; case 'csv': return '"' . addslashes($value) . '"'; break; default: trigger_error('_formatFieldActivityOutput called with ' . htmlspecialchars($output), E_USER_WARNING); return $value; break; } }
function saveTab( $option ) { global $_CB_database, $_CB_framework, $_POST; $this->_importNeeded(); $this->_importNeededSave(); if ( isset( $_POST['params'] ) ) { $_POST['params'] = cbParamsEditorController::getRawParamsMagicgpcEscaped( $_POST['params'] ); } else { $_POST['params'] = ''; } if ( ! isset( $_POST['tabid'] ) || ( count( $_POST ) == 0 ) ) { echo "<script type=\"text/javascript\"> alert('" . addslashes( CBTxt::T('Missing post values') ) . "'); window.history.go(-2); </script>\n"; exit(); } if ( $_POST['tabid'] ) { $oldrow = new moscomprofilerTabs( $_CB_database ); if ( $oldrow->load( (int) $_POST['tabid'] ) && ( ! in_array( $oldrow->useraccessgroupid, getChildGIDS( userGID( $_CB_framework->myId() ) ) ) ) ) { echo "<script type=\"text/javascript\"> alert('" . addslashes( CBTxt::T('Unauthorized Access') ) . "'); window.history.go(-1);</script>\n"; exit; } } $row = new moscomprofilerTabs( $_CB_database ); if (!$row->bind( $_POST )) { echo "<script type=\"text/javascript\"> alert('".$row->getError()."'); window.history.go(-1); </script>\n"; exit(); } if ( ! $row->ordering_register ) { $row->ordering_register = 10; } $row->description = cleanEditorsTranslationJunk( trim( $row->description ) ); if (!$row->check()) { echo "<script type=\"text/javascript\"> alert('".$row->getError()."'); window.history.go(-2); </script>\n"; exit(); } $row->tabid = (int) cbGetParam( $_POST, 'tabid', 0 ); if ( ! $row->store() ) { echo "<script type=\"text/javascript\"> alert('".$row->getError()."'); window.history.go(-2); </script>\n"; exit(); } $row->checkin(); cbRedirect( $_CB_framework->backendUrl( "index.php?option=$option&task=showTab" ), CBTxt::T('Successfully Saved Tab') . ": ". $row->title ); }
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 }
"></span> </span> <?php } ?> <?php if ($newConnectionRequests) { ?> <?php echo $newConnectionRequests == 1 ? CBTxt::T('YOU_HAVE_COUNT_NEW_CONNECTION_REQUEST', 'You have [count] new connection request.', array('[count]' => $newConnectionRequests)) : CBTxt::T('YOU_HAVE_COUNT_NEW_CONNECTION_REQUESTS', 'You have [count] new connection requests.', array('[count]' => $newConnectionRequests)); ?> <?php } else { ?> <?php echo CBTxt::T('You have no new connection requests.'); ?> <?php } ?> </a> </li> <?php } ?> <?php if ($profileViewText) { ?> <li class="logout-profile"> <a href="<?php echo $_CB_framework->userProfileUrl();
function saveField($option, $task) { global $_CB_database, $_CB_framework, $_POST, $_PLUGINS; if ($task == 'showField' || !(isset($_POST['oldtabid']) && isset($_POST['fieldid']))) { cbRedirect($_CB_framework->backendUrl("index.php?option={$option}&task={$task}")); return; } $this->_importNeeded(); $this->_importNeededSave(); $fieldOldTab = new moscomprofilerTabs($_CB_database); if (isset($_POST['oldtabid']) && $_POST['oldtabid']) { $fieldOldTab->load((int) $_POST['oldtabid']); // Check if user is a super user: if (!$_CB_framework->acl->amIaSuperAdmin()) { // Check if user belongs to useraccessgroupid: if (!in_array($fieldOldTab->useraccessgroupid, $_CB_framework->acl->get_groups_below_me(null, true))) { echo "<script type=\"text/javascript\"> alert('" . addslashes(CBTxt::T('Unauthorized Access')) . "'); window.history.go(-1);</script>\n"; exit; } // Check if user belongs to viewaccesslevel: if (!in_array($fieldOldTab->viewaccesslevel, CBuser::getMyInstance()->getAuthorisedViewLevelsIds(false))) { echo "<script type=\"text/javascript\"> alert('" . addslashes(CBTxt::T('Unauthorized Access')) . "'); window.history.go(-1);</script>\n"; exit; } } } $fid = (int) $_POST['fieldid']; $row = new moscomprofilerFields($_CB_database); if ($fid) { // load the row from the db table if (!$row->load((int) $fid)) { echo "<script type=\"text/javascript\"> alert('" . addslashes(CBTxt::T('Innexistant field')) . "'); window.history.go(-1);</script>\n"; exit; } $fieldTab = new moscomprofilerTabs($_CB_database); // load the row from the db table $fieldTab->load((int) $row->tabid); // Check if user is a super user: if (!$_CB_framework->acl->amIaSuperAdmin()) { // Check if user belongs to useraccessgroupid: if (!in_array($fieldTab->useraccessgroupid, $_CB_framework->acl->get_groups_below_me(null, true))) { echo "<script type=\"text/javascript\"> alert('" . addslashes(CBTxt::T('Unauthorized Access')) . "'); window.history.go(-1);</script>\n"; exit; } // Check if user belongs to viewaccesslevel: if (!in_array($fieldTab->viewaccesslevel, CBuser::getMyInstance()->getAuthorisedViewLevelsIds(false))) { echo "<script type=\"text/javascript\"> alert('" . addslashes(CBTxt::T('Unauthorized Access')) . "'); window.history.go(-1);</script>\n"; exit; } } } $oldrow = new moscomprofilerFields($_CB_database); foreach (array_keys(get_object_vars($row)) as $k) { if (substr($k, 0, 1) != '_') { $oldrow->{$k} = $row->{$k}; } } $_PLUGINS->loadPluginGroup('user'); if (!$this->_prov_bind_CB_field($row, $fid)) { echo "<script type=\"text/javascript\"> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } // Set defaults if nothing is found // Also check if oldrow value to use its current value or default otherwise // This prevents a tab from storing to database with null values when some inputs are set disabled: if ($row->tabid == '') { $row->tabid = $oldrow->tabid != '' ? $oldrow->tabid : 11; } if ($row->profile == '') { $row->profile = $oldrow->profile != '' ? $oldrow->profile : 1; } if ($row->registration == '') { $row->registration = $oldrow->registration != '' ? $oldrow->registration : 1; } if ($row->published == '') { $row->published = $oldrow->published != '' ? $oldrow->published : 1; } if ($row->required == '') { $row->required = $oldrow->required != '' ? $oldrow->required : 0; } if ($row->readonly == '') { $row->readonly = $oldrow->readonly != '' ? $oldrow->readonly : 0; } if ($row->tablecolumns != '' && !in_array($row->type, array('password', 'userparams'))) { $searchable_default = 1; } else { $searchable_default = 0; } if ($row->searchable == '') { $row->searchable = $oldrow->searchable != '' ? $oldrow->searchable : $searchable_default; } // If the input is disabled we need to apply the default if the tabid isn't in POST: if (!isset($_POST['tabid'])) { $_POST['tabid'] = $row->tabid; } // Moved above check here just encase it ends up being empty: if ($task == 'showField' || !isset($_POST['tabid'])) { cbRedirect($_CB_framework->backendUrl("index.php?option={$option}&task={$task}")); return; } // in case the above changed perms.... really ? $fieldTab = new moscomprofilerTabs($_CB_database); $fieldTab->load((int) $row->tabid); // Check if user is a super user: if (!$_CB_framework->acl->amIaSuperAdmin()) { // Check if user belongs to useraccessgroupid: if (!in_array($fieldTab->useraccessgroupid, $_CB_framework->acl->get_groups_below_me(null, true))) { echo "<script type=\"text/javascript\"> alert('" . addslashes(CBTxt::T('Unauthorized Access')) . "'); window.history.go(-1);</script>\n"; exit; } // Check if user belongs to viewaccesslevel: if (!in_array($fieldTab->viewaccesslevel, CBuser::getMyInstance()->getAuthorisedViewLevelsIds(false))) { echo "<script type=\"text/javascript\"> alert('" . addslashes(CBTxt::T('Unauthorized Access')) . "'); window.history.go(-1);</script>\n"; exit; } } if ($row->type == 'webaddress') { $row->rows = $_POST['webaddresstypes']; if (!($row->rows == 0 || $row->rows == 2)) { $row->rows = 0; } } if ($_POST['oldtabid'] != $_POST['tabid']) { if ($_POST['oldtabid'] !== '') { //Re-order old tab $sql = "UPDATE #__comprofiler_fields SET ordering = ordering-1 WHERE ordering > " . (int) $_POST['ordering'] . " AND tabid = " . (int) $_POST['oldtabid']; $_CB_database->setQuery($sql); $_CB_database->query(); } //Select Last Order in New Tab $sql = "SELECT MAX(ordering) FROM #__comprofiler_fields WHERE tabid=" . (int) $_POST['tabid']; $_CB_database->SetQuery($sql); $max = $_CB_database->LoadResult(); $row->ordering = max($max + 1, 1); } if (cbStartOfStringMatch($row->name, 'cb_')) { $row->name = str_replace(" ", "", strtolower($row->name)); } if (!$row->check()) { echo "<script type=\"text/javascript\"> alert('" . $row->getError() . "'); window.history.go(-2); </script>\n"; exit; } // Check if user is a super user: if (!$_CB_framework->acl->amIaSuperAdmin()) { $canEditState = CBuser::getMyInstance()->authoriseAction('core.edit.state'); // Check if user belongs to useraccessgroupid if ($fieldTab->useraccessgroupid != '' && !in_array($fieldTab->useraccessgroupid, $_CB_framework->acl->get_groups_below_me(null, true))) { echo "<script type=\"text/javascript\"> alert('" . addslashes(CBTxt::T('Unauthorized Access')) . "'); window.history.go(-1);</script>\n"; exit; } // Check if user belongs to viewaccesslevel if ($fieldTab->viewaccesslevel != '' && !in_array($fieldTab->viewaccesslevel, CBuser::getMyInstance()->getAuthorisedViewLevelsIds(false))) { echo "<script type=\"text/javascript\"> alert('" . addslashes(CBTxt::T('Unauthorized Access')) . "'); window.history.go(-1);</script>\n"; exit; } // Check if user can edit status (and if not, that status are as expected): if (!$canEditState) { $failed = false; // Check if row exists and if tabid is different from existing row // Check if row doesn't exist and if tabid is different from default // Check if user can edit status: if ($oldrow->fieldid && ($row->tabid != '' && $oldrow->tabid != $row->tabid) || !$oldrow->fieldid && ($row->tabid != '' && $row->tabid != 11)) { $failed = true; } // Check if row exists and if profile is different from existing row // Check if row doesn't exist and if profile is different from default // Check if user can edit status: if ($oldrow->fieldid && ($row->profile != '' && $oldrow->profile != $row->profile) || !$oldrow->fieldid && ($row->profile != '' && $row->profile != 1)) { $failed = true; } // Check if row exists and if registration is different from existing row // Check if row doesn't exist and if registration is different from default // Check if user can edit status: if ($oldrow->fieldid && ($row->registration != '' && $oldrow->registration != $row->registration) || !$oldrow->fieldid && ($row->registration != '' && $row->registration != 1)) { $failed = true; } // Check if row exists and if published is different from existing row // Check if row doesn't exist and if published is different from default // Check if user can edit status: if ($oldrow->fieldid && ($row->published != '' && $oldrow->published != $row->published) || !$oldrow->fieldid && ($row->published != '' && $row->published != 1)) { $failed = true; } // Check if row exists and if required is different from existing row // Check if row doesn't exist and if required is different from default // Check if user can edit status: if ($oldrow->fieldid && ($row->required != '' && $oldrow->required != $row->required) || !$oldrow->fieldid && ($row->required != '' && $row->required != 0)) { $failed = true; } // Check if row exists and if readonly is different from existing row // Check if row doesn't exist and if readonly is different from default // Check if user can edit status: if ($oldrow->fieldid && ($row->readonly != '' && $oldrow->readonly != $row->readonly) || !$oldrow->fieldid && ($row->readonly != '' && $row->readonly != 0)) { $failed = true; } // Check if row exists and if searchable is different from existing row // Check if row doesn't exist and if searchable is different from default // Check if user can edit status: if ($oldrow->fieldid && ($row->searchable != '' && $oldrow->searchable != $row->searchable) || !$oldrow->fieldid && ($row->searchable != '' && $row->searchable != $searchable_default)) { $failed = true; } if ($failed) { echo "<script type=\"text/javascript\"> alert('" . addslashes(CBTxt::T('Unauthorized Access')) . "'); window.history.go(-1);</script>\n"; exit; } } } if (!$row->store((int) $fid)) { echo "<script type=\"text/javascript\"> alert('" . $row->getError() . "'); window.history.go(-2); </script>\n"; exit; } $fieldNames = $_POST['vNames']; $j = 1; if ($row->fieldid > 0) { $_CB_database->setQuery("DELETE FROM #__comprofiler_field_values" . " WHERE fieldid = " . (int) $row->fieldid); if ($_CB_database->query() === false) { echo $_CB_database->getErrorMsg(); } } else { $_CB_database->setQuery("SELECT MAX(fieldid) FROM #__comprofiler_fields"); $maxID = $_CB_database->loadResult(); $row->fieldid = $maxID; echo $_CB_database->getErrorMsg(); } //for($i=0, $n=count( $fieldNames ); $i < $n; $i++) { foreach ($fieldNames as $fieldName) { if (trim($fieldName) != null || trim($fieldName) != '') { $_CB_database->setQuery("INSERT INTO #__comprofiler_field_values (fieldid,fieldtitle,ordering)" . " VALUES( " . (int) $row->fieldid . ",'" . cbGetEscaped(trim($fieldName)) . "', " . (int) $j . ")"); if ($_CB_database->query() === false) { echo $_CB_database->getErrorMsg(); } $j++; } } switch ($task) { case 'applyField': $msg = CBTxt::T('Successfully Saved changes to Field') . ': ' . $row->name; cbRedirect($_CB_framework->backendUrl("index.php?option={$option}&task=editField&cid={$row->fieldid}"), $msg); break; case 'saveField': default: $msg = CBTxt::T('Successfully Saved Field') . ': ' . $row->name; cbRedirect($_CB_framework->backendUrl("index.php?option={$option}&task=showField"), $msg); break; } }
</div> <?php } ?> <!-- End Register Button --> <!-- Recover Login --> <?php if ($showForgotLogin) { ?> <div class="mdl-card__actions mdl-card--border"> <a class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect" href="<?php echo $_CB_framework->viewUrl('lostpassword', true, null, 'html', $secureForm); ?> "> <?php echo CBTxt::T('Forgot Login?'); ?> </a> </div> <?php } ?> <!-- End Recover Login --> <?php echo modCBLoginHelper::getPlugins($params, $type, 'almostEnd'); ?> <?php echo modCBLoginHelper::getPlugins($params, $type, 'end'); ?> <?php echo modCBLoginHelper::getPlugins($params, $type, 'afterForm');
echo $newMessageCount == 1 ? CBTxt::T('COUNT_PRIVATE_MESSAGE', '[count] Private Message', array('[count]' => $newMessageCount)) : CBTxt::T('COUNT_PRIVATE_MESSAGES', '[count] Private Messages', array('[count]' => $newMessageCount)); ?> </a> </li> <?php } ?> <?php if ($showConnectionRequests) { ?> <li class="cbModeratorLink cbModeratorLinkConnectionRequests"> <a href="<?php echo $_CB_framework->viewUrl('manageconnections'); ?> "><?php echo $newConnectionRequests == 1 ? CBTxt::T('COUNT_CONNECTION_REQUEST', '[count] Connection Request', array('[count]' => $newConnectionRequests)) : CBTxt::T('COUNT_CONNECTION_REQUESTS', '[count] Connection Requests', array('[count]' => $newConnectionRequests)); ?> </a> </li> <?php } ?> <?php echo modCBModeratorHelper::getPlugins($params, 'afterLinks'); ?> </ul> <?php echo modCBModeratorHelper::getPlugins($params, 'almostEnd'); if ($postText) { ?> <div class="posttext">
/** * Generates HTML for favorites in forum tab * * @param object $template * @param object $forum * @param object $model * @return mixed */ function ShowFavorites( $template, $forum, $model ) { $html = null; $oneOrTwo = 1; if ( $template->favorites ) { $html .= '<br /><table width="100%" cellspacing="0" cellpadding="3" border="0">' . '<thead>' . '<tr class="sectiontableheader">' . '<th colspan="4">' . CBTxt::T( 'Your Favorites' ) . '</th>' . '</tr>' . '<tr class="sectiontableheader">' . '<th width="20%">' . $template->titles->date . '</th>' . '<th width="45%">' . $template->titles->subject . '</th>' . '<th width="25%">' . $template->titles->category . '</th>' . '<th width="10%">' . CBTxt::T( 'Action' ) . '</th>' . '</tr>' . '</thead>' . '<tbody>'; foreach ( $template->favorites as $item ) { $unsubURL = cbSef( $template->unFavThreadURL . $item->thread ); $postURL = cbSef( 'index.php?option=' . $forum->component . $forum->itemid . '&func=view&catid='. $item->catid . '&id=' . $item->id ); $catURL = cbSef( 'index.php?option=' . $forum->component . $forum->itemid . '&func=' . ( $forum->component == 'com_kunena' ? 'showcat' : 'view' ) . '&catid='. $item->catid ); $html .= '<tr class="sectiontableentry' . $oneOrTwo . '">' . '<td>' . getFieldValue( 'date', date( 'Y-m-d, H:i:s', $item->time ) ) . '</td>' . '<td><a href="' . $postURL . '">' . htmlspecialchars( stripslashes( $item->subject ) ) . '</a></td>' . '<td><a href="' . $catURL . '">' . htmlspecialchars( stripslashes( $item->catname ) ) . '</a></td>' . '<td><a href="javascript:void(0);" onclick="javascript:if ( confirm(\'' . CBTxt::T( "Are you sure you want to remove this favorite thread?" ) . '\') ) { location.href=\'' . $unsubURL . '\'; }">' . CBTxt::T( 'Remove' ) . '</a></td>' . '</tr>'; $oneOrTwo = ( $oneOrTwo == 1 ? 2 : 1 ); } $html .= '</tbody>' . '</table>'; if ( $template->showPaging ) { $html .= '<br /><div style="width:95%;text-align:center;">' . $template->paging . '</div>'; } $html .= '<br /><div style="width:95%;text-align:center;"><input type="button" class="button" onclick="javascript:if ( confirm(\'' . CBTxt::T( "Are you sure you want to remove all your favorite threads?" ) . '\') ) { location.href=\'' . $template->unFavAllURL . '\'; }" value="' . CBTxt::T( 'Remove All' ) . '" /></div>'; } else { $html .= '<br /><div>' . CBTxt::T( 'No favorites found for you.' ) . '</div>'; } return $html; }
/** * render frontend users * * @param object $rows * @param object $pageNav * @param cbgjCategory $category * @param cbgjGroup $group * @param moscomprofilerUser $user * @param object $plugin * @return string */ static function showUsers( $rows, $pageNav, $category, $group, $user, $plugin ) { $groupUsersSearch = $plugin->params->get( 'group_users_search', 1 ); $groupUsersPaging = $plugin->params->get( 'group_users_paging', 1 ); $groupUsersLimitbox = $plugin->params->get( 'group_users_limitbox', 1 ); $return = '<form action="' . $group->getUrl() . '" method="post" name="gjForm_users" id="gjForm_users" class="gjUsers_form">' . ( $groupUsersSearch && ( $pageNav->searching || $pageNav->total ) ? '<div class="gjTop gjTopRight">' . $pageNav->search . '</div>' : null ); if ( $rows ) { $return .= '<div class="gjContent">'; foreach ( $rows as $row ) { $authorized = cbgjClass::getAuthorization( $category, $group, $user, $row->getOwner() ); $adminUrl = cbgjClass::getPluginURL( array( 'users', 'admin', (int) $category->get( 'id' ), (int) $group->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to set this [user] to [admin]?', array( '[user]' => cbgjClass::getOverride( 'user' ), '[admin]' => cbgjClass::getOverride( 'admin' ) ) ) ); $modUrl = cbgjClass::getPluginURL( array( 'users', 'mod', (int) $category->get( 'id' ), (int) $group->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to set this [user] to [mod]?', array( '[user]' => cbgjClass::getOverride( 'user' ), '[mod]' => cbgjClass::getOverride( 'moderator' ) ) ) ); $activeUrl = cbgjClass::getPluginURL( array( 'users', 'active', (int) $category->get( 'id' ), (int) $group->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to set this [user] as Active?', array( '[user]' => cbgjClass::getOverride( 'user' ) ) ) ); $inactiveUrl = cbgjClass::getPluginURL( array( 'users', 'inactive', (int) $category->get( 'id' ), (int) $group->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to set this [user] as Inactive?', array( '[user]' => cbgjClass::getOverride( 'user' ) ) ) ); $banUrl = cbgjClass::getPluginURL( array( 'users', 'ban', (int) $category->get( 'id' ), (int) $group->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to ban this [user]?', array( '[user]' => cbgjClass::getOverride( 'user' ) ) ) ); $deleteUrl = cbgjClass::getPluginURL( array( 'users', 'delete', (int) $category->get( 'id' ), (int) $group->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to delete this [user]?', array( '[user]' => cbgjClass::getOverride( 'user' ) ) ) ); if ( $row->get( 'status' ) == 0 ) { $typeClass = 'gjUserTypePENDING'; $type = CBTxt::Th( 'Pending' ); } elseif ( $row->get( 'status' ) == -1 ) { $typeClass = 'gjUserTypeBANNED'; $type = CBTxt::Th( 'Banned' ); } elseif ( $row->get( 'status' ) == 2 ) { $typeClass = 'gjUserTypeMOD'; $type = cbgjClass::getOverride( 'moderator' ); } elseif ( $row->get( 'status' ) == 3 ) { $typeClass = 'gjUserTypeADMIN'; $type = cbgjClass::getOverride( 'admin' ); } elseif ( $row->get( 'status' ) == 4 ) { $typeClass = 'gjUserTypeOWNER'; $type = cbgjClass::getOverride( 'owner' ); } else { $typeClass = 'gjUserTypeUSER'; $type = cbgjClass::getOverride( 'user' ); } if ( ( ! in_array( $row->get( 'status' ), array( -1, 4 ) ) ) && ( ( $row->get( 'status' ) != 3 ) || cbgjClass::hasAccess( 'mod_lvl2', $authorized ) ) && cbgjClass::hasAccess( 'mod_lvl3', $authorized ) ) { $ban = '<div><a href="javascript: void(0);" onclick="' . $banUrl . '"><i class="icon-lock"></i> ' . CBTxt::T( 'Ban' ) . '</a></div>'; } elseif ( ( $row->get( 'status' ) == -1 ) && cbgjClass::hasAccess( 'mod_lvl3', $authorized ) ) { $ban = '<div><a href="javascript: void(0);" onclick="' . $activeUrl . '"><i class="icon-ok"></i> ' . CBTxt::T( 'Unban' ) . '</a></div>'; } else { $ban = null; } if ( ( $row->get( 'status' ) == 1 ) && cbgjClass::hasAccess( 'mod_lvl3', $authorized ) ) { $promote = '<div><a href="javascript: void(0);" onclick="' . $modUrl . '"><i class="icon-thumbs-up"></i> ' . CBTxt::T( 'Promote' ) . '</a></div>'; } elseif ( ( $row->get( 'status' ) == 2 ) && cbgjClass::hasAccess( 'mod_lvl2', $authorized ) ) { $promote = '<div><a href="javascript: void(0);" onclick="' . $adminUrl . '"><i class="icon-thumbs-up"></i> ' . CBTxt::T( 'Promote' ) . '</a></div>'; } else { $promote = null; } if ( ( $row->get( 'status' ) == 2 ) && cbgjClass::hasAccess( 'mod_lvl3', $authorized ) ) { $demote = '<div><a href="javascript: void(0);" onclick="' . $activeUrl . '"><i class="icon-thumbs-down"></i> ' . CBTxt::T( 'Demote' ) . '</a></div>'; } elseif ( ( $row->get( 'status' ) == 3 ) && cbgjClass::hasAccess( 'mod_lvl2', $authorized ) ) { $demote = '<div><a href="javascript: void(0);" onclick="' . $modUrl . '"><i class="icon-thumbs-down"></i> ' . CBTxt::T( 'Demote' ) . '</a></div>'; } elseif ( ( $row->get( 'status' ) == 1 ) && cbgjClass::hasAccess( 'mod_lvl4', $authorized ) ) { $demote = '<div><a href="javascript: void(0);" onclick="' . $inactiveUrl . '"><i class="icon-thumbs-down"></i> ' . CBTxt::T( 'Demote' ) . '</a></div>'; } else { $demote = null; } if ( ( $row->get( 'status' ) != 4 ) && cbgjClass::hasAccess( 'mod_lvl2', $authorized ) ) { $delete = '<div><a href="javascript: void(0);" onclick="' . $deleteUrl . '"><i class="icon-remove"></i> ' . CBTxt::T( 'Delete' ) . '</a></div>'; } else { $delete = null; } $beforeMenu = cbgjClass::getIntegrations( 'gj_onBeforeGroupUserMenu', array( $row, $group, $category, $user, $plugin ) ); $afterMenu = cbgjClass::getIntegrations( 'gj_onAfterGroupUserMenu', array( $row, $group, $category, $user, $plugin ) ); $return .= '<div class="gjContentBox mini-layout">' . '<div class="gjContentBoxRow">' . $row->getOwnerName( true ) . '</div>' . '<div class="gjContentBoxRow">' . $row->getOwnerAvatar( true ) . '</div>' . '<div class="gjContentBoxRow">' . $row->getOwnerOnline() . '</div>' . '<div class="gjContentBoxRow">' . cbgjClass::getIntegrations( 'gj_onBeforeGroupUserInfo', array( $row, $group, $category, $user, $plugin ) ) . '<span class="' . $typeClass . '" title="' . cbFormatDate( $row->get( 'date' ), 1, false ) . '">' . $type . '</span>' . cbgjClass::getIntegrations( 'gj_onAfterGroupUserInfo', array( $row, $group, $category, $user, $plugin ) ) . '</div>'; if ( ( $row->get( 'status' ) == 0 ) && cbgjClass::hasAccess( 'mod_lvl4', $authorized ) ) { $return .= '<div class="gjContentBoxRow">' . '<input type="button" value="' . htmlspecialchars( CBTxt::Th( 'Approve' ) ) . '" class="gjButton btn btn-mini btn-success" onclick="' . cbgjClass::getPluginURL( array( 'users', 'active', (int) $category->get( 'id' ), (int) $group->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to set this [user] as Active?', array( '[user]' => cbgjClass::getOverride( 'user' ) ) ), true ) . '" />' . '</div>'; } if ( $beforeMenu || $ban || $delete || $promote || $demote || $afterMenu ) { $return .= '<div class="gjContentBoxRow">' . cbgjClass::getDropdown( ( $beforeMenu . $ban . $delete . $promote . $demote . $afterMenu ), CBTxt::T( 'Menu' ) ) . '</div>'; } $return .= '</div>'; } $return .= '</div>'; } else { $return .= '<div class="gjContent">'; if ( $groupUsersSearch && $pageNav->searching ) { $return .= CBTxt::Ph( 'No [user] search results found.', array( '[user]' => cbgjClass::getOverride( 'user' ) ) ); } else { $return .= CBTxt::Ph( 'There are no [users] available.', array( '[users]' => cbgjClass::getOverride( 'user', true ) ) ); } $return .= '</div>'; } if ( $groupUsersPaging ) { $return .= '<div class="gjPaging pagination pagination-centered">' . ( $pageNav->total > $pageNav->limit ? $pageNav->pagelinks : null ) . ( ! $groupUsersLimitbox ? $pageNav->getLimitBox( false ) : ( $pageNav->total ? '<div class="gjPagingLimitbox">' . $pageNav->limitbox . '</div>' : null ) ) . '</div>'; } $return .= cbGetSpoofInputTag( 'plugin' ) . '</form>'; return $return; }
echo htmlspecialchars($templateClass); ?> "> <span class="cbModuleRegisterIcon fa fa-edit" title="<?php echo htmlspecialchars(CBTxt::T('UE_REGISTER', 'Sign up')); ?> "></span> </span> <?php } ?> <?php if (in_array($params->get('show_newaccount', 1), array(1, 3))) { ?> <?php echo CBTxt::T('UE_REGISTER', 'Sign up'); ?> <?php } ?> </a> </span> <?php } ?> </span> <?php } ?> <?php
/** * render frontend tab invites * * @param object $rows * @param object $pageNav * @param moscomprofilerUser $displayed * @param moscomprofilerUser $user * @param object $plugin * @param boolean $tabbed * @return mixed */ static function showInvites( $rows, $pageNav, $displayed, $user, $plugin, $tabbed ) { global $_CB_framework; $invitesTabSearch = $plugin->params->get( 'invites_tab_search', 1 ); $invitesTabPaging = $plugin->params->get( 'invites_tab_paging', 1 ); $invitesTabLimitbox = $plugin->params->get( 'invites_tab_limitbox', 1 ); if ( ! $tabbed ) { $formUrl = cbgjClass::getPluginURL( array( 'panel', 'invites' ) ); } else { $formUrl = $_CB_framework->userProfileUrl( $displayed->id, true, $plugin->tab->tabid ); } $return = '<div class="gjTabInvites">' . '<form action="' . $formUrl . '" method="post" name="gjTabForm_invites" id="gjTabForm_invites" class="gjForm">' . ( $invitesTabSearch && ( $pageNav->searching || $pageNav->total ) ? '<div class="gjTop gjTopRight">' . $pageNav->search . '</div>' : null ); if ( $rows ) { $return .= '<div class="gjContent">'; foreach ( $rows as $row ) { $group = $row->getGroup(); $category = $group->getCategory(); if ( $row->get( 'user' ) ) { $userAvatar = $row->getInvitedAvatar( true ); $userName = $row->getInvitedName( true ); $userOnline = $row->getInvitedOnline(); } else { $userAvatar = '<img src="' . selectTemplate() . 'images/avatar/tnnophoto_n.png" alt="' . htmlspecialchars( $row->get( 'email' ) ) . '" title="' . htmlspecialchars( $row->get( 'email' ) ) . '" />'; $userName = '******' . htmlspecialchars( $row->get( 'email' ) ) . '">' . htmlspecialchars( $row->get( 'email' ) ) . '</a>'; $userOnline = null; } $menuItems = cbgjClass::getIntegrations( 'gj_onBeforeProfileGroupInviteMenu', array( $row, $group, $category, $displayed, $user, $plugin ) ) . '<div><a href="javascript: void(0);" onclick="' . cbgjClass::getPluginURL( array( 'invites', 'delete', (int) $category->get( 'id' ), (int) $group->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::T( 'Are you sure you want to delete this invite?' ) ) . '"><i class="icon-remove"></i> ' . CBTxt::Th( 'Delete' ) . '</a></div>' . cbgjClass::getIntegrations( 'gj_onAfterProfileGroupInviteMenu', array( $row, $group, $category, $displayed, $user, $plugin ) ); $return .= '<div class="gjContentBox mini-layout">' . '<div class="gjContentBoxRow">' . $userName . '</div>' . '<div class="gjContentBoxRow">' . $userAvatar . '</div>' . ( $userOnline ? '<div class="gjContentBoxRow">' . $userOnline . '</div>' : null ) . '<div class="gjContentBoxRow">' . $group->getName( 0, true ) . '</div>' . '<div class="gjContentBoxRow">' . $category->getName( 0, true ) . '</div>' . '<div class="gjContentBoxRow">' . cbgjClass::getIntegrations( 'gj_onBeforeProfileGroupInviteInfo', array( $row, $group, $category, $displayed, $user, $plugin ) ) . '<span title="' . cbFormatDate( $row->get( 'invited' ), 1, false ) . ( $row->isAccepted() ? ' - ' . cbFormatDate( $row->get( 'accepted' ), 1, false ) : null ) . '">' . $row->getStatus() . '</span>' . cbgjClass::getIntegrations( 'gj_onAfterProfileGroupInviteInfo', array( $row, $group, $category, $displayed, $user, $plugin ) ) . '</div>'; if ( ( ! $row->isAccepted() ) && ( $row->dateDifference() >= 5 ) ) { $return .= '<div class="gjContentBoxRow">' . '<input type="button" value="' . htmlspecialchars( CBTxt::Th( 'Resend' ) ) . '" class="gjButton btn btn-mini btn-success" onclick="' . cbgjClass::getPluginURL( array( 'invites', 'send', (int) $category->get( 'id' ), (int) $group->get( 'id' ), (int) $row->get( 'id' ) ), true ) . '" />' . '</div>'; } $return .= '<div class="gjContentBoxRow">' . cbgjClass::getDropdown( $menuItems, CBTxt::Th( 'Menu' ) ) . '</div>'; $return .= '</div>'; } $return .= '</div>'; } else { $return .= '<div class="gjContent">'; if ( $invitesTabSearch && $pageNav->searching ) { $return .= CBTxt::Th( 'No invite search results found.' ); } else { if ( $displayed->id == $user->id ) { $return .= CBTxt::Th( 'You have no invites.' ); } else { $return .= CBTxt::Th( 'This user has no invites.' ); } } $return .= '</div>'; } if ( $invitesTabPaging ) { $return .= '<div class="gjPaging pagination pagination-centered">' . ( $pageNav->total > $pageNav->limit ? $pageNav->pagelinks : null ) . ( ! $invitesTabLimitbox ? $pageNav->getLimitBox( false ) : ( $pageNav->total ? '<div class="gjPagingLimitbox">' . $pageNav->limitbox . '</div>' : null ) ) . '</div>'; } $return .= cbGetSpoofInputTag( 'plugin' ) . '</form>' . '</div>'; return $return; }
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 }
/** * prepare frontend tab invited render * * @param moscomprofilerUser $displayed * @param moscomprofilerUser $user * @param object $plugin * @param boolean $tabbed * @return mixed */ public function getInvited( $displayed, $user, $plugin, $tabbed = true ) { cbgjClass::getTemplate( 'tab_invited' ); $paging = new cbgjPaging( 'tab_invited' ); $limit = $paging->getlimit( (int) $plugin->params->get( 'invited_tab_limit', 15 ) ); $limitstart = $paging->getLimistart(); $search = $paging->getFilter( 'search' ); $where = array(); if ( isset( $search ) && ( $search != '' ) ) { $where[] = array( 'name', 'CONTAINS', $search ); } $searching = ( count( $where ) ? true : false ); $where[] = array( 'f.user', '=', (int) $displayed->id, array( 'f.email', '=', $displayed->email ) ); $where[] = array( 'f.accepted', 'IN', array( '0000-00-00', '0000-00-00 00:00:00', '', null ) ); switch( $plugin->params->get( 'invited_tab_orderby', 1 ) ) { case 2: $orderBy = array( 'ordering', 'DESC' ); break; case 3: $orderBy = array( 'date', 'ASC' ); break; case 4: $orderBy = array( 'date', 'DESC' ); break; case 5: $orderBy = array( 'name', 'ASC' ); break; case 6: $orderBy = array( 'name', 'DESC' ); break; case 7: $orderBy = 'user_count_asc'; break; case 8: $orderBy = 'user_count_desc'; break; case 9: $orderBy = 'nested_count_asc'; break; case 10: $orderBy = 'nested_count_desc'; break; default: $orderBy = null; break; } $total = count( cbgjData::getGroups( array( array( 'grp_access', 'mod_lvl2' ), $user ), $where, $orderBy ) ); if ( $total <= $limitstart ) { $limitstart = 0; } $pageNav = $paging->getPageNav( $total, $limitstart, $limit ); $rows = cbgjData::getGroups( array( array( 'grp_access', 'mod_lvl2' ), $user ), $where, $orderBy, ( $plugin->params->get( 'invited_tab_paging', 1 ) ? array( $pageNav->limitstart, $pageNav->limit ) : null ) ); $pageNav->search = $paging->getInputSearch( 'gjTabForm_invited', 'search', CBTxt::T( 'Search Invited...' ), $search ); $pageNav->searching = $searching; $pageNav->limitbox = $paging->getLimitbox( $pageNav ); $pageNav->pagelinks = $paging->getPagesLinks( $pageNav ); return HTML_groupjiveTabInvited::showInvited( $rows, $pageNav, $displayed, $user, $plugin, $tabbed ); }
/** * render frontend panel main * * @param string $function * @param moscomprofilerUser $user * @param object $plugin * @return string */ static function showPanelMain( $function, $user, $plugin ) { global $_CB_framework; $authorized = cbgjClass::getAuthorization( null, null, $user ); $newCategory = ( $plugin->params->get( 'panel_new_category', 1 ) && cbgjClass::hasAccess( 'cat_create', $authorized ) ); $newGroup = ( $plugin->params->get( 'panel_new_group', 1 ) && cbgjClass::hasAccess( 'grp_create', $authorized ) ); $return = null; if ( $newCategory || $newGroup ) { $return .= '<div class="gjTop gjTopCenter">' . '<div class="btn-group">' . ( $newCategory ? '<input type="button" value="' . htmlspecialchars( CBTxt::P( 'New [category]', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) ) . '" class="gjButton btn" onclick="' . cbgjClass::getPluginURL( array( 'categories', 'new' ), true, true, false, null, true ) . '" />' : null ) . ( $newGroup ? '<input type="button" value="' . htmlspecialchars( CBTxt::P( 'New [group]', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ) ) . '" class="gjButton btn" onclick="' . cbgjClass::getPluginURL( array( 'groups', 'new' ), true, true, false, null, true ) . '" />' : null ) . '</div>' . '</div>'; } switch ( $function ) { case 'categories': default: if ( $plugin->params->get( 'panel_category_display', 1 ) ) { $title = htmlspecialchars( CBTxt::P( 'My [categories]', array( '[categories]' => cbgjClass::getOverride( 'category', true ) ) ) ); $_CB_framework->setPageTitle( $title ); $_CB_framework->appendPathWay( $title, cbgjClass::getPluginURL( array( 'panel', 'categories' ) ) ); $return .= cbgjTab::getCategories( $user, $user, $plugin, false ); break; } case 'groups': if ( $plugin->params->get( 'panel_group_display', 1 ) ) { $title = htmlspecialchars( CBTxt::P( 'My [groups]', array( '[groups]' => cbgjClass::getOverride( 'group', true ) ) ) ); $_CB_framework->setPageTitle( $title ); $_CB_framework->appendPathWay( $title, cbgjClass::getPluginURL( array( 'panel', 'groups' ) ) ); $return .= cbgjTab::getGroups( $user, $user, $plugin, false ); break; } case 'joined': if ( $plugin->params->get( 'panel_joined_display', 1 ) ) { $title = htmlspecialchars( CBTxt::P( 'Joined [groups]', array( '[groups]' => cbgjClass::getOverride( 'group', true ) ) ) ); $_CB_framework->setPageTitle( $title ); $_CB_framework->appendPathWay( $title, cbgjClass::getPluginURL( array( 'panel', 'joined' ) ) ); $return .= cbgjTab::getJoined( $user, $user, $plugin, false ); break; } case 'invites': if ( $plugin->params->get( 'panel_invites_display', 1 ) ) { $title = htmlspecialchars( CBTxt::T( 'My Invites' ) ); $_CB_framework->setPageTitle( $title ); $_CB_framework->appendPathWay( $title, cbgjClass::getPluginURL( array( 'panel', 'invites' ) ) ); $return .= cbgjTab::getInvites( $user, $user, $plugin, false ); break; } case 'invited': if ( $plugin->params->get( 'panel_invited_display', 1 ) ) { $title = htmlspecialchars( CBTxt::T( 'Invited To' ) ); $_CB_framework->setPageTitle( $title ); $_CB_framework->appendPathWay( $title, cbgjClass::getPluginURL( array( 'panel', 'invited' ) ) ); $return .= cbgjTab::getInvited( $user, $user, $plugin, false ); break; } } return $return; }
/** * render frontend overview main * * @param object $rows * @param object $pageNav * @param moscomprofilerUser $user * @param object $plugin * @return string */ static function showOverviewMain( $rows, $pageNav, $user, $plugin ) { $authorized = cbgjClass::getAuthorization( null, null, $user ); $overviewSearch = $plugin->params->get( 'overview_search', 1 ); $overviewPaging = $plugin->params->get( 'overview_paging', 1 ); $overviewLimitbox = $plugin->params->get( 'overview_limitbox', 1 ); $categoryDescLimit = (int) $plugin->params->get( 'overview_cat_desc_limit', 150 ); $categoryApprove = $plugin->params->get( 'category_approve', 0 ); $newCategory = ( $plugin->params->get( 'overview_new_category', 0 ) && cbgjClass::hasAccess( 'cat_create', $authorized ) ); $newGroup = ( $plugin->params->get( 'overview_new_group', 0 ) && cbgjClass::hasAccess( 'grp_create', $authorized ) ); $return = null; if ( $newCategory || $newGroup ) { $return .= '<div class="gjTop gjTopCenter">' . '<div class="btn-group">' . ( $newCategory ? '<input type="button" value="' . htmlspecialchars( CBTxt::P( 'New [category]', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) ) . '" class="gjButton btn" onclick="' . cbgjClass::getPluginURL( array( 'categories', 'new' ), true ) . '" />' : null ) . ( $newGroup ? '<input type="button" value="' . htmlspecialchars( CBTxt::P( 'New [group]', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ) ) . '" class="gjButton btn" onclick="' . cbgjClass::getPluginURL( array( 'groups', 'new' ), true, true, false, null, true ) . '" />' : null ) . '</div>' . '</div>'; } $return .= '<form action="' . cbgjClass::getPluginURL( array( 'overview' ) ) . '" method="post" name="gjForm" id="gjForm" class="gjForm">' . ( $overviewSearch && ( $pageNav->searching || $pageNav->total ) ? '<div class="gjTop gjTopRight">' . $pageNav->search . '</div>' : null ); if ( $rows ) foreach ( $rows as $row ) { $authorized = cbgjClass::getAuthorization( $row, null, $user ); if ( $row->get( 'published' ) == 1 ) { $state = '<div><a href="javascript: void(0);" onclick="' . cbgjClass::getPluginURL( array( 'categories', 'unpublish', (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to unpublish this [category]?', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ), true, false, null, true ) . '"><i class="icon-ban-circle"></i> ' . CBTxt::Th( 'Unpublish' ) . '</a></div>'; } else { $state = '<div><a href="' . cbgjClass::getPluginURL( array( 'categories', 'publish', (int) $row->get( 'id' ) ), null, true, false, null, true ) . '"><i class="icon-ok"></i> ' . CBTxt::Th( 'Publish' ) . '</a></div>'; } $canApprove = ( $categoryApprove && ( $row->get( 'published' ) == -1 ) && cbgjClass::hasAccess( 'cat_can_publish', $authorized ) ); $beforeMenu = cbgjClass::getIntegrations( 'gj_onBeforeOverviewCategoryMenu', array( $row, $user, $plugin ) ); $afterMenu = cbgjClass::getIntegrations( 'gj_onAfterOverviewCategoryMenu', array( $row, $user, $plugin ) ); $return .= '<div class="gjContent row-fluid">' . '<div class="gjContentLogo span2">' . $row->getLogo( true, true, true ) . '</div>' . '<div class="gjContentBody mini-layout span10">' . '<div class="gjContentBodyHeader row-fluid">' . '<div class="gjContentBodyTitle span9"><h5>' . $row->getName( 0, true ) . '<small> ' . cbFormatDate( $row->get( 'date' ), 1, false ) . '</small></h5></div>' . '<div class="gjContentBodyMenu span3">'; if ( $canApprove ) { $return .= '<input type="button" value="' . htmlspecialchars( CBTxt::T( 'Approve' ) ) . '" class="gjButton btn btn-mini btn-success" onclick="' . cbgjClass::getPluginURL( array( 'categories', 'publish', (int) $row->get( 'id' ) ), true, true, false, null, true ) . '" />'; } else { if ( ( $row->get( 'published' ) == 0 ) || ( ( $row->get( 'published' ) == 1 ) && ( ! cbgjClass::hasAccess( 'cat_approved', $authorized ) ) ) ) { $return .= cbgjClass::getIcon( null, CBTxt::P( 'This [category] is currently unpublished.', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ), 'icon-eye-close' ); } } if ( $beforeMenu || cbgjClass::hasAccess( array( 'mod_lvl1', 'cat_can_publish' ), $authorized ) || $afterMenu ) { $menuItems = $beforeMenu . ( cbgjClass::hasAccess( 'mod_lvl1', $authorized ) ? '<div><a href="' . cbgjClass::getPluginURL( array( 'categories', 'edit', (int) $row->get( 'id' ) ), null, true, false, null, true ) . '"><i class="icon-pencil"></i> ' . CBTxt::Th( 'Edit' ) . '</a></div>' : null ) . ( ( ! $canApprove ) && cbgjClass::hasAccess( 'cat_can_publish', $authorized ) ? $state : null ) . ( cbgjClass::hasAccess( 'mod_lvl1', $authorized ) ? '<div><a href="javascript: void(0);" onclick="' . cbgjClass::getPluginURL( array( 'categories', 'delete', (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to delete this [category] and all its associated [groups]?', array( '[category]' => cbgjClass::getOverride( 'category' ), '[groups]' => cbgjClass::getOverride( 'group', true ) ) ), true, false, null, true ) . '"><i class="icon-remove"></i> ' . CBTxt::Th( 'Delete' ) . '</a></div>' : null ) . $afterMenu; $return .= cbgjClass::getDropdown( $menuItems, CBTxt::Th( 'Menu' ) ); } $return .= '</div>' . '</div>' . '<div class="gjContentBodyInfo">' . ( $row->getDescription( $categoryDescLimit ) ? '<div class="well well-small">' . $row->getDescription( $categoryDescLimit ) . '</div>' : null ) . '</div>' . '<div class="gjContentDivider"></div>' . '<div class="gjContentBodyFooter">' . cbgjClass::getIntegrations( 'gj_onBeforeOverviewCategoryInfo', array( $row, $user, $plugin ), null, 'span' ) . ( ( ( ( ! $row->get( 'nested' ) ) && cbgjClass::hasAccess( 'mod_lvl1', $authorized ) ) || $row->get( 'nested' ) ) && $row->nestedCount() ? cbgjClass::getOverride( 'category', $row->nestedCount() ) . ' | ' : null ) . ( $row->groupCount() ? cbgjClass::getOverride( 'group', $row->groupCount() ) . ' | ' : null ) . implode( ', ', $row->getTypes() ) . cbgjClass::getIntegrations( 'gj_onAfterOverviewCategoryInfo', array( $row, $user, $plugin ), null, 'span' ) . '</div>' . '</div>' . '</div>'; } else { $return .= '<div class="gjContent">'; if ( $overviewSearch && $pageNav->searching ) { $return .= CBTxt::Ph( 'No [category] search results found.', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ); } else { $return .= CBTxt::Ph( 'There are no [categories] available.', array( '[categories]' => cbgjClass::getOverride( 'category', true ) ) ); } $return .= '</div>'; } if ( $overviewPaging ) { $return .= '<div class="gjPaging pagination pagination-centered">' . ( $pageNav->total > $pageNav->limit ? $pageNav->pagelinks : null ) . ( ! $overviewLimitbox ? $pageNav->getLimitBox( false ) : ( $pageNav->total ? '<div class="gjPagingLimitbox">' . $pageNav->limitbox . '</div>' : null ) ) . '</div>'; } $return .= cbGetSpoofInputTag( 'plugin' ) . '</form>'; return $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 }
static function renderGenericJs() { cbimport('language.cbteamplugins'); ?> $.extend(jQuery.validator.messages, { required: "<?php echo addslashes(CBTxt::T("This field is required.")); ?> ", remote: "<?php echo addslashes(CBTxt::T("Please fix this field.")); ?> ", email: "<?php echo addslashes(CBTxt::T("Please enter a valid email address.")); ?> ", url: "<?php echo addslashes(CBTxt::T("Please enter a valid URL.")); ?> ", date: "<?php echo addslashes(CBTxt::T("Please enter a valid date.")); ?> ", dateISO: "<?php echo addslashes(CBTxt::T("Please enter a valid date (ISO).")); ?> ", number: "<?php echo addslashes(CBTxt::T("Please enter a valid number.")); ?> ", digits: "<?php echo addslashes(CBTxt::T("Please enter only digits.")); ?> ", creditcard: "<?php echo addslashes(CBTxt::T("Please enter a valid credit card number.")); ?> ", equalTo: "<?php echo addslashes(CBTxt::T("Please enter the same value again.")); ?> ", accept: "<?php echo addslashes(CBTxt::T("Please enter a value with a valid extension.")); ?> ", maxlength: $.validator.format("<?php echo addslashes(CBTxt::T("Please enter no more than {0} characters.")); ?> "), minlength: $.validator.format("<?php echo addslashes(CBTxt::T("Please enter at least {0} characters.")); ?> "), rangelength: $.validator.format("<?php echo addslashes(CBTxt::T("Please enter a value between {0} and {1} characters long.")); ?> "), range: $.validator.format("<?php echo addslashes(CBTxt::T("Please enter a value between {0} and {1}.")); ?> "), max: $.validator.format("<?php echo addslashes(CBTxt::T("Please enter a value less than or equal to {0}.")); ?> "), min: $.validator.format("<?php echo addslashes(CBTxt::T("Please enter a value greater than or equal to {0}.")); ?> ") }); { var firstInvalidFieldFound = 0; $('#cbcheckedadminForm').submit( function() { var v = $(this).validate(); v.cbIsFormSubmitting = true; var r = $(this).validate().form(); v.cbIsFormSubmitting = false; if ( ! r ) { $(this).validate().focusInvalid(); } return r; } ); $('#cbcheckedadminForm').validate( { onsubmit : false, ignoreTitle : true, errorClass: 'cb_result_warning', // debug: true, cbIsOnKeyUp: false, cbIsFormSubmitting: false, highlight: function( element, errorClass ) { $( element ).parents('.fieldCell').parent().addClass( 'cbValidationError' ); // tables $( element ).parents('.cb_field,.cb_form_line').addClass( 'cbValidationError' ); // divs $( element ).addClass( 'cbValidationError' + $(element).attr('type') ); $( element ).parents('.tab-page').addClass('cbValidationErrorTab') .each( function() { $(this).siblings('.tab-row') .find('h2:nth-child(' + $(this).index() + ')') .addClass('cbValidationErrorTabTip'); }) .filter(':not(:visible)').each( function() { if ( ! firstInvalidFieldFound++ ) { showCBTab( $(this).attr('id').substr(5) ); } });; }, unhighlight: function( element, errorClass ) { if ( this.errorList.length == 0 ) { firstInvalidFieldFound = 0; } $( element ).parents('.fieldCell').parent().removeClass( 'cbValidationError' ); // tables $( element ).parents('.cb_field,.cb_form_line').removeClass( 'cbValidationError' ); // divs $( element ).removeClass( 'cbValidationError' + $(element).attr('type') ); $( element ).parents('.tab-page') .each( function() { if ( $(this).find('.cbValidationError').size() == 0 ) { $(this).removeClass('cbValidationErrorTab') .siblings('.tab-row') .find('h2:nth-child(' + $(this).index() + ')') .removeClass('cbValidationErrorTabTip'); } }); }, errorElement: 'div', errorPlacement: function(error, element) { element.closest('.fieldCell, .cb_field').append( error[0] ); // .fieldCell : tables, .cb_field : div }, onkeyup: function(element) { if ( element.name in this.submitted || element == this.lastElement ) { // avoid remotejhtml rule onkeyup this.cbIsOnKeyUp = true; this.element(element); this.cbIsOnKeyUp = false; } <?php /* }, showErrors: function(errorMap, errorList) { var messages; for ( var i = 0; errorList[i]; i++ ) { messages += errorList[i].message + "\n"; } this.defaultShowErrors(); alert( messages ); }, rules: { username: { required: true, minlength: 3 //, // remote: "users.php" }, password: { required: true, minlength: 6 }, password_confirm: { required: true, minlength: 6, equalTo: "#password" }, email: { required: true, email: true //, //remote: "emails.php" } }, */ /* messages: { username: { required: "Please enter a username", minlength: jQuery.format("Enter at least {0} characters"), remote: jQuery.format("{0} is already in use") }, password: { required: "Please provide a password", rangelength: jQuery.format("Enter at least {0} characters") }, password_confirm: { required: "Please repeat your password", minlength: jQuery.format("Enter at least {0} characters"), equalTo: "Enter the same password as above" }, email: { required: "Please enter a valid email address", minlength: "Please enter a valid email address" //, // remote: jQuery.format("{0} is already in use") } */ ?> } } ); $('#cbcheckedadminForm input:checkbox,#cbcheckedadminForm input:radio').click( function() { $('#cbcheckedadminForm').validate().element( $(this) ); } ); $( '#cbcheckedadminForm .cbDateinputJs select' ).change( function() { var datefield = $(this).parent().prev('input'); if ( datefield.length ) { $('#cbcheckedadminForm').validate().element( datefield ); } } ); } <?php echo implode("\n", self::$methods) . "\n"; echo self::$rules; }
/** * Translates, prepares the HTML $htmlText with triggering CMS Content Plugins, replaces CB substitutions and extra HTML and non-HTML substitutions * @see CBuser::replaceUserVars * * @param string $mainText * @param int $user_id * @param boolean $html * @param boolean $translateMainText * @param boolean $prepareHtmlContentPlugins * @param array|null $extraHtmlStrings * @param array|null $extraNonHtmlStrings * @return string */ public static function replaceUserVars( $mainText, $user_id, $html, $translateMainText = true, $prepareHtmlContentPlugins = false, $extraHtmlStrings = null, $extraNonHtmlStrings = null ) { if ( $translateMainText ) { $mainText = $html ? parent::Th( $mainText ) : parent::T( $mainText ); } if ( $prepareHtmlContentPlugins ) { $mainText = Application::Cms()->prepareHtmlContentPlugins( $mainText ); if ( ! $html ) { $mainText = strip_tags( $mainText ); } } $cbUser = CBuser::getInstance( (int) $user_id ); if ( ! $cbUser ) { $cbUser = CBuser::getInstance( null ); } $mainText = $cbUser->replaceUserVars( $mainText, true, false, $extraNonHtmlStrings, false ); if ( $extraHtmlStrings ) { foreach ( $extraHtmlStrings as $k => $v ) { $mainText = str_replace( "[$k]", $html ? $v : strip_tags( $v ), $mainText ); } } return $mainText; }
/** * Function for the backend XML * * @param string $name Name of the control * @param string $value Current value * @param string $control_name Name of the controlling array (if any) * @return string HTML for the control data part or FALSE in case of error */ function loadExistingForums( $name, $value, $control_name ) { global $_CB_framework; $img_path = $_CB_framework->getCfg( 'live_site' ) . '/components/com_comprofiler/images/'; $installed = '<img src="' . $img_path . 'approve.png" alt="Installed" title="Installed" border="0" />'; $uninstalled = '<img src="' . $img_path . 'reject.png" alt="Uninstalled" title="Uninstalled" border="0" />'; $path = $_CB_framework->getCfg( 'absolute_path' ); $forums = null; if ( file_exists( $path . '/administrator/components/com_joomlaboard/' ) ) { $forums .= '<div>' . $installed . ' ' . CBTxt::T( 'Joomlaboard' ) . '</div>'; } else { $forums .= '<div>' . $uninstalled . ' ' . CBTxt::T( 'Joomlaboard' ) . '</div>'; } if ( file_exists( $path . '/administrator/components/com_simpleboard/' ) ) { $forums .= '<div>' . $installed . ' ' . CBTxt::T( 'Simpleboard' ) . '</div>'; } else { $forums .= '<div>' . $uninstalled . ' ' . CBTxt::T( 'Simpleboard' ) . '</div>'; } if ( file_exists( $path . '/administrator/components/com_fireboard/' ) ) { $forums .= '<div>' . $installed . ' ' . CBTxt::T( 'Fireboard' ) . '</div>'; } else { $forums .= '<div>' . $uninstalled . ' ' . CBTxt::T( 'Fireboard' ) . '</div>'; } if ( file_exists( $path . '/administrator/components/com_kunena/' ) ) { $forums .= '<div>' . $installed . ' ' . CBTxt::T( 'Kunena (It is advised to select Kunena manually as Kunena has additional options)' ) . '</div>'; } else { $forums .= '<div>' . $uninstalled . ' ' . CBTxt::T( 'Kunena' ) . '</div>'; } return $forums; }
/** * finds and accepts a users invites when registered within CB (front and backend) * * @param moscomprofilerUser $user */ public function acceptInvites( $user ) { $plugin = cbgjClass::getPlugin(); if ( $plugin->params->get( 'group_invites_accept', 1 ) ) { $invites = cbgjData::getInvites( null, array( 'email', '=', $user->email ) ); if ( $invites ) foreach ( $invites as $invite ) { $invite->set( 'accepted', cbgjClass::getUTCDate() ); $invite->set( 'user', (int) $user->id ); if ( $invite->store() ) { $row = cbgjData::getUsers( null, array( array( 'group', '=', (int) $invite->get( 'group' ) ), array( 'user_id', '=', (int) $user->id ) ), null, null, false ); if ( ! $row->get( 'id' ) ) { $row->set( 'user_id', (int) $user->id ); $row->set( 'group', (int) $invite->get( 'group' ) ); $row->set( 'date', cbgjClass::getUTCDate() ); $row->set( 'status', 1 ); $row->store(); } } $notification = cbgjData::getNotifications( array( array( 'grp_usr_notifications' ), 'owner' ), array( array( 'type', '=', 'group' ), array( 'item', '=', (int) $invite->get( 'group' ) ), array( 'user_id', '=', (int) $invite->get( 'user_id' ) ), array( 'params', 'CONTAINS', 'group_inviteaccept=1' ) ), null, null, false ); if ( $notification->get( 'id' ) ) { $subject = CBTxt::T( '[group_name] - Invite Accepted!' ); $message = CBTxt::T( '[user] has accepted your invite to join [group] in [category]!' ); cbgjClass::getNotification( $notification->get( 'user_id' ), $invite->get( 'user' ), $subject, $message, 1, $invite->getCategory(), $invite->getGroup() ); } } } }
/** * @param string The name of the form element * @param string The value of the element * @param CBSimpleXMLElement $node The xml element for the parameter * @param string The control name * @return string The html for the element */ function _form_field( $name, $value, &$node, $control_name ) { global $_CB_database; $query = "SELECT f.fieldid AS value, f.title AS text" . "\n FROM #__comprofiler_fields AS f" . "\n LEFT JOIN #__comprofiler_tabs AS t ON t.tabid = f.tabid" . "\n WHERE f.published = 1 AND f.name != 'NA'" . "\n ORDER BY t.ordering, f.ordering" ; $_CB_database->setQuery( $query ); $options = $_CB_database->loadObjectList(); for ($i=0, $n=count($options); $i<$n; $i++) { $options[$i]->text = CBTxt::T( getLangDefinition( $options[$i]->text ) ); } array_unshift( $options, moscomprofilerHTML::makeOption( '0', '- Select Field -' ) ); return moscomprofilerHTML::selectList( $options, ''. $this->control_name( $control_name, $name ) . '', 'class="inputbox" id="' . $this->control_id( $control_name, $name ) . '"', 'value', 'text', $value, 2, true, false ); }