function testimonials_table_content($column_name, $post_id) { if ($column_name == 'testimonial_content') { $testimonial_content = get_post_field('post_content', $post->ID); // echo testimonial link and content echo "<a href=\"" . get_edit_post_link($id, $context) . "\">{$testimonial_content}</a>"; } if ($column_name == 'word_count') { word_count(); } }
function send_sms($mobile, $message, $word = 0, $time = 0) { global $db, $DT, $DT_TIME, $DT_IP, $_username; if (!$DT['sms'] || !$DT['sms_uid'] || !$DT['sms_key']) { return false; } $word or $word = word_count($message); $sms_message = rawurlencode(convert($message, DT_CHARSET, 'UTF-8')); $data = 'sms_uid=' . $DT['sms_uid'] . '&sms_key=' . $DT['sms_key'] . '&sms_charset=' . DT_CHARSET . '&sms_mobile=' . $mobile . '&sms_message=' . $sms_message . '&sms_time=' . $time; $header = "POST /send.php HTTP/1.0\r\n"; $header .= "Accept: */*\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Content-Length: " . strlen($data) . "\r\n\r\n"; $fp = function_exists('fsockopen') ? fsockopen('sms.destoon.com', 8820) : stream_socket_client('sms.destoon.com:8820'); $code = ''; if ($fp) { fputs($fp, $header . $data); while (!feof($fp)) { $code .= fgets($fp, 1024); } fclose($fp); if ($code && strpos($code, 'destoon_sms_code=') !== false) { $code = explode('destoon_sms_code=', $code); $code = $code[1]; } else { $code = 'Can Not Connect SMS Server'; } } else { $code = 'Can Not Connect SMS Server'; } $db->query("INSERT INTO {$db->pre}sms (mobile,message,word,editor,sendtime,code) VALUES ('{$mobile}','{$message}','{$word}','{$_username}','{$DT_TIME}','{$code}')"); return $code; }
<label for="text" class="col-sm-2 control-label">Input Text</label> <div class="col-sm-10"> <textarea class="form-control" name="user_text" rows="5" id="text" placeholder="Input some text..."><?php if (isset($_POST['btn'])) { echo $_POST['user_text']; } ?> </textarea> </div> </div> <div class="form-group"> <label for="word" class="col-sm-2 control-label">Word</label> <div class="col-sm-10"> <input type="text" class="form-control" id="word" value="<?php if (isset($_POST['user_text'])) { echo word_count($_POST['user_text']); } ?> "> </div> </div> <div class="form-group"> <label for="character" class="col-sm-2 control-label">Character</label> <div class="col-sm-10"> <input type="text" class="form-control" id="character" value="<?php if (isset($_POST['user_text'])) { echo character_count($_POST['user_text']); } ?> "> </div>
the_ID(); ?> " <?php post_class(); ?> > <header> <h2 class="h1"><?php edit_post_link('✍', '', ' '); the_title(); ?> </h2> <p class="meta"> the following <?php word_count(); ?> words were posted by <?php the_author_posts_link(); ?> <br /> <?php basis_fuzzy_time(); ?> (<?php the_date(); ?> at <?php the_time(); ?> )
$content .= '<br/>' . $L['content_msn'] . ' ' . im_msn($msn) . ' ' . $msn; } if ($skype) { $content .= '<br/>' . $L['content_skype'] . ' ' . im_skype($skype) . ' ' . $skype; } if (is_date($date)) { $content .= '<hr size="1"/>' . lang($L['content_date'], array($date)); } $message = $L['content_product'] . '<a href="' . $linkurl . '"><strong>' . $item['title'] . '</strong></a><br/>' . $content; //send sms if ($DT['sms'] && $_sms && $item['username'] && isset($sendsms)) { $touser = userinfo($item['username']); if ($touser['mobile']) { $message = lang('sms->sms_price', array($item['tag'], $itemid, $truename, $telephone)); $message = strip_sms($message); $word = word_count($message); $sms_num = ceil($word / $DT['sms_len']); if ($sms_num <= $_sms) { $sms_code = send_sms($touser['mobile'], $message, $word); if (strpos($sms_code, $DT['sms_ok']) !== false) { $tmp = explode('/', $sms_code); if (is_numeric($tmp[1])) { $sms_num = $tmp[1]; } if ($sms_num) { sms_add($_username, -$sms_num); } if ($sms_num) { sms_record($_username, -$sms_num, $_username, $L['sms_price'], 'ID:' . $itemid); } }
<?php } ?> </div> </small> </header> <?php $content = apply_filters('the_content', get_the_content()); $content = explode("</p>", $content); for ($i = 0; $i < count($content); $i++) { if ($i == 1) { ?> <p class="separator"> <i class="fa fa-book icon"></i>Reading Time: <?php echo calc_read_time(word_count(get_the_content())); ?> </p> <?php break; } echo $content[$i] . "</p>"; } ?> </article> <a class="link" href="<?php the_permalink(); ?> ">continue reading...</a> <?php }
<?php defined('IN_DESTOON') or exit('Access Denied'); if (!$_userid) { dheader($MODULE[2]['linkurl'] . $DT['file_my']); } require DT_ROOT . '/module/' . $module . '/common.inc.php'; if ($action == 'logout' && $admin_user) { set_cookie('admin_user', ''); dmsg($L['index_msg_logout'], $MODULE[2]['linkurl']); } require MD_ROOT . '/member.class.php'; require DT_ROOT . '/include/post.func.php'; $do = new member(); if ($submit) { if (word_count($note) > 1000) { message($L['index_msg_note_limit']); } $note = '<?php exit;?>' . htmlspecialchars(stripslashes($note)); file_put(DT_ROOT . '/file/user/' . dalloc($_userid) . '/' . $_userid . '/note.php', $note); dmsg($L['op_update_success'], $MODULE[2]['linkurl']); } else { $head_title = ''; $do->userid = $_userid; $user = $do->get_one(); extract($user); $logintime = timetodate($logintime, 5); $regtime = timetodate($regtime, 5); $userurl = userurl($_username, '', $domain); $sys = array(); $i = 0;
function fields_check($post_fields, $fd = array()) { global $FD, $session; include load('include.lang'); if ($fd) { $FD = $fd; } if (!is_object($session)) { $session = new dsession(); } $uploads = isset($_SESSION['uploads']) ? $_SESSION['uploads'] : array(); foreach ($FD as $k => $v) { $value = isset($post_fields[$v['name']]) ? $post_fields[$v['name']] : ''; if (in_array($v['html'], array('thumb', 'file', 'editor')) && $uploads) { foreach ($uploads as $sk => $sv) { if ($v['html'] == 'editor') { if (strpos($value, $sv) !== false) { unset($_SESSION['uploads'][$sk]); } } else { if ($sv == $value) { unset($_SESSION['uploads'][$sk]); } } } } if (!$v['input_limit']) { continue; } if (!defined('DT_ADMIN') && !$v['front']) { continue; } if ($v['input_limit'] == 'is_date') { if (!is_date($value)) { fields_message(lang($L['fields_input'], array($v['title']))); } } else { if ($v['input_limit'] == 'is_email') { if (!is_email($value)) { fields_message(lang($L['fields_valid'], array($v['title']))); } } else { if (is_numeric($v['input_limit'])) { $length = $v['html'] == 'checkbox' ? count($value) : word_count($value); if ($length < $v['input_limit']) { fields_message(lang($L['fields_less'], array($v['title'], $v['input_limit']))); } } else { if (preg_match("/^([0-9]{1,})\\-([0-9]{1,})\$/", $v['input_limit'], $m)) { $length = $v['html'] == 'checkbox' ? count($value) : word_count($value); if ($m[1] && $length < $m[1]) { fields_message(lang($L['fields_less'], array($v['title'], $m[1]))); } if ($m[2] && $length > $m[2]) { fields_message(lang($L['fields_more'], array($v['title'], $m[2]))); } } else { if (!preg_match("/^" . $v['input_limit'] . "\$/", $value)) { fields_message(lang($L['fields_match'], array($v['title']))); } } } } } } }
<?php defined('IN_DESTOON') or exit('Access Denied'); if (!$_userid) { dheader($MODULE[2]['linkurl'] . $DT['file_my']); } require DT_ROOT . '/module/' . $module . '/common.inc.php'; if ($action == 'logout' && $admin_user) { set_cookie('admin_user', ''); dmsg($L['index_msg_logout'], $MODULE[2]['linkurl']); } require MD_ROOT . '/member.class.php'; require DT_ROOT . '/include/post.func.php'; $do = new member(); if ($submit) { if (word_count($note) > 5000) { message($L['index_msg_note_limit']); } $note = '<?php exit;?>' . dhtmlspecialchars(stripslashes($note)); file_put(DT_ROOT . '/file/user/' . dalloc($_userid) . '/' . $_userid . '/note.php', $note); dmsg($L['op_update_success'], $MODULE[2]['linkurl']); } else { $head_title = ''; $do->userid = $_userid; $user = $do->get_one(); extract($user); $expired = $totime && $totime < $DT_TIME ? true : false; $havedays = $expired ? 0 : ceil(($totime - $DT_TIME) / 86400); $sys = array(); $i = 0; $result = $db->query("SELECT itemid,title,addtime,groupids FROM {$DT_PRE}message WHERE groupids<>'' ORDER BY itemid DESC", 'CACHE');
function is_member($member) { global $L, $AREA; if (!is_array($member)) { return false; } if (!$this->is_passport($member['passport'])) { return false; } if (!$member['groupid']) { return $this->_($L['member_groupid_null']); } if (strlen($member['truename']) < 2 || !$this->is_clean($member['truename'])) { return $this->_($L['member_truename_null']); } if (!$this->is_email(trim($member['email']))) { return false; } if ($this->email_exists(trim($member['email']))) { return $this->_($L['member_email_reg']); } $areaid = intval($member['areaid']); if (!$areaid || !$this->db->get_one("SELECT areaid FROM {$this->db->pre}area WHERE areaid={$areaid}")) { return $this->_($L['member_areaid_null']); } $groupid = $this->userid ? $member['groupid'] : $member['regid']; if ($groupid > 5) { if (strlen($member['company']) < 2) { return $this->_($L['member_company_null']); } if (preg_match("/[0-9]+/", $member['company']) || !$this->is_clean($member['company'])) { return $this->_($L['member_company_bad']); } if ($this->company_exists($member['company'])) { return $this->_($L['member_company_reg']); } if (strlen($member['type']) < 2) { return $this->_($L['member_type_null']); } if (!preg_match("/^[0-9\\-]{6,}\$/", $member['telephone'])) { return $this->_($L['member_telephone_null']); } } if ($this->userid) { if ($member['password'] && !$this->is_password($member['password'], $member['cpassword'])) { return false; } if ($member['payword'] && !$this->is_payword($member['payword'], $member['cpayword'])) { return false; } if ($member['groupid'] > 5) { if (strlen($member['regyear']) != 4 || !is_numeric($member['regyear'])) { return $this->_($L['member_regyear_null']); } if (empty($member['address'])) { return $this->_($L['member_address_null']); } if (word_count($member['introduce']) < 5) { return $this->_($L['member_introduce_null']); } if (!$member['business']) { return $this->_($L['member_business_null']); } if (strlen($member['catid']) < 2) { return $this->_($L['member_catid_null']); } } } else { if (!$this->is_username($member['username'])) { return false; } if ($member['groupid'] > 5 && !$this->is_company($member['company'])) { return false; } if (!$this->is_password($member['password'], $member['cpassword'])) { return false; } } return true; }
} if ($MOD['comment_time']) { $r = $db->get_one("SELECT addtime FROM {$DT_PRE}comment WHERE {$sql} ORDER BY addtime DESC"); if ($r && $DT_TIME - $r['addtime'] < $MOD['comment_time']) { dalert(lang($L['comment_msg_time'], array($MOD['comment_time']))); } } if ($need_captcha) { $msg = captcha($captcha, 1, true); if ($msg) { dalert($msg); } } $content = dhtmlspecialchars(trim($content)); $content = preg_replace("/&([a-z]{1,});/", '', $content); $len = word_count($content); if ($len < $MOD['comment_min']) { dalert(lang($L['comment_msg_min'], array($MOD['comment_min']))); } if ($len > $MOD['comment_max']) { dalert(lang($L['comment_msg_max'], array($MOD['comment_max']))); } $BANWORD = cache_read('banword.php'); if ($BANWORD) { $content = banword($BANWORD, $content, false); } $star = intval($star); in_array($star, array(1, 2, 3)) or $star = 3; $status = get_status(3, $MOD['comment_check'] == 2 ? $MG['check_add'] : $MOD['comment_check']); $hidden = isset($hidden) ? 1 : 0; $content = nl2br($content);
/** * This function displays a wiki entry * @author Patrick Cool <*****@*****.**>, Ghent University * @author Juan Carlos Raña Trabado * @return html code **/ function display_wiki_entry($newtitle) { global $charset, $tbl_wiki, $tbl_wiki_conf, $groupfilter, $condition_session, $page; $course_id = api_get_course_int_id(); if ($newtitle) { $pageMIX = $newtitle; //display the page after it is created } else { $pageMIX = $page; //display current page } $_clean['group_id'] = (int) $_SESSION['_gid']; $session_id = api_get_session_id(); if ($_GET['view']) { $_clean['view'] = (int) Database::escape_string($_GET['view']); $filter = ' AND w.id="' . $_clean['view'] . '"'; } //first, check page visibility in the first page version $sql = 'SELECT * FROM ' . $tbl_wiki . ' WHERE c_id = ' . $course_id . ' AND reflink="' . Database::escape_string($pageMIX) . '" AND ' . $groupfilter . $condition_session . ' ORDER BY id ASC'; $result = Database::query($sql); $row = Database::fetch_array($result); $KeyVisibility = $row['visibility']; // second, show the last version $sql = 'SELECT * FROM ' . $tbl_wiki . ' w , ' . $tbl_wiki_conf . ' wc WHERE wc.c_id = ' . $course_id . ' AND w.c_id = ' . $course_id . ' AND wc.page_id = w.page_id AND w.reflink = "' . Database::escape_string($pageMIX) . '" AND w.session_id = ' . $session_id . ' AND w.' . $groupfilter . ' ' . $filter . ' ORDER BY id DESC'; $result = Database::query($sql); $row = Database::fetch_array($result); // we do not need a while loop since we are always displaying the last version //update visits if ($row['id']) { $sql = 'UPDATE ' . $tbl_wiki . ' SET hits=(hits+1) WHERE c_id = ' . $course_id . ' AND id=' . $row['id'] . ''; Database::query($sql); } // if both are empty and we are displaying the index page then we display the default text. if ($row['content'] == '' and $row['title'] == '' and $page == 'index') { if (api_is_allowed_to_edit(false, true) || api_is_platform_admin() || GroupManager::is_user_in_group(api_get_user_id(), $_SESSION['_gid'])) { //Table structure for better export to pdf $default_table_for_content_Start = '<table align="center" border="0"><tr><td align="center">'; $default_table_for_content_End = '</td></tr></table>'; $content = $default_table_for_content_Start . sprintf(get_lang('DefaultContent'), api_get_path(WEB_IMG_PATH)) . $default_table_for_content_End; $title = get_lang('DefaultTitle'); } else { return Display::display_normal_message(get_lang('WikiStandBy')); } } else { $content = Security::remove_XSS($row['content'], COURSEMANAGERLOWSECURITY); $title = $row['title']; } //assignment mode: identify page type if ($row['assignment'] == 1) { $icon_assignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'), '', ICON_SIZE_SMALL); } elseif ($row['assignment'] == 2) { $icon_assignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL); } //task mode if (!empty($row['task'])) { $icon_task = Display::return_icon('wiki_task.png', get_lang('StandardTask'), '', ICON_SIZE_SMALL); } //Show page. Show page to all users if isn't hide page. Mode assignments: if student is the author, can view if ($KeyVisibility == "1" || api_is_allowed_to_edit(false, true) || api_is_platform_admin() || $row['assignment'] == 2 && $KeyVisibility == "0" && api_get_user_id() == $row['user_id']) { echo '<div id="wikititle">'; // page action: protecting (locking) the page if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { if (check_protect_page() == 1) { $protect_page = Display::return_icon('lock.png', get_lang('PageLockedExtra'), '', ICON_SIZE_SMALL); $lock_unlock_protect = 'unlock'; } else { $protect_page = Display::return_icon('unlock.png', get_lang('PageUnlockedExtra'), '', ICON_SIZE_SMALL); $lock_unlock_protect = 'lock'; } } if ($row['id']) { echo '<span style="float:right;">'; echo '<a href="index.php?action=showpage&actionpage=' . $lock_unlock_protect . '&title=' . api_htmlentities(urlencode($page)) . '">' . $protect_page . '</a>'; echo '</span>'; } //page action: visibility if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { if (check_visibility_page() == 1) { // TODO: FIX This hides the icon eye closed to users of work they can see yours //if(($row['assignment']==2 && $KeyVisibility=="0" && (api_get_user_id()==$row['user_id']))==false) //{ // // } $visibility_page = Display::return_icon('visible.png', get_lang('ShowPageExtra'), '', ICON_SIZE_SMALL); $lock_unlock_visibility = 'invisible'; } else { $visibility_page = Display::return_icon('invisible.png', get_lang('HidePageExtra'), '', ICON_SIZE_SMALL); $lock_unlock_visibility = 'visible'; } } if ($row['id']) { echo '<span style="float:right;">'; echo '<a href="index.php?action=showpage&actionpage=' . $lock_unlock_visibility . '&title=' . api_htmlentities(urlencode($page)) . '">' . $visibility_page . '</a>'; echo '</span>'; } //page action: notification if (api_is_allowed_to_session_edit()) { if (check_notify_page($page) == 1) { $notify_page = Display::return_icon('messagebox_info.png', get_lang('NotifyByEmail'), '', ICON_SIZE_SMALL); $lock_unlock_notify_page = 'unlocknotify'; } else { $notify_page = Display::return_icon('mail.png', get_lang('CancelNotifyByEmail'), '', ICON_SIZE_SMALL); $lock_unlock_notify_page = 'locknotify'; } } echo '<span style="float:right;">'; echo '<a href="index.php?action=showpage&actionpage=' . $lock_unlock_notify_page . '&title=' . api_htmlentities(urlencode($page)) . '">' . $notify_page . '</a>'; echo '</span>'; //ONly available if row['id'] is set if ($row['id']) { //page action: export to pdf echo '<span style="float:right;padding-top:5px;">'; echo '<form name="form_export2PDF" method="post" action="index.php">'; echo '<input type="hidden" name="action" value="export_to_pdf">'; echo '<input type="hidden" name="wiki_id" value="' . $row['id'] . '">'; echo '<input type="image" src="../img/icons/22/pdf.png" border ="0" title="' . get_lang('ExportToPDF') . '" alt="' . get_lang('ExportToPDF') . '" style=" width:22px; border:none; margin-top: -9px">'; echo '</form>'; echo '</span>'; //page action: copy last version to doc area if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { echo '<span style="float:right;">'; echo '<form name="form_export2DOC" method="post" action="index.php" >'; echo '<input type=hidden name="export2DOC" value="export2doc">'; echo '<input type=hidden name="doc_id" value="' . $row['id'] . '">'; echo '<input type="image" src="../img/icons/22/export_to_documents.png" border ="0" title="' . get_lang('ExportToDocArea') . '" alt="' . get_lang('ExportToDocArea') . '" style=" width:22px; border:none; margin-top: -6px">'; echo '</form>'; echo '</span>'; } } //export to print ?> <script> function goprint() { var a = window.open('', '', 'width=800,height=600'); a.document.open("text/html"); a.document.write(document.getElementById('wikicontent').innerHTML); a.document.close(); a.print(); } </script> <?php echo '<span style="float:right; cursor: pointer;">'; echo Display::return_icon('printer.png', get_lang('Print'), array('onclick' => "javascript: goprint();"), ICON_SIZE_SMALL); echo '</span>'; if (empty($title)) { $title = get_lang('DefaultTitle'); } if (wiki_exist($title)) { echo $icon_assignment . ' ' . $icon_task . ' ' . api_htmlentities($title); } else { echo api_htmlentities($title); } echo '</div>'; echo '<div id="wikicontent">' . make_wiki_link_clickable(detect_external_link(detect_anchor_link(detect_mail_link(detect_ftp_link(detect_irc_link(detect_news_link($content))))))) . '</div>'; echo '<div id="wikifooter">' . get_lang('Progress') . ': ' . $row['progress'] . '% ' . get_lang('Rating') . ': ' . $row['score'] . ' ' . get_lang('Words') . ': ' . word_count($content) . '</div>'; } //end filter visibility }
<?php global $db, $start_table, $end_table; $result = $db->Execute("SELECT * FROM `Obsedb_news` WHERE `id` = '{$_REQUEST['id']}'"); // Variables for view article page $id = $result->fields['id']; $title = stripslashes($result->fields['title']); $intro = clean($result->fields['intro']); $text = clean($result->fields['text']); $word_count = word_count($result->fields['text']) + word_count($result->fields['intro']); $date = stripslashes($result->fields['date']); echo <<<EOF <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr> <td><font class="newstitle"><b>{$title}</b></font></td> <td align="right"><a href="index.php?do=printarticle&id={$id}"><img src="images/print.png" border="0" alt="Print Article"></a></td> </tr> </table> \t<p class="news_introtext"> \t{$intro} \t</p> \t \t<p class="news_maintext"> \t{$text} \t<br /><br /> \t<b>Word Count:</b> {$word_count} <br /> \t<b>Date Posted:</b> {$date} <br /> \t</p>
$message = get_lang('TheDeadlineHasBeenCompleted') . ': ' . api_get_local_time($row['enddate_assig'], null, date_default_timezone_get()); Display::display_warning_message($message); if (!api_is_allowed_to_edit(false, true)) { exit; } } // if (!empty($row['max_version']) && $row['version'] >= $row['max_version']) { $message = get_lang('HasReachedMaxiNumVersions'); Display::display_warning_message($message); if (!api_is_allowed_to_edit(false, true)) { exit; } } // if (!empty($row['max_text']) && $row['max_text'] <= word_count($row['content'])) { $message = get_lang('HasReachedMaxNumWords'); Display::display_warning_message($message); if (!api_is_allowed_to_edit(false, true)) { exit; } } //// if (!empty($row['task'])) { //previous change 0 by text if ($row['startdate_assig'] == '0000-00-00 00:00:00') { $message_task_startdate = get_lang('No'); } else { $message_task_startdate = api_get_local_time($row['startdate_assig'], null, date_default_timezone_get()); } if ($row['enddate_assig'] == '0000-00-00 00:00:00') {