public function listing() { /** * AJAX List of Data * Here we load the list of data in a table */ if ($this->input->is_ajax_request()) { $bootgrid_arr = []; $current = null != $this->input->post('current') ? $this->input->post('current') : 1; $limit = $this->input->post('rowCount') == -1 ? 0 : $this->input->post('rowCount'); $page = $current !== null ? $current : 1; $start_from = ($page - 1) * $limit; $sort = null != $this->input->post('sort') ? $this->input->post('sort') : null; $wildcard = null != $this->input->post('searchPhrase') ? $this->input->post('searchPhrase') : null; $removed_only = null != $this->input->post('removedOnly') ? $this->input->post('removedOnly') : false; $total = $this->User->get_all(0, 0, null, $removed_only)->num_rows(); if (null != $wildcard) { $users = $this->User->like($wildcard, $start_from, $limit, $sort, $removed_only)->result_array(); $total = $this->User->like($wildcard, 0, 0, null, $removed_only)->num_rows(); } else { $users = $this->User->get_all($start_from, $limit, $sort, $removed_only)->result_array(); } foreach ($users as $key => $user) { $bootgrid_arr[] = array('count_id' => $key + 1 + $start_from, 'id' => $user['id'], 'username' => $user['username'], 'fullname' => arraytostring([$user['firstname'], $user['middlename'] ? substr($user['middlename'], 0, 1) . '.' : '', $user['lastname']], ' '), 'email' => $user['email'], 'privilege' => $this->Privilege->find($user['privilege'])->name, 'privilege_level' => $this->PrivilegesLevel->find($user['privilege_level'])->name); } $data = array("current" => intval($current), "rowCount" => $limit, "searchPhrase" => $wildcard, "total" => intval($total), "rows" => $bootgrid_arr, "trash" => array("count" => $this->Privilege->get_all(0, 0, null, true)->num_rows())); echo json_encode($data); exit; } }
function block_sql($paramarr, $multicachekey = '', $returncount = 0) { global $_G, $_SGLOBAL, $_GET, $_SERVER; if (!empty($paramarr['sql'])) { require_once B_ROOT . './source/function/block_sql.func.php'; if ($returncount > 0) { return runsql($paramarr, '', 1); } list($sqlstring, $listcount) = runsql($paramarr, '', 0, $multicachekey); if (!empty($paramarr['perpage'])) { if ($listcount) { $urlarr = $_GET; foreach ($urlarr as $key => $value) { if (empty($value)) { unset($urlarr[$key]); } else { $urlarr[$key] = rawurlencode($urlarr[$key]); } } unset($urlarr['page']); $phpurl = arraytostring($urlarr, '=', '&'); $phpurl = $phpurl ? 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'] . '?' . $phpurl : 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']; $theblockarr['multipage'] = multi($listcount, $paramarr['perpage'], $_GET['page'], rawurldecode($phpurl), 1); $theblockarr['listcount'] = $listcount; } } } //查詢數據 if ($listcount) { //查詢 $query = DB::query($sqlstring); while ($value = DB::fetch($query)) { if (isset($value['subjectimage'])) { $value['thumb'] = getattachurl($value['subjectimage'], 1); $value['subjectimage'] = getattachurl($value['subjectimage']); } $theblockarr[] = $value; } } return $theblockarr; }
public function listing() { /** * AJAX List of Data * Here we load the list of data in a table */ if ($this->input->is_ajax_request()) { $bootgrid_arr = []; $current = $this->input->post('current'); $limit = $this->input->post('rowCount') == -1 ? 0 : $this->input->post('rowCount'); $page = $current !== null ? $current : 1; $start_from = ($page - 1) * $limit; $sort = null != $this->input->post('sort') ? $this->input->post('sort') : null; $wildcard = null != $this->input->post('searchPhrase') ? $this->input->post('searchPhrase') : null; $total = $this->Contact->get_all()->num_rows(); if (null != $wildcard) { $contacts = $this->Contact->like($wildcard, $start_from, $limit, $sort)->result_array(); $total = $this->Contact->like($wildcard)->num_rows(); } else { $contacts = $this->Contact->get_all($start_from, $limit, $sort)->result_array(); } foreach ($contacts as $key => $contact) { $group = null; if (null != $contact['contacts_group']) { $group = $this->Group->find(explodetoarray($contact['contacts_group'])); } $groups_name_arr = []; $groups_id_arr = []; if (is_array($group)) { foreach ($group as $group_single) { $groups_name_arr[] = $group_single->groups_name; $groups_id_arr[] = $group_single->groups_id; } } if (null !== $contact['contacts_level']) { $level = $this->Level->find(explodetoarray($contact['contacts_level'])); } $levels_name_arr = []; $levels_id_arr = []; if (is_array($level)) { foreach ($level as $level_single) { $levels_name_arr[] = $level_single->levels_name; $levels_id_arr[] = $level_single->levels_id; } } if (null !== $contact['contacts_type']) { $type = $this->Type->find(explodetoarray($contact['contacts_type'])); } $types_name_arr = []; $types_id_arr = []; if (is_array($type)) { foreach ($type as $type_single) { $types_name_arr[] = $type_single->types_name; $types_id_arr[] = $type_single->types_id; } } $bootgrid_arr[] = array('count_id' => $key + 1 + $start_from, 'contacts_id' => $contact['contacts_id'], 'contacts_firstname' => arraytostring([$contact['contacts_firstname'], $contact['contacts_middlename'] ? substr($contact['contacts_middlename'], 0, 1) . '.' : '', $contact['contacts_lastname']], ' '), 'contacts_level' => $levels_name_arr ? arraytostring($levels_name_arr, ", ") : '', 'levels_id' => $levels_id_arr ? $levels_id_arr : '', 'contacts_type' => $types_name_arr ? arraytostring($types_name_arr, ", ") : '', 'types_id' => $types_id_arr ? $types_id_arr : '', 'contacts_address' => arraytostring([$contact['contacts_blockno'], $contact['contacts_street'], $contact['contacts_brgy'], $contact['contacts_city'], $contact['contacts_zip']]), 'contacts_telephone' => $contact['contacts_telephone'], 'contacts_mobile' => $contact['contacts_mobile'], 'contacts_email' => $contact['contacts_email'], 'contacts_group' => $groups_name_arr ? arraytostring($groups_name_arr, ", ") : '', 'groups_id' => $groups_id_arr ? $groups_id_arr : ''); } $data = array("current" => intval($current), "rowCount" => $limit, "searchPhrase" => $wildcard, "total" => intval($total), "rows" => $bootgrid_arr); echo json_encode($data); exit; } }
?> </td> <td><?php echo $member->email; ?> </td> <td><?php echo $member->msisdn; ?> </td> <td><?php echo $member->telephone; ?> </td> <td><?php echo arraytostring([$member->address_blockno, $member->address_street, $member->address_brgy, $member->address_city, $member->address_zip]); ?> </td> <td></td> </tr> <?php } ?> </tbody> --> </table> </div> </div> </div> <button id="delete-member-btn" title="Delete all selected Members" class="btn btn-float bgm-red delete-all m-btn"><i class="zmdi zmdi zmdi-delete"></i></button> <button id="add-new-member-btn" title="Add new Member" class="btn btn-float bgm-green add-new m-btn" data-toggle="modal" href="#add-member"><i class="zmdi zmdi-plus-square"></i></button> </section>
$LOGINFORM = convertUri($LOGINFORM); } ///Some extra debugging information if debugSet is enabled if ($debugSet == "on") { $DEBUGINFO .= "Page Full text path : " . $pageFullPath . "<br /><br />\n"; $DEBUGINFO .= "UID : " . getUserId() . "<br /><br />\n"; $DEBUGINFO .= "GIDS : " . arraytostring(getGroupIds($userId)) . "<br /><br />\n"; $DEBUGINFO .= "Action : " . $action . "<br /><br />\n"; $DEBUGINFO .= "Get Vars : " . arraytostring($_GET) . "<br /><br />\n"; $DEBUGINFO .= "Page Id : " . $pageId . "<br /><br />\n"; $DEBUGINFO .= "Page id path : " . arraytostring($pageIdArray) . "\n<br /><br />"; $DEBUGINFO .= "Title : " . $TITLE . "\n<br /><br />"; $DEBUGINFO .= "SERVER info : " . arraytostring($_SERVER) . "\n<br /><br />"; $DEBUGINFO .= "POST info : " . arraytostring($_POST) . "\n<br /><br />"; $DEBUGINFO .= "FILES info : " . arraytostring($_FILES) . "\n<br /><br />"; $DEBUGINFO .= "SESSION info : " . arraytostring($_SESSION) . "\n<br /><br />"; $DEBUGINFO .= "STARTSCRIPTS : " . $STARTSCRIPTS . "\n<br/><br/>"; if ($DEBUGINFO != "") { displayinfo($DEBUGINFO); } } ///Used to check in subsequent requests if cookies are supported or not setcookie("cookie_support", "enabled", 0, "/"); ///Apply the template on the generated content and display the page templateReplace($TITLE, $MENUBAR, $ACTIONBARMODULE, $ACTIONBARPAGE, $BREADCRUMB, $SEARCHBAR, $PAGEKEYWORDS, $INHERITEDINFO, $CONTENT, $FOOTER, $DEBUGINFO, $ERRORSTRING, $WARNINGSTRING, $INFOSTRING, $STARTSCRIPTS, $LOGINFORM); disconnect(); exit; /** Additional notes : authenticate.lib.php -> Find out who requested it output: one int -> uid
/** * Add an entry in the GMcache table * * @global integer The selected bot. * * @param string $combined the complete input in <input>word word<that>word word<topic>word word format. * @param string $mytemplate the reply to the input * @param string $inputstarvals contents of the input star * @param string $thatstarvals contents of the that star * @param string $topicstarvals contents of the topic star * @param string $patternmatched the AIML category pattern that matches the input * @param string $inputmatched the input that matched the category. * * @return void */ function fillcache($combined, $mytemplate, $inputstarvals, $thatstarvals, $topicstarvals, $patternmatched, $inputmatched) { global $selectbot; $ccquery = "insert into gmcache (bot, combined,template,inputstarvals,thatstarvals,topicstarvals,patternmatched,inputmatched) values ({$selectbot},'" . addslashes($combined) . "'," . $mytemplate . ",'" . addslashes(arraytostring($inputstarvals)) . "','" . addslashes(arraytostring($thatstarvals)) . "','" . addslashes(arraytostring($topicstarvals)) . "','" . addslashes($patternmatched) . "','" . addslashes($inputmatched) . "')"; $selectcode = mysql_query($ccquery); if ($selectcode) { } }
function multi($num, $perpage, $curpage, $mpurl, $phpurl = 1) { global $_SHTML, $lang, $_SGLOBAL; if (($curpage - 1) * $perpage > $num) { showmessage('start_listcount_error'); } $maxpages = $_SGLOBAL['maxpages']; $multipage = $a_name = ''; if ($phpurl) { $mpurl .= strpos($mpurl, '?') ? '&' : '?'; } else { $urlarr = $mpurl; unset($urlarr['php']); unset($urlarr['modified']); } if ($num > $perpage) { $page = 10; $offset = 2; $realpages = @ceil($num / $perpage); $pages = $maxpages && $maxpages < $realpages ? $maxpages : $realpages; if ($page > $pages) { $from = 1; $to = $pages; } else { $from = $curpage - $offset; $to = $curpage + $page - $offset - 1; if ($from < 1) { $to = $curpage + 1 - $from; $from = 1; if ($to - $from < $page && $to - $from < $pages) { $to = $page; } } elseif ($to > $pages) { $from = $curpage - $pages + $to; $to = $pages; if ($to - $from < $page && $to - $from < $pages) { $from = $pages - $page + 1; } } } if ($phpurl) { $url = $mpurl . 'page=1' . $a_name; $url2 = $mpurl . 'page=' . ($curpage - 1) . $a_name; } else { $urlarr['page'] = 1; $url = geturl(arraytostring($urlarr)) . $a_name; $urlarr['page'] = $curpage - 1; $url2 = geturl(arraytostring($urlarr)) . $a_name; } $multipage = '<div class="pages"><div>' . ($curpage - $offset > 1 && $pages > $page ? '<a href="' . $url . '">1...</a>' : '') . ($curpage > 1 ? '<a class="prev" href="' . $url2 . '">' . $lang['pre_page'] . '</a>' : ''); for ($i = $from; $i <= $to; $i++) { if ($phpurl) { $url = $mpurl . 'page=' . $i . $a_name; } else { $urlarr['page'] = $i; if ($urlarr['page'] == 1) { unset($urlarr['page']); } $url = geturl(arraytostring($urlarr)) . $a_name; } $multipage .= $i == $curpage ? '<strong>' . $i . '</strong>' : '<a href="' . $url . '">' . $i . '</a>'; } if ($phpurl) { $url = $mpurl . 'page=' . ($curpage + 1) . $a_name; $url2 = $mpurl . 'page=' . $pages . $a_name; } else { $urlarr['page'] = $curpage + 1; if ($urlarr['page'] == 1) { unset($urlarr['page']); } $url = geturl(arraytostring($urlarr)) . $a_name; $urlarr['page'] = $pages; if ($urlarr['page'] == 1) { unset($urlarr['page']); } $url2 = geturl(arraytostring($urlarr)) . $a_name; } $multipage .= ($to < $pages && $curpage < $maxpages ? '<a href="' . $url2 . '" target="_self">...' . $realpages . '</a>' : '') . ($curpage < $pages ? '<a class="next" href="' . $url . '">' . $lang['next_page'] . '</a>' : '') . ($pages > $page ? '' : ''); $multipage .= '</div></div>'; } return $multipage; }
function mailer($to, $mailtype, $key, $from) { if (empty($from)) { $from = "from: " . CMS_TITLE . " <" . CMS_EMAIL . ">"; } //init mail template file path $mail_filepath = MAILPATH . "/" . LANGUAGE . "/email/{$mailtype}.txt"; $drop_header = ''; if (!file_exists($mail_filepath)) { displayerror(safe_html("NO FILE called {$mail_filepath} FOUND !")); } //check file if (($data = @file_get_contents($mail_filepath)) === false) { displayerror("{$mail_filepath} FILE READ ERROR !"); } //read contents //escape quotes $body = str_replace("'", "\\'", $data); //replace the vars in file content with those defined $body = preg_replace('#\\{([a-z0-9\\-_]*?)\\}#is', "' . ((isset(\$this->vars['\\1'])) ? \$this->vars['\\1'] : '') . '", $body); //Make the content parseable eval("\$body = '{$body}';"); //Extract the SUBJECT from mail content $match = array(); if (preg_match('#^(Subject:(.*?))$#m', $body, $match)) { //Find SUBJECT $subject = trim($match[2]) != '' ? trim($match[2]) : $subject; $drop_header .= '[\\r\\n]*?' . preg_quote($match[1], '#'); } if ($drop_header) { //Remove SUBJECT from BODY of mail $body = trim(preg_replace('#' . $drop_header . '#s', '', $body)); } //Debug info //echo displayinfo($from.' <br> '.$to.' <br> '.$subject.' <br> '.$body); //Send mail global $debugSet; if ($debugSet == "on") { displayinfo("Vars :" . arraytostring($this->vars)); displayinfo("Mail sent to {$to} from {$from} with subject {$subject} and body {$body}"); } return mail($to, $subject, $body, $from); }
public function listing() { /** * AJAX List of Data * Here we load the list of data in a table */ if ($this->input->is_ajax_request()) { $bootgrid_arr = []; $current = $this->input->post('current'); $limit = $this->input->post('rowCount') == -1 ? 0 : $this->input->post('rowCount'); $page = $current !== null ? $current : 1; $start_from = ($page - 1) * $limit; $sort = null != $this->input->post('sort') ? $this->input->post('sort') : null; $wildcard = null != $this->input->post('searchPhrase') ? $this->input->post('searchPhrase') : null; $removed_only = null !== $this->input->post('removedOnly') ? $this->input->post('removedOnly') : false; $total = $this->Member->get_all(0, 0, null, $removed_only)->num_rows(); if (null != $wildcard) { $members = $this->Member->like($wildcard, $start_from, $limit, $sort, $removed_only)->result_array(); $total = $this->Member->like($wildcard, 0, 0, null, $removed_only)->num_rows(); } else { $members = $this->Member->get_all($start_from, $limit, $sort, $removed_only)->result_array(); } foreach ($members as $key => $member) { $group = null; if (null != $member['groups']) { $group = $this->Group->find(explodetoarray($member['groups'])); } $groups_name_arr = []; $groups_id_arr = []; if (is_array($group)) { foreach ($group as $group_single) { $groups_name_arr[] = $group_single->groups_name; $groups_id_arr[] = $group_single->groups_id; } } $level = ''; if (null !== $member['level']) { $level = $this->Level->find(explodetoarray($member['level'])); } $levels_name_arr = []; $levels_id_arr = []; if (is_array($level)) { foreach ($level as $level_single) { $levels_name_arr[] = $level_single->levels_name; $levels_id_arr[] = $level_single->levels_id; } } $type = ''; if (null !== $member['type']) { $type = $this->Type->find(explodetoarray($member['type'])); } $types_name_arr = []; $types_id_arr = []; if (is_array($type)) { foreach ($type as $type_single) { $types_name_arr[] = $type_single->types_name; $types_id_arr[] = $type_single->types_id; } } $bootgrid_arr[] = array('count_id' => $key + 1 + $start_from, 'id' => $member['id'], 'avatar' => '<img src=\'' . $member['avatar'] . '\' />', 'stud_no' => $member['stud_no'], 'fullname' => arraytostring([$member['firstname'], $member['middlename'] ? substr($member['middlename'], 0, 1) . '.' : '', $member['lastname']], ' '), 'level' => $levels_name_arr ? arraytostring($levels_name_arr, ", ") : '', 'levels_id' => $levels_id_arr ? $levels_id_arr : '', 'type' => $types_name_arr ? arraytostring($types_name_arr, ", ") : '', 'types_id' => $types_id_arr ? $types_id_arr : '', 'address' => arraytostring([$member['address_blockno'], $member['address_street'], $member['address_brgy'], $member['address_city'], $member['address_zip']]), 'telephone' => $member['telephone'], 'msisdn' => $member['msisdn'], 'email' => $member['email'], 'groups' => $groups_name_arr ? arraytostring($groups_name_arr, ", ") : '', 'groups_id' => $groups_id_arr ? $groups_id_arr : ''); } $data = array("current" => intval($current), "rowCount" => $limit, "searchPhrase" => $wildcard, "total" => intval($total), "rows" => $bootgrid_arr, "trash" => array("count" => $this->Member->get_all(0, 0, null, true)->num_rows())); echo json_encode($data); exit; } }