public function captcha() { $this->init(); $this->load->helper('captcha'); $captcha = get_captcha(); $this->session->set_userdata('captcha', $captcha['word']); echo $captcha['image']; }
function captcha_challenge() { global $remote_ip; list($captcha_id, $question) = get_captcha(); $captcha_challenge = array(); $captcha_challenge["remote_ip"] = $remote_ip; $captcha_challenge["captcha_id"] = $captcha_id; db_set_rec("captcha_challenge", $captcha_challenge); return $question; }
function content_55e4485ead5e40_22088703($_smarty_tpl) { if ($_smarty_tpl->tpl_vars['userquery']->value->login_check('', true) || $_smarty_tpl->tpl_vars['Cbucket']->value->configs['anonym_comments'] == 'yes') { ?> <div class="add_comment_box" id="add_comment"> </div> <div class=""> <div id="comment-add-err"></div> <script type="text/javascript"> //Edit the counter/limiter value as your wish var count = "125"; //Example: var count = "175"; function limiter(){ var tex = document.myform.comment.value; var len = tex.length; if(len > count){ tex = tex.substring(0,count); document.myform.comment.value =tex; return false; } document.myform.limit.value = count-len; } </script> <form class="" id="comment_form" name="myform"> <input type="hidden" name="reply_to" id="reply_to" value="0"> <input type="hidden" name="obj_id" id="obj_id" value="<?php echo $_smarty_tpl->tpl_vars['id']->value; ?> "> <?php if (!$_smarty_tpl->tpl_vars['userquery']->value->login_check('', true) && $_smarty_tpl->tpl_vars['Cbucket']->value->configs['anonym_comments'] == 'yes') { ?> <div class="form-group"> <label for="comment_name"> <?php echo smarty_lang(array('code' => 'name'), $_smarty_tpl); ?> </label> <input type="text" name="name" id="comment_name" class="form-control"> </div> <div class="form-group"> <label for="comment_email"> <?php echo smarty_lang(array('code' => 'email_wont_display'), $_smarty_tpl); ?> </label> <input type="email" name="email" id="comment_email" class="form-control"> </div> <?php } else { ?> <strong class="comment-as"><?php echo sprintf(lang('Comment as %s'), $_smarty_tpl->tpl_vars['userquery']->value->username); ?> </strong> <?php } ?> <?php echo ANCHOR(array('place' => 'before_compose_box'), $_smarty_tpl); ?> <?php if (config('comments_captcha') == 'all' || config('comments_captcha') == 'guests' && !$_smarty_tpl->tpl_vars['userquery']->value->login_check('', true)) { ?> <div class="form-group"> <?php if (isset($_smarty_tpl->tpl_vars['captcha'])) { $_smarty_tpl->tpl_vars['captcha'] = clone $_smarty_tpl->tpl_vars['captcha']; $_smarty_tpl->tpl_vars['captcha']->value = get_captcha(); $_smarty_tpl->tpl_vars['captcha']->nocache = null; $_smarty_tpl->tpl_vars['captcha']->scope = 0; } else { $_smarty_tpl->tpl_vars['captcha'] = new Smarty_variable(get_captcha(), null, 0); } ?> <?php if ($_smarty_tpl->tpl_vars['captcha']->value) { ?> <?php if ($_smarty_tpl->tpl_vars['captcha']->value['show_field']) { ?> <label class="label" for="captcha">Verification Code</label> <?php echo load_captcha(array('captcha' => $_smarty_tpl->tpl_vars['captcha']->value, 'load' => 'field', 'field_params' => ' id="captcha" class="input" '), $_smarty_tpl); ?> <?php } ?> <?php echo load_captcha(array('captcha' => $_smarty_tpl->tpl_vars['captcha']->value, 'load' => 'function'), $_smarty_tpl); ?> <?php } ?> </div> <?php } ?> <div class="form-group"> <?php if (!$_smarty_tpl->tpl_vars['userquery']->value->login_check('', true) && $_smarty_tpl->tpl_vars['Cbucket']->value->configs['anonym_comments'] == 'yes') { ?> <label for="comment_text"> <?php echo smarty_lang(array('code' => 'Your comment'), $_smarty_tpl); ?> </label> <?php } ?> <script type="text/javascript"> document.write("<input style='float:right;margin-top:-31px' type=text name=limit size=4 readonly value="+count+">"); </script> <div class="clear"></div> <textarea onkeyup="limiter()" name="comment" placeholder="Type your comment here. Make sure it means something.." id="comment_text" class="form-control clearfix comment_text_new"></textarea> <div id="reply_to_img"><i class="glyphicon glyphicon-share-alt" style="color:#428BCA;"></i></div> </div> <div class="form-group clearfix"> <button data-loading-text="Loading..." type="button" class="hidden-xs hidden-sm btn btn-primary pull-right" id="addCommentButton"><?php echo lang('Comment'); ?> </button> </div> <script> function blink(selector){ $(selector).fadeOut('slow', function(){ $(this).fadeIn('slow', function(){ blink(this); }); }); } var ajaxPage = baseurl+'/ajax.php'; $('#addCommentButton').on('click',function(e){ e.preventDefault(); var btn =$(this); btn.button('loading'); $('#comment-add-err').hide(); var data = $(this).parents("form").serialize() + "&type=<?php echo $_smarty_tpl->tpl_vars['type']->value; ?> &mode=add_comment"; console.log(data); $.ajax({ url: ajaxPage, type: "post", data: data, dataType : 'json', }).success(function(response){ //var response = $.parseJSON(response); var cid = parseInt(response.cid); if(cid > 1){ $.ajax({ url: ajaxPage, type: "post", data: { mode: "get_comment", cid: cid, }, }).success(function(comment){ $("#comment_text").val(''); $("#userCommentsList").prepend(comment); var count_comments = $("#comment_counter").val(); $("#com_count").html(""); $("#com_count").append('Comments '+count_comments); }); }else{ if(response.msg){ $('#comment-add-err').show().html(response.msg); } else if(response.err) { $('#comment-add-err').show().html(response.err); } } btn.button('reset'); }); }); </script> <div class="hidden-lg hidden-md mbxl"> <button type="submit" class="btn btn-primary" onclick="add_comment_js('comment_form','<?php echo $_smarty_tpl->tpl_vars['type']->value; ?> ')<?php echo ANCHOR(array('place' => 'onClickAddComment'), $_smarty_tpl); ?> "><?php echo lang('Comment'); ?> </button> </div> </form> <div id="add_comment_result" class="add_comment_result mtm mbm" style="display:none"></div> <?php } else { ?> <?php echo smarty_lang(array('code' => 'please_login_to_comment'), $_smarty_tpl); ?> <?php } ?> </div> <style> #reply_to_img{ position:absolute; margin-left:686px; margin-top:-65px; display:none; } </style> <!-- Script by hscripts.com --> <?php }
/** |========================================================== | Create Captcha |========================================================== | */ function create_captcha() { $seed = rand(); return get_captcha($seed); }
/** * Function used to verify captcha */ function verify_captcha() { $var = post('cb_captcha_enabled'); if ($var == 'yes') { $captcha = get_captcha(); $val = $captcha['validate_function'](post(GLOBAL_CB_CAPTCHA)); return $val; } else { return true; } }
function content_56afda72e12f03_17643218($_smarty_tpl) { ?> <div class="row add-comments clearfix" id="add_comment"> <?php if ($_smarty_tpl->tpl_vars['userquery']->value->login_check('', true) || $_smarty_tpl->tpl_vars['Cbucket']->value->configs['anonym_comments'] == 'yes') { ?> <form name="comment_form" method="post" action="" id="comment_form" onsubmit="return false;"> <div class="col-lg-12"> <span id="comment_err_output" class="alert alert-danger comment_err_output pull-left" style="display:none;width:100%"></span> <span id="comment_msg_output" class="alert alert-success comment_msg_output pull-left" style="display:none;"></span> <input type="hidden" name="reply_to" id="reply_to" value="0"> <input type="hidden" name="obj_id" id="obj_id" value="<?php echo $_smarty_tpl->tpl_vars['id']->value; ?> "> <input type="hidden" name="type" value="<?php echo $_smarty_tpl->tpl_vars['type']->value; ?> " /> <?php if (!$_smarty_tpl->tpl_vars['userquery']->value->login_check('', true) && $_smarty_tpl->tpl_vars['Cbucket']->value->configs['anonym_comments'] == 'yes') { ?> <div class="clearfix"></div> <label for="name" class="Label"><?php echo smarty_lang(array('code' => 'name'), $_smarty_tpl); ?> </label> <input type="text" name="name" id="name" class="form-control" placeholder="Your Name"> <div class="clearfix"></div> <br> <div class="clearfix"></div> <label for="email" class="Label"><?php echo smarty_lang(array('code' => 'email_wont_display'), $_smarty_tpl); ?> </label> <input type="text" name="email" id="email" class="form-control" placeholder="Your Email"> <div class="clearfix"></div> <br> <?php } else { ?> <div class="clearfix"></div> <label class="Label"><?php echo smarty_lang(array('code' => "name"), $_smarty_tpl); ?> </label> <span class="vAlignMiddle Cantarell sizeBigger capitalize"> <?php if ($_smarty_tpl->tpl_vars['userquery']->value->udetails['fullname']) { ?> <?php echo $_smarty_tpl->tpl_vars['userquery']->value->udetails['fullname']; ?> <?php } else { ?> <?php echo $_smarty_tpl->tpl_vars['userquery']->value->username; ?> <?php } ?> </span> <div class="clearfix"></div> <?php } ?> <?php if (config('comments_captcha') == 'all' || config('comments_captcha') == 'guests' && !$_smarty_tpl->tpl_vars['userquery']->value->login_check('', true)) { ?> <?php if (isset($_smarty_tpl->tpl_vars['captcha'])) { $_smarty_tpl->tpl_vars['captcha'] = clone $_smarty_tpl->tpl_vars['captcha']; $_smarty_tpl->tpl_vars['captcha']->value = get_captcha(); $_smarty_tpl->tpl_vars['captcha']->nocache = null; $_smarty_tpl->tpl_vars['captcha']->scope = 0; } else { $_smarty_tpl->tpl_vars['captcha'] = new Smarty_variable(get_captcha(), null, 0); } ?> <?php if ($_smarty_tpl->tpl_vars['captcha']->value) { ?> <div class="clearfix"></div> <?php if ($_smarty_tpl->tpl_vars['captcha']->value['show_field']) { ?> <label class="Label" for="captcha">Verification Code</label> <div class="ADfieldInputs"><?php echo load_captcha(array('captcha' => $_smarty_tpl->tpl_vars['captcha']->value, 'load' => 'field', 'field_params' => ' id="captcha" class="TextField"'), $_smarty_tpl); ?> </div> <?php } ?> <?php echo load_captcha(array('captcha' => $_smarty_tpl->tpl_vars['captcha']->value, 'load' => 'function'), $_smarty_tpl); ?> <div class="clearfix"></div> <?php } ?> <?php } ?> <?php echo ANCHOR(array('place' => 'before_compose_box'), $_smarty_tpl); ?> <div class="clearfix"></div> <textarea name="comment" id="comment_box" class="form-control" placeholder="Please type something in a comment box"></textarea> </div> <div class="col-lg-12" style="margin:15px 0 15px 0;"> <input type="button" name="add_comment" id="add_comment_button" class="btn btn-primary btn-block" value='Add Comment'> </div> <div class="col-lg-10 col-md-9 col-sm-9 col-xs-9" id="msg_container"></div> </form> <?php } else { ?> <span class="sizeSmall bold error"></span> <div class="col-lg-10 col-md-9 col-sm-9 col-xs-9"> <span class="alert-warning alert msg-display"><?php echo smarty_lang(array('code' => 'please_login_to_comment'), $_smarty_tpl); ?> </span> </div> <?php } ?> </div> <script type="text/javascript"> $(document).ready(function(){ var form_selector = 'comment_form'; var type = '<?php echo $_smarty_tpl->tpl_vars['type']->value; ?> '; var video_id = '<?php echo $_smarty_tpl->tpl_vars['vdo']->value['video_id']; ?> '; $('body').on("click","#add_comment_button",function(){ add_comment_js(form_selector,type,video_id); }); $('#comment_box').keypress(function(e){ if(e.keyCode == 13 && !e.shiftKey) { e.preventDefault(); add_comment_js(form_selector,type,video_id); } }); }); </script><?php }
/** * Function used to validate signup form */ function signup_user($array = NULL, $send_signup_email = true) { global $LANG, $db, $userquery; // echo "<pre>"; // var_dump($array); // echo "</pre>"; //die(); if ($array == NULL) { $array = $_POST; } if (is_array($_FILES)) { $array = array_merge($array, $_FILES); } $this->validate_form_fields($array); //checking terms and policy agreement if ($array['agree'] != 'yes' && !has_access('admin_access', true)) { e(lang('usr_ament_err')); } // first checking if captha plugin is enabled // do not trust the form cb_captcha_enabled value if (get_captcha() && !$userquery->admin_login_check(true)) { // now checking if the user posted captha value is not empty and cb_captcha_enabled == yes if (!isset($array['cb_captcha_enabled']) || $array['cb_captcha_enabled'] == 'no') { e(lang('usr_ccode_err')); //echo "wrong captha input"; } if (!verify_captcha()) { e(lang('usr_ccode_err')); } } if (!error()) { $signup_fields = $this->load_signup_fields($array); //Adding Custom Signup Fields if (count($this->custom_signup_fields) > 0) { $signup_fields = array_merge($signup_fields, $this->custom_signup_fields); } foreach ($signup_fields as $field) { $name = formObj::rmBrackets($field['name']); $val = $array[$name]; if ($field['use_func_val']) { $val = $field['validate_function']($val); } if (!empty($field['db_field'])) { $query_field[] = $field['db_field']; } if (is_array($val)) { $new_val = ''; foreach ($val as $v) { $new_val .= "#" . $v . "# "; } $val = $new_val; } if (!$field['clean_func'] || !function_exists($field['clean_func']) && !is_array($field['clean_func'])) { $val = mysql_clean($val); } else { $val = apply_func($field['clean_func'], sql_free('|no_mc|' . $val)); } if (!empty($field['db_field'])) { $query_val[] = $val; } } // Setting Verification type if (EMAIL_VERIFICATION == '1') { $usr_status = 'ToActivate'; $welcome_email = 'no'; } else { $usr_status = 'Ok'; $welcome_email = 'yes'; } if (has_access('admin_access', true)) { if ($array['active'] == 'Ok') { $usr_status = 'Ok'; $welcome_email = 'yes'; } else { $usr_status = 'ToActivate'; $welcome_email = 'no'; } $query_field[] = "level"; $query_val[] = $array['level']; } $query_field[] = "usr_status"; $query_val[] = $usr_status; $query_field[] = "\twelcome_email_sent"; $query_val[] = $welcome_email; //Creating AV Code $avcode = RandomString(10); $query_field[] = "avcode"; $query_val[] = $avcode; //Signup IP $signup_ip = $_SERVER['REMOTE_ADDR']; $query_field[] = "signup_ip"; $query_val[] = $signup_ip; //Date Joined $now = NOW(); $query_field[] = "doj"; $query_val[] = $now; /** * A VERY IMPORTANT PART OF * OUR SIGNUP SYSTEM IS * SESSION KEY AND CODE * WHEN A USER IS LOGGED IN * IT IS ONLY VALIDATED BY * ITS SIGNUP KEY AND CODE * */ $sess_key = $this->create_session_key($_COOKIE['PHPSESSID'], $array['password']); $sess_code = $this->create_session_code(); $query_field[] = "user_session_key"; $query_val[] = $sess_key; $query_field[] = "user_session_code"; $query_val[] = $sess_code; $query = "INSERT INTO " . tbl("users") . " ("; $total_fields = count($query_field); //Adding Fields to query $i = 0; foreach ($query_field as $qfield) { $i++; $query .= $qfield; if ($i < $total_fields) { $query .= ','; } } $query .= ") VALUES ("; $i = 0; //Adding Fields Values to query foreach ($query_val as $qval) { $i++; $query .= "'{$qval}'"; if ($i < $total_fields) { $query .= ','; } } //Finalzing Query $query .= ")"; $db->Execute($query); $insert_id = $db->insert_id(); $db->insert(tbl($userquery->dbtbl['user_profile']), array("userid"), array($insert_id)); if (!has_access('admin_access', true) && EMAIL_VERIFICATION && $send_signup_email) { global $cbemail; $tpl = $cbemail->get_template('email_verify_template'); $more_var = array('{username}' => post('username'), '{password}' => post('password'), '{email}' => post('email'), '{avcode}' => $avcode); if (!is_array($var)) { $var = array(); } $var = array_merge($more_var, $var); $subj = $cbemail->replace($tpl['email_template_subject'], $var); $msg = nl2br($cbemail->replace($tpl['email_template'], $var)); //Now Finally Sending Email cbmail(array('to' => post('email'), 'from' => WEBSITE_EMAIL, 'subject' => $subj, 'content' => $msg)); } elseif (!has_access('admin_access', true) && $send_signup_email) { $this->send_welcome_email($insert_id); } $log_array = array('username' => $array['username'], 'userid' => $insert_id, 'userlevel' => $array['level'], 'useremail' => $array['email'], 'success' => 'yes', 'details' => sprintf("%s signed up", $array['username'])); //Login Signup insert_log('signup', $log_array); //Adding User has Signup Feed addFeed(array('action' => 'signup', 'object_id' => $insert_id, 'object' => 'signup', 'uid' => $insert_id)); return $insert_id; } return false; }