My Groups

You are not a member of any group.

Login

Message Box

You are not logged in.

Notification

Members Online

None

User Statistics

Registered users : 38790
Online : 3811
Guest : 3811
Members : 0

Online members
No members online!

Last 5 users
dienul82
suksesbisnismlm
ariefalbani
dracostar
rendrapratama
registerFunction( 'onBeforeUserUpdate','protectFields', 'getProtectFieldsTab' ); /** * Protection Tab Class for handling the CB tab api * @package Community Builder * @author JoomlaJoe and Beat */ class getProtectFieldsTab extends cbTabHandler { /** * Constructor */ function getProtectFieldsTab() { $this->cbTabHandler(); } /** * gets object with name, title and table corresponding to a field id * @access private * @param int fieldId * @returns mixed : either object, or null if no match */ function getFieldInfo($protectFieldId) { global $database; if ($protectFieldId == "0") return null; $query = "SELECT `name`,`table`,`title`,`type` FROM #__comprofiler_fields WHERE published=1 AND fieldid=".$protectFieldId; $database->setQuery($query); $protectObj = null; $database->loadObject($protectObj); return $protectObj; } /** * Discards all changes the user makes to email field. Admins are allowed to change email addresses. * Method is called before user data is stored in the database * @access private * @param object holds the core mambo user data * @param object holds the community builder user data * @param object holds the field information * @return boolean true check ok no changes, FALSE error raised */ function checkMyFieldChanges(&$user,&$cbUser,$protectObj) { global $database, $my, $_PLUGINS; if ($protectObj === null) return true; $params = $this->params; $alertMsg = htmlspecialchars($params->get('alertMsg', '0')); $protectFieldName = $protectObj->name; $protectTable = $protectObj->table; $protectTitle = $protectObj->title; //if ($my->gid != 2) { // admins can change their profile unrestricted from the backend if ($protectTable != "#__comprofiler") { $query = "SELECT `".$database->getEscaped($protectFieldName)."` FROM #__users WHERE id=".$user->id." LIMIT 1"; $pObject =& $user; } else { $query = "SELECT `".$database->getEscaped($protectFieldName)."` FROM #__comprofiler WHERE id=".$user->id." LIMIT 1"; $pObject =& $cbUser; } $database->setQuery($query); $pOriginalField = $database->loadResult(); //The field before the change was attempted if ($pObject->$protectFieldName != $pOriginalField) { $_PLUGINS->raiseError(0); $_PLUGINS->_setErrorMSG(htmlspecialchars(getLangDefinition($protectTitle))." ".$alertMsg); $pObject->$protectFieldName = $pOriginalField; return false; } //} return true; } /** * generates javascript code to check and flag at browser end * @access private * @param object tab reflecting the tab database entry * @param object mosUser reflecting the user being displayed * @param object holds the field information */ function getEditTabJScode(&$user,$protectObj) { if ($protectObj == null) return; $params = $this->params; $alertMsg = $params->get('alertMsg', '0'); $protectFieldName = $protectObj->name; $protectTitle = $protectObj->title; $protectValue = $user->$protectFieldName; //Type matters ;) $protectType = $protectObj->type; //We need to add square brackets for accessing select, multiselect and mulitcheckbox in JS $addBrackets = ""; if($protectType == "multiselect" || $protectType == "select" || $protectType == "multicheckbox"){$addBrackets = "[]";} $this->_addValidationJS( "\t if (getInputValue(me['".htmlspecialchars($protectFieldName).$addBrackets."'])!=getInputDefaultValue(me['".htmlspecialchars($protectFieldName).$addBrackets."'])){\n" ."\t errorMSG += \"".html_entity_decode(getLangDefinition($protectTitle)." ".$alertMsg)."\\n\"\n" ."\t me['".htmlspecialchars($protectFieldName).$addBrackets."'].style.background = \"red\";\n" ."\t setInputValue(me['".htmlspecialchars($protectFieldName).$addBrackets."'],getInputDefaultValue(me['".htmlspecialchars($protectFieldName).$addBrackets."']));\n" ."\t iserror=1;\n" ."\t} else {\n" ."\t me['".htmlspecialchars($protectFieldName).$addBrackets."'].style.background = cbDefaultFieldBackground;\n" ."\t}\n"); // also see event: 'onBeforeUserUpdate' : must also be implemented as above to avoid changes with JS off. } /** * Discards all changes the user makes to email field. Admins are allowed to change email addresses. * Method is called before user data is stored in the database * @param array holds the core mambo user data * @param array holds the community builder user data */ function protectFields(&$user,&$cbUser) { $params = $this->params; $protectFieldId = $params->get('protect1', '0'); $result1 = $this->checkMyFieldChanges($user, $cbUser, $this->getFieldInfo($protectFieldId)); $protectFieldId = $params->get('protect2', '0'); $result2 = $this->checkMyFieldChanges($user, $cbUser, $this->getFieldInfo($protectFieldId)); $protectFieldId = $params->get('protect3', '0'); $result3 = $this->checkMyFieldChanges($user, $cbUser, $this->getFieldInfo($protectFieldId)); $protectFieldId = $params->get('protect4', '0'); $result4 = $this->checkMyFieldChanges($user, $cbUser, $this->getFieldInfo($protectFieldId)); return result1 && result2 && restult3 && result4; } /** * Generates the HTML to display the user edit tab * @param object tab reflecting the tab database entry * @param object mosUser reflecting the user being displayed * @param int 1 for front-end, 2 for back-end * @returns mixed : either string HTML for tab content, or false if ErrorMSG generated */ function getEditTab($tab,$user,$ui) { if ($ui == 2) return ""; // don't protect backend user edits. $params = $this->params; //Functions used in every check. So let's include them here only once. $this->_addValidationJS( "\t // ===================================================================\n" ."\t //JavaScript functions\n" ."\t // Author: Matt Kruse \n" ."\t // WWW: http://www.mattkruse.com/\n" ."\t // ===================================================================\n" ."\t //-------------------------------------------------------------------\n" ."\t // isArray(obj)\n" ."\t // Returns true if the object is an array, else false\n" ."\t //-------------------------------------------------------------------\n" ."\t function isArray(obj){return(typeof(obj.length)==\"undefined\")?false:true;}\n" ."\t //-------------------------------------------------------------------\n" ."\t // getInputValue(input_object[,delimiter])\n" ."\t // Get the value of any form input field\n" ."\t // Multiple-select fields are returned as comma-separated values, or\n" ."\t // delmited by the optional second argument\n" ."\t // (Doesn't support input types: button,file,reset,submit)\n" ."\t //-------------------------------------------------------------------\n" ."\t function getInputValue(obj,delimiter) {\n" ."\t var use_default=(arguments.length>2)?arguments[2]:false;\n" ."\t if (isArray(obj) && (typeof(obj.type)==\"undefined\")) {\n" ."\t var values=new Array();\n" ."\t for(var i=0;i0)?obj.options[obj.selectedIndex].value:null;\n" ."\t case 'select-multiple': \n" ."\t if (obj.options==null) { return null; }\n" ."\t var values=new Array();\n" ."\t for(var i=0;i1)?arguments[1]:false;\n" ."\t if(isArray(obj)&&(typeof(obj.type)==\"undefined\")){\n" ."\t for(var i=0;iget('protect1', '0'); $this->getEditTabJScode($user, $this->getFieldInfo($protectFieldId)); $protectFieldId = $params->get('protect2', '0'); $this->getEditTabJScode($user, $this->getFieldInfo($protectFieldId)); $protectFieldId = $params->get('protect3', '0'); $this->getEditTabJScode($user, $this->getFieldInfo($protectFieldId)); $protectFieldId = $params->get('protect4', '0'); $this->getEditTabJScode($user, $this->getFieldInfo($protectFieldId)); return ""; } } // end class getProtectFieldsTab. ?>
Welcome, Guest
Please Login or Register.    Lost Password?
PERKENALKAN, MODERATOR FORUM MARKETING AOOTB!!!
07/01/2010 | lulut _

Halo AOOTB 'ers   Komunitas Marketing AOOTB punya moderator baru nan handal, namanya Ronald Sipahutar. pecinta marketing yang berlatar belakang  pendidikan di FE Universitas Riau jurusan Management angkatan 97, kemudian melanjutkan program CBM- Operation di Prasetya Mulya dan sekarang ini sedang [ ... ]


RULES OF FORUM
06/01/2010 | Administrator

Topik Diskusi harus didominasi oleh Keilmuan Marketing sesuai dengan tujuan dari Grup ini yaitu Marketing. Diskusi harus bebas dari SARA dan Politik. Opini dalam Diskusi harus didasarkan oleh Keilmuan dan bukan atas dasar sentiment ketidaksukaan atas sebuah peristiwa atau hal-hal yang berkaitan  [ ... ]


Other Announcement

    (1 viewing) (1) Guest
    Main ForumMain Forum adalah tempat berdiskusi ttg Case, Problem dan Peristiwa yang Terjadi atau akan Terjadi di Dunia Marketing
      Forum Topics Replies Last Post
    No New Posts
    B2B
    Posting Thread anda disini jika ingin berdiskusi ttg Strategi Marketing di Industri Business to Business (B2B)
    10 48
    by ronaldsipahutar | 07/09/2010 13:38 Show most recent message
    No New Posts
    B2C
    Posting Thread anda disini jika ingin berdiskusi ttg Strategi Marketing di Industri Business to Consumer (B2C)
    35 143
    by dakhastore | 07/18/2011 12:38 Show most recent message
    No New Posts 196 791
    by budi | 07/17/2010 13:15 Show most recent message
      Forum Topics Replies Last Post
    No New Posts
    Jika anda memiliki Informasi Lowongan Pekerjaan (Khusus Bidang Marketing & Sales) Posting disini. Pastikan Selalu mencatumkan Nama dan Alamat Lengkap Perusahaan.
    6 3
    by kurniawanboy | 06/23/2010 11:33 Show most recent message
    No New Posts
    Jika anda memiliki Informasi Workshop & Seminar (Khusus Bidang Marketing & Sales) Posting disini. Pastikan Selalu mencatumkan Nama dan Alamat Lengkap Perusahaan.
    10 7
    by kurniawanboy | 06/23/2010 11:38 Show most recent message
    No New Posts
    Jika anda memiliki Informasi mengenai Kompetisi (offline dan online) khusus untuk bidang Marketing & Sales Silahkan Posting Disini. Pastikan mencantumkan Informasi detail mengenai penyelanggara & Lomba
    3 6
    by UNILAxioo | 01/29/2010 19:41 Show most recent message
    No New Posts
    Segala hal berkaitan dengan AIMA, silahkan posting Threadnya disini
    11 28
    by Suhandies | 05/01/2010 13:13 Show most recent message
      Forum Topics Replies Last Post
    No New Posts
    Daftarkan Blog Marketing & Sales anda untuk bisa menjadi sumber resources bersama.
    2 3
    by Suhandies | 06/01/2010 00:13 Show most recent message
    No New Posts
    Jika anda memiliki Tulisan, Ulasan ataupun hasil saduran dari Artikel-artikel Marketing & Sales bisa diposting disini. (ingat jika ingin berdiskusi, gunakan Main Forum)
    2 1
    by ronaldsipahutar | 07/26/2010 15:31 Show most recent message
      Forum Topics Replies Last Post
    No New Posts
    Child Boards :
    No New Posts Seller(11/23)
    No New Posts Buyer(2/26)
    13 49
    by meyjaroni | 08/18/2010 04:35 Show most recent message
    No New Posts
    Jika anda membutuhkan bantuan mengenai Forum, silahkan share disini. Para member Forum dan Moderator akan membantu anda. (Group ini hanya berkaitan dengan Forum dan Fitur-fiturnya.
    3 22
    by Coal | 05/20/2010 11:09 Show most recent message
    No New Posts
    Punya Quote ttg Marketing & Sales? Share Quote anda disini
    3 1
    by UNILAxioo | 02/16/2010 21:30 Show most recent message
    No New Posts
    Punya Idea-Idea Unik ttg Usaha, Jasa dan Startegi Marketing? Post Disini! (untuk diskusi mengenai Case Marketing Gunakan Main Forum)
    1 0
    by UNILAxioo | 01/15/2010 20:02 Show most recent message
      Forum Topics Replies Last Post
    No New Posts 16 103
    by UNILAxioo | 01/29/2010 19:42 Show most recent message
      Forum Topics Replies Last Post
    No New Posts 0 0 No Posts
      Forum Topics Replies Last Post
    No New Posts 38 176
    by pennyyoung | 07/01/2011 09:28 Show most recent message
    No New Posts 20 68
    by budi | 07/17/2010 14:12 Show most recent message
    Members Statistic Members Statistics:
    » Total Users: 38790
    » Latest Member: dienul82
    » User List
    Messages Statistic Forum Statistics:
    Total Messages: 1820   Total Subjects: 371   Total Sections: 8   Total Categories: 27
    Today Open: 0   Yesterday Open: 0   Today Total Answer: 0   Yesterday Total Answer: 0
    » View Recent Posts » More About Stats
    get the latest posts directly to your desktop